Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch main Excluding Merge-Ins
This is equivalent to a diff from 32a9cba0 to e2d54968
2024-05-14
| ||
17:17 | merge trunk check-in: eda7d647 user: dgp tags: core-9-0-b2-rc | |
10:37 | Merge 9.0 Leaf check-in: 027db524 user: jan.nijtmans tags: revised_text, tip-466 | |
2024-05-13
| ||
19:23 | Merge 8.7 Leaf check-in: e2d54968 user: jan.nijtmans tags: trunk, main | |
19:14 | Merge 8.6, which means some more Tk_GetPixelsFromObj() improvements Leaf check-in: fe606133 user: jan.nijtmans tags: core-8-branch | |
13:46 | Merge 8.7 check-in: a06c63fa user: jan.nijtmans tags: trunk, main | |
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 36 37 38 39 | */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 unix/tk.pc unix/Tk-Info.plist unix/Wish-Info.plist unix/Credits.html |
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 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 | name: Linux on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" 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" config: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-shared" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl 8.6 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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.config }} COMPILER: ${{ matrix.compiler }} OPTS: ${{ matrix.compiler }}${{ matrix.config }} - 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.config }}) 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@v4 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@v4 with: name: Tk ${{ env.VERSION }} HTML documentation (snapshot) path: /tmp/dist/tk*/html test: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" config: - "" - "--disable-xft" - "--enable-symbols" steps: - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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.config }} 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.config }} 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 } timeout-minutes: 10 |
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 | name: Linux (with Tcl 8.7) on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" 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@v4 with: path: tk - name: Checkout Tcl uses: actions/checkout@v4 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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 } test: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" cfgopt: - "" - "--disable-xft" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl uses: actions/checkout@v4 with: repository: tcltk/tcl ref: core-8-branch path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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 } timeout-minutes: 15 |
Added .github/workflows/linux-with-tcl91-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 | name: Linux (with Tcl 9.1) on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" 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@v4 with: path: tk - name: Checkout Tcl uses: actions/checkout@v4 with: repository: tcltk/tcl ref: tip-626 path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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 } test: runs-on: ubuntu-22.04 strategy: matrix: compiler: - "gcc" cfgopt: - "" - "--disable-xft" - "--enable-symbols" steps: - name: Checkout uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl uses: actions/checkout@v4 with: repository: tcltk/tcl ref: tip-626 path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | sudo apt-get install libxss-dev libxft-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 } timeout-minutes: 15 |
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 165 166 167 168 169 170 171 | name: macOS on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" permissions: contents: read env: ERROR_ON_FAILURES: 1 jobs: xcode: runs-on: macos-11 defaults: run: shell: bash working-directory: tk/macosx steps: - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Check out Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main 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 timeout-minutes: 30 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: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Check out Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main 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 run: | ./configure $CFGOPT --disable-zipfs "--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 }}) run: | ./configure $CFGOPT --disable-zipfs "--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 } timeout-minutes: 20 - 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 216 217 218 219 220 221 222 | name: Build Binaries on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" 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@v4 with: path: tk - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main path: tcl - name: Setup Environment run: | sudo apt-get install libxss-dev libxft-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 --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/wish9.0 ${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@v4 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 steps: - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main path: tcl - name: Checkout create-dmg uses: actions/checkout@v4 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 arm64" >> $GITHUB_ENV working-directory: "." - name: Configure Tcl run: | ./configure $CFGOPT --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@v4 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@v4 with: path: tk - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main 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 --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@v4 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 168 169 170 171 172 173 174 175 176 177 178 | name: Windows on: push: branches: - "main" - "core-8-branch" - "core-8-6-branch" tags: - "core-**" 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: config: - "" - "OPTS=symbols" - "OPTS=static" steps: - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main 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 (${{ matrix.config }}) run: | &nmake -f makefile.vc release install ${{ matrix.config }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } working-directory: tcl/win - name: Build Tk (${{ matrix.config }}) run: | &nmake -f makefile.vc all ${{ matrix.config }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Build Test Harness (${{ matrix.config }}) run: | &nmake -f makefile.vc tktest ${{ matrix.config }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Run Tk Tests (${{ matrix.config }}) run: | nmake -f makefile.vc test-classic ${{ matrix.config }} | tee out-classic.txt || { echo "::error::Failure during Test" exit 1 } nmake -f makefile.vc test-ttk ${{ matrix.config }} | 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 timeout-minutes: 10 - name: Build Help (${{ matrix.config }}) run: | &nmake -f makefile.vc htmlhelp ${{ matrix.config }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } - name: Install (${{ matrix.config }}) run: | &nmake -f makefile.vc install ${{ matrix.config }} if ($lastexitcode -ne 0) { throw "nmake exit code: $lastexitcode" } gcc: runs-on: windows-2019 defaults: run: shell: msys2 {0} working-directory: win strategy: matrix: config: - "" - "--enable-symbols=mem" - "--enable-symbols=all" - "--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@v4 - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl ref: main 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 (${{ matrix.config }}) 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 ${{ matrix.config }} working-directory: tcl/win - name: Configure Tk (${{ matrix.config }}) 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 ${{ matrix.config }} - 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 } timeout-minutes: 10 |
Changes to .gitignore.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | *.res *.sl *.so .fslckout Makefile Tk-Info.plist Wish-Info.plist autom4te.cache config.cache config.log config.status config.status.lineno html manifest.uuid _FOSSIL_ */tkConfig.sh */wish* | > | | | > | 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 | *.res *.sl *.so .fslckout Makefile Tk-Info.plist Wish-Info.plist Credits.html autom4te.cache config.cache config.log 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 .project.
1 2 | <?xml version="1.0" encoding="UTF-8"?> <projectDescription> | | | 1 2 3 4 5 6 7 8 9 10 | <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>tk9.0</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> |
︙ | ︙ |
Deleted .travis.yml.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted ChangeLog.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted ChangeLog.2002.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted ChangeLog.2004.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted ChangeLog.2007.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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 44 45 46 47 | # README: Tk This is the **Tk 9.0b2** 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=core-8-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Linux%22+branch%3Acore-8-branch) [![Build Status](https://github.com/tcltk/tk/workflows/Windows/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22Windows%22+branch%3Acore-8-branch) [![Build Status](https://github.com/tcltk/tk/workflows/macOS/badge.svg?branch=core-8-branch)](https://github.com/tcltk/tk/actions?query=workflow%3A%22macOS%22+branch%3Acore-8-branch) 9.0 (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 9.0 Web page](https://www.tcl-lang.org/software/tcltk/9.0.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 |
︙ | ︙ |
Deleted changes.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added changes.md.
> | 1 | TODO |
Deleted compat/stdint.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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 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) 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, Tk_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 Tk_3DBorder \fBTk_Alloc3DBorderFromObj\fR(\fIinterp, tkwin, objPtr\fR) .sp \fBTk_ClipDrawableToRect\fR(\fIdisplay, drawable, x, y, width, height\fR) .sp \fBTk_DrawHighlightBorder\fR(\fItkwin, fgGC, bgGC, highlightWidth, drawable\fR) .sp Tk_3DBorder \fBTk_Get3DBorder\fR(\fIinterp, tkwin, colorName\fR) .sp \fBTk_Get3DBorderColors\fR(\fIborder, bgColorPtr, darkColorPtr, lightColorPtr\fR) .sp Tk_3DBorder \fBTk_Get3DBorderFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_Draw3DRectangle\fR(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fR) .sp \fBTk_Fill3DRectangle\fR(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fR) .sp \fBTk_Draw3DPolygon\fR(\fItkwin, drawable, border, pointPtr, numPoints, polyBorderWidth, leftRelief\fR) .sp \fBTk_Fill3DPolygon\fR(\fItkwin, drawable, border, pointPtr, numPoints, polyBorderWidth, leftRelief\fR) .sp \fBTk_3DVerticalBevel\fR(\fItkwin, drawable, border, x, y, width, height, leftBevel, relief\fR) .sp \fBTk_3DHorizontalBevel\fR(\fItkwin, drawable, border, x, y, width, height, leftIn, rightIn, topBevel, relief\fR) .sp \fBTk_SetBackgroundFromBorder\fR(\fItkwin, border\fR) .sp const char * \fBTk_NameOf3DBorder\fR(\fIborder\fR) .sp XColor * \fBTk_3DBorderColor\fR(\fIborder\fR) .sp GC * \fBTk_3DBorderGC\fR(\fItkwin, border, which\fR) .sp \fBTk_Free3DBorderFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_Free3DBorder\fR(\fIborder\fR) .fi .SH ARGUMENTS .AS "Tk_3DBorder" borderWidth .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window (for all procedures except \fBTk_Get3DBorder\fR, must be the window for which the border was allocated). |
︙ | ︙ | |||
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. | > > > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 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 | > > > > > > > > > > > > | 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 | 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 | > > > > > > > > > > > > > > > > | 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 | 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 \fId\fR to the given rectangle. If \fIwidth\fR or \fIheight\fR are negative, reset to no clipping. Subsequent drawing into \fId\fR 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 |
︙ | ︙ | |||
188 189 190 191 192 193 194 | \fIwidth\fR and \fIheight\fR are the dimensions of the window), and \fIborderWidth\fR specifies the number of pixels actually occupied by the border. The \fIrelief\fR argument indicates which of several three-dimensional effects is desired: \fBTK_RELIEF_RAISED\fR means that the interior of the rectangle should appear raised relative to the exterior of the rectangle, and \fBTK_RELIEF_SUNKEN\fR means that the interior should appear depressed. | | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | \fIwidth\fR and \fIheight\fR are the dimensions of the window), and \fIborderWidth\fR specifies the number of pixels actually occupied by the border. The \fIrelief\fR argument indicates which of several three-dimensional effects is desired: \fBTK_RELIEF_RAISED\fR means that the interior of the rectangle should appear raised relative to the exterior of the rectangle, and \fBTK_RELIEF_SUNKEN\fR means that the interior should appear depressed. \fBTK_RELIEF_GROOVE\fR and \fBTK_RELIEF_RIDGE\fR mean that there should appear to be a groove or ridge around the exterior of the rectangle. .PP \fBTk_Fill3DRectangle\fR is somewhat like \fBTk_Draw3DRectangle\fR except that it first fills the rectangular area with the background color (one corresponding to the color used to create \fIborder\fR). Then it calls \fBTk_Draw3DRectangle\fR to draw a border just inside the outer edge of the rectangular area. The argument \fIrelief\fR indicates the desired |
︙ | ︙ | |||
287 288 289 290 291 292 293 | with the window and color name used to create the border; for \fBTk_Free3DBorder\fR the border to release is specified with the Tk_3DBorder token for the border. There should be exactly one call to \fBTk_Free3DBorderFromObj\fR or \fBTk_Free3DBorder\fR for each call to \fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. .SH KEYWORDS | | > | 318 319 320 321 322 323 324 325 326 | with the window and color name used to create the border; for \fBTk_Free3DBorder\fR the border to release is specified with the Tk_3DBorder token for the border. There should be exactly one call to \fBTk_Free3DBorderFromObj\fR or \fBTk_Free3DBorder\fR for each call to \fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. .SH KEYWORDS 3D, background, border, color, depressed, illumination, value, polygon, raised, shadow, three-dimensional effect |
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 60 61 62 | '\" '\" 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 Tcl_Obj * \fBTk_GetSystemDefault\fR(\fItkwin, dbName, className\fR) .fi .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 (100). Some common priority values are: .IP \fBTK_WIDGET_DEFAULT_PRIO\fR (20) Used for default values hard-coded into widgets. .IP \fBTK_STARTUP_FILE_PRIO\fR (40) Used for options specified in application-specific startup files. .IP \fBTK_USER_DEFAULT_PRIO\fR (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 \fBTK_INTERACTIVE_PRIO\fR (80) Used for options specified interactively after the application starts running. .PP \fBTk_GetSystemDefault\fR returns a Tcl_Obj* with the string identifying a configuration option matching the given \fIdbname\fR and \fIclassName\fR. Returns NULL if there are no system defaults that match this pair. .SH KEYWORDS class, name, option, add |
Changes to doc/BindTable.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_CreateBindingTable, Tk_DeleteBindingTable, Tk_CreateBinding, Tk_DeleteBinding, Tk_GetBinding, Tk_GetAllBindings, Tk_DeleteAllBindings, Tk_BindEvent \- invoke scripts in response to X events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_BindingTable | | | | | | | | | > | | | | 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 | .SH NAME Tk_CreateBindingTable, Tk_DeleteBindingTable, Tk_CreateBinding, Tk_DeleteBinding, Tk_GetBinding, Tk_GetAllBindings, Tk_DeleteAllBindings, Tk_BindEvent \- invoke scripts in response to X events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_BindingTable \fBTk_CreateBindingTable\fR(\fIinterp\fR) .sp \fBTk_DeleteBindingTable\fR(\fIbindingTable\fR) .sp unsigned long \fBTk_CreateBinding\fR(\fIinterp, bindingTable, object, eventString, script, append\fR) .sp int \fBTk_DeleteBinding\fR(\fIinterp, bindingTable, object, eventString\fR) .sp const char * \fBTk_GetBinding\fR(\fIinterp, bindingTable, object, eventString\fR) .sp \fBTk_GetAllBindings\fR(\fIinterp, bindingTable, object\fR) .sp \fBTk_DeleteAllBindings\fR(\fIbindingTable, object\fR) .sp \fBTk_BindEvent\fR(\fIbindingTable, eventPtr, tkwin, numObjects, objectPtr\fR) .fi .SH ARGUMENTS .AS Tk_BindingTable bindingTable .AP Tcl_Interp *interp in Interpreter to use when invoking bindings in binding table. Also used for returning results and errors from binding procedures. .AP Tk_BindingTable bindingTable in Token for binding table; must have been returned by some previous call to \fBTk_CreateBindingTable\fR. .AP "void *" object in Identifies object with which binding is associated. .AP "const char" *eventString in String describing event sequence. .AP "const char" *script in Tcl script to invoke when binding triggers. .AP int append in Non-zero means append \fIscript\fR to existing script for binding, if any; zero means replace existing script with new one. .AP XEvent *eventPtr in X event to match against bindings in \fIbindingTable\fR. .AP Tk_Window tkwin in Identifier for any window on the display where the event occurred. Used to find display-related information such as key maps. .AP Tcl_Size numObjects in Number of object identifiers pointed to by \fIobjectPtr\fR. .AP "void **" objectPtr in Points to an array of object identifiers: bindings will be considered for each of these objects in order from first to last. .BE .SH DESCRIPTION .PP These procedures provide a general-purpose mechanism for creating and invoking bindings. |
︙ | ︙ |
Changes to doc/CanvPsY.3.
︙ | ︙ | |||
25 26 27 28 29 30 31 32 | int \fBTk_CanvasPsFont\fR(\fIinterp, canvas, tkFont\fR) .sp \fBTk_CanvasPsPath\fR(\fIinterp, canvas, coordPtr, numPoints\fR) .sp int \fBTk_CanvasPsStipple\fR(\fIinterp, canvas, bitmap\fR) .SH ARGUMENTS | > | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | int \fBTk_CanvasPsFont\fR(\fIinterp, canvas, tkFont\fR) .sp \fBTk_CanvasPsPath\fR(\fIinterp, canvas, coordPtr, numPoints\fR) .sp int \fBTk_CanvasPsStipple\fR(\fIinterp, canvas, bitmap\fR) .fi .SH ARGUMENTS .AS Tcl_Size "numPoints" .AP Tk_Canvas canvas in A token that identifies a canvas widget for which Postscript is being generated. .AP double canvasY in Y-coordinate in the space of the canvas. .AP Tcl_Interp *interp in/out A Tcl interpreter; Postscript is appended to its result, or the |
︙ | ︙ | |||
54 55 56 57 58 59 60 | .AP Tk_Font tkFont in Font for which Postscript is to be generated. .AP double *coordPtr in Pointer to an array of coordinates for one or more points specified in canvas coordinates. The order of values in \fIcoordPtr\fR is x1, y1, x2, y2, x3, y3, and so on. | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | .AP Tk_Font tkFont in Font for which Postscript is to be generated. .AP double *coordPtr in Pointer to an array of coordinates for one or more points specified in canvas coordinates. The order of values in \fIcoordPtr\fR is x1, y1, x2, y2, x3, y3, and so on. .AP Tcl_Size numPoints in Number of points at \fIcoordPtr\fR. .BE .SH DESCRIPTION .PP These procedures are called by canvas type managers to carry out common functions related to generating Postscript. Most of the procedures take a \fIcanvas\fR argument, which |
︙ | ︙ |
Changes to doc/CanvTkwin.3.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | \fBTk_CanvasWindowCoords\fR(\fIcanvas, x, y, screenXPtr, screenYPtr\fR) .sp \fBTk_CanvasEventuallyRedraw\fR(\fIcanvas, x1, y1, x2, y2\fR) .sp Tk_OptionParseProc *\fBTk_CanvasTagsParseProc\fR; .sp Tk_OptionPrintProc *\fBTk_CanvasTagsPrintProc\fR; .SH ARGUMENTS .AS Tk_ItemType *drawableXPtr .AP Tk_Canvas canvas in A token that identifies a canvas widget. .AP Tcl_Interp *interp in/out Interpreter to use for error reporting. .AP "const char" *string in | > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | \fBTk_CanvasWindowCoords\fR(\fIcanvas, x, y, screenXPtr, screenYPtr\fR) .sp \fBTk_CanvasEventuallyRedraw\fR(\fIcanvas, x1, y1, x2, y2\fR) .sp Tk_OptionParseProc *\fBTk_CanvasTagsParseProc\fR; .sp Tk_OptionPrintProc *\fBTk_CanvasTagsPrintProc\fR; .fi .SH ARGUMENTS .AS Tk_ItemType *drawableXPtr .AP Tk_Canvas canvas in A token that identifies a canvas widget. .AP Tcl_Interp *interp in/out Interpreter to use for error reporting. .AP "const char" *string in |
︙ | ︙ | |||
145 146 147 148 149 150 151 | .CS static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { ... | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | .CS static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { ... {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, ... }; .CE .SH KEYWORDS canvas, focus, item type, redisplay, selection, type manager |
Changes to doc/CanvTxtInfo.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | Tk_CanvasTextInfo \- additional information for managing text items in canvases .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_CanvasTextInfo * \fBTk_CanvasGetTextInfo\fR(\fIcanvas\fR) .SH ARGUMENTS .AS Tk_Canvas canvas .AP Tk_Canvas canvas in A token that identifies a particular canvas widget. .BE .SH DESCRIPTION .PP Textual canvas items are somewhat more complicated to manage than other items, due to things like the selection and the input focus. \fBTk_CanvasGetTextInfo\fR may be invoked by a type manager to obtain additional information needed for items that display text. The return value from \fBTk_CanvasGetTextInfo\fR is a pointer to a structure that is shared between Tk and all the items that display text. The structure has the following form: .CS | > | | 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 | Tk_CanvasTextInfo \- additional information for managing text items in canvases .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_CanvasTextInfo * \fBTk_CanvasGetTextInfo\fR(\fIcanvas\fR) .fi .SH ARGUMENTS .AS Tk_Canvas canvas .AP Tk_Canvas canvas in A token that identifies a particular canvas widget. .BE .SH DESCRIPTION .PP Textual canvas items are somewhat more complicated to manage than other items, due to things like the selection and the input focus. \fBTk_CanvasGetTextInfo\fR may be invoked by a type manager to obtain additional information needed for items that display text. The return value from \fBTk_CanvasGetTextInfo\fR is a pointer to a structure that is shared between Tk and all the items that display text. The structure has the following form: .CS typedef struct { Tk_3DBorder \fIselBorder\fR; int \fIselBorderWidth\fR; XColor *\fIselFgColorPtr\fR; Tk_Item *\fIselItemPtr\fR; int \fIselectFirst\fR; int \fIselectLast\fR; Tk_Item *\fIanchorItemPtr\fR; |
︙ | ︙ |
Changes to doc/Clipboard.3.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | \fB#include <tk.h>\fR .sp int \fBTk_ClipboardClear\fR(\fIinterp, tkwin\fR) .sp int \fBTk_ClipboardAppend\fR(\fIinterp, tkwin, target, format, buffer\fR) .SH ARGUMENTS .AS Tk_ClipboardClear tkwin .AP Tcl_Interp *interp in Interpreter to use for reporting errors. .AP Tk_Window tkwin in Window that determines which display's clipboard to manipulate. .AP Atom target in | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | \fB#include <tk.h>\fR .sp int \fBTk_ClipboardClear\fR(\fIinterp, tkwin\fR) .sp int \fBTk_ClipboardAppend\fR(\fIinterp, tkwin, target, format, buffer\fR) .fi .SH ARGUMENTS .AS Tk_ClipboardClear tkwin .AP Tcl_Interp *interp in Interpreter to use for reporting errors. .AP Tk_Window tkwin in Window that determines which display's clipboard to manipulate. .AP Atom target in |
︙ | ︙ |
Changes to doc/ClrSelect.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_ClearSelection \- Deselect a selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ClearSelection\fR(\fItkwin, selection\fR) .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in The selection will be cleared from the display containing this window. .AP Atom selection in The name of selection to be cleared. | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_ClearSelection \- Deselect a selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ClearSelection\fR(\fItkwin, selection\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in The selection will be cleared from the display containing this window. .AP Atom selection in The name of selection to be cleared. |
︙ | ︙ |
Changes to doc/ConfigWidg.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_ConfigureWidget, Tk_ConfigureInfo, Tk_ConfigureValue, Tk_FreeOptions \- process configuration options for widgets .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | | > | | | | | 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 | .SH NAME Tk_ConfigureWidget, Tk_ConfigureInfo, Tk_ConfigureValue, Tk_FreeOptions \- process configuration options for widgets .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_ConfigureWidget\fR(\fIinterp, tkwin, specs, objc, objv, widgRec, flags\fR) .sp int \fBTk_ConfigureInfo\fR(\fIinterp, tkwin, specs, widgRec, argvName, flags\fR) .sp int \fBTk_ConfigureValue\fR(\fIinterp, tkwin, specs, widgRec, argvName, flags\fR) .sp \fBTk_FreeOptions\fR(\fIspecs, widgRec, display, flags\fR) .fi .SH ARGUMENTS .AS void *widgRec in/out .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in Window used to represent widget (needed to set up X resources). .AP "const Tk_ConfigSpec" *specs in Pointer to table specifying legal configuration options for this widget. .AP Tcl_Size objc in Number of arguments in \fIobjv\fR. .AP "Tcl_Obj *const *" objv in Command-line options for configuring widget. .AP char *widgRec in/out Points to widget record structure. Fields in this structure get modified by \fBTk_ConfigureWidget\fR to hold configuration information. .AP int flags in If non-zero, then it specifies an OR-ed combination of flags that control the processing of configuration information. |
︙ | ︙ | |||
58 59 60 61 62 63 64 | options. .AP Display *display in Display containing widget whose record is being freed; needed in order to free up resources. .BE .SH DESCRIPTION .PP | | | | | | | | 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 | options. .AP Display *display in Display containing widget whose record is being freed; needed in order to free up resources. .BE .SH DESCRIPTION .PP Note that \fBTk_ConfigureWidget\fR should be replaced with the new \fBTcl_Obj\fR based API, \fBTk_SetOptions\fR. The old interface is retained for backward compatibility. .PP \fBTk_ConfigureWidget\fR is called to configure various aspects of a widget, such as colors, fonts, border width, etc. It is intended as a convenience procedure to reduce the amount of code that must be written in individual widget managers to handle configuration information. It is typically invoked when widgets are created, and again when the \fBconfigure\fR command is invoked for a widget. Although intended primarily for widgets, \fBTk_ConfigureWidget\fR can be used in other situations where \fIobjc-objv\fR information is to be used to fill in a record structure, such as configuring graphical elements for a canvas widget or entries of a menu. .PP \fBTk_ConfigureWidget\fR processes a table specifying the configuration options that are supported (\fIspecs\fR) and a collection of command-line arguments (\fIobjc\fR and \fIobjv\fR) to fill in fields of a record (\fIwidgRec\fR). It uses the option database and defaults specified in \fIspecs\fR to fill in fields of \fIwidgRec\fR that are not specified in \fIobjv\fR. \fBTk_ConfigureWidget\fR normally returns the value \fBTCL_OK\fR; in this case it does not modify \fIinterp\fR. If an error occurs then \fBTCL_ERROR\fR is returned and \fBTk_ConfigureWidget\fR will leave an error message in interpreter \fIinterp\fR's result in the standard Tcl fashion. In the event of an error return, some of the fields of \fIwidgRec\fR |
︙ | ︙ | |||
116 117 118 119 120 121 122 | (e.g. \fBTK_CONFIG_COLOR\fR for a color value, or \fBTK_CONFIG_INT\fR for an integer value). The \fItype\fR field indicates how to use the value of the option (more on this below). The \fIargvName\fR field is a string such as .QW \-font or .QW \-bg , | | | | | | | 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 | (e.g. \fBTK_CONFIG_COLOR\fR for a color value, or \fBTK_CONFIG_INT\fR for an integer value). The \fItype\fR field indicates how to use the value of the option (more on this below). The \fIargvName\fR field is a string such as .QW \-font or .QW \-bg , which is compared with the values in \fIobjv\fR (if \fIargvName\fR is NULL it means this is a grouped entry; see \fBGROUPED ENTRIES\fR below). The \fIdbName\fR and \fIdbClass\fR fields are used to look up a value for this option in the option database. The \fIdefValue\fR field specifies a default value for this configuration option if no value is specified in either \fIobjv\fR or the option database. \fIOffset\fR indicates where in \fIwidgRec\fR to store information about this option, and \fIspecFlags\fR contains additional information to control the processing of this configuration option (see FLAGS below). The last field, \fIcustomPtr\fR, is only used if \fItype\fR is \fBTK_CONFIG_CUSTOM\fR; see CUSTOM OPTION TYPES below. .PP \fBTk_ConfigureWidget\fR first processes \fIobjv\fR to see which (if any) configuration options are specified there. \fIArgv\fR must contain an even number of fields; the first of each pair of fields must match the \fIargvName\fR of some entry in \fIspecs\fR (unique abbreviations are acceptable), and the second field of the pair contains the value for that configuration option. If there are entries in \fIspec\fR for which there were no matching entries in \fIobjv\fR, \fBTk_ConfigureWidget\fR uses the \fIdbName\fR and \fIdbClass\fR fields of the \fIspecs\fR entry to probe the option database; if a value is found, then it is used as the value for the option. Finally, if no entry is found in the option database, the \fIdefValue\fR field of the \fIspecs\fR entry is used as the value for the configuration option. If the \fIdefValue\fR is NULL, or if the \fBTK_CONFIG_DONT_SET_DEFAULT\fR bit is set in \fIflags\fR, then there is no default value and this \fIspecs\fR entry will be ignored if no value is specified in \fIobjv\fR or the option database. .PP Once a string value has been determined for a configuration option, \fBTk_ConfigureWidget\fR translates the string value into a more useful form, such as a color if \fItype\fR is \fBTK_CONFIG_COLOR\fR or an integer if \fItype\fR is \fBTK_CONFIG_INT\fR. This value is then stored in the record pointed to by \fIwidgRec\fR. This record is assumed to |
︙ | ︙ | |||
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 | in the descriptions below. .PP The \fItype\fR field of each entry in \fIspecs\fR determines what to do with the string value of that configuration option. The legal values for \fItype\fR, and the corresponding actions, are: .TP \fBTK_CONFIG_ACTIVE_CURSOR\fR The value must be an ASCII string identifying a cursor in a form suitable for passing to \fBTk_GetCursor\fR. The value is converted to a \fBTk_Cursor\fR by calling \fBTk_GetCursor\fR and the result is stored in the target. In addition, the resulting cursor is made the active cursor for \fItkwin\fR by calling \fBXDefineCursor\fR. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target and \fItkwin\fR's active cursor will be set to \fBNone\fR. If the previous value of the target was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeCursor\fR. .TP \fBTK_CONFIG_ANCHOR\fR The value must be an ASCII string identifying an anchor point in one of the ways accepted by \fBTk_GetAnchor\fR. The string is converted to a \fBTk_Anchor\fR by calling \fBTk_GetAnchor\fR and the result is stored in the target. .TP \fBTK_CONFIG_BITMAP\fR The value must be an ASCII string identifying a bitmap in a form suitable for passing to \fBTk_GetBitmap\fR. The value is converted to a \fBPixmap\fR by calling \fBTk_GetBitmap\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target is set to \fBNone\fR. If the previous value of the target was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeBitmap\fR. .TP \fBTK_CONFIG_BOOLEAN\fR The value must be an ASCII string specifying a boolean value. Any of the values .QW true , .QW yes , .QW on , or .QW 1 , or an abbreviation of one of these values, means true; any of the values .QW false , .QW no , .QW off , or .QW 0 , or an abbreviation of one of these values, means false. The target is expected to be an integer; for true values it will be set to 1 and for false values it will be set to 0. .TP \fBTK_CONFIG_BORDER\fR The value must be an ASCII string identifying a border color in a form suitable for passing to \fBTk_Get3DBorder\fR. The value is converted to a (\fBTk_3DBorder *\fR) by calling \fBTk_Get3DBorder\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to NULL. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_Free3DBorder\fR. .TP \fBTK_CONFIG_CAP_STYLE\fR The value must be an ASCII string identifying a cap style in one of the ways accepted by \fBTk_GetCapStyle\fR. The string is converted to an integer value corresponding to the cap style by calling \fBTk_GetCapStyle\fR and the result is stored in the target. .TP \fBTK_CONFIG_COLOR\fR The value must be an ASCII string identifying a color in a form suitable for passing to \fBTk_GetColor\fR. The value is converted to an (\fBXColor *\fR) by calling \fBTk_GetColor\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to \fBNone\fR. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_FreeColor\fR. .TP \fBTK_CONFIG_CURSOR\fR This option is identical to \fBTK_CONFIG_ACTIVE_CURSOR\fR except that the new cursor is not made the active one for \fItkwin\fR. .TP \fBTK_CONFIG_CUSTOM\fR This option allows applications to define new option types. The \fIcustomPtr\fR 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_CONFIG_DOUBLE\fR The value must be an ASCII floating-point number in the format accepted by \fBstrtol\fR. The string is converted to a \fBdouble\fR value, and the value is stored in the target. .TP \fBTK_CONFIG_END\fR Marks the end of the table. The last entry in \fIspecs\fR must have this type; all of its other fields are ignored and it will never match any arguments. .TP \fBTK_CONFIG_FONT\fR The value must be an ASCII string identifying a font in a form suitable for passing to \fBTk_GetFont\fR. The value is converted to a \fBTk_Font\fR by calling \fBTk_GetFont\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to NULL. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_FreeFont\fR. .TP \fBTK_CONFIG_INT\fR The value must be an ASCII integer string in the format accepted by \fBstrtol\fR (e.g. .QW 0 and .QW 0x prefixes may be used to specify octal or hexadecimal numbers, respectively). The string is converted to an integer value and the integer is stored in the target. .TP \fBTK_CONFIG_JOIN_STYLE\fR The value must be an ASCII string identifying a join style in one of the ways accepted by \fBTk_GetJoinStyle\fR. The string is converted to an integer value corresponding to the join style by calling \fBTk_GetJoinStyle\fR and the result is stored in the target. .TP \fBTK_CONFIG_JUSTIFY\fR The value must be an ASCII string identifying a justification method in one of the ways accepted by \fBTk_GetJustify\fR. The string is converted to a \fBTk_Justify\fR by calling \fBTk_GetJustify\fR and the result is stored in the target. .TP \fBTK_CONFIG_MM\fR The value must specify a screen distance in one of the forms acceptable to \fBTk_GetScreenMM\fR. The string is converted to double-precision floating-point distance in millimeters and the value is stored in the target. .TP \fBTK_CONFIG_PIXELS\fR The value must specify screen units in one of the forms acceptable to \fBTk_GetPixels\fR. The string is converted to an integer distance in pixels and the value is stored in the target. .TP \fBTK_CONFIG_RELIEF\fR The value must be an ASCII string identifying a relief in a form suitable for passing to \fBTk_GetRelief\fR. The value is converted to an integer relief value by calling \fBTk_GetRelief\fR and the result is stored in the target. .TP \fBTK_CONFIG_STRING\fR | > > > > > > > > > > > > > > > > > > < > | > | | | > > | 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 | in the descriptions below. .PP The \fItype\fR field of each entry in \fIspecs\fR determines what to do with the string value of that configuration option. The legal values for \fItype\fR, and the corresponding actions, are: .TP \fBTK_CONFIG_ACTIVE_CURSOR\fR . The value must be an ASCII string identifying a cursor in a form suitable for passing to \fBTk_GetCursor\fR. The value is converted to a \fBTk_Cursor\fR by calling \fBTk_GetCursor\fR and the result is stored in the target. In addition, the resulting cursor is made the active cursor for \fItkwin\fR by calling \fBXDefineCursor\fR. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target and \fItkwin\fR's active cursor will be set to \fBNone\fR. If the previous value of the target was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeCursor\fR. .TP \fBTK_CONFIG_ANCHOR\fR . The value must be an ASCII string identifying an anchor point in one of the ways accepted by \fBTk_GetAnchor\fR. The string is converted to a \fBTk_Anchor\fR by calling \fBTk_GetAnchor\fR and the result is stored in the target. .TP \fBTK_CONFIG_BITMAP\fR . The value must be an ASCII string identifying a bitmap in a form suitable for passing to \fBTk_GetBitmap\fR. The value is converted to a \fBPixmap\fR by calling \fBTk_GetBitmap\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target is set to \fBNone\fR. If the previous value of the target was not \fBNone\fR, then it is freed by passing it to \fBTk_FreeBitmap\fR. .TP \fBTK_CONFIG_BOOLEAN\fR . The value must be an ASCII string specifying a boolean value. Any of the values .QW true , .QW yes , .QW on , or .QW 1 , or an abbreviation of one of these values, means true; any of the values .QW false , .QW no , .QW off , or .QW 0 , or an abbreviation of one of these values, means false. The target is expected to be an integer; for true values it will be set to 1 and for false values it will be set to 0. .TP \fBTK_CONFIG_BORDER\fR . The value must be an ASCII string identifying a border color in a form suitable for passing to \fBTk_Get3DBorder\fR. The value is converted to a (\fBTk_3DBorder *\fR) by calling \fBTk_Get3DBorder\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to NULL. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_Free3DBorder\fR. .TP \fBTK_CONFIG_CAP_STYLE\fR . The value must be an ASCII string identifying a cap style in one of the ways accepted by \fBTk_GetCapStyle\fR. The string is converted to an integer value corresponding to the cap style by calling \fBTk_GetCapStyle\fR and the result is stored in the target. .TP \fBTK_CONFIG_COLOR\fR . The value must be an ASCII string identifying a color in a form suitable for passing to \fBTk_GetColor\fR. The value is converted to an (\fBXColor *\fR) by calling \fBTk_GetColor\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to \fBNone\fR. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_FreeColor\fR. .TP \fBTK_CONFIG_CURSOR\fR . This option is identical to \fBTK_CONFIG_ACTIVE_CURSOR\fR except that the new cursor is not made the active one for \fItkwin\fR. .TP \fBTK_CONFIG_CUSTOM\fR . This option allows applications to define new option types. The \fIcustomPtr\fR 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_CONFIG_DOUBLE\fR . The value must be an ASCII floating-point number in the format accepted by \fBstrtol\fR. The string is converted to a \fBdouble\fR value, and the value is stored in the target. .TP \fBTK_CONFIG_END\fR . Marks the end of the table. The last entry in \fIspecs\fR must have this type; all of its other fields are ignored and it will never match any arguments. .TP \fBTK_CONFIG_FONT\fR . The value must be an ASCII string identifying a font in a form suitable for passing to \fBTk_GetFont\fR. The value is converted to a \fBTk_Font\fR by calling \fBTk_GetFont\fR and the result is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to NULL. If the previous value of the target was not NULL, then it is freed by passing it to \fBTk_FreeFont\fR. .TP \fBTK_CONFIG_INT\fR . The value must be an ASCII integer string in the format accepted by \fBstrtol\fR (e.g. .QW 0 and .QW 0x prefixes may be used to specify octal or hexadecimal numbers, respectively). The string is converted to an integer value and the integer is stored in the target. .TP \fBTK_CONFIG_JOIN_STYLE\fR . The value must be an ASCII string identifying a join style in one of the ways accepted by \fBTk_GetJoinStyle\fR. The string is converted to an integer value corresponding to the join style by calling \fBTk_GetJoinStyle\fR and the result is stored in the target. .TP \fBTK_CONFIG_JUSTIFY\fR . The value must be an ASCII string identifying a justification method in one of the ways accepted by \fBTk_GetJustify\fR. The string is converted to a \fBTk_Justify\fR by calling \fBTk_GetJustify\fR and the result is stored in the target. .TP \fBTK_CONFIG_MM\fR . The value must specify a screen distance in one of the forms acceptable to \fBTk_GetScreenMM\fR. The string is converted to double-precision floating-point distance in millimeters and the value is stored in the target. .TP \fBTK_CONFIG_PIXELS\fR . The value must specify screen units in one of the forms acceptable to \fBTk_GetPixels\fR. The string is converted to an integer distance in pixels and the value is stored in the target. .TP \fBTK_CONFIG_RELIEF\fR . The value must be an ASCII string identifying a relief in a form suitable for passing to \fBTk_GetRelief\fR. The value is converted to an integer relief value by calling \fBTk_GetRelief\fR and the result is stored in the target. .TP \fBTK_CONFIG_STRING\fR . A copy of the value is made by allocating memory space with \fBTcl_Alloc\fR and copying the value into the dynamically-allocated space. A pointer to the new string is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR then the value may be an empty string, in which case the target will be set to NULL. If the previous value of the target was not NULL, then it is freed by passing it to \fBTcl_Free\fR. .TP \fBTK_CONFIG_SYNONYM\fR . This \fItype\fR value identifies special entries in \fIspecs\fR that are synonyms for other entries. If an \fIobjv\fR value matches the \fIargvName\fR of a \fBTK_CONFIG_SYNONYM\fR entry, the entry is not used directly. Instead, \fBTk_ConfigureWidget\fR searches \fIspecs\fR for another entry whose \fIargvName\fR is the same as the \fIdbName\fR field in the \fBTK_CONFIG_SYNONYM\fR entry; this new entry is used just as if its \fIargvName\fR had matched the \fIobjv\fR value. The synonym mechanism allows multiple \fIobjv\fR values to be used for a single configuration option, such as .QW \-background and .QW \-bg . .TP \fBTK_CONFIG_UID\fR . The value is translated to a \fBTk_Uid\fR (by passing it to \fBTk_GetUid\fR). The resulting value is stored in the target. If \fBTK_CONFIG_NULL_OK\fR is specified in \fIspecFlags\fR and the value is an empty string then the target will be set to NULL. .TP \fBTK_CONFIG_WINDOW\fR . The value must be a window path name. It is translated to a \fBTk_Window\fR token and the token is stored in the target. .SH "GROUPED ENTRIES" .PP In some cases it is useful to generate multiple resources from a single configuration value. For example, a color name might be used both to generate the background color for a widget (using |
︙ | ︙ | |||
377 378 379 380 381 382 383 | The \fIflags\fR argument passed to \fBTk_ConfigureWidget\fR is used in conjunction with the \fIspecFlags\fR fields in the entries of \fIspecs\fR to provide additional control over the processing of configuration options. These values are used in three different ways as described below. .PP First, if the \fIflags\fR argument to \fBTk_ConfigureWidget\fR has | | > | > > > > < < < < < < < < | 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 | The \fIflags\fR argument passed to \fBTk_ConfigureWidget\fR is used in conjunction with the \fIspecFlags\fR fields in the entries of \fIspecs\fR to provide additional control over the processing of configuration options. These values are used in three different ways as described below. .PP First, if the \fIflags\fR argument to \fBTk_ConfigureWidget\fR has the \fBTK_CONFIG_ARGV_ONLY\fR bit set (i.e., \fIflags\fR | \fBTK_CONFIG_ARGV_ONLY\fR != 0), then the option database and \fIdefValue\fR fields are not used. In this case, if an entry in \fIspecs\fR does not match a field in \fIobjv\fR then nothing happens: the corresponding target is not modified. This feature is useful when the goal is to modify certain configuration options while leaving others in their current state, such as when a \fBconfigure\fR widget command is being processed. .PP Second, the \fIspecFlags\fR field of an entry in \fIspecs\fR may be used to control the processing of that entry. Each \fIspecFlags\fR field may consists of an OR-ed combination of the following values: .TP \fBTK_CONFIG_COLOR_ONLY\fR . If this bit is set then the entry will only be considered if the display for \fItkwin\fR has more than one bit plane. If the display is monochromatic then this \fIspecs\fR entry will be ignored. .TP \fBTK_CONFIG_MONO_ONLY\fR . If this bit is set then the entry will only be considered if the display for \fItkwin\fR has exactly one bit plane. If the display is not monochromatic then this \fIspecs\fR entry will be ignored. .TP \fBTK_CONFIG_NULL_OK\fR . This bit is only relevant for some types of entries (see the descriptions of the various entry types above). If this bit is set, it indicates that an empty string value for the field is acceptable and if it occurs then the target should be set to NULL or \fBNone\fR, depending on the type of the target. This flag is typically used to allow a feature to be turned off entirely, e.g. set a cursor value to \fBNone\fR so that a window simply inherits its parent's cursor. If this bit is not set then empty strings are processed as strings, which generally results in an error. .TP \fBTK_CONFIG_DONT_SET_DEFAULT\fR . If this bit is one, it means that the \fIdefValue\fR field of the entry should only be used for returning the default value in \fBTk_ConfigureInfo\fR. In calls to \fBTk_ConfigureWidget\fR no default will be supplied for entries with this flag set; it is assumed that the caller has already supplied a default value in the target location. This flag provides a performance optimization where it is expensive to process the default string: the client can compute the default once, save the value, and provide it before calling \fBTk_ConfigureWidget\fR. .PP The \fBTK_CONFIG_MONO_ONLY\fR and \fBTK_CONFIG_COLOR_ONLY\fR flags are typically used to specify different default values for monochrome and color displays. This is done by creating two entries in \fIspecs\fR that are identical except for their \fIdefValue\fR and \fIspecFlags\fR fields. One entry should have the value \fBTK_CONFIG_MONO_ONLY\fR in its \fIspecFlags\fR and the |
︙ | ︙ | |||
529 530 531 532 533 534 535 | corresponding field of the widget record to null. .SH "CUSTOM OPTION TYPES" .PP Applications can extend the built-in configuration types with additional configuration types by writing procedures to parse and print options of the a type and creating a structure pointing to those procedures: .CS | | | | | | | | 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 | corresponding field of the widget record to null. .SH "CUSTOM OPTION TYPES" .PP Applications can extend the built-in configuration types with additional configuration types by writing procedures to parse and print options of the a type and creating a structure pointing to those procedures: .CS typedef struct { Tk_OptionParseProc *\fIparseProc\fR; Tk_OptionPrintProc *\fIprintProc\fR; void *\fIclientData\fR; } \fBTk_CustomOption\fR; typedef int \fBTk_OptionParseProc\fR( void *\fIclientData\fR, Tcl_Interp *\fIinterp\fR, Tk_Window \fItkwin\fR, char *\fIvalue\fR, char *\fIwidgRec\fR, Tcl_Size \fIoffset\fR); typedef const char *\fBTk_OptionPrintProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIwidgRec\fR, Tcl_Size \fIoffset\fR, Tcl_FreeProc **\fIfreeProcPtr\fR); .CE The Tk_CustomOption structure contains three fields, which are pointers to the two procedures and a \fIclientData\fR value to be passed to those procedures when they are invoked. The \fIclientData\fR value typically points to a structure containing information that is needed by the procedures when they are parsing and printing options. |
︙ | ︙ |
Changes to doc/ConfigWind.3.
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | \fBTk_SetWindowBorderPixmap\fR(\fItkwin, pixmap\fR) .sp \fBTk_SetWindowColormap\fR(\fItkwin, colormap\fR) .sp \fBTk_DefineCursor\fR(\fItkwin, cursor\fR) .sp \fBTk_UndefineCursor\fR(\fItkwin\fR) .SH ARGUMENTS .AS XSetWindowAttributes borderWidth .AP Tk_Window tkwin in Token for window. .AP "unsigned int" valueMask in OR-ed mask of values like \fBCWX\fR or \fBCWBorderPixel\fR, indicating which fields of \fI*valuePtr\fR or \fI*attsPtr\fR to use. | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | \fBTk_SetWindowBorderPixmap\fR(\fItkwin, pixmap\fR) .sp \fBTk_SetWindowColormap\fR(\fItkwin, colormap\fR) .sp \fBTk_DefineCursor\fR(\fItkwin, cursor\fR) .sp \fBTk_UndefineCursor\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS XSetWindowAttributes borderWidth .AP Tk_Window tkwin in Token for window. .AP "unsigned int" valueMask in OR-ed mask of values like \fBCWX\fR or \fBCWBorderPixel\fR, indicating which fields of \fI*valuePtr\fR or \fI*attsPtr\fR to use. |
︙ | ︙ |
Changes to doc/CoordToWin.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_CoordsToWindow \- Find window containing a point .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_CoordsToWindow\fR(\fIrootX, rootY, tkwin\fR) .SH ARGUMENTS .AS Tk_Window tkwin .AP int rootX in X-coordinate (in root window coordinates). .AP int rootY in Y-coordinate (in root window coordinates). .AP Tk_Window tkwin in | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_CoordsToWindow \- Find window containing a point .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_CoordsToWindow\fR(\fIrootX, rootY, tkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP int rootX in X-coordinate (in root window coordinates). .AP int rootY in Y-coordinate (in root window coordinates). .AP Tk_Window tkwin in |
︙ | ︙ |
Changes to doc/CrtCmHdlr.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateClientMessageHandler\fR(\fIproc\fR) .sp \fBTk_DeleteClientMessageHandler\fR(\fIproc\fR) .SH ARGUMENTS .AP Tk_ClientMessageProc *proc in Procedure to invoke whenever a ClientMessage X event occurs on any display. .BE .SH DESCRIPTION .PP \fBTk_CreateClientMessageHandler\fR arranges for \fIproc\fR to be invoked | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateClientMessageHandler\fR(\fIproc\fR) .sp \fBTk_DeleteClientMessageHandler\fR(\fIproc\fR) .fi .SH ARGUMENTS .AP Tk_ClientMessageProc *proc in Procedure to invoke whenever a ClientMessage X event occurs on any display. .BE .SH DESCRIPTION .PP \fBTk_CreateClientMessageHandler\fR arranges for \fIproc\fR to be invoked |
︙ | ︙ |
Changes to doc/CrtConsoleChan.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | .SH NAME Tk_InitConsoleChannels \- Install the console channels as standard channels .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_InitConsoleChannels\fR(\fIinterp\fR) .SH ARGUMENTS .AS Tcl_Interp *interp in .AP Tcl_Interp *interp in Interpreter in which the console channels are created. .BE .SH DESCRIPTION .PP | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_InitConsoleChannels \- Install the console channels as standard channels .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_InitConsoleChannels\fR(\fIinterp\fR) .fi .SH ARGUMENTS .AS Tcl_Interp *interp in .AP Tcl_Interp *interp in Interpreter in which the console channels are created. .BE .SH DESCRIPTION .PP |
︙ | ︙ |
Changes to doc/CrtErrHdlr.3.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | .nf \fB#include <tk.h>\fR .sp Tk_ErrorHandler \fBTk_CreateErrorHandler\fR(\fIdisplay, error, request, minor, proc, clientData\fR) .sp \fBTk_DeleteErrorHandler\fR(\fIhandler\fR) .SH ARGUMENTS .AS "Tk_ErrorHandler" clientData .AP Display *display in Display whose errors are to be handled. .AP int error in Match only error events with this value in the \fIerror_code\fR field. If \-1, then match any \fIerror_code\fR value. .AP int request in Match only error events with this value in the \fIrequest_code\fR field. If \-1, then match any \fIrequest_code\fR value. .AP int minor in Match only error events with this value in the \fIminor_code\fR field. If \-1, then match any \fIminor_code\fR value. .AP Tk_ErrorProc *proc in Procedure to invoke whenever an error event is received for \fIdisplay\fR and matches \fIerror\fR, \fIrequest\fR, and \fIminor\fR. NULL means ignore any matching errors. | > | | 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 | .nf \fB#include <tk.h>\fR .sp Tk_ErrorHandler \fBTk_CreateErrorHandler\fR(\fIdisplay, error, request, minor, proc, clientData\fR) .sp \fBTk_DeleteErrorHandler\fR(\fIhandler\fR) .fi .SH ARGUMENTS .AS "Tk_ErrorHandler" clientData .AP Display *display in Display whose errors are to be handled. .AP int error in Match only error events with this value in the \fIerror_code\fR field. If \-1, then match any \fIerror_code\fR value. .AP int request in Match only error events with this value in the \fIrequest_code\fR field. If \-1, then match any \fIrequest_code\fR value. .AP int minor in Match only error events with this value in the \fIminor_code\fR field. If \-1, then match any \fIminor_code\fR value. .AP Tk_ErrorProc *proc in Procedure to invoke whenever an error event is received for \fIdisplay\fR and matches \fIerror\fR, \fIrequest\fR, and \fIminor\fR. NULL means ignore any matching errors. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .AP Tk_ErrorHandler handler in Token for error handler to delete (return value from a previous call to \fBTk_CreateErrorHandler\fR). .BE .SH DESCRIPTION .PP |
︙ | ︙ | |||
69 70 71 72 73 74 75 | The protocol request to which the error pertains must have been made when the handler was active (see below for more information). .PP \fIProc\fR should have arguments and result that match the following type: .CS typedef int \fBTk_ErrorProc\fR( | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | The protocol request to which the error pertains must have been made when the handler was active (see below for more information). .PP \fIProc\fR should have arguments and result that match the following type: .CS typedef int \fBTk_ErrorProc\fR( void *\fIclientData\fR, XErrorEvent *\fIerrEventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTcl_CreateErrorHandler\fR when the callback was created. Typically, \fIclientData\fR points to a data structure containing application-specific information that is needed to deal with the error. \fIErrEventPtr\fR is |
︙ | ︙ |
Changes to doc/CrtGenHdlr.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateGenericHandler\fR(\fIproc, clientData\fR) .sp \fBTk_DeleteGenericHandler\fR(\fIproc, clientData\fR) .SH ARGUMENTS .AS "Tk_GenericProc" clientData .AP Tk_GenericProc *proc in Procedure to invoke whenever any X event occurs on any display. | > | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateGenericHandler\fR(\fIproc, clientData\fR) .sp \fBTk_DeleteGenericHandler\fR(\fIproc, clientData\fR) .fi .SH ARGUMENTS .AS "Tk_GenericProc" clientData .AP Tk_GenericProc *proc in Procedure to invoke whenever any X event occurs on any display. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTk_CreateGenericHandler\fR arranges for \fIproc\fR to be invoked in the future whenever any X event occurs. This mechanism is \fInot\fR intended for dispatching X events on windows managed by Tk |
︙ | ︙ | |||
41 42 43 44 45 46 47 | call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_GenericProc\fR: .CS typedef int \fBTk_GenericProc\fR( | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_GenericProc\fR: .CS typedef int \fBTk_GenericProc\fR( void *\fIclientData\fR, XEvent *\fIeventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_CreateGenericHandler\fR when the callback was created. Typically, \fIclientData\fR points to a data structure containing application-specific information about how to handle events. |
︙ | ︙ |
Changes to doc/CrtImgType.3.
1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateImageType 3 8.5 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 39 40 41 42 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateImageType 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateImageType, Tk_GetImageModelData \- define new kind of image .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateImageType\fR(\fItypePtr\fR) .sp void * \fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR) .fi .SH ARGUMENTS .AS "const Tk_ImageType" *typePtrPtr .AP "const Tk_ImageType" *typePtr in Structure that defines the new type of image. For Tk 8.4 and earlier this must be static: a pointer to this structure is retained by the image code. In Tk 8.5, this limitation was relaxed. .AP Tcl_Interp *interp in Interpreter in which image was created. .AP "const char" *name in Name of existing image. .AP Tk_ImageType **typePtrPtr out Points to word in which to store a pointer to type information for the given image, if it exists. .AP char ***argvPtr in/out Pointer to argument list .BE .SH DESCRIPTION .PP \fBTk_CreateImageType\fR is invoked to define a new kind of image. An image type corresponds to a particular value of the \fItype\fR |
︙ | ︙ | |||
54 55 56 57 58 59 60 | \fIimage manager\fR. It consists of a collection of procedures plus three different kinds of data structures. The first data structure is a Tk_ImageType structure, which contains the name of the image type and pointers to five procedures provided by the image manager to deal with images of this type: .CS | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | \fIimage manager\fR. It consists of a collection of procedures plus three different kinds of data structures. The first data structure is a Tk_ImageType structure, which contains the name of the image type and pointers to five procedures provided by the image manager to deal with images of this type: .CS typedef struct { const char *\fIname\fR; Tk_ImageCreateProc *\fIcreateProc\fR; Tk_ImageGetProc *\fIgetProc\fR; Tk_ImageDisplayProc *\fIdisplayProc\fR; Tk_ImageFreeProc *\fIfreeProc\fR; Tk_ImageDeleteProc *\fIdeleteProc\fR; } \fBTk_ImageType\fR; |
︙ | ︙ | |||
110 111 112 113 114 115 116 | typedef int \fBTk_ImageCreateProc\fR( Tcl_Interp *\fIinterp\fR, const char *\fIname\fR, int \fIobjc\fR, Tcl_Obj *const \fIobjv\fR[], const Tk_ImageType *\fItypePtr\fR, Tk_ImageModel \fImodel\fR, | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | typedef int \fBTk_ImageCreateProc\fR( Tcl_Interp *\fIinterp\fR, const char *\fIname\fR, int \fIobjc\fR, Tcl_Obj *const \fIobjv\fR[], const Tk_ImageType *\fItypePtr\fR, Tk_ImageModel \fImodel\fR, void **\fImodelDataPtr\fR); .CE The \fIinterp\fR argument is the interpreter in which the \fBimage\fR command was invoked, and \fIname\fR is the name for the new image, which was either specified explicitly in the \fBimage\fR command or generated automatically by the \fBimage\fR command. The \fIobjc\fR and \fIobjv\fR arguments describe all the configuration options for the new image (everything after the name argument to |
︙ | ︙ | |||
142 143 144 145 146 147 148 | size of the image and request an initial redisplay. .SS GETPROC .PP \fItypePtr->getProc\fR is invoked by Tk whenever a widget calls \fBTk_GetImage\fR to use a particular image. This procedure must match the following prototype: .CS | | | | | 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 | size of the image and request an initial redisplay. .SS GETPROC .PP \fItypePtr->getProc\fR is invoked by Tk whenever a widget calls \fBTk_GetImage\fR to use a particular image. This procedure must match the following prototype: .CS typedef void *\fBTk_ImageGetProc\fR( Tk_Window \fItkwin\fR, void *\fImodelData\fR); .CE The \fItkwin\fR argument identifies the window in which the image will be used and \fImodelData\fR is the value returned by \fIcreateProc\fR when the image model was created. \fIgetProc\fR will usually create a data structure for the new instance, including such things as the resources needed to display the image in the given window. \fIgetProc\fR returns a one-word token for the instance, which is typically the address of the instance data structure. Tk will pass this value back to the image manager when invoking its \fIdisplayProc\fR and \fIfreeProc\fR procedures. .SS DISPLAYPROC .PP \fItypePtr->displayProc\fR is invoked by Tk whenever an image needs to be displayed (i.e., whenever a widget calls \fBTk_RedrawImage\fR). \fIdisplayProc\fR must match the following prototype: .CS typedef void \fBTk_ImageDisplayProc\fR( void *\fIinstanceData\fR, Display *\fIdisplay\fR, Drawable \fIdrawable\fR, int \fIimageX\fR, int \fIimageY\fR, int \fIwidth\fR, int \fIheight\fR, int \fIdrawableX\fR, |
︙ | ︙ | |||
199 200 201 202 203 204 205 | \fBTk_FreeImage\fR is invoked). This can happen, for example, when a widget is deleted or a image item in a canvas is deleted, or when the image displayed in a widget or canvas item is changed. \fIfreeProc\fR must match the following prototype: .CS typedef void \fBTk_ImageFreeProc\fR( | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | \fBTk_FreeImage\fR is invoked). This can happen, for example, when a widget is deleted or a image item in a canvas is deleted, or when the image displayed in a widget or canvas item is changed. \fIfreeProc\fR must match the following prototype: .CS typedef void \fBTk_ImageFreeProc\fR( void *\fIinstanceData\fR, Display *\fIdisplay\fR); .CE The \fIinstanceData\fR will be the same as the value returned by \fIgetProc\fR when the instance was created, and \fIdisplay\fR is the display containing the window for the instance. \fIfreeProc\fR should release any resources associated with the image instance, since the instance will never be used again. .SS DELETEPROC .PP \fItypePtr->deleteProc\fR is a procedure that Tk invokes when an image is being deleted (i.e. when the \fBimage delete\fR command is invoked). Before invoking \fIdeleteProc\fR Tk will invoke \fIfreeProc\fR for each of the image's instances. \fIdeleteProc\fR must match the following prototype: .CS typedef void \fBTk_ImageDeleteProc\fR( void *\fImodelData\fR); .CE The \fImodelData\fR argument will be the same as the value stored in \fI*modelDataPtr\fR by \fIcreateProc\fR when the image was created. \fIdeleteProc\fR should release any resources associated with the image. .SH TK_GETIMAGEMODELDATA .PP The procedure \fBTk_GetImageModelData\fR may be invoked to retrieve information about an image. For example, an image manager can use this procedure to locate its image model data for an image. If there exists an image named \fIname\fR in the interpreter given by \fIinterp\fR, then \fI*typePtrPtr\fR is filled in with type information for the image (the \fItypePtr\fR value passed to \fBTk_CreateImageType\fR when the image type was registered) and the return value is the clientData value returned by the \fIcreateProc\fR when the image was created (this is typically a pointer to the image model data structure). If no such image exists then NULL is returned and NULL is stored at \fI*typePtrPtr\fR. .SH "SEE ALSO" Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage .SH KEYWORDS image manager, image type, instance, model |
Changes to doc/CrtItemType.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | .nf \fB#include <tk.h>\fR .sp \fBTk_CreateItemType\fR(\fItypePtr\fR) .sp Tk_ItemType * \fBTk_GetItemTypes\fR() .SH ARGUMENTS .AS Tk_ItemType *typePtr .AP Tk_ItemType *typePtr in Structure that defines the new type of canvas item. .BE .SH INTRODUCTION .PP \fBTk_CreateItemType\fR is invoked to define a new kind of canvas item described by the \fItypePtr\fR argument. An item type corresponds to a particular value of the \fItype\fR argument to the \fBcreate\fR widget command for canvases, and | > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .nf \fB#include <tk.h>\fR .sp \fBTk_CreateItemType\fR(\fItypePtr\fR) .sp Tk_ItemType * \fBTk_GetItemTypes\fR() .fi .SH ARGUMENTS .AS Tk_ItemType *typePtr .AP Tk_ItemType *typePtr in Structure that defines the new type of canvas item. Note that this is not \fIconst\fR; Tk may write to these structures. .BE .SH INTRODUCTION .PP \fBTk_CreateItemType\fR is invoked to define a new kind of canvas item described by the \fItypePtr\fR argument. An item type corresponds to a particular value of the \fItype\fR argument to the \fBcreate\fR widget command for canvases, and |
︙ | ︙ | |||
67 68 69 70 71 72 73 | size_t \fIitemSize\fR; Tk_ItemCreateProc *\fIcreateProc\fR; const Tk_ConfigSpec *\fIconfigSpecs\fR; Tk_ItemConfigureProc *\fIconfigProc\fR; Tk_ItemCoordProc *\fIcoordProc\fR; Tk_ItemDeleteProc *\fIdeleteProc\fR; Tk_ItemDisplayProc *\fIdisplayProc\fR; | | | | 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 | size_t \fIitemSize\fR; Tk_ItemCreateProc *\fIcreateProc\fR; const Tk_ConfigSpec *\fIconfigSpecs\fR; Tk_ItemConfigureProc *\fIconfigProc\fR; Tk_ItemCoordProc *\fIcoordProc\fR; Tk_ItemDeleteProc *\fIdeleteProc\fR; Tk_ItemDisplayProc *\fIdisplayProc\fR; int \fIflags\fR; Tk_ItemPointProc *\fIpointProc\fR; Tk_ItemAreaProc *\fIareaProc\fR; Tk_ItemPostscriptProc *\fIpostscriptProc\fR; Tk_ItemScaleProc *\fIscaleProc\fR; Tk_ItemTranslateProc *\fItranslateProc\fR; Tk_ItemIndexProc *\fIindexProc\fR; Tk_ItemCursorProc *\fIicursorProc\fR; Tk_ItemSelectionProc *\fIselectionProc\fR; Tk_ItemInsertProc *\fIinsertProc\fR; Tk_ItemDCharsProc *\fIdCharsProc\fR; struct Tk_ItemType *\fInextPtr\fR; .VS "8.7, TIP164" Tk_ItemRotateProc *\fIrotateProc\fR; .VE "8.7, TIP164" } \fBTk_ItemType\fR; .CE .PP The fields of a Tk_ItemType structure are described in more detail |
︙ | ︙ | |||
109 110 111 112 113 114 115 | defined by Tk via the type Tk_Item; the rest of the item record is defined by the type manager. A type manager must define its item records with a Tk_Item as the first field. For example, the item record for bitmap items is defined as follows: .PP .CS | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | defined by Tk via the type Tk_Item; the rest of the item record is defined by the type manager. A type manager must define its item records with a Tk_Item as the first field. For example, the item record for bitmap items is defined as follows: .PP .CS typedef struct { Tk_Item \fIheader\fR; double \fIx\fR, \fIy\fR; Tk_Anchor \fIanchor\fR; Pixmap \fIbitmap\fR; XColor *\fIfgColor\fR; XColor *\fIbgColor\fR; GC \fIgc\fR; |
︙ | ︙ | |||
165 166 167 168 169 170 171 | Once \fBTk_CreateImageType\fR returns, this name may be used in \fBcreate\fR widget commands to create items of the new type. If there already existed an item type by this name then the new item type replaces the old one. .SS "FLAGS (IN ALWAYSREDRAW)" .PP | | | < < < < < < < < | 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 | Once \fBTk_CreateImageType\fR returns, this name may be used in \fBcreate\fR widget commands to create items of the new type. If there already existed an item type by this name then the new item type replaces the old one. .SS "FLAGS (IN ALWAYSREDRAW)" .PP The \fItypePtr\->flags\fR field contains a collection of flag bits that modify how the canvas core interacts with the item. The following bits are defined: .TP \fBTK_ALWAYS_REDRAW\fR . Indicates that the item should always be redrawn when any part of the canvas is redrawn, rather than only when the bounding box of the item overlaps the area being redrawn. This is used by window items, for example, which need to unmap subwindows that are not on the screen. .TP \fBTK_MOVABLE_POINTS\fR .VS 8.6 Indicates that the item supports the \fIdCharsProc\fR, \fIindexProc\fR and \fIinsertProc\fR with the same semantics as Tk's built-in line and polygon types, and that hence individual coordinate points can be moved. Must not be set if any of the above methods is NULL. .VE 8.6 |
︙ | ︙ | |||
225 226 227 228 229 230 231 | \fIitemPtr\fR is a pointer to a newly-allocated item of size \fItypePtr\->itemSize\fR. Tk has already initialized the item's header (the first \fBsizeof(Tk_ItemType)\fR bytes). The \fIobjc\fR and \fIobjv\fR arguments describe all of the arguments to the \fBcreate\fR command after the \fItype\fR argument. | < < < | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | \fIitemPtr\fR is a pointer to a newly-allocated item of size \fItypePtr\->itemSize\fR. Tk has already initialized the item's header (the first \fBsizeof(Tk_ItemType)\fR bytes). The \fIobjc\fR and \fIobjv\fR arguments describe all of the arguments to the \fBcreate\fR command after the \fItype\fR argument. For example, in the widget command: .PP .CS \fB\&.c create rectangle 10 20 50 50 \-fill black\fR .CE .PP \fIobjc\fR will be \fB6\fR and \fIobjv\fR[0] will contain the |
︙ | ︙ | |||
257 258 259 260 261 262 263 | \fBTk_ConfigureWidget\fR. This table will normally be used by \fItypePtr\->createProc\fR and \fItypePtr\->configProc\fR, but Tk also uses it directly to retrieve option information in the \fBitemcget\fR and \fBitemconfigure\fR widget commands. \fItypePtr\->configSpecs\fR must point to the configuration table for this type. | > | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | \fBTk_ConfigureWidget\fR. This table will normally be used by \fItypePtr\->createProc\fR and \fItypePtr\->configProc\fR, but Tk also uses it directly to retrieve option information in the \fBitemcget\fR and \fBitemconfigure\fR widget commands. \fItypePtr\->configSpecs\fR must point to the configuration table for this type. .PP Note that Tk provides a custom option type \fBtk_CanvasTagsOption\fR for implementing the \fB\-tags\fR option; see an existing type manager for an example of how to use it in \fIconfigSpecs\fR. .SS CONFIGPROC .PP \fItypePtr\->configProc\fR is called by Tk whenever the \fBitemconfigure\fR widget command is invoked to change the configuration options for a canvas item. |
︙ | ︙ | |||
281 282 283 284 285 286 287 | int \fIflags\fR); .CE .PP The \fIinterp\fR argument identifies the interpreter in which the widget command was invoked, \fIcanvas\fR is a handle for the canvas widget, and \fIitemPtr\fR is a pointer to the item being configured. \fIobjc\fR and \fIobjv\fR contain the configuration options. | < < < | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | int \fIflags\fR); .CE .PP The \fIinterp\fR argument identifies the interpreter in which the widget command was invoked, \fIcanvas\fR is a handle for the canvas widget, and \fIitemPtr\fR is a pointer to the item being configured. \fIobjc\fR and \fIobjv\fR contain the configuration options. For example, if the following command is invoked: .PP .CS \fB\&.c itemconfigure 2 \-fill red \-outline black\fR .CE .PP \fIobjc\fR is \fB4\fR and \fIobjv\fR contains the string objects \fB\-fill\fR |
︙ | ︙ | |||
320 321 322 323 324 325 326 | int \fIobjc\fR, Tcl_Obj *const \fIobjv\fR[]); .CE .PP The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR all have the standard meanings, and \fIobjc\fR and \fIobjv\fR describe the coordinate arguments. | < < < | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | int \fIobjc\fR, Tcl_Obj *const \fIobjv\fR[]); .CE .PP The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR all have the standard meanings, and \fIobjc\fR and \fIobjv\fR describe the coordinate arguments. For example, if the following widget command is invoked: .PP .CS \fB\&.c coords 2 30 90\fR .CE .PP \fIobjc\fR will be \fB2\fR and \fBobjv\fR will contain the integer objects |
︙ | ︙ | |||
397 398 399 400 401 402 403 | will not necessarily be the same as those in the canvas. \fIdisplayProc\fR should call \fBTk_CanvasDrawableCoords\fR to transform coordinates from those of the canvas to those of \fIdst\fR. .PP Normally an item's \fIdisplayProc\fR is only invoked if the item overlaps the area being displayed. | | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | will not necessarily be the same as those in the canvas. \fIdisplayProc\fR should call \fBTk_CanvasDrawableCoords\fR to transform coordinates from those of the canvas to those of \fIdst\fR. .PP Normally an item's \fIdisplayProc\fR is only invoked if the item overlaps the area being displayed. However, if bit zero of \fItypePtr\->flags\fR is 1, (i.e.\| .QW "\fItypePtr\->flags & 1 == 1\fR" ) then \fIdisplayProc\fR is invoked during every redisplay operation, even if the item does not overlap the area of redisplay; this is useful for cases such as window items, where the subwindow needs to be unmapped when it is off the screen. .SS POINTPROC .PP \fItypePtr\->pointProc\fR is invoked by Tk to find out how close |
︙ | ︙ | |||
573 574 575 576 577 578 579 | the item is to be rotated, and \fIangleRad\fR gives the anticlockwise rotation to be applied in radians. The item should adjust the coordinates of its control points so that where they used to have coordinates \fIx\fR and \fIy\fR, they will have new coordinates \fIx\(fm\fR and \fIy\(fm\fR, where .PP .CS | | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | the item is to be rotated, and \fIangleRad\fR gives the anticlockwise rotation to be applied in radians. The item should adjust the coordinates of its control points so that where they used to have coordinates \fIx\fR and \fIy\fR, they will have new coordinates \fIx\(fm\fR and \fIy\(fm\fR, where .PP .CS \fIrelX\fR = \fIx\fR \(mi \fIoriginX\fR \fIrelY\fR = \fIy\fR \(mi \fIoriginY\fR \fIx\(fm\fR = \fIoriginX\fR + \fIrelX\fR \(mu cos(\fIangleRad\fR) + \fIrelY\fR \(mu sin(\fIangleRad\fR) \fIy\(fm\fR = \fIoriginY\fR \(mi \fIrelX\fR \(mu sin(\fIangleRad\fR) + \fIrelY\fR \(mu cos(\fIangleRad\fR) .CE .PP The control points for an item are not necessarily the coordinates provided to the item when it is created (or via the \fItypePtr\->coordProc\fR), but could instead be derived from them. |
︙ | ︙ | |||
612 613 614 615 616 617 618 | .CE .PP The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all have the usual meaning. \fIindexObj\fR contains a textual description of an index, and \fIindexPtr\fR points to an integer value that should be filled in with a numerical index. | < < < | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | .CE .PP The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all have the usual meaning. \fIindexObj\fR contains a textual description of an index, and \fIindexPtr\fR points to an integer value that should be filled in with a numerical index. It is up to the type manager to decide what forms of index are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR, \fBend\fR, etc.). \fIindexProc\fR should return a Tcl completion code and set the interpreter result in the event of an error. .SS ICURSORPROC .PP |
︙ | ︙ | |||
698 699 700 701 702 703 704 | .CE .PP \fIcanvas\fR and \fIitemPtr\fR have the usual meanings. \fIindex\fR is an index into the item's text, as returned by a previous call to \fItypePtr\->insertProc\fR, and \fIobj\fR contains new text to insert just before the character given by \fIindex\fR. | < < < | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | .CE .PP \fIcanvas\fR and \fIitemPtr\fR have the usual meanings. \fIindex\fR is an index into the item's text, as returned by a previous call to \fItypePtr\->insertProc\fR, and \fIobj\fR contains new text to insert just before the character given by \fIindex\fR. If the item supports modification of the coordinates list by this .PP The type manager should insert the text and recompute the bounding box in the item's header. .SS DCHARSPROC .PP \fItypePtr\->dCharsProc\fR is invoked by Tk during the \fBdchars\fR |
︙ | ︙ |
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 | '\" '\" 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 { 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_ImageFileReadProcVersion3\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_ImageStringReadProcVersion3\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_ImageFileWriteProcVersion3\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_ImageStringWriteProcVersion3\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 .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: .IP \(bu Abbreviations are in upper case. .IP \(bu Words are in US English in small case (except proper nouns) .IP \(bu Vertical DPI is expressed as DPI/aspect. The reason is, that some image formats may feature aspect and no resolution value. .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)); // use value reference in itemData } .CE .PP The \fB\-metadata\fR 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 \fB\-metadata\fR 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 \fB\-metadata\fR 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 metadata dict to return them. Those functions get a Tcl object pointer \fImetadataOut\fR as parameter. \fImetadataOut\fR may be NULL to indicate, that no metadata return is required (\fBput\fR, \fBread\fR subcommands). The variable pointed to by \fImetadataOut\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 { 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 .SH "SEE ALSO" Tk_FindPhoto, Tk_PhotoPutBlock .SH KEYWORDS photo image, image file |
Changes to doc/CrtSelHdlr.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateSelHandler\fR(\fItkwin, selection, target, proc, clientData, format\fR) .sp \fBTk_DeleteSelHandler\fR(\fItkwin, selection, target\fR) .SH ARGUMENTS .AS Tk_SelectionProc clientData .AP Tk_Window tkwin in Window for which \fIproc\fR will provide selection information. .AP Atom selection in The name of the selection for which \fIproc\fR will provide selection information. .AP Atom target in Form in which \fIproc\fR can provide the selection (e.g. STRING or FILE_NAME). Corresponds to \fItype\fR arguments in \fBselection\fR commands. .AP Tk_SelectionProc *proc in Procedure to invoke whenever the selection is owned by \fItkwin\fR and the selection contents are requested in the format given by \fItarget\fR. | > | | 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 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_CreateSelHandler\fR(\fItkwin, selection, target, proc, clientData, format\fR) .sp \fBTk_DeleteSelHandler\fR(\fItkwin, selection, target\fR) .fi .SH ARGUMENTS .AS Tk_SelectionProc clientData .AP Tk_Window tkwin in Window for which \fIproc\fR will provide selection information. .AP Atom selection in The name of the selection for which \fIproc\fR will provide selection information. .AP Atom target in Form in which \fIproc\fR can provide the selection (e.g. STRING or FILE_NAME). Corresponds to \fItype\fR arguments in \fBselection\fR commands. .AP Tk_SelectionProc *proc in Procedure to invoke whenever the selection is owned by \fItkwin\fR and the selection contents are requested in the format given by \fItarget\fR. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .AP Atom format in If the selection requestor is not in this process, \fIformat\fR determines the representation used to transmit the selection to its requestor. .BE .SH DESCRIPTION |
︙ | ︙ | |||
50 51 52 53 54 55 56 | X Inter-Client Communication Conventions Manual (ICCCM) or any other form in which an application is willing to present the selection. The most common form is STRING. .PP \fIProc\fR should have arguments and result that match the type \fBTk_SelectionProc\fR: .CS | | | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | X Inter-Client Communication Conventions Manual (ICCCM) or any other form in which an application is willing to present the selection. The most common form is STRING. .PP \fIProc\fR should have arguments and result that match the type \fBTk_SelectionProc\fR: .CS typedef Tcl_Size \fBTk_SelectionProc\fR( void *\fIclientData\fR, Tcl_Size \fIoffset\fR, char *\fIbuffer\fR, Tcl_Size \fImaxBytes\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_CreateSelHandler\fR. Typically, \fIclientData\fR points to a data structure containing application-specific information that is needed to retrieve the selection. \fIOffset\fR specifies an offset position into the selection, \fIbuffer\fR specifies a |
︙ | ︙ |
Changes to doc/CrtWindow.3.
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | .sp Tk_Window \fBTk_CreateWindowFromPath\fR(\fIinterp, tkwin, pathName, topLevScreen\fR) .sp \fBTk_DestroyWindow\fR(\fItkwin\fR) .sp \fBTk_MakeWindowExist\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tcl_Interp *topLevScreen .AP Tcl_Interp *interp out Tcl interpreter to use for error reporting. If no error occurs, then \fI*interp\fR is not modified. .AP Tk_Window parent in Token for the window that is to serve as the logical parent of | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | .sp Tk_Window \fBTk_CreateWindowFromPath\fR(\fIinterp, tkwin, pathName, topLevScreen\fR) .sp \fBTk_DestroyWindow\fR(\fItkwin\fR) .sp \fBTk_MakeWindowExist\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tcl_Interp *topLevScreen .AP Tcl_Interp *interp out Tcl interpreter to use for error reporting. If no error occurs, then \fI*interp\fR is not modified. .AP Tk_Window parent in Token for the window that is to serve as the logical parent of |
︙ | ︙ |
Changes to doc/DeleteImg.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | .SH NAME Tk_DeleteImage \- Destroy an image. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_DeleteImage\fR(\fIinterp, name\fR) .SH ARGUMENTS .AS Tcl_Interp *interp .AP Tcl_Interp *interp in Interpreter for which the image was created. .AP "const char" *name in Name of the image. .BE | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_DeleteImage \- Destroy an image. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_DeleteImage\fR(\fIinterp, name\fR) .fi .SH ARGUMENTS .AS Tcl_Interp *interp .AP Tcl_Interp *interp in Interpreter for which the image was created. .AP "const char" *name in Name of the image. .BE |
︙ | ︙ |
Changes to doc/DrawFocHlt.3.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .BS .SH NAME Tk_DrawFocusHighlight \- draw the traversal highlight ring for a widget .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp | | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .BS .SH NAME Tk_DrawFocusHighlight \- draw the traversal highlight ring for a widget .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_DrawFocusHighlight\fR(\fItkwin, gc, width, drawable\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *joinPtr .AP Tk_Window tkwin in Window for which the highlight is being drawn. Used to retrieve the window's dimensions, among other things. .AP GC gc in Graphics context to use for drawing the highlight. |
︙ | ︙ |
Changes to doc/EventHndlr.3.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | \fBTk_CreateEventHandler\fR(\fItkwin, mask, proc, clientData\fR) .sp \fBTk_DeleteEventHandler\fR(\fItkwin, mask, proc, clientData\fR) .sp \fBTk_GetButtonMask\fR(\fIbutton\fR) .sp \fBTk_SendVirtualEvent\fR(\fItkwin, eventName, detail\fR) .SH ARGUMENTS .AS "unsigned long" clientData .AP unsigned button in Button number. .AP "const char" *eventName in The name of the virtual event. .AP Tcl_Obj *detail in Detail information for the virtual event. .AP Tk_Window tkwin in Token for window in which events may occur. .AP "unsigned long" mask in Bit-mask of events (such as \fBButtonPressMask\fR) for which \fIproc\fR should be called. .AP Tk_EventProc *proc in Procedure to invoke whenever an event in \fImask\fR occurs in the window given by \fItkwin\fR. | > | | | 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 | \fBTk_CreateEventHandler\fR(\fItkwin, mask, proc, clientData\fR) .sp \fBTk_DeleteEventHandler\fR(\fItkwin, mask, proc, clientData\fR) .sp \fBTk_GetButtonMask\fR(\fIbutton\fR) .sp \fBTk_SendVirtualEvent\fR(\fItkwin, eventName, detail\fR) .fi .SH ARGUMENTS .AS "unsigned long" clientData .AP unsigned button in Button number. .AP "const char" *eventName in The name of the virtual event. .AP Tcl_Obj *detail in Detail information for the virtual event. .AP Tk_Window tkwin in Token for window in which events may occur. .AP "unsigned long" mask in Bit-mask of events (such as \fBButtonPressMask\fR) for which \fIproc\fR should be called. .AP Tk_EventProc *proc in Procedure to invoke whenever an event in \fImask\fR occurs in the window given by \fItkwin\fR. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTk_CreateEventHandler\fR arranges for \fIproc\fR to be invoked in the future whenever one of the event types specified by \fImask\fR occurs in the window specified by \fItkwin\fR. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_EventProc\fR: .CS typedef void \fBTk_EventProc\fR( void *\fIclientData\fR, XEvent *\fIeventPtr\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_CreateEventHandler\fR when the callback was created. Typically, \fIclientData\fR points to a data structure containing application-specific information about the window in which the event occurred. \fIEventPtr\fR is |
︙ | ︙ |
Changes to doc/FindPhoto.3.
︙ | ︙ | |||
28 29 30 31 32 33 34 | int \fBTk_PhotoPutZoomedBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\ zoomX, zoomY, subsampleX, subsampleY, compRule\fR) .sp int \fBTk_PhotoGetImage\fR(\fIhandle, blockPtr\fR) .sp | < < > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | int \fBTk_PhotoPutZoomedBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\ zoomX, zoomY, subsampleX, subsampleY, compRule\fR) .sp int \fBTk_PhotoGetImage\fR(\fIhandle, blockPtr\fR) .sp \fBTk_PhotoBlank\fR(\fIhandle\fR) .sp int \fBTk_PhotoExpand\fR(\fIinterp, handle, width, height\fR) .sp \fBTk_PhotoGetSize\fR(\fIhandle, widthPtr, heightPtr\fR) .sp int \fBTk_PhotoSetSize\fR(\fIinterp. handle, width, height\fR) .fi .SH ARGUMENTS .AS Tk_PhotoImageBlock window_path .AP Tcl_Interp *interp in Interpreter in which image was created and in which error reporting is to be done. .AP "const char" *imageName in Name of the photo image. |
︙ | ︙ | |||
260 261 262 263 264 265 266 | .SH BUGS The \fBTk_PhotoImageBlock\fR structure used to provide image data to \fBTk_PhotoPutBlock\fR promises great flexibility in the layout of the data (e.g. separate planes for the red, green, blue and alpha channels). Unfortunately, the implementation fails to hold this promise. The problem is that the \fIpixelSize\fR field is (incorrectly) used to determine whether the image has an alpha channel. | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | .SH BUGS The \fBTk_PhotoImageBlock\fR structure used to provide image data to \fBTk_PhotoPutBlock\fR promises great flexibility in the layout of the data (e.g. separate planes for the red, green, blue and alpha channels). Unfortunately, the implementation fails to hold this promise. The problem is that the \fIpixelSize\fR field is (incorrectly) used to determine whether the image has an alpha channel. Currently, if the offset for the alpha channel is greater than or equal to \fIpixelSize\fR, \fBtk_PhotoPutblock\fR assumes no alpha data is present and makes the image fully opaque. This means that for layouts where the channels are separate (or any other exotic layout where \fIpixelSize\fR has to be smaller than the alpha offset), the alpha channel will not be read correctly. In order to be on the safe side if this issue will be corrected in a future release, it is strongly recommended you always provide alpha data - even if the image has no |
︙ | ︙ |
Changes to doc/FontId.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | Tk_FontId, Tk_GetFontMetrics, Tk_PostscriptFontName \- accessor functions for fonts .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Font | | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | Tk_FontId, Tk_GetFontMetrics, Tk_PostscriptFontName \- accessor functions for fonts .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Font \fBTk_FontId\fR(\fItkfont\fR) .sp \fBTk_GetFontMetrics\fR(\fItkfont, fmPtr\fR) .sp int \fBTk_PostscriptFontName\fR(\fItkfont, dsPtr\fR) .fi .SH ARGUMENTS .AS Tk_FontMetrics *dsPtr .AP Tk_Font tkfont in Opaque font token being queried. Must have been returned by a previous call to \fBTk_GetFont\fR. .AP Tk_FontMetrics *fmPtr out Pointer to structure in which the font metrics for \fItkfont\fR will |
︙ | ︙ | |||
65 66 67 68 69 70 71 | Any other font families may not print correctly because the computed Postscript font name may be incorrect or not exist on the printer. .SH "DATA STRUCTURES" .PP The \fBTk_FontMetrics\fR data structure is used by \fBTk_GetFontMetrics\fR to return information about a font and is defined as follows: .CS | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | Any other font families may not print correctly because the computed Postscript font name may be incorrect or not exist on the printer. .SH "DATA STRUCTURES" .PP The \fBTk_FontMetrics\fR data structure is used by \fBTk_GetFontMetrics\fR to return information about a font and is defined as follows: .CS typedef struct { int \fIascent\fR; int \fIdescent\fR; int \fIlinespace\fR; } \fBTk_FontMetrics\fR; .CE .PP The \fIascent\fR field is the amount in pixels that the tallest |
︙ | ︙ |
Deleted doc/FreeXId.3.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to doc/GeomReq.3.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | \fBTk_GeometryRequest\fR(\fItkwin, reqWidth, reqHeight\fR) .sp \fBTk_SetMinimumRequestSize\fR(\fItkwin, minWidth, minHeight\fR) .sp \fBTk_SetInternalBorder\fR(\fItkwin, width\fR) .sp \fBTk_SetInternalBorderEx\fR(\fItkwin, left, right, top, bottom\fR) .SH ARGUMENTS .AS baseHeight clientData .AP Tk_Window tkwin in Window for which geometry is being requested. .AP int reqWidth in Desired width for \fItkwin\fR, in pixel units. .AP int reqHeight in Desired height for \fItkwin\fR, in pixel units. .AP int minWidth in Desired minimum requested width for \fItkwin\fR, in pixel units. .AP int minHeight in Desired minimum requested height for \fItkwin\fR, in pixel units. .AP int width in Space to leave for internal border for \fItkwin\fR, in pixel units. .AP int left in | > | > | > | > | > | 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 | \fBTk_GeometryRequest\fR(\fItkwin, reqWidth, reqHeight\fR) .sp \fBTk_SetMinimumRequestSize\fR(\fItkwin, minWidth, minHeight\fR) .sp \fBTk_SetInternalBorder\fR(\fItkwin, width\fR) .sp \fBTk_SetInternalBorderEx\fR(\fItkwin, left, right, top, bottom\fR) .fi .SH ARGUMENTS .AS baseHeight clientData .AP Tk_Window tkwin in Window for which geometry is being requested. .AP int reqWidth in Desired width for \fItkwin\fR, in pixel units. .AP int reqHeight in Desired height for \fItkwin\fR, in pixel units. .AP int minWidth in Desired minimum requested width for \fItkwin\fR, in pixel units. .AP int minHeight in Desired minimum requested height for \fItkwin\fR, in pixel units. .AP int width in Space to leave for internal border for \fItkwin\fR, in pixel units. .AP int left in Space to leave for left side of internal border for \fItkwin\fR, in pixel units. .AP int right in Space to leave for right side of internal border for \fItkwin\fR, in pixel units. .AP int top in Space to leave for top side of internal border for \fItkwin\fR, in pixel units. .AP int bottom in Space to leave for bottom side of internal border for \fItkwin\fR, in pixel units. .BE .SH DESCRIPTION .PP \fBTk_GeometryRequest\fR is called by widget code to indicate its preference for the dimensions of a particular window. The arguments to \fBTk_GeometryRequest\fR are made available to the geometry manager for the window, which then decides on the actual geometry |
︙ | ︙ |
Changes to doc/GetAnchor.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .SH NAME Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetAnchorFromObj\fR(\fIinterp, objPtr, anchorPtr\fR) .sp int \fBTk_GetAnchor\fR(\fIinterp, string, anchorPtr\fR) .sp const char * \fBTk_NameOfAnchor\fR(\fIanchor\fR) .fi .SH ARGUMENTS .AS "Tk_Anchor" *anchorPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting, or NULL. .AP Tcl_Obj *objPtr in/out String value contains name of anchor point: .QW \fBn\fR , |
︙ | ︙ |
Changes to doc/GetBitmap.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmapFromObj, Tk_FreeBitmap \- maintain database of single-plane pixmaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Pixmap | | | | | | | | | > | 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 | .SH NAME Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmapFromObj, Tk_FreeBitmap \- maintain database of single-plane pixmaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Pixmap \fBTk_AllocBitmapFromObj\fR(\fIinterp, tkwin, objPtr\fR) .sp Pixmap \fBTk_GetBitmap\fR(\fIinterp, tkwin, info\fR) .sp Pixmap \fBTk_GetBitmapFromObj\fR(\fItkwin, objPtr\fR) .sp int \fBTk_DefineBitmap\fR(\fIinterp, name, source, width, height\fR) .sp const char * \fBTk_NameOfBitmap\fR(\fIdisplay, bitmap\fR) .sp \fBTk_SizeOfBitmap\fR(\fIdisplay, bitmap, widthPtr, heightPtr\fR) .sp \fBTk_FreeBitmapFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_FreeBitmap\fR(\fIdisplay, bitmap\fR) .fi .SH ARGUMENTS .AS "unsigned long" *pixelPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting; if NULL then no error message is left after errors. .AP Tk_Window tkwin in Token for window in which the bitmap will be used. |
︙ | ︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | \fBTk_AllocBitmapFromObj\fR returns a Pixmap identifier for a bitmap that matches the description in \fIobjPtr\fR and is suitable for use in \fItkwin\fR. It re-uses an existing bitmap, if possible, and creates a new one otherwise. \fIObjPtr\fR's value must have one of the following forms: .TP 20 \fB@\fIfileName\fR \fIFileName\fR must be the name of a file containing a bitmap description in the standard X11 format. .TP 20 \fIname\fR \fIName\fR must be the name of a bitmap defined previously with a call to \fBTk_DefineBitmap\fR. The following names are pre-defined by Tk: .RS | > > < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | < | | 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 | \fBTk_AllocBitmapFromObj\fR returns a Pixmap identifier for a bitmap that matches the description in \fIobjPtr\fR and is suitable for use in \fItkwin\fR. It re-uses an existing bitmap, if possible, and creates a new one otherwise. \fIObjPtr\fR's value must have one of the following forms: .TP 20 \fB@\fIfileName\fR . \fIFileName\fR must be the name of a file containing a bitmap description in the standard X11 format. .TP 20 \fIname\fR . \fIName\fR must be the name of a bitmap defined previously with a call to \fBTk_DefineBitmap\fR. The following names are pre-defined by Tk: .RS .IP \fBerror\fR 12 The international .QW don't symbol: a circle with a diagonal line across it. .IP \fBgray75\fR 12 75% gray: a checkerboard pattern where three out of four bits are on. .IP \fBgray50\fR 12 50% gray: a checkerboard pattern where every other bit is on. .IP \fBgray25\fR 12 25% gray: a checkerboard pattern where one out of every four bits is on. .IP \fBgray12\fR 12 12.5% gray: a pattern where one-eighth of the bits are on, consisting of every fourth pixel in every other row. .IP \fBhourglass\fR 12 An hourglass symbol. .IP \fBinfo\fR 12 A large letter .QW i . .IP \fBquesthead\fR 12 The silhouette of a human head, with a question mark in it. .IP \fBquestion\fR 12 A large question-mark. .IP \fBwarning\fR 12 A large exclamation point. .PP In addition, the following pre-defined names are available only on the \fBMacintosh\fR platform: .IP \fBdocument\fR 12 A generic document. .IP \fBstationery\fR 12 Document stationery. .IP \fBedition\fR 12 The \fIedition\fR symbol. .IP \fBapplication\fR 12 Generic application icon. .IP \fBaccessory\fR 12 A desk accessory. .IP \fBfolder\fR 12 Generic folder icon. .IP \fBpfolder\fR 12 A locked folder. .IP \fBtrash\fR 12 A trash can. .IP \fBfloppy\fR 12 A floppy disk. .IP \fBramdisk\fR 12 A floppy disk with chip. .IP \fBcdrom\fR 12 A cd disk icon. .IP \fBpreferences\fR 12 A folder with prefs symbol. .IP \fBquerydoc\fR 12 A database document icon. .IP \fBstop\fR 12 A stop sign. .IP \fBnote\fR 12 A face with balloon words. .IP \fBcaution\fR 12 A triangle with an exclamation point. .RE .LP Under normal conditions, \fBTk_AllocBitmapFromObj\fR returns an identifier for the requested bitmap. If an error occurs in creating the bitmap, such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR is returned and an error |
︙ | ︙ | |||
206 207 208 209 210 211 212 | have been used in a call to \fBTk_DefineBitmap\fR. The arguments \fIsource\fR, \fIwidth\fR, and \fIheight\fR describe the bitmap. \fBTk_DefineBitmap\fR normally returns \fBTCL_OK\fR; if an error occurs (e.g. a bitmap named \fInameId\fR has already been defined) then \fBTCL_ERROR\fR is returned and an error message is left in interpreter \fIinterp\fR's result. | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | have been used in a call to \fBTk_DefineBitmap\fR. The arguments \fIsource\fR, \fIwidth\fR, and \fIheight\fR describe the bitmap. \fBTk_DefineBitmap\fR normally returns \fBTCL_OK\fR; if an error occurs (e.g. a bitmap named \fInameId\fR has already been defined) then \fBTCL_ERROR\fR is returned and an error message is left in interpreter \fIinterp\fR's result. Note that \fBTk_DefineBitmap\fR expects the memory pointed to by \fIsource\fR to be static: \fBTk_DefineBitmap\fR does not make a private copy of this memory, but uses the bytes pointed to by \fIsource\fR later in calls to \fBTk_AllocBitmapFromObj\fR or \fBTk_GetBitmap\fR. .PP Typically \fBTk_DefineBitmap\fR is used by \fB#include\fR-ing a bitmap file directly into a C program and then referencing |
︙ | ︙ |
Changes to doc/GetCapStyl.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetCapStyle, Tk_NameOfCapStyle \- translate between strings and cap styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .SH NAME Tk_GetCapStyle, Tk_NameOfCapStyle \- translate between strings and cap styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetCapStyle\fR(\fIinterp, string, capPtr\fR) .sp const char * \fBTk_NameOfCapStyle\fR(\fIcap\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *capPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP "const char" *string in String containing name of cap style \- one of .QW \fBbutt\fR , |
︙ | ︙ |
Changes to doc/GetClrmap.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap \- allocate and free colormaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Colormap | | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | .SH NAME Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap \- allocate and free colormaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Colormap \fBTk_GetColormap\fR(\fIinterp, tkwin, string\fR) .sp \fBTk_PreserveColormap\fR(\fIdisplay, colormap\fR) .sp \fBTk_FreeColormap\fR(\fIdisplay, colormap\fR) .fi .SH ARGUMENTS .AS "Colormap" colormap .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which colormap will be used. .AP "const char" *string in |
︙ | ︙ |
Changes to doc/GetColor.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_AllocColorFromObj, Tk_GetColor, Tk_GetColorFromObj, Tk_GetColorByValue, Tk_NameOfColor, Tk_FreeColorFromObj, Tk_FreeColor \- maintain database of colors .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp XColor * | | | | | | | | | > | 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 | .SH NAME Tk_AllocColorFromObj, Tk_GetColor, Tk_GetColorFromObj, Tk_GetColorByValue, Tk_NameOfColor, Tk_FreeColorFromObj, Tk_FreeColor \- maintain database of colors .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp XColor * \fBTk_AllocColorFromObj\fR(\fIinterp, tkwin, objPtr\fR) .sp XColor * \fBTk_GetColor\fR(\fIinterp, tkwin, name\fR) .sp XColor * \fBTk_GetColorFromObj\fR(\fItkwin, objPtr\fR) .sp XColor * \fBTk_GetColorByValue\fR(\fItkwin, prefPtr\fR) .sp const char * \fBTk_NameOfColor\fR(\fIcolorPtr\fR) .sp GC \fBTk_GCForColor\fR(\fIcolorPtr, drawable\fR) .sp \fBTk_FreeColorFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_FreeColor\fR(\fIcolorPtr\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *colorPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which color will be used. .AP Tcl_Obj *objPtr in/out |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | .PP Given a textual description of a color, \fBTk_AllocColorFromObj\fR locates a pixel value that may be used to render the color in a particular window. The desired color is specified with a value whose string value must have one of the following forms: .TP 20 \fIcolorname\fR Any of the valid textual names for a color defined in the server's color database file, such as \fBred\fR or \fBPeachPuff\fR. .TP 20 \fB#\fIRGB\fR .TP 20 \fB#\fIRRGGBB\fR .TP 20 \fB#\fIRRRGGGBBB\fR .TP 20 \fB#\fIRRRRGGGGBBBB\fR A numeric specification of the red, green, and blue intensities to use to display the color. Each \fIR\fR, \fIG\fR, or \fIB\fR represents a single hexadecimal digit. The four forms permit colors to be specified with 4-bit, 8-bit, 12-bit or 16-bit values. When fewer than 16 bits are provided for each color, they represent the most significant bits of the color, while the lower unfilled bits will be repeatedly replicated from the available higher bits. | > > | 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 | .PP Given a textual description of a color, \fBTk_AllocColorFromObj\fR locates a pixel value that may be used to render the color in a particular window. The desired color is specified with a value whose string value must have one of the following forms: .TP 20 \fIcolorname\fR . Any of the valid textual names for a color defined in the server's color database file, such as \fBred\fR or \fBPeachPuff\fR. .TP 20 \fB#\fIRGB\fR .TP 20 \fB#\fIRRGGBB\fR .TP 20 \fB#\fIRRRGGGBBB\fR .TP 20 \fB#\fIRRRRGGGGBBBB\fR . A numeric specification of the red, green, and blue intensities to use to display the color. Each \fIR\fR, \fIG\fR, or \fIB\fR represents a single hexadecimal digit. The four forms permit colors to be specified with 4-bit, 8-bit, 12-bit or 16-bit values. When fewer than 16 bits are provided for each color, they represent the most significant bits of the color, while the lower unfilled bits will be repeatedly replicated from the available higher bits. |
︙ | ︙ |
Changes to doc/GetCursor.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_AllocCursorFromObj, Tk_GetCursor, Tk_GetCursorFromObj, Tk_GetCursorFromData, Tk_NameOfCursor, Tk_FreeCursorFromObj, Tk_FreeCursor \- maintain database of cursors .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Cursor | | | | | | | | > | 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 | .SH NAME Tk_AllocCursorFromObj, Tk_GetCursor, Tk_GetCursorFromObj, Tk_GetCursorFromData, Tk_NameOfCursor, Tk_FreeCursorFromObj, Tk_FreeCursor \- maintain database of cursors .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Cursor \fBTk_AllocCursorFromObj\fR(\fIinterp, tkwin, objPtr\fR) .sp Tk_Cursor \fBTk_GetCursor\fR(\fIinterp, tkwin, name\fR) .sp Tk_Cursor \fBTk_GetCursorFromObj\fR(\fItkwin, objPtr\fR) .sp Tk_Cursor \fBTk_GetCursorFromData\fR(\fIinterp, tkwin, source, mask, width, height, xHot, yHot, fg, bg\fR) .sp const char * \fBTk_NameOfCursor\fR(\fIdisplay, cursor\fR) .sp \fBTk_FreeCursorFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_FreeCursor\fR(\fIdisplay, cursor\fR) .fi .SH ARGUMENTS .AS "unsigned long" *pixelPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which the cursor will be used. .AP Tcl_Obj *objPtr in/out |
︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | \fBTk_GetCursorFromObj\fR. If an error occurs in creating the cursor, such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR is returned and an error message will be stored in \fIinterp\fR's result if \fIinterp\fR is not NULL. \fIObjPtr\fR must contain a standard Tcl list with one of the following forms: .TP \fIname\fR\0[\fIfgColor\fR\0[\fIbgColor\fR]] \fIName\fR is the name of a cursor in the standard X cursor cursor, i.e., any of the names defined in \fBcursorcursor.h\fR, without the \fBXC_\fR. Some example values are \fBX_cursor\fR, \fBhand2\fR, or \fBleft_ptr\fR. Appendix B of .QW "The X Window System" by Scheifler & Gettys has illustrations showing what each of these cursors looks like. If \fIfgColor\fR and \fIbgColor\fR are both | > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | \fBTk_GetCursorFromObj\fR. If an error occurs in creating the cursor, such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR is returned and an error message will be stored in \fIinterp\fR's result if \fIinterp\fR is not NULL. \fIObjPtr\fR must contain a standard Tcl list with one of the following forms: .TP \fIname\fR\0[\fIfgColor\fR\0[\fIbgColor\fR]] . \fIName\fR is the name of a cursor in the standard X cursor cursor, i.e., any of the names defined in \fBcursorcursor.h\fR, without the \fBXC_\fR. Some example values are \fBX_cursor\fR, \fBhand2\fR, or \fBleft_ptr\fR. Appendix B of .QW "The X Window System" by Scheifler & Gettys has illustrations showing what each of these cursors looks like. If \fIfgColor\fR and \fIbgColor\fR are both |
︙ | ︙ | |||
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 | name of the resource. The application and all its open dynamic library's resource files will be searched for the named cursor. If there are conflicts color cursors will always be loaded in preference to black and white cursors. .RE .TP \fB@\fIsourceName\0maskName\0fgColor\0bgColor\fR In this form, \fIsourceName\fR and \fImaskName\fR are the names of files describing cursors for the cursor's source bits and mask. Each file must be in standard X11 cursor format. \fIFgColor\fR and \fIbgColor\fR indicate the colors to use for the cursor, in any of the forms acceptable to \fBTk_GetColor\fR. This form of the command will not work on Macintosh or Windows computers. .TP \fB@\fIsourceName\0fgColor\fR This form is similar to the one above, except that the source is used as mask also. This means that the cursor's background is transparent. This form of the command will not work on Macintosh or Windows computers. .TP \fB@\fIsourceName\fR This form only works on Windows, and will load a Windows system cursor (\fB.ani\fR or \fB.cur\fR) from the file specified in \fIsourceName\fR. .PP \fBTk_GetCursor\fR is identical to \fBTk_AllocCursorFromObj\fR except that the description of the cursor is specified with a string instead of an object. This prevents \fBTk_GetCursor\fR from caching the | > > > | 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 | name of the resource. The application and all its open dynamic library's resource files will be searched for the named cursor. If there are conflicts color cursors will always be loaded in preference to black and white cursors. .RE .TP \fB@\fIsourceName\0maskName\0fgColor\0bgColor\fR . In this form, \fIsourceName\fR and \fImaskName\fR are the names of files describing cursors for the cursor's source bits and mask. Each file must be in standard X11 cursor format. \fIFgColor\fR and \fIbgColor\fR indicate the colors to use for the cursor, in any of the forms acceptable to \fBTk_GetColor\fR. This form of the command will not work on Macintosh or Windows computers. .TP \fB@\fIsourceName\0fgColor\fR . This form is similar to the one above, except that the source is used as mask also. This means that the cursor's background is transparent. This form of the command will not work on Macintosh or Windows computers. .TP \fB@\fIsourceName\fR . This form only works on Windows, and will load a Windows system cursor (\fB.ani\fR or \fB.cur\fR) from the file specified in \fIsourceName\fR. .PP \fBTk_GetCursor\fR is identical to \fBTk_AllocCursorFromObj\fR except that the description of the cursor is specified with a string instead of an object. This prevents \fBTk_GetCursor\fR from caching the |
︙ | ︙ | |||
192 193 194 195 196 197 198 | The procedure \fBTk_NameOfCursor\fR is roughly the inverse of \fBTk_GetCursor\fR. If its \fIcursor\fR argument was created by \fBTk_GetCursor\fR, then the return value is the \fIname\fR argument that was passed to \fBTk_GetCursor\fR to create the cursor. If \fIcursor\fR was created by a call to \fBTk_GetCursorFromData\fR, or by any other mechanism, then the return value is a hexadecimal string giving the X identifier for the cursor. | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | The procedure \fBTk_NameOfCursor\fR is roughly the inverse of \fBTk_GetCursor\fR. If its \fIcursor\fR argument was created by \fBTk_GetCursor\fR, then the return value is the \fIname\fR argument that was passed to \fBTk_GetCursor\fR to create the cursor. If \fIcursor\fR was created by a call to \fBTk_GetCursorFromData\fR, or by any other mechanism, then the return value is a hexadecimal string giving the X identifier for the cursor. Note that the string returned by \fBTk_NameOfCursor\fR is only guaranteed to persist until the next call to \fBTk_NameOfCursor\fR. Also, this call is not portable except for cursors returned by \fBTk_GetCursor\fR. .PP When a cursor returned by \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, or \fBTk_GetCursorFromData\fR is no longer needed, \fBTk_FreeCursorFromObj\fR or |
︙ | ︙ |
Changes to doc/GetFont.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FontGetDescription, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Font | | | | | | | < | > | 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 | .SH NAME Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FontGetDescription, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Font \fBTk_AllocFontFromObj\fR(\fIinterp, tkwin, objPtr\fR) .sp Tk_Font \fBTk_GetFont\fR(\fIinterp, tkwin, string\fR) .sp Tk_Font \fBTk_GetFontFromObj\fR(\fItkwin, objPtr\fR) .sp Tcl_Obj * \fBTk_FontGetDescription\fR(\fItkfont\fR) .sp const char * \fBTk_NameOfFont\fR(\fItkfont\fR) .sp Tk_Font \fBTk_FreeFontFromObj\fR(\fItkwin, objPtr\fR) .sp \fBTk_FreeFont\fR(\fItkfont\fR) .fi .SH ARGUMENTS .AS "const char" *tkfont .AP "Tcl_Interp" *interp in Interpreter to use for error reporting. If \fBNULL\fR, then no error messages are left after errors. .AP Tk_Window tkwin in Token for window in which font will be used. |
︙ | ︙ | |||
88 89 90 91 92 93 94 | a database of all fonts they have allocated. If the same font is requested multiple times (e.g. by different windows or for different purposes), then a single Tk_Font will be shared for all uses. The underlying resources will be freed automatically when no-one is using the font anymore. .PP The procedure \fBTk_FontGetDescription\fR returns information about the font | | > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | a database of all fonts they have allocated. If the same font is requested multiple times (e.g. by different windows or for different purposes), then a single Tk_Font will be shared for all uses. The underlying resources will be freed automatically when no-one is using the font anymore. .PP The procedure \fBTk_FontGetDescription\fR returns information about the font description as a Tcl list. One possible result is .QW "{{DejaVu Sans} -16 bold underline}" . .PP The procedure \fBTk_NameOfFont\fR is roughly the inverse of \fBTk_GetFont\fR. Given a \fItkfont\fR that was created by \fBTk_GetFont\fR (or \fBTk_AllocFontFromObj\fR), the return value is the \fIstring\fR argument that was passed to \fBTk_GetFont\fR to create the font. The string returned by \fBTk_NameOfFont\fR is only guaranteed to persist until the \fItkfont\fR |
︙ | ︙ |
Changes to doc/GetGC.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp GC \fBTk_GetGC\fR(\fItkwin, valueMask, valuePtr\fR) .sp | | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp GC \fBTk_GetGC\fR(\fItkwin, valueMask, valuePtr\fR) .sp \fBTk_FreeGC\fR(\fIdisplay, gc\fR) .fi .SH ARGUMENTS .AS "unsigned long" valueMask .AP Tk_Window tkwin in Token for window in which the graphics context will be used. .AP "unsigned long" valueMask in Mask of bits (such as \fBGCForeground\fR or \fBGCStipple\fR) indicating which fields of \fI*valuePtr\fR are valid. |
︙ | ︙ |
Changes to doc/GetHINSTANCE.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 | '\" '\" 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 .SH SYNOPSIS .nf \fB#include <tkPlatDecls.h>\fR .sp HINSTANCE \fBTk_GetHINSTANCE\fR() .fi .BE .SH DESCRIPTION .PP \fBTk_GetHINSTANCE\fR returns the Windows application instance handle for the Tk application. This function is only available on Windows platforms. .SH KEYWORDS identifier, instance |
Changes to doc/GetHWND.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 | '\" '\" 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 .SH SYNOPSIS .nf \fB#include <tkPlatDecls.h>\fR .sp HWND \fBTk_GetHWND\fR(\fIwindow\fR) .sp Window \fBTk_AttachHWND\fR(\fItkwin, hwnd\fR) .fi .SH ARGUMENTS .AP Window window in X token for window. .AP Tk_Window tkwin in Tk window for window. .AP HWND hwnd in Windows HWND for window. |
︙ | ︙ |
Changes to doc/GetImage.3.
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | \fBTk_GetImage\fR(\fIinterp, tkwin, name, changeProc, clientData\fR) .sp \fBTk_RedrawImage\fR(\fIimage, imageX, imageY, width, height, drawable, drawableX, drawableY\fR) .sp \fBTk_SizeOfImage\fR(\fIimage, widthPtr, heightPtr\fR) .sp \fBTk_FreeImage\fR(\fIimage\fR) .SH ARGUMENTS .AS Tk_ImageChangedProc *changeProc .AP Tcl_Interp *interp in Place to leave error message. .AP Tk_Window tkwin in Window in which image will be used. .AP "const char" *name in Name of image. .AP Tk_ImageChangedProc *changeProc in Procedure for Tk to invoke whenever image content or size changes. | > | | 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 | \fBTk_GetImage\fR(\fIinterp, tkwin, name, changeProc, clientData\fR) .sp \fBTk_RedrawImage\fR(\fIimage, imageX, imageY, width, height, drawable, drawableX, drawableY\fR) .sp \fBTk_SizeOfImage\fR(\fIimage, widthPtr, heightPtr\fR) .sp \fBTk_FreeImage\fR(\fIimage\fR) .fi .SH ARGUMENTS .AS Tk_ImageChangedProc *changeProc .AP Tcl_Interp *interp in Place to leave error message. .AP Tk_Window tkwin in Window in which image will be used. .AP "const char" *name in Name of image. .AP Tk_ImageChangedProc *changeProc in Procedure for Tk to invoke whenever image content or size changes. .AP void *clientData in One-word value for Tk to pass to \fIchangeProc\fR. .AP Tk_Image image in Token for image instance; must have been returned by a previous call to \fBTk_GetImage\fR. .AP int imageX in X-coordinate of upper-left corner of region of image to redisplay (measured in pixels from the image's upper-left corner). |
︙ | ︙ | |||
102 103 104 105 106 107 108 | they can redisplay themselves. The \fIchangeProc\fR and \fIclientData\fR arguments to \fBTk_GetImage\fR are used for this purpose. \fIchangeProc\fR will be called by Tk whenever a change occurs in the image; it must match the following prototype: .CS typedef void \fBTk_ImageChangedProc\fR( | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | they can redisplay themselves. The \fIchangeProc\fR and \fIclientData\fR arguments to \fBTk_GetImage\fR are used for this purpose. \fIchangeProc\fR will be called by Tk whenever a change occurs in the image; it must match the following prototype: .CS typedef void \fBTk_ImageChangedProc\fR( void *\fIclientData\fR, int \fIx\fR, int \fIy\fR, int \fIwidth\fR, int \fIheight\fR, int \fIimageWidth\fR, int \fIimageHeight\fR); .CE |
︙ | ︙ |
Changes to doc/GetJoinStl.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetJoinStyle, Tk_NameOfJoinStyle \- translate between strings and join styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .SH NAME Tk_GetJoinStyle, Tk_NameOfJoinStyle \- translate between strings and join styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetJoinStyle\fR(\fIinterp, string, joinPtr\fR) .sp const char * \fBTk_NameOfJoinStyle\fR(\fIjoin\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *joinPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP "const char" *string in String containing name of join style \- one of .QW \fBbevel\fR , |
︙ | ︙ |
Changes to doc/GetJustify.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .SH NAME Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetJustifyFromObj\fR(\fIinterp, objPtr, justifyPtr\fR) .sp int \fBTk_GetJustify\fR(\fIinterp, string, justifyPtr\fR) .sp const char * \fBTk_NameOfJustify\fR(\fIjustify\fR) .fi .SH ARGUMENTS .AS "Tk_Justify" *justifyPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting, or NULL. .AP Tcl_Obj *objPtr in/out String value contains name of justification style \- one of .QW \fBleft\fR , |
︙ | ︙ | |||
44 45 46 47 48 49 50 | Justification style (one of the values listed below). .BE .SH DESCRIPTION .PP \fBTk_GetJustifyFromObj\fR places in \fI*justifyPtr\fR the justify value corresponding to \fIobjPtr\fR's value. This value will be one of the following: | < | < | < | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | Justification style (one of the values listed below). .BE .SH DESCRIPTION .PP \fBTk_GetJustifyFromObj\fR places in \fI*justifyPtr\fR the justify value corresponding to \fIobjPtr\fR's value. This value will be one of the following: .IP \fBTK_JUSTIFY_LEFT\fR Means that the text on each line should start at the left edge of the line; as a result, the right edges of lines may be ragged. .IP \fBTK_JUSTIFY_RIGHT\fR Means that the text on each line should end at the right edge of the line; as a result, the left edges of lines may be ragged. .IP \fBTK_JUSTIFY_CENTER\fR Means that the text on each line should be centered; as a result, both the left and right edges of lines may be ragged. .PP Under normal circumstances the return value is \fBTCL_OK\fR and \fIinterp\fR is unused. If \fIobjPtr\fR does not contain a valid justification style or an abbreviation of one of these names, \fBTCL_ERROR\fR is returned, |
︙ | ︙ |
Changes to doc/GetOption.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_GetOption \- retrieve an option from the option database .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Uid \fBTk_GetOption\fR(\fItkwin, name, class\fR) .SH ARGUMENTS .AS Tk_Window *class .AP Tk_Window tkwin in Token for window. .AP "const char" *name in Name of desired option. .AP "const char" *class in | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_GetOption \- retrieve an option from the option database .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Uid \fBTk_GetOption\fR(\fItkwin, name, class\fR) .fi .SH ARGUMENTS .AS Tk_Window *class .AP Tk_Window tkwin in Token for window. .AP "const char" *name in Name of desired option. .AP "const char" *class in |
︙ | ︙ |
Changes to doc/GetPixels.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM, Tk_GetDoublePixelsFromObj \- translate between strings and screen units .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | | | > | 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 | .SH NAME Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM, Tk_GetDoublePixelsFromObj \- translate between strings and screen units .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetPixelsFromObj\fR(\fIinterp, tkwin, objPtr, intPtr\fR) .sp int \fBTk_GetDoublePixelsFromObj\fR(\fIinterp, tkwin, objPtr, doublePtr\fR) .sp int \fBTk_GetPixels\fR(\fIinterp, tkwin, string, intPtr\fR) .sp int \fBTk_GetMMFromObj\fR(\fIinterp, tkwin, objPtr, doublePtr\fR) .sp int \fBTk_GetScreenMM\fR(\fIinterp, tkwin, string, doublePtr\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *joinPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Window whose screen geometry determines the conversion between absolute units and pixels. |
︙ | ︙ | |||
52 53 54 55 56 57 58 | the screen (\fIobjPtr\fR or \fIstring\fR) and compute the corresponding distance either in integer pixels or floating-point millimeters. In either case, \fIobjPtr\fR or \fIstring\fR specifies a screen distance as a floating-point number followed by one of the following characters that indicates units: | < | < | < | < | < | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | the screen (\fIobjPtr\fR or \fIstring\fR) and compute the corresponding distance either in integer pixels or floating-point millimeters. In either case, \fIobjPtr\fR or \fIstring\fR specifies a screen distance as a floating-point number followed by one of the following characters that indicates units: .IP <none> The number specifies a distance in pixels. .IP \fBc\fR The number specifies a distance in centimeters on the screen. .IP \fBi\fR The number specifies a distance in inches on the screen. .IP \fBm\fR The number specifies a distance in millimeters on the screen. .IP \fBp\fR The number specifies a distance in printer's points (1/72 inch) on the screen. .PP \fBTk_GetPixelsFromObj\fR converts the value of \fIobjPtr\fR to the nearest even number of pixels and stores that value at \fI*intPtr\fR. It returns \fBTCL_OK\fR under normal circumstances. If an error occurs (e.g. \fIobjPtr\fR contains a number followed |
︙ | ︙ |
Changes to doc/GetPixmap.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetPixmap, Tk_FreePixmap \- allocate and free pixmaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Pixmap | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .SH NAME Tk_GetPixmap, Tk_FreePixmap \- allocate and free pixmaps .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Pixmap \fBTk_GetPixmap\fR(\fIdisplay, d, width, height, depth\fR) .sp \fBTk_FreePixmap\fR(\fIdisplay, pixmap\fR) .fi .SH ARGUMENTS .AS "Drawable" *pixelPtr .AP Display *display in X display for the pixmap. .AP Drawable d in Pixmap or window where the new pixmap will be used for drawing. .AP "int" width in |
︙ | ︙ |
Changes to doc/GetRelief.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .SH NAME Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetReliefFromObj\fR(\fIinterp, objPtr, reliefPtr\fR) .sp int \fBTk_GetRelief\fR(\fIinterp, name, reliefPtr\fR) .sp const char * \fBTk_NameOfRelief\fR(\fIrelief\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *reliefPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tcl_Obj *objPtr in/out String value contains name of relief, one of .QW \fBflat\fR , |
︙ | ︙ |
Changes to doc/GetRootCrd.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_GetRootCoords \- Compute root-window coordinates of window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_GetRootCoords\fR(\fItkwin, xPtr, yPtr\fR) .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .AP int *xPtr out Pointer to location in which to store root-window x-coordinate corresponding to left edge of \fItkwin\fR's border. | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_GetRootCoords \- Compute root-window coordinates of window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_GetRootCoords\fR(\fItkwin, xPtr, yPtr\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .AP int *xPtr out Pointer to location in which to store root-window x-coordinate corresponding to left edge of \fItkwin\fR's border. |
︙ | ︙ |
Changes to doc/GetScroll.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | .SH NAME Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetScrollInfoObj\fR(\fIinterp, objc, objv, fractionPtr, stepsPtr\fR) .sp int \fBTk_GetScrollInfo\fR(\fIinterp, argc, argv, fractionPtr, stepsPtr\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *fractionPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tcl_Size objc in Number of Tcl_Obj's in \fIobjv\fR array. .AP "Tcl_Obj *const *" objv in Argument objects. These represent the entire widget command, of which the first word is typically the widget name and the second word is typically \fBxview\fR or \fByview\fR. .AP int argc in Number of strings in \fIargv\fR array. |
︙ | ︙ |
Changes to doc/GetSelect.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | Tk_GetSelection \- retrieve the contents of a selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetSelection\fR(\fIinterp, tkwin, selection, target, proc, clientData\fR) .SH ARGUMENTS .AS Tk_GetSelProc clientData .AP Tcl_Interp *interp in Interpreter to use for reporting errors. .AP Tk_Window tkwin in Window on whose behalf to retrieve the selection (determines display from which to retrieve). .AP Atom selection in The name of the selection to be retrieved. .AP Atom target in Form in which to retrieve selection. .AP Tk_GetSelProc *proc in Procedure to invoke to process pieces of the selection as they are retrieved. | > | | | 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 | Tk_GetSelection \- retrieve the contents of a selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetSelection\fR(\fIinterp, tkwin, selection, target, proc, clientData\fR) .fi .SH ARGUMENTS .AS Tk_GetSelProc clientData .AP Tcl_Interp *interp in Interpreter to use for reporting errors. .AP Tk_Window tkwin in Window on whose behalf to retrieve the selection (determines display from which to retrieve). .AP Atom selection in The name of the selection to be retrieved. .AP Atom target in Form in which to retrieve selection. .AP Tk_GetSelProc *proc in Procedure to invoke to process pieces of the selection as they are retrieved. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTk_GetSelection\fR retrieves the selection specified by the atom \fIselection\fR in the format specified by \fItarget\fR. The selection may actually be retrieved in several pieces; as each piece is retrieved, \fIproc\fR is called to process the piece. \fIProc\fR should have arguments and result that match the type \fBTk_GetSelProc\fR: .PP .CS typedef int \fBTk_GetSelProc\fR( void *\fIclientData\fR, Tcl_Interp *\fIinterp\fR, char *\fIportion\fR); .CE .PP The \fIclientData\fR and \fIinterp\fR parameters to \fIproc\fR will be copies of the corresponding arguments to \fBTk_GetSelection\fR. \fIPortion\fR will be a pointer to |
︙ | ︙ |
Changes to doc/GetUid.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_GetUid, Tk_Uid \- convert from string to unique identifier .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Uid \fBTk_GetUid\fR(\fIstring\fR) .SH ARGUMENTS .AP char *string in String for which the corresponding unique identifier is desired. .BE .SH DESCRIPTION .PP | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_GetUid, Tk_Uid \- convert from string to unique identifier .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Uid \fBTk_GetUid\fR(\fIstring\fR) .fi .SH ARGUMENTS .AP char *string in String for which the corresponding unique identifier is desired. .BE .SH DESCRIPTION .PP |
︙ | ︙ |
Changes to doc/GetVRoot.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 | .BS .SH NAME Tk_GetVRootGeometry \- Get location and size of virtual root for window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp | | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .BS .SH NAME Tk_GetVRootGeometry \- Get location and size of virtual root for window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_GetVRootGeometry\fR(\fItkwin, xPtr, yPtr, widthPtr, heightPtr\fR) .fi .SH ARGUMENTS .AS Tk_Window heightPtr .AP Tk_Window tkwin in Token for window whose virtual root is to be queried. .AP int xPtr out Points to word in which to store x-offset of virtual root. .AP int yPtr out |
︙ | ︙ |
Changes to doc/GetVisual.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_GetVisual \- translate from string to visual .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Visual * | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .SH NAME Tk_GetVisual \- translate from string to visual .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Visual * \fBTk_GetVisual\fR(\fIinterp, tkwin, string, depthPtr, colormapPtr\fR) .fi .SH ARGUMENTS .AS "Tcl_Interp" *colormapPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which the visual will be used. .AP "const char" *string in |
︙ | ︙ | |||
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 | also locates an appropriate colormap for use with the result visual and stores its X identifier at \fI*colormapPtr\fR. .PP The \fIstring\fR argument specifies the desired visual in one of the following ways: .TP 15 \fIclass depth\fR The string consists of a class name followed by an integer depth, with any amount of white space (including none) in between. \fIclass\fR selects what sort of visual is desired and must be one of \fBdirectcolor\fR, \fBgrayscale\fR, \fBgreyscale\fR, \fBpseudocolor\fR, \fBstaticcolor\fR, \fBstaticgray\fR, \fBstaticgrey\fR, or \fBtruecolor\fR, or a unique abbreviation. \fIdepth\fR specifies how many bits per pixel are needed for the visual. If possible, \fBTk_GetVisual\fR will return a visual with this depth; if there is no visual of the desired depth then \fBTk_GetVisual\fR looks first for a visual with greater depth, then one with less depth. .TP 15 \fBdefault\fR Use the default visual for \fItkwin\fR's screen. .TP 15 \fIpathName\fR Use the visual for the window given by \fIpathName\fR. \fIpathName\fR must be the name of a window on the same screen as \fItkwin\fR. .TP 15 \fInumber\fR Use the visual whose X identifier is \fInumber\fR. .TP 15 \fBbest\fR ?\fIdepth\fR? Choose the .QW "best possible" visual, using the following rules, in decreasing order of priority: .RS .IP (a) a visual that has exactly the desired depth is best, followed by a visual with greater depth than requested (but as little extra | > > > > > | 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 | also locates an appropriate colormap for use with the result visual and stores its X identifier at \fI*colormapPtr\fR. .PP The \fIstring\fR argument specifies the desired visual in one of the following ways: .TP 15 \fIclass depth\fR . The string consists of a class name followed by an integer depth, with any amount of white space (including none) in between. \fIclass\fR selects what sort of visual is desired and must be one of \fBdirectcolor\fR, \fBgrayscale\fR, \fBgreyscale\fR, \fBpseudocolor\fR, \fBstaticcolor\fR, \fBstaticgray\fR, \fBstaticgrey\fR, or \fBtruecolor\fR, or a unique abbreviation. \fIdepth\fR specifies how many bits per pixel are needed for the visual. If possible, \fBTk_GetVisual\fR will return a visual with this depth; if there is no visual of the desired depth then \fBTk_GetVisual\fR looks first for a visual with greater depth, then one with less depth. .TP 15 \fBdefault\fR . Use the default visual for \fItkwin\fR's screen. .TP 15 \fIpathName\fR . Use the visual for the window given by \fIpathName\fR. \fIpathName\fR must be the name of a window on the same screen as \fItkwin\fR. .TP 15 \fInumber\fR . Use the visual whose X identifier is \fInumber\fR. .TP 15 \fBbest\fR ?\fIdepth\fR? . Choose the .QW "best possible" visual, using the following rules, in decreasing order of priority: .RS .IP (a) a visual that has exactly the desired depth is best, followed by a visual with greater depth than requested (but as little extra |
︙ | ︙ |
Changes to doc/Grab.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 | '\" '\" 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 .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_Grab\fR(\fIinterp, tkwin, grabGlobal\fR) .sp \fBTk_Ungrab\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AP Tcl_Interp *interp in Interpreter to use for error reporting .AP Tk_Window tkwin in Window on whose behalf the pointer is to be grabbed or released .AP int grabGlobal in Boolean indicating whether the grab is global or application local |
︙ | ︙ |
Changes to doc/HWNDToWindow.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 | '\" '\" 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 .SH SYNOPSIS .nf \fB#include <tkPlatDecls.h>\fR .sp Tk_Window \fBTk_HWNDToWindow\fR(\fIhwnd\fR) .fi .SH ARGUMENTS .AP HWND hwnd in Windows handle for the window. .BE .SH DESCRIPTION .PP Given a Windows HWND window identifier, this procedure returns the |
︙ | ︙ |
Changes to doc/HandleEvent.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_HandleEvent \- invoke event handlers for window system events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_HandleEvent\fR(\fIeventPtr\fR) .SH ARGUMENTS .AS XEvent *eventPtr .AP XEvent *eventPtr in Pointer to X event to dispatch to relevant handler(s). It is important that all unused fields of the structure be set to zero. .BE .SH DESCRIPTION | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_HandleEvent \- invoke event handlers for window system events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_HandleEvent\fR(\fIeventPtr\fR) .fi .SH ARGUMENTS .AS XEvent *eventPtr .AP XEvent *eventPtr in Pointer to X event to dispatch to relevant handler(s). It is important that all unused fields of the structure be set to zero. .BE .SH DESCRIPTION |
︙ | ︙ |
Changes to doc/IdToWindow.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Tk_IdToWindow \- Find Tk's window information for an X window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_IdToWindow\fR(\fIdisplay, window\fR) .SH ARGUMENTS .AS Tk_Window display .AP Display *display in X display containing the window. .AP Window window in X id for window. .BE | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_IdToWindow \- Find Tk's window information for an X window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_IdToWindow\fR(\fIdisplay, window\fR) .fi .SH ARGUMENTS .AS Tk_Window display .AP Display *display in X display containing the window. .AP Window window in X id for window. .BE |
︙ | ︙ |
Changes to doc/ImgChanged.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_ImageChanged \- notify widgets that image needs to be redrawn .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR) .SH ARGUMENTS .AS Tk_ImageModel imageHeight .AP Tk_ImageModel model in Token for image, which was passed to image's \fIcreateProc\fR when the image was created. .AP int x in X-coordinate of upper-left corner of region that needs redisplay (measured | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_ImageChanged \- notify widgets that image needs to be redrawn .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR) .fi .SH ARGUMENTS .AS Tk_ImageModel imageHeight .AP Tk_ImageModel model in Token for image, which was passed to image's \fIcreateProc\fR when the image was created. .AP int x in X-coordinate of upper-left corner of region that needs redisplay (measured |
︙ | ︙ |
Changes to doc/Inactive.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 | '\" '\" 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 .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp long \fBTk_GetUserInactiveTime\fR(\fIdisplay\fR) .sp \fBTk_ResetUserInactiveTime\fR(\fIdisplay\fR) .fi .SH ARGUMENTS .AS Display *display .AP Display *display in The display on which the user inactivity timer is to be queried or reset. .BE .SH DESCRIPTION |
︙ | ︙ |
Changes to doc/InternAtom.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 | .SH NAME Tk_InternAtom, Tk_GetAtomName \- manage cache of X atoms .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Atom | | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .SH NAME Tk_InternAtom, Tk_GetAtomName \- manage cache of X atoms .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Atom \fBTk_InternAtom\fR(\fItkwin, name\fR) .sp const char * \fBTk_GetAtomName\fR(\fItkwin, atom\fR) .fi .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window. Used to map atom or name relative to a particular display. .AP "const char" *name in String name for which atom is desired. .AP Atom atom in |
︙ | ︙ |
Changes to doc/MainLoop.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_MainLoop \- loop for events until all windows are deleted .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_MainLoop\fR() .BE .SH DESCRIPTION .PP \fBTk_MainLoop\fR is a procedure that loops repeatedly calling \fBTcl_DoOneEvent\fR. It returns only when there are no applications left in this process (i.e. no main windows exist anymore). Most windowing applications will call \fBTk_MainLoop\fR after | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_MainLoop \- loop for events until all windows are deleted .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_MainLoop\fR() .fi .BE .SH DESCRIPTION .PP \fBTk_MainLoop\fR is a procedure that loops repeatedly calling \fBTcl_DoOneEvent\fR. It returns only when there are no applications left in this process (i.e. no main windows exist anymore). Most windowing applications will call \fBTk_MainLoop\fR after |
︙ | ︙ |
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 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_MainWindow\fR(\fIinterp\fR) .sp \fBTk_SetMainMenubar\fR(\fIinterp, tkwin, menuName\fR) .sp \fBTk_SetWindowMenubar\fR(\fIinterp, tkwin, oldMenuName, menuName\fR) .sp int \fBTk_GetNumMainWindows\fR() .fi .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 across 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/MaintGeom.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR) .sp \fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR) .SH ARGUMENTS .AS Tk_Window container .AP Tk_Window window in Window whose geometry is to be controlled. .AP Tk_Window container in Window relative to which \fIwindow\fR's geometry will be controlled. .AP int x in | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR) .sp \fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR) .fi .SH ARGUMENTS .AS Tk_Window container .AP Tk_Window window in Window whose geometry is to be controlled. .AP Tk_Window container in Window relative to which \fIwindow\fR's geometry will be controlled. .AP int x in |
︙ | ︙ |
Changes to doc/ManageGeom.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .SH NAME Tk_ManageGeometry \- arrange to handle geometry requests for a window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ManageGeometry\fR(\fItkwin, mgrPtr, clientData\fR) .SH ARGUMENTS .AS Tk_GeometryProc clientData .AP Tk_Window tkwin in Token for window to be managed. .AP "const Tk_GeomMgr" *mgrPtr in Pointer to data structure containing information about the geometry manager, or NULL to indicate that \fItkwin\fR's geometry should not be managed anymore. The data structure pointed to by \fImgrPtr\fR must be static: Tk keeps a reference to it as long as the window is managed. | > | | 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 | .SH NAME Tk_ManageGeometry \- arrange to handle geometry requests for a window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_ManageGeometry\fR(\fItkwin, mgrPtr, clientData\fR) .fi .SH ARGUMENTS .AS Tk_GeometryProc clientData .AP Tk_Window tkwin in Token for window to be managed. .AP "const Tk_GeomMgr" *mgrPtr in Pointer to data structure containing information about the geometry manager, or NULL to indicate that \fItkwin\fR's geometry should not be managed anymore. The data structure pointed to by \fImgrPtr\fR must be static: Tk keeps a reference to it as long as the window is managed. .AP void *clientData in Arbitrary one-word value to pass to geometry manager callbacks. .BE .SH DESCRIPTION .PP \fBTk_ManageGeometry\fR arranges for a particular geometry manager, described by the \fImgrPtr\fR argument, to control the geometry of a particular content window, given by \fItkwin\fR. |
︙ | ︙ | |||
54 55 56 57 58 59 60 | \fIrequestProc\fR is a procedure in the geometry manager that will be invoked whenever \fBTk_GeometryRequest\fR is called by the content window to change its desired geometry. \fIrequestProc\fR should have arguments and results that match the type \fBTk_GeomRequestProc\fR: .CS typedef void \fBTk_GeomRequestProc\fR( | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | \fIrequestProc\fR is a procedure in the geometry manager that will be invoked whenever \fBTk_GeometryRequest\fR is called by the content window to change its desired geometry. \fIrequestProc\fR should have arguments and results that match the type \fBTk_GeomRequestProc\fR: .CS typedef void \fBTk_GeomRequestProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR); .CE The parameters to \fIrequestProc\fR will be identical to the corresponding parameters passed to \fBTk_ManageGeometry\fR. \fIclientData\fR usually points to a data structure containing application-specific information about how to manage \fItkwin\fR's geometry. |
︙ | ︙ | |||
77 78 79 80 81 82 83 | geometry manager has made this call, so it already knows that the window is no longer managed), nor is it called if \fImgrPtr\fR is the same as the window's current geometry manager. \fIlostContentProc\fR should have arguments and results that match the following prototype: .CS typedef void \fBTk_GeomLostContentProc\fR( | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | geometry manager has made this call, so it already knows that the window is no longer managed), nor is it called if \fImgrPtr\fR is the same as the window's current geometry manager. \fIlostContentProc\fR should have arguments and results that match the following prototype: .CS typedef void \fBTk_GeomLostContentProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR); .CE The parameters to \fIlostContentProc\fR will be identical to the corresponding parameters passed to \fBTk_ManageGeometry\fR. .SH KEYWORDS callback, geometry, managed, request, unmanaged |
Changes to doc/MapWindow.3.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_MapWindow\fR(\fItkwin\fR) .sp \fBTk_UnmapWindow\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .nf \fB#include <tk.h>\fR .sp Tk_Window \fBTk_MapWindow\fR(\fItkwin\fR) .sp \fBTk_UnmapWindow\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP |
︙ | ︙ |
Changes to doc/MeasureChar.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 | .SH NAME Tk_MeasureChars, Tk_TextWidth, Tk_DrawChars, Tk_UnderlineChars \- routines to measure and display simple single-line strings. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int | | | | | | | | | | 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 | .SH NAME Tk_MeasureChars, Tk_TextWidth, Tk_DrawChars, Tk_UnderlineChars \- routines to measure and display simple single-line strings. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_MeasureChars\fR(\fItkfont, string, numBytes, maxPixels, flags, lengthPtr\fR) .sp int \fBTk_TextWidth\fR(\fItkfont, string, numBytes\fR) .sp \fBTk_DrawChars\fR(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y\fR) .sp \fBTk_UnderlineChars\fR(\fIdisplay, drawable, gc, tkfont, string, x, y, firstByte, lastByte\fR) .fi .SH ARGUMENTS .AS "const char" firstChar .AP Tk_Font tkfont in Token for font in which text is to be drawn or measured. Must have been returned by a previous call to \fBTk_GetFont\fR. .AP "const char" *string in Text to be measured or displayed. Need not be null terminated. Any non-printing meta-characters in the string (such as tabs, newlines, and other control characters) will be measured or displayed in a platform-dependent manner. .AP Tcl_Size numBytes in The maximum number of bytes to consider when measuring or drawing \fIstring\fR. Must be greater than or equal to 0. .AP int maxPixels in If \fImaxPixels\fR is >= 0, it specifies the longest permissible line length in pixels. Characters from \fIstring\fR are processed only until this many pixels have been covered. If \fImaxPixels\fR is < 0, then the line length is unbounded and the \fIflags\fR argument is ignored. .AP int flags in Various flag bits OR-ed together: \fBTK_PARTIAL_OK\fR means include a character as long as any part of it fits in the length given by \fImaxPixels\fR; otherwise, a character must fit completely to be considered. \fBTK_WHOLE_WORDS\fR means stop on a word boundary, if possible. If \fBTK_AT_LEAST_ONE\fR is set, it means return at least one character even if no characters could fit in the length given by \fImaxPixels\fR. If \fBTK_AT_LEAST_ONE\fR is set and \fBTK_WHOLE_WORDS\fR is also set, it means that if not even one word fits on the line, return the first few letters of the word that did fit; if not even one letter of the word fit, then the first letter will still be returned. .AP int *lengthPtr out Filled with the number of pixels occupied by the number of characters returned as the result of \fBTk_MeasureChars\fR. .AP Display *display in Display on which to draw. |
︙ | ︙ |
Changes to doc/MoveToplev.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 | .BS .SH NAME Tk_MoveToplevelWindow \- Adjust the position of a top-level window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp | | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .BS .SH NAME Tk_MoveToplevelWindow \- Adjust the position of a top-level window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_MoveToplevelWindow\fR(\fItkwin, x, y\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for top-level window to move. .AP int x in New x-coordinate for the top-left pixel of \fItkwin\fR's border, or the top-left pixel of the decorative border supplied for \fItkwin\fR by the |
︙ | ︙ |
Changes to doc/Name.3.
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | \fBTk_Name\fR(\fItkwin\fR) .sp char * \fBTk_PathName\fR(\fItkwin\fR) .sp Tk_Window \fBTk_NameToWindow\fR(\fIinterp, pathName, tkwin\fR) .SH ARGUMENTS .AS Tcl_Interp *pathName .AP Tk_Window tkwin in Token for window. .AP Tcl_Interp *interp out Interpreter to use for error reporting. .AP "const char" *pathName in | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | \fBTk_Name\fR(\fItkwin\fR) .sp char * \fBTk_PathName\fR(\fItkwin\fR) .sp Tk_Window \fBTk_NameToWindow\fR(\fIinterp, pathName, tkwin\fR) .fi .SH ARGUMENTS .AS Tcl_Interp *pathName .AP Tk_Window tkwin in Token for window. .AP Tcl_Interp *interp out Interpreter to use for error reporting. .AP "const char" *pathName in |
︙ | ︙ |
Changes to doc/NameOfImg.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Tk_NameOfImage \- Return name of image. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_NameOfImage\fR(\fIimageModel\fR) .SH ARGUMENTS .AS Tk_ImageModel imageModel .AP Tk_ImageModel imageModel in Token for image, which was passed to image manager's \fIcreateProc\fR when the image was created. .BE .SH DESCRIPTION | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_NameOfImage \- Return name of image. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_NameOfImage\fR(\fIimageModel\fR) .fi .SH ARGUMENTS .AS Tk_ImageModel imageModel .AP Tk_ImageModel imageModel in Token for image, which was passed to image manager's \fIcreateProc\fR when the image was created. .BE .SH DESCRIPTION |
︙ | ︙ |
Changes to doc/OwnSelect.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .SH NAME Tk_OwnSelection \- make a window the owner of the primary selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_OwnSelection\fR(\fItkwin, selection, proc, clientData\fR) .SH ARGUMENTS .AS Tk_LostSelProc clientData .AP Tk_Window tkwin in Window that is to become new selection owner. .AP Atom selection in The name of the selection to be owned, such as XA_PRIMARY. .AP Tk_LostSelProc *proc in Procedure to invoke when \fItkwin\fR loses selection ownership later. | > | | | 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 | .SH NAME Tk_OwnSelection \- make a window the owner of the primary selection .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_OwnSelection\fR(\fItkwin, selection, proc, clientData\fR) .fi .SH ARGUMENTS .AS Tk_LostSelProc clientData .AP Tk_Window tkwin in Window that is to become new selection owner. .AP Atom selection in The name of the selection to be owned, such as XA_PRIMARY. .AP Tk_LostSelProc *proc in Procedure to invoke when \fItkwin\fR loses selection ownership later. .AP void *clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTk_OwnSelection\fR arranges for \fItkwin\fR to become the new owner of the selection specified by the atom \fIselection\fR. After this call completes, future requests for the selection will be directed to handlers created for \fItkwin\fR using \fBTk_CreateSelHandler\fR. When \fItkwin\fR eventually loses the selection ownership, \fIproc\fR will be invoked so that the window can clean itself up (e.g. by unhighlighting the selection). \fIProc\fR should have arguments and result that match the type \fBTk_LostSelProc\fR: .CS typedef void \fBTk_LostSelProc\fR( void *\fIclientData\fR); .CE The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR argument given to \fBTk_OwnSelection\fR, and is usually a pointer to a data structure containing application-specific information about \fItkwin\fR. .SH KEYWORDS own, selection owner |
Changes to doc/ParseArgv.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_ParseArgv \- process command-line options .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_ParseArgv\fR(\fIinterp, tkwin, argcPtr, argv, argTable, flags\fR) .SH ARGUMENTS .AS Tk_ArgvInfo *argTable .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in Window to use when arguments specify Tk options. If NULL, then no Tk options will be processed. | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_ParseArgv \- process command-line options .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_ParseArgv\fR(\fIinterp, tkwin, argcPtr, argv, argTable, flags\fR) .fi .SH ARGUMENTS .AS Tk_ArgvInfo *argTable .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in Window to use when arguments specify Tk options. If NULL, then no Tk options will be processed. |
︙ | ︙ | |||
109 110 111 112 113 114 115 | .QW "the matching argument" in the descriptions below. As part of the processing, \fBTk_ParseArgv\fR may also use the next argument in \fIargv\fR after the matching argument, which is called .QW "the following argument" . The legal values for \fItype\fR, and the processing that they cause, are as follows: | < | < | < | < | < | < | < | < | < | < | < | < | | 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 | .QW "the matching argument" in the descriptions below. As part of the processing, \fBTk_ParseArgv\fR may also use the next argument in \fIargv\fR after the matching argument, which is called .QW "the following argument" . The legal values for \fItype\fR, and the processing that they cause, are as follows: .IP \fBTK_ARGV_END\fR Marks the end of the table. The last entry in \fIargTable\fR must have this type; all of its other fields are ignored and it will never match any arguments. .IP \fBTK_ARGV_CONSTANT\fR \fISrc\fR is treated as an integer and \fIdst\fR is treated as a pointer to an integer. \fISrc\fR is stored at \fI*dst\fR. The matching argument is discarded. .IP \fBTK_ARGV_INT\fR The following argument must contain an integer string in the format accepted by \fBstrtol\fR (e.g. .QW 0 and .QW 0x prefixes may be used to specify octal or hexadecimal numbers, respectively). \fIDst\fR is treated as a pointer to an integer; the following argument is converted to an integer value and stored at \fI*dst\fR. \fISrc\fR is ignored. The matching and following arguments are discarded from \fIargv\fR. .IP \fBTK_ARGV_FLOAT\fR The following argument must contain a floating-point number in the format accepted by \fBstrtol\fR. \fIDst\fR is treated as the address of a double-precision floating point value; the following argument is converted to a double-precision value and stored at \fI*dst\fR. The matching and following arguments are discarded from \fIargv\fR. .IP \fBTK_ARGV_STRING\fR In this form, \fIdst\fR is treated as a pointer to a (char *); \fBTk_ParseArgv\fR stores at \fI*dst\fR a pointer to the following argument, and discards the matching and following arguments from \fIargv\fR. \fISrc\fR is ignored. .IP \fBTK_ARGV_UID\fR This form is similar to \fBTK_ARGV_STRING\fR, except that the argument is turned into a Tk_Uid by calling \fBTk_GetUid\fR. \fIDst\fR is treated as a pointer to a Tk_Uid; \fBTk_ParseArgv\fR stores at \fI*dst\fR the Tk_Uid corresponding to the following argument, and discards the matching and following arguments from \fIargv\fR. \fISrc\fR is ignored. .IP \fBTK_ARGV_CONST_OPTION\fR This form causes a Tk option to be set (as if the \fBoption\fR command had been invoked). The \fIsrc\fR field is treated as a pointer to a string giving the value of an option, and \fIdst\fR is treated as a pointer to the name of the option. The matching argument is discarded. If \fItkwin\fR is NULL, then argument specifiers of this type are ignored (as if they did not exist). .IP \fBTK_ARGV_OPTION_VALUE\fR This form is similar to \fBTK_ARGV_CONST_OPTION\fR, except that the value of the option is taken from the following argument instead of from \fIsrc\fR. \fIDst\fR is used as the name of the option. \fISrc\fR is ignored. The matching and following arguments are discarded. If \fItkwin\fR is NULL, then argument specifiers of this type are ignored (as if they did not exist). .IP \fBTK_ARGV_OPTION_NAME_VALUE\fR In this case the following argument is taken as the name of a Tk option and the argument after that is taken as the value for that option. Both \fIsrc\fR and \fIdst\fR are ignored. All three arguments are discarded from \fIargv\fR. If \fItkwin\fR is NULL, then argument specifiers of this type are ignored (as if they did not exist). .IP \fBTK_ARGV_HELP\fR When this kind of option is encountered, \fBTk_ParseArgv\fR uses the \fIhelp\fR fields of \fIargTable\fR to format a message describing all the valid arguments. The message is placed in interpreter \fIinterp\fR's result and \fBTk_ParseArgv\fR returns \fBTCL_ERROR\fR. When this happens, the caller normally prints the help message and aborts. If the \fIkey\fR field of a \fBTK_ARGV_HELP\fR specifier is NULL, then the specifier will never match any arguments; in this case the specifier simply provides extra documentation, which will be included when some other \fBTK_ARGV_HELP\fR entry causes help information to be returned. .IP \fBTK_ARGV_REST\fR This option is used by programs or commands that allow the last several of their options to be the name and/or options for some other program. If a \fBTK_ARGV_REST\fR argument is found, then \fBTk_ParseArgv\fR does not process any of the remaining arguments; it returns them all at the beginning of \fIargv\fR (along with any other unprocessed arguments). In addition, \fBTk_ParseArgv\fR treats \fIdst\fR as the address of an integer value, and stores at \fI*dst\fR the index of the first of the \fBTK_ARGV_REST\fR options in the returned \fIargv\fR. This allows the program to distinguish the \fBTK_ARGV_REST\fR options from other unprocessed options that preceded the \fBTK_ARGV_REST\fR. .IP \fBTK_ARGV_FUNC\fR For this kind of argument, \fIsrc\fR is treated as the address of a procedure, which is invoked to process the following argument. The procedure should have the following structure: .RS .CS int \fIfunc\fR(\fIdst\fR, \fIkey\fR, \fInextArg\fR) |
︙ | ︙ | |||
228 229 230 231 232 233 234 | (or NULL if there are not any more arguments left in \fIargv\fR). If \fIfunc\fR uses \fInextArg\fR (so that \fBTk_ParseArgv\fR should discard it), then it should return 1. Otherwise it should return 0 and \fBTkParseArgv\fR will process the following argument in the normal fashion. In either event the matching argument is discarded. .RE | < | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | (or NULL if there are not any more arguments left in \fIargv\fR). If \fIfunc\fR uses \fInextArg\fR (so that \fBTk_ParseArgv\fR should discard it), then it should return 1. Otherwise it should return 0 and \fBTkParseArgv\fR will process the following argument in the normal fashion. In either event the matching argument is discarded. .RE .IP \fBTK_ARGV_GENFUNC\fR This form provides a more general procedural escape. It treats \fIsrc\fR as the address of a procedure, and passes that procedure all of the remaining arguments. The procedure should have the following form: .RS .CS int |
︙ | ︙ | |||
262 263 264 265 266 267 268 | \fBTk_ParseArgv\fR will process them. If \fIgenfunc\fR encounters an error then it should leave an error message in interpreter \fIinterp\fR's result, in the usual Tcl fashion, and return \-1; when this happens \fBTk_ParseArgv\fR will abort its processing and return \fBTCL_ERROR\fR. .RE .SS "FLAGS" | < | < | < | < | | 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 | \fBTk_ParseArgv\fR will process them. If \fIgenfunc\fR encounters an error then it should leave an error message in interpreter \fIinterp\fR's result, in the usual Tcl fashion, and return \-1; when this happens \fBTk_ParseArgv\fR will abort its processing and return \fBTCL_ERROR\fR. .RE .SS "FLAGS" .IP \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR \fBTk_ParseArgv\fR normally treats \fIargv[0]\fR as a program or command name, and returns it to the caller just as if it had not matched \fIargTable\fR. If this flag is given, then \fIargv[0]\fR is not given special treatment. .IP \fBTK_ARGV_NO_ABBREV\fR Normally, \fBTk_ParseArgv\fR accepts unique abbreviations for \fIkey\fR values in \fIargTable\fR. If this flag is given then only exact matches will be acceptable. .IP \fBTK_ARGV_NO_LEFTOVERS\fR Normally, \fBTk_ParseArgv\fR returns unrecognized arguments to the caller. If this bit is set in \fIflags\fR then \fBTk_ParseArgv\fR will return an error if it encounters any argument that does not match \fIargTable\fR. The only exception to this rule is \fIargv[0]\fR, which will be returned to the caller with no errors as long as \fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR is not specified. .IP \fBTK_ARGV_NO_DEFAULTS\fR Normally, \fBTk_ParseArgv\fR searches an internal table of standard argument specifiers in addition to \fIargTable\fR. If this bit is set in \fIflags\fR, then \fBTk_ParseArgv\fR will use only \fIargTable\fR and not its default table. .SH EXAMPLE .PP Here is an example definition of an \fIargTable\fR and |
︙ | ︙ | |||
308 309 310 311 312 313 314 | char *fileName = defaultFileName; Boolean exec = FALSE; /* * Define option descriptions. */ Tk_ArgvInfo argTable[] = { | | | | < < | | | | | 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 | char *fileName = defaultFileName; Boolean exec = FALSE; /* * Define option descriptions. */ Tk_ArgvInfo argTable[] = { {"-X", TK_ARGV_CONSTANT, (char *) 1, &debugFlag, "Turn on debugging printfs"}, {"-N", TK_ARGV_INT, NULL, &numReps, "Number of repetitions"}, {"-of", TK_ARGV_STRING, NULL, &fileName, "Name of file for output"}, {"x", TK_ARGV_REST, NULL, &exec, "File to exec, followed by any arguments (must be last argument)."}, {NULL, TK_ARGV_END, NULL, NULL, NULL} }; int main(int argc, char *argv[]) { \&... if (Tk_ParseArgv(interp, tkwin, &argc, argv, argTable, 0) != TCL_OK) { fprintf(stderr, "%s\en", Tcl_GetString(Tcl_GetObjResult(interp))); exit(1); } /* * Remainder of the program. */ } .CE .PP Note that default values can be assigned to variables named in \fIargTable\fR: the variables will only be overwritten if the particular arguments are present in \fIargv\fR. Here are some example command lines and their effects. .CS prog -N 200 infile # just sets the numReps variable to 200 prog -of out200 infile # sets fileName to reference "out200" prog -XN 10 infile # sets the debug flag, also sets numReps .CE In all of the above examples, \fIargc\fR will be set by \fBTk_ParseArgv\fR to 2, \fIargv\fR[0] will be .QW prog , \fIargv\fR[1] will be .QW infile , and \fIargv\fR[2] will be NULL. .SH KEYWORDS arguments, command line, options |
Changes to doc/QWinEvent.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .nf \fB#include <tk.h>\fR .sp int \fBTk_CollapseMotionEvents\fR(\fIdisplay, collapse\fR) .sp \fBTk_QueueWindowEvent\fR(\fIeventPtr, position\fR) .SH ARGUMENTS .AS Tcl_QueuePosition position .AP Display *display in Display for which to control motion event collapsing. .AP int collapse in Indicates whether motion events should be collapsed or not. .AP XEvent *eventPtr in | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .nf \fB#include <tk.h>\fR .sp int \fBTk_CollapseMotionEvents\fR(\fIdisplay, collapse\fR) .sp \fBTk_QueueWindowEvent\fR(\fIeventPtr, position\fR) .fi .SH ARGUMENTS .AS Tcl_QueuePosition position .AP Display *display in Display for which to control motion event collapsing. .AP int collapse in Indicates whether motion events should be collapsed or not. .AP XEvent *eventPtr in |
︙ | ︙ |
Changes to doc/Restack.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_RestackWindow \- Change a window's position in the stacking order .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_RestackWindow\fR(\fItkwin, aboveBelow, other\fR) .SH ARGUMENTS .AS Tk_Window aboveBelow .AP Tk_Window tkwin in Token for window to restack. .AP int aboveBelow in Indicates new position of \fItkwin\fR relative to \fIother\fR; must be \fBAbove\fR or \fBBelow\fR. | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_RestackWindow \- Change a window's position in the stacking order .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_RestackWindow\fR(\fItkwin, aboveBelow, other\fR) .fi .SH ARGUMENTS .AS Tk_Window aboveBelow .AP Tk_Window tkwin in Token for window to restack. .AP int aboveBelow in Indicates new position of \fItkwin\fR relative to \fIother\fR; must be \fBAbove\fR or \fBBelow\fR. |
︙ | ︙ |
Changes to doc/RestrictEv.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 | Tk_RestrictEvents \- filter and selectively delay X events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_RestrictProc * \fBTk_RestrictEvents\fR(\fIproc, arg, prevArgPtr\fR) .SH ARGUMENTS .AS Tk_RestrictProc **prevArgPtr .AP Tk_RestrictProc *proc in Predicate procedure to call to filter incoming X events. NULL means do not restrict events at all. | > | | | | 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 | Tk_RestrictEvents \- filter and selectively delay X events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_RestrictProc * \fBTk_RestrictEvents\fR(\fIproc, arg, prevArgPtr\fR) .fi .SH ARGUMENTS .AS Tk_RestrictProc **prevArgPtr .AP Tk_RestrictProc *proc in Predicate procedure to call to filter incoming X events. NULL means do not restrict events at all. .AP void *arg in Arbitrary argument to pass to \fIproc\fR. .AP void **prevArgPtr out Pointer to place to save argument to previous restrict procedure. .BE .SH DESCRIPTION .PP This procedure is useful in certain situations where applications are only prepared to receive certain X events. After \fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and hence \fBTk_MainLoop\fR) will filter X input events through \fIproc\fR. \fIProc\fR indicates whether a given event is to be processed immediately, deferred until some later time (e.g. when the event restriction is lifted), or discarded. \fIProc\fR is a procedure with arguments and result that match the type \fBTk_RestrictProc\fR: .CS typedef Tk_RestrictAction \fBTk_RestrictProc\fR( void *\fIarg\fR, XEvent *\fIeventPtr\fR); .CE The \fIarg\fR argument is a copy of the \fIarg\fR passed to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with information it needs to filter events. The \fIeventPtr\fR points to an event under consideration. \fIProc\fR returns a restrict action (enumerated type \fBTk_RestrictAction\fR) that indicates what |
︙ | ︙ |
Changes to doc/SetAppName.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_SetAppName \- Set the name of an application for 'send' commands .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_SetAppName\fR(\fItkwin, name\fR) .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window in application. Used only to select a particular application. .AP "const char" *name in Name under which to register the application. | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_SetAppName \- Set the name of an application for 'send' commands .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_SetAppName\fR(\fItkwin, name\fR) .fi .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window in application. Used only to select a particular application. .AP "const char" *name in Name under which to register the application. |
︙ | ︙ |
Changes to doc/SetCaret.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Tk_SetCaretPos \- set the display caret location .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_SetCaretPos\fR(\fItkwin, x, y, height\fR) .SH ARGUMENTS .AP Tk_Window tkwin in Token for window. .AP int x in Window-relative x coordinate. .AP int y in Window-relative y coordinate. | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_SetCaretPos \- set the display caret location .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_SetCaretPos\fR(\fItkwin, x, y, height\fR) .fi .SH ARGUMENTS .AP Tk_Window tkwin in Token for window. .AP int x in Window-relative x coordinate. .AP int y in Window-relative y coordinate. |
︙ | ︙ |
Changes to doc/SetClass.3.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .nf \fB#include <tk.h>\fR .sp \fBTk_SetClass\fR(\fItkwin, class\fR) .sp Tk_Uid \fBTk_Class\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window. .AP char *class in New class name for window. .BE | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .nf \fB#include <tk.h>\fR .sp \fBTk_SetClass\fR(\fItkwin, class\fR) .sp Tk_Uid \fBTk_Class\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window parent .AP Tk_Window tkwin in Token for window. .AP char *class in New class name for window. .BE |
︙ | ︙ |
Changes to doc/SetClassProcs.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .SH NAME Tk_SetClassProcs \- register widget specific procedures .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_SetClassProcs\fR(\fItkwin, procs, instanceData\fR) .SH ARGUMENTS .AS Tk_ClassProc instanceData .AP Tk_Window tkwin in Token for window to modify. .AP "const Tk_ClassProcs" *procs in Pointer to data structure containing widget specific procedures. The data structure pointed to by \fIprocs\fR must be static: Tk keeps a reference to it as long as the window exists. | > | | | | | 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 | .SH NAME Tk_SetClassProcs \- register widget specific procedures .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_SetClassProcs\fR(\fItkwin, procs, instanceData\fR) .fi .SH ARGUMENTS .AS Tk_ClassProc instanceData .AP Tk_Window tkwin in Token for window to modify. .AP "const Tk_ClassProcs" *procs in Pointer to data structure containing widget specific procedures. The data structure pointed to by \fIprocs\fR must be static: Tk keeps a reference to it as long as the window exists. .AP void *instanceData in Arbitrary one-word value to pass to widget callbacks. .BE .SH DESCRIPTION .PP \fBTk_SetClassProcs\fR is called to register a set of procedures that are used as callbacks in different places. .PP The structure pointed to by \fIprocs\fR contains the following: .CS typedef struct { size_t \fIsize\fR; Tk_ClassWorldChangedProc *\fIworldChangedProc\fR; Tk_ClassCreateProc *\fIcreateProc\fR; Tk_ClassModalProc *\fImodalProc\fR; } \fBTk_ClassProcs\fR; .CE The \fIsize\fR field is used to simplify future expansion of the structure. It should always be set to (literally) \fBsizeof(Tk_ClassProcs)\fR. .PP \fIworldChangedProc\fR is invoked when the system has altered in some way that requires some reaction from the widget. For example, when a font alias (see the \fBfont\fR manual entry) is reconfigured, widgets configured to use that font alias must update their display accordingly. \fIworldChangedProc\fR should have arguments and results that match the type \fBTk_ClassWorldChangedProc\fR: .CS typedef void \fBTk_ClassWorldChangedProc\fR( void *\fIinstanceData\fR); .CE The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR will be identical to the \fIinstanceData\fR parameter passed to \fBTk_SetClassProcs\fR. .PP \fIcreateProc\fR is used to create platform-dependent windows. It is invoked by \fBTk_MakeWindowExist\fR. \fIcreateProc\fR should have arguments and results that match the type \fBTk_ClassCreateProc\fR: .CS typedef Window \fBTk_ClassCreateProc\fR( Tk_Window \fItkwin\fR, Window \fIparent\fR, void *\fIinstanceData\fR); .CE The \fItkwin\fR and \fIinstanceData\fR parameters will be identical to the \fItkwin\fR and \fIinstanceData\fR parameters passed to \fBTk_SetClassProcs\fR. The \fIparent\fR parameter will be the parent of the window to be created. The \fIcreateProc\fR should return the created window. .PP |
︙ | ︙ |
Changes to doc/SetGrid.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_SetGrid\fR(\fItkwin, reqWidth, reqHeight, widthInc, heightInc\fR) .sp \fBTk_UnsetGrid\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tk_Window heightInc .AP Tk_Window tkwin in Token for window. .AP int reqWidth in Width in grid units that corresponds to the pixel dimension \fItkwin\fR has requested via \fBTk_GeometryRequest\fR. | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_SetGrid\fR(\fItkwin, reqWidth, reqHeight, widthInc, heightInc\fR) .sp \fBTk_UnsetGrid\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window heightInc .AP Tk_Window tkwin in Token for window. .AP int reqWidth in Width in grid units that corresponds to the pixel dimension \fItkwin\fR has requested via \fBTk_GeometryRequest\fR. |
︙ | ︙ |
Changes to doc/SetOptions.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 | .SH NAME Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions \- process configuration options .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_OptionTable | | | | | | | | | | > | 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 | .SH NAME Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions \- process configuration options .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_OptionTable \fBTk_CreateOptionTable\fR(\fIinterp, templatePtr\fR) .sp \fBTk_DeleteOptionTable\fR(\fIoptionTable\fR) .sp int \fBTk_InitOptions\fR(\fIinterp, recordPtr, optionTable, tkwin\fR) .sp int \fBTk_SetOptions\fR(\fIinterp, recordPtr, optionTable, objc, objv, tkwin, savePtr, maskPtr\fR) .sp \fBTk_FreeSavedOptions\fR(\fIsavedPtr\fR) .sp \fBTk_RestoreSavedOptions\fR(\fIsavedPtr\fR) .sp Tcl_Obj * \fBTk_GetOptionValue\fR(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fR) .sp Tcl_Obj * \fBTk_GetOptionInfo\fR(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fR) .sp \fBTk_FreeConfigOptions\fR(\fIrecordPtr, optionTable, tkwin\fR) .fi .SH ARGUMENTS .AS Tk_SavedOptions "*const objv[]" in/out .AP Tcl_Interp *interp in A Tcl interpreter. Most procedures use this only for returning error messages; if it is NULL then no error messages are returned. For \fBTk_CreateOptionTable\fR the value cannot be NULL; it gives the interpreter in which the option table will be used. |
︙ | ︙ | |||
54 55 56 57 58 59 60 | fields of this record are modified by procedures such as \fBTk_SetOptions\fR and read by procedures such as \fBTk_GetOptionValue\fR. .AP Tk_Window tkwin in For options such as \fBTK_OPTION_COLOR\fR, this argument indicates the window in which the option will be used. If \fIoptionTable\fR uses no window-dependent options, then a NULL value may be supplied for this argument. | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | fields of this record are modified by procedures such as \fBTk_SetOptions\fR and read by procedures such as \fBTk_GetOptionValue\fR. .AP Tk_Window tkwin in For options such as \fBTK_OPTION_COLOR\fR, this argument indicates the window in which the option will be used. If \fIoptionTable\fR uses no window-dependent options, then a NULL value may be supplied for this argument. .AP Tcl_Size objc in Number of values in \fIobjv\fR. .AP Tcl_Obj "*const *objv" in Command-line arguments for setting configuring options. .AP Tk_SavedOptions *savePtr out If not NULL, the structure pointed to by this argument is filled in with the old values of any options that were modified and old values are restored automatically if an error occurs in \fBTk_SetOptions\fR. |
︙ | ︙ | |||
94 95 96 97 98 99 100 | .QW widget will be used to refer to the object whose options are being managed; in practice the object may not actually be a widget. The term .QW "widget record" is used to refer to the C-level structure in which information about a particular widget or object is stored. .PP | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | .QW widget will be used to refer to the object whose options are being managed; in practice the object may not actually be a widget. The term .QW "widget record" is used to refer to the C-level structure in which information about a particular widget or object is stored. .PP Note that the easiest way to learn how to use these procedures is to look at a working example. In Tk, the simplest example is the code that implements the button family of widgets, which is in \fBtkButton.c\fR. Other examples are in \fBtkSquare.c\fR and \fBtkMenu.c\fR. .PP In order to use these procedures, the code that implements the widget must contain a static array of Tk_OptionSpec structures. This is a template that describes the various options supported by that class of |
︙ | ︙ | |||
123 124 125 126 127 128 129 | class. A Tk_OptionTable may be used only in a single interpreter, given by the \fIinterp\fR argument to \fBTk_CreateOptionTable\fR. When an option table is no longer needed \fBTk_DeleteOptionTable\fR should be called to free all of its resources. All of the option tables for a Tcl interpreter are freed automatically if the interpreter is deleted. .PP \fBTk_InitOptions\fR is invoked when a new widget is created to set the | | < | < | > > | 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 | class. A Tk_OptionTable may be used only in a single interpreter, given by the \fIinterp\fR argument to \fBTk_CreateOptionTable\fR. When an option table is no longer needed \fBTk_DeleteOptionTable\fR should be called to free all of its resources. All of the option tables for a Tcl interpreter are freed automatically if the interpreter is deleted. .PP \fBTk_InitOptions\fR is invoked when a new widget is created to set the default values. \fBTk_InitOptions\fR is passed a token for an option table (\fIoptionTable\fR) and a pointer to a widget record (\fIrecordPtr\fR), which is the C structure that holds information about this widget. \fBTk_InitOptions\fR uses the information in the option table to choose an appropriate default for each option, then it stores the default value directly into the widget record, overwriting any information that was already present in the widget record. \fBTk_InitOptions\fR normally returns \fBTCL_OK\fR. If an error occurred while setting the default values (e.g., because a default value was erroneous) then \fBTCL_ERROR\fR is returned and an error message is left in \fIinterp\fR's result if \fIinterp\fR is not NULL. For any widget's configuration option that has \fBTK_OPTION_DONT_SET_DEFAULT\fR set in its \fIflags\fR field, the above initialization is fully skipped, see below. .PP \fBTk_SetOptions\fR is invoked to modify configuration options based on information specified in a Tcl command. The command might be one that creates a new widget, or a command that modifies options on an existing widget. The \fIobjc\fR and \fIobjv\fR arguments describe the values of the arguments from the Tcl command. \fIObjv\fR must contain an even number of objects: the first object of each pair gives the name of |
︙ | ︙ | |||
297 298 299 300 301 302 303 | \fBTK_OPTION_INT\fR then the internal form is an integer. If the \fIobjOffset\fR or \fIinternalOffset\fR field is negative then the value is not stored in that form. At least one of the offsets must be greater than or equal to zero. .PP The \fIflags\fR field consists of one or more bits ORed together. The following flags are supported: | < | < | > > > > > > > > > > > > > | | | | > | < | | > | > > | < | < | < | < | | < | < | < | | > > > > > | < > > > > > | | < > > > | | | | < | | | < | < | < | < | | 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 | \fBTK_OPTION_INT\fR then the internal form is an integer. If the \fIobjOffset\fR or \fIinternalOffset\fR field is negative then the value is not stored in that form. At least one of the offsets must be greater than or equal to zero. .PP The \fIflags\fR field consists of one or more bits ORed together. The following flags are supported: .IP \fBTK_OPTION_NULL_OK\fR If this bit is set for an option then an empty string will be accepted as the value for the option and the resulting internal form will be a NULL pointer, a zero value, or \fBNone\fR, depending on the type of the option. If the flag is not set then empty strings will result in errors. \fBTK_OPTION_NULL_OK\fR is typically used to allow a feature to be turned off entirely, e.g. set a cursor value to \fBNone\fR so that a window simply inherits its parent's cursor. Not all option types support the \fBTK_OPTION_NULL_OK\fR flag; for those that do, there is an explicit indication of that fact in the descriptions below. .IP \fBTK_OPTION_DONT_SET_DEFAULT\fR If this bit is set for an option then no default value will be set in \fBTk_InitOptions\fR for this option. Neither the option database, nor any system default value, nor \fIoptionTable\fR are used to give a default value to this option. Instead it is assumed that the caller has already supplied a default value in the widget code. .IP \fBTK_OPTION_ENUM_VAR\fR If this value is set for an option, then it indicates the the internalOffset points to an enum variable in stead of an int variable. Only useful in combination with \fBTK_OPTION_STRING_TABLE\fR, \fBTK_OPTION_BOOLEAN\fR, \fBTK_OPTION_ANCHOR\fR, \fBTK_OPTION_JUSTIFY\fR, or \fBTK_OPTION_ANCHOR\fR. .IP \fBTK_OPTION_VAR(\fItype\fB)\fR If this value is set for an option, then it indicates the the internalOffset points to a \fItype\fR variable in stead of an int variable. Only useful in combination with \fBTK_OPTION_STRING_TABLE\fR or \fBTK_OPTION_BOOLEAN\fR, or as \fBTK_OPTION_VAR(Tcl_Size)\fR with \fBTK_OPTION_INT\fR .RS .PP The \fItype\fR field of each Tk_OptionSpec structure determines how to parse the value of that configuration option. The legal value for \fItype\fR, and the corresponding actions, are described below. If the type requires a \fItkwin\fR value to be passed into procedures like \fBTk_SetOptions\fR, or if it uses 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. .RE .IP \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. .IP \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. .IP \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 that if the \fIobjOffset\fR field is not used, 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. .IP \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. .IP \fBTK_OPTION_COLOR\fR The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. The internal form is an (XColor *) token like the ones returned by \fBTk_AllocColorFromObj\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. .IP \fBTK_OPTION_CURSOR\fR The value must be a standard cursor name such as \fBcross\fR or \fB@foo\fR. The internal form is a Tk_Cursor token like the ones returned by \fBTk_AllocCursorFromObj\fR. This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR, and when the option is set the cursor for the window is changed by calling \fBXDefineCursor\fR. This option type also supports the \fBTK_OPTION_NULL_OK\fR flag. .IP \fBTK_OPTION_CUSTOM\fR This option allows applications to define new option types. The clientData field of the entry points to a structure defining the new option type. See the section \fBCUSTOM OPTION TYPES\fR below for details. .IP \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. .IP \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 deeply. This feature allows common options to be shared by several widget classes. .IP \fBTK_OPTION_FONT\fR The value must be a standard font name such as \fBTimes 16\fR. The internal form is a Tk_Font handle like the ones returned by \fBTk_AllocFontFromObj\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. .IP \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. .IP \fBTK_OPTION_INDEX\fR The string value must be an index in the format accepted by \fBTcl_GetIntForIndex()\fR or the empty string. The internal form is a C \fBint\fR value. If the string starts with \fB\-\fR, the internal representation will be set to INT_MIN. If the string has the form \fBend-???\fR, then the result will be a negative number: \fB-1\fR stands for \fBend\fR, \fB-2\fR stands for \fBend-1\fR and so on. 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. .IP \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. .IP \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 that if the \fIobjOffset\fR field is not used, 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. .IP \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. .IP \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. .IP \fBTK_OPTION_STRING_TABLE\fR For this type, \fIclientData\fR is a pointer to an array of strings suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must be one of the strings in the table, or a unique abbreviation of one of the strings. The internal form is an integer giving the index into the table of the matching string, like the return value from \fBTcl_GetStringFromObj\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal representation is set to -1. .IP \fBTK_OPTION_SYNONYM\fR This type is used to provide alternative names for an option (for example, \fB\-bg\fR is often used as a synonym for \fB\-background\fR). The \fBclientData\fR field is a string that gives the name of another option in the same table. Whenever the synonym option is used, the information from the other option will be used instead. .IP \fBTK_OPTION_WINDOW\fR The value must be a window path name. The internal form is a \fBTk_Window\fR token for the window. This option type requires \fItkwin\fR to be supplied to procedures such as \fBTk_SetOptions\fR (in order to identify the application), and it supports the \fBTK_OPTION_NULL_OK\fR flag. .SH "STORAGE MANAGEMENT ISSUES" .PP |
︙ | ︙ | |||
491 492 493 494 495 496 497 | the original screen-independent value. Thus for \fBTK_OPTION_PIXELS\fR options it is better to use the \fIobjOffset\fR field. In this case the original value of the option is retained in the object and can be returned when the option is retrieved. In most cases it is convenient to use the \fIinternalOffset\fR field as well, so that the integer value is immediately available for use in the widget code (alternatively, \fBTk_GetPixelsFromObj\fR can be used to extract the integer value from | | | > > > > | | | | | | < | < | < | < | < | < | < | < | | 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 | the original screen-independent value. Thus for \fBTK_OPTION_PIXELS\fR options it is better to use the \fIobjOffset\fR field. In this case the original value of the option is retained in the object and can be returned when the option is retrieved. In most cases it is convenient to use the \fIinternalOffset\fR field as well, so that the integer value is immediately available for use in the widget code (alternatively, \fBTk_GetPixelsFromObj\fR can be used to extract the integer value from the object whenever it is needed). Note that the problem of losing information on retrievals exists only for \fBTK_OPTION_PIXELS\fR options. .PP The second reason to use the \fIobjOffset\fR field is in order to implement new types of options not supported by these procedures. To implement a new type of option, you can use \fBTK_OPTION_STRING\fR as the type in the Tk_OptionSpec structure and set the \fIobjOffset\fR field but not the \fIinternalOffset\fR field. Then, after calling \fBTk_SetOptions\fR, convert the object to internal form yourself. .PP Ttk widgets do not support the \fIinternalOffset\fR machinery. Option values of Ttk widgets are always stored as (Tcl_Obj *), meaning that the \fIobjOffset\fR field must be used. .SH "CUSTOM OPTION TYPES" .PP Applications can extend the built-in configuration types with additional configuration types by writing procedures to parse, print, free, and restore saved copies of the type and creating a structure pointing to those procedures: .CS typedef struct { char *name; Tk_CustomOptionSetProc *\fIsetProc\fR; Tk_CustomOptionGetProc *\fIgetProc\fR; Tk_CustomOptionRestoreProc *\fIrestoreProc\fR; Tk_CustomOptionFreeProc *\fIfreeProc\fR; void *\fIclientData\fR; } \fBTk_ObjCustomOption\fR; typedef int \fBTk_CustomOptionSetProc\fR( void *\fIclientData\fR, Tcl_Interp *\fIinterp\fR, Tk_Window \fItkwin\fR, Tcl_Obj **\fIvaluePtr\fR, char *\fIrecordPtr\fR, int \fIinternalOffset\fR, char *\fIsaveInternalPtr\fR, int \fIflags\fR); typedef Tcl_Obj *\fBTk_CustomOptionGetProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIrecordPtr\fR, int \fIinternalOffset\fR); typedef void \fBTk_CustomOptionRestoreProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIinternalPtr\fR, char *\fIsaveInternalPtr\fR); typedef void \fBTk_CustomOptionFreeProc\fR( void *\fIclientData\fR, Tk_Window \fItkwin\fR, char *\fIinternalPtr\fR); .CE .PP The Tk_ObjCustomOption structure contains six fields: a name for the custom option type; pointers to the four procedures; and a \fIclientData\fR value to be passed to those procedures when they are invoked. The \fIclientData\fR value typically points to a structure containing information that is needed by the procedures when they are parsing and printing options. \fIRestoreProc\fR and \fIfreeProc\fR may be NULL, indicating that no function should be called for those operations. .PP The \fIsetProc\fR procedure is invoked by \fBTk_SetOptions\fR to convert a Tcl_Obj into an internal representation and store the resulting value in the widget record. The arguments are: .RS .IP \fIclientData\fR A copy of the \fIclientData\fR field in the Tk_ObjCustomOption structure. .IP \fIinterp\fR A pointer to a Tcl interpreter, used for error reporting. .IP \fITkwin\fR A copy of the \fItkwin\fR argument to \fBTk_SetOptions\fR .IP \fIvaluePtr\fR A pointer to a reference to a Tcl_Obj describing the new value for the option; it could have been specified explicitly in the call to \fBTk_SetOptions\fR or it could come from the option database or a default. If the objOffset for the option is non-negative (the option value is stored as a (Tcl_Obj *) in the widget record), the Tcl_Obj pointer referenced by \fIvaluePtr\fR is the pointer that will be stored at the objOffset for the option. \fISetProc\fR may modify the value if necessary; for example, \fIsetProc\fR may change the value to NULL to support the \fBTK_OPTION_NULL_OK\fR flag. .IP \fIrecordPtr\fR A pointer to the start of the widget record to modify. .IP \fIinternalOffset\fR Offset in bytes from the start of the widget record to the location where the internal representation of the option value is to be placed. .IP \fIsaveInternalPtr\fR A pointer to storage allocated in a Tk_SavedOptions structure for the internal representation of the original option value. Before setting the option to its new value, \fIsetProc\fR should set the value referenced by \fIsaveInternalPtr\fR to the original value of the option in order to support \fBTk_RestoreSavedOptions\fR. .IP \fIflags\fR A copy of the \fIflags\fR field in the Tk_OptionSpec structure for the option .RE .PP \fISetProc\fR returns a standard Tcl result: \fBTCL_OK\fR to indicate successful processing, or \fBTCL_ERROR\fR to indicate a failure of any kind. An error message may be left in the Tcl interpreter given by \fIinterp\fR in |
︙ | ︙ |
Changes to doc/SetVisual.3.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_SetWindowVisual \- change visual characteristics of window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_SetWindowVisual\fR(\fItkwin, visual, depth, colormap\fR) .SH ARGUMENTS .AS "Tk_Window int" colormap .AP Tk_Window tkwin in Token for window. .AP Visual *visual in New visual type to use for \fItkwin\fR. .AP "int" depth in | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Tk_SetWindowVisual \- change visual characteristics of window .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_SetWindowVisual\fR(\fItkwin, visual, depth, colormap\fR) .fi .SH ARGUMENTS .AS "Tk_Window int" colormap .AP Tk_Window tkwin in Token for window. .AP Visual *visual in New visual type to use for \fItkwin\fR. .AP "int" depth in |
︙ | ︙ | |||
39 40 41 42 43 44 45 | The safest thing is to call \fBTk_SetWindowVisual\fR immediately after calling \fBTk_CreateWindow\fR. If \fItkwin\fR has already been created before \fBTk_SetWindowVisual\fR is called then it returns 0 and does not make any changes; otherwise it returns 1 to signify that the operation completed successfully. .PP | | | 40 41 42 43 44 45 46 47 48 49 50 51 | The safest thing is to call \fBTk_SetWindowVisual\fR immediately after calling \fBTk_CreateWindow\fR. If \fItkwin\fR has already been created before \fBTk_SetWindowVisual\fR is called then it returns 0 and does not make any changes; otherwise it returns 1 to signify that the operation completed successfully. .PP Note that \fBTk_SetWindowVisual\fR should not be called if you just want to change a window's colormap without changing its visual or depth; call \fBTk_SetWindowColormap\fR instead. .SH KEYWORDS colormap, depth, visual |
Changes to doc/StrictMotif.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Tk_StrictMotif \- Return value of tk_strictMotif variable .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_StrictMotif\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_StrictMotif \- Return value of tk_strictMotif variable .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_StrictMotif\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP |
︙ | ︙ |
Changes to doc/TextLayout.3.
︙ | ︙ | |||
10 11 12 13 14 15 16 | .SH NAME Tk_ComputeTextLayout, Tk_FreeTextLayout, Tk_DrawTextLayout, Tk_UnderlineTextLayout, Tk_PointToChar, Tk_CharBbox, Tk_DistanceToTextLayout, Tk_IntersectTextLayout, Tk_TextLayoutToPostscript \- routines to measure and display single-font, multi-line, justified text. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_TextLayout | | < | < | < | | | | | < | > | 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 | .SH NAME Tk_ComputeTextLayout, Tk_FreeTextLayout, Tk_DrawTextLayout, Tk_UnderlineTextLayout, Tk_PointToChar, Tk_CharBbox, Tk_DistanceToTextLayout, Tk_IntersectTextLayout, Tk_TextLayoutToPostscript \- routines to measure and display single-font, multi-line, justified text. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_TextLayout \fBTk_ComputeTextLayout\fR(\fItkfont, string, numChars, wrapLength, justify, flags, widthPtr, heightPtr\fR) .sp \fBTk_FreeTextLayout\fR(\fIlayout\fR) .sp \fBTk_DrawTextLayout\fR(\fIdisplay, drawable, gc, layout, x, y, firstChar, lastChar\fR) .sp \fBTk_UnderlineTextLayout\fR(\fIdisplay, drawable, gc, layout, x, y, underline\fR) .sp int \fBTk_PointToChar\fR(\fIlayout, x, y\fR) .sp int \fBTk_CharBbox\fR(\fIlayout, index, xPtr, yPtr, widthPtr, heightPtr\fR) .sp int \fBTk_DistanceToTextLayout\fR(\fIlayout, x, y\fR) .sp int \fBTk_IntersectTextLayout\fR(\fIlayout, x, y, width, height\fR) .sp \fBTk_TextLayoutToPostscript\fR(\fIinterp, layout\fR) .fi .SH ARGUMENTS .AS Tk_TextLayout "*xPtr, *yPtr" .AP Tk_Font tkfont in Font to use when constructing and displaying a text layout. The \fItkfont\fR must remain valid for the lifetime of the text layout. Must have been returned by a previous call to \fBTk_GetFont\fR. .AP "const char" *string in |
︙ | ︙ | |||
96 97 98 99 100 101 102 | this GC must correspond to the \fItkfont\fR used when constructing the text layout. .AP int "x, y" in Point, in pixels, at which to place the upper-left hand corner of the text layout when it is being drawn, or the coordinates of a point (with respect to the upper-left hand corner of the text layout) to check against the text layout. | | | | > | | | 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 | this GC must correspond to the \fItkfont\fR used when constructing the text layout. .AP int "x, y" in Point, in pixels, at which to place the upper-left hand corner of the text layout when it is being drawn, or the coordinates of a point (with respect to the upper-left hand corner of the text layout) to check against the text layout. .AP Tcl_Size firstChar in The index of the first character to draw from the given text layout. The number 0 means to draw from the beginning. .AP Tcl_Size 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 Tcl_Size 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 is not calculated. |
︙ | ︙ |
Changes to doc/TkInitStubs.3.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Tk_InitStubs \- initialize the Tk stubs mechanism .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_InitStubs\fR(\fIinterp, version, exact\fR) .SH ARGUMENTS .AS Tcl_Interp *interp in .AP Tcl_Interp *interp in Tcl interpreter handle. .AP char *version in A version string consisting of one or more decimal numbers separated by dots. | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | Tk_InitStubs \- initialize the Tk stubs mechanism .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_InitStubs\fR(\fIinterp, version, exact\fR) .fi .SH ARGUMENTS .AS Tcl_Interp *interp in .AP Tcl_Interp *interp in Tcl interpreter handle. .AP char *version in A version string consisting of one or more decimal numbers separated by dots. |
︙ | ︙ |
Changes to doc/Tk_Init.3.
︙ | ︙ | |||
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 | its command-line arguments). .PP \fBTk_SafeInit\fR is identical to \fBTk_Init\fR except that it removes all Tk commands that are considered unsafe. Those commands and the reasons for their exclusion are: .TP \fBbell\fR Continuous ringing of the bell is a nuisance. .TP \fBclipboard\fR A malicious script could replace the contents of the clipboard with the string .QW "\fBrm \-r *\fR" and lead to surprises when the contents of the clipboard are pasted. .TP \fBgrab\fR Grab can be used to block the user from using any other applications. .TP \fBmenu\fR Menus can be used to cover the entire screen and to steal input from the user. .TP \fBselection\fR See clipboard. .TP \fBsend\fR Send can be used to cause unsafe interpreters to execute commands. .TP \fBtk\fR The tk command recreates the send command, which is unsafe. .TP \fBtkwait\fR Tkwait can block the containing process forever .TP \fBtoplevel\fR Toplevels can be used to cover the entire screen and to steal input from the user. .TP \fBwm\fR If toplevels are ever allowed, wm can be used to remove decorations, move windows around, etc. .SH KEYWORDS safe, application, initialization, load, main window | > > > > > > > > > > | 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 | its command-line arguments). .PP \fBTk_SafeInit\fR is identical to \fBTk_Init\fR except that it removes all Tk commands that are considered unsafe. Those commands and the reasons for their exclusion are: .TP \fBbell\fR . Continuous ringing of the bell is a nuisance. .TP \fBclipboard\fR . A malicious script could replace the contents of the clipboard with the string .QW "\fBrm \-r *\fR" and lead to surprises when the contents of the clipboard are pasted. .TP \fBgrab\fR . Grab can be used to block the user from using any other applications. .TP \fBmenu\fR . Menus can be used to cover the entire screen and to steal input from the user. .TP \fBselection\fR . See clipboard. .TP \fBsend\fR . Send can be used to cause unsafe interpreters to execute commands. .TP \fBtk\fR . The tk command recreates the send command, which is unsafe. .TP \fBtkwait\fR . Tkwait can block the containing process forever .TP \fBtoplevel\fR . Toplevels can be used to cover the entire screen and to steal input from the user. .TP \fBwm\fR . If toplevels are ever allowed, wm can be used to remove decorations, move windows around, etc. .SH KEYWORDS safe, application, initialization, load, main window |
Changes to doc/Tk_Main.3.
︙ | ︙ | |||
13 14 15 16 17 18 19 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_Main\fR(\fIargc, argv, appInitProc\fR) .SH ARGUMENTS .AS Tcl_AppInitProc *appInitProc | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_Main\fR(\fIargc, argv, appInitProc\fR) .SH ARGUMENTS .AS Tcl_AppInitProc *appInitProc .AP Tcl_Size argc in Number of elements in \fIargv\fR. .AP char *argv[] in Array of strings containing command-line arguments. On Windows, when using -DUNICODE, the parameter type changes to wchar_t *. .AP Tcl_AppInitProc *appInitProc in Address of an application-specific initialization procedure. The value for this argument is usually \fBTcl_AppInit\fR. |
︙ | ︙ |
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 65 | '\" '\" 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\fR(\fItkwin\fR) .sp \fBTk_MakeContainer\fR(\fItkwin\fR) .sp \fBTk_MakeWindow\fR(\fItkwin, parent\fR) .sp int \fBTk_UseWindow\fR(\fIinterp, tkwin, string\fR) .fi .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/WindowId.3.
︙ | ︙ | |||
99 100 101 102 103 104 105 106 107 108 109 110 111 112 | \fBTk_Colormap\fR(\fItkwin\fR) .sp Tcl_Interp * \fBTk_Interp\fR(\fItkwin\fR) .sp Tcl_Obj * \fBTk_NewWindowObj\fR(\fItkwin\fR) .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP | > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | \fBTk_Colormap\fR(\fItkwin\fR) .sp Tcl_Interp * \fBTk_Interp\fR(\fItkwin\fR) .sp Tcl_Obj * \fBTk_NewWindowObj\fR(\fItkwin\fR) .fi .SH ARGUMENTS .AS Tk_Window tkwin .AP Tk_Window tkwin in Token for window. .BE .SH DESCRIPTION .PP |
︙ | ︙ | |||
143 144 145 146 147 148 149 | The width and height information refers to the interior size of the window, not including any border. \fBTk_Changes\fR returns a pointer to a structure containing all of the above information plus a few other fields. \fBTk_Attributes\fR returns a pointer to an XSetWindowAttributes structure describing all of the attributes of the \fItkwin\fR's window, such as background pixmap, event mask, and so on (Tk keeps track of all this information | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | The width and height information refers to the interior size of the window, not including any border. \fBTk_Changes\fR returns a pointer to a structure containing all of the above information plus a few other fields. \fBTk_Attributes\fR returns a pointer to an XSetWindowAttributes structure describing all of the attributes of the \fItkwin\fR's window, such as background pixmap, event mask, and so on (Tk keeps track of all this information as it is changed by the application). Note that it is essential that applications use Tk procedures like \fBTk_ResizeWindow\fR instead of X procedures like \fBXResizeWindow\fR, so that Tk can keep its data structures up-to-date. .PP \fBTk_IsContainer\fR returns a non-zero value if \fItkwin\fR is a container, and that some other application may be embedding itself inside \fItkwin\fR. |
︙ | ︙ |
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 161 | 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, |
︙ | ︙ | |||
169 170 171 172 173 174 175 | types; where two names appear together, they are synonyms. .DS .ta \w'\fBButton, ButtonPress\0\0\0\fR'u +\w'\fBKey, KeyPress\0\0\0\fR'u \fBActivate\fR \fBDestroy\fR \fBMap\fR \fBButton\fR, \fBButtonPress\fR \fBEnter\fR \fBMapRequest\fR \fBButtonRelease\fR \fBExpose\fR \fBMotion\fR \fBCirculate\fR \fBFocusIn\fR \fBMouseWheel\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 238 239 240 241 242 | types; where two names appear together, they are synonyms. .DS .ta \w'\fBButton, ButtonPress\0\0\0\fR'u +\w'\fBKey, KeyPress\0\0\0\fR'u \fBActivate\fR \fBDestroy\fR \fBMap\fR \fBButton\fR, \fBButtonPress\fR \fBEnter\fR \fBMapRequest\fR \fBButtonRelease\fR \fBExpose\fR \fBMotion\fR \fBCirculate\fR \fBFocusIn\fR \fBMouseWheel\fR \fBTouchpadScroll\fR \fBCirculateRequest\fR \fBFocusOut\fR \fBProperty\fR \fBColormap\fR \fBGravity\fR \fBReparent\fR \fBConfigure\fR \fBKey\fR, \fBKeyPress\fR \fBResizeRequest\fR \fBConfigureRequest\fR \fBKeyRelease\fR \fBUnmap\fR \fBCreate\fR \fBLeave\fR \fBVisibility\fR \fBDeactivate\fR .DE Most of the above events have the same fields and behaviors as events in the X Windowing system. You can find more detailed descriptions of these events in any X window programming book. A couple of the events are extensions to the X event system to support features unique to the Macintosh and Windows platforms. We provide a little more detail on these events here. These include: .IP "\fBActivate\fR, \fBDeactivate\fR" 5 These two events are sent to every sub-window of a toplevel when they change state. In addition to the focus Window, the Macintosh platform and Windows platforms have a notion of an active window (which often has but is not required to have the focus). On the Macintosh, widgets in the active window have a different appearance than widgets in deactive windows. The \fBActivate\fR event is sent to all the sub-windows in a toplevel when it changes from being deactive to active. Likewise, the \fBDeactive\fR event is sent when the window's state changes from active to deactive. There are no useful percent substitutions you would make when binding to these events. .IP \fBMouseWheel\fR 5 Many contemporary mice include a mouse wheel, which is used for scrolling documents without using the scrollbars. By rolling the wheel, the system will generate \fBMouseWheel\fR events that the application can use to scroll. The event is routed to the window currently under the mouse pointer. When the event is received you can use the \fB%D\fR substitution to get the \fIdelta\fR field for the event, which is an integer value describing how the mouse wheel has moved. The smallest value for which the system will report is defined by the OS. The sign of the value determines which direction your widget should scroll. Positive values should scroll up and negative values should scroll down. .RS .PP Horizontal scrolling uses \fBShift-MouseWheel\fR events, with positive \fB%D\fR \fIdelta\fR substitution indicating left scrolling and negative right scrolling. Horizontal scrolling events are generated tilt wheels on some mice. Horizontal scrolling can also be emulated by holding Shift and scrolling vertically. .RE .IP "\fBTouchpadScroll\fR" 5 On some platforms (currently Windows and macOS) there is support for high-resolution scrolling devices, such as touchpads. This is provided via \fBTouchpadScroll\fR events. These events store two 16 bit delta values in the integer provided by the \fB%D\fR substitution. The \fIX\fR delta is in the high order 16 bits and the \fIY\fR delta is in the low order 16 bits. These values can be unpacked by using the tk::PreciseScrollDeltas utility procedure. For example: .CS lassign [tk::PreciseScrollDeltas %D] deltaX deltaY .CE The \fB$#\fR substitution is a counter for \fBTouchpadScroll\fR events which can be used by widgets that only support scrolling by units to ignore some portion of the events. .IP "\fBKeyPress\fR, \fBKeyRelease\fR" 5 The \fBKeyPress\fR and \fBKeyRelease\fR events are generated whenever a key is pressed or released. \fBKeyPress\fR and \fBKeyRelease\fR .IP "\fBKey\fR, \fBKeyRelease\fR" 5 The \fBKey\fR and \fBKeyRelease\fR events are generated whenever a key is pressed or released. \fBKey\fR and \fBKeyRelease\fR events are sent to the window which currently has the keyboard focus. |
︙ | ︙ | |||
631 632 633 634 635 636 637 | appended scripts, is terminated but Tk will continue processing binding scripts associated with other \fItag\fR's. If the \fBbreak\fR command is invoked within a binding script, then that script terminates and no other scripts will be invoked for the event. .PP Within a script called from the binding script, \fBreturn\fR | | | | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | appended scripts, is terminated but Tk will continue processing binding scripts associated with other \fItag\fR's. If the \fBbreak\fR command is invoked within a binding script, then that script terminates and no other scripts will be invoked for the event. .PP Within a script called from the binding script, \fBreturn\fR \fB\-code ok\fR may be used to continue processing (including .QW + appended scripts), or \fBreturn\fR \fB\-code break\fR may be used to stop processing all other binding scripts. .PP If more than one binding matches a particular event and they have the same \fItag\fR, then the most specific binding is chosen and its script is evaluated. The following tests are applied, in order, to determine which of several matching sequences is more specific: |
︙ | ︙ | |||
721 722 723 724 725 726 727 | The \fBbgerror\fR command will be executed at global level (outside the context of any Tcl procedure). .SH "EXAMPLES" .PP Arrange for a string describing the motion of the mouse to be printed out when the mouse is double-clicked: .CS | | | | 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 | The \fBbgerror\fR command will be executed at global level (outside the context of any Tcl procedure). .SH "EXAMPLES" .PP Arrange for a string describing the motion of the mouse to be printed out when the mouse is double-clicked: .CS \fBbind\fR . <Double-1> { puts "hi from (%x,%y)" } .CE .PP A little GUI that displays what the keysym name of the last key pressed is: .CS set keysym "Press any key" pack [label .l -textvariable keysym -padx 2m -pady 1m] \fBbind\fR . <Key> { set keysym "You pressed %K" } .CE .SH "SEE ALSO" bgerror(n), bindtags(n), event(n), focus(n), grab(n), keysyms(n) .SH KEYWORDS binding, event '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/bitmap.n.
︙ | ︙ | |||
11 12 13 14 15 16 17 | '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bitmap \- Images that display two colors .SH SYNOPSIS .nf \fBimage create bitmap \fR?\fIname\fR? ?\fIoptions\fR? | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bitmap \- Images that display two colors .SH SYNOPSIS .nf \fBimage create bitmap \fR?\fIname\fR? ?\fIoptions\fR? \fIimageName \fBcget\fI option\fR \fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? .fi .BE .SH DESCRIPTION .PP A bitmap is an image whose pixels can display either of two colors or be transparent. |
︙ | ︙ | |||
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 | the source data is one and the background color if the source data is zero. .SH "CREATING BITMAPS" .PP Like all images, bitmaps are created using the \fBimage create\fR command. Bitmaps support the following \fIoptions\fR: .TP \fB\-background \fIcolor\fR . Specifies a background color for the image in any of the standard ways accepted by Tk. If this option is set to an empty string then the background pixels will be transparent. This effect is achieved by using the source bitmap as the mask bitmap, ignoring any \fB\-maskdata\fR or \fB\-maskfile\fR options. .TP \fB\-data \fIstring\fR . Specifies the contents of the source bitmap as a string. The string must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). If both the \fB\-data\fR and \fB\-file\fR options are specified, the \fB\-data\fR option takes precedence. .TP \fB\-file \fIname\fR . \fIname\fR gives the name of a file whose contents define the source bitmap. The file must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). .TP \fB\-foreground \fIcolor\fR . Specifies a foreground color for the image in any of the standard ways accepted by Tk. .TP \fB\-maskdata \fIstring\fR . Specifies the contents of the mask as a string. The string must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). If both the \fB\-maskdata\fR and \fB\-maskfile\fR options are specified, the \fB\-maskdata\fR option takes precedence. .TP \fB\-maskfile \fIname\fR . \fIname\fR gives the name of a file whose contents define the mask. The file must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). .SH "IMAGE COMMAND" .PP When a bitmap image is created, Tk also creates a new command whose name is the same as the image. This command may be used to invoke various operations on the image. It has the following general form: .CS \fIimageName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for bitmap images: .TP | > > > > > > > | > | 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 | the source data is one and the background color if the source data is zero. .SH "CREATING BITMAPS" .PP Like all images, bitmaps are created using the \fBimage create\fR command. Bitmaps support the following \fIoptions\fR: .\" OPTION: -background .TP \fB\-background \fIcolor\fR . Specifies a background color for the image in any of the standard ways accepted by Tk. If this option is set to an empty string then the background pixels will be transparent. This effect is achieved by using the source bitmap as the mask bitmap, ignoring any \fB\-maskdata\fR or \fB\-maskfile\fR options. .\" OPTION: -data .TP \fB\-data \fIstring\fR . Specifies the contents of the source bitmap as a string. The string must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). If both the \fB\-data\fR and \fB\-file\fR options are specified, the \fB\-data\fR option takes precedence. .\" OPTION: -file .TP \fB\-file \fIname\fR . \fIname\fR gives the name of a file whose contents define the source bitmap. The file must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). .\" OPTION: -foreground .TP \fB\-foreground \fIcolor\fR . Specifies a foreground color for the image in any of the standard ways accepted by Tk. .\" OPTION: -maskdata .TP \fB\-maskdata \fIstring\fR . Specifies the contents of the mask as a string. The string must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). If both the \fB\-maskdata\fR and \fB\-maskfile\fR options are specified, the \fB\-maskdata\fR option takes precedence. .\" OPTION: -maskfile .TP \fB\-maskfile \fIname\fR . \fIname\fR gives the name of a file whose contents define the mask. The file must adhere to X11 bitmap format (e.g., as generated by the \fBbitmap\fR program). .SH "IMAGE COMMAND" .PP When a bitmap image is created, Tk also creates a new command whose name is the same as the image. This command may be used to invoke various operations on the image. It has the following general form: .CS \fIimageName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for bitmap images: .\" METHOD: cget .TP \fIimageName \fBcget\fI option\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 \fBbitmap\fR command. .\" METHOD: configure .TP \fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options for the image. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIimageName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified |
︙ | ︙ |
Changes to doc/busy.n.
︙ | ︙ | |||
26 27 28 29 30 31 32 | .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME busy \- Make Tk widgets busy, temporarily blocking user interactions .SH SYNOPSIS | > | < < | < < | < < > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME busy \- Make Tk widgets busy, temporarily blocking user interactions .SH SYNOPSIS .nf \fBtk busy\fI window \fR?\fIoptions\fR? \fBtk busy busywindow \fIwindow\fR \fBtk busy hold\fI window \fR?\fIoptions\fR? \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?... \fBtk busy forget\fI window \fR?\fIwindow \fR?... \fBtk busy current\fR ?\fIpattern\fR? \fBtk busy status \fIwindow\fR .fi .BE .SH DESCRIPTION .PP The \fBtk busy\fR command provides a simple means to block mouse pointer events from Tk widgets, while overriding the widget's cursor with a configurable busy cursor. Note this command does not prevent keyboard events from being sent to the widgets made busy. |
︙ | ︙ | |||
112 113 114 115 116 117 118 | \fBtk busy\fR forget .top .CE .PP The busy window has a configurable cursor. You can change the busy cursor using the \fBconfigure\fR operation. .PP .CS | | > > | > | 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 | \fBtk busy\fR forget .top .CE .PP The busy window has a configurable cursor. You can change the busy cursor using the \fBconfigure\fR operation. .PP .CS \fBtk busy\fR configure .top -cursor "watch" .CE .PP Destroying the widget will also clean up any resources allocated by the \fBtk busy\fR command. .PP .SH OPERATIONS .PP The following operations are available for the \fBtk busy\fR command: .TP \fBtk busy \fIwindow\fR ?\fIoption value\fR?... . Shortcut for \fBtk busy hold\fR command. .\" METHOD: busywindow .TP \fBtk busy busywindow \fIwindow\fR . Returns the pathname of the busy window (i.e. the transparent window shielding the window appearing busy) created by the \fBtk busy hold\fR command for \fIwindow\fR, or the empty string if \fIwindow\fR is not busy. .\" METHOD: cget .TP \fBtk busy cget \fIwindow option\fR . Queries the \fBtk busy\fR command configuration options for \fIwindow\fR. \fIWindow\fR must be the path name of a widget previously made busy by the \fBhold\fR operation. The command returns the present value of the specified \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBhold\fR operation. .\" METHOD: configure .TP \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?... . Queries or modifies the \fBtk busy\fR command configuration options for \fIwindow\fR. \fIWindow\fR must be the path name of a widget previously made busy by the \fBhold\fR operation. If no options are specified, a list describing all of the available options for \fIwindow\fR (see |
︙ | ︙ | |||
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 | specified for it by either \fBoption\fR command: .PP .CS option add *frame.busyCursor gumby option add *Frame.BusyCursor gumby .CE .RE .TP \fBtk busy current \fR?\fIpattern\fR? . Returns the pathnames of all widgets that are currently busy. If a \fIpattern\fR is given, only the path names of busy widgets matching \fIpattern\fR are returned. .TP \fBtk busy forget \fIwindow\fR ?\fIwindow\fR?... . Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR, including the transparent window. User events will again be received by \fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed. \fIWindow\fR must be the name of a widget specified in the \fBhold\fR operation, otherwise an error is reported. .TP \fBtk busy hold \fIwindow\fR ?\fIoption value\fR?... . Makes the specified \fIwindow\fR (and its descendants in the Tk window hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget. A transparent window is put in front of the specified window. This transparent window is mapped the next time idle tasks are processed, and the specified window and its descendants will be blocked from user interactions. Normally \fBupdate\fR should be called immediately afterward to insure that the hold operation is in effect before the application starts its processing. The command returns the pathname of the busy window that was created (i.e. the transparent window shielding the window appearing busy). The following configuration options are valid: .RS .TP \fB\-cursor \fIcursorName\fR . Specifies the cursor to be displayed when the widget is made busy. \fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms. .RE .TP \fBtk busy status \fIwindow\fR . Returns the status of a widget \fIwindow\fR. If \fIwindow\fR presently can not receive user interactions, \fB1\fR is returned, otherwise \fB0\fR. .SH "EVENT HANDLING" .SS BINDINGS | > > > > > | 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 | specified for it by either \fBoption\fR command: .PP .CS option add *frame.busyCursor gumby option add *Frame.BusyCursor gumby .CE .RE .\" METHOD: current .TP \fBtk busy current \fR?\fIpattern\fR? . Returns the pathnames of all widgets that are currently busy. If a \fIpattern\fR is given, only the path names of busy widgets matching \fIpattern\fR are returned. .\" METHOD: forget .TP \fBtk busy forget \fIwindow\fR ?\fIwindow\fR?... . Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR, including the transparent window. User events will again be received by \fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed. \fIWindow\fR must be the name of a widget specified in the \fBhold\fR operation, otherwise an error is reported. .\" METHOD: hold .TP \fBtk busy hold \fIwindow\fR ?\fIoption value\fR?... . Makes the specified \fIwindow\fR (and its descendants in the Tk window hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget. A transparent window is put in front of the specified window. This transparent window is mapped the next time idle tasks are processed, and the specified window and its descendants will be blocked from user interactions. Normally \fBupdate\fR should be called immediately afterward to insure that the hold operation is in effect before the application starts its processing. The command returns the pathname of the busy window that was created (i.e. the transparent window shielding the window appearing busy). The following configuration options are valid: .RS .\" OPTION: -cursor .TP \fB\-cursor \fIcursorName\fR . Specifies the cursor to be displayed when the widget is made busy. \fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms. .RE .\" METHOD: status .TP \fBtk busy status \fIwindow\fR . Returns the status of a widget \fIwindow\fR. If \fIwindow\fR presently can not receive user interactions, \fB1\fR is returned, otherwise \fB0\fR. .SH "EVENT HANDLING" .SS BINDINGS |
︙ | ︙ |
Changes to doc/button.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH button n 4.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME button \- Create and manipulate 'button' action widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH button n 4.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME button \- Create and manipulate 'button' action widgets .SH SYNOPSIS \fBbutton\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-font \-relief \-activeforeground \-foreground \-repeatdelay \-anchor \-highlightbackground \-repeatinterval \-background \-highlightcolor \-takefocus \-bitmap \-highlightthickness \-text \-borderwidth \-image \-textvariable |
︙ | ︙ | |||
110 111 112 113 114 115 116 117 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for button widgets: .TP | > | > > > > > > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for button widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBbutton\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBbutton\fR command. .\" METHOD: flash .TP \fIpathName \fBflash\fR . Flash the button. This is accomplished by redisplaying the button several times, alternating between the configured activebackground and background colors. At the end of the flash the button is left in the same normal/active state as when the command was invoked. This command is ignored if the button's state is \fBdisabled\fR. .\" METHOD: invoke .TP \fIpathName \fBinvoke\fR . Invoke the Tcl command associated with the button, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the button. This command is ignored if the button's state is \fBdisabled\fR. .SH "DEFAULT BINDINGS" .PP Tk automatically creates class bindings for buttons that give them |
︙ | ︙ | |||
184 185 186 187 188 189 190 | .SH EXAMPLES .PP This is the classic Tk .QW "Hello, World!" demonstration: .PP .CS | | | | | | | 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 | .SH EXAMPLES .PP This is the classic Tk .QW "Hello, World!" demonstration: .PP .CS \fBbutton\fR .b -text "Hello, World!" -command exit pack .b .CE .PP This example demonstrates how to handle button accelerators: .PP .CS \fBbutton\fR .b1 -text Hello -underline 0 \fBbutton\fR .b2 -text World -underline 0 bind . <Key-h> {.b1 flash; .b1 invoke} bind . <Key-w> {.b2 flash; .b2 invoke} pack .b1 .b2 .CE .SH "SEE ALSO" ttk::button(n) .SH KEYWORDS button, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/canvas.n.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .TH canvas n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME canvas \- Create and manipulate 'canvas' hypergraphics drawing surface widgets .SH SYNOPSIS | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | .TH canvas n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME canvas \- Create and manipulate 'canvas' hypergraphics drawing surface widgets .SH SYNOPSIS \fBcanvas\fI pathName \fR?\fIoptions\fR? .SO \-background \-borderwidth \-cursor \-highlightbackground \-highlightcolor \-highlightthickness \-insertbackground \-insertborderwidth \-insertofftime \-insertontime \-insertwidth \-relief \-selectbackground \-selectborderwidth \-selectforeground \-takefocus \-xscrollcommand \-yscrollcommand |
︙ | ︙ | |||
252 253 254 255 256 257 258 | support as many of these forms as practical. Note that it is possible to refer to the character just after the last one in the text item; this is necessary for such tasks as inserting new text at the end of the item. Lines and Polygons do not support the insertion cursor and the selection. Their indices are supposed to be even always, because coordinates always appear in pairs. | < | < < | < < | < < | < < | < < | < | 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 | support as many of these forms as practical. Note that it is possible to refer to the character just after the last one in the text item; this is necessary for such tasks as inserting new text at the end of the item. Lines and Polygons do not support the insertion cursor and the selection. Their indices are supposed to be even always, because coordinates always appear in pairs. .IP \fInumber\fR 10 A decimal number giving the position of the desired character within the text item. 0 refers to the first character, 1 to the next character, and so on. If indexes are odd for lines and polygons, they will be automatically decremented by one. A number less than 0 is treated as if it were zero, and a number greater than the length of the text item is treated as if it were equal to the length of the text item. For polygons, numbers less than 0 or greater than the length of the coordinate list will be adjusted by adding or subtracting the length until the result is between zero and the length, inclusive. .IP \fBend\fR 10 Refers to the character or coordinate just after the last one in the item (same as the number of characters or coordinates in the item). .IP \fBinsert\fR 10 Refers to the character just before which the insertion cursor is drawn in this item. Not valid for lines and polygons. .IP \fBsel.first\fR 10 Refers to the first selected character in the item. If the selection is not in this item then this form is illegal. .IP \fBsel.last\fR 10 Refers to the last selected character in the item. If the selection is not in this item then this form is illegal. .IP \fB@\fIx,y\fR 10 Refers to the character or coordinate at the point given by \fIx\fR and \fIy\fR, where \fIx\fR and \fIy\fR are specified in the coordinate system of the canvas. If \fIx\fR and \fIy\fR lie outside the coordinates covered by the text item, then they refer to the first or last character in the line that is closest to the given point. .SH "DASH PATTERNS" |
︙ | ︙ | |||
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following widget commands are possible for canvas widgets: .TP \fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg ...\fR? . For each item that meets the constraints specified by \fIsearchSpec\fR and the \fIarg\fRs, add \fItag\fR to the list of tags associated with the item if it is not already present on that list. It is possible that no items will satisfy the constraints given by \fIsearchSpec\fR and \fIarg\fRs, in which case the command has no effect. This command returns an empty string as result. \fISearchSpec\fR and \fIarg\fR's may take any of the following forms: .RS | > < | < < | < < | < < | < < | < < | < < | < > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following widget commands are possible for canvas widgets: .\" METHOD: addtag .TP \fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg ...\fR? . For each item that meets the constraints specified by \fIsearchSpec\fR and the \fIarg\fRs, add \fItag\fR to the list of tags associated with the item if it is not already present on that list. It is possible that no items will satisfy the constraints given by \fIsearchSpec\fR and \fIarg\fRs, in which case the command has no effect. This command returns an empty string as result. \fISearchSpec\fR and \fIarg\fR's may take any of the following forms: .RS .IP "\fBabove \fItagOrId\fR" Selects the item just after (above) the one given by \fItagOrId\fR in the display list. If \fItagOrId\fR denotes more than one item, then the last (topmost) of these items in the display list is used. .IP \fBall\fR Selects all the items in the canvas. .IP "\fBbelow \fItagOrId\fR" Selects the item just before (below) the one given by \fItagOrId\fR in the display list. If \fItagOrId\fR denotes more than one item, then the first (lowest) of these items in the display list is used. .IP "\fBclosest \fIx y \fR?\fIhalo\fR? ?\fIstart\fR?" Selects the item closest to the point given by \fIx\fR and \fIy\fR. If more than one item is at the same closest distance (e.g. two items overlap the point), then the top-most of these items (the last one in the display list) is used. If \fIhalo\fR is specified, then it must be a non-negative value. Any item closer than \fIhalo\fR to the point is considered to overlap it. The \fIstart\fR argument may be used to step circularly through all the closest items. If \fIstart\fR is specified, it names an item using a tag or id (if by tag, it selects the first item in the display list with the given tag). Instead of selecting the topmost closest item, this form will select the topmost closest item that is below \fIstart\fR in the display list; if no such item exists, then the selection behaves as if the \fIstart\fR argument had not been specified. .IP "\fBenclosed\fI x1 y1 x2 y2\fR" Selects all the items completely enclosed within the rectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR. \fIX1\fR must be no greater than \fIx2\fR and \fIy1\fR must be no greater than \fIy2\fR. .IP "\fBoverlapping\fI x1 y1 x2 y2\fR" Selects all the items that overlap or are enclosed within the rectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR. \fIX1\fR must be no greater than \fIx2\fR and \fIy1\fR must be no greater than \fIy2\fR. .IP "\fBwithtag \fItagOrId\fR" Selects all the items given by \fItagOrId\fR. .RE .\" METHOD: bbox .TP \fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR? . Returns a list with four elements giving an approximate bounding box for all the items named by the \fItagOrId\fR arguments. The list has the form .QW "\fIx1 y1 x2 y2\fR" such that the drawn areas of all the named elements are within the region bounded by \fIx1\fR on the left, \fIx2\fR on the right, \fIy1\fR on the top, and \fIy2\fR on the bottom. The return value may overestimate the actual bounding box by a few pixels. If no items match any of the \fItagOrId\fR arguments or if the matching items have empty bounding boxes (i.e. they have nothing to display) then an empty string is returned. .\" METHOD: bind .TP \fIpathName \fBbind \fItagOrId\fR ?\fIsequence\fR? ?\fIcommand\fR? . This command associates \fIcommand\fR with all the items given by \fItagOrId\fR such that whenever the event sequence given by \fIsequence\fR occurs for one of the items the command will be invoked. |
︙ | ︙ | |||
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | .PP If bindings have been created for a canvas window using the \fBbind\fR command, then they are invoked in addition to bindings created for the canvas's items using the \fBbind\fR widget command. The bindings for items will be invoked before any of the bindings for the window as a whole. .RE .TP \fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR? . Given a window x-coordinate in the canvas \fIscreenx\fR, this command returns the canvas x-coordinate that is displayed at that location. If \fIgridspacing\fR is specified, then the canvas coordinate is rounded to the nearest multiple of \fIgridspacing\fR units. .TP \fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR? . Given a window y-coordinate in the canvas \fIscreeny\fR this command returns the canvas y-coordinate that is displayed at that location. If \fIgridspacing\fR is specified, then the canvas coordinate is rounded to the nearest multiple of \fIgridspacing\fR units. .TP | > > > | > > | | > > > > > > | 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 | .PP If bindings have been created for a canvas window using the \fBbind\fR command, then they are invoked in addition to bindings created for the canvas's items using the \fBbind\fR widget command. The bindings for items will be invoked before any of the bindings for the window as a whole. .RE .\" METHOD: canvasx .TP \fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR? . Given a window x-coordinate in the canvas \fIscreenx\fR, this command returns the canvas x-coordinate that is displayed at that location. If \fIgridspacing\fR is specified, then the canvas coordinate is rounded to the nearest multiple of \fIgridspacing\fR units. .\" METHOD: canvasy .TP \fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR? . Given a window y-coordinate in the canvas \fIscreeny\fR this command returns the canvas y-coordinate that is displayed at that location. If \fIgridspacing\fR is specified, then the canvas coordinate is rounded to the nearest multiple of \fIgridspacing\fR units. .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBcanvas\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBcanvas\fR command. .\" METHOD: coords .TP \fIpathName \fBcoords \fItagOrId \fR?\fIx0 y0 ...\fR? .TP \fIpathName \fBcoords \fItagOrId \fR?\fIcoordList\fR? . Query or modify the coordinates that define an item. If no coordinates are specified, this command returns a list whose elements are the coordinates of the item named by \fItagOrId\fR. If coordinates are specified, then they replace the current coordinates for the named item. If \fItagOrId\fR refers to multiple items, then the first one in the display list is used. .RS .PP Note that for rectangles, ovals and arcs the returned list of coordinates has a fixed order, namely the left, top, right and bottom coordinates, which may not be the order originally given. Also the coordinates are always returned in screen units with no units (that is, in pixels). So if the original coordinates were specified for instance in centimeters or inches, the returned values will nevertheless be in pixels. .RE .\" METHOD: create .TP \fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR? .TP \fIpathName \fBcreate \fItype coordList \fR?\fIoption value ...\fR? . Create a new item in \fIpathName\fR of type \fItype\fR. The exact format of the arguments after \fItype\fR depends on \fItype\fR, but usually they consist of the coordinates for one or more points, followed by specifications for zero or more item options. See the subsections on individual item types below for more on the syntax of this command. This command returns the id for the new item. .\" METHOD: dchars .TP \fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR? . For each item given by \fItagOrId\fR, delete the characters, or coordinates, in the range given by \fIfirst\fR and \fIlast\fR, inclusive. If some of the items given by \fItagOrId\fR do not support indexing operations then they ignore this operation. Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character, line and polygon items interpret them as indices to a coordinate (an x,y pair). Indices are described in \fBINDICES\fR above. If \fIlast\fR is omitted, it defaults to \fIfirst\fR. This command returns an empty string. .\" METHOD: delete .TP \fIpathName \fBdelete \fR?\fItagOrId tagOrId ...\fR? . Delete each of the items given by each \fItagOrId\fR, and return an empty string. .\" METHOD: dtag .TP \fIpathName \fBdtag \fItagOrId \fR?\fItagToDelete\fR? . For each of the items given by \fItagOrId\fR, delete the tag given by \fItagToDelete\fR from the list of those associated with the item. If an item does not have the tag \fItagToDelete\fR then the item is unaffected by the command. If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR. This command returns an empty string. .\" METHOD: find .TP \fIpathName \fBfind \fIsearchCommand \fR?\fIarg ...\fR? . This command returns a list consisting of all the items that meet the constraints specified by \fIsearchCommand\fR and \fIarg\fR's. \fISearchCommand\fR and \fIargs\fR have any of the forms accepted by the \fBaddtag\fR command. The items are returned in stacking order, with the lowest item first. .\" METHOD: focus .TP \fIpathName \fBfocus \fR?\fItagOrId\fR? . Set the keyboard focus for the canvas widget to the item given by \fItagOrId\fR. If \fItagOrId\fR refers to several items, then the focus is set to the first such item in the display list that supports the |
︙ | ︙ | |||
635 636 637 638 639 640 641 642 | a given item does not actually have the input focus unless (a) its canvas is the focus window and (b) the item is the focus item within the canvas. In most cases it is advisable to follow the \fBfocus\fR widget command with the \fBfocus\fR command to set the focus window to the canvas (if it was not there already). .RE .TP | > | > > > | > > > | | > | | | > > > | | | | | > > > > > > > > > > | > | 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 | a given item does not actually have the input focus unless (a) its canvas is the focus window and (b) the item is the focus item within the canvas. In most cases it is advisable to follow the \fBfocus\fR widget command with the \fBfocus\fR command to set the focus window to the canvas (if it was not there already). .RE .\" METHOD: gettags .TP \fIpathName \fBgettags\fI tagOrId\fR . Return a list whose elements are the tags associated with the item given by \fItagOrId\fR. If \fItagOrId\fR refers to more than one item, then the tags are returned from the first such item in the display list. If \fItagOrId\fR does not refer to any items, or if the item contains no tags, then an empty string is returned. .\" METHOD: icursor .TP \fIpathName \fBicursor \fItagOrId index\fR . Set the position of the insertion cursor for the item(s) given by \fItagOrId\fR to just before the character whose position is given by \fIindex\fR. If some or all of the items given by \fItagOrId\fR do not support an insertion cursor then this command has no effect on them. See \fBINDICES\fR above for a description of the legal forms for \fIindex\fR. .RS .PP Note that the insertion cursor is only displayed in an item if that item currently has the keyboard focus (see the \fBfocus\fR widget command, above), but the cursor position may be set even when the item does not have the focus. .PP This command returns an empty string. .RE .\" METHOD: image .TP \fIpathName \fBimage \fIimagename\fR ?\fIsubsample\fR? ?\fIzoom\fR? . Draw the canvas into the Tk photo image named \fIimagename\fR. If a \fB\-scrollregion\fR has been defined then this will be the boundaries of the canvas region drawn and the final size of the photo image. Otherwise the widget width and height with an origin of 0,0 will be the size of the canvas region drawn and the final size of the photo image. Optionally an integer \fIsubsample\fR factor may be given and the photo image will be reduced in size. .RS .PP In addition to the \fIsubsample\fR an integer \fIzoom\fR factor can also be given and the photo image will be enlarged. The image background will be filled with the canvas background colour. The canvas widget does not need to be mapped for this widget command to work, but at least one of it's ancestors must be mapped. .PP This command returns an empty string. .RE .\" METHOD: imove .TP \fIpathName \fBimove \fItagOrId index x y\fR . This command causes the \fIindex\fR'th coordinate of each of the items indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR). Each item interprets \fIindex\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, only line and polygon items may have their coordinates relocated this way. .\" METHOD: index .TP \fIpathName \fBindex \fItagOrId index\fR . This command returns a decimal string giving the numerical index within \fItagOrId\fR corresponding to \fIindex\fR. \fIIndex\fR gives a textual description of the desired position as described in \fBINDICES\fR above. Text items interpret \fIindex\fR as an index to a character, line and polygon items interpret it as an index to a coordinate (an x,y pair). The return value is guaranteed to lie between 0 and the number of characters, or coordinates, within the item, inclusive. If \fItagOrId\fR refers to multiple items, then the index is processed in the first of these items that supports indexing operations (in display list order). .\" METHOD: insert .TP \fIpathName \fBinsert \fItagOrId beforeThis string\fR . For each of the items given by \fItagOrId\fR, if the item supports text or coordinate, insertion then \fIstring\fR is inserted into the item's text just before the character, or coordinate, whose index is \fIbeforeThis\fR. Text items interpret \fIbeforeThis\fR as an index to a character, line and polygon items interpret it as an index to a coordinate (an x,y pair). For lines and polygons the \fIstring\fR must be a valid coordinate sequence. .RS .PP See \fBINDICES\fR above for information about the forms allowed for \fIbeforeThis\fR. .PP This command returns an empty string. .RE .\" METHOD: itemcget .TP \fIpathName \fBitemcget\fI tagOrId option\fR . Returns the current value of the configuration option for the item given by \fItagOrId\fR whose name is \fIoption\fR. This command is similar to the \fBcget\fR widget command except that it applies to a particular item rather than the widget as a whole. \fIOption\fR may have any of the values accepted by the \fBcreate\fR widget command when the item was created. If \fItagOrId\fR is a tag that refers to more than one item, the first (lowest) such item is used. .\" METHOD: itemconfigure .TP \fIpathName \fBitemconfigure \fItagOrId\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR? . This command is similar to the \fBconfigure\fR widget command except that it modifies item-specific options for the items given by \fItagOrId\fR instead of modifying options for the overall canvas widget. |
︙ | ︙ | |||
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | modifies the given widget option(s) to have the given value(s) in each of the items given by \fItagOrId\fR; in this case the command returns an empty string. The \fIoption\fRs and \fIvalue\fRs are the same as those permissible in the \fBcreate\fR widget command when the item(s) were created; see the sections describing individual item types below for details on the legal options. .TP \fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR? . Move all of the items given by \fItagOrId\fR to a new position in the display list just before the item given by \fIbelowThis\fR. If \fItagOrId\fR refers to more than one item then all are moved but the relative order of the moved items will not be changed. \fIBelowThis\fR is a tag or id; if it refers to more than one item then the first (lowest) of these items in the display list is used as the destination location for the moved items. | > | > > > | 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 | modifies the given widget option(s) to have the given value(s) in each of the items given by \fItagOrId\fR; in this case the command returns an empty string. The \fIoption\fRs and \fIvalue\fRs are the same as those permissible in the \fBcreate\fR widget command when the item(s) were created; see the sections describing individual item types below for details on the legal options. .\" METHOD: lower .TP \fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR? . Move all of the items given by \fItagOrId\fR to a new position in the display list just before the item given by \fIbelowThis\fR. If \fItagOrId\fR refers to more than one item then all are moved but the relative order of the moved items will not be changed. \fIBelowThis\fR is a tag or id; if it refers to more than one item then the first (lowest) of these items in the display list is used as the destination location for the moved items. Note that this command has no effect on window items. Window items always obscure other item types, and the stacking order of window items is determined by the \fBraise\fR command and \fBlower\fR command, not the \fBraise\fR widget command and \fBlower\fR widget command for canvases. This command returns an empty string. .\" METHOD: move .TP \fIpathName \fBmove \fItagOrId xAmount yAmount\fR . Move each of the items given by \fItagOrId\fR in the canvas coordinate space by adding \fIxAmount\fR to the x-coordinate of each point associated with the item and \fIyAmount\fR to the y-coordinate of each point associated with the item. This command returns an empty string. .\" METHOD: moveto .TP \fIpathName \fBmoveto \fItagOrId xPos yPos\fR . Move the items given by \fItagOrId\fR in the canvas coordinate space so that the first coordinate pair (the upper-left corner of the bounding box) of the first item (the lowest in the display list) with tag \fItagOrId\fR is located at position (\fIxPos\fR,\fIyPos\fR). \fIxPos\fR and \fIyPos\fR may be the empty string, in which case the corresponding coordinate will be unchanged. All items matching \fItagOrId\fR remain in the same positions relative to each other. This command returns an empty string. .\" METHOD: postscript .TP \fIpathName \fBpostscript \fR?\fIoption value option value ...\fR? . Generate a Postscript representation for part or all of the canvas. If the \fB\-file\fR option is specified then the Postscript is written to a file and an empty string is returned; otherwise the Postscript is returned as the result of the command. |
︙ | ︙ | |||
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 | either invoke the \fBupdate\fR command to wait for the canvas window to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR options to specify the area of the canvas to print. The \fIoption\fR\-\fIvalue\fR argument pairs provide additional information to control the generation of Postscript. The following options are supported: .RS .TP \fB\-channel \fIchannelName\fR . Specifies the name of the channel to which to write the Postscript. If this option and the \fB\-file\fR option are not specified then the Postscript is returned as the result of the command. .TP \fB\-colormap \fIvarName\fR . \fIVarName\fR must be the name of an array variable that specifies a color mapping to use in the Postscript. Each element of \fIvarName\fR must consist of Postscript code to set a particular color value (e.g. .QW "\fB1.0 1.0 0.0 setrgbcolor\fR" ). When outputting color information in the Postscript, Tk checks to see if there is an element of \fIvarName\fR with the same name as the color. If so, Tk uses the value of the element as the Postscript command to set the color. If this option has not been specified, or if there is no entry in \fIvarName\fR for a given color, then Tk uses the red, green, and blue intensities from the X color. .TP \fB\-colormode \fImode\fR . Specifies how to output color information. \fIMode\fR must be either \fBcolor\fR (for full color output), \fBgray\fR (convert all colors to their gray-scale equivalents) or \fBmono\fR (convert all colors to black or white). .TP \fB\-file \fIfileName\fR . Specifies the name of the file in which to write the Postscript. If this option and the \fB\-channel\fR option are not specified then the Postscript is returned as the result of the command. .TP \fB\-fontmap \fIvarName\fR . \fIVarName\fR must be the name of an array variable that specifies a font mapping to use in the Postscript. Each element of \fIvarName\fR must consist of a Tcl list with two elements, which are the name and point size of a Postscript font. When outputting Postscript commands for a particular font, Tk checks to see if \fIvarName\fR contains an element with the same name as the font. If there is such an element, then the font information contained in that element is used in the Postscript. Otherwise Tk attempts to guess what Postscript font to use. Tk's guesses generally only work for well-known fonts such as Times and Helvetica and Courier, and only if the X font name does not omit any dashes up through the point size. For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but \fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to parse the font name). .TP \fB\-height \fIsize\fR . Specifies the height of the area of the canvas to print. Defaults to the height of the canvas window. .TP \fB\-pageanchor \fIanchor\fR . Specifies which point of the printed area of the canvas should appear over the positioning point on the page (which is given by the \fB\-pagex\fR and \fB\-pagey\fR options). For example, \fB\-pageanchor n\fR means that the top center of the area of the canvas being printed (as it appears in the canvas window) should be over the positioning point. Defaults to \fBcenter\fR. .TP \fB\-pageheight \fIsize\fR . Specifies that the Postscript should be scaled in both x and y so that the printed area is \fIsize\fR high on the Postscript page. \fISize\fR consists of a floating-point number followed by \fBc\fR for centimeters, \fBi\fR for inches, \fBm\fR for millimeters, or \fBp\fR or nothing for printer's points (1/72 inch). Defaults to the height of the printed area on the screen. If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling is not implemented). .TP \fB\-pagewidth \fIsize\fR . Specifies that the Postscript should be scaled in both x and y so that the printed area is \fIsize\fR wide on the Postscript page. \fISize\fR has the same form as for \fB\-pageheight\fR. Defaults to the width of the printed area on the screen. If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling is not implemented). .TP \fB\-pagex \fIposition\fR . \fIPosition\fR gives the x-coordinate of the positioning point on the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR options to determine where the printed area appears on the Postscript page. Defaults to the center of the page. .TP \fB\-pagey \fIposition\fR . \fIPosition\fR gives the y-coordinate of the positioning point on the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR options to determine where the printed area appears on the Postscript page. Defaults to the center of the page. .TP \fB\-rotate \fIboolean\fR . \fIBoolean\fR specifies whether the printed area is to be rotated 90 degrees. In non-rotated output the x-axis of the printed area runs along the short dimension of the page .PQ portrait " orientation" ; in rotated output the x-axis runs along the long dimension of the page .PQ landscape " orientation" . Defaults to non-rotated. .TP \fB\-width \fIsize\fR . Specifies the width of the area of the canvas to print. Defaults to the width of the canvas window. .TP \fB\-x \fIposition\fR . Specifies the x-coordinate of the left edge of the area of the canvas that is to be printed, in canvas coordinates, not window coordinates. Defaults to the coordinate of the left edge of the window. .TP \fB\-y \fIposition\fR . Specifies the y-coordinate of the top edge of the area of the canvas that is to be printed, in canvas coordinates, not window coordinates. Defaults to the coordinate of the top edge of the window. .RE .TP \fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR? . Move all of the items given by \fItagOrId\fR to a new position in the display list just after the item given by \fIaboveThis\fR. If \fItagOrId\fR refers to more than one item then all are moved but the relative order of the moved items will not be changed. \fIAboveThis\fR is a tag or id; if it refers to more than one item then the last (topmost) of these items in the display list is used as the destination location for the moved items. This command returns an empty string. .RS .PP | > > > > > > > > > > > > > > > > > > > > > > > > > | > > | 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 | either invoke the \fBupdate\fR command to wait for the canvas window to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR options to specify the area of the canvas to print. The \fIoption\fR\-\fIvalue\fR argument pairs provide additional information to control the generation of Postscript. The following options are supported: .RS .\" OPTION: -channel .TP \fB\-channel \fIchannelName\fR . Specifies the name of the channel to which to write the Postscript. If this option and the \fB\-file\fR option are not specified then the Postscript is returned as the result of the command. .\" OPTION: -colormap .TP \fB\-colormap \fIvarName\fR . \fIVarName\fR must be the name of an array variable that specifies a color mapping to use in the Postscript. Each element of \fIvarName\fR must consist of Postscript code to set a particular color value (e.g. .QW "\fB1.0 1.0 0.0 setrgbcolor\fR" ). When outputting color information in the Postscript, Tk checks to see if there is an element of \fIvarName\fR with the same name as the color. If so, Tk uses the value of the element as the Postscript command to set the color. .RS .PP If this option has not been specified, or if there is no entry in \fIvarName\fR for a given color, then Tk uses the red, green, and blue intensities from the X color. .RE .\" OPTION: -colormode .TP \fB\-colormode \fImode\fR . Specifies how to output color information. \fIMode\fR must be either \fBcolor\fR (for full color output), \fBgray\fR (convert all colors to their gray-scale equivalents) or \fBmono\fR (convert all colors to black or white). .\" OPTION: -file .TP \fB\-file \fIfileName\fR . Specifies the name of the file in which to write the Postscript. If this option and the \fB\-channel\fR option are not specified then the Postscript is returned as the result of the command. .\" OPTION: -fontmap .TP \fB\-fontmap \fIvarName\fR . \fIVarName\fR must be the name of an array variable that specifies a font mapping to use in the Postscript. Each element of \fIvarName\fR must consist of a Tcl list with two elements, which are the name and point size of a Postscript font. When outputting Postscript commands for a particular font, Tk checks to see if \fIvarName\fR contains an element with the same name as the font. If there is such an element, then the font information contained in that element is used in the Postscript. Otherwise Tk attempts to guess what Postscript font to use. Tk's guesses generally only work for well-known fonts such as Times and Helvetica and Courier, and only if the X font name does not omit any dashes up through the point size. .RS .PP For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but \fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to parse the font name). .RE .\" OPTION: -height .TP \fB\-height \fIsize\fR . Specifies the height of the area of the canvas to print. Defaults to the height of the canvas window. .\" OPTION: -pageanchor .TP \fB\-pageanchor \fIanchor\fR . Specifies which point of the printed area of the canvas should appear over the positioning point on the page (which is given by the \fB\-pagex\fR and \fB\-pagey\fR options). .RS .PP For example, \fB\-pageanchor n\fR means that the top center of the area of the canvas being printed (as it appears in the canvas window) should be over the positioning point. Defaults to \fBcenter\fR. .RE .\" OPTION: -pageheight .TP \fB\-pageheight \fIsize\fR . Specifies that the Postscript should be scaled in both x and y so that the printed area is \fIsize\fR high on the Postscript page. \fISize\fR consists of a floating-point number followed by \fBc\fR for centimeters, \fBi\fR for inches, \fBm\fR for millimeters, or \fBp\fR or nothing for printer's points (1/72 inch). Defaults to the height of the printed area on the screen. If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling is not implemented). .\" OPTION: -pagewidth .TP \fB\-pagewidth \fIsize\fR . Specifies that the Postscript should be scaled in both x and y so that the printed area is \fIsize\fR wide on the Postscript page. \fISize\fR has the same form as for \fB\-pageheight\fR. Defaults to the width of the printed area on the screen. If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling is not implemented). .\" OPTION: -pagex .TP \fB\-pagex \fIposition\fR . \fIPosition\fR gives the x-coordinate of the positioning point on the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR options to determine where the printed area appears on the Postscript page. Defaults to the center of the page. .\" OPTION: -pagey .TP \fB\-pagey \fIposition\fR . \fIPosition\fR gives the y-coordinate of the positioning point on the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR options to determine where the printed area appears on the Postscript page. Defaults to the center of the page. .\" OPTION: -rotate .TP \fB\-rotate \fIboolean\fR . \fIBoolean\fR specifies whether the printed area is to be rotated 90 degrees. In non-rotated output the x-axis of the printed area runs along the short dimension of the page .PQ portrait " orientation" ; in rotated output the x-axis runs along the long dimension of the page .PQ landscape " orientation" . Defaults to non-rotated. .\" OPTION: -width .TP \fB\-width \fIsize\fR . Specifies the width of the area of the canvas to print. Defaults to the width of the canvas window. .\" OPTION: -x .TP \fB\-x \fIposition\fR . Specifies the x-coordinate of the left edge of the area of the canvas that is to be printed, in canvas coordinates, not window coordinates. Defaults to the coordinate of the left edge of the window. .\" OPTION: -y .TP \fB\-y \fIposition\fR . Specifies the y-coordinate of the top edge of the area of the canvas that is to be printed, in canvas coordinates, not window coordinates. Defaults to the coordinate of the top edge of the window. .RE .\" METHOD: raise .TP \fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR? . Move all of the items given by \fItagOrId\fR to a new position in the display list just after the item given by \fIaboveThis\fR. If \fItagOrId\fR refers to more than one item then all are moved but the relative order of the moved items will not be changed. \fIAboveThis\fR is a tag or id; if it refers to more than one item then the last (topmost) of these items in the display list is used as the destination location for the moved items. This command returns an empty string. .RS .PP Note this this command has no effect on window items. Window items always obscure other item types, and the stacking order of window items is determined by the \fBraise\fR command and \fBlower\fR command, not the \fBraise\fR widget command and \fBlower\fR widget command for canvases. .RE .\" METHOD: rchars .TP \fIpathName \fBrchars \fItagOrId first last string\fR . This command causes the text or coordinates between \fIfirst\fR and \fIlast\fR for each of the items indicated by \fItagOrId\fR to be replaced by \fIstring\fR. Each item interprets \fIfirst\fR and \fIlast\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, text items support this operation by altering their text as directed, and line and polygon items support this operation by altering their coordinate list (in which case \fIstring\fR should be a list of coordinates to use as a replacement). The other items ignore this operation. .\" METHOD: rotate .TP \fIpathName \fBrotate \fItagOrId xOrigin yOrigin angle\fR .VS "8.7, TIP164" Rotate the coordinates of all of the items given by \fItagOrId\fR in canvas coordinate space. \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the rotation operation and \fIangle\fR identifies the amount to rotate the coordinates |
︙ | ︙ | |||
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | points, and the \fBarc\fR, \fBoval\fR and \fBrectangle\fR types rotate about a computed center point instead of moving the bounding box coordinates directly. .PP Some items (currently \fBarc\fR and\fB text\fR) have angles in their options; this command \fIdoes not\fR affect those options. .RE .VE "8.7, TIP164" .TP \fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR . Rescale the coordinates of all of the items given by \fItagOrId\fR in canvas coordinate space. \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling operation and \fIxScale\fR and \fIyScale\fR identify the scale | > | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | points, and the \fBarc\fR, \fBoval\fR and \fBrectangle\fR types rotate about a computed center point instead of moving the bounding box coordinates directly. .PP Some items (currently \fBarc\fR and\fB text\fR) have angles in their options; this command \fIdoes not\fR affect those options. .RE .VE "8.7, TIP164" .\" METHOD: scale .TP \fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR . Rescale the coordinates of all of the items given by \fItagOrId\fR in canvas coordinate space. \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling operation and \fIxScale\fR and \fIyScale\fR identify the scale |
︙ | ︙ | |||
1011 1012 1013 1014 1015 1016 1017 1018 | This command returns an empty string. .RS .PP Note that some items have only a single pair of coordinates (e.g., text, images and windows) and so scaling of them by this command can only move them around. .RE .TP | > | | 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | This command returns an empty string. .RS .PP Note that some items have only a single pair of coordinates (e.g., text, images and windows) and so scaling of them by this command can only move them around. .RE .\" METHOD: scan .TP \fIpathName \fBscan\fI option args\fR . This command is used to implement scanning on canvases. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBscan mark \fIx y\fR . |
︙ | ︙ | |||
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | It then adjusts the view by \fIgain\fR times the difference in coordinates, where \fIgain\fR defaults to 10. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the canvas at high speed through its window. The return value is an empty string. .RE .TP \fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR? . Manipulates the selection in one of several ways, depending on \fIoption\fR. The command may take any of the forms described below. In all of the descriptions below, \fItagOrId\fR must refer to | > | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | It then adjusts the view by \fIgain\fR times the difference in coordinates, where \fIgain\fR defaults to 10. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the canvas at high speed through its window. The return value is an empty string. .RE .\" METHOD: select .TP \fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR? . Manipulates the selection in one of several ways, depending on \fIoption\fR. The command may take any of the forms described below. In all of the descriptions below, \fItagOrId\fR must refer to |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | The anchor point is determined by the most recent \fBselect adjust\fR or \fBselect from\fR command for this widget. If the selection anchor point for the widget is not currently in \fItagOrId\fR, then it is set to the same character given by \fIindex\fR. Returns an empty string. .RE .TP \fIpathName \fBtype\fI tagOrId\fR . Returns the type of the item given by \fItagOrId\fR, such as \fBrectangle\fR or \fBtext\fR. If \fItagOrId\fR refers to more than one item, then the type of the first item in the display list is returned. If \fItagOrId\fR does not refer to any items at all then an empty string is returned. .TP \fIpathName \fBxview \fR?\fIargs\fR? . This command is used to query and change the horizontal position of the information displayed in the canvas's window. It can take any of the following forms: .RS | > > | 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 | The anchor point is determined by the most recent \fBselect adjust\fR or \fBselect from\fR command for this widget. If the selection anchor point for the widget is not currently in \fItagOrId\fR, then it is set to the same character given by \fIindex\fR. Returns an empty string. .RE .\" METHOD: type .TP \fIpathName \fBtype\fI tagOrId\fR . Returns the type of the item given by \fItagOrId\fR, such as \fBrectangle\fR or \fBtext\fR. If \fItagOrId\fR refers to more than one item, then the type of the first item in the display list is returned. If \fItagOrId\fR does not refer to any items at all then an empty string is returned. .\" METHOD: xview .TP \fIpathName \fBxview \fR?\fIargs\fR? . This command is used to query and change the horizontal position of the information displayed in the canvas's window. It can take any of the following forms: .RS |
︙ | ︙ | |||
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | If \fInumber\fR is negative then information farther to the left becomes visible; if it is positive then information farther to the right becomes visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units of the \fBxScrollIncrement\fR option, if it is greater than zero, or in units of one-tenth the window's width otherwise. .RE .TP \fIpathName \fByview ?\fIargs\fR? . This command is used to query and change the vertical position of the information displayed in the canvas's window. It can take any of the following forms: .RS | > | 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 | If \fInumber\fR is negative then information farther to the left becomes visible; if it is positive then information farther to the right becomes visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units of the \fBxScrollIncrement\fR option, if it is greater than zero, or in units of one-tenth the window's width otherwise. .RE .\" METHOD: yview .TP \fIpathName \fByview ?\fIargs\fR? . This command is used to query and change the vertical position of the information displayed in the canvas's window. It can take any of the following forms: .RS |
︙ | ︙ | |||
1185 1186 1187 1188 1189 1190 1191 | area is off-screen to the top. \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. | | > | 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | area is off-screen to the top. \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. If \fIwhat\fR is \fBpages\fR then the view adjusts in units of nine-tenths the window's height. If \fInumber\fR is negative then higher information becomes visible; if it is positive then lower information becomes visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units |
︙ | ︙ | |||
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 | At present, text, line and polygon items provide this support. For lines and polygons the indexing facility is used to manipulate the coordinates of the item. .SS "COMMON ITEM OPTIONS" .PP Many items share a common set of options. These options are explained here, and then referred to be each widget type for brevity. .TP \fB\-anchor \fIanchorPos\fR . \fIAnchorPos\fR tells how to position the item relative to the positioning point for the item; it may have any of the forms accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR is \fBcenter\fR then the item is centered on the point; if \fIanchorPos\fR is \fBn\fR then the item will be drawn so that its top center point is at the positioning point. This option defaults to \fBcenter\fR. .TP \fB\-dash \fIpattern\fR .TP \fB\-activedash \fIpattern\fR .TP \fB\-disableddash \fIpattern\fR . | > > > > | > > > > | | > > > > | > > > > | > > > > | > > > > > | | | > | 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 | At present, text, line and polygon items provide this support. For lines and polygons the indexing facility is used to manipulate the coordinates of the item. .SS "COMMON ITEM OPTIONS" .PP Many items share a common set of options. These options are explained here, and then referred to be each widget type for brevity. .\" OPTION: -anchor .TP \fB\-anchor \fIanchorPos\fR . \fIAnchorPos\fR tells how to position the item relative to the positioning point for the item; it may have any of the forms accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR is \fBcenter\fR then the item is centered on the point; if \fIanchorPos\fR is \fBn\fR then the item will be drawn so that its top center point is at the positioning point. This option defaults to \fBcenter\fR. .\" OPTION: -dash .TP \fB\-dash \fIpattern\fR .\" OPTION: -activedash .TP \fB\-activedash \fIpattern\fR .\" OPTION: -disableddash .TP \fB\-disableddash \fIpattern\fR . These options specify dash patterns for the normal, active state, and disabled state of an item. \fIpattern\fR may have any of the forms accepted by \fBTk_GetDash\fR. If the dash options are omitted then the default is a solid outline. See \fBDASH PATTERNS\fR for more information. .\" OPTION: -dashoffset .TP \fB\-dashoffset \fIoffset\fR . The starting \fIoffset\fR in pixels into the pattern provided by the \fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no \fB\-dash\fR pattern. The \fIoffset\fR may have any of the forms described in the \fBCOORDINATES\fR section above. .\" OPTION: -fill .TP \fB\-fill \fIcolor\fR .\" OPTION: -activefill .TP \fB\-activefill \fIcolor\fR .\" OPTION: -disabledfill .TP \fB\-disabledfill \fIcolor\fR . These options specify 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. .\" OPTION: -outline .TP \fB\-outline \fIcolor\fR .\" OPTION: -activeoutline .TP \fB\-activeoutline \fIcolor\fR .\" OPTION: -disabledoutline .TP \fB\-disabledoutline \fIcolor\fR . These options specify the color that should be used to draw the outline of the item in its normal, active and disabled states. \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR is specified as an empty string then no outline is drawn for the item. .\" OPTION: -offset .TP \fB\-offset \fIoffset\fR . Specifies the offset of stipples. The offset value can be of the form \fBx,y\fR or \fIside\fR, where side can be \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. In the first case the origin is the origin of the toplevel of the current window. For the canvas itself and canvas objects the origin is the canvas origin, but putting \fB#\fR in front of the coordinate pair indicates using the toplevel origin instead. For canvas objects, the \fB\-offset\fR option is used for stippling as well. For the line and polygon canvas items you can also specify an index as argument, which connects the stipple origin to one of the coordinate points of the line/polygon. Note that stipple offsets are \fIonly supported on X11\fR; they are silently ignored on other platforms. .\" OPTION: -outlinestipple .TP \fB\-outlinestipple \fIbitmap\fR .\" OPTION: -activeoutlinestipple .TP \fB\-activeoutlinestipple \fIbitmap\fR .\" OPTION: -disabledoutlinestipple .TP \fB\-disabledoutlinestipple \fIbitmap\fR . These options specify stipple patterns that should be used to draw the outline of the item in its normal, active and disabled states. Indicates that the outline for the item should be drawn with a stipple pattern; \fIbitmap\fR specifies the stipple pattern to use, in any of the forms accepted by \fBTk_GetBitmap\fR. If the \fB\-outline\fR option has not been specified then this option has no effect. If \fIbitmap\fR is an empty string (the default), then the outline is drawn in a solid fashion. \fINote that stipples are not well supported on platforms that do not use X11 as their drawing API.\fR .\" OPTION: -outlineoffset .TP \fB\-outlineoffset \fIoffset\fR . Specifies the offset of the stipple pattern used for outlines, in the same way that the \fB\-outline\fR option controls fill stipples. (See the \fB\-outline\fR option for a description of the syntax of \fIoffset\fR.) .\" OPTION: -stipple .TP \fB\-stipple \fIbitmap\fR .\" OPTION: -activestipple .TP \fB\-activestipple \fIbitmap\fR .\" OPTION: -disabledstipple .TP \fB\-disabledstipple \fIbitmap\fR . These options specify stipple patterns that should be used to fill the item in its normal, active and disabled states. \fIbitmap\fR specifies the stipple pattern to use, in any of the forms accepted by \fBTk_GetBitmap\fR. If the \fB\-fill\fR option has not been specified then this option has no effect. If \fIbitmap\fR is an empty string (the default), then filling is done in a solid fashion. For the text item, it affects the actual text. \fINote that stipples are not well supported on platforms that do not use X11 as their drawing API.\fR .\" OPTION: -state .TP \fB\-state \fIstate\fR . This allows an item to override the canvas widget's global \fIstate\fR option. It takes the same values: \fInormal\fR, \fIdisabled\fR or \fIhidden\fR. .\" OPTION: -tags .TP \fB\-tags \fItagList\fR . Specifies a set of tags to apply to the item. \fITagList\fR consists of a list of tag names, which replace any existing tags for the item. \fITagList\fR may be an empty list. .\" OPTION: -width .TP \fB\-width \fIoutlineWidth\fR .\" OPTION: -activewidth .TP \fB\-activewidth \fIoutlineWidth\fR .\" OPTION: -disabledwidth .TP \fB\-disabledwidth \fIoutlineWidth\fR . These options specify the width of the outline to be drawn around the item's region, in its normal, active and disabled states. \fIoutlineWidth\fR may be in any of the forms described in the \fBCOORDINATES\fR section above. If the \fB\-outline\fR option has been specified as an empty string then this option has no effect. This option defaults to 1.0. For arcs, wide outlines will be drawn centered on the edges of the arc's region. .SH "STANDARD ITEM TYPES" .SS "ARC ITEMS" .PP Items of type \fBarc\fR appear on the display as arc-shaped regions. An arc is a section of an oval delimited by two angles (specified by either the \fB\-start\fR and \fB\-extent\fR options or the \fB\-height\fR option) and displayed in one of several ways (specified by the \fB\-style\fR option). Arcs are created with widget commands of the following form: .CS \fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR? \fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value ...\fR? .CE The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give the coordinates of two diagonally opposite corners of a |
︙ | ︙ | |||
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 | \fB\-disabledoutlinestipple\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for arcs: .TP \fB\-extent \fIdegrees\fR Specifies the size of the angular range occupied by the arc. The arc's range extends for \fIdegrees\fR degrees counter-clockwise from the starting angle given by the \fB\-start\fR option. \fIDegrees\fR may be negative. If it is greater than 360 or less than \-360, then \fIdegrees\fR modulo 360 is used as the extent. .TP \fB\-start \fIdegrees\fR Specifies the beginning of the angular range occupied by the arc. \fIDegrees\fR is given in units of degrees measured counter-clockwise from the 3-o'clock position; it may be either positive or negative. .TP \fB\-height \fIdistance\fR Provides a shortcut for creating a circular arc segment by defining the distance of the mid-point of the arc from its chord. When this option is used the coordinates are interpreted as the start and end coordinates | > > > > > > | | 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 | \fB\-disabledoutlinestipple\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for arcs: .\" OPTION: -extent .TP \fB\-extent \fIdegrees\fR . Specifies the size of the angular range occupied by the arc. The arc's range extends for \fIdegrees\fR degrees counter-clockwise from the starting angle given by the \fB\-start\fR option. \fIDegrees\fR may be negative. If it is greater than 360 or less than \-360, then \fIdegrees\fR modulo 360 is used as the extent. .\" OPTION: -start .TP \fB\-start \fIdegrees\fR . Specifies the beginning of the angular range occupied by the arc. \fIDegrees\fR is given in units of degrees measured counter-clockwise from the 3-o'clock position; it may be either positive or negative. .\" OPTION: -height .TP \fB\-height \fIdistance\fR . Provides a shortcut for creating a circular arc segment by defining the distance of the mid-point of the arc from its chord. When this option is used the coordinates are interpreted as the start and end coordinates of the chord, and the options \fB\-start\fR and \fB\-extent\fR are ignored. The value of \fIdistance\fR has the following meaning: .RS .PP .RS \fIdistance\fR > 0 creates a clockwise arc .br \fIdistance\fR < 0 creates an counter-clockwise arc |
︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 | .RE .PP choosing the minus sign for the minor arc and the plus sign for the major arc. .PP Note that \fBitemcget \-height\fR always returns 0 so that introspection code can be kept simple. .RE .TP \fB\-style \fItype\fR Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR (the default) then the arc's region is defined by a section of the oval's perimeter plus two line segments, one between the center of the oval and each end of the perimeter section. If \fItype\fR is \fBchord\fR then the arc's region is defined by a section of the oval's perimeter plus a single line segment connecting the two end points of the perimeter section. | > > | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 | .RE .PP choosing the minus sign for the minor arc and the plus sign for the major arc. .PP Note that \fBitemcget \-height\fR always returns 0 so that introspection code can be kept simple. .RE .\" OPTION: -style .TP \fB\-style \fItype\fR . Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR (the default) then the arc's region is defined by a section of the oval's perimeter plus two line segments, one between the center of the oval and each end of the perimeter section. If \fItype\fR is \fBchord\fR then the arc's region is defined by a section of the oval's perimeter plus a single line segment connecting the two end points of the perimeter section. |
︙ | ︙ | |||
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 | The following standard options are supported by bitmaps: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for bitmaps: .TP \fB\-background \fIcolor\fR .TP \fB\-activebackground \fIcolor\fR .TP \fB\-disabledbackground \fIcolor\fR Specifies the color to use for each of the bitmap's .QW 0 valued pixels in its normal, active and disabled states. \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. If this option is not specified, or if it is specified as an empty string, then nothing is displayed where the bitmap pixels are 0; this produces a transparent effect. .TP \fB\-bitmap \fIbitmap\fR .TP \fB\-activebitmap \fIbitmap\fR .TP \fB\-disabledbitmap \fIbitmap\fR | > > > > > > > > | | > > > > | | 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 | The following standard options are supported by bitmaps: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for bitmaps: .\" OPTION: -background .TP \fB\-background \fIcolor\fR .\" OPTION: -activebackground .TP \fB\-activebackground \fIcolor\fR .\" OPTION: -disabledbackground .TP \fB\-disabledbackground \fIcolor\fR . Specifies the color to use for each of the bitmap's .QW 0 valued pixels in its normal, active and disabled states. \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. If this option is not specified, or if it is specified as an empty string, then nothing is displayed where the bitmap pixels are 0; this produces a transparent effect. .\" OPTION: -bitmap .TP \fB\-bitmap \fIbitmap\fR .\" OPTION: -activebitmap .TP \fB\-activebitmap \fIbitmap\fR .\" OPTION: -disabledbitmap .TP \fB\-disabledbitmap \fIbitmap\fR . These options specify the bitmaps to display in the item in its normal, active and disabled states. \fIBitmap\fR may have any of the forms accepted by \fBTk_GetBitmap\fR. .\" OPTION: -foreground .TP \fB\-foreground \fIcolor\fR .\" OPTION: -activeforeground .TP \fB\-activeforeground \fIcolor\fR .\" OPTION: -disabledforeground .TP \fB\-disabledforeground \fIcolor\fR . These options specify the color to use for each of the bitmap's .QW 1 valued pixels in its normal, active and disabled states. \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. .SS "IMAGE ITEMS" .PP Items of type \fBimage\fR are used to display images on a canvas. |
︙ | ︙ | |||
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | The following standard options are supported by images: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for images: .TP \fB\-image \fIname\fR .TP \fB\-activeimage \fIname\fR .TP \fB\-disabledimage \fIname\fR Specifies the name of the images to display in the item in is normal, active and disabled states. This image must have been created previously with the \fBimage create\fR command. .SS "LINE ITEMS" .PP Items of type \fBline\fR appear on the display as one or more connected | > > > > | 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 | The following standard options are supported by images: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for images: .\" OPTION: -image .TP \fB\-image \fIname\fR .\" OPTION: -activeimage .TP \fB\-activeimage \fIname\fR .\" OPTION: -disabledimage .TP \fB\-disabledimage \fIname\fR . Specifies the name of the images to display in the item in is normal, active and disabled states. This image must have been created previously with the \fBimage create\fR command. .SS "LINE ITEMS" .PP Items of type \fBline\fR appear on the display as one or more connected |
︙ | ︙ | |||
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 | \fB\-disabledfill\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for lines: .TP \fB\-arrow \fIwhere\fR Indicates whether or not arrowheads are to be drawn at one or both ends of the line. \fIWhere\fR must have one of the values \fBnone\fR (for no arrowheads), \fBfirst\fR (for an arrowhead at the first point of the line), \fBlast\fR (for an arrowhead at the last point of the line), or \fBboth\fR (for arrowheads at both ends). This option defaults to \fBnone\fR. When requested to draw an arrowhead, Tk internally adjusts the corresponding line end point so that the rendered line ends at the neck of the arrowhead rather than at its tip so that the line doesn't extend past the edge of the arrowhead. This may trigger a \fBLeave\fR event if the mouse is hovering this line end. Conversely, when removing an arrowhead Tk adjusts the corresponding line point the other way round, which may trigger an \fBEnter\fR event. .TP \fB\-arrowshape \fIshape\fR This option indicates how to draw arrowheads. The \fIshape\fR argument must be a list with three elements, each specifying a distance in any of the forms described in the \fBCOORDINATES\fR section above. The first element of the list gives the distance along the line from the neck of the arrowhead to its tip. The second element gives the distance along the line from the trailing points of the arrowhead to the tip, and the third element gives the distance from the outside edge of the line to the trailing points. If this option is not specified then Tk picks a .QW reasonable shape. .TP \fB\-capstyle \fIstyle\fR Specifies the ways in which caps are to be drawn at the endpoints of the line. \fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR (\fBbutt\fR, \fBprojecting\fR, or \fBround\fR). If this option is not specified then it defaults to \fBbutt\fR. Where arrowheads are drawn the cap style is ignored. .TP \fB\-joinstyle \fIstyle\fR Specifies the ways in which joints are to be drawn at the vertices of the line. \fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). If this option is not specified then it defaults to \fBround\fR. If the line only contains two points then this option is irrelevant. .TP \fB\-smooth \fIsmoothMethod\fR \fIsmoothMethod\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are | > > > > > > > > > > | > > > | 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 | \fB\-disabledfill\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for lines: .\" OPTION: -arrow .TP \fB\-arrow \fIwhere\fR . Indicates whether or not arrowheads are to be drawn at one or both ends of the line. \fIWhere\fR must have one of the values \fBnone\fR (for no arrowheads), \fBfirst\fR (for an arrowhead at the first point of the line), \fBlast\fR (for an arrowhead at the last point of the line), or \fBboth\fR (for arrowheads at both ends). This option defaults to \fBnone\fR. When requested to draw an arrowhead, Tk internally adjusts the corresponding line end point so that the rendered line ends at the neck of the arrowhead rather than at its tip so that the line doesn't extend past the edge of the arrowhead. This may trigger a \fBLeave\fR event if the mouse is hovering this line end. Conversely, when removing an arrowhead Tk adjusts the corresponding line point the other way round, which may trigger an \fBEnter\fR event. .\" OPTION: -arrowshape .TP \fB\-arrowshape \fIshape\fR . This option indicates how to draw arrowheads. The \fIshape\fR argument must be a list with three elements, each specifying a distance in any of the forms described in the \fBCOORDINATES\fR section above. The first element of the list gives the distance along the line from the neck of the arrowhead to its tip. The second element gives the distance along the line from the trailing points of the arrowhead to the tip, and the third element gives the distance from the outside edge of the line to the trailing points. If this option is not specified then Tk picks a .QW reasonable shape. .\" OPTION: -capstyle .TP \fB\-capstyle \fIstyle\fR . Specifies the ways in which caps are to be drawn at the endpoints of the line. \fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR (\fBbutt\fR, \fBprojecting\fR, or \fBround\fR). If this option is not specified then it defaults to \fBbutt\fR. Where arrowheads are drawn the cap style is ignored. .\" OPTION: -joinstyle .TP \fB\-joinstyle \fIstyle\fR . Specifies the ways in which joints are to be drawn at the vertices of the line. \fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). If this option is not specified then it defaults to \fBround\fR. If the line only contains two points then this option is irrelevant. .\" OPTION: -smooth .TP \fB\-smooth \fIsmoothMethod\fR . \fIsmoothMethod\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes \fBtrue\fR smoothing. If the smoothing method is \fBtrue\fR, this indicates that the line should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second 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 line 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 a control point and not a knot point, the point is repeated (one or two times) so that it also becomes a knot point. .\" OPTION: -splinesteps .TP \fB\-splinesteps \fInumber\fR . Specifies the degree of smoothness desired for curves: each spline will be approximated with \fInumber\fR line segments. This option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR. .SS "OVAL ITEMS" .PP Items of type \fBoval\fR appear as circular or oval regions on the display. Each oval may have an outline, a fill, or |
︙ | ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | Polygon items support coordinate indexing operations using the \fBdchars\fR, \fBindex\fR and \fBinsert\fR widget commands. Polygons are created with widget commands of the following form: .CS \fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value ...\fR? \fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value ...\fR? .CE | | | | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 | Polygon items support coordinate indexing operations using the \fBdchars\fR, \fBindex\fR and \fBinsert\fR widget commands. Polygons are created with widget commands of the following form: .CS \fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value ...\fR? \fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value ...\fR? .CE The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR specify the coordinates for three or more points that define a polygon. The first point should not be repeated as the last to close the shape; Tk will automatically close the periphery between the first and last points. After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR pairs, each of which sets one of the configuration options for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be used in \fBitemconfigure\fR widget commands to change the item's |
︙ | ︙ | |||
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | \fB\-disabledoutlinestipple\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for polygons: .TP \fB\-joinstyle \fIstyle\fR Specifies the ways in which joints are to be drawn at the vertices of the outline. \fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). If this option is not specified then it defaults to \fBround\fR. .TP \fB\-smooth \fIboolean\fR \fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are | > > > > | > | > > | 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 | \fB\-disabledoutlinestipple\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR \fB\-width\fR \fB\-activewidth\fR \fB\-disabledwidth\fR .DE The following extra options are supported for polygons: .\" OPTION: -joinstyle .TP \fB\-joinstyle \fIstyle\fR . Specifies the ways in which joints are to be drawn at the vertices of the outline. \fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). If this option is not specified then it defaults to \fBround\fR. .\" OPTION: -smooth .TP \fB\-smooth \fIboolean\fR . \fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes \fBtrue\fR smoothing. If the smoothing method is \fBtrue\fR, this indicates that the polygon should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second 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). .\" OPTION: -splinesteps .TP \fB\-splinesteps \fInumber\fR . Specifies the degree of smoothness desired for curves: each spline will be approximated with \fInumber\fR line segments. This option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR. .PP Polygon items are different from other items such as rectangles, ovals and arcs in that interior points are considered to be .QW inside |
︙ | ︙ | |||
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 | \fB\-anchor\fR \fB\-fill\fR \fB\-activefill\fR \fB\-disabledfill\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for text items: .TP \fB\-angle \fIrotationDegrees\fR . \fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise about the positioning point for the text; it may have any floating-point value from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the text will be drawn vertically from bottom to top. This option defaults to \fB0.0\fR. .TP \fB\-font \fIfontName\fR Specifies the font to use for the text item. \fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR. If this option is not specified, it defaults to a system-dependent font. .TP \fB\-justify \fIhow\fR Specifies how to justify the text within its bounding region. \fIHow\fR must be one of the values \fBleft\fR, \fBright\fR, or \fBcenter\fR. This option will only matter if the text is displayed as multiple lines. If the option is omitted, it defaults to \fBleft\fR. .TP \fB\-text \fIstring\fR \fIString\fR specifies the characters to be displayed in the text item. Newline characters cause line breaks. The characters in the item may also be changed with the \fBinsert\fR and \fBdelete\fR widget commands. This option defaults to an empty string. .TP | > > > > > > > > | > > > | 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 | \fB\-anchor\fR \fB\-fill\fR \fB\-activefill\fR \fB\-disabledfill\fR \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for text items: .\" OPTION: -angle .TP \fB\-angle \fIrotationDegrees\fR . \fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise about the positioning point for the text; it may have any floating-point value from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the text will be drawn vertically from bottom to top. This option defaults to \fB0.0\fR. .\" OPTION: -font .TP \fB\-font \fIfontName\fR . Specifies the font to use for the text item. \fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR. If this option is not specified, it defaults to a system-dependent font. .\" OPTION: -justify .TP \fB\-justify \fIhow\fR . Specifies how to justify the text within its bounding region. \fIHow\fR must be one of the values \fBleft\fR, \fBright\fR, or \fBcenter\fR. This option will only matter if the text is displayed as multiple lines. If the option is omitted, it defaults to \fBleft\fR. .\" OPTION: -text .TP \fB\-text \fIstring\fR . \fIString\fR specifies the characters to be displayed in the text item. Newline characters cause line breaks. The characters in the item may also be changed with the \fBinsert\fR and \fBdelete\fR widget commands. This option defaults to an empty string. .\" OPTION: -underline .TP \fB\-underline \fInumber\fR . Specifies the integer index of a character within the text to be underlined. 0 corresponds to the first character of the text displayed, 1 to the next character, and so on. \-1 means that no underline should be drawn (if the whole text item is to be underlined, the appropriate font should be used instead). .\" OPTION: -width .TP \fB\-width \fIlineLength\fR . Specifies a maximum line length for the text, in any of the forms described in the \fBCOORDINATES\fR section above. If this option is zero (the default) the text is broken into lines only at newline characters. However, if this option is non-zero then any line that would be longer than \fIlineLength\fR is broken just before a space character to make the line shorter than \fIlineLength\fR; the |
︙ | ︙ | |||
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 | The following standard options are supported by window items: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for window items: .TP \fB\-height \fIpixels\fR . Specifies the height to assign to the item's window. \fIPixels\fR may have any of the forms described in the \fBCOORDINATES\fR section above. If this option is not specified, or if it is specified as zero, then the window is given whatever height it requests internally. .TP \fB\-width \fIpixels\fR . Specifies the width to assign to the item's window. \fIPixels\fR may have any of the forms described in the \fBCOORDINATES\fR section above. If this option is not specified, or if it is specified as zero, then the window is given whatever width it requests internally. .TP \fB\-window \fIpathName\fR . Specifies the window to associate with this item. The window specified by \fIpathName\fR must either be a child of the canvas widget or a child of some ancestor of the canvas widget. \fIPathName\fR may not refer to a top-level window. .PP | > > > | | 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 | The following standard options are supported by window items: .DS .ta 3i \fB\-anchor\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for window items: .\" OPTION: -height .TP \fB\-height \fIpixels\fR . Specifies the height to assign to the item's window. \fIPixels\fR may have any of the forms described in the \fBCOORDINATES\fR section above. If this option is not specified, or if it is specified as zero, then the window is given whatever height it requests internally. .\" OPTION: -width .TP \fB\-width \fIpixels\fR . Specifies the width to assign to the item's window. \fIPixels\fR may have any of the forms described in the \fBCOORDINATES\fR section above. If this option is not specified, or if it is specified as zero, then the window is given whatever width it requests internally. .\" OPTION: -window .TP \fB\-window \fIpathName\fR . Specifies the window to associate with this item. The window specified by \fIpathName\fR must either be a child of the canvas widget or a child of some ancestor of the canvas widget. \fIPathName\fR may not refer to a top-level window. .PP Note that, due to restrictions in the ways that windows are managed, it is not possible to draw other graphical items (such as lines and images) on top of window items. A window item always obscures any graphics that overlap it, regardless of their order in the display list. Also note that window items, unlike other canvas items, are not clipped for display by their containing canvas's border, and are instead clipped by the parent widget of the window specified by the \fB\-window\fR option; when the parent widget is the canvas, this means that the window item can overlap the canvas's border. |
︙ | ︙ |
Changes to doc/checkbutton.n.
︙ | ︙ | |||
193 194 195 196 197 198 199 200 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for checkbutton widgets: .TP | > | > > > > > > > > > > > > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for checkbutton widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBcheckbutton\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBcheckbutton\fR command. .\" METHOD: deselect .TP \fIpathName \fBdeselect\fR . Deselects the checkbutton and sets the associated variable to its .QW off value. .\" METHOD: flash .TP \fIpathName \fBflash\fR . Flashes the checkbutton. This is accomplished by redisplaying the checkbutton several times, alternating between active and normal colors. At the end of the flash the checkbutton is left in the same normal/active state as when the command was invoked. This command is ignored if the checkbutton's state is \fBdisabled\fR. .\" METHOD: invoke .TP \fIpathName \fBinvoke\fR . Does just what would have happened if the user invoked the checkbutton with the mouse: toggle the selection state of the button and invoke the Tcl command associated with the checkbutton, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the checkbutton. This command is ignored if the checkbutton's state is \fBdisabled\fR. .\" METHOD: select .TP \fIpathName \fBselect\fR . Selects the checkbutton and sets the associated variable to its .QW on value. .\" METHOD: toggle .TP \fIpathName \fBtoggle\fR . Toggles the selection state of the button, redisplaying it and modifying its associated variable to reflect the new state. .SH BINDINGS .PP Tk automatically creates class bindings for checkbuttons that give them the following default behavior: .IP [1] |
︙ | ︙ | |||
273 274 275 276 277 278 279 | The behavior of checkbuttons can be changed by defining new bindings for individual widgets or by redefining the class bindings. .SH EXAMPLE .PP This example shows a group of uncoupled checkbuttons. .PP .CS | | | | | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | The behavior of checkbuttons can be changed by defining new bindings for individual widgets or by redefining the class bindings. .SH EXAMPLE .PP This example shows a group of uncoupled checkbuttons. .PP .CS labelframe .lbl -text "Steps:" \fBcheckbutton\fR .c1 -text Lights -variable lights \fBcheckbutton\fR .c2 -text Cameras -variable cameras \fBcheckbutton\fR .c3 -text Action! -variable action pack .c1 .c2 .c3 -in .lbl pack .lbl .CE .SH "SEE ALSO" button(n), options(n), radiobutton(n), ttk::checkbutton(n) .SH KEYWORDS checkbutton, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/chooseColor.n.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 | \fBtk_chooseColor \fR?\fIoption value ...\fR? .BE .SH DESCRIPTION .PP The procedure \fBtk_chooseColor\fR pops up a dialog box for the user to select a color. The following \fIoption\-value\fR pairs are possible as command line arguments: .TP | > | > > | > > | > | | 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 | \fBtk_chooseColor \fR?\fIoption value ...\fR? .BE .SH DESCRIPTION .PP The procedure \fBtk_chooseColor\fR pops up a dialog box for the user to select a color. The following \fIoption\-value\fR pairs are possible as command line arguments: .\" OPTION: -initialcolor .TP \fB\-initialcolor\fI color\fR . Specifies the color to display in the color dialog when it pops up. \fIcolor\fR must be in a form acceptable to the \fBTk_GetColor\fR function. .\" OPTION: -parent .TP \fB\-parent\fI window\fR . Makes \fIwindow\fR the logical parent of the color dialog. The color dialog is displayed on top of its parent window. .\" OPTION: -title .TP \fB\-title\fI titleString\fR . Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed. .LP If the user selects a color, \fBtk_chooseColor\fR will return the name of the color in a form acceptable to \fBTk_GetColor\fR. If the user cancels the operation, both commands will return the empty string. .SH EXAMPLE .PP .CS button .b -bg [tk_chooseColor -initialcolor gray -title "Choose color"] .CE .SH KEYWORDS color, color selection, dialog '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/chooseDirectory.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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | '\" '\" 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 tk_chooseDirectory \- pops up a dialog box for the user to select a directory. .SH SYNOPSIS \fBtk_chooseDirectory \fR?\fIoption value ...\fR? .BE .SH DESCRIPTION .PP The procedure \fBtk_chooseDirectory\fR pops up a dialog box for the user to select a directory. The following \fIoption\-value\fR pairs are possible as command line arguments: .\" OPTION: -command .TP \fB\-command\fI string\fR . Specifies the prefix of a Tcl command to invoke when the user closes the dialog after having selected an item. This callback is not called if the user cancelled the dialog. The actual command consists of \fIstring\fR followed by a space and the value selected by the user in the dialog. This is only available on Mac OS X. .\" OPTION: -initialdir .TP \fB\-initialdir\fI dirname\fR . Specifies that the directories in \fIdirectory\fR should be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path. .\" OPTION: -message .TP \fB\-message\fI string\fR . Specifies a message to include in the client area of the dialog. This is only available on Mac OS X. .\" OPTION: -mustexist .TP \fB\-mustexist\fI boolean\fR . Specifies whether the user may specify non-existent directories. If this parameter is true, then the user may only select directories that already exist. The default value is \fIfalse\fR. .\" OPTION: -parent .TP \fB\-parent\fI window\fR . Makes \fIwindow\fR the logical parent of the dialog. The dialog is displayed on top of its parent window. On Mac OS X, this turns the file dialog into a sheet attached to the parent window. .\" OPTION: -title .TP \fB\-title\fI titleString\fR . Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed. .SH EXAMPLE .PP .CS set dir [\fBtk_chooseDirectory\fR \e -initialdir ~ -title "Choose a directory"] if {$dir eq ""} { label .l -text "No directory selected" } else { label .l -text "Selected $dir" } .CE .SH "SEE ALSO" tk_getOpenFile(n), tk_getSaveFile(n) .SH KEYWORDS directory, selection, dialog, platform-specific '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/clipboard.n.
︙ | ︙ | |||
23 24 25 26 27 28 29 30 | be called, followed by a sequence of one or more calls to \fBclipboard append\fR. To ensure that the clipboard is updated atomically, all appends should be completed before returning to the event loop. .PP The first argument to \fBclipboard\fR determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: .TP | > | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | be called, followed by a sequence of one or more calls to \fBclipboard append\fR. To ensure that the clipboard is updated atomically, all appends should be completed before returning to the event loop. .PP The first argument to \fBclipboard\fR determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: .\" METHOD: append .TP \fBclipboard append\fR ?\fB\-displayof\fI window\fR? ?\fB\-format\fI format\fR? ?\fB\-type\fI type\fR? ?\fB\-\|\-\fR? \fIdata\fR . Appends \fIdata\fR to the clipboard on \fIwindow\fR's display in the form given by \fItype\fR with the representation given by \fIformat\fR and claims ownership of the clipboard on \fIwindow\fR's display. .RS .PP |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 | irrelevant. .PP A \fB\-\|\-\fR argument may be specified to mark the end of options: the next argument will always be used as \fIdata\fR. This feature may be convenient if, for example, \fIdata\fR starts with a \fB\-\fR. .RE .TP | > | > | | 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 | irrelevant. .PP A \fB\-\|\-\fR argument may be specified to mark the end of options: the next argument will always be used as \fIdata\fR. This feature may be convenient if, for example, \fIdata\fR starts with a \fB\-\fR. .RE .\" METHOD: clear .TP \fBclipboard clear\fR ?\fB\-displayof\fI window\fR? . Claims ownership of the clipboard on \fIwindow\fR's display and removes any previous contents. \fIWindow\fR defaults to .QW . . Returns an empty string. .\" METHOD: get .TP \fBclipboard get\fR ?\fB\-displayof\fI window\fR? ?\fB\-type\fI type\fR? . Retrieve data from the clipboard on \fIwindow\fR's display. \fIWindow\fR defaults to .QW . . \fIType\fR specifies the form in which the data is to be returned and should be an atom name such as \fBSTRING\fR or \fBFILE_NAME\fR. \fIType\fR defaults to \fBSTRING\fR. This command is |
︙ | ︙ | |||
118 119 120 121 122 123 124 | # it produces a script that recreates the item(s) when executed proc getItemConfig {canvas tag} { set script {} foreach item [$canvas find withtag $tag] { append script {$canvas create } [$canvas type $item] append script { } [$canvas coords $item] { } foreach config [$canvas itemconf $item] { | | | | | | 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 | # it produces a script that recreates the item(s) when executed proc getItemConfig {canvas tag} { set script {} foreach item [$canvas find withtag $tag] { append script {$canvas create } [$canvas type $item] append script { } [$canvas coords $item] { } foreach config [$canvas itemconf $item] { lassign $config name - - - value append script [list $name $value] { } } append script \en } return [string trim $script] } # Set up a binding on a canvas to cut and paste an item set c [canvas .c] pack $c $c create text 150 30 -text "cut and paste me" bind $c <<Cut>> { \fBclipboard clear\fR \fBclipboard append -type\fR TkCanvasItem \e [getItemConfig %W current] # Delete because this is cut, not copy. %W delete current } bind $c <<Paste>> { catch { set canvas %W eval [\fBclipboard get -type\fR TkCanvasItem] } } .CE .SH "SEE ALSO" interp(n), selection(n) .SH KEYWORDS clear, format, clipboard, append, selection, type '\" Local Variables: '\" mode: nroff '\" End: |
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 |
︙ | ︙ | |||
892 893 894 895 896 897 898 | systemTextBackgroundColor systemTextColor .DE .RE . The numbered systemWindowBackgroundColors below are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets | | < | 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 | systemTextBackgroundColor systemTextColor .DE .RE . The numbered systemWindowBackgroundColors below are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a contrasting background. Each numbered color contrasts with its predecessor. .RS .DS systemWindowBackgroundColor systemWindowBackgroundColor1 systemWindowBackgroundColor2 systemWindowBackgroundColor3 systemWindowBackgroundColor4 systemWindowBackgroundColor5 systemWindowBackgroundColor6 systemWindowBackgroundColor7 .DE .RE .TP \fBWindows\fR . On Windows, the following additional system colors are available (note that the actual color values depend on the currently active OS theme): .RS .DS .ta 6c |
︙ | ︙ |
Changes to doc/console.n.
1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH console n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME console \- Control the console on systems without a real console .SH SYNOPSIS | | | > > > > > > > > > > > > > | 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 | '\" '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH console n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME console \- Control the console on systems without a real console .SH SYNOPSIS \fBconsole\fI subcommand\fR ?\fIarg ...\fR? .BE .SH DESCRIPTION .PP The console window is a replacement for a real console to allow input 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. .PP .\" METHOD: eval .TP \fBconsole eval \fIscript\fR . Evaluate the \fIscript\fR argument as a Tcl script in the console interpreter. The normal interpreter is accessed through the \fBconsoleinterp\fR command in the console interpreter. .\" METHOD: hide .TP \fBconsole hide\fR . Hide the console window from view. Precisely equivalent to withdrawing the \fB.\fR window in the console interpreter. .\" METHOD: show .TP \fBconsole show\fR . Display the console window. Precisely equivalent to deiconifying the \fB.\fR window in the console interpreter. .\" METHOD: title .TP \fBconsole title \fR?\fIstring\fR? . Query or modify the title of the console window. If \fIstring\fR is not specified, queries the title of the console window, and sets the title of the console window to \fIstring\fR otherwise. Precisely equivalent to using the \fBwm title\fR command in the console interpreter. .SH "ACCESS TO THE MAIN INTERPRETER" .PP The \fBconsoleinterp\fR command in the console interpreter allows scripts to be evaluated in the main interpreter. It supports two subcommands: \fBeval\fR and \fBrecord\fR. .PP .\" METHOD: eval .TP \fBconsoleinterp eval \fIscript\fR . Evaluates \fIscript\fR as a Tcl script at the global level in the main interpreter. .\" METHOD: record .TP \fBconsoleinterp record \fIscript\fR . Records and evaluates \fIscript\fR as a Tcl script at the global level in the main interpreter as if \fIscript\fR had been typed in at the console. .SH "ADDITIONAL TRAP CALLS" .PP There are several additional commands in the console interpreter that are called in response to activity in the main interpreter. |
︙ | ︙ |
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 |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | xterm .CE .PP The \fBnone\fR cursor can be specified to eliminate the cursor. .SH "PORTABILITY ISSUES" .TP \fBWindows\fR On Windows systems, the following cursors are mapped to native cursors: .RS .CS arrow center_ptr crosshair fleur | > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | xterm .CE .PP The \fBnone\fR cursor can be specified to eliminate the cursor. .SH "PORTABILITY ISSUES" .TP \fBWindows\fR . On Windows systems, the following cursors are mapped to native cursors: .RS .CS arrow center_ptr crosshair fleur |
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | size_we uparrow wait .CE .RE .TP \fBMac OS X\fR On Mac OS X systems, the following cursors are mapped to native cursors: .RS .CS arrow top_left_arrow left_ptr cross | > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | size_we uparrow wait .CE .RE .TP \fBMac OS X\fR . On Mac OS X systems, the following cursors are mapped to native cursors: .RS .CS arrow top_left_arrow left_ptr cross |
︙ | ︙ |
Changes to doc/dialog.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | \fBtk_dialog \fIwindow title text bitmap default string string ...\fR .BE .SH DESCRIPTION .PP This procedure is part of the Tk script library. It is largely \fIdeprecated\fR by the \fBtk_messageBox\fR. Its arguments describe a dialog box: | < | < | < | < | < | < | | 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 | \fBtk_dialog \fIwindow title text bitmap default string string ...\fR .BE .SH DESCRIPTION .PP This procedure is part of the Tk script library. It is largely \fIdeprecated\fR by the \fBtk_messageBox\fR. Its arguments describe a dialog box: .IP \fIwindow\fR Name of top-level window to use for dialog. Any existing window by this name is destroyed. .IP \fItitle\fR Text to appear in the window manager's title bar for the dialog. .IP \fItext\fR Message to appear in the top portion of the dialog box. .IP \fIbitmap\fR If non-empty, specifies a bitmap (in a form suitable for Tk_GetBitmap) to display in the top portion of the dialog, to the left of the text. If this is an empty string then no bitmap is displayed in the dialog. .IP \fIdefault\fR If this is an integer greater than or equal to zero, then it gives the index of the button that is to be the default button for the dialog (0 for the leftmost button, and so on). If less than zero or an empty string then there will not be any default button. .IP \fIstring\fR There will be one button for each of these arguments. Each \fIstring\fR specifies text to display in a button, in order from left to right. .PP After creating a dialog box, \fBtk_dialog\fR waits for the user to select one of the buttons either by clicking on the button with the mouse or by typing return to invoke the default button (if any). |
︙ | ︙ |
Changes to doc/entry.n.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .TH entry n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME entry \- Create and manipulate 'entry' one-line text entry widgets .SH SYNOPSIS | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | .TH entry n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME entry \- Create and manipulate 'entry' one-line text entry widgets .SH SYNOPSIS \fBentry\fI pathName \fR?\fIoptions\fR? .SO \-background \-highlightthickness \-selectbackground \-borderwidth \-insertbackground \-selectborderwidth \-cursor \-insertborderwidth \-selectforeground \-exportselection \-insertofftime \-takefocus \-font \-insertontime \-textvariable \-foreground \-insertwidth \-xscrollcommand |
︙ | ︙ | |||
172 173 174 175 176 177 178 | \fB\-invalidcommand\fR encounters an error in its script while evaluating or \fB\-validatecommand\fR does not return a valid Tcl boolean value. The \fB\-validate\fR option will also set itself to \fBnone\fR when you edit the entry widget from within either the \fB\-validatecommand\fR or the \fB\-invalidcommand\fR. Such editions will override the one that was being validated. If you wish to edit the entry widget (for example set it to {}) during validation and still have the \fB\-validate\fR option set, you should | | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | \fB\-invalidcommand\fR encounters an error in its script while evaluating or \fB\-validatecommand\fR does not return a valid Tcl boolean value. The \fB\-validate\fR option will also set itself to \fBnone\fR when you edit the entry widget from within either the \fB\-validatecommand\fR or the \fB\-invalidcommand\fR. Such editions will override the one that was being validated. If you wish to edit the entry widget (for example set it to {}) during validation and still have the \fB\-validate\fR option set, you should include the command: .CS after idle {%W config -validate %v} .CE in the \fB\-validatecommand\fR or \fB\-invalidcommand\fR (whichever one you were editing the entry widget from). It is also recommended to not set an associated \fB\-textvariable\fR during validation, as that can cause the entry widget to become out of sync with the \fB\-textvariable\fR. .SH "WIDGET COMMAND" .PP |
︙ | ︙ | |||
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 | .SS INDICES .PP Many of the widget commands for entries take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways: .TP 12 \fInumber\fR Specifies the character as a numerical index, where 0 corresponds to the first character in the string. .TP 12 \fBanchor\fR Indicates the anchor point for the selection, which is set with the \fBselect from\fR and \fBselect adjust\fR widget commands. .TP 12 \fBend\fR Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string. .TP 12 \fBinsert\fR Indicates the character adjacent to and immediately following the insertion cursor. .TP 12 \fBsel.first\fR Indicates the first character in the selection. It is an error to use this form if the selection is not in the entry window. .TP 12 \fBsel.last\fR Indicates the character just after the last one in the selection. It is an error to use this form if the selection is not in the entry window. .TP 12 \fB@\fInumber\fR In this form, \fInumber\fR is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, .QW \fB@0\fR indicates the left-most character in the window. .LP Abbreviations may be used for any of the forms above, e.g. .QW \fBe\fR or .QW \fBsel.f\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. .SS SUBCOMMANDS .PP The following commands are possible for entry widgets: .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 | > > > > > > > > > > > > > | > > > > > > > > > > > > > > | > > > > > > > > > | > > > > > > > | > > > | 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 | .SS INDICES .PP Many of the widget commands for entries take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways: .TP 12 \fInumber\fR . Specifies the character as a numerical index, where 0 corresponds to the first character in the string. .TP 12 \fBanchor\fR . Indicates the anchor point for the selection, which is set with the \fBselect from\fR and \fBselect adjust\fR widget commands. .TP 12 \fBend\fR . Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string. .TP 12 \fBinsert\fR . Indicates the character adjacent to and immediately following the insertion cursor. .TP 12 \fBsel.first\fR . Indicates the first character in the selection. It is an error to use this form if the selection is not in the entry window. .TP 12 \fBsel.last\fR . Indicates the character just after the last one in the selection. It is an error to use this form if the selection is not in the entry window. .TP 12 \fB@\fInumber\fR . In this form, \fInumber\fR is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, .QW \fB@0\fR indicates the left-most character in the window. .LP Abbreviations may be used for any of the forms above, e.g. .QW \fBe\fR or .QW \fBsel.f\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. .SS SUBCOMMANDS .PP The following commands are possible for entry widgets: .\" METHOD: bbox .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. .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBentry\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBentry\fR command. .\" METHOD: delete .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 an empty string. .\" METHOD: get .TP \fIpathName \fBget\fR . Returns the entry's string. .\" METHOD: icursor .TP \fIpathName \fBicursor \fIindex\fR . Arrange for the insertion cursor to be displayed just before the character given by \fIindex\fR. Returns an empty string. .\" METHOD: index .TP \fIpathName \fBindex\fI index\fR . Returns the numerical index corresponding to \fIindex\fR. .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex string\fR . Insert the characters of \fIstring\fR just before the character indicated by \fIindex\fR. Returns an empty string. .\" METHOD: scan .TP \fIpathName \fBscan\fI option args\fR . This command is used to implement scanning on entries. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBscan mark \fIx\fR . Records \fIx\fR and the current view in the entry window; used in conjunction with later \fBscan dragto\fR commands. Typically this command is associated with a mouse button press in the widget. It returns an empty string. .TP \fIpathName \fBscan dragto \fIx\fR . This command computes the difference between its \fIx\fR argument and the \fIx\fR argument to the last \fBscan mark\fR command for the widget. It then adjusts the view left or right by 10 times the difference in x-coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the entry at high speed through the window. The return value is an empty string. .RE .\" METHOD: selection .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 adjust \fIindex\fR . Locate the end of the selection nearest to the character given by \fIindex\fR, and adjust that end of the selection to be at \fIindex\fR (i.e. including but not going beyond \fIindex\fR). The other end of the selection is made the anchor point for future \fBselect to\fR commands. If the selection is not currently in the entry, then a new selection is created to include the characters between \fIindex\fR and the most recent selection anchor point, inclusive. Returns an empty string. .TP \fIpathName \fBselection clear\fR . Clear the selection if it is currently in this widget. If the selection is not in this widget then the command has no effect. Returns an empty string. .TP \fIpathName \fBselection from \fIindex\fR . Set the selection anchor point to just before the character given by \fIindex\fR. Does not change the selection. Returns an empty string. .TP \fIpathName \fBselection present\fR . Returns 1 if there is are characters selected in the entry, 0 if nothing is selected. .TP \fIpathName \fBselection range \fIstart end\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. .TP \fIpathName \fBselection to \fIindex\fR . If \fIindex\fR is before the anchor point, set the selection to the characters from \fIindex\fR up to but not including the anchor point. If \fIindex\fR is the same as the anchor point, do nothing. If \fIindex\fR is after the anchor point, set the selection to the characters from the anchor point up to but not including \fIindex\fR. The anchor point is determined by the most recent \fBselect from\fR or \fBselect adjust\fR command in this widget. If the selection is not in this widget then a new selection is created using the most recent anchor point specified for the widget. Returns an empty string. .RE .\" METHOD: validate .TP \fIpathName \fBvalidate\fR . This command is used to force an evaluation of the \fB\-validatecommand\fR independent of the conditions specified by the \fB\-validate\fR option. This is done by temporarily setting the \fB\-validate\fR option to \fBall\fR. It returns 0 or 1. .\" METHOD: xview .TP \fIpathName \fBxview \fIargs\fR . This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fBxview\fR . Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR option. .TP \fIpathName \fBxview\fI index\fR . Adjusts the view in the window so that the character given by \fIindex\fR is displayed at the left edge of the window. .TP \fIpathName \fBxview moveto\fI fraction\fR . Adjusts the view in the window so that the character \fIfraction\fR of the way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. |
︙ | ︙ |
Changes to doc/event.n.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | .BE .SH DESCRIPTION .PP The \fBevent\fR command provides several facilities for dealing with window system events, such as defining virtual events and synthesizing events. The command has several different forms, determined by the first argument. The following forms are currently supported: .TP \fBevent add <<\fIvirtual\fB>>\fI sequence \fR?\fIsequence ...\fR? Associates the virtual event \fIvirtual\fR with the physical event sequence(s) given by the \fIsequence\fR arguments, so that the virtual event will trigger whenever any one of the \fIsequence\fRs occurs. \fIVirtual\fR may be any string value and \fIsequence\fR may have any of the values allowed for the \fIsequence\fR argument to the \fBbind\fR command. If \fIvirtual\fR is already defined, the new physical event sequences add to the existing sequences for the event. .TP | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .BE .SH DESCRIPTION .PP The \fBevent\fR command provides several facilities for dealing with window system events, such as defining virtual events and synthesizing events. The command has several different forms, determined by the first argument. The following forms are currently supported: .\" METHOD: add .TP \fBevent add <<\fIvirtual\fB>>\fI sequence \fR?\fIsequence ...\fR? . Associates the virtual event \fIvirtual\fR with the physical event sequence(s) given by the \fIsequence\fR arguments, so that the virtual event will trigger whenever any one of the \fIsequence\fRs occurs. \fIVirtual\fR may be any string value and \fIsequence\fR may have any of the values allowed for the \fIsequence\fR argument to the \fBbind\fR command. If \fIvirtual\fR is already defined, the new physical event sequences add to the existing sequences for the event. .\" METHOD: delete .TP \fBevent delete <<\fIvirtual\fB>> \fR?\fIsequence sequence ...\fR? . Deletes each of the \fIsequence\fRs from those associated with the virtual event given by \fIvirtual\fR. \fIVirtual\fR may be any string value and \fIsequence\fR may have any of the values allowed for the \fIsequence\fR argument to the \fBbind\fR command. Any \fIsequence\fRs not currently associated with \fIvirtual\fR are ignored. If no \fIsequence\fR argument is provided, all physical event sequences are removed for \fIvirtual\fR, so that the virtual event will not trigger anymore. .\" METHOD: generate .TP \fBevent generate \fIwindow event \fR?\fIoption value option value ...\fR? . Generates a window event and arranges for it to be processed just as if it had come from the window system. \fIWindow\fR gives the path name of the window for which the event will be generated; it may also be an identifier (such as returned by \fBwinfo id\fR) as long as it is for a window in the current application. \fIEvent\fR provides a basic description of the event, such as \fB<Shift-Button-2>\fR or \fB<<Paste>>\fR. If \fIWindow\fR is empty the whole screen is meant, and coordinates are relative to the screen. \fIEvent\fR may have any of the forms allowed for the \fIsequence\fR argument of the \fBbind\fR command except that it must consist of a single event pattern, not a sequence. \fIOption-value\fR pairs may be used to specify additional attributes of the event, such as the x and y mouse position; see \fBEVENT FIELDS\fR below. If the \fB\-when\fR option is not specified, the event is processed immediately: all of the handlers for the event will complete before the \fBevent generate\fR command returns. If the \fB\-when\fR option is specified then it determines when the event is processed. Certain events, such as key events, require that the window has focus to receive the event properly. .\" METHOD: info .TP \fBevent info \fR?\fB<<\fIvirtual\fB>>\fR? . Returns information about virtual events. If the \fB<<\fIvirtual\fB>>\fR argument is omitted, the return value is a list of all the virtual events that are currently defined. If \fB<<\fIvirtual\fB>>\fR is specified then the return value is a list whose elements are the physical event sequences currently defined for the given virtual event; if the virtual event is not defined then an empty string is returned. .RS .PP Note that virtual events that are not bound to physical event sequences are \fInot\fR returned by \fBevent info\fR. .RE .SH "EVENT FIELDS" .PP The following options are supported for the \fBevent generate\fR command. These correspond to the .QW % expansions allowed in binding scripts for the \fBbind\fR command. .\" OPTION: -above .TP \fB\-above\fI window\fR . \fIWindow\fR specifies the \fIabove\fR field for the event, either as a window path name or as an integer window id. Valid for \fBConfigure\fR events. Corresponds to the \fB%a\fR substitution for binding scripts. .\" OPTION: -borderwidth .TP \fB\-borderwidth\fI size\fR . \fISize\fR must be a screen distance; it specifies the \fIborder_width\fR field for the event. Valid for \fBConfigure\fR events. Corresponds to the \fB%B\fR substitution for binding scripts. .\" OPTION: -button .TP \fB\-button\fI number\fR . \fINumber\fR must be an integer; it specifies the \fIdetail\fR field for a \fBButton\fR or \fBButtonRelease\fR event, overriding any button number provided in the base \fIevent\fR argument. Corresponds to the \fB%b\fR substitution for binding scripts. .\" OPTION: -count .TP \fB\-count\fI number\fR . \fINumber\fR must be an integer; it specifies the \fIcount\fR field for the event. Valid for \fBExpose\fR events. Corresponds to the \fB%c\fR substitution for binding scripts. .\" OPTION: -data .TP \fB\-data\fI string\fR . \fIString\fR may be any value; it specifies the \fIuser_data\fR field for the event. Only valid for virtual events. Corresponds to the \fB%d\fR substitution for virtual events in binding scripts. .\" OPTION: -delta .TP \fB\-delta\fI number\fR . \fINumber\fR must be an integer; it specifies the \fIdelta\fR field for the \fBMouseWheel\fR event. The \fIdelta\fR refers to the direction and magnitude the mouse wheel was rotated. Note the value is not a screen distance but are units of motion in the mouse wheel. Typically these values are multiples of 120. For example, 120 should scroll the text widget up 4 lines and \-240 would scroll the text widget down 8 lines. Of course, other widgets may define different behaviors for mouse wheel motion. This field corresponds to the \fB%D\fR substitution for binding scripts. .\" OPTION: -detail .TP \fB\-detail\fI detail\fR . \fIDetail\fR specifies the \fIdetail\fR field for the event and must be one of the following: .RS .DS .ta 6c \fBNotifyAncestor\fR \fBNotifyNonlinearVirtual\fR \fBNotifyDetailNone\fR \fBNotifyPointer\fR \fBNotifyInferior\fR \fBNotifyPointerRoot\fR \fBNotifyNonlinear\fR \fBNotifyVirtual\fR .DE Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR and \fBFocusOut\fR events. Corresponds to the \fB%d\fR substitution for binding scripts. .RE .\" OPTION: -focus .TP \fB\-focus\fI boolean\fR . \fIBoolean\fR must be a boolean value; it specifies the \fIfocus\fR field for the event. Valid for \fBEnter\fR and \fBLeave\fR events. Corresponds to the \fB%f\fR substitution for binding scripts. .\" OPTION: -height .TP \fB\-height\fI size\fR . \fISize\fR must be a screen distance; it specifies the \fIheight\fR field for the event. Valid for \fBConfigure\fR events. Corresponds to the \fB%h\fR substitution for binding scripts. .\" OPTION: -keycode .TP \fB\-keycode\fI number\fR . \fINumber\fR must be an integer; it specifies the \fIkeycode\fR field for the event. Valid for \fBKey\fR and \fBKeyRelease\fR events. Corresponds to the \fB%k\fR substitution for binding scripts. .\" OPTION: -keysym .TP \fB\-keysym\fI name\fR . \fIName\fR must be the name of a valid keysym, such as \fBg\fR, \fBspace\fR, or \fBReturn\fR; its corresponding keycode value is used as the \fIkeycode\fR field for event, overriding any detail specified in the base \fIevent\fR argument. Valid for \fBKey\fR and \fBKeyRelease\fR events. Corresponds to the \fB%K\fR substitution for binding scripts. .\" OPTION: -mode .TP \fB\-mode\fI notify\fR . \fINotify\fR specifies the \fImode\fR field for the event and must be one of \fBNotifyNormal\fR, \fBNotifyGrab\fR, \fBNotifyUngrab\fR, or \fBNotifyWhileGrabbed\fR. Valid for \fBEnter\fR, \fBLeave\fR, \fBFocusIn\fR, and \fBFocusOut\fR events. Corresponds to the \fB%m\fR substitution for binding scripts. .\" OPTION: -override .TP \fB\-override\fI boolean\fR . \fIBoolean\fR must be a boolean value; it specifies the \fIoverride_redirect\fR field for the event. Valid for \fBMap\fR, \fBReparent\fR, and \fBConfigure\fR events. Corresponds to the \fB%o\fR substitution for binding scripts. .\" OPTION: -place .TP \fB\-place\fI where\fR . \fIWhere\fR specifies the \fIplace\fR field for the event; it must be either \fBPlaceOnTop\fR or \fBPlaceOnBottom\fR. Valid for \fBCirculate\fR events. Corresponds to the \fB%p\fR substitution for binding scripts. .\" OPTION: -root .TP \fB\-root\fI window\fR . \fIWindow\fR must be either a window path name or an integer window identifier; it specifies the \fIroot\fR field for the event. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events. Corresponds to the \fB%R\fR substitution for binding scripts. .\" OPTION: -rootx .TP \fB\-rootx\fI coord\fR . \fICoord\fR must be a screen distance; it specifies the \fIx_root\fR field for the event. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events. Corresponds to the \fB%X\fR substitution for binding scripts. .\" OPTION: -rooty .TP \fB\-rooty\fI coord\fR . \fICoord\fR must be a screen distance; it specifies the \fIy_root\fR field for the event. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events. Corresponds to the \fB%Y\fR substitution for binding scripts. .\" OPTION: -sendevent .TP \fB\-sendevent\fI boolean\fR . \fIBoolean\fR must be a boolean value; it specifies the \fIsend_event\fR field for the event. Valid for all events. Corresponds to the \fB%E\fR substitution for binding scripts. .\" OPTION: -serial .TP \fB\-serial\fI number\fR . \fINumber\fR must be an integer; it specifies the \fIserial\fR field for the event. Valid for all events. Corresponds to the \fB%#\fR substitution for binding scripts. .\" OPTION: -state .TP \fB\-state\fI state\fR . \fIState\fR specifies the \fIstate\fR field for the event. For \fBKey\fR, \fBKeyRelease\fR, \fBButtons\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events it must be an integer value. For \fBVisibility\fR events it must be one of \fBVisibilityUnobscured\fR, \fBVisibilityPartiallyObscured\fR, or \fBVisibilityFullyObscured\fR. This option overrides any modifiers such as \fBMeta\fR or \fBControl\fR specified in the base \fIevent\fR. Corresponds to the \fB%s\fR substitution for binding scripts. .\" OPTION: -subwindow .TP \fB\-subwindow\fI window\fR . \fIWindow\fR specifies the \fIsubwindow\fR field for the event, either as a path name for a Tk widget or as an integer window identifier. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, and \fBMotion\fR events. Similar to \fB%S\fR substitution for binding scripts. .\" OPTION: -time .TP \fB\-time\fI integer\fR . \fIInteger\fR must be an integer value; it specifies the \fItime\fR field for the event. Additionally, the special value \fBcurrent\fR is allowed; this value will be substituted by the current event time. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBLeave\fR, \fBMotion\fR, and \fBProperty\fR events. Corresponds to the \fB%t\fR substitution for binding scripts. .\" OPTION: -warp .TP \fB\-warp\fI boolean\fR . \fIboolean\fR must be a boolean value; it specifies whether the screen pointer should be warped as well. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, and \fBMotion\fR events. The pointer will only warp to a window if it is mapped. .\" OPTION: -width .TP \fB\-width\fI size\fR . \fISize\fR must be a screen distance; it specifies the \fIwidth\fR field for the event. Valid for \fBConfigure\fR events. Corresponds to the \fB%w\fR substitution for binding scripts. .\" OPTION: -when .TP \fB\-when\fI when\fR . \fIWhen\fR determines when the event will be processed; it must have one of the following values: .RS .IP \fBnow\fR 10 Process the event immediately, before the command returns. This also happens if the \fB\-when\fR option is omitted. .IP \fBtail\fR 10 Place the event on Tcl's event queue behind any events already queued for this application. .IP \fBhead\fR 10 Place the event at the front of Tcl's event queue, so that it will be handled before any other events already queued. .IP \fBmark\fR 10 Place the event at the front of Tcl's event queue but behind any other events already queued with \fB\-when mark\fR. This option is useful when generating a series of events that should be processed in order but at the front of the queue. .RE .\" OPTION: -x .TP \fB\-x\fI coord\fR . \fICoord\fR must be a screen distance; it specifies the \fIx\fR field for the event. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR, \fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR events. Corresponds to the \fB%x\fR substitution for binding scripts. If \fIWindow\fR is empty the coordinate is relative to the screen, and this option corresponds to the \fB%X\fR substitution for binding scripts. .\" OPTION: -y .TP \fB\-y\fI coord\fR . \fICoord\fR must be a screen distance; it specifies the \fIy\fR field for the event. Valid for \fBKey\fR, \fBKeyRelease\fR, \fBButton\fR, \fBButtonRelease\fR, \fBMotion\fR, \fBEnter\fR, \fBLeave\fR, \fBExpose\fR, \fBConfigure\fR, \fBGravity\fR, and \fBReparent\fR events. Corresponds to the \fB%y\fR substitution for binding scripts. If \fIWindow\fR is empty the coordinate is relative to the screen, and this option corresponds to the \fB%Y\fR substitution for binding scripts. .PP Any options that are not specified when generating an event are filled with the value 0, except for \fIserial\fR, which is filled with the next X event serial number. .SH "PREDEFINED VIRTUAL EVENTS" .PP Tk defines the following virtual events for the purposes of notification: .TP \fB<<AltUnderlined>>\fR . This is sent to widget to notify it that the letter it has underlined (as an accelerator indicator) with the \fB\-underline\fR option has been pressed in combination with the Alt key. The usual response to this is to either focus into the widget (or some related widget) or to invoke the widget. .TP \fB<<Invoke>>\fR . This can be sent to some widgets (e.g. button, listbox, menu) as an alternative to <space>. .TP \fB<<ListboxSelect>>\fR . This is sent to a listbox when the set of selected item(s) in the listbox is updated. .TP \fB<<MenuSelect>>\fR . This is sent to a menu when the currently selected item in the menu changes. It is intended for use with context-sensitive help systems. .TP \fB<<Modified>>\fR . This is sent to a text widget when the contents of the widget are changed. .TP \fB<<Selection>>\fR . 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 \fB<<TraverseOut>>\fR . This is sent to a widget when the focus leaves the widget because of a user-driven .QW "tab to widget" action. .TP \fB<<UndoStack>>\fR . This is sent to a text widget when its undo stack or redo stack becomes empty or unempty. .TP \fB<<WidgetViewSync>>\fR . This is sent to a text widget when its internal data become obsolete, and again when these internal data are back in sync with the widget view. The detail field (%d substitution) is either true (when the widget is in sync) or false (when it is not). .PP Tk defines the following virtual events for the purposes of unifying bindings across multiple platforms. Users expect them to behave in the following way: .TP \fB<<Clear>>\fR . Delete the currently selected widget contents. .TP \fB<<Copy>>\fR . Copy the currently selected widget contents to the clipboard. .TP \fB<<Cut>>\fR . Move the currently selected widget contents to the clipboard. .TP \fB<<LineEnd>>\fR . Move to the end of the line in the current widget while deselecting any selected contents. .TP |
︙ | ︙ | |||
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 | .TP \fB<<NextWord>>\fR . Move to the next group of items (i.e., visible word) in the current widget while deselecting any selected contents. .TP \fB<<Paste>>\fR Replace the currently selected widget contents with the contents of the clipboard. .TP \fB<<PasteSelection>>\fR Insert the contents of the selection at the mouse location. (This event has meaningful \fB%x\fR and \fB%y\fR substitutions). .TP \fB<<PrevChar>>\fR . Move to the previous item (i.e., visible character) in the current widget while deselecting any selected contents. .TP \fB<<PrevLine>>\fR . Move to the previous line in the current widget while deselecting any selected contents. .TP \fB<<PrevPara>>\fR . Move to the previous paragraph in the current widget while deselecting any selected contents. .TP \fB<<PrevWindow>>\fR Traverse to the previous window. .TP \fB<<PrevWord>>\fR . Move to the previous group of items (i.e., visible word) in the current widget while deselecting any selected contents. .TP \fB<<Redo>>\fR Redo one undone action. .TP \fB<<SelectAll>>\fR . Set the range of selected contents to the complete widget. .TP \fB<<SelectLineEnd>>\fR | > > > > | 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 | .TP \fB<<NextWord>>\fR . Move to the next group of items (i.e., visible word) in the current widget while deselecting any selected contents. .TP \fB<<Paste>>\fR . Replace the currently selected widget contents with the contents of the clipboard. .TP \fB<<PasteSelection>>\fR . Insert the contents of the selection at the mouse location. (This event has meaningful \fB%x\fR and \fB%y\fR substitutions). .TP \fB<<PrevChar>>\fR . Move to the previous item (i.e., visible character) in the current widget while deselecting any selected contents. .TP \fB<<PrevLine>>\fR . Move to the previous line in the current widget while deselecting any selected contents. .TP \fB<<PrevPara>>\fR . Move to the previous paragraph in the current widget while deselecting any selected contents. .TP \fB<<PrevWindow>>\fR . Traverse to the previous window. .TP \fB<<PrevWord>>\fR . Move to the previous group of items (i.e., visible word) in the current widget while deselecting any selected contents. .TP \fB<<Redo>>\fR . Redo one undone action. .TP \fB<<SelectAll>>\fR . Set the range of selected contents to the complete widget. .TP \fB<<SelectLineEnd>>\fR |
︙ | ︙ |
Changes to doc/focus.n.
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | implement a focus order among the windows of a top-level; they are used in the default bindings for Tab and Shift-Tab, among other things. .PP The \fBfocus\fR command can take any of the following forms: .TP \fBfocus\fR Returns the path name of the focus window on the display containing the application's main window, or an empty string if no window in this application has the focus on that display. Note: it is better to specify the display explicitly using \fB\-displayof\fR (see below) so that the code will work in applications using multiple displays. .TP \fBfocus \fIwindow\fR If the application currently has the input focus on \fIwindow\fR's display, this command resets the input focus for \fIwindow\fR's display to \fIwindow\fR and returns an empty string. If the application does not currently have the input focus on \fIwindow\fR's display, \fIwindow\fR will be remembered as the focus for its top-level; the next time the focus arrives at the top-level, Tk will redirect it to \fIwindow\fR. If \fIwindow\fR is an empty string then the command does nothing. .TP | > > | > > | > | 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 | implement a focus order among the windows of a top-level; they are used in the default bindings for Tab and Shift-Tab, among other things. .PP The \fBfocus\fR command can take any of the following forms: .TP \fBfocus\fR . Returns the path name of the focus window on the display containing the application's main window, or an empty string if no window in this application has the focus on that display. Note: it is better to specify the display explicitly using \fB\-displayof\fR (see below) so that the code will work in applications using multiple displays. .TP \fBfocus \fIwindow\fR . If the application currently has the input focus on \fIwindow\fR's display, this command resets the input focus for \fIwindow\fR's display to \fIwindow\fR and returns an empty string. If the application does not currently have the input focus on \fIwindow\fR's display, \fIwindow\fR will be remembered as the focus for its top-level; the next time the focus arrives at the top-level, Tk will redirect it to \fIwindow\fR. If \fIwindow\fR is an empty string then the command does nothing. .TP \fBfocus \-displayof \fIwindow\fR . Returns the name of the focus window on the display containing \fIwindow\fR. If the focus window for \fIwindow\fR's display is not in this application, the return value is an empty string. .TP \fBfocus \-force \fIwindow\fR . Sets the focus of \fIwindow\fR's display to \fIwindow\fR, even if the application does not currently have the input focus for the display. This command should be used sparingly, if at all. In normal usage, an application should not claim the focus for itself; instead, it should wait for the window manager to give it the focus. If \fIwindow\fR is an empty string then the command does nothing. .TP \fBfocus \-lastfor \fIwindow\fR . Returns the name of the most recent window to have the input focus among all the windows in the same top-level as \fIwindow\fR. If no window in that top-level has ever had the input focus, or if the most recent focus window has been deleted, then the name of the top-level is returned. The return value is the window that will receive the input focus the next time the window manager gives the focus to the top-level. |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 | the fact that the X focus is on the top-level is invisible unless you use C code to query the X server directly. .SH "EXAMPLE" .PP To make a window that only participates in the focus traversal ring when a variable is set, add the following bindings to the widgets \fIbefore\fR and \fIafter\fR it in that focus ring: .CS | > | | | | | | | 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 | the fact that the X focus is on the top-level is invisible unless you use C code to query the X server directly. .SH "EXAMPLE" .PP To make a window that only participates in the focus traversal ring when a variable is set, add the following bindings to the widgets \fIbefore\fR and \fIafter\fR it in that focus ring: .PP .CS button .before -text "Before" button .middle -text "Middle" button .after -text "After" checkbutton .flag -variable traverseToMiddle -takefocus 0 pack .flag -side left pack .before .middle .after bind .before <Tab> { if {!$traverseToMiddle} { \fBfocus\fR .after break } } bind .after <Shift-Tab> { if {!$traverseToMiddle} { \fBfocus\fR .before break } } \fBfocus\fR .before .CE .SH KEYWORDS events, focus, keyboard, top-level, window manager '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/focusNext.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 | .TH tk_focusNext n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_focusNext, tk_focusPrev, tk_focusFollowsMouse \- Utility procedures for managing the input focus. .SH SYNOPSIS \fBtk_focusNext \fIwindow\fR | > < < > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .TH tk_focusNext n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_focusNext, tk_focusPrev, tk_focusFollowsMouse \- Utility procedures for managing the input focus. .SH SYNOPSIS .nf \fBtk_focusNext \fIwindow\fR \fBtk_focusPrev \fIwindow\fR \fBtk_focusFollowsMouse\fR .fi .BE .SH DESCRIPTION .PP \fBtk_focusNext\fR is a utility procedure used for keyboard traversal. It returns the .QW next window after \fIwindow\fR in focus order. The focus order is determined by |
︙ | ︙ | |||
45 46 47 48 49 50 51 | \fBtk_focusFollowsMouse\fR changes the focus model for the application to an implicit one where the window under the mouse gets the focus. After this procedure is called, whenever the mouse enters a window Tk will automatically give it the input focus. The \fBfocus\fR command may be used to move the focus to a window other than the one under the mouse, but as soon as the mouse moves into a new window the focus will jump to that window. | > | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | \fBtk_focusFollowsMouse\fR changes the focus model for the application to an implicit one where the window under the mouse gets the focus. After this procedure is called, whenever the mouse enters a window Tk will automatically give it the input focus. The \fBfocus\fR command may be used to move the focus to a window other than the one under the mouse, but as soon as the mouse moves into a new window the focus will jump to that window. .PP Note that at present there is no built-in support for returning the application to an explicit focus model; to do this you will have to write a script that deletes the bindings created by \fBtk_focusFollowsMouse\fR. .SH KEYWORDS focus, keyboard traversal, top-level '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/font.n.
︙ | ︙ | |||
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 | .BE .SH DESCRIPTION .PP The \fBfont\fR command provides several facilities for dealing with fonts, such as defining named fonts and inspecting the actual attributes of a font. The command has several different forms, determined by the first argument. The following forms are currently supported: .TP \fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? ?\fB\-\|\-\fR? ?\fIchar\fR? . Returns information about the actual attributes that are obtained when \fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained may differ from the attributes requested due to platform-dependent limitations, such as the availability of font families and point sizes. \fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is omitted, it defaults to the main window. If \fIoption\fR is specified, returns the value of that attribute; if it is omitted, the return value is a list of all the attributes and their values. See \fBFONT OPTIONS\fR below for a list of the possible attributes. If the \fIchar\fR argument is supplied, it must be a single character. The font attributes returned will be those of the specific font used to render that character, which will be different from the base font if the base font does not contain the given character. If \fIchar\fR may be a hyphen, it should be preceded by \fB\-\|\-\fR to distinguish it from a misspelled \fIoption\fR. .TP \fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the desired attributes for the named font called \fIfontname\fR. If no \fIoption\fR is specified, returns a list describing all the options and their values for \fIfontname\fR. If a single \fIoption\fR is specified with no \fIvalue\fR, then returns the current value of that attribute. If one or more \fIoption\fR\-\fIvalue\fR pairs are specified, then the command modifies the given named font to have the given values; in this case, all widgets using that font will redisplay themselves using the new attributes for the font. See \fBFONT OPTIONS\fR below for a list of the possible attributes. .RS .PP Note that on Aqua/Mac OS X, the system fonts (see \fBPLATFORM SPECIFIC FONTS\fR below) may not be actually altered because they are implemented by the system theme. To achieve the effect of modification, use \fBfont actual\fR to get their configuration and \fBfont create\fR to synthesize a copy of the font which can be modified. .RE .TP \fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR? . Creates a new named font and returns its name. \fIfontname\fR specifies the name for the font; if it is omitted, then Tk generates a new name of the form \fBfont\fIx\fR, where \fIx\fR is an integer. There may be any number of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for the new named font. See \fBFONT OPTIONS\fR below for a list of the possible attributes. .TP | > > > > | > > > > > | 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 | .BE .SH DESCRIPTION .PP The \fBfont\fR command provides several facilities for dealing with fonts, such as defining named fonts and inspecting the actual attributes of a font. The command has several different forms, determined by the first argument. The following forms are currently supported: .\" METHOD: actual .TP \fBfont actual \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? ?\fB\-\|\-\fR? ?\fIchar\fR? . Returns information about the actual attributes that are obtained when \fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained may differ from the attributes requested due to platform-dependent limitations, such as the availability of font families and point sizes. \fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is omitted, it defaults to the main window. If \fIoption\fR is specified, returns the value of that attribute; if it is omitted, the return value is a list of all the attributes and their values. See \fBFONT OPTIONS\fR below for a list of the possible attributes. If the \fIchar\fR argument is supplied, it must be a single character. The font attributes returned will be those of the specific font used to render that character, which will be different from the base font if the base font does not contain the given character. If \fIchar\fR may be a hyphen, it should be preceded by \fB\-\|\-\fR to distinguish it from a misspelled \fIoption\fR. .\" METHOD: configure .TP \fBfont configure \fIfontname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the desired attributes for the named font called \fIfontname\fR. If no \fIoption\fR is specified, returns a list describing all the options and their values for \fIfontname\fR. If a single \fIoption\fR is specified with no \fIvalue\fR, then returns the current value of that attribute. If one or more \fIoption\fR\-\fIvalue\fR pairs are specified, then the command modifies the given named font to have the given values; in this case, all widgets using that font will redisplay themselves using the new attributes for the font. See \fBFONT OPTIONS\fR below for a list of the possible attributes. .RS .PP Note that on Aqua/Mac OS X, the system fonts (see \fBPLATFORM SPECIFIC FONTS\fR below) may not be actually altered because they are implemented by the system theme. To achieve the effect of modification, use \fBfont actual\fR to get their configuration and \fBfont create\fR to synthesize a copy of the font which can be modified. .RE .\" METHOD: create .TP \fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR? . Creates a new named font and returns its name. \fIfontname\fR specifies the name for the font; if it is omitted, then Tk generates a new name of the form \fBfont\fIx\fR, where \fIx\fR is an integer. There may be any number of \fIoption\fR\-\fIvalue\fR pairs, which provide the desired attributes for the new named font. See \fBFONT OPTIONS\fR below for a list of the possible attributes. .\" METHOD: delete .TP \fBfont delete\fI fontname\fR ?\fIfontname ...\fR? . Delete the specified named fonts. If there are widgets using the named font, the named font will not actually be deleted until all the instances are released. Those widgets will continue to display using the last known values for the named font. If a deleted named font is subsequently recreated with another call to \fBfont create\fR, the widgets will use the new named font and redisplay themselves using the new attributes of that font. .\" METHOD: families .TP \fBfont families\fR ?\fB\-displayof \fIwindow\fR? . The return value is a list of the case-insensitive names of all font families that exist on \fIwindow\fR's display. If the \fIwindow\fR argument is omitted, it defaults to the main window. .\" METHOD: measure .TP \fBfont measure \fIfont\fR ?\fB\-displayof \fIwindow\fR? \fItext\fR . Measures the amount of space the string \fItext\fR would use in the given \fIfont\fR when displayed in \fIwindow\fR. \fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is omitted, it defaults to the main window. The return value is the total width in pixels of \fItext\fR, not including the extra pixels used by highly exaggerated characters such as cursive .QW f . If the string contains newlines or tabs, those characters are not expanded or treated specially when measuring the string. .\" METHOD: metrics .TP \fBfont metrics \fIfont\fR ?\fB\-displayof \fIwindow\fR? ?\fIoption\fR? . Returns information about the metrics (the font-specific data), for \fIfont\fR when it is used on \fIwindow\fR's display. \fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the \fIwindow\fR argument is omitted, it defaults to the main window. If \fIoption\fR is specified, returns the value of that metric; if it is omitted, the return value is a list of all the metrics and their values. See \fBFONT METRICS\fR below for a list of the possible metrics. .\" METHOD: names .TP \fBfont names\fR . The return value is a list of all the named fonts that are currently defined. .SH "FONT DESCRIPTIONS" .PP The following formats are accepted as a font description anywhere \fIfont\fR is specified as an argument above; these same forms are also permitted when specifying the \fB\-font\fR option for widgets. .TP |
︙ | ︙ | |||
196 197 198 199 200 201 202 203 | font. In the following definitions, the .QW baseline of a font is the horizontal line where the bottom of most letters line up; certain letters, such as lower-case .QW g stick below the baseline. .TP | > | > | > > | > > > > > > > > > < | < < | < < | < < | < < | < < | < < | < < | < < | < > > > | 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 | font. In the following definitions, the .QW baseline of a font is the horizontal line where the bottom of most letters line up; certain letters, such as lower-case .QW g stick below the baseline. .\" OPTION: -ascent .TP \fB\-ascent\fR . The amount in pixels that the tallest letter sticks up above the baseline of the font, plus any extra blank space added by the designer of the font. .\" OPTION: -descent .TP \fB\-descent\fR . The largest amount in pixels that any letter sticks down below the baseline of the font, plus any extra blank space added by the designer of the font. .\" OPTION: -linespace .TP \fB\-linespace\fR . Returns how far apart vertically in pixels two lines of text using the same font should be placed so that none of the characters in one line overlap any of the characters in the other line. This is generally the sum of the ascent above the baseline line plus the descent below the baseline. .\" OPTION: -fixed .TP \fB\-fixed\fR . Returns a boolean flag that is .QW \fB1\fR if this is a fixed-width font, where each normal character is the same width as all the other characters, or is .QW \fB0\fR if this is a proportionally-spaced font, where individual characters have different widths. The widths of control characters, tab characters, and other non-printing characters are not included when calculating this value. .SH "FONT OPTIONS" .PP The following options are supported on all platforms, and are used when constructing a named font or when specifying a font using style [5] as above: .\" OPTION: -family .TP \fB\-family \fIname\fR . The case-insensitive font family name. Tk guarantees to support the font families named \fBCourier\fR (a monospaced .QW typewriter font), \fBTimes\fR (a serifed .QW newspaper font), and \fBHelvetica\fR (a sans-serif .QW European font). The most closely matching native font family will automatically be substituted when one of the above font families is used. The \fIname\fR may also be the name of a native, platform-specific font family; in that case it will work as desired on one platform but may not display correctly on other platforms. If the family is unspecified or unrecognized, a platform-specific default font will be chosen. .\" OPTION: -size .TP \fB\-size \fIsize\fR . The desired size of the font. If the \fIsize\fR argument is a positive number, it is interpreted as a size in points. If \fIsize\fR is a negative number, its absolute value is interpreted as a size in pixels. If a font cannot be displayed at the specified size, a nearby size will be chosen. If \fIsize\fR is unspecified or zero, a platform-dependent default size will be chosen. .RS .PP Sizes should normally be specified in points so the application will remain the same ruler size on the screen, even when changing screen resolutions or moving scripts across platforms. However, specifying pixels is useful in certain circumstances such as when a piece of text must line up with respect to a fixed-size bitmap. The mapping between points and pixels is set when the application starts, based on properties of the installed monitor, but it can be overridden by calling the \fBtk scaling\fR command. .RE .\" OPTION: -weight .TP \fB\-weight \fIweight\fR . The nominal thickness of the characters in the font. The value \fBnormal\fR specifies a normal weight font, while \fBbold\fR specifies a bold font. The closest available weight to the one specified will be chosen. The default weight is \fBnormal\fR. .\" OPTION: -slant .TP \fB\-slant \fIslant\fR . The amount the characters in the font are slanted away from the vertical. Valid values for slant are \fBroman\fR and \fBitalic\fR. A roman font is the normal, upright appearance of a font, while an italic font is one that is tilted some number of degrees from upright. The closest available slant to the one specified will be chosen. The default slant is \fBroman\fR. .\" OPTION: -underline .TP \fB\-underline \fIboolean\fR . The value is a boolean flag that specifies whether characters in this font should be underlined. The default value for underline is \fBfalse\fR. .\" OPTION: -overstrike .TP \fB\-overstrike \fIboolean\fR . The value is a boolean flag that specifies whether a horizontal line should be drawn through the middle of characters in this font. The default value for overstrike is \fBfalse\fR. .SH "STANDARD FONTS" .PP The following named fonts are supported on all systems, and default to values that match appropriate system defaults. .IP \fBTkDefaultFont\fR This font is the default for all GUI items not otherwise specified. .IP \fBTkTextFont\fR This font should be used for user text in entry widgets, listboxes etc. .IP \fBTkFixedFont\fR This font is the standard fixed-width font. .IP \fBTkMenuFont\fR This font is used for menu items. .IP \fBTkHeadingFont\fR This font should be used for column headings in lists and tables. .IP \fBTkCaptionFont\fR This font should be used for window and dialog caption bars. .IP \fBTkSmallCaptionFont\fR This font should be used for captions on contained windows or tool dialogs. .IP \fBTkIconFont\fR This font should be used for icon captions. .IP \fBTkTooltipFont\fR This font should be used for tooltip windows (transient information windows). .LP It is \fInot\fR advised to change these fonts, as they may be modified by Tk itself in response to system changes. Instead, make a copy of the font and modify that. .SH "PLATFORM SPECIFIC FONTS" .PP The following system fonts are supported: .TP \fBX Windows\fR . All valid X font names, including those listed by xlsfonts(1), are available. .TP \fBMS Windows\fR . The following fonts are supported, and are mapped to the user's style defaults. .RS .DS .ta 3c 6c \fBsystem\fR \fBansi\fR \fBdevice\fR \fBsystemfixed\fR \fBansifixed\fR \fBoemfixed\fR .DE .RE .TP \fBMac OS X\fR . The following fonts are supported, and are mapped to the user's style defaults. .RS .DS .ta 3c 6c \fBsystem\fR \fBapplication\fR \fBmenu\fR .DE |
︙ | ︙ | |||
382 383 384 385 386 387 388 | .DE .RE .SH EXAMPLE .PP Fill a text widget with lots of font demonstrators, one for every font family installed on your system: .CS | | | | | | | | | | 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 | .DE .RE .SH EXAMPLE .PP Fill a text widget with lots of font demonstrators, one for every font family installed on your system: .CS pack [text .t -wrap none] -fill both -expand 1 set count 0 set tabwidth 0 foreach family [lsort -dictionary [\fBfont families\fR]] { .t tag configure f[incr count] -font [list $family 10] .t insert end ${family}:\et {} \e "This is a simple sampler\en" f$count set w [\fBfont measure\fR [.t cget -font] ${family}:] if {$w + 5 > $tabwidth} { set tabwidth [expr {$w + 5}] .t configure -tabs $tabwidth } } .CE .SH "SEE ALSO" options(n) .SH KEYWORDS font '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/fontchooser.n.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 2008 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. '\" .TH fontchooser n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fontchooser \- control font selection dialog .SH SYNOPSIS \fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value ...\fR? | > < < > > > > > > > > > > > > > > > > | 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 (c) 2008 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. '\" .TH fontchooser n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fontchooser \- control font selection dialog .SH SYNOPSIS .nf \fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value ...\fR? \fBtk fontchooser\fR \fBshow\fR \fBtk fontchooser\fR \fBhide\fR .fi .BE .SH DESCRIPTION .PP The \fBtk fontchooser\fR command controls the Tk font selection dialog. It uses the native platform font selection dialog where available, or a dialog implemented in Tcl otherwise. .PP Unlike most of the other Tk dialog commands, \fBtk fontchooser\fR does not return an immediate result, as on some platforms (Mac OS X) the standard font dialog is modeless while on others (Windows) it is modal. To accommodate this difference, all user interaction with the dialog will be communicated to the caller via callbacks or virtual events. .PP The \fBtk fontchooser\fR command can have one of the following forms: .\" METHOD: configure .TP \fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value ...\fR? . Set or query one or more of the configurations options below (analogous to Tk widget configuration). .\" METHOD: show .TP \fBtk fontchooser\fR \fBshow\fR . Show the font selection dialog. Depending on the platform, may return immediately or only once the dialog has been withdrawn. .\" METHOD: hide .TP \fBtk fontchooser\fR \fBhide\fR . Hide the font selection dialog if it is visible and cause any pending \fBtk fontchooser\fR \fBshow\fR command to return. .PP .SH "CONFIGURATION OPTIONS" .\" OPTION: -parent .TP \fB\-parent\fR . Specifies/returns the logical parent window of the font selection dialog (similar to the \fB\-parent\fR option to other dialogs). The font selection dialog is hidden if it is visible when the parent window is destroyed. .\" OPTION: -title .TP \fB\-title\fR . Specifies/returns the title of the dialog. Has no effect on platforms where the font selection dialog does not support titles. .\" OPTION: -font .TP \fB\-font\fR . Specifies/returns the font that is currently selected in the dialog if it is visible, or that will be initially selected when the dialog is shown (if supported by the platform). Can be set to the empty string to indicate that no font should be selected. Fonts can be specified in any form given by the "FONT DESCRIPTION" section in the \fBfont\fR manual page. .\" OPTION: -command .TP \fB\-command\fR . Specifies/returns the command prefix to be called when a font selection has been made by the user. The command prefix is evaluated at the global level after having the specification of the selected font appended. On platforms where the font selection dialog offers the user control of further font attributes (such as color), additional key/value pairs may be appended before evaluation. Can be set to the empty string to indicate that no callback should be invoked. Fonts are specified by a list of form [3] of the "FONT DESCRIPTION" section in the \fBfont\fR manual page (i.e. a list of the form \fI{family size style ?style ...?}\fR). .\" OPTION: -visible .TP \fB\-visible\fR . Read-only option that returns a boolean indicating whether the font selection dialog is currently visible. Attempting to set this option results in an error. .PP .SH "VIRTUAL EVENTS" .TP \fB<<TkFontchooserVisibility>>\fR . Sent to the dialog parent whenever the visibility of the font selection dialog changes, both as a result of user action (e.g. disposing of the dialog via OK/Cancel button or close box) and of the \fBtk fontchooser\fR \fBshow\fR/\fBhide\fR commands being called. Binding scripts can determine the current visibility of the dialog by querying the \fB\-visible\fR configuration option. .TP \fB<<TkFontchooserFontChanged>>\fR . Sent to the dialog parent whenever the font selection dialog is visible and the selected font changes, both as a result of user action and of the \fB\-font\fR configuration option being set. Binding scripts can determine the currently selected font by querying the \fB\-font\fR configuration option. .PP .SH NOTES .PP |
︙ | ︙ | |||
135 136 137 138 139 140 141 | to ensure its selected font matches the new value of the named font. .PP .SH EXAMPLE .PP .CS proc fontchooserDemo {} { wm title . "Font Chooser Demo" | | | | | | | | | | | | | | 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 | to ensure its selected font matches the new value of the named font. .PP .SH EXAMPLE .PP .CS proc fontchooserDemo {} { wm title . "Font Chooser Demo" \fBtk fontchooser\fR \fBconfigure\fR -parent . button .b -command fontchooserToggle -takefocus 0 fontchooserVisibility .b bind . \fB<<TkFontchooserVisibility>>\fR \e [list fontchooserVisibility .b] foreach w {.t1 .t2} { text $w -width 20 -height 4 -borderwidth 1 -relief solid bind $w <FocusIn> [list fontchooserFocus $w] $w insert end "Text Widget $w" } .t1 configure -font {Courier 14} .t2 configure -font {Times 16} pack .b .t1 .t2; focus .t1 } proc fontchooserToggle {} { \fBtk fontchooser\fR [expr { [\fBtk fontchooser\fR \fBconfigure\fR -visible] ? "\fBhide\fR" : "\fBshow\fR"}] } proc fontchooserVisibility {w} { $w configure -text [expr { [\fBtk fontchooser\fR \fBconfigure\fR -visible] ? "Hide Font Dialog" : "Show Font Dialog"}] } proc fontchooserFocus {w} { \fBtk fontchooser\fR \fBconfigure\fR -font [$w cget -font] \e -command [list fontchooserFontSelection $w] } proc fontchooserFontSelection {w font args} { $w configure -font [font actual $font] } fontchooserDemo .CE .SH "SEE ALSO" font(n), tk(n) .SH KEYWORDS dialog, font, font selection, font chooser, font panel '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/frame.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH frame n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME frame \- Create and manipulate 'frame' simple container widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH frame n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME frame \- Create and manipulate 'frame' simple container widgets .SH SYNOPSIS \fBframe\fI pathName\fR ?\fIoptions\fR? .SO \-borderwidth \-highlightcolor \-pady \-cursor \-highlightthickness \-relief \-highlightbackground \-padx \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background background Background |
︙ | ︙ | |||
123 124 125 126 127 128 129 130 | \fIpathName option \fR?\fIarg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the frame widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for frame widgets: .TP | > | > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | \fIpathName option \fR?\fIarg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the frame widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for frame widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBframe\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified |
︙ | ︙ |
Changes to doc/getOpenFile.n.
︙ | ︙ | |||
30 31 32 33 34 35 36 37 | The \fBtk_getSaveFile\fR command is usually associated with the \fBSave as\fR command in the \fBFile\fR menu. If the user enters a file that already exists, the dialog box prompts the user for confirmation whether the existing file should be overwritten or not. .PP The following \fIoption\-value\fR pairs are possible as command line arguments to these two commands: .TP | > | > > | > > | > | > | > | > | > | > | > | > | | 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 | The \fBtk_getSaveFile\fR command is usually associated with the \fBSave as\fR command in the \fBFile\fR menu. If the user enters a file that already exists, the dialog box prompts the user for confirmation whether the existing file should be overwritten or not. .PP The following \fIoption\-value\fR pairs are possible as command line arguments to these two commands: .\" OPTION: -command .TP \fB\-command\fI string\fR . Specifies the prefix of a Tcl command to invoke when the user closes the dialog after having selected an item. This callback is not called if the user cancelled the dialog. The actual command consists of \fIstring\fR followed by a space and the value selected by the user in the dialog. This is only available on Mac OS X. .\" OPTION: -confirmoverwrite .TP \fB\-confirmoverwrite\fI boolean\fR . Configures how the Save dialog reacts when the selected file already exists, and saving would overwrite it. A true value requests a confirmation dialog be presented to the user. A false value requests that the overwrite take place without confirmation. Default value is true. .\" OPTION: -defaultextension .TP \fB\-defaultextension\fI extension\fR . Specifies a string that will be appended to the filename if the user enters a filename without an extension. The default value is the empty string, which means no extension will be appended to the filename in any case. This option is ignored on Mac OS X, which does not require extensions to filenames, and the UNIX implementation guesses reasonable values for this from the \fB\-filetypes\fR option when this is not supplied. .\" OPTION: -filetypes .TP \fB\-filetypes\fI filePatternList\fR . If a \fBFile types\fR listbox exists in the file dialog on the particular platform, this option gives the \fIfiletype\fRs in this listbox. When the user choose a filetype in the listbox, only the files of that type are listed. If this option is unspecified, or if it is set to the empty list, or if the \fBFile types\fR listbox is not supported by the particular platform then all files are listed regardless of their types. See the section \fBSPECIFYING FILE PATTERNS\fR below for a discussion on the contents of \fIfilePatternList\fR. .\" OPTION: -initialdir .TP \fB\-initialdir\fI directory\fR . Specifies that the files in \fIdirectory\fR should be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path. .\" OPTION: -initialfile .TP \fB\-initialfile\fI filename\fR . Specifies a filename to be displayed in the dialog when it pops up. .\" OPTION: -message .TP \fB\-message\fI string\fR . Specifies a message to include in the client area of the dialog. This is only available on Mac OS X. .\" OPTION: -multiple .TP \fB\-multiple\fI boolean\fR . Allows the user to choose multiple files from the Open dialog. .\" OPTION: -parent .TP \fB\-parent\fI window\fR . Makes \fIwindow\fR the logical parent of the file dialog. The file dialog is displayed on top of its parent window. On Mac OS X, this turns the file dialog into a sheet attached to the parent window. .\" OPTION: -title .TP \fB\-title\fI titleString\fR . Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title is displayed. .\" OPTION: -typevariable .TP \fB\-typevariable\fI variableName\fR . The global variable \fIvariableName\fR is used to preselect which filter is used from \fIfilterList\fR when the dialog box is opened and is updated when the dialog box is closed, to the last selected filter. The variable is read once at the beginning to select the appropriate filter. If the variable does not exist, or its value does not match any filter typename, or is empty (\fB{}\fR), the dialog box |
︙ | ︙ | |||
188 189 190 191 192 193 194 | {{Text Files} {.txt} } {{TCL Scripts} {.tcl} } {{C Source Files} {.c} TEXT} {{GIF Files} {.gif} } {{GIF Files} {} GIFF} {{All Files} * } } | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | {{Text Files} {.txt} } {{TCL Scripts} {.tcl} } {{C Source Files} {.c} TEXT} {{GIF Files} {.gif} } {{GIF Files} {} GIFF} {{All Files} * } } set filename [\fBtk_getOpenFile\fR -filetypes $types] if {$filename ne ""} { # Open the file ... } .CE .SH "SEE ALSO" tk_chooseDirectory .SH KEYWORDS file selection dialog '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/grab.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 | .TH grab n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME grab \- Confine pointer and keyboard events to a window sub-tree .SH SYNOPSIS \fBgrab \fR?\fB\-global\fR? \fIwindow\fR | > < > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .TH grab n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME grab \- Confine pointer and keyboard events to a window sub-tree .SH SYNOPSIS .nf \fBgrab \fR?\fB\-global\fR? \fIwindow\fR \fBgrab \fIoption \fR?\fIarg \fR...? .fi .BE .SH DESCRIPTION .PP This command implements simple pointer and keyboard grabs for Tk. Tk's grabs are different than the grabs described in the Xlib documentation. When a grab is set for a particular window, Tk restricts all pointer |
︙ | ︙ | |||
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 | It is possible for different applications on a single display to have simultaneous local grabs, but only one application can have a global grab on a given display at once. .PP The \fBgrab\fR command can take any of the following forms: .TP \fBgrab \fR?\fB\-global\fR? \fIwindow\fR Same as \fBgrab set\fR, described below. .TP \fBgrab current \fR?\fIwindow\fR? If \fIwindow\fR is specified, returns the name of the current grab window in this application for \fIwindow\fR's display, or an empty string if there is no such window. If \fIwindow\fR is omitted, the command returns a list whose elements are all of the windows grabbed by this application for all displays, or an empty string if the application has no grabs. .TP \fBgrab release \fIwindow\fR Releases the grab on \fIwindow\fR if there is one, otherwise does nothing. Returns an empty string. .TP \fBgrab set \fR?\fB\-global\fR? \fIwindow\fR Sets a grab on \fIwindow\fR. If \fB\-global\fR is specified then the grab is global, otherwise it is local. If a grab was already in effect for this application on \fIwindow\fR's display then it is automatically released. If there is already a grab on \fIwindow\fR and it has the same global/local form as the requested grab, then the command does nothing. Returns an empty string. .TP \fBgrab status \fIwindow\fR Returns \fBnone\fR if no grab is currently set on \fIwindow\fR, \fBlocal\fR if a local grab is set on \fIwindow\fR, and \fBglobal\fR if a global grab is set. .SH WARNING .PP It is very easy to use global grabs to render a display completely unusable (e.g. by setting a grab on a widget which does not respond to | > > > > > > > > > | 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 | It is possible for different applications on a single display to have simultaneous local grabs, but only one application can have a global grab on a given display at once. .PP The \fBgrab\fR command can take any of the following forms: .TP \fBgrab \fR?\fB\-global\fR? \fIwindow\fR . Same as \fBgrab set\fR, described below. .\" METHOD: current .TP \fBgrab current \fR?\fIwindow\fR? . If \fIwindow\fR is specified, returns the name of the current grab window in this application for \fIwindow\fR's display, or an empty string if there is no such window. If \fIwindow\fR is omitted, the command returns a list whose elements are all of the windows grabbed by this application for all displays, or an empty string if the application has no grabs. .\" METHOD: release .TP \fBgrab release \fIwindow\fR . Releases the grab on \fIwindow\fR if there is one, otherwise does nothing. Returns an empty string. .\" METHOD: set .TP \fBgrab set \fR?\fB\-global\fR? \fIwindow\fR . Sets a grab on \fIwindow\fR. If \fB\-global\fR is specified then the grab is global, otherwise it is local. If a grab was already in effect for this application on \fIwindow\fR's display then it is automatically released. If there is already a grab on \fIwindow\fR and it has the same global/local form as the requested grab, then the command does nothing. Returns an empty string. .\" METHOD: status .TP \fBgrab status \fIwindow\fR . Returns \fBnone\fR if no grab is currently set on \fIwindow\fR, \fBlocal\fR if a local grab is set on \fIwindow\fR, and \fBglobal\fR if a global grab is set. .SH WARNING .PP It is very easy to use global grabs to render a display completely unusable (e.g. by setting a grab on a widget which does not respond to |
︙ | ︙ | |||
132 133 134 135 136 137 138 | processes, this restriction does not exist. .SH EXAMPLE .PP Set a grab so that only one button may be clicked out of a group. The other buttons are unresponsive to the mouse until the middle button is clicked. .CS | | | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | processes, this restriction does not exist. .SH EXAMPLE .PP Set a grab so that only one button may be clicked out of a group. The other buttons are unresponsive to the mouse until the middle button is clicked. .CS pack [button .b1 -text "Click me! #1" -command {destroy .b1}] pack [button .b2 -text "Click me! #2" -command {destroy .b2}] pack [button .b3 -text "Click me! #3" -command {destroy .b3}] \fBgrab\fR .b2 .CE .SH "SEE ALSO" busy(n) .SH KEYWORDS grab, keyboard events, pointer events, window '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/grid.n.
︙ | ︙ | |||
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 | \fBgrid \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? . If the first argument to \fBgrid\fR is suitable as the first window argument to \fBgrid configure\fR, either a window name (any value starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR (see the \fBRELATIVE PLACEMENT\fR section below), then the command is processed in the same way as \fBgrid configure\fR. .TP \fBgrid anchor \fIwindow\fR ?\fIanchor\fR? . The anchor value controls how to place the grid within the container window when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below for further details. The default \fIanchor\fR is \fInw\fR. .TP \fBgrid bbox \fIwindow\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR? . With no arguments, the bounding box (in pixels) of the grid is returned. The return value consists of 4 integers. The first two are the pixel offset from the container window (x then y) of the top-left corner of the grid, and the second two integers are the width and height of the grid, also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on the command line, then the bounding box for that cell is returned, where the top left cell is numbered from zero. If both \fIcolumn\fR and \fIrow\fR arguments are specified, then the bounding box spanning the rows and columns indicated is returned. .TP \fBgrid columnconfigure \fIwindow index \fR?\fI\-option value...\fR? . Query or set the column properties of the \fIindex\fR column of the geometry container, \fIwindow\fR. The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR and \fB\-pad\fR. | > > > | 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 | \fBgrid \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? . If the first argument to \fBgrid\fR is suitable as the first window argument to \fBgrid configure\fR, either a window name (any value starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR (see the \fBRELATIVE PLACEMENT\fR section below), then the command is processed in the same way as \fBgrid configure\fR. .\" METHOD: anchor .TP \fBgrid anchor \fIwindow\fR ?\fIanchor\fR? . The anchor value controls how to place the grid within the container window when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below for further details. The default \fIanchor\fR is \fInw\fR. .\" METHOD: bbox .TP \fBgrid bbox \fIwindow\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR? . With no arguments, the bounding box (in pixels) of the grid is returned. The return value consists of 4 integers. The first two are the pixel offset from the container window (x then y) of the top-left corner of the grid, and the second two integers are the width and height of the grid, also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on the command line, then the bounding box for that cell is returned, where the top left cell is numbered from zero. If both \fIcolumn\fR and \fIrow\fR arguments are specified, then the bounding box spanning the rows and columns indicated is returned. .\" METHOD: columnconfigure .TP \fBgrid columnconfigure \fIwindow index \fR?\fI\-option value...\fR? . Query or set the column properties of the \fIindex\fR column of the geometry container, \fIwindow\fR. The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR and \fB\-pad\fR. |
︙ | ︙ | |||
78 79 80 81 82 83 84 | The \fB\-pad\fR option specifies the number of screen units that will be added to the largest window contained completely in that column when the grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of | | > > > > > > > > > > > | 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 | The \fB\-pad\fR option specifies the number of screen units that will be added to the largest window contained completely in that column when the grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of .QW "\fI\-option value\fR" pairs. .\" METHOD: configure .TP \fBgrid configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? . The arguments consist of the names of one or more content windows followed by pairs of arguments that specify how to manage the content. The characters \fB\-\fR, \fBx\fR and \fB^\fR, can be specified instead of a window name to alter the default location of a \fIwindow\fR, as described in the \fBRELATIVE PLACEMENT\fR section, below. The following options are supported: .RS .\" OPTION: -column .TP \fB\-column \fIn\fR . Insert the window so that it occupies the \fIn\fRth column in the grid. Column numbers start with 0. If this option is not supplied, then the window is arranged just to the right of previous window specified on this call to \fBgrid\fR, or column .QW 0 if it is the first window. For each \fBx\fR that immediately precedes the \fIwindow\fR, the column position is incremented by one. Thus the \fBx\fR represents a blank column for this row in the grid. .\" OPTION: -columnspan .TP \fB\-columnspan \fIn\fR . Insert the window so that it occupies \fIn\fR columns in the grid. The default is one column, unless the window name is followed by a \fB\-\fR, in which case the columnspan is incremented once for each immediately following \fB\-\fR. .\" OPTION: -in .TP \fB\-in \fIcontainer\fR . Insert the window(s) in the container window given by \fIcontainer\fR. The default is the first window's parent window. .\" OPTION: -ipadx .TP \fB\-ipadx \fIamount\fR . The \fIamount\fR specifies how much horizontal internal padding to leave on each side of the content. This is space is added inside the content border. The \fIamount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR. It defaults to 0. .\" OPTION: -ipady .TP \fB\-ipady \fIamount\fR . The \fIamount\fR specifies how much vertical internal padding to leave on the top and bottom of the content. This space is added inside the content border. The \fIamount\fR defaults to 0. .\" OPTION: -padx .TP \fB\-padx \fIamount\fR . The \fIamount\fR specifies how much horizontal external padding to leave on each side of the content, in screen units. \fIAmount\fR may be a list of two values to specify padding for left and right separately. The \fIamount\fR defaults to 0. This space is added outside the content border. .\" OPTION: -pady .TP \fB\-pady \fIamount\fR . The \fIamount\fR specifies how much vertical external padding to leave on the top and bottom of the content, in screen units. \fIAmount\fR may be a list of two values to specify padding for top and bottom separately. The \fIamount\fR defaults to 0. This space is added outside the content border. .\" OPTION: -row .TP \fB\-row \fIn\fR . Insert the content so that it occupies the \fIn\fRth row in the grid. Row numbers start with 0. If this option is not supplied, then the content is arranged on the same row as the previous content specified on this call to \fBgrid\fR, or the next row after the highest occupied row if this is the first content. .\" OPTION: -rowspan .TP \fB\-rowspan \fIn\fR . Insert the content so that it occupies \fIn\fR rows in the grid. The default is one row. If the next \fBgrid\fR command contains \fB^\fR characters instead of \fIcontent\fR that line up with the columns of this \fIcontent\fR, then the \fBrowspan\fR of this \fIcontent\fR is extended by one. .\" OPTION: -sticky .TP \fB\-sticky \fIstyle\fR . If a content's cell is larger than its requested dimensions, this option may be used to position (or stretch) the content within its cell. \fIStyle\fR is a string that contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. |
︙ | ︙ | |||
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | .QW "" , which causes the content to be centered in its cavity, at its requested size. .LP If any of the content is already managed by the geometry manager then any unspecified options for them retain their previous values rather than receiving default values. .RE .TP \fBgrid forget \fIwindow \fR?\fIwindow ...\fR? . Removes each of the \fIwindow\fRs from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. The configuration options for that window are forgotten, so that if the window is managed once more by the grid geometry manager, the initial default settings are used. .RS .PP .VS "TIP 518" | > > > > > > > > > > | | > > | | | | > > > > > | | | | 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 | .QW "" , which causes the content to be centered in its cavity, at its requested size. .LP If any of the content is already managed by the geometry manager then any unspecified options for them retain their previous values rather than receiving default values. .RE .\" METHOD: content .TP \fBgrid content \fIwindow\fR ?\fI\-option value\fR? . If no options are supplied, a list of all of the content in \fIwindow\fR 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. .\" METHOD: forget .TP \fBgrid forget \fIwindow \fR?\fIwindow ...\fR? . Removes each of the \fIwindow\fRs from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. The configuration options for that window are forgotten, so that if the window is managed once more by the grid geometry manager, the initial default settings are used. .RS .PP .VS "TIP 518" If the last content window of the container becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the container; the container may choose to resize itself (or otherwise respond) to such a change. .VE "TIP 518" .RE .\" METHOD: info .TP \fBgrid info \fIwindow\fR . Returns a list whose elements are the current configuration state of the content given by \fIwindow\fR in the same option-value form that might be specified to \fBgrid configure\fR. The first two elements of the list are .QW "\fB\-in \fIcontainer\fR" where \fIcontainer\fR is the windows's container window. .\" METHOD: location .TP \fBgrid location \fIwindow x y\fR . Given \fIx\fR and \fIy\fR values in screen units relative to the container window, the column and row number at that \fIx\fR and \fIy\fR location is returned. For locations that are above or to the left of the grid, \fB\-1\fR is returned. .\" METHOD: propagate .TP \fBgrid propagate \fIwindow\fR ?\fIboolean\fR? . If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR then propagation is enabled for \fIwindow\fR, which must be a window name (see \fBGEOMETRY PROPAGATION\fR below). If \fIboolean\fR has a false boolean value then propagation is disabled for \fIwindow\fR. In either of these cases an empty string is returned. If \fIboolean\fR is omitted then the command returns \fB0\fR or \fB1\fR to indicate whether propagation is currently enabled for \fIwindow\fR. .RS .PP Propagation is enabled by default. .RE .\" METHOD: rowconfigure .TP \fBgrid rowconfigure \fIwindow index \fR?\fI\-option value...\fR? . Query or set the row properties of the \fIindex\fR row of the geometry container, \fIwindow\fR. The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR and \fB\-pad\fR. If one or more options are provided, then \fIindex\fR may be given as a list of row indices to which the configuration options will operate on. Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR the options apply to all rows currently occupied by content windows. For a window name, that window must be a content window of this container and the options apply to all rows currently occupied by the container window. The \fB\-minsize\fR option sets the minimum size, in screen units, that will be permitted for this row. The \fB\-weight\fR option (an integer value) sets the relative weight for apportioning any extra spaces among rows. A weight of zero (0) indicates the row will not deviate from its requested |
︙ | ︙ | |||
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of .QW "-option value" pairs. .TP \fBgrid remove \fIwindow \fR?\fIwindow ...\fR? . Removes each of the \fIwindow\fRs from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, so that if the content window is managed once more by the grid geometry manager, the previous values are retained. .RS .PP .VS "TIP 518" | > | | | > < < | < < < < < | < | < | | | < | < < | < | | | 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 | grid geometry manager requests a size from the containing window. If only an option is specified, with no value, the current value of that option is returned. If only the container window and index is specified, all the current settings are returned in a list of .QW "-option value" pairs. .\" METHOD: remove .TP \fBgrid remove \fIwindow \fR?\fIwindow ...\fR? . Removes each of the \fIwindow\fRs from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, so that if the content window is managed once more by the grid geometry manager, the previous values are retained. .RS .PP .VS "TIP 518" If the last content window of the container becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the container; the container may choose to resize itself (or otherwise respond) to such a change. .VE "TIP 518" .RE .\" METHOD: size .TP \fBgrid size \fIcontainer\fR . Returns the size of the grid (in columns then rows) for \fIcontainer\fR. The size is determined either by the \fIcontent\fR occupying the largest row or column, or the largest column or row with a \fB\-minsize\fR, \fB\-weight\fR, or \fB\-pad\fR that is non-zero. .\" METHOD: slaves .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. When no column or row information is specified for a \fIcontent\fR, default values are chosen for \fB\-column\fR, \fB\-row\fR, \fB\-columnspan\fR and \fB\-rowspan\fR at the time the \fIcontent\fR is managed. The values are chosen based upon the current layout of the grid, the position of the \fIcontent\fR relative to other \fIcontent\fRs in the same grid command, and the presence of the characters \fB\-\fR, \fBx\fR, and \fB^\fR in \fBgrid\fR command where \fIcontent\fR names are normally expected. .RS .IP \fB\-\fR This increases the \fB\-columnspan\fR of the \fIcontent\fR to the left. Several \fB\-\fR's in a row will successively increase the number of columns spanned. A \fB\-\fR may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIcontent\fR argument to \fBgrid configure\fR. .IP \fBx\fR This leaves an empty column between the \fIcontent\fR on the left and the \fIcontent\fR on the right. .IP \fB^\fR This extends the \fB\-rowspan\fR of the \fIcontent\fR above the \fB^\fR's in the grid. The number of \fB^\fR's in a row must match the number of columns spanned by the \fIcontent\fR above it. .RE .SH "THE GRID ALGORITHM" .PP The grid geometry manager lays out its content in three steps. In the first step, the minimum size needed to fit all of the content is computed, then (if propagation is turned on), a request is made of the container window to become that size. In the second step, the requested size is compared against the actual size of the container. If the sizes are different, then spaces is added to or taken away from the layout as needed. For the final step, each content is positioned in its row(s) and column(s) based on the setting of its \fIsticky\fR flag. .PP To compute the minimum size of a layout, the grid geometry manager first looks at all content whose \fB\-columnspan\fR and \fB\-rowspan\fR values are one, and computes the nominal size of each row or column to be either the \fIminsize\fR for that row or column, or the sum of the \fIpad\fRding plus the size of the largest content, whichever is greater. After that the rows or columns in each uniform group adapt to each other. Then the content whose row-spans or column-spans are greater than one are examined. If a group of rows or columns need to be increased in size in order to accommodate these content, then extra space is added to each |
︙ | ︙ | |||
437 438 439 440 441 442 443 | .SH EXAMPLES .PP A toplevel window containing a text widget and two scrollbars: .PP .CS # Make the widgets toplevel .t | | | | | | | | | | | | | | 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 | .SH EXAMPLES .PP A toplevel window containing a text widget and two scrollbars: .PP .CS # Make the widgets toplevel .t text .t.txt -wrap none -xscroll {.t.h set} -yscroll {.t.v set} scrollbar .t.v -orient vertical -command {.t.txt yview} scrollbar .t.h -orient horizontal -command {.t.txt xview} # Lay them out \fBgrid\fR .t.txt .t.v -sticky nsew \fBgrid\fR .t.h -sticky nsew # Tell the text widget to take all the extra room \fBgrid rowconfigure\fR .t .t.txt -weight 1 \fBgrid columnconfigure\fR .t .t.txt -weight 1 .CE .PP Three widgets of equal width, despite their different .QW natural widths: .PP .CS button .b -text "Foo" entry .e -textvariable foo ; set foo "Hello World!" label .l -text "This is a fairly long piece of text" \fBgrid\fR .b .e .l -sticky ew \fBgrid columnconfigure\fR . "all" -uniform allTheSame .CE .SH "SEE ALSO" pack(n), place(n) .SH KEYWORDS geometry manager, location, grid, cell, propagation, size, pack '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/image.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH image n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME image \- Create and manipulate images .SH SYNOPSIS | | > > > > > > > > > > > > > > > > < | < | > > > > > > > > > > > | | 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 | .TH image n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME image \- Create and manipulate images .SH SYNOPSIS \fBimage\fI option \fR?\fIarg ...\fR? .BE .SH DESCRIPTION .PP The \fBimage\fR command is used to create, delete, and query images. It can take several different forms, depending on the \fIoption\fR argument. The legal forms are: .\" METHOD: create .TP \fBimage create \fItype \fR?\fIname\fR? ?\fIoption value ...\fR? . Creates a new image and a command with the same name and returns its name. \fItype\fR specifies the type of the image, which must be one of the types currently defined (e.g., \fBbitmap\fR). \fIname\fR specifies the name for the image; if it is omitted then Tk picks a name of the form \fBimage\fIx\fR, where \fIx\fR is an integer. There may be any number of \fIoption\fR\-\fIvalue\fR pairs, which provide configuration options for the new image. The legal set of options is defined separately for each image type; see below for details on the options for built-in image types. If an image already exists by the given name then it is replaced with the new image and any instances of that image will redisplay with the new contents. It is important to note that the image command will silently overwrite any procedure that may currently be defined by the given name, so choose the name wisely. It is recommended to use a separate namespace for image names (e.g., \fB::img::logo\fR, \fB::img::large\fR). .\" METHOD: delete .TP \fBimage delete \fR?\fIname name\fR ...? . Deletes each of the named images and returns an empty string. If there are instances of the images displayed in widgets, the images will not actually be deleted until all of the instances are released. However, the association between the instances and the image manager will be dropped. Existing instances will retain their sizes but redisplay as empty areas. If a deleted image is recreated with another call to \fBimage create\fR, the existing instances will use the new image. .\" METHOD: height .TP \fBimage height \fIname\fR . Returns a decimal string giving the height of image \fIname\fR in pixels. .\" METHOD: inuse .TP \fBimage inuse \fIname\fR . Returns a boolean value indicating whether or not the image given by \fIname\fR is in use by any widgets. .\" METHOD: names .TP \fBimage names\fR . Returns a list containing the names of all existing images. .\" METHOD: type .TP \fBimage type \fIname\fR . Returns the type of image \fIname\fR (the value of the \fItype\fR argument to \fBimage create\fR when the image was created). .\" METHOD: types .TP \fBimage types\fR . Returns a list whose elements are all of the valid image types (i.e., all of the values that may be supplied for the \fItype\fR argument to \fBimage create\fR). .\" METHOD: width .TP \fBimage width \fIname\fR . Returns a decimal string giving the width of image \fIname\fR in pixels. .PP Additional operations (e.g. writing the image to a file) may be available as subcommands of the image instance command. See the manual page for the particular image type for details. .SH "BUILT-IN IMAGE TYPES" .PP The following image types are defined by Tk so they will be available in any Tk application. Individual applications or extensions may define additional types. .IP \fBbitmap\fR Each pixel in the image displays a foreground color, a background color, or nothing. See the \fBbitmap\fR manual entry for more information. .IP \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. .IP \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 (guillemetleft) 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 (ordmasculine) 186 0xBA \(Fc (guillemetright) 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 |
︙ | ︙ | |||
1113 1114 1115 1116 1117 1118 1119 | dead_E 65155 0xFE83 dead_i 65156 0xFE84 dead_I 65157 0xFE85 dead_o 65158 0xFE86 dead_O 65159 0xFE87 dead_u 65160 0xFE88 dead_U 65161 0xFE89 | | | | 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | dead_E 65155 0xFE83 dead_i 65156 0xFE84 dead_I 65157 0xFE85 dead_o 65158 0xFE86 dead_O 65159 0xFE87 dead_u 65160 0xFE88 dead_U 65161 0xFE89 dead_schwa 65162 0xFE8A dead_SCHWA 65163 0xFE8B dead_greek 65164 0xFE8C dead_lowline 65168 0xFE90 dead_aboveverticalline 65169 0xFE91 dead_belowverticalline 65170 0xFE92 dead_longsolidusoverlay 65171 0xFE93 ch 65184 0xFEA0 Ch 65185 0xFEA1 |
︙ | ︙ | |||
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/label.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH label n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME label \- Create and manipulate 'label' non-interactive text or image widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH label n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME label \- Create and manipulate 'label' non-interactive text or image widgets .SH SYNOPSIS \fBlabel\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-disabledforeground \-padx \-activeforeground \-font \-pady \-anchor \-foreground \-relief \-background \-highlightbackground \-takefocus \-bitmap \-highlightcolor \-text \-borderwidth \-highlightthickness \-textvariable |
︙ | ︙ | |||
76 77 78 79 80 81 82 83 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for label widgets: .TP | > | > > > | | | | | | | | | | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for label widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBlabel\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBlabel\fR command. .SH BINDINGS .PP When a new label is created, it has no default event bindings: labels are not intended to be interactive. .SH EXAMPLE .PP .CS # Make the widgets \fBlabel\fR .t -text "This widget is at the top" -bg red \fBlabel\fR .b -text "This widget is at the bottom" -bg green \fBlabel\fR .l -text "Left\enHand\enSide" \fBlabel\fR .r -text "Right\enHand\enSide" text .mid \&.mid insert end "This layout is like Java's BorderLayout" # Lay them out pack .t -side top -fill x pack .b -side bottom -fill x pack .l -side left -fill y pack .r -side right -fill y pack .mid -expand 1 -fill both .CE .SH "SEE ALSO" labelframe(n), button(n), ttk::label(n) .SH KEYWORDS label, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/labelframe.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH labelframe n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME labelframe \- Create and manipulate 'labelframe' labelled container widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH labelframe n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME labelframe \- Create and manipulate 'labelframe' labelled container widgets .SH SYNOPSIS \fBlabelframe\fI pathName\fR ?\fIoptions\fR? .SO \-borderwidth \-highlightbackground \-pady \-cursor \-highlightcolor \-relief \-font \-highlightthickness \-takefocus \-foreground \-padx \-text .SE .SH "WIDGET-SPECIFIC OPTIONS" |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 | .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the labelframe widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for frame widgets: .TP | > | > > > | 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 | .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the labelframe widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for frame widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBlabelframe\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no \fIoption\fR is specified). If |
︙ | ︙ | |||
128 129 130 131 132 133 134 | .SH EXAMPLE .PP This shows how to build part of a GUI for a hamburger vendor. The \fBlabelframe\fR widgets are used to organize the available choices by the kinds of things that the choices are being made over. .PP .CS | | | | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | .SH EXAMPLE .PP This shows how to build part of a GUI for a hamburger vendor. The \fBlabelframe\fR widgets are used to organize the available choices by the kinds of things that the choices are being made over. .PP .CS grid [\fBlabelframe\fR .burger -text "Burger"] \e [\fBlabelframe\fR .bun -text "Bun"] -sticky news grid [\fBlabelframe\fR .cheese -text "Cheese Option"] \e [\fBlabelframe\fR .pickle -text "Pickle Option"] -sticky news foreach {type name val} { burger Beef beef burger Lamb lamb burger Vegetarian beans bun Plain white bun Sesame seeds |
︙ | ︙ | |||
153 154 155 156 157 158 159 | cheese "Monterey Jack" jack pickle None none pickle Gherkins gherkins pickle Onions onion pickle Chili chili } { | | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | cheese "Monterey Jack" jack pickle None none pickle Gherkins gherkins pickle Onions onion pickle Chili chili } { set w [radiobutton .$type.$val -text $name -anchor w \e -variable $type -value $val] pack $w -side top -fill x } set burger beef set bun white set cheese none set pickle none .CE .SH "SEE ALSO" frame(n), label(n), ttk::labelframe(n) .SH KEYWORDS labelframe, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/listbox.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH listbox n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME listbox \- Create and manipulate 'listbox' item list widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH listbox n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME listbox \- Create and manipulate 'listbox' item list widgets .SH SYNOPSIS \fBlistbox\fI pathName \fR?\fIoptions\fR? .SO \-background \-borderwidth \-cursor \-disabledforeground \-exportselection \-font \-foreground \-highlightbackground \-highlightcolor \-highlightthickness \-justify \-relief \-selectbackground \-selectborderwidth \-selectforeground \-setgrid \-takefocus \-xscrollcommand |
︙ | ︙ | |||
91 92 93 94 95 96 97 | They also support scanning, as described below. .SH "INDICES" .PP Many of the widget commands for listboxes take one or more indices as arguments. An index specifies a particular element of the listbox, in any of the following ways: | < | < < | < < | < < | < < | | > > > > | > | > | > > > > > > > > > > > > > > | | 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 | They also support scanning, as described below. .SH "INDICES" .PP Many of the widget commands for listboxes take one or more indices as arguments. An index specifies a particular element of the listbox, in any of the following ways: .IP \fInumber\fR 12 Specifies the element as a numerical index, where 0 corresponds to the first element in the listbox. .IP \fBactive\fR 12 Indicates the element that has the location cursor. This element will be displayed as specified by \fB\-activestyle\fR when the listbox has the keyboard focus, and it is specified with the \fBactivate\fR widget command. .IP \fBanchor\fR 12 Indicates the anchor point for the selection, which is set with the \fBselection anchor\fR widget command. .IP \fBend\fR 12 Indicates the end of the listbox. For most commands this refers to the last element in the listbox, but for a few commands such as \fBindex\fR and \fBinsert\fR it refers to the element just after the last one. .IP \fB@\fIx\fB,\fIy\fR 12 Indicates the element that covers the point in the listbox window specified by \fIx\fR and \fIy\fR (in pixel coordinates). If no element covers that point, then the closest element to that point is used. .PP Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. In the widget command descriptions below, arguments named \fIindex\fR, \fIfirst\fR, and \fIlast\fR always contain text indices in one of the above forms. .SH "WIDGET COMMAND" .PP The \fBlistbox\fR command creates a new Tcl command whose name is \fIpathName\fR. This command may be used to invoke various operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for listbox widgets: .\" METHOD: activate .TP \fIpathName \fBactivate\fI index\fR . Sets the active element to the one indicated by \fIindex\fR. If \fIindex\fR is outside the range of elements in the listbox then the closest element is activated. The active element is drawn as specified by \fB\-activestyle\fR when the widget has the input focus, and its index may be retrieved with the index \fBactive\fR. .\" METHOD: bbox .TP \fIpathName \fBbbox\fI index\fR . Returns a list of four numbers describing the bounding box of the text in the element 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 text (specified in pixels relative to the widget) and the last two elements give the width and height of the area, in pixels. If no part of the element given by \fIindex\fR is visible on the screen, or if \fIindex\fR refers to a non-existent element, then the result is an empty string; if the element is partially visible, the result gives the full area of the element, including any parts that are not visible. .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBlistbox\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBlistbox\fR command. .\" METHOD: curselection .TP \fIpathName \fBcurselection\fR . Returns a list containing the numerical indices of all of the elements in the listbox that are currently selected. If there are no elements selected in the listbox then an empty string is returned. .\" METHOD: delete .TP \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR? . Deletes one or more elements of the listbox. \fIFirst\fR and \fIlast\fR are indices specifying the first and last elements in the range to delete. If \fIlast\fR is not specified it defaults to \fIfirst\fR, i.e. a single element is deleted. .\" METHOD: get .TP \fIpathName \fBget \fIfirst\fR ?\fIlast\fR? . If \fIlast\fR is omitted, returns the contents of the listbox element indicated by \fIfirst\fR, or an empty string if \fIfirst\fR refers to a non-existent element. If \fIlast\fR is specified, the command returns a list whose elements are all of the listbox elements between \fIfirst\fR and \fIlast\fR, inclusive. Both \fIfirst\fR and \fIlast\fR may have any of the standard forms for indices. .\" METHOD: index .TP \fIpathName \fBindex \fIindex\fR . Returns the integer index value that corresponds to \fIindex\fR. If \fIindex\fR is \fBend\fR the return value is a count of the number of elements in the listbox (not the index of the last element). .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex \fR?\fIelement element ...\fR? . Inserts zero or more new elements in the list just before the element given by \fIindex\fR. If \fIindex\fR is specified as \fBend\fR then the new elements are added to the end of the list. Returns an empty string. .\" METHOD: itemcget .TP \fIpathName \fBitemcget \fIindex option\fR . Returns the current value of the item configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBitemconfigure\fR command. .\" METHOD: itemconfigure .TP \fIpathName \fBitemconfigure \fIindex\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR? . Query or modify the configuration options of an item in the listbox. If no \fIoption\fR is specified, returns a list describing all of the available options for the item (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget option(s) to have the given value(s); in this case the command returns an empty string. The following options are currently supported for items: .RS .\" OPTION: -background .TP \fB\-background \fIcolor\fR . \fIColor\fR specifies the background color to use when displaying the item. It may have any of the forms accepted by \fBTk_GetColor\fR. .\" OPTION: -foreground .TP \fB\-foreground \fIcolor\fR . \fIColor\fR specifies the foreground color to use when displaying the item. It may have any of the forms accepted by \fBTk_GetColor\fR. .\" OPTION: -selectbackground .TP \fB\-selectbackground \fIcolor\fR . \fIcolor\fR specifies the background color to use when displaying the item while it is selected. It may have any of the forms accepted by \fBTk_GetColor\fR. .\" OPTION: -selectforeground .TP \fB\-selectforeground \fIcolor\fR . \fIcolor\fR specifies the foreground color to use when displaying the item while it is selected. It may have any of the forms accepted by \fBTk_GetColor\fR. .RE .\" METHOD: nearest .TP \fIpathName \fBnearest \fIy\fR . Given a y-coordinate within the listbox window, this command returns the index of the (visible) listbox element nearest to that y-coordinate. .\" METHOD: scan .TP \fIpathName \fBscan\fI option args\fR . This command is used to implement scanning on listboxes. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBscan mark \fIx y\fR . |
︙ | ︙ | |||
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | \fBscan mark\fR command for the widget. It then adjusts the view by 10 times the difference in coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the list at high speed through the window. The return value is an empty string. .RE .TP \fIpathName \fBsee \fIindex\fR . Adjust the view in the listbox so that the element given by \fIindex\fR is visible. If the element is already visible then the command has no effect; if the element is near one edge of the window then the listbox scrolls to bring the element into view at the edge; otherwise the listbox scrolls to center the element. .TP \fIpathName \fBselection \fIoption arg\fR . This command is used to adjust the selection within a listbox. It has several forms, depending on \fIoption\fR: .RS .TP | > > | 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 | \fBscan mark\fR command for the widget. It then adjusts the view by 10 times the difference in coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the list at high speed through the window. The return value is an empty string. .RE .\" METHOD: see .TP \fIpathName \fBsee \fIindex\fR . Adjust the view in the listbox so that the element given by \fIindex\fR is visible. If the element is already visible then the command has no effect; if the element is near one edge of the window then the listbox scrolls to bring the element into view at the edge; otherwise the listbox scrolls to center the element. .\" METHOD: selection .TP \fIpathName \fBselection \fIoption arg\fR . This command is used to adjust the selection within a listbox. It has several forms, depending on \fIoption\fR: .RS .TP |
︙ | ︙ | |||
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | .TP \fIpathName \fBselection set \fIfirst \fR?\fIlast\fR? . Selects all of the elements in the range between \fIfirst\fR and \fIlast\fR, inclusive, without affecting the selection state of elements outside that range. .RE .TP \fIpathName \fBsize\fR . Returns a decimal string indicating the total number of elements in the listbox. .TP \fIpathName \fBxview \fR?\fIargs\fR . This command is used to query and change the horizontal position of the information in the widget's window. It can take any of the following forms: .RS | > > | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | .TP \fIpathName \fBselection set \fIfirst \fR?\fIlast\fR? . Selects all of the elements in the range between \fIfirst\fR and \fIlast\fR, inclusive, without affecting the selection state of elements outside that range. .RE .\" METHOD: size .TP \fIpathName \fBsize\fR . Returns a decimal string indicating the total number of elements in the listbox. .\" METHOD: xview .TP \fIpathName \fBxview \fR?\fIargs\fR . This command is used to query and change the horizontal position of the information in the widget's window. It can take any of the following forms: .RS |
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR character units (the width of the \fB0\fR character) on the display. .RE .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fByview\fR Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the listbox element at the top of the window, relative to the listbox as a whole (0.5 means it is halfway through the listbox, for example). The second element gives the position of the listbox element just after the last one in the window, relative to the listbox as a whole. | > > | 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 | If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR character units (the width of the \fB0\fR character) on the display. .RE .\" METHOD: yview .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fByview\fR . Returns a list containing two elements, both of which are real fractions between 0 and 1. The first element gives the position of the listbox element at the top of the window, relative to the listbox as a whole (0.5 means it is halfway through the listbox, for example). The second element gives the position of the listbox element just after the last one in the window, relative to the listbox as a whole. |
︙ | ︙ | |||
428 429 430 431 432 433 434 | element in the listbox, 0.33 indicates the element one-third the way through the listbox, and so on. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. | | > | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | element in the listbox, 0.33 indicates the element one-third the way through the listbox, and so on. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then earlier elements become visible; if it is positive then later elements become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by |
︙ | ︙ | |||
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] | | | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | 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/loadTk.n.
1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 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. '\" .TH "Safe Tk" n 8.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME safe::loadTk \- Load Tk into a safe interpreter. .SH SYNOPSIS | | | | | 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 | '\" '\" Copyright (c) 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. '\" .TH "Safe Tk" n 8.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME safe::loadTk \- Load Tk into a safe interpreter. .SH SYNOPSIS \fBsafe::loadTk \fIchild\fR ?\fB\-use\fI windowId\fR? ?\fB\-display\fI displayName\fR? .BE .SH DESCRIPTION .PP Safe Tk is based on Safe Tcl, which provides a mechanism that allows restricted and mediated access to auto-loading and packages for safe interpreters. Safe Tk adds the ability to configure the interpreter for safe Tk operations and load Tk into safe interpreters. .PP The \fBsafe::loadTk\fR command initializes the required data structures in the named safe interpreter and then loads Tk into it. The interpreter must have been created with \fBsafe::interpCreate\fR or have been initialized with \fBsafe::interpInit\fR. The command returns the name of the safe interpreter. If \fB\-use\fR is specified, the window identified by the specified system dependent identifier \fIwindowId\fR is used to contain the .QW . window of the safe interpreter; it can be any valid id, eventually referencing a window belonging to another application. As a convenience, if the window you plan to use is a Tk Window of the application you can use the window name (e.g., .QW \fB.x.y\fR ) instead of its window Id (e.g., from \fBwinfo id\fI .x.y\fR). When \fB\-use\fR is not specified, a new toplevel window is created for the .QW . window of the safe interpreter. On X11 if you want the embedded window to use another display than the default one, specify it with \fB\-display\fR. See the \fBSECURITY ISSUES\fR section below for implementation details. .SH "SECURITY ISSUES" .PP Please read the \fBsafe\fR manual page for Tcl to learn about the basic security considerations for Safe Tcl. .PP \fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the parent interpreter to the virtual access path of the safe interpreter so that auto-loading will work in the safe interpreter. .PP Tk initialization is now safe with respect to not trusting the child's state for startup. \fBsafe::loadTk\fR registers the child's name so when the Tk initialization (\fBTk_SafeInit\fR) is called and in turn calls the parent's \fBsafe::InitTk\fR it will return the desired \fBargv\fR equivalent (\fB\-use\fI windowId\fR, correct \fB\-display\fR, etc.) .PP When \fB\-use\fR is not used, the new toplevel created is specially decorated so the user is always aware that the user interface presented comes from a potentially unsafe code and can easily delete the corresponding interpreter. .PP On X11, conflicting \fB\-use\fR and \fB\-display\fR are likely to generate a fatal X error. |
︙ | ︙ |
Changes to doc/menu.n.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME menu, tk_menuSetFocus \- Create and manipulate 'menu' widgets and menubars .SH SYNOPSIS .nf | | | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME menu, tk_menuSetFocus \- Create and manipulate 'menu' widgets and menubars .SH SYNOPSIS .nf \fBmenu\fI pathName \fR?\fIoptions\fR? \fBtk_menuSetFocus\fI pathName\fR .fi .SO \-activebackground \-borderwidth \-foreground \-activeborderwidth \-cursor \-relief \-activeforeground \-disabledforeground \-takefocus \-background \-font \-activerelief .SE .SH "WIDGET-SPECIFIC OPTIONS" |
︙ | ︙ | |||
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. | | | | 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 | .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 |
︙ | ︙ | |||
308 309 310 311 312 313 314 | \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. .PP Many of the widget commands for a menu take as one argument an 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: | < | < | < | < | < | < < | < | < < | < < | < | | < > | < | > > | < | > > > > | > | | > > > | | | > > > > > > > > > > > > > > > > | > | | | | > > > > > > > > > | | > | | > > | > > | > > > > > | > > > > > > > > > > > > > | 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 | \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. .PP Many of the widget commands for a menu take as one argument an 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: .IP \fBactive\fR 12 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. .IP \fBend\fR 12 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. .IP \fBlast\fR 12 Same as \fBend\fR. .IP \fB{}\fR 12 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. .IP \fB@\fIx\fB,\fIy\fR 12 Indicates the entry that covers the point in the menu's window specified by \fIx\fR and \fIy\fR (in pixel coordinates). If no entry covers that point, then this form is equivalent to \fB{}\fR. If only a single number is specified, it is treated as the y-coordinate. .IP \fInumber\fR 12 Specifies the entry numerically, where 0 corresponds to the top-most entry of the menu, 1 to the entry below it, and so on. .IP \fIid\fR 12 If the index does not satisfy one of the above forms then the menu is searched for an entry with the specified id. .IP \fIpattern\fR 12 If all of the above methods for finding an entry fail, this form is used. \fIPattern\fR is pattern-matched against the label of each entry in the menu, in order from the top down, until a matching entry is found. The rules of \fBstring match\fR are used. .PP If the index could match more than one of the above forms, then the form earlier in the above list takes precedence. Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. .PP The following widget commands are possible for menu widgets: .\" METHOD: activate .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 if the specified entry is disabled, then the menu ends up with no active entry. Returns an empty string. .\" METHOD: add .TP \fIpathName \fBadd \fItype \fR?\fIid\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, \fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR, or a unique abbreviation of one of the above. If the \fIid\fR argument is specified, it is used as the entry identifier; \fIid\fR must not already exist in the menu. Otherwise, a new unique identifier is generated. If additional arguments are present, they specify the options listed in the \fBMENU ENTRY OPTIONS\fR section below. The \fBadd\fR widget command returns the id of the new entry. .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBmenu\fR command. .\" METHOD: clone .TP \fIpathName \fBclone \fInewPathname\fR ?\fIcloneType\fR? . Makes a clone of the current menu named \fInewPathName\fR. This clone is a menu in its own right, but any changes to the clone are propagated to the original menu and vice versa. \fIcloneType\fR can be \fBnormal\fR, \fBmenubar\fR, or \fBtearoff\fR. Should not normally be called outside of the Tk library. See the \fBCLONES\fR section for more information. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBmenu\fR command. .\" METHOD: delete .TP \fIpathName \fBdelete \fIindex1\fR ?\fIindex2\fR? . Delete all of the menu entries between \fIindex1\fR and \fIindex2\fR inclusive. If \fIindex2\fR is omitted then it defaults to \fIindex1\fR. Attempts to delete a tear-off menu entry are ignored (instead, you should change the \fB\-tearoff\fR option to remove the tear-off entry). .\" METHOD: entrycget .TP \fIpathName \fBentrycget \fIindex option\fR . Returns the current value of a configuration option for the entry given by \fIindex\fR. \fIOption\fR may have any of the names described in the \fBMENU ENTRY OPTIONS\fR section below. .\" METHOD: entryconfigure .TP \fIpathName \fBentryconfigure \fIindex \fR?\fIoptions...\fR? . This command is similar to the \fBconfigure\fR command, except that it applies to the options for an individual entry, whereas \fBconfigure\fR applies to the options for the menu as a whole. \fIOptions\fR may have any of the values described in the \fBMENU ENTRY OPTIONS\fR section below. If \fIoptions\fR are specified, options are modified as indicated in the command and the command returns an empty string. 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). .\" METHOD: id .TP \fIpathName \fBid \fIindex\fR . Returns the id of the menu entry given by \fIindex\fR. This is the identifier that was assigned to the entry when it was created using the \fBadd\fR or \fBinsert\fR widget command. Returns an empty string for the tear-off entry, or if \fIindex\fR is equivalent to \fB{}\fR. .\" METHOD: index .TP \fIpathName \fBindex \fIindex\fR . Returns the numerical index corresponding to \fIindex\fR, or \fB{}\fR if \fIindex\fR was specified as \fB{}\fR. .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex type \fR?\fIid\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, \fIid\fR, \fIoption\fR, and \fIvalue\fR arguments have the same interpretation as for the \fBadd\fR widget command. It is not possible to insert new menu entries before the tear-off entry, if the menu has one. The \fBinsert\fR widget command returns the id of the new entry. .\" METHOD: invoke .TP \fIpathName \fBinvoke \fIindex\fR . Invoke the action of the menu entry. See the sections on the individual entries above for details on what happens. If the menu entry is disabled then nothing happens. If the entry has a command associated with it then the result of that command is returned as the result of the \fBinvoke\fR widget command. Otherwise the result is an empty string. Note: invoking a menu entry does not automatically unpost the menu; the default bindings normally take care of this before invoking the \fBinvoke\fR widget command. .\" METHOD: post .TP \fIpathName \fBpost \fIx y\fR ?\fIindex\fR? . Arrange for the menu to be displayed on the screen at the root-window coordinates given by \fIx\fR and \fIy\fR. If an index is specified the menu will be located so that the entry with that index is displayed at the point. These coordinates are adjusted if necessary to guarantee that the entire menu is visible on the screen. This command normally returns an empty string. If the \fB\-postcommand\fR option has been specified, then its value is executed as a Tcl script before posting the menu and the result of that script is returned as the result of the \fBpost\fR widget command. If an error returns while executing the command, then the error is returned without posting the menu. .\" METHOD: postcascade .TP \fIpathName \fBpostcascade \fIindex\fR . Posts the submenu associated with the cascade entry given by \fIindex\fR, and unposts any previously posted submenu. If \fIindex\fR does not correspond to a cascade entry, or if \fIpathName\fR is not posted, the command has no effect except to unpost any currently posted submenu. .\" METHOD: type .TP \fIpathName \fBtype \fIindex\fR . Returns the type of the menu entry given by \fIindex\fR. This is the \fItype\fR argument passed to the \fBadd\fR or \fBinsert\fR widget command when the entry was created, such as \fBcommand\fR or \fBseparator\fR, or \fBtearoff\fR for a tear-off entry. .\" METHOD: unpost .TP \fIpathName \fBunpost\fR . Unmap the window so that it is no longer displayed. If a lower-level cascaded menu is posted, unpost that menu. Returns an empty string. This subcommand does not work on Windows and the Macintosh, as those platforms have their own way of unposting menus. .\" METHOD: xposition .TP \fIpathName \fBxposition \fIindex\fR . Returns a decimal string giving the x-coordinate within the menu window of the leftmost pixel in the entry specified by \fIindex\fR. .\" METHOD: yposition .TP \fIpathName \fByposition \fIindex\fR . Returns a decimal string giving the y-coordinate within the menu window of the topmost pixel in the entry specified by \fIindex\fR. .SH "MENU ENTRY OPTIONS" The following options are allowed on menu entries. Most options are not supported by all entry types. .\" OPTION: -activebackground .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. .\" OPTION: -activeforeground .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. .\" OPTION: -accelerator .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. .\" OPTION: -background .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. .\" OPTION: -bitmap .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. .\" OPTION: -columnbreak .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. .\" OPTION: -command .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. .\" OPTION: -compound .TP \fB\-compound \fIvalue\fR . Specifies whether the menu entry should display both an image and text, and if so, where the image should be placed relative to the text. Valid values for this option are \fBbottom\fR, \fBcenter\fR, \fBleft\fR, \fBnone\fR, \fBright\fR and \fBtop\fR. The default value is \fBnone\fR, meaning that the button will display either an image or text, depending on the values of the \fB\-image\fR and \fB\-bitmap\fR options. .\" OPTION: -font .TP \fB\-font \fIvalue\fR . Specifies the font to use when drawing the label or accelerator string in this entry. If this option is specified as an empty string (the default) then the \fB\-font\fR option for the overall menu is used. This option is not available for separator or tear-off entries. .\" OPTION: -foreground .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. .\" OPTION: -hidemargin .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., color palettes, pattern palettes, etc. 1 indicates that the margin for the entry is hidden; 0 means that the margin is used. .\" OPTION: -image .TP \fB\-image \fIvalue\fR . Specifies an image to display in the menu instead of a text string or bitmap. The image must have been created by some previous invocation of \fBimage create\fR. This option overrides the \fB\-label\fR and \fB\-bitmap\fR options (as controlled by the \fB\-compound\fR option) but may be reset to an empty string to enable a textual or bitmap label to be displayed. This option is not available for separator or tear-off entries. .\" OPTION: -indicatoron .TP \fB\-indicatoron \fIvalue\fR . Available only for checkbutton and radiobutton entries. \fIValue\fR is a boolean that determines whether or not the indicator should be displayed. .\" OPTION: -label .TP \fB\-label \fIvalue\fR . Specifies a string to display as an identifying label in the menu entry. Not available for separator or tear-off entries. .\" OPTION: -menu .TP \fB\-menu \fIvalue\fR . Available only for cascade entries. Specifies the path name of the submenu associated with this entry. The submenu must be a child of the menu. .\" OPTION: -offvalue .TP \fB\-offvalue \fIvalue\fR . Available only for checkbutton entries. Specifies the value to store in the entry's associated variable when the entry is deselected. .\" OPTION: -onvalue .TP \fB\-onvalue \fIvalue\fR . Available only for checkbutton entries. Specifies the value to store in the entry's associated variable when the entry is selected. .\" OPTION: -selectcolor .TP \fB\-selectcolor \fIvalue\fR . Available only for checkbutton and radiobutton entries. Specifies the color to display in the indicator when the entry is selected. If the value is an empty string (the default) then the \fB\-selectcolor\fR option for the menu determines the indicator color. .\" OPTION: -selectimage .TP \fB\-selectimage \fIvalue\fR . Available only for checkbutton and radiobutton entries. Specifies an image to display in the entry (in place of the \fB\-image\fR option) when it is selected. \fIValue\fR is the name of an image, which must have been created by some previous invocation of \fBimage create\fR. This option is ignored unless the \fB\-image\fR option has been specified. .\" OPTION: -state .TP \fB\-state \fIvalue\fR . Specifies one of three states for the entry: \fBnormal\fR, \fBactive\fR, or \fBdisabled\fR. In normal state the entry is displayed using the \fB\-foreground\fR option for the menu and the \fB\-background\fR option from the entry or the menu. The active state is typically used when the pointer is over the entry. In active state the entry is displayed using the \fB\-activeforeground\fR option for the menu along with the \fB\-activebackground\fR option from the entry. Disabled state means that the entry should be insensitive: the default bindings will refuse to activate or invoke the entry. In this state the entry is displayed according to the \fB\-disabledforeground\fR option for the menu and the \fB\-background\fR option from the entry. This option is not available for separator entries. .\" OPTION: -underline .TP \fB\-underline \fIvalue\fR . Specifies the integer index of a character to underline in the entry. This option is also queried by the default bindings and used to implement keyboard traversal. 0 corresponds to the first character of the text displayed in the entry, 1 to the next character, and so on. If a bitmap or image is displayed in the entry then this option is ignored. This option is not available for separator or tear-off entries. .\" OPTION: -value .TP \fB\-value \fIvalue\fR . Available only for radiobutton entries. Specifies the value to store in the entry's associated variable when the entry is selected. If an empty string is specified, then the \fB\-label\fR option for the entry as the value to store in the variable. .\" OPTION: -variable .TP \fB\-variable \fIvalue\fR . Available only for checkbutton and radiobutton entries. Specifies the name of a global variable to set when the entry is selected. For checkbutton entries the variable is also set when the entry is deselected. For radiobutton entries, changing the variable |
︙ | ︙ |
Deleted doc/menubar.n.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to doc/menubutton.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH menubutton n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME menubutton \- Create and manipulate 'menubutton' pop-up menu indicator widgets .SH SYNOPSIS | | | | 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 | .TH menubutton n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME menubutton \- Create and manipulate 'menubutton' pop-up menu indicator widgets .SH SYNOPSIS \fBmenubutton\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-disabledforeground \-padx \-activeforeground \-font \-pady \-anchor \-foreground \-relief \-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. |
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for menubutton widgets: .TP \fIpathName \fBcget \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 \fBmenubutton\fR command. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified | > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for menubutton widgets: .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBmenubutton\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified |
︙ | ︙ |
Changes to doc/message.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH message n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME message \- Create and manipulate 'message' non-interactive text widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH message n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME message \- Create and manipulate 'message' non-interactive text widgets .SH SYNOPSIS \fBmessage\fI pathName \fR?\fIoptions\fR? .SO \-anchor \-background \-borderwidth \-cursor \-font \-foreground \-highlightbackground \-highlightcolor \-highlightthickness \-padx \-pady \-relief \-takefocus \-text \-textvariable .SE |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for message widgets: .TP \fIpathName \fBcget \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 \fBmessage\fR command. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified | > > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for message widgets: .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBmessage\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified |
︙ | ︙ |
Changes to doc/messageBox.n.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 | application-specified message, an icon and a set of buttons. Each of the buttons in the message window is identified by a unique symbolic name (see the \fB\-type\fR options). After the message window is popped up, \fBtk_messageBox\fR waits for the user to select one of the buttons. Then it returns the symbolic name of the selected button. .PP The following option-value pairs are supported: .TP | > | > > | > | > | > | > | > | | < | > | < | < < | < < | < < | < < | < < | < | | | | | | | 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 | application-specified message, an icon and a set of buttons. Each of the buttons in the message window is identified by a unique symbolic name (see the \fB\-type\fR options). After the message window is popped up, \fBtk_messageBox\fR waits for the user to select one of the buttons. Then it returns the symbolic name of the selected button. .PP The following option-value pairs are supported: .\" OPTION: -command .TP \fB\-command\fI string\fR . Specifies the prefix of a Tcl command to invoke when the user closes the dialog. The actual command consists of \fIstring\fR followed by a space and the name of the button clicked by the user to close the dialog. This is only available on Mac OS X. .\" OPTION: -default .TP \fB\-default\fI name\fR . \fIName\fR gives the symbolic name of the default button for this message window ( .QW ok , .QW cancel , and so on). See \fB\-type\fR for a list of the symbolic names. If this option is not specified, the first button in the dialog will be made the default. .\" OPTION: -detail .TP \fB\-detail\fI string\fR . Specifies an auxiliary message to the main message given by the \fB\-message\fR option. The message detail will be presented beneath the main message and, where supported by the OS, in a less emphasized font than the main message. .\" OPTION: -icon .TP \fB\-icon\fI iconImage\fR . Specifies an icon to display. \fIIconImage\fR must be one of the following: \fBerror\fR, \fBinfo\fR, \fBquestion\fR or \fBwarning\fR. If this option is not specified, then the info icon will be displayed. .\" OPTION: -message .TP \fB\-message\fI string\fR . Specifies the message to display in this message box. The default value is an empty string. .\" OPTION: -parent .TP \fB\-parent\fI window\fR . Makes \fIwindow\fR the logical parent of the message box. The message box is displayed on top of its parent window. .\" OPTION: -title .TP \fB\-title\fI titleString\fR . Specifies a string to display as the title of the message box. The default value is an empty string. .\" OPTION: -type .TP \fB\-type\fI predefinedType\fR . Arranges for a predefined set of buttons to be displayed. The following values are possible for \fIpredefinedType\fR: .RS .IP \fBabortretryignore\fR 18 Displays three buttons whose symbolic names are \fBabort\fR, \fBretry\fR and \fBignore\fR. .IP \fBok\fR 18 Displays one button whose symbolic name is \fBok\fR. .IP \fBokcancel\fR 18 Displays two buttons whose symbolic names are \fBok\fR and \fBcancel\fR. .IP \fBretrycancel\fR 18 Displays two buttons whose symbolic names are \fBretry\fR and \fBcancel\fR. .IP \fByesno\fR 18 Displays two buttons whose symbolic names are \fByes\fR and \fBno\fR. .IP \fByesnocancel\fR 18 Displays three buttons whose symbolic names are \fByes\fR, \fBno\fR and \fBcancel\fR. .RE .PP .SH EXAMPLE .PP .CS set answer [\fBtk_messageBox\fR -message "Really quit?" \e -icon question -type yesno \e -detail "Select \e"Yes\e" to make the application exit"] switch -- $answer { yes exit no {\fBtk_messageBox\fR -message "I know you like this application!" \e -type ok} } .CE .SH KEYWORDS message box '\" Local Variables: '\" mode: nroff '\" End: |
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 130 131 132 133 | '\" '\" 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: .\" OPTION: -source .TP \fB\-source\fI string\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 .\" OPTION: -as .TP \fB\-as\fI type\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: .RS .IP \fBname\fR The source should be interpreted as the name of a named NSImage provided by the system. This is the default if the \fB\-as\fR option is not specified. .IP \fBfile\fR 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 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 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. .RE .\" OPTION: -width .TP \fB\-width\fI pixels\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. .\" OPTION: -height .TP \fB\-height\fI pixels\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. .\" OPTION: -radius .TP \fB\-radius\fI pixels\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. .\" OPTION: -ring .TP \fB\-ring\fI pixels\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. .\" OPTION: -alpha .TP \fB\-alpha\fI float\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. .\" OPTION: -pressed .TP \fB\-pressed\fI boolean\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. .\" OPTION: -template .TP \fB\-template\fI boolean\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/option.n.
︙ | ︙ | |||
18 19 20 21 22 23 24 | \fBoption get \fIwindow name class\fR \fBoption readfile \fIfileName \fR?\fIpriority\fR? .fi .BE .SH DESCRIPTION .PP The \fBoption\fR command allows you to add entries to the Tk option | | > | > > > < | < | < | < | | 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 | \fBoption get \fIwindow name class\fR \fBoption readfile \fIfileName \fR?\fIpriority\fR? .fi .BE .SH DESCRIPTION .PP The \fBoption\fR command allows you to add entries to the Tk option database or to retrieve options from the database. .\" METHOD: add The \fBadd\fR form of the command adds a new option to the database. \fIPattern\fR contains the option being specified, and consists of names and/or classes separated by asterisks or dots, in the usual X format (see \fBPATTERN FORMAT\fR). \fIValue\fR contains a text string to associate with \fIpattern\fR; this is the value that will be returned in calls to \fBTk_GetOption\fR or by invocations of the \fBoption get\fR command. If \fIpriority\fR is specified, it indicates the priority level for this option (see below for legal values); it defaults to \fBinteractive\fR. This command always returns an empty string. .PP .\" METHOD: clear The \fBoption clear\fR command clears the option database. Default options (from the \fBRESOURCE_MANAGER\fR property or the \fB.Xdefaults\fR file) will be reloaded automatically the next time an option is added to the database or removed from it. This command always returns an empty string. .PP .\" METHOD: get The \fBoption get\fR command returns the value of the option specified for \fIwindow\fR under \fIname\fR and \fIclass\fR. If several entries in the option database match \fIwindow\fR, \fIname\fR, and \fIclass\fR, then the command returns whichever was created with highest \fIpriority\fR level. If there are several matching entries at the same priority level, then it returns whichever entry was most recently entered into the option database. If there are no matching entries, then the empty string is returned. .PP .\" METHOD: readfile The \fBreadfile\fR form of the command reads \fIfileName\fR, which should have the standard format for an X resource database such as \fB.Xdefaults\fR, and adds all the options specified in that file to the option database. If \fIpriority\fR is specified, it indicates the priority level at which to enter the options; \fIpriority\fR defaults to \fBinteractive\fR. .PP The file is read through a channel which is in "utf-8" encoding, invalid byte sequences are automatically converted to valid ones. This means that encodings like ISO 8859-1 or cp1252 with high probability will work as well, but this cannot be guaranteed. This cannot be changed, setting the [encoding system] has no effect. .PP The \fIpriority\fR arguments to the \fBoption\fR command are normally specified symbolically using one of the following values: .IP \fBwidgetDefault\fR3 Level 20. Used for default values hard-coded into widgets. .IP \fBstartupFile\fR Level 40. Used for options specified in application-specific startup files. .IP \fBuserDefault\fR Level 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 \fBinteractive\fR Level 80. Used for options specified interactively after the application starts running. If \fIpriority\fR is not specified, it defaults to this level. .PP Any of the above keywords may be abbreviated. In addition, priorities may be specified numerically using integers between 0 and 100, inclusive. The numeric form is probably a bad idea except for new priority |
︙ | ︙ |
Changes to doc/options.n.
︙ | ︙ | |||
56 57 58 59 60 61 62 | This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). .OP \-activeforeground activeForeground Background Specifies foreground color to use when drawing active elements. See above for definition of active elements. .OP \-activerelief activeRelief Relief Specifies the 3-D effect desired for the active item of the widget. | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). .OP \-activeforeground activeForeground Background Specifies foreground color to use when drawing active elements. See above for definition of active elements. .OP \-activerelief activeRelief Relief Specifies the 3-D effect desired for the active item of the widget. See the \fB\-relief\fR option for details. .OP \-anchor anchor Anchor Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the values \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. For example, \fBnw\fR means display the information such that its top-left corner is at the top-left corner of the widget. |
︙ | ︙ | |||
288 289 290 291 292 293 294 | If the value has any other form, then the traversal scripts take the value, append the name of the window to it (with a separator space), and evaluate the resulting string as a Tcl script. The script must return \fB0\fR, \fB1\fR, or an empty string: a \fB0\fR or \fB1\fR value specifies whether the window will receive the input focus, and an empty string results in the default decision described above. | | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | If the value has any other form, then the traversal scripts take the value, append the name of the window to it (with a separator space), and evaluate the resulting string as a Tcl script. The script must return \fB0\fR, \fB1\fR, or an empty string: a \fB0\fR or \fB1\fR value specifies whether the window will receive the input focus, and an empty string results in the default decision described above. Note that this interpretation of the option is defined entirely by the Tcl scripts that implement traversal: the widget implementations ignore the option entirely, so you can change its meaning if you redefine the keyboard traversal scripts. .OP \-text text Text Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as \fB\-anchor\fR or \fB\-justify\fR. |
︙ | ︙ | |||
312 313 314 315 316 317 318 | in widgets such as scrollbars and scales. This option is ignored for scrollbars on Windows (native widget does not recognize this option). .OP \-underline underline Underline Specifies the integer index of a character to underline in the widget. This option is used by the default bindings to implement keyboard traversal for menu buttons and menu entries. 0 corresponds to the first character of the text displayed in the | | > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | in widgets such as scrollbars and scales. This option is ignored for scrollbars on Windows (native widget does not recognize this option). .OP \-underline underline Underline Specifies the integer index of a character to underline in the widget. This option is used by the default bindings to implement keyboard traversal for menu buttons and menu entries. 0 corresponds to the first character of the text displayed in the widget, 1 to the next character, and so on. \fBend\fR corresponds to the last character, \fBend\fR-1 to the before last character, and so on. .OP \-wraplength wrapLength WrapLength For widgets that can perform word-wrapping, this option specifies the maximum line length. Lines that would exceed this length are wrapped onto the next line, so that no line is longer than the specified length. The value may be specified in any of the standard forms for screen distances. |
︙ | ︙ |
Deleted doc/pack-old.n.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to doc/pack.n.
︙ | ︙ | |||
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 | The \fBpack\fR command is used to communicate with the packer, a geometry manager that arranges the children of a parent by packing them in order around the edges of the parent. The \fBpack\fR command can have any of several forms, depending on the \fIoption\fR argument: .TP \fBpack \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? If the first argument to \fBpack\fR is a window name (any value starting with .QW . ), then the command is processed in the same way as \fBpack configure\fR. .TP \fBpack configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? The arguments consist of the names of one or more content windows followed by pairs of arguments that specify how to manage the content. See \fBTHE PACKER ALGORITHM\fR below for details on how the options are used by the packer. The following options are supported: .RS .TP \fB\-after \fIother\fR \fIOther\fR must the name of another window. Use its container as the container for the content, and insert the content just after \fIother\fR in the packing order. .TP \fB\-anchor \fIanchor\fR \fIAnchor\fR must be a valid anchor position such as \fBn\fR or \fBsw\fR; it specifies where to position each content in its parcel. Defaults to \fBcenter\fR. .TP \fB\-before \fIother\fR \fIOther\fR must the name of another window. Use its container as the container for the content, and insert the content just before \fIother\fR in the packing order. .TP \fB\-expand \fIboolean\fR Specifies whether the content should be expanded to consume extra space in their container. \fIBoolean\fR may have any proper boolean value, such as \fB1\fR or \fBno\fR. Defaults to 0. .TP \fB\-fill \fIstyle\fR If a content's parcel is larger than its requested dimensions, this option may be used to stretch the content. \fIStyle\fR must have one of the following values: .RS | > > > > > > > > > > > > > < | < | < | < | > > > > > > > > > > > > > > > > > > > > > > | | | > > > > | < < < < < | | 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 | The \fBpack\fR command is used to communicate with the packer, a geometry manager that arranges the children of a parent by packing them in order around the edges of the parent. The \fBpack\fR command can have any of several forms, depending on the \fIoption\fR argument: .TP \fBpack \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? . If the first argument to \fBpack\fR is a window name (any value starting with .QW . ), then the command is processed in the same way as \fBpack configure\fR. .\" METHOD: configure .TP \fBpack configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR? . The arguments consist of the names of one or more content windows followed by pairs of arguments that specify how to manage the content. See \fBTHE PACKER ALGORITHM\fR below for details on how the options are used by the packer. The following options are supported: .RS .\" OPTION: -after .TP \fB\-after \fIother\fR . \fIOther\fR must the name of another window. Use its container as the container for the content, and insert the content just after \fIother\fR in the packing order. .\" OPTION: -anchor .TP \fB\-anchor \fIanchor\fR . \fIAnchor\fR must be a valid anchor position such as \fBn\fR or \fBsw\fR; it specifies where to position each content in its parcel. Defaults to \fBcenter\fR. .\" OPTION: -before .TP \fB\-before \fIother\fR . \fIOther\fR must the name of another window. Use its container as the container for the content, and insert the content just before \fIother\fR in the packing order. .\" OPTION: -expand .TP \fB\-expand \fIboolean\fR . Specifies whether the content should be expanded to consume extra space in their container. \fIBoolean\fR may have any proper boolean value, such as \fB1\fR or \fBno\fR. Defaults to 0. .\" OPTION: -fill .TP \fB\-fill \fIstyle\fR . If a content's parcel is larger than its requested dimensions, this option may be used to stretch the content. \fIStyle\fR must have one of the following values: .RS .IP \fBnone\fR Give the content its requested dimensions plus any internal padding requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default. .IP \fBx\fR Stretch the content horizontally to fill the entire width of its parcel (except leave external padding as specified by \fB\-padx\fR). .IP \fBy\fR Stretch the content vertically to fill the entire height of its parcel (except leave external padding as specified by \fB\-pady\fR). .IP \fBboth\fR Stretch the content both horizontally and vertically. .RE .\" OPTION: -in .TP \fB\-in \fIcontainer\fR . Insert the window at the end of the packing order for the container window given by \fIcontainer\fR. .\" OPTION: -ipadx .TP \fB\-ipadx \fIamount\fR . \fIAmount\fR specifies how much horizontal internal padding to leave on each side of the content. \fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR. It defaults to 0. .\" OPTION: -ipady .TP \fB\-ipady \fIamount\fR . \fIAmount\fR specifies how much vertical internal padding to leave on each side of the content. \fIAmount\fR defaults to 0. .\" OPTION: -padx .TP \fB\-padx \fIamount\fR . \fIAmount\fR specifies how much horizontal external padding to leave on each side of the content. \fIAmount\fR may be a list of two values to specify padding for left and right separately. \fIAmount\fR defaults to 0. .\" OPTION: -pady .TP \fB\-pady \fIamount\fR . \fIAmount\fR specifies how much vertical external padding to leave on each side of the content. \fIAmount\fR may be a list of two values to specify padding for top and bottom separately. \fIAmount\fR defaults to 0. .\" OPTION: -side .TP \fB\-side \fIside\fR . Specifies which side of the container the content will be packed against. Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. Defaults to \fBtop\fR. .LP If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified then each of the content will be inserted at the end of the packing list for its parent unless it is already managed by the packer (in which case it will be left where it is). If one of these options is specified then all the content will be inserted at the specified point. If any of the content are already managed by the geometry manager then any unspecified options for them retain their previous values rather than receiving default values. .RE .\" METHOD: content .TP \fBpack content \fIwindow\fR . 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. .\" METHOD: forget .TP \fBpack forget \fIwindow \fR?\fIwindow ...\fR? . Removes each of the \fIwindow\fRs from the packing order for its container and unmaps their windows. The content will no longer be managed by the packer. .RS .PP .VS "TIP 518" If the last content window of the container becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the container; the container may choose to resize itself (or otherwise respond) to such a change. .VE "TIP 518" .RE .\" METHOD: info .TP \fBpack info \fIwindow\fR . Returns a list whose elements are the current configuration state of the window given by \fIwindow\fR in the same option-value form that might be specified to \fBpack configure\fR. The first two elements of the list are .QW "\fB\-in \fIcontainer\fR" where \fIcontainer\fR is the window's container. .\" METHOD: propagate .TP \fBpack propagate \fIcontainer\fR ?\fIboolean\fR? . If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR then propagation is enabled for \fIcontainer\fR, which must be a window name (see \fBGEOMETRY PROPAGATION\fR below). If \fIboolean\fR has a false boolean value then propagation is disabled for \fIcontainer\fR. In either of these cases an empty string is returned. If \fIboolean\fR is omitted then the command returns \fB0\fR or \fB1\fR to indicate whether propagation is currently enabled for \fIcontainer\fR. Propagation is enabled by default. .\" METHOD: slaves .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. |
︙ | ︙ | |||
269 270 271 272 273 274 275 | will be highest in the stacking order. Or, you can use the \fBraise\fR and \fBlower\fR commands to change the stacking order of either the container or the content. .SH EXAMPLE .PP .CS # Make the widgets | | | | | | | | | | | 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 | will be highest in the stacking order. Or, you can use the \fBraise\fR and \fBlower\fR commands to change the stacking order of either the container or the content. .SH EXAMPLE .PP .CS # Make the widgets label .t -text "This widget is at the top" -bg red label .b -text "This widget is at the bottom" -bg green label .l -text "Left\enHand\enSide" label .r -text "Right\enHand\enSide" text .mid \&.mid insert end "This layout is like Java's BorderLayout" # Lay them out \fBpack\fR .t -side top -fill x \fBpack\fR .b -side bottom -fill x \fBpack\fR .l -side left -fill y \fBpack\fR .r -side right -fill y \fBpack\fR .mid -expand 1 -fill both .CE .SH "SEE ALSO" grid(n), place(n) .SH KEYWORDS geometry manager, location, packer, parcel, propagation, size '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/palette.n.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 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. '\" .TH tk_setPalette n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_setPalette, tk_bisque \- Modify the Tk color palette .SH SYNOPSIS \fBtk_setPalette \fIbackground\fR | > < < > | 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 | '\" '\" Copyright (c) 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. '\" .TH tk_setPalette n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_setPalette, tk_bisque \- Modify the Tk color palette .SH SYNOPSIS .nf \fBtk_setPalette \fIbackground\fR \fBtk_setPalette \fIname value \fR?\fIname value ...\fR? \fBtk_bisque\fR .fi .BE .SH DESCRIPTION .PP The \fBtk_setPalette\fR procedure changes the color scheme for Tk. It does this by modifying the colors of existing widgets and by changing the option database so that future widgets will use the new color scheme. If \fBtk_setPalette\fR is invoked with a single argument, the |
︙ | ︙ |
Changes to doc/panedwindow.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH panedwindow n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME panedwindow \- Create and manipulate 'panedwindow' split container widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH panedwindow n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME panedwindow \- Create and manipulate 'panedwindow' split container widgets .SH SYNOPSIS \fBpanedwindow\fI pathName \fR?\fIoptions\fR? .SO \-background \-borderwidth \-cursor \-orient \-relief .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-handlepad handlePad HandlePad When sash handles are drawn, specifies the distance from the top or |
︙ | ︙ | |||
34 35 36 37 38 39 40 | or if resizing should be deferred until the sash is placed (false). In the latter case, a .QW ghost version of the sash is displayed during the resizing to show where the panes will be resized to when releasing the mouse button. This .QW ghost version of the sash is the proxy. It's rendering can be configured | | | | | | 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 | or if resizing should be deferred until the sash is placed (false). In the latter case, a .QW ghost version of the sash is displayed during the resizing to show where the panes will be resized to when releasing the mouse button. This .QW ghost version of the sash is the proxy. It's rendering can be configured using the \fB\-proxybackground\fR, \fB\-proxyborderwidth\fR and \fB\-proxyrelief\fR options. .OP \-proxybackground proxyBackground ProxyBackground Background color to use when drawing the proxy. If an empty string, the value of the \fB\-background\fR option will be used. .OP \-proxyborderwidth proxyBorderWidth ProxyBorderWidth Specifies the borderwidth of the proxy. May be any value accepted by \fBTk_GetPixels\fR. .OP \-proxyrelief proxyRelief ProxyRelief Relief to use when drawing the proxy. May be any of the standard Tk relief values. If an empty string, the value of the \fB\-sashrelief\fR option will be used. .OP \-sashcursor sashCursor SashCursor Mouse cursor to use when over a sash. If null, \fBsb_h_double_arrow\fR will be used for horizontal panedwindows, and \fBsb_v_double_arrow\fR will be used for vertical panedwindows. .OP \-sashpad sashPad SashPad Specifies the amount of padding to leave of each side of a sash. May |
︙ | ︙ | |||
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 | .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for panedwindow widgets: .TP \fIpathName \fBadd \fIwindow \fR?\fIwindow ...\fR? ?\fIoption value ...\fR? . Add one or more windows to the panedwindow, each in a separate pane. The arguments consist of the names of one or more windows followed by pairs of arguments that specify how to manage the windows. \fIOption\fR may have any of the values accepted by the \fBconfigure\fR subcommand. .TP \fIpathName \fBcget \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 \fBpanedwindow\fR command. .TP \fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBpanedwindow\fR command. .TP \fIpathName \fBforget \fIwindow \fR?\fIwindow ...\fR? . Remove the pane containing \fIwindow\fR from the panedwindow. All geometry management options for \fIwindow\fR will be forgotten. .TP \fIpathName \fBidentify \fIx y\fR . Identify the panedwindow component underneath the point given by \fIx\fR and \fIy\fR, in window coordinates. If the point is over a sash or a sash handle, the result is a two element list containing the index of the sash or handle, and a word indicating whether it is over a sash or a handle, such as {0 sash} or {2 handle}. If the point is over any other part of the panedwindow, the result is an empty list. .TP \fIpathName \fBpanecget \fIwindow option\fR . Query a management option for \fIwindow\fR. \fIOption\fR may be any value allowed by the \fBpaneconfigure\fR subcommand. .TP \fIpathName \fBpaneconfigure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the management options for \fIwindow\fR. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget option(s) to have the given value(s); in this case the command returns an empty string. The following options are supported: .RS .TP \fB\-after \fIwindow\fR . Insert the window after the window specified. \fIwindow\fR should be the name of a window already managed by \fIpathName\fR. .TP \fB\-before \fIwindow\fR . Insert the window before the window specified. \fIwindow\fR should be the name of a window already managed by \fIpathName\fR. .TP \fB\-height \fIsize\fR . Specify a height for the window. The height will be the outer dimension of the window including its border, if any. If \fIsize\fR is an empty string, or if \fB\-height\fR is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR. .TP \fB\-hide \fIboolean\fR . Controls the visibility of a pane. When the \fIboolean\fR is true (according to \fBTcl_GetBoolean\fR) the pane will not be visible, but it will still be maintained in the list of panes. .TP \fB\-minsize \fIn\fR . Specifies that the size of the window cannot be made less than \fIn\fR. This constraint only affects the size of the widget in the paned dimension \(em the x dimension for horizontal panedwindows, the y dimension for vertical panedwindows. May be any value accepted by \fBTk_GetPixels\fR. .TP \fB\-padx \fIn\fR . Specifies a non-negative value indicating how much extra space to leave on each side of the window in the X-direction. The value may have any of the forms accepted by \fBTk_GetPixels\fR. .TP \fB\-pady \fIn\fR . Specifies a non-negative value indicating how much extra space to leave on each side of the window in the Y-direction. The value may have any of the forms accepted by \fBTk_GetPixels\fR. .TP \fB\-sticky \fIstyle\fR . If a window's pane is larger than the requested dimensions of the window, this option may be used to position (or stretch) the window within its pane. \fIStyle\fR is a string that contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. The string can optionally contains spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the window will .QW stick to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are specified, the window will be stretched to fill the entire height (or width) of its cavity. .TP \fB\-stretch \fIwhen\fR . Controls how extra space is allocated to each of the panes. \fIWhen\fR is one of \fBalways\fR, \fBfirst\fR, \fBlast\fR, \fBmiddle\fR, and \fBnever\fR. The panedwindow will calculate the required size of all its panes. Any remaining (or deficit) space will be distributed to those panes marked for stretching. The space will be distributed based on each panes current ratio of the whole. The \fIwhen\fR values have the following definition: .RS | > > > > > > > > > > > > > > > > < | < < | < < | < < | < < | < > > > | 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 | .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for panedwindow widgets: .\" METHOD: add .TP \fIpathName \fBadd \fIwindow \fR?\fIwindow ...\fR? ?\fIoption value ...\fR? . Add one or more windows to the panedwindow, each in a separate pane. The arguments consist of the names of one or more windows followed by pairs of arguments that specify how to manage the windows. \fIOption\fR may have any of the values accepted by the \fBconfigure\fR subcommand. .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBpanedwindow\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBpanedwindow\fR command. .\" METHOD: forget .TP \fIpathName \fBforget \fIwindow \fR?\fIwindow ...\fR? . Remove the pane containing \fIwindow\fR from the panedwindow. All geometry management options for \fIwindow\fR will be forgotten. .\" METHOD: identify .TP \fIpathName \fBidentify \fIx y\fR . Identify the panedwindow component underneath the point given by \fIx\fR and \fIy\fR, in window coordinates. If the point is over a sash or a sash handle, the result is a two element list containing the index of the sash or handle, and a word indicating whether it is over a sash or a handle, such as {0 sash} or {2 handle}. If the point is over any other part of the panedwindow, the result is an empty list. .\" METHOD: panecget .TP \fIpathName \fBpanecget \fIwindow option\fR . Query a management option for \fIwindow\fR. \fIOption\fR may be any value allowed by the \fBpaneconfigure\fR subcommand. .\" METHOD: paneconfigure .TP \fIpathName \fBpaneconfigure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the management options for \fIwindow\fR. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget option(s) to have the given value(s); in this case the command returns an empty string. The following options are supported: .RS .\" OPTION: -after .TP \fB\-after \fIwindow\fR . Insert the window after the window specified. \fIwindow\fR should be the name of a window already managed by \fIpathName\fR. .\" OPTION: -before .TP \fB\-before \fIwindow\fR . Insert the window before the window specified. \fIwindow\fR should be the name of a window already managed by \fIpathName\fR. .\" OPTION: -height .TP \fB\-height \fIsize\fR . Specify a height for the window. The height will be the outer dimension of the window including its border, if any. If \fIsize\fR is an empty string, or if \fB\-height\fR is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR. .\" OPTION: -hide .TP \fB\-hide \fIboolean\fR . Controls the visibility of a pane. When the \fIboolean\fR is true (according to \fBTcl_GetBoolean\fR) the pane will not be visible, but it will still be maintained in the list of panes. .\" OPTION: -minsize .TP \fB\-minsize \fIn\fR . Specifies that the size of the window cannot be made less than \fIn\fR. This constraint only affects the size of the widget in the paned dimension \(em the x dimension for horizontal panedwindows, the y dimension for vertical panedwindows. May be any value accepted by \fBTk_GetPixels\fR. .\" OPTION: -padx .TP \fB\-padx \fIn\fR . Specifies a non-negative value indicating how much extra space to leave on each side of the window in the X-direction. The value may have any of the forms accepted by \fBTk_GetPixels\fR. .\" OPTION: -pady .TP \fB\-pady \fIn\fR . Specifies a non-negative value indicating how much extra space to leave on each side of the window in the Y-direction. The value may have any of the forms accepted by \fBTk_GetPixels\fR. .\" OPTION: -sticky .TP \fB\-sticky \fIstyle\fR . If a window's pane is larger than the requested dimensions of the window, this option may be used to position (or stretch) the window within its pane. \fIStyle\fR is a string that contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. The string can optionally contains spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the window will .QW stick to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are specified, the window will be stretched to fill the entire height (or width) of its cavity. .\" OPTION: -stretch .TP \fB\-stretch \fIwhen\fR . Controls how extra space is allocated to each of the panes. \fIWhen\fR is one of \fBalways\fR, \fBfirst\fR, \fBlast\fR, \fBmiddle\fR, and \fBnever\fR. The panedwindow will calculate the required size of all its panes. Any remaining (or deficit) space will be distributed to those panes marked for stretching. The space will be distributed based on each panes current ratio of the whole. The \fIwhen\fR values have the following definition: .RS .IP \fBalways\fR This pane will always stretch. .IP \fBfirst\fR Only if this pane is the first pane (left-most or top-most) will it stretch. .IP \fBlast\fR Only if this pane is the last pane (right-most or bottom-most) will it stretch. This is the default value. .IP \fBmiddle\fR Only if this pane is not the first or last pane will it stretch. .IP \fBnever\fR This pane will never stretch. .RE .\" OPTION: -width .TP \fB\-width \fIsize\fR . Specify a width for the window. The width will be the outer dimension of the window including its border, if any. If \fIsize\fR is an empty string, or if \fB\-width\fR is not specified, then the width requested internally by the window will be used initially; the width may later be adjusted by the movement of sashes in the panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR. .RE .\" METHOD: panes .TP \fIpathName \fBpanes\fR . Returns an ordered list of the widgets managed by \fIpathName\fR. .\" METHOD: proxy .TP \fIpathName \fBproxy \fR?\fIargs\fR? . This command is used to query and change the position of the sash proxy, used for rubberband-style pane resizing. It can take any of the following forms: .RS |
︙ | ︙ | |||
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | . Remove the proxy from the display. .TP \fIpathName \fBproxy place \fIx y\fR . Place the proxy at the given \fIx\fR and \fIy\fR coordinates. .RE .TP \fIpathName \fBsash \fR?\fIargs\fR? This command is used to query and change the position of sashes in the panedwindow. It can take any of the following forms: .RS .TP \fIpathName \fBsash coord \fIindex\fR . Return the current x and y coordinate pair for the sash given by | > > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | . Remove the proxy from the display. .TP \fIpathName \fBproxy place \fIx y\fR . Place the proxy at the given \fIx\fR and \fIy\fR coordinates. .RE .\" METHOD: sash .TP \fIpathName \fBsash \fR?\fIargs\fR? . This command is used to query and change the position of sashes in the panedwindow. It can take any of the following forms: .RS .TP \fIpathName \fBsash coord \fIindex\fR . Return the current x and y coordinate pair for the sash given by |
︙ | ︙ |
Changes to doc/photo.n.
︙ | ︙ | |||
39 40 41 42 43 44 45 | internally in full color (32 bits per pixel), and is displayed using dithering if necessary. Image data for a photo image can be obtained from a file or a string, or it can be supplied from C code through a procedural interface. At present, only .VS 8.6 PNG, .VE 8.6 | > > > > | | > > | > > > > > > > > > > > > > > > > | 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 | internally in full color (32 bits per pixel), and is displayed using dithering if necessary. Image data for a photo image can be obtained from a file or a string, or it can be supplied from C code through a procedural interface. At present, only .VS 8.6 PNG, .VE 8.6 GIF, PPM/PGM, .VS 8.7 and (read-only) SVG .VE 8.7 formats are supported, but an interface exists to allow additional image file formats to be added easily. A photo image is (semi)transparent if the image data it was obtained from had transparency information. In regions where no image data has been supplied, it is fully transparent. Transparency may also be modified with the \fBtransparency set\fR subcommand. .SH "CREATING PHOTOS" .PP Like all images, photos are created using the \fBimage create\fR command. Photos support the following \fIoptions\fR: .\" OPTION: -data .TP \fB\-data \fIstring\fR . Specifies the contents of the image as a string. .VS 8.7 The string should contain data in the default list-of-lists form, .VE 8.7 binary data or, for some formats, base64-encoded data (this is currently guaranteed to be supported for PNG and GIF images). The format of the string must be one of those for which there is an image file format handler that will accept string data. If both the \fB\-data\fR and \fB\-file\fR options are specified, the \fB\-file\fR option takes precedence. .\" OPTION: -format .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the file format for the data specified with the \fB\-data\fR or \fB\-file\fR option and optional arguments passed to the format handler. Note that 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. .\" OPTION: -file .TP \fB\-file \fIname\fR . \fIname\fR gives the name of a file that is to be read to supply data for the photo image. The file format must be one of those for which there is an image file format handler that can read data. .\" OPTION: -gamma .TP \fB\-gamma \fIvalue\fR . Specifies that the colors allocated for displaying this image in a window should be corrected for a non-linear display with the specified gamma exponent value. (The intensity produced by most CRT displays is a power function of the input value, to a good approximation; gamma is the exponent and is typically around 2). The value specified must be greater than zero. The default value is one (no correction). In general, values greater than one will make the image lighter, and values less than one will make it darker. .\" OPTION: -height .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 .\" OPTION: -metadata .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 .\" OPTION: -palette .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, specifying the number of shades of gray to use, or three decimal numbers separated by slashes (/), specifying the number of shades of red, green and blue to use, respectively. If the first form (a single number) is used, the image will be displayed in monochrome (i.e., grayscale). .\" OPTION: -width .TP \fB\-width \fInumber\fR . Specifies the width 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 horizontally to fit the data stored in it. |
︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 | of the image, if necessary, to accommodate the data written to the image, unless the user has specified non-zero values for the \fB\-width\fR and/or \fB\-height\fR configuration options, in which case the width and/or height, respectively, of the image will not be changed. .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 | > | > > | > > > > > > | > > > > > > > | > > | > > < > > > > > > > > > > > > > | | | | > | > > > > > > > > > > > | > | > | > > > > > > > > > > > > > > > < | | | < < | | | > > > | > > > > > > > > > > > > > | | | 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 | of the image, if necessary, to accommodate the data written to the image, unless the user has specified non-zero values for the \fB\-width\fR and/or \fB\-height\fR configuration options, in which case the width and/or height, respectively, of the image will not be changed. .PP The following commands are possible for photo images: .\" METHOD: blank .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. .\" METHOD: cget .TP \fIimageName \fBcget\fI option\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. .\" METHOD: configure .TP \fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options for the image. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIimageName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 that setting the \fB\-metadata\fR option without any other option will not invoke the image format driver to recreate the bitmap. .VE 8.7 .\" METHOD: copy .TP \fIimageName \fBcopy\fI sourceImage\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, starting at coordinates (0,0) in \fIimageName\fR. The following options may be specified: .RS .\" OPTION: -from .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular sub-region of the source image to be copied. (\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite corners of the rectangle. If \fIx2\fR and \fIy2\fR are not specified, the default value is the bottom-right corner of the source image. The pixels copied will include the left and top edges of the specified rectangle but not the bottom or right edges. If the \fB\-from\fR option is not given, the default is the whole source image. .\" OPTION: -to .TP \fB\-to \fIx1 y1 x2 y2\fR . Specifies a rectangular sub-region of the destination image to be affected. (\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite corners of the rectangle. If \fIx2\fR and \fIy2\fR are not specified, the default value is (\fIx1,y1\fR) plus the size of the source region (after subsampling and zooming, if specified). If \fIx2\fR and \fIy2\fR are specified, the source region will be replicated if necessary to fill the destination region in a tiled fashion. .\" OPTION: -shrink .TP \fB\-shrink\fR . Specifies that the size of the destination image should be reduced, if necessary, so that the region being copied into is at the bottom-right corner of the image. This option will not affect the width or height of the image if the user has specified a non-zero value for the \fB\-width\fR or \fB\-height\fR configuration option, respectively. .\" OPTION: -zoom .TP \fB\-zoom \fIx y\fR . Specifies that the source region should be magnified by a factor of \fIx\fR in the X direction and \fIy\fR in the Y direction. If \fIy\fR is not given, the default value is the same as \fIx\fR. With this option, each pixel in the source image will be expanded into a block of \fIx\fR x \fIy\fR pixels in the destination image, all the same color. \fIx\fR and \fIy\fR must be greater than 0. .\" OPTION: -subsample .TP \fB\-subsample \fIx y\fR . Specifies that the source image should be reduced in size by using only every \fIx\fRth pixel in the X direction and \fIy\fRth pixel in the Y direction. Negative values will cause the image to be flipped about the Y or X axes, respectively. If \fIy\fR is not given, the default value is the same as \fIx\fR. .\" OPTION: -compositingrule .TP \fB\-compositingrule \fIrule\fR . Specifies how transparent pixels in the source image are combined with the destination image. When a compositing rule of \fIoverlay\fR is set, the old contents of the destination image are visible, as if the source image were printed on a piece of transparent film and placed over the top of the destination. When a compositing rule of \fIset\fR is set, the old contents of the destination image are discarded and the source image is used as-is. The default compositing rule is \fIoverlay\fR. .RE .\" METHOD: data .TP \fIimageName \fBdata\fR ?\fIoption value(s) ...\fR? . Returns image data in the form of a string. .VS 8.7 The format of the string depends on the format handler. By default, a human readable format as a list of lists of pixel data is used, other formats can be chosen with the \fB\-format\fR option. See \fBIMAGE FORMATS\fR below for details. .VE 8.7 The following options may be specified: .RS .\" OPTION: -background .TP \fB\-background\fI color\fR . If the color is specified, the data will not contain any transparency information. In all transparent pixels the color will be replaced by the specified color. .\" OPTION: -format .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the image file format handler to use and, optionally, arguments to the format handler. Specifically, this subcommand searches for the first handler whose name matches an initial substring of \fIformat-name\fR and which has the capability to write a string containing this image data. .VS 8.7 If this option is not given, this subcommand uses the default format that consists of a list (one element per row) of lists (one element per pixel/column) of colors in .QW \fB#\fIrrggbb\fR format (see \fBIMAGE FORMATS\fR below). .VE 8.7 Note that 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. .\" OPTION: -from .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular region of \fIimageName\fR to be returned. If only \fIx1\fR and \fIy1\fR are specified, the region extends from \fI(x1,y1)\fR to the bottom-right corner of \fIimageName\fR. If all four coordinates are given, they specify diagonally opposite corners of the rectangular region, including x1,y1 and excluding x2,y2. The default, if this option is not given, is the whole image. .\" OPTION: -grayscale .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 .\" OPTION: -metadata .TP \fB\-metadata\fI metadata\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 .\" METHOD: get .TP \fIimageName \fBget\fI x 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 255. .\" METHOD: put .TP \fIimageName \fBput\fI data\fR ?\fIoption value(s) ...\fR? . Sets pixels in \fI imageName\fR to the data specified in \fIdata\fR. .VS 8.7 This command searches the list of image file format handlers for a handler that can interpret the data in \fIdata\fR, and then reads the image encoded within into \fIimageName\fR (the destination image). See \fBIMAGE FORMATS\fR below for details on formats for image data. .VE 8.7 The following options may be specified: .RS .\" OPTION: -format .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ..\fR?} . Specifies the format of the image data in \fIdata\fR and, optionally, 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 that 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 .\" OPTION: -metadata .TP \fB\-metadata\fI metadata\fR . A specified \fImetadata\fR is passed to the image format driver when interpreting the data. Note that the current metadata of the image is not passed to the format driver and is not changed by the command. .VE 8.7 .\" OPTION: -to .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 this option, the image data extracted will be tiled so it covers the entire destination rectangle. If the region specified with this option is smaller than the supplied \fIdata\fR, the exceeding data is silently discarded. Note that if \fIdata\fR specifies a single color value, then a region extending to the bottom-right corner represented by (\fIx2\fR,\fIy2\fR) will be filled with that color. .RE .\" METHOD: read .TP \fIimageName \fBread\fI filename\fR ?\fIoption value(s) ...\fR? . Reads image data from the file named \fIfilename\fR into the image. This command first searches the list of image file format handlers for a handler that can interpret the data in \fIfilename\fR, and then reads the image in \fIfilename\fR into \fIimageName\fR (the destination image). The following options may be specified: .RS .\" OPTION: -format .TP \fB\-format {\fIformat-name\fR ?\fIoption value ..\fR?} . Specifies the format of the image data in \fIfilename\fR and, optionally, additional options 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 that 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. .\" OPTION: -from .TP \fB\-from \fIx1 y1 x2 y2\fR . 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 .\" OPTION: -metadata .TP \fB\-metadata\fI metadata\fR . A specified \fImetadata\fR is passed to the image format driver when interpreting the data. Note that the current metadata of the image is not passed to the format driver and is not changed by the command. .VE 8.7 .\" OPTION: -shrink .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 specified a non-zero value for the \fB\-width\fR or \fB\-height\fR configuration option, respectively. .\" OPTION: -to .TP \fB\-to \fIx y\fR . Specifies the coordinates of the top-left corner of the region of \fIimageName\fR into which data from \fIfilename\fR are to be read. The default is (0,0). .RE .\" METHOD: redither .TP \fIimageName \fBredither\fR . The dithering algorithm used in displaying photo images propagates quantization errors from one pixel to its neighbors. If the image data for \fIimageName\fR is supplied in pieces, the dithered image may not be exactly correct. Normally the difference is not noticeable, but if it is a problem, this command can be used to recalculate the dithered image in each window where the image is displayed. .\" METHOD: transparency .TP \fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR? . Allows examination and manipulation of the transparency information in the photo image. Several subcommands are available: .RS .TP \fIimageName \fBtransparency get \fIx y\fR ?\fB\-alpha\fR? .VS 8.7 Returns true if the pixel at (\fIx\fR,\fIy\fR) is fully transparent, false otherwise. If the option \fB\-alpha\fR is passed, returns the alpha value of the pixel instead, as an integer in the range 0 to 255. .VE 8.7 .TP \fIimageName \fBtransparency set \fIx y newVal\fR ?\fB\-alpha\fR? .VS 8.7 Change the transparency of the pixel at (\fIx\fR,\fIy\fR) to \fInewVal.\fR If no additional option is passed, \fInewVal\fR is interpreted as a boolean and the pixel is made fully transparent if that value is true, fully opaque otherwise. If the \fB\-alpha\fR option is passed, \fInewVal\fR is interpreted as an integral alpha value for the pixel, which must be in the range 0 to 255. .VE 8.7 .RE .\" METHOD: write .TP \fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR? . Writes image data from \fIimageName\fR to a file named \fIfilename\fR. The following options may be specified: .RS .\" OPTION: -background .TP \fB\-background\fI color\fR . If the color is specified, the data will not contain any transparency information. In all transparent pixels the color will be replaced by the specified color. .\" OPTION: -format .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the image file format handler to be used to write the data to the file and, optionally, options to pass to the format handler. Specifically, this subcommand searches for the first handler whose name matches an initial substring of \fIformat-name\fR and which has the capability to write an image file. If this option is not given, the format is guessed from the file extension. If that cannot be determined, this subcommand uses the first handler that has the capability to write an image file. Note that 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. .\" OPTION: -from .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular region of \fIimageName\fR to be written to the image file. If only \fIx1\fR and \fIy1\fR are specified, the region extends from \fI(x1,y1)\fR to the bottom-right corner of \fIimageName\fR. If all four coordinates are given, they specify diagonally opposite corners of the rectangular region. The default, if this option is not given, is the whole image. .\" OPTION: -grayscale .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 .\" OPTION: -metadata .TP \fB\-metadata\fI metadata\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 standard Tk distribution comes with handlers for PPM/PGM, PNG, GIF and (read-only) SVG formats, .VS 8.7 as well as the \fBdefault\fR handler to encode/decode image data in a human readable form. .VE 8.7 These handlers are automatically registered on initialization. .PP When reading an image file or processing string data specified with |
︙ | ︙ | |||
500 501 502 503 504 505 506 | .SS "THE DEFAULT IMAGE HANDLER" .PP The \fBdefault\fR image handler cannot be used to read or write data from/to a file. Its sole purpose is to encode and decode image data in string form in a clear text, human readable, form. The \fIimageName\fR \fBdata\fR subcommand uses this handler when no other format is specified. When reading image data from a string with \fIimageName\fR | | | > | > > > > > > | > > | > > < | | > > | | > > | | | > > | > > | | | > > | | > > | > > | | > > | | > > | | > > | 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 | .SS "THE DEFAULT IMAGE HANDLER" .PP The \fBdefault\fR image handler cannot be used to read or write data from/to a file. Its sole purpose is to encode and decode image data in string form in a clear text, human readable, form. The \fIimageName\fR \fBdata\fR subcommand uses this handler when no other format is specified. When reading image data from a string with \fIimageName\fR \fBput\fR or the \fB\-data\fR option, the default handler is treated as the other handlers. .PP Image data in the \fBdefault\fR string format is a (top-to-bottom) list of scan-lines, with each scan-line being a (left-to-right) list of pixel data. Every scan-line has the same length. The color and, optionally, alpha value of each pixel is specified in any of the forms described in the \fBCOLOR FORMATS\fR section below. .VE 8.7 .SS "FORMAT SUBOPTIONS" .PP .VS 8.6 Image formats may support sub-options, which are specified using additional words in the value to the \fB\-format\fR option. These suboptions can affect how image data is read or written to file or string. The nature and values of these options is up to the format handler. The built-in handlers support these suboptions: .\" OPTION -colorformat .VS 8.7 .TP \fBdefault \-colorformat\fI formatType\fR . The option is allowed when writing image data to a string with \fIimageName \fBdata\fR. Specifies the format to use for the color string of each pixel. \fIformatType\fR may be one of: \fBrgb\fR to encode pixel data in the form \fB#\fIRRGGBB\fR, \fBrgba\fR to encode pixel data in the form \fB#\fIRRGGBBAA\fR or \fBlist\fR to encode pixel data as a list with four elements. See \fBCOLOR FORMATS\fR below for details. The default is \fBrgb\fR. .VE 8.7 .\" OPTION -index .TP \fBgif \-index\fI indexValue\fR . The option has effect when reading image data from a file. When parsing a multi-part GIF image, Tk normally only accesses the first image. By giving the \fB\-index\fR sub-option, the \fIindexValue\fR'th value may be used instead. The \fIindexValue\fR must be an integer from 0 up to the number of image parts in the GIF data. .\" OPTION -alpha .TP \fBpng \-alpha\fI alphaValue\fR . The option has effect when reading image data from a file. Specifies an additional alpha filtering for the overall image, which allows the background on which the image is displayed to show through. This usually also has the effect of desaturating the image. The \fIalphaValue\fR must be between 0.0 and 1.0. .\" OPTION -dpi .\" OPTION -scale .\" OPTION -scaletowidth .\" OPTION -scaletoheight .TP \fBsvg \-dpi\fI dpiValue \fB\-scale\fI scaleValue \fB\-scaletowidth\fI width \fB\-scaletoheight\fI height\fR . \fIdpiValue\fR is used in conversion between given coordinates and screen resolution. The value must be greater than 0 and the default value is 96. .PP .RS \fIscaleValue\fR is used to scale the resulting image. The value must be greater than 0 and the default value is 1. \fIwidth\fR and \fIheight\fR are the width or height that the image will be adjusted to. Only one parameter among \fB\-scale\fR, \fB\-scaletowidth\fR and \fB\-scaletoheight\fR can be given at a time and the aspect ratio of the original image is always preserved. The \fBsvg\fR format supports a wide range of SVG features, but the full SVG standard is not available, for instance the 'text' feature is missing and silently ignored when reading the SVG data. The supported SVG features are: .TP \fBelements:\fR . g, path, rect, circle, ellipse, line, polyline, polygon, linearGradient, radialGradient, stop, defs, svg, style .TP \fBattributes:\fR . width, height, viewBox, preserveAspectRatio with none, xMin, xMid, xMax, yMin, yMid, yMax, slice .TP \fBgradient attributes:\fR . gradientUnits with objectBoundingBox, gradientTransform, cx, cy, r fx, fy x1, y1, x2, y2 spreadMethod with pad, reflect or repeat, xlink:href .TP \fBpoly attributes:\fR . points .TP \fBline attributes:\fR . x1, y1, x2, y2 .TP \fBellipse attributes:\fR . cx, cy, rx, ry .TP \fBcircle attributes:\fR . cx, cy, r .TP \fBrectangle attributes:\fR . x, y, width, height, rx, ry .TP \fBpath attributes:\fR . d with m, M, l, L, h, H, v, V, c, C, s, S, q, Q, t, T, a, A, z, Z .TP \fBstyle attributes:\fR . display with none, visibility, hidden, visible, fill with nonzero and evenodd, opacity, fill-opacity, stroke, stroke-width, stroke-dasharray, stroke-dashoffset, stroke-opacity, stroke-linecap with butt, round and square, stroke-linejoin with miter, round and bevel, stroke-miterlimit fill-rule, font-size, transform with matrix, translate, scale, rotate, skewX and skewY, stop-color, stop-opacity, offset, id, class .RE .PP .RS Currently only SVG images reading and conversion into (pixel-based format) photos is supported: Tk does not (yet) support bundling photo images in SVG vector graphics. .RE .VE 8.6 .VS 8.7 .SH "COLOR FORMATS" .PP The default image handler can represent/parse color and alpha values of a pixel in one of the formats listed below. If a color format does not contain transparency information, full opacity is assumed. The |
︙ | ︙ | |||
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | 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 Load an image from a file and tile it to the size of a window, which is useful for producing a tiled background: .PP .CS # These lines should be called once | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | 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 | 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: .IP \fBDPI\fR Horizontal image resolution in DPI as a double value. Supported by format \fBpng\fR. .IP \fBaspect\fR Aspect ratio horizontal divided by vertical as double value. Supported by formats \fBgif\fR and \fBpng\fR. .IP \fBcomment\fR 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 that 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 \fB\-index\fR option of an animated \fBgif\fR file to properly display the subimage sequence. The options are linked to each subimage selected by \fB\-index\fR. .TP \fBdelay time\fI time\fR . Update delay time in 10ms units. This key is only present if the delay time is not 0. .TP \fBdisposal method\fI method\fR . Disposal method of the preceeding image, if given for the current image. Possible values are: \fBdo not dispose\fR, \fBrestore to background color\fR, \fBrestore to previous\fR. .TP \fBuser interaction\fI bool\fR . The key is present with a value of 1, if user interaction is specified. Otherwise, the key is not present. .TP \fBupdate region\fI X0\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 Load an image from a file and tile it to the size of a window, which is useful for producing a tiled background: .PP .CS # These lines should be called once \fBimage create photo\fR untiled -file "theFile.ppm" \fBimage create photo\fR tiled # These lines should be called whenever .someWidget changes # size; a <Configure> binding is useful here set width [winfo width .someWidget] set height [winfo height .someWidget] tiled \fBcopy\fR untiled -to 0 0 $width $height -shrink .CE .PP .VS 8.6 The PNG image loader allows the application of an additional alpha factor during loading, which is useful for generating images suitable for disabled buttons: .PP .CS \fBimage create photo\fR icon -file "icon.png" \fBimage create photo\fR iconDisabled -file "icon.png" \e -format "png -alpha 0.5" button .b -image icon -disabledimage iconDisabled .CE .VE 8.6 .PP .VS 8.7 Create a green box with a simple shadow effect .PP .CS |
︙ | ︙ |
Changes to doc/place.n.
︙ | ︙ | |||
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 | in response to changes in the size of the container. Lastly, the placer allows you to mix these styles of placement so that, for example, the content has a fixed width and height but is centered inside the container. .PP .TP \fBplace \fIwindow option value \fR?\fIoption value ...\fR? Arrange for the placer to manage the geometry of a content whose pathName is \fIwindow\fR. The remaining arguments consist of one or more \fIoption\-value\fR pairs that specify the way in which \fIwindow\fR's geometry is managed. \fIOption\fR may have any of the values accepted by the \fBplace configure\fR command. .TP \fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR? Query or modify the geometry options of the content given by \fIwindow\fR. If no \fIoption\fR is specified, this command returns a list describing the available options (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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. .RS .PP The following \fIoption\-value\fR pairs are supported: .TP \fB\-anchor \fIwhere\fR \fIWhere\fR specifies which point of \fIwindow\fR is to be positioned at the (x,y) location selected by the \fB\-x\fR, \fB\-y\fR, \fB\-relx\fR, and \fB\-rely\fR options. The anchor point is in terms of the outer area of \fIwindow\fR including its border, if any. Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of \fIwindow\fR's border will appear at the given (x,y) location in the container. The anchor position defaults to \fBnw\fR. .TP \fB\-bordermode \fImode\fR \fIMode\fR determines the degree to which borders within the container are used in determining the placement of the content. The default and most common value is \fBinside\fR. In this case the placer considers the area of the container to be the innermost area of the container, inside any border: an option of \fB\-x 0\fR corresponds to an x-coordinate just inside the border and an option of \fB\-relwidth 1.0\fR | > > > > > > > | 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 | in response to changes in the size of the container. Lastly, the placer allows you to mix these styles of placement so that, for example, the content has a fixed width and height but is centered inside the container. .PP .TP \fBplace \fIwindow option value \fR?\fIoption value ...\fR? . Arrange for the placer to manage the geometry of a content whose pathName is \fIwindow\fR. The remaining arguments consist of one or more \fIoption\-value\fR pairs that specify the way in which \fIwindow\fR's geometry is managed. \fIOption\fR may have any of the values accepted by the \fBplace configure\fR command. .\" METHOD: configure .TP \fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the geometry options of the content given by \fIwindow\fR. If no \fIoption\fR is specified, this command returns a list describing the available options (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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. .RS .PP The following \fIoption\-value\fR pairs are supported: .\" OPTION: -anchor .TP \fB\-anchor \fIwhere\fR . \fIWhere\fR specifies which point of \fIwindow\fR is to be positioned at the (x,y) location selected by the \fB\-x\fR, \fB\-y\fR, \fB\-relx\fR, and \fB\-rely\fR options. The anchor point is in terms of the outer area of \fIwindow\fR including its border, if any. Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of \fIwindow\fR's border will appear at the given (x,y) location in the container. The anchor position defaults to \fBnw\fR. .\" OPTION: -bordermode .TP \fB\-bordermode \fImode\fR . \fIMode\fR determines the degree to which borders within the container are used in determining the placement of the content. The default and most common value is \fBinside\fR. In this case the placer considers the area of the container to be the innermost area of the container, inside any border: an option of \fB\-x 0\fR corresponds to an x-coordinate just inside the border and an option of \fB\-relwidth 1.0\fR |
︙ | ︙ | |||
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 | outside its container, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR. Lastly, \fImode\fR may be specified as \fBignore\fR, in which case borders are ignored: the area of the container is considered to be its official X area, which includes any internal border but no external border. A bordermode of \fBignore\fR is probably not very useful. .RE .TP \fB\-height \fIsize\fR \fISize\fR specifies the height for \fIwindow\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The height will be the outer dimension of \fIwindow\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-height\fR or \fB\-relheight\fR option is specified, then the height requested internally by the window will be used. .TP \fB\-in \fIcontainer\fR \fIContainer\fR specifies the path name of the window relative to which \fIwindow\fR is to be placed. \fIContainer\fR must either be \fIwindow\fR's parent or a descendant of \fIwindow\fR's parent. In addition, \fIcontainer\fR and \fIwindow\fR must both be descendants of the same top-level window. These restrictions are necessary to guarantee that \fIwindow\fR is visible whenever \fIcontainer\fR is visible. If this option is not specified then the other window defaults to \fIwindow\fR's parent. .TP \fB\-relheight \fIsize\fR \fISize\fR specifies the height for \fIwindow\fR. In this case the height is specified as a floating-point number relative to the height of the container: 0.5 means \fIwindow\fR will be half as high as the container, 1.0 means \fIwindow\fR will have the same height as the container, and so on. If both \fB\-height\fR and \fB\-relheight\fR are specified for a content, their values are summed. For example, \fB\-relheight 1.0 \-height \-2\fR makes the content 2 pixels shorter than the container. .TP \fB\-relwidth \fIsize\fR \fISize\fR specifies the width for \fIwindow\fR. In this case the width is specified as a floating-point number relative to the width of the container: 0.5 means \fIwindow\fR will be half as wide as the container, 1.0 means \fIwindow\fR will have the same width as the container, and so on. If both \fB\-width\fR and \fB\-relwidth\fR are specified for a content, their values are summed. For example, \fB\-relwidth 1.0 \-width 5\fR makes the content 5 pixels wider than the container. .TP \fB\-relx \fIlocation\fR \fILocation\fR specifies the x-coordinate within the container window of the anchor point for \fIwindow\fR. In this case the location is specified in a relative fashion as a floating-point number: 0.0 corresponds to the left edge of the container and 1.0 corresponds to the right edge of the container. \fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-x\fR and \fB\-relx\fR are specified for a content then their values are summed. For example, \fB\-relx 0.5 \-x \-2\fR positions the left edge of the content 2 pixels to the left of the center of its container. .TP \fB\-rely \fIlocation\fR \fILocation\fR specifies the y-coordinate within the container window of the anchor point for \fIwindow\fR. In this case the value is specified in a relative fashion as a floating-point number: 0.0 corresponds to the top edge of the container and 1.0 corresponds to the bottom edge of the container. \fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-y\fR and \fB\-rely\fR are specified for a content then their values are summed. For example, \fB\-rely 0.5 \-x 3\fR positions the top edge of the content 3 pixels below the center of its container. .TP \fB\-width \fIsize\fR \fISize\fR specifies the width for \fIwindow\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The width will be the outer width of \fIwindow\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-width\fR or \fB\-relwidth\fR option is specified, then the width requested internally by the window will be used. .TP \fB\-x \fIlocation\fR \fILocation\fR specifies the x-coordinate within the container window of the anchor point for \fIwindow\fR. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the container window. .TP \fB\-y \fIlocation\fR \fILocation\fR specifies the y-coordinate within the container window of the anchor point for \fIwindow\fR. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the container window. .PP If the same value is specified separately with two different options, such as \fB\-x\fR and \fB\-relx\fR, then the most recent option is used and the older one is ignored. .RE .TP \fBplace forget \fIwindow\fR Causes the placer to stop managing the geometry of \fIwindow\fR. As a side effect of this command \fIwindow\fR will be unmapped so that it does not appear on the screen. If \fIwindow\fR is not currently managed by the placer then the command has no effect. This command returns an empty string. .TP \fBplace info \fIwindow\fR Returns a list giving the current configuration of \fIwindow\fR. The list consists of \fIoption\-value\fR pairs in exactly the same form as might be specified to the \fBplace configure\fR command. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | | 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 | outside its container, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR. Lastly, \fImode\fR may be specified as \fBignore\fR, in which case borders are ignored: the area of the container is considered to be its official X area, which includes any internal border but no external border. A bordermode of \fBignore\fR is probably not very useful. .RE .\" OPTION: -height .TP \fB\-height \fIsize\fR . \fISize\fR specifies the height for \fIwindow\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The height will be the outer dimension of \fIwindow\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-height\fR or \fB\-relheight\fR option is specified, then the height requested internally by the window will be used. .\" OPTION: -in .TP \fB\-in \fIcontainer\fR . \fIContainer\fR specifies the path name of the window relative to which \fIwindow\fR is to be placed. \fIContainer\fR must either be \fIwindow\fR's parent or a descendant of \fIwindow\fR's parent. In addition, \fIcontainer\fR and \fIwindow\fR must both be descendants of the same top-level window. These restrictions are necessary to guarantee that \fIwindow\fR is visible whenever \fIcontainer\fR is visible. If this option is not specified then the other window defaults to \fIwindow\fR's parent. .\" OPTION: -relheight .TP \fB\-relheight \fIsize\fR . \fISize\fR specifies the height for \fIwindow\fR. In this case the height is specified as a floating-point number relative to the height of the container: 0.5 means \fIwindow\fR will be half as high as the container, 1.0 means \fIwindow\fR will have the same height as the container, and so on. If both \fB\-height\fR and \fB\-relheight\fR are specified for a content, their values are summed. For example, \fB\-relheight 1.0 \-height \-2\fR makes the content 2 pixels shorter than the container. .\" OPTION: -relwidth .TP \fB\-relwidth \fIsize\fR . \fISize\fR specifies the width for \fIwindow\fR. In this case the width is specified as a floating-point number relative to the width of the container: 0.5 means \fIwindow\fR will be half as wide as the container, 1.0 means \fIwindow\fR will have the same width as the container, and so on. If both \fB\-width\fR and \fB\-relwidth\fR are specified for a content, their values are summed. For example, \fB\-relwidth 1.0 \-width 5\fR makes the content 5 pixels wider than the container. .\" OPTION: -relx .TP \fB\-relx \fIlocation\fR . \fILocation\fR specifies the x-coordinate within the container window of the anchor point for \fIwindow\fR. In this case the location is specified in a relative fashion as a floating-point number: 0.0 corresponds to the left edge of the container and 1.0 corresponds to the right edge of the container. \fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-x\fR and \fB\-relx\fR are specified for a content then their values are summed. For example, \fB\-relx 0.5 \-x \-2\fR positions the left edge of the content 2 pixels to the left of the center of its container. .\" OPTION: -rely .TP \fB\-rely \fIlocation\fR . \fILocation\fR specifies the y-coordinate within the container window of the anchor point for \fIwindow\fR. In this case the value is specified in a relative fashion as a floating-point number: 0.0 corresponds to the top edge of the container and 1.0 corresponds to the bottom edge of the container. \fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-y\fR and \fB\-rely\fR are specified for a content then their values are summed. For example, \fB\-rely 0.5 \-x 3\fR positions the top edge of the content 3 pixels below the center of its container. .\" OPTION: -width .TP \fB\-width \fIsize\fR . \fISize\fR specifies the width for \fIwindow\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The width will be the outer width of \fIwindow\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-width\fR or \fB\-relwidth\fR option is specified, then the width requested internally by the window will be used. .\" OPTION: -x .TP \fB\-x \fIlocation\fR . \fILocation\fR specifies the x-coordinate within the container window of the anchor point for \fIwindow\fR. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the container window. .\" OPTION: -y .TP \fB\-y \fIlocation\fR . \fILocation\fR specifies the y-coordinate within the container window of the anchor point for \fIwindow\fR. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the container window. .PP If the same value is specified separately with two different options, such as \fB\-x\fR and \fB\-relx\fR, then the most recent option is used and the older one is ignored. .RE .\" METHOD: content .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. .\" METHOD: forget .TP \fBplace forget \fIwindow\fR . Causes the placer to stop managing the geometry of \fIwindow\fR. As a side effect of this command \fIwindow\fR will be unmapped so that it does not appear on the screen. If \fIwindow\fR is not currently managed by the placer then the command has no effect. This command returns an empty string. .\" METHOD: info .TP \fBplace info \fIwindow\fR . Returns a list giving the current configuration of \fIwindow\fR. The list consists of \fIoption\-value\fR pairs in exactly the same form as might be specified to the \fBplace configure\fR command. .\" METHOD: slaves .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" |
︙ | ︙ | |||
243 244 245 246 247 248 249 | To control the sizes of these windows, make them windows like frames and canvases that provide configuration options for this purpose. .SH EXAMPLE .PP Make the label occupy the middle bit of the toplevel, no matter how it is resized: .CS | | | | > | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | To control the sizes of these windows, make them windows like frames and canvases that provide configuration options for this purpose. .SH EXAMPLE .PP Make the label occupy the middle bit of the toplevel, no matter how it is resized: .CS label .l -text "In the\enMiddle!" -bg black -fg white \fBplace\fR .l -relwidth .3 -relx .35 -relheight .3 -rely .35 .CE .SH "SEE ALSO" grid(n), pack(n) .SH KEYWORDS geometry manager, height, location, container, place, rubber sheet, content, width '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/popup.n.
︙ | ︙ | |||
27 28 29 30 31 32 33 | the given point. .SH EXAMPLE .PP How to attach a simple popup menu to a widget. .CS # Create a menu set m [menu .popupMenu] | | | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | the given point. .SH EXAMPLE .PP How to attach a simple popup menu to a widget. .CS # Create a menu set m [menu .popupMenu] $m add command -label "Example 1" -command bell $m add command -label "Example 2" -command bell # Create something to attach it to pack [label .l -text "Click me!"] # Arrange for the menu to pop up when the label is clicked bind .l <Button-1> {\fBtk_popup\fR .popupMenu %X %Y} .CE .SH "SEE ALSO" bind(n), menu(n), tk_optionMenu(n) .SH KEYWORDS |
︙ | ︙ |
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 | .\" 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 PDF conversion of the canvas data to the printer or to a PDF 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/radiobutton.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH radiobutton n 4.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME radiobutton \- Create and manipulate 'radiobutton' pick-one widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH radiobutton n 4.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME radiobutton \- Create and manipulate 'radiobutton' pick-one widgets .SH SYNOPSIS \fBradiobutton\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-disabledforeground \-padx \-activeforeground \-font \-pady \-anchor \-foreground \-relief \-background \-highlightbackground \-takefocus \-bitmap \-highlightcolor \-text \-borderwidth \-highlightthickness \-textvariable |
︙ | ︙ | |||
61 62 63 64 65 66 67 | raised\fR. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the radiobutton. The empty string is the default value. .OP \-selectcolor selectColor Background Specifies a background color to use when the button is selected. If \fBindicatorOn\fR is true then the color is used as the background for the indicator regardless of the select state. | | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | raised\fR. If the value of this option is the empty string, then no alternative relief is used when the mouse cursor is over the radiobutton. The empty string is the default value. .OP \-selectcolor selectColor Background Specifies a background color to use when the button is selected. If \fBindicatorOn\fR is true then the color is used as the background for the indicator regardless of the select state. If \fB\-indicatoron\fR is false, this color is used as the background for the entire widget, in place of \fB\-background\fR or \fB\-activeBackground\fR, whenever the widget is selected. If specified as an empty string then no special color is used for displaying when the widget is selected. .OP \-selectimage selectImage SelectImage Specifies an image to display (in place of the \fB\-image\fR option) when the radiobutton is selected. This option is ignored unless the \fB\-image\fR option has been |
︙ | ︙ | |||
177 178 179 180 181 182 183 184 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for radiobutton widgets: .TP | > | > > > > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for radiobutton widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBradiobutton\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, the command returns a list describing the 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, the command modifies the given widget 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 \fBradiobutton\fR command. .\" METHOD: deselect .TP \fIpathName \fBdeselect\fR . Deselects the radiobutton and sets the associated variable to an empty string. If this radiobutton was not currently selected, the command has no effect. .\" METHOD: flash .TP \fIpathName \fBflash\fR . Flashes the radiobutton. This is accomplished by redisplaying the radiobutton several times, alternating between active and normal colors. At the end of the flash the radiobutton is left in the same normal/active state as when the command was invoked. This command is ignored if the radiobutton's state is \fBdisabled\fR. .\" METHOD: invoke .TP \fIpathName \fBinvoke\fR . Does just what would have happened if the user invoked the radiobutton with the mouse: selects the button and invokes its associated Tcl command, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the radiobutton. This command is ignored if the radiobutton's state is \fBdisabled\fR. .\" METHOD: select .TP \fIpathName \fBselect\fR . Selects the radiobutton and sets the associated variable to the value corresponding to this widget. .SH BINDINGS .PP |
︙ | ︙ | |||
253 254 255 256 257 258 259 | .PP If the radiobutton's state is \fBdisabled\fR then none of the above actions occur: the radiobutton is completely non-responsive. .PP The behavior of radiobuttons can be changed by defining new bindings for individual widgets or by redefining the class bindings. .SH "SEE ALSO" | | > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | .PP If the radiobutton's state is \fBdisabled\fR then none of the above actions occur: the radiobutton is completely non-responsive. .PP The behavior of radiobuttons can be changed by defining new bindings for individual widgets or by redefining the class bindings. .SH "SEE ALSO" checkbutton(n), labelframe(n), listbox(n), options(n), scale(n), ttk::radiobutton(n) .SH KEYWORDS radiobutton, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/raise.n.
︙ | ︙ | |||
37 38 39 40 41 42 43 | .SH EXAMPLE .PP Make a button appear to be in a sibling frame that was created after it. This is is often necessary when building GUIs in the style where you create your activity widgets first before laying them out on the display: .CS | | | | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | .SH EXAMPLE .PP Make a button appear to be in a sibling frame that was created after it. This is is often necessary when building GUIs in the style where you create your activity widgets first before laying them out on the display: .CS button .b -text "Hi there!" pack [frame .f -background blue] pack [label .f.l1 -text "This is above"] pack .b -in .f pack [label .f.l2 -text "This is below"] \fBraise\fR .b .CE .SH "SEE ALSO" lower(n) .SH KEYWORDS obscure, raise, stacking order '\" Local Variables: |
︙ | ︙ |
Changes to doc/scale.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH scale n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scale \- Create and manipulate 'scale' value-controlled slider widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH scale n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scale \- Create and manipulate 'scale' value-controlled slider widgets .SH SYNOPSIS \fBscale\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-foreground \-relief \-background \-highlightbackground \-repeatdelay \-borderwidth \-highlightcolor \-repeatinterval \-cursor \-highlightthickness \-takefocus \-font \-orient \-troughcolor .SE |
︙ | ︙ | |||
74 75 76 77 78 79 80 | If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the \fB\-activebackground\fR option. .OP \-tickinterval tickInterval TickInterval Must be a real value. Determines the spacing between numerical | | > > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the \fB\-activebackground\fR option. .OP \-tickinterval tickInterval TickInterval Must be a real value. Determines the spacing between numerical tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. If 0, no tick marks will be displayed. .OP \-to to To Specifies a real value corresponding to the right or bottom end of the scale. This value may be either less than or greater than the \fB\-from\fR option. .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the |
︙ | ︙ | |||
139 140 141 142 143 144 145 146 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for scale widgets: .TP | > | > > > > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for scale widgets: .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBscale\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBscale\fR command. .\" METHOD: coords .TP \fIpathName \fBcoords \fR?\fIvalue\fR? . Returns a list whose elements are the x and y coordinates of the point along the centerline of the trough that corresponds to \fIvalue\fR. If \fIvalue\fR is omitted then the scale's current value is used. .\" METHOD: get .TP \fIpathName \fBget\fR ?\fIx y\fR? . If \fIx\fR and \fIy\fR are omitted, returns the current value of the scale. If \fIx\fR and \fIy\fR are specified, they give pixel coordinates within the widget; the command returns the scale value corresponding to the given pixel. Only one of \fIx\fR or \fIy\fR is used: for horizontal scales \fIy\fR is ignored, and for vertical scales \fIx\fR is ignored. .\" METHOD: identify .TP \fIpathName \fBidentify \fIx y\fR . Returns a string indicating what part of the scale lies under the coordinates given by \fIx\fR and \fIy\fR. A return value of \fBslider\fR means that the point is over the slider; \fBtrough1\fR means that the point is over the portion of the slider above or to the left of the slider; and \fBtrough2\fR means that the point is over the portion of the slider below or to the right of the slider. If the point is not over one of these elements, an empty string is returned. .\" METHOD: set .TP \fIpathName \fBset \fIvalue\fR . This command is invoked to change the current value of the scale, and hence the position at which the slider is displayed. \fIValue\fR gives the new value for the scale. The command has no effect if the scale is disabled. |
︙ | ︙ |
Changes to doc/scrollbar.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH scrollbar n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scrollbar \- Create and manipulate 'scrollbar' scrolling control and indicator widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH scrollbar n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scrollbar \- Create and manipulate 'scrollbar' scrolling control and indicator widgets .SH SYNOPSIS \fBscrollbar\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-highlightcolor \-repeatdelay \-background \-highlightthickness \-repeatinterval \-borderwidth \-jump \-takefocus \-cursor \-orient \-troughcolor \-highlightbackground \-relief .SE |
︙ | ︙ | |||
77 78 79 80 81 82 83 | Scrollbars can be used to adjust the view in the associated window by clicking or dragging with the mouse. See the \fBBINDINGS\fR section below for details. .SH "ELEMENTS" .PP A scrollbar displays five elements, which are referred to in the widget commands for the scrollbar: | < | < | < | < | < | > > > > > > > > | 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 | Scrollbars can be used to adjust the view in the associated window by clicking or dragging with the mouse. See the \fBBINDINGS\fR section below for details. .SH "ELEMENTS" .PP A scrollbar displays five elements, which are referred to in the widget commands for the scrollbar: .IP \fBarrow1\fR 10 The top or left arrow in the scrollbar. .IP \fBtrough1\fR 10 The region between the slider and \fBarrow1\fR. .IP \fBslider\fR 10 The rectangle that indicates what is visible in the associated widget. .IP \fBtrough2\fR 10 The region between the slider and \fBarrow2\fR. .IP \fBarrow2\fR 10 The bottom or right arrow in the scrollbar. .SH "WIDGET COMMAND" .PP The \fBscrollbar\fR command creates a new Tcl command whose name is \fIpathName\fR. This command may be used to invoke various operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for scrollbar widgets: .\" METHOD: activate .TP \fIpathName \fBactivate \fR?\fIelement\fR? . Marks the element indicated by \fIelement\fR as active, which causes it to be displayed as specified by the \fB\-activebackground\fR and \fB\-activerelief\fR options. The only element values understood by this command are \fBarrow1\fR, \fBslider\fR, or \fBarrow2\fR. If any other value is specified then no element of the scrollbar will be active. If \fIelement\fR is not specified, the command returns the name of the element that is currently active, or an empty string if no element is active. .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBscrollbar\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBscrollbar\fR command. .\" METHOD: delta .TP \fIpathName \fBdelta \fIdeltaX deltaY\fR . Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in slider position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the slider \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the slider \fIdeltaY\fR pixels down. The arguments and the result may be zero or negative. .\" METHOD: fraction .TP \fIpathName \fBfraction \fIx y\fR . Returns a real number between 0 and 1 indicating where the point given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar. The value 0 corresponds to the top or left of the trough, the value 1 corresponds to the bottom or right, 0.5 corresponds to the middle, and so on. \fIX\fR and \fIy\fR must be pixel coordinates relative to the scrollbar widget. If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest point in the trough is used. .\" METHOD: get .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. .\" METHOD: identify .TP \fIpathName \fBidentify \fIx y\fR . Returns the name of the element under the point given by \fIx\fR and \fIy\fR (such as \fBarrow1\fR), or an empty string if the point does not lie in any element of the scrollbar. \fIX\fR and \fIy\fR must be pixel coordinates relative to the scrollbar widget. .\" METHOD: set .TP \fIpathName \fBset \fIfirst last\fR . This command is invoked by the scrollbar's associated widget to tell the scrollbar about the current view in the widget. The command takes two arguments, each of which is a real fraction between 0 and 1. |
︙ | ︙ | |||
199 200 201 202 203 204 205 | the slider, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's \fB\-command\fR option. The command may take any of the following forms. In each case, \fIprefix\fR is the contents of the \fB\-command\fR option, which usually has a form like | | > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | the slider, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's \fB\-command\fR option. The command may take any of the following forms. In each case, \fIprefix\fR is the contents of the \fB\-command\fR option, which usually has a form like .QW "\fB.t yview\fR" . .\" METHOD: moveto .TP \fIprefix \fBmoveto \fIfraction\fR . \fIFraction\fR is a real number between 0 and 1. The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .\" METHOD: scroll .TP \fIprefix \fBscroll \fInumber \fBpages\fR . The widget should adjust its view by \fInumber\fR pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. \fINumber\fR is either 1, which means the next page should become visible, or \-1, which means that the previous page should become visible. Fractional numbers are rounded away from 0, so scrolling 0.001 pages has the same effect as scrolling 1 page. .TP \fIprefix \fBscroll \fInumber \fBunits\fR . The widget should adjust its view by \fInumber\fR units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. \fINumber\fR is either 1, which means one unit should scroll off the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. Fractional numbers are rounded away from 0, so scrolling 0.001 units has the same effect as scrolling 1 unit. .SH BINDINGS .PP Tk automatically creates class bindings for scrollbars that give them the following default behavior. If the behavior is different for vertical and horizontal scrollbars, the horizontal behavior is described in parentheses. .IP [1] |
︙ | ︙ | |||
344 345 346 347 348 349 350 | .IP [14] The End key adjusts the view to the bottom (right edge) of the document. .SH EXAMPLE .PP Create a window with a scrollable \fBtext\fR widget: .CS toplevel .tl | | | | | | | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | .IP [14] The End key adjusts the view to the bottom (right edge) of the document. .SH EXAMPLE .PP Create a window with a scrollable \fBtext\fR widget: .CS toplevel .tl text .tl.t -yscrollcommand {.tl.s set} \fBscrollbar\fR .tl.s -command {.tl.t yview} grid .tl.t .tl.s -sticky nsew grid columnconfigure .tl 0 -weight 1 grid rowconfigure .tl 0 -weight 1 .CE .SH "SEE ALSO" ttk:scrollbar(n) .SH KEYWORDS scrollbar, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/selection.n.
︙ | ︙ | |||
22 23 24 25 26 27 28 29 | .PP Note that for management of the \fBCLIPBOARD\fR selection (see below), the \fBclipboard\fR command may also be used. .PP The first argument to \fBselection\fR determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: .TP | > | > | | 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 | .PP Note that for management of the \fBCLIPBOARD\fR selection (see below), the \fBclipboard\fR command may also be used. .PP The first argument to \fBselection\fR determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: .\" METHOD: clear .TP \fBselection clear\fR ?\fB\-displayof\fI window\fR? ?\fB\-selection\fI selection\fR? . If \fIselection\fR exists anywhere on \fIwindow\fR's display, clear it so that no window owns the selection anymore. \fISelection\fR specifies the X selection that should be cleared, and should be an atom name such as \fBPRIMARY\fR or \fBCLIPBOARD\fR; see the Inter-Client Communication Conventions Manual for complete details. \fISelection\fR defaults to \fBPRIMARY\fR and \fIwindow\fR defaults to .QW . . Returns an empty string. .\" METHOD: get .TP \fBselection get\fR ?\fB\-displayof\fI window\fR? ?\fB\-selection\fI selection\fR? ?\fB\-type\fI type\fR? . Retrieves the value of \fIselection\fR from \fIwindow\fR's display and returns it as a result. \fISelection\fR defaults to \fBPRIMARY\fR and \fIwindow\fR defaults to .QW . . \fIType\fR specifies the form in which the selection is to be returned (the desired |
︙ | ︙ | |||
57 58 59 60 61 62 63 64 | than the selection type; see the ICCCM for all the confusing details). If the selection is returned in a non-string format, such as \fBINTEGER\fR or \fBATOM\fR, the \fBselection\fR command converts it to string format as a collection of fields separated by spaces: atoms are converted to their textual names, and anything else is converted to hexadecimal integers. Note that \fBselection get\fR does not retrieve the selection in the \fBUTF8_STRING\fR format unless told to. .TP | > | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | than the selection type; see the ICCCM for all the confusing details). If the selection is returned in a non-string format, such as \fBINTEGER\fR or \fBATOM\fR, the \fBselection\fR command converts it to string format as a collection of fields separated by spaces: atoms are converted to their textual names, and anything else is converted to hexadecimal integers. Note that \fBselection get\fR does not retrieve the selection in the \fBUTF8_STRING\fR format unless told to. .\" METHOD: handle .TP \fBselection handle\fR ?\fB\-selection\fI s\fR? ?\fB\-type\fI t\fR? ?\fB\-format\fI f\fR? \fIwindow command\fR . Creates a handler for selection requests, such that \fIcommand\fR will be executed whenever selection \fIs\fR is owned by \fIwindow\fR and someone attempts to retrieve it in the form given by type \fIt\fR (e.g. \fIt\fR is specified in the \fBselection get\fR command). \fIS\fR defaults to \fBPRIMARY\fR, \fIt\fR defaults to \fBSTRING\fR, and \fIf\fR defaults to \fBSTRING\fR. If \fIcommand\fR is an empty string |
︙ | ︙ | |||
115 116 117 118 119 120 121 122 | .PP The \fIformat\fR argument is needed only for compatibility with selection requesters that do not use Tk. If Tk is being used to retrieve the selection then the value is converted back to a string at the requesting end, so \fIformat\fR is irrelevant. .RE .TP | > | | | > > > > | > > > | > | > > > > > | > > | > > | > > | | | | | 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 | .PP The \fIformat\fR argument is needed only for compatibility with selection requesters that do not use Tk. If Tk is being used to retrieve the selection then the value is converted back to a string at the requesting end, so \fIformat\fR is irrelevant. .RE .\" METHOD: own .TP \fBselection own\fR ?\fB\-displayof\fI window\fR? ?\fB\-selection\fI selection\fR? .TP \fBselection own\fR ?\fB\-command\fI command\fR? ?\fB\-selection\fI selection\fR? \fIwindow\fR . The first form of \fBselection own\fR returns the path name of the window in this application that owns \fIselection\fR on the display containing \fIwindow\fR, or an empty string if no window in this application owns the selection. \fISelection\fR defaults to \fBPRIMARY\fR and \fIwindow\fR defaults to .QW . . .RS .PP The second form of \fBselection own\fR causes \fIwindow\fR to become the new owner of \fIselection\fR on \fIwindow\fR's display, returning an empty string as result. The existing owner, if any, is notified that it has lost the selection. If \fIcommand\fR is specified, it is a Tcl script to execute when some other window claims ownership of the selection away from \fIwindow\fR. \fISelection\fR defaults to PRIMARY. .RE .SH WIDGET FACILITIES .PP The \fBtext\fR, \fBentry\fR, \fBttk::entry\fR, \fBlistbox\fR, \fBspinbox\fR and \fBttk::spinbox\fR widgets have the option \fB\-exportselection\fR. If a widget has this option set to boolean \fBtrue\fR, then (in an unsafe interpreter) a selection made in the widget is automatically written to the \fBPRIMARY\fR selection. .PP A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR selection to certain widgets. This copy is implemented by a widget binding to the event. The binding script makes appropriate calls to the \fBselection\fR command. .PP .SH PORTABILITY ISSUES .PP On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients. .PP On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its child interpreters which are not safe interpreters. .PP .SH SECURITY .PP A safe interpreter cannot read from the \fBPRIMARY\fR selection because its \fBselection\fR command is hidden. For this reason the \fBPRIMARY\fR selection cannot be written to the Tk widgets of a safe interpreter. .PP A Tk widget can have its option \fB\-exportselection\fR set to boolean \fBtrue\fR, but in a safe interpreter this option has no effect: writing from the widget to the \fBPRIMARY\fR selection is disabled. .PP These are security features. A safe interpreter may run untrusted code, and it is a security risk if this untrusted code can read or write the \fBPRIMARY\fR selection used by other interpreters. .PP .SH EXAMPLES .PP On X11 platforms, one of the standard selections available is the \fBSECONDARY\fR selection. Hardly anything uses it, but here is how to read it using Tk: .PP .CS set selContents [\fBselection get\fR -selection SECONDARY] .CE .PP Many different types of data may be available for a selection; the special type \fBTARGETS\fR allows you to get a list of available types: .PP .CS foreach type [\fBselection get\fR -type TARGETS] { puts "Selection PRIMARY supports type $type" } .CE .PP To claim the selection, you must first set up a handler to supply the data for the selection. Then you have to claim the selection... .CS # Set up the data handler ready for incoming requests set foo "This is a string with some data in it... blah blah" \fBselection handle\fR -selection SECONDARY . getData proc getData {offset maxChars} { puts "Retrieving selection starting at $offset" return [string range $::foo $offset [expr {$offset+$maxChars-1}]] } # Now we grab the selection itself puts "Claiming selection" \fBselection own\fR -command lost -selection SECONDARY . proc lost {} { puts "Lost selection" } .CE .SH "SEE ALSO" clipboard(n) .SH KEYWORDS clear, format, handler, ICCCM, own, selection, target, type '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/send.n.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | contained entirely within the \fIcmd\fR argument. If one or more \fIarg\fRs are present, they are concatenated to form the command to be executed, just as for the \fBeval\fR command. .PP If the initial arguments of the command begin with .QW \- they are treated as options. The following options are currently defined: .TP \fB\-async\fR Requests asynchronous invocation. In this case the \fBsend\fR command will complete immediately without waiting for \fIcmd\fR to complete in the target application; no result will be available and errors in the sent command will be ignored. If the target application is in the same process as the sending application then the \fB\-async\fR option is ignored. .TP | > > > | > > > | 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 | contained entirely within the \fIcmd\fR argument. If one or more \fIarg\fRs are present, they are concatenated to form the command to be executed, just as for the \fBeval\fR command. .PP If the initial arguments of the command begin with .QW \- they are treated as options. The following options are currently defined: .\" OPTION: -async .TP \fB\-async\fR . Requests asynchronous invocation. In this case the \fBsend\fR command will complete immediately without waiting for \fIcmd\fR to complete in the target application; no result will be available and errors in the sent command will be ignored. If the target application is in the same process as the sending application then the \fB\-async\fR option is ignored. .\" OPTION: -displayof .TP \fB\-displayof\fI pathName\fR . Specifies that the target application's main window is on the display of the window given by \fIpathName\fR, instead of the display containing the application's main window. .\" OPTION: -- .TP \fB\-\|\-\fR . Serves no purpose except to terminate the list of options. This option is needed only if \fIapp\fR could contain a leading .QW \- character. .SH "APPLICATION NAMES" .PP The name of an application is set initially from the name of the |
︙ | ︙ | |||
86 87 88 89 90 91 92 | functionality is provided by the \fBdde\fR command instead. .SH EXAMPLE .PP This script fragment can be used to make an application that only runs once on a particular display. .CS if {[tk appname FoobarApp] ne "FoobarApp"} { | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | functionality is provided by the \fBdde\fR command instead. .SH EXAMPLE .PP This script fragment can be used to make an application that only runs once on a particular display. .CS if {[tk appname FoobarApp] ne "FoobarApp"} { \fBsend\fR -async FoobarApp RemoteStart $argv exit } # The command that will be called remotely, which raises # the application main window and opens the requested files proc RemoteStart args { raise . foreach filename $args { |
︙ | ︙ |
Changes to doc/spinbox.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH spinbox n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME spinbox \- Create and manipulate 'spinbox' value spinner widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH spinbox n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME spinbox \- Create and manipulate 'spinbox' value spinner widgets .SH SYNOPSIS \fBspinbox\fI pathName \fR?\fIoptions\fR? .SO \-activebackground \-highlightthickness \-repeatinterval \-background \-insertbackground \-selectbackground \-borderwidth \-insertborderwidth \-selectborderwidth \-cursor \-insertontime \-selectforeground \-exportselection \-insertwidth \-takefocus \-font \-insertofftime \-textvariable |
︙ | ︙ | |||
164 165 166 167 168 169 170 | The \fB\-validatecommand\fR will be called when the spinbox loses focus. .IP \fBkey\fR 10 The \fB\-validatecommand\fR will be called when the spinbox is edited. .IP \fBall\fR 10 The \fB\-validatecommand\fR will be called for all above conditions. .PP It is possible to perform percent substitutions on the \fB\-validatecommand\fR | | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | The \fB\-validatecommand\fR will be called when the spinbox loses focus. .IP \fBkey\fR 10 The \fB\-validatecommand\fR will be called when the spinbox is edited. .IP \fBall\fR 10 The \fB\-validatecommand\fR will be called for all above conditions. .PP It is possible to perform percent substitutions on the \fB\-validatecommand\fR and \fB\-invalidcommand\fR scripts, just as you would in a \fBbind\fR script. The following substitutions are recognized: .PP .IP \fB%d\fR 5 Type of action: 1 for \fBinsert\fR, 0 for \fBdelete\fR, or \-1 for focus, forced or textvariable validation. .IP \fB%i\fR 5 Index of char string to be inserted/deleted, if any, otherwise \-1. .IP \fB%P\fR 5 |
︙ | ︙ | |||
209 210 211 212 213 214 215 | \fB\-validate\fR option will also set itself to \fBnone\fR when you edit the spinbox widget from within either the \fB\-validatecommand\fR or the \fB\-invalidcommand\fR. Such editions will override the one that was being validated. If you wish to edit the value of the widget during validation and still have the \fB\-validate\fR option set, you should include the command .CS | | | | | | | | | > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | 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 | \fB\-validate\fR option will also set itself to \fBnone\fR when you edit the spinbox widget from within either the \fB\-validatecommand\fR or the \fB\-invalidcommand\fR. Such editions will override the one that was being validated. If you wish to edit the value of the widget during validation and still have the \fB\-validate\fR option set, you should include the command .CS \fI%W config -validate %v\fR .CE in the \fB\-validatecommand\fR or \fB\-invalidcommand\fR (whichever one you were editing the spinbox widget from). It is also recommended to not set an 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, then the \fB\-validate\fR option will be automatically set to \fBnone\fR. .SH "WIDGET COMMAND" .PP The \fBspinbox\fR command creates a new Tcl command whose name is \fIpathName\fR. This command may be used to invoke various operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. .SS INDICES .PP Many of the widget commands for spinboxes take one or more indices as arguments. An index specifies a particular character in the spinbox's string, in any of the following ways: .TP 12 \fInumber\fR . Specifies the character as a numerical index, where 0 corresponds to the first character in the string. .TP 12 \fBanchor\fR . Indicates the anchor point for the selection, which is set with the \fBselect from\fR and \fBselect adjust\fR widget commands. .TP 12 \fBend\fR . Indicates the character just after the last one in the spinbox's string. This is equivalent to specifying a numerical index equal to the length of the spinbox's string. .TP 12 \fBinsert\fR . Indicates the character adjacent to and immediately following the insertion cursor. .TP 12 \fBsel.first\fR . Indicates the first character in the selection. It is an error to use this form if the selection is not in the spinbox window. .TP 12 \fBsel.last\fR . Indicates the character just after the last one in the selection. It is an error to use this form if the selection is not in the spinbox window. .TP 12 \fB@\fInumber\fR . In this form, \fInumber\fR is treated as an x-coordinate in the spinbox's window; the character spanning that x-coordinate is used. For example, .QW \fB@0\fR indicates the left-most character in the window. .LP Abbreviations may be used for any of the forms above, e.g. .QW \fBe\fR or .QW \fBsel.f\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. .SS SUBCOMMANDS .PP The following commands are possible for spinbox widgets: .\" METHOD: bbox .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. .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBspinbox\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBspinbox\fR command. .\" METHOD: delete .TP \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR? . Delete one or more elements of the spinbox. \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 an empty string. .\" METHOD: get .TP \fIpathName \fBget\fR . Returns the spinbox's string. .\" METHOD: icursor .TP \fIpathName \fBicursor \fIindex\fR . Arrange for the insertion cursor to be displayed just before the character given by \fIindex\fR. Returns an empty string. .\" METHOD: identify .TP \fIpathName \fBidentify\fI x y\fR . Returns the name of the window element corresponding to coordinates \fIx\fR and \fIy\fR in the spinbox. Return value is one of: \fBnone\fR, \fBbuttondown\fR, \fBbuttonup\fR, \fBentry\fR. .\" METHOD: index .TP \fIpathName \fBindex\fI index\fR . Returns the numerical index corresponding to \fIindex\fR. .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex string\fR . Insert the characters of \fIstring\fR just before the character indicated by \fIindex\fR. Returns an empty string. .\" METHOD: invoke .TP \fIpathName \fBinvoke\fI element\fR . Causes the specified element, either \fBbuttondown\fR or \fBbuttonup\fR, to be invoked, triggering the action associated with it. .\" METHOD: scan .TP \fIpathName \fBscan\fI option args\fR . This command is used to implement scanning on spinboxes. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBscan mark \fIx\fR . Records \fIx\fR and the current view in the spinbox window; used in conjunction with later \fBscan dragto\fR commands. Typically this command is associated with a mouse button press in the widget. It returns an empty string. .TP \fIpathName \fBscan dragto \fIx\fR . This command computes the difference between its \fIx\fR argument and the \fIx\fR argument to the last \fBscan mark\fR command for the widget. It then adjusts the view left or right by 10 times the difference in x-coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the spinbox at high speed through the window. The return value is an empty string. .RE .\" METHOD: selection .TP \fIpathName \fBselection \fIoption arg\fR . This command is used to adjust the selection within a spinbox. It has several forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBselection adjust \fIindex\fR . Locate the end of the selection nearest to the character given by \fIindex\fR, and adjust that end of the selection to be at \fIindex\fR (i.e. including but not going beyond \fIindex\fR). The other end of the selection is made the anchor point for future \fBselect to\fR commands. If the selection is not currently in the spinbox, then a new selection is created to include the characters between \fIindex\fR and the most recent selection anchor point, inclusive. Returns an empty string. .TP \fIpathName \fBselection clear\fR . Clear the selection if it is currently in this widget. If the selection is not in this widget then the command has no effect. Returns an empty string. .TP \fIpathName \fBselection element\fR ?\fIelement\fR? . Sets or gets the currently selected element. If a spinbutton element is specified, it will be displayed depressed. .TP \fIpathName \fBselection from \fIindex\fR . Set the selection anchor point to just before the character given by \fIindex\fR. Does not change the selection. Returns an empty string. .TP \fIpathName \fBselection present\fR . Returns 1 if there is are characters selected in the spinbox, 0 if nothing is selected. .TP \fIpathName \fBselection range \fIstart end\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 spinbox's selection is cleared. .TP \fIpathName \fBselection to \fIindex\fR . If \fIindex\fR is before the anchor point, set the selection to the characters from \fIindex\fR up to but not including the anchor point. If \fIindex\fR is the same as the anchor point, do nothing. If \fIindex\fR is after the anchor point, set the selection to the characters from the anchor point up to but not including \fIindex\fR. The anchor point is determined by the most recent \fBselect from\fR or \fBselect adjust\fR command in this widget. If the selection is not in this widget then a new selection is created using the most recent anchor point specified for the widget. Returns an empty string. .RE .\" METHOD: set .TP \fIpathName \fBset\fR ?\fIstring\fR? . If \fIstring\fR is specified, the spinbox will try and set it to this value, otherwise it just returns the spinbox's string. If validation is on, it will occur when setting the string. .\" METHOD: validate .TP \fIpathName \fBvalidate\fR . This command is used to force an evaluation of the \fB\-validatecommand\fR independent of the conditions specified by the \fB\-validate\fR option. This is done by temporarily setting the \fB\-validate\fR option to \fBall\fR. It returns 0 or 1. .\" METHOD: xview .TP \fIpathName \fBxview \fIargs\fR . This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fBxview\fR . Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the spinbox's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR option. .TP \fIpathName \fBxview \fIindex\fR . Adjusts the view in the window so that the character given by \fIindex\fR is displayed at the left edge of the window. .TP \fIpathName \fBxview moveto\fI fraction\fR . Adjusts the view in the window so that the character \fIfraction\fR of the way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR |
︙ | ︙ |
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 57 58 59 | .\" 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 .BS .SH NAME sysnotify \- Creates a notification window with a title and message. .SH SYNOPSIS \fBtk sysnotify\fI title message\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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | .\" 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 .BS .SH NAME systray \- Creates an icon display in the platform-specific system tray. .SH SYNOPSIS .nf \fBtk systray create \-image \fIimage\fR ?\fB\-text \fItext\fR? ?\fB\-button1 \fIcallback\fR? ?\fB\-button3 \fIcallback\fR? \fBtk systray configure \fI?option? ?value option value ...?\fR \fBtk systray exists\fR \fBtk systray destroy\fR .fi .BE .SH DESCRIPTION .PP .\" METHOD: create 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 .\" METHOD: configure 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 value of this option. When no option is given this command returns the list of all options and their current value. .PP .\" METHOD: exists The \fBtk systray exists\fR command checks whether a systray icon was created. It returns a boolean. .PP .\" METHOD: destroy 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 \e R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== tk systray create -image book -text "tk systray sample" \e -button1 {puts "Here is the tk systray output"} \e -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 \e R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 tk systray configure -image book_page -text "Updated sample" \e -button1 {puts "Different output from the tk systray"} \e -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 \fB\-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.
︙ | ︙ | |||
9 10 11 12 13 14 15 | .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate 'text' hypertext editing widgets .SH SYNOPSIS .nf | | | | | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate 'text' hypertext editing widgets .SH SYNOPSIS .nf \fBtext\fI pathName \fR?\fIoptions\fR? \fBtk_textCopy\fI pathName\fR \fBtk_textCut\fI pathName\fR \fBtk_textPaste\fI pathName\fR .fi .SO \-background \-highlightthickness \-relief \-borderwidth \-insertbackground \-selectbackground \-cursor \-insertborderwidth \-selectborderwidth \-exportselection \-insertofftime \-selectforeground \-font \-insertontime \-setgrid \-foreground \-insertwidth \-takefocus |
︙ | ︙ | |||
225 226 227 228 229 230 231 | .TP 12 \fBend\fR . Indicates the end of the text (the character just after the last newline). .TP 12 \fImark\fR . | | > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | .TP 12 \fBend\fR . Indicates the end of the text (the character just after the last newline). .TP 12 \fImark\fR . Indicates the character just after the mark whose name is \fImark\fR (see \fBMARKS\fR for details). .TP 12 \fItag\fB.first\fR . Indicates the first character in the text that has been tagged with \fItag\fR. This form generates an error if no characters are currently tagged with \fItag\fR. .TP 12 |
︙ | ︙ | |||
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 | as determined by the \fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR options for the text widget. However, display options may be associated with individual tags using the .QW "\fIpathName \fBtag configure\fR" widget command. If a character has been tagged, then the display options associated with the tag override the default display style. The following options are currently supported for tags: .TP \fB\-background \fIcolor\fR . \fIColor\fR specifies the background color to use for characters associated with the tag. It may have any of the forms accepted by \fBTk_GetColor\fR. .TP \fB\-bgstipple \fIbitmap\fR . \fIBitmap\fR specifies a bitmap that is used as a stipple pattern for the background. It may have any of the forms accepted by \fBTk_GetBitmap\fR. If \fIbitmap\fR has not been specified, or if it is specified as an empty string, then a solid fill will be used for the background. .TP \fB\-borderwidth \fIpixels\fR . \fIPixels\fR specifies the width of a border to draw around the tag using any of the forms accepted by \fBTk_GetPixels\fR. This option should be used in conjunction with the \fB\-relief\fR option to provide the desired border. .TP \fB\-elide \fIboolean\fR . \fIElide\fR specifies whether the data should be elided. Elided data (characters, images, embedded windows, etc.) is not displayed and takes no space on screen, but further on behaves just as normal data. .TP \fB\-fgstipple \fIbitmap\fR . \fIBitmap\fR specifies a bitmap that is used as a stipple pattern when drawing text and other foreground information such as underlines. It may have any of the forms accepted by \fBTk_GetBitmap\fR. If \fIbitmap\fR has not been specified, or if it is specified as an empty string, then a solid fill will be used. .TP \fB\-font \fIfontName\fR . \fIFontName\fR is the name of a font to use for drawing characters. It may have any of the forms accepted by \fBTk_GetFont\fR. .TP \fB\-foreground \fIcolor\fR . \fIColor\fR specifies the color to use when drawing text and other foreground information such as underlines. It may have any of the forms accepted by \fBTk_GetColor\fR. .TP \fB\-justify \fIjustify\fR . If the first non-elided character of a display line has a tag for which this option has been specified, then \fIjustify\fR determines how to justify the line. It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR. If a line wraps, then the justification for each line on the display is determined by the first non-elided character of that display line. .TP \fB\-lmargin1 \fIpixels\fR . If the first non-elided character of a text line has a tag for which this option has been specified, then \fIpixels\fR specifies how much the line should be indented from the left edge of the window. \fIPixels\fR may have any of the standard forms for screen distances. If a line of text wraps, this option only applies to the first line on the display; the \fB\-lmargin2\fR option controls the indentation for subsequent lines. .TP \fB\-lmargin2 \fIpixels\fR . If the first non-elided character of a display line has a tag for which this option has been specified, and if the display line is not the first for its text line (i.e., the text line has wrapped), then \fIpixels\fR specifies how much the line should be indented from the left edge of the window. \fIPixels\fR may have any of the standard forms for screen distances. This option is only used when wrapping is enabled, and it only applies to the second and later display lines for a text line. .TP \fB\-lmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not contain characters because they are indented by \fB\-lmargin1\fR or \fB\-lmargin2\fR. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color used is specified by the | > > > > > > > > > > > | | > > > > > > | | > > > > > > > > > > > > | 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 | as determined by the \fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR options for the text widget. However, display options may be associated with individual tags using the .QW "\fIpathName \fBtag configure\fR" widget command. If a character has been tagged, then the display options associated with the tag override the default display style. The following options are currently supported for tags: .\" OPTION: -background .TP \fB\-background \fIcolor\fR . \fIColor\fR specifies the background color to use for characters associated with the tag. It may have any of the forms accepted by \fBTk_GetColor\fR. .\" OPTION: -bgstipple .TP \fB\-bgstipple \fIbitmap\fR . \fIBitmap\fR specifies a bitmap that is used as a stipple pattern for the background. It may have any of the forms accepted by \fBTk_GetBitmap\fR. If \fIbitmap\fR has not been specified, or if it is specified as an empty string, then a solid fill will be used for the background. .\" OPTION: -borderwidth .TP \fB\-borderwidth \fIpixels\fR . \fIPixels\fR specifies the width of a border to draw around the tag using any of the forms accepted by \fBTk_GetPixels\fR. This option should be used in conjunction with the \fB\-relief\fR option to provide the desired border. .\" OPTION: -elide .TP \fB\-elide \fIboolean\fR . \fIElide\fR specifies whether the data should be elided. Elided data (characters, images, embedded windows, etc.) is not displayed and takes no space on screen, but further on behaves just as normal data. .\" OPTION: -fgstipple .TP \fB\-fgstipple \fIbitmap\fR . \fIBitmap\fR specifies a bitmap that is used as a stipple pattern when drawing text and other foreground information such as underlines. It may have any of the forms accepted by \fBTk_GetBitmap\fR. If \fIbitmap\fR has not been specified, or if it is specified as an empty string, then a solid fill will be used. .\" OPTION: -font .TP \fB\-font \fIfontName\fR . \fIFontName\fR is the name of a font to use for drawing characters. It may have any of the forms accepted by \fBTk_GetFont\fR. .\" OPTION: -foreground .TP \fB\-foreground \fIcolor\fR . \fIColor\fR specifies the color to use when drawing text and other foreground information such as underlines. It may have any of the forms accepted by \fBTk_GetColor\fR. .\" OPTION: -justify .TP \fB\-justify \fIjustify\fR . If the first non-elided character of a display line has a tag for which this option has been specified, then \fIjustify\fR determines how to justify the line. It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR. If a line wraps, then the justification for each line on the display is determined by the first non-elided character of that display line. .\" OPTION: -lmargin1 .TP \fB\-lmargin1 \fIpixels\fR . If the first non-elided character of a text line has a tag for which this option has been specified, then \fIpixels\fR specifies how much the line should be indented from the left edge of the window. \fIPixels\fR may have any of the standard forms for screen distances. If a line of text wraps, this option only applies to the first line on the display; the \fB\-lmargin2\fR option controls the indentation for subsequent lines. .\" OPTION: -lmargin2 .TP \fB\-lmargin2 \fIpixels\fR . If the first non-elided character of a display line has a tag for which this option has been specified, and if the display line is not the first for its text line (i.e., the text line has wrapped), then \fIpixels\fR specifies how much the line should be indented from the left edge of the window. \fIPixels\fR may have any of the standard forms for screen distances. This option is only used when wrapping is enabled, and it only applies to the second and later display lines for a text line. .\" OPTION: -lmargincolor .TP \fB\-lmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not contain characters because they are indented by \fB\-lmargin1\fR or \fB\-lmargin2\fR. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color used is specified by the \fB\-background\fR tag option (or, if this is also unspecified, by the \fB\-background\fR widget option). .\" OPTION: -offset .TP \fB\-offset \fIpixels\fR . \fIPixels\fR specifies an amount by which the text's baseline should be offset vertically from the baseline of the overall line, in pixels. For example, a positive offset can be used for superscripts and a negative offset can be used for subscripts. \fIPixels\fR may have any of the standard forms for screen distances. .\" OPTION: -overstrike .TP \fB\-overstrike \fIboolean\fR . Specifies whether or not to draw a horizontal rule through the middle of characters. \fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR. .\" OPTION: -overstrikefg .TP \fB\-overstrikefg \fIcolor\fR . \fIColor\fR specifies the color to use when displaying the overstrike. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color specified by the \fB\-foreground\fR tag option is used. .\" OPTION: -relief .TP \fB\-relief \fIrelief\fR . \fIRelief\fR specifies the relief style to use for drawing the border, in any of the forms accepted by \fBTk_GetRelief\fR. This option is used in conjunction with the \fB\-borderwidth\fR option to enable to the desired border appearance. .\" OPTION: -rmargin .TP \fB\-rmargin \fIpixels\fR . If the first non-elided character of a display line has a tag for which this option has been specified, then \fIpixels\fR specifies how wide a margin to leave between the end of the line and the right edge of the window. \fIPixels\fR may have any of the standard forms for screen distances. This option is only used when wrapping is enabled. If a text line wraps, the right margin for each line on the display is determined by the first non-elided character of that display line. .\" OPTION: -rmargincolor .TP \fB\-rmargincolor \fIcolor\fR . \fIColor\fR specifies the background color to use in regions that do not contain characters because they are indented by \fB\-rmargin\fR. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color used is specified by the \fB\-background\fR tag option (or, if this is also unspecified, by the \fB\-background\fR widget option). .\" OPTION: -selectbackground .TP \fB\-selectbackground \fIcolor\fR . \fIColor\fR specifies the background color to use when displaying selected items. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color specified by the \fB\-background\fR tag option is used. .\" OPTION: -selectforeground .TP \fB\-selectforeground \fIcolor\fR . \fIColor\fR specifies the foreground color to use when displaying selected items. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color specified by the \fB\-foreground\fR tag option is used. .\" OPTION: -spacing1 .TP \fB\-spacing1 \fIpixels\fR . \fIPixels\fR specifies how much additional space should be left above each text line, using any of the standard forms for screen distances. If a line wraps, this option only applies to the first line on the display. .\" OPTION: -spacing2 .TP \fB\-spacing2 \fIpixels\fR . For lines that wrap, this option specifies how much additional space to leave between the display lines for a single text line. \fIPixels\fR may have any of the standard forms for screen distances. .\" OPTION: -spacing3 .TP \fB\-spacing3 \fIpixels\fR . \fIPixels\fR specifies how much additional space should be left below each text line, using any of the standard forms for screen distances. If a line wraps, this option only applies to the last line on the display. .\" OPTION: -tabs .TP \fB\-tabs \fItabList\fR . \fITabList\fR specifies a set of tab stops in the same form as for the \fB\-tabs\fR option for the text widget. This option only applies to a display line if it applies to the first non-elided character on that display line. If this option is specified as an empty string, it cancels the option, leaving it unspecified for the tag (the default). If the option is specified as a non-empty string that is an empty list, such as \fB\-tags\0{\0}\fR, then it requests default 8-character tabs as described for the \fB\-tags\fR widget option. .\" OPTION: -tabstyle .TP \fB\-tabstyle \fIstyle\fR . \fIStyle\fR specifies either the \fItabular\fR or \fIwordprocessor\fR style of tabbing to use for the text widget. This option only applies to a display line if it applies to the first non-elided character on that display line. If this option is specified as an empty string, it cancels the option, leaving it unspecified for the tag (the default). .\" OPTION: -underline .TP \fB\-underline \fIboolean\fR . \fIBoolean\fR specifies whether or not to draw an underline underneath characters. It may have any of the forms accepted by \fBTcl_GetBoolean\fR. .\" OPTION: -underlinefg .TP \fB\-underlinefg \fIcolor\fR . \fIColor\fR specifies the color to use when displaying the underline. It may have any of the forms accepted by \fBTk_GetColor\fR. If \fIcolor\fR has not been specified, or if it is specified as an empty string, then the color specified by the \fB\-foreground\fR tag option is used. .\" OPTION: -wrap .TP \fB\-wrap \fImode\fR . \fIMode\fR specifies how to handle lines that are wider than the text's window. This option only applies to a display line if it applies to the first non-elided character on that display line. It has the same legal values as the \fB\-wrap\fR option for the text widget: \fBnone\fR, |
︙ | ︙ | |||
691 692 693 694 695 696 697 | unit's worth of index space in the text widget, and it may be referred to either by the name of its embedded window or by its position in the widget's index space. If the range of text containing the embedded window is deleted then the window is destroyed. Similarly if the text widget as a whole is deleted, then the window is destroyed. .PP Eliding an embedded window immediately after scheduling it for creation via | | | > > > > > > | 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 | unit's worth of index space in the text widget, and it may be referred to either by the name of its embedded window or by its position in the widget's index space. If the range of text containing the embedded window is deleted then the window is destroyed. Similarly if the text widget as a whole is deleted, then the window is destroyed. .PP Eliding an embedded window immediately after scheduling it for creation via \fIpathName \fBwindow create \fIindex \fB\-create\fR will prevent it from being effectively created. Uneliding an elided embedded window scheduled for creation via \fIpathName \fBwindow create \fIindex \fB\-create\fR will automatically trigger the associated creation script. After destroying an elided embedded window, the latter won't get automatically recreated. .PP When an embedded window is added to a text widget with the \fIpathName \fBwindow create\fR widget command, several configuration options may be associated with it. These options may be modified later with the \fIpathName \fBwindow configure\fR widget command. The following options are currently supported: .\" OPTION: -align .TP \fB\-align \fIwhere\fR . If the window is not as tall as the line in which it is displayed, this option determines where the window is displayed in the line. \fIWhere\fR must have one of the values \fBtop\fR (align the top of the window with the top of the line), \fBcenter\fR (center the window within the range of the line), \fBbottom\fR (align the bottom of the window with the bottom of the line's area), or \fBbaseline\fR (align the bottom of the window with the baseline of the line). .\" OPTION: -create .TP \fB\-create \fIscript\fR . Specifies a Tcl script that may be evaluated to create the window for the annotation. If no \fB\-window\fR option has been specified for the annotation this script will be evaluated when the annotation is about to be displayed on the screen. \fIScript\fR must create a window for the annotation and return the name of that window as its result. Two substitutions will be performed in \fIscript\fR before evaluation. \fI%W\fR will be substituted by the name of the parent text widget, and \fI%%\fR will be substituted by a single \fI%\fR. If the annotation's window should ever be deleted, \fIscript\fR will be evaluated again the next time the annotation is displayed. .\" OPTION: -padx .TP \fB\-padx \fIpixels\fR . \fIPixels\fR specifies the amount of extra space to leave on each side of the embedded window. It may have any of the usual forms defined for a screen distance. .\" OPTION: -pady .TP \fB\-pady \fIpixels\fR . \fIPixels\fR specifies the amount of extra space to leave on the top and on the bottom of the embedded window. It may have any of the usual forms defined for a screen distance. .\" OPTION: -stretch .TP \fB\-stretch \fIboolean\fR . If the requested height of the embedded window is less than the height of the line in which it is displayed, this option can be used to specify whether the window should be stretched vertically to fill its line. If the \fB\-pady\fR option has been specified as well, then the requested padding will be retained even if the window is stretched. .\" OPTION: -window .TP \fB\-window \fIpathName\fR . Specifies the name of a window to display in the annotation. Note that if a \fIpathName\fR has been set, then later configuring a window to the empty string will not delete the widget corresponding to the old \fIpathName\fR. Rather it will remove the association between the old \fIpathName\fR and the |
︙ | ︙ | |||
770 771 772 773 774 775 776 | space in the text widget, and it may be referred to either by its position in the widget's index space, or the name it is assigned when the image is inserted into the text widget with \fIpathName \fBimage create\fR. If the range of text containing the embedded image is deleted then that copy of the image is removed from the screen. .PP Eliding an embedded image immediately after scheduling it for creation via | | | > > > > > | 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 | space in the text widget, and it may be referred to either by its position in the widget's index space, or the name it is assigned when the image is inserted into the text widget with \fIpathName \fBimage create\fR. If the range of text containing the embedded image is deleted then that copy of the image is removed from the screen. .PP Eliding an embedded image immediately after scheduling it for creation via \fIpathName \fBimage create \fIindex \fB\-create\fR will prevent it from being effectively created. Uneliding an elided embedded image scheduled for creation via \fIpathName \fBimage create \fIindex \fB\-create\fR will automatically trigger the associated creation script. After destroying an elided embedded image, the latter won't get automatically recreated. .PP When an embedded image is added to a text widget with the \fIpathName \fBimage create\fR widget command, a name unique to this instance of the image is returned. This name may then be used to refer to this image instance. The name is taken to be the value of the \fB\-name\fR option (described below). If the \fB\-name\fR option is not provided, the \fB\-image\fR name is used instead. If the \fIimageName\fR is already in use in the text widget, then \fB#\fInn\fR is added to the end of the \fIimageName\fR, where \fInn\fR is an arbitrary integer. This insures the \fIimageName\fR is unique. Once this name is assigned to this instance of the image, it does not change, even though the \fB\-image\fR or \fB\-name\fR values can be changed with \fIpathName \fBimage configure\fR. .PP When an embedded image is added to a text widget with the \fIpathName \fBimage create\fR widget command, several configuration options may be associated with it. These options may be modified later with the \fIpathName \fBimage configure\fR widget command. The following options are currently supported: .\" OPTION: -align .TP \fB\-align \fIwhere\fR . If the image is not as tall as the line in which it is displayed, this option determines where the image is displayed in the line. \fIWhere\fR must have one of the values \fBtop\fR (align the top of the image with the top of the line), \fBcenter\fR (center the image within the range of the line), \fBbottom\fR (align the bottom of the image with the bottom of the line's area), or \fBbaseline\fR (align the bottom of the image with the baseline of the line). .\" OPTION: -image .TP \fB\-image \fIimage\fR . Specifies the name of the Tk image to display in the annotation. If \fIimage\fR is not a valid Tk image, then an error is returned. .\" OPTION: -name .TP \fB\-name \fIImageName\fR . Specifies the name by which this image instance may be referenced in the text widget. If \fIImageName\fR is not supplied, then the name of the Tk image is used instead. If the \fIimageName\fR is already in use, \fI#nn\fR is appended to the end of the name as described above. .\" OPTION: -padx .TP \fB\-padx \fIpixels\fR . \fIPixels\fR specifies the amount of extra space to leave on each side of the embedded image. It may have any of the usual forms defined for a screen distance. .\" OPTION: -pady .TP \fB\-pady \fIpixels\fR . \fIPixels\fR specifies the amount of extra space to leave on the top and on the bottom of the embedded image. It may have any of the usual forms defined for a screen distance. .SH "THE SELECTION" |
︙ | ︙ | |||
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 | > > > | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | .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 |
︙ | ︙ | |||
971 972 973 974 975 976 977 | creation of peer widgets. .SH "ASYNCHRONOUS UPDATE OF LINE HEIGHTS" .PP In order to maintain a responsive user-experience, the text widget calculates lines metrics (line heights in pixels) asynchronously. Because of this, some commands of the text widget may return wrong results if the asynchronous calculations are not finished at the time of calling. This applies to | | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | creation of peer widgets. .SH "ASYNCHRONOUS UPDATE OF LINE HEIGHTS" .PP In order to maintain a responsive user-experience, the text widget calculates lines metrics (line heights in pixels) asynchronously. Because of this, some commands of the text widget may return wrong results if the asynchronous calculations are not finished at the time of calling. This applies to \fIpathName \fBcount \-ypixels\fR and \fIpathName \fByview\fR. .PP Again for performance reasons, it would not be appropriate to let these commands always wait for the end of the update calculation each time they are called. In most use cases of these commands a more or less inaccurate result does not really matter compared to execution speed. .PP In case accurate result is needed (and if the text widget is managed by a |
︙ | ︙ | |||
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the text widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for text widgets: .TP \fIpathName \fBbbox \fIindex\fR . Returns a list of four elements describing the screen area 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 area occupied by the character, and the last two elements give the width and height of the area. If the character is only partially visible on the screen, then the return value reflects just the visible part. If the character is not visible on the screen then the return value is an empty list. .TP | > > | > | > > | 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 | operations on the widget. It has the following general form: .CS \fIpathName option \fR?\fIarg ...\fR? .CE \fIPathName\fR is the name of the command, which is the same as the text widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for text widgets: .\" METHOD: bbox .TP \fIpathName \fBbbox \fIindex\fR . Returns a list of four elements describing the screen area 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 area occupied by the character, and the last two elements give the width and height of the area. If the character is only partially visible on the screen, then the return value reflects just the visible part. If the character is not visible on the screen then the return value is an empty list. .\" METHOD: cget .TP \fIpathName \fBcget\fI option\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBtext\fR command. .\" METHOD: compare .TP \fIpathName \fBcompare\fI index1 op index2\fR . Compares the indices given by \fIindex1\fR and \fIindex2\fR according to the relational operator given by \fIop\fR, and returns 1 if the relationship is satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==, >=, >, or !=. If \fIop\fR is == then 1 is returned if the two indices refer to the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers to an earlier character in the text than \fIindex2\fR, and so on. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the 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 widget 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 \fBtext\fR command. .\" METHOD: count .TP \fIpathName \fBcount\fR ?\fIoptions\fR? \fIindex1 index2\fR . Counts the number of relevant things between the two indices. If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number (and this holds for each of the possible options). The actual items which are counted depend on the options given. The result is a list of integers, one for the result of |
︙ | ︙ | |||
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 | The command returns a positive or negative integer corresponding to the number of items counted between the two indices. One such integer is returned for each counting option given, so a list is returned if more than one option was supplied. For example .QW ".text count \-xpixels \-ypixels 1.3 4.5" is perfectly valid and will return a list of two elements. .RE .TP \fIpathName \fBdebug \fR?\fIboolean\fR? . If \fIboolean\fR is specified, then it must have one of the true or false values accepted by Tcl_GetBoolean. If the value is a true one then internal consistency checks will be turned on in the B-tree code associated with text widgets. If \fIboolean\fR has a false value then the debugging checks will be turned off. In either case the command returns an empty string. If \fIboolean\fR is not specified then the command returns \fBon\fR or \fBoff\fR to indicate whether or not debugging is turned on. There is a single debugging switch shared by all text widgets: turning debugging on or off in any widget turns it on or off for all widgets. For widgets with large amounts of text, the consistency checks may cause a noticeable slow-down. .RS .PP When debugging is turned on, the drawing routines of the text widget set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR to the lists of indices that are redrawn. The values of these variables are tested by Tk's test suite. .RE .TP \fIpathName \fBdelete \fIindex1 \fR?\fIindex2 ...\fR? . Delete a range of characters from the text. If both \fIindex1\fR and \fIindex2\fR are specified, then delete all the characters starting with the one given by \fIindex1\fR and stopping just before \fIindex2\fR (i.e. the character at | > > | 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 | The command returns a positive or negative integer corresponding to the number of items counted between the two indices. One such integer is returned for each counting option given, so a list is returned if more than one option was supplied. For example .QW ".text count \-xpixels \-ypixels 1.3 4.5" is perfectly valid and will return a list of two elements. .RE .\" METHOD: debug .TP \fIpathName \fBdebug \fR?\fIboolean\fR? . If \fIboolean\fR is specified, then it must have one of the true or false values accepted by Tcl_GetBoolean. If the value is a true one then internal consistency checks will be turned on in the B-tree code associated with text widgets. If \fIboolean\fR has a false value then the debugging checks will be turned off. In either case the command returns an empty string. If \fIboolean\fR is not specified then the command returns \fBon\fR or \fBoff\fR to indicate whether or not debugging is turned on. There is a single debugging switch shared by all text widgets: turning debugging on or off in any widget turns it on or off for all widgets. For widgets with large amounts of text, the consistency checks may cause a noticeable slow-down. .RS .PP When debugging is turned on, the drawing routines of the text widget set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR to the lists of indices that are redrawn. The values of these variables are tested by Tk's test suite. .RE .\" METHOD: delete .TP \fIpathName \fBdelete \fIindex1 \fR?\fIindex2 ...\fR? . Delete a range of characters from the text. If both \fIindex1\fR and \fIindex2\fR are specified, then delete all the characters starting with the one given by \fIindex1\fR and stopping just before \fIindex2\fR (i.e. the character at |
︙ | ︙ | |||
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 | All indices are first checked for validity before any deletions are made. They are sorted and the text is removed from the last range to the first range so deleted text does not cause an undesired index shifting side-effects. If multiple ranges with the same start index are given, then the longest range is used. If overlapping ranges are given, then they will be merged into spans that do not cause deletion of text outside the given ranges due to text shifted during deletion. .TP \fIpathName \fBdlineinfo \fIindex\fR . Returns a list with five elements describing the area occupied by the display line containing \fIindex\fR. The first two elements of the list give the x and y coordinates of the upper-left corner of the area occupied by the line, the third and fourth elements give the width and height of the area, and the fifth element gives the position of the baseline for the line, measured down from the top of the area. All of this information is measured in pixels. If the current wrap mode is \fBnone\fR and the line extends beyond the boundaries of the window, the area returned reflects the entire area of the line, including the portions that are out of the window. If the line is shorter than the full width of the window then the area returned reflects just the portion of the line that is occupied by characters and embedded windows. If the display line containing \fIindex\fR is not visible on the screen then the return value is an empty list. .TP \fIpathName \fBdump \fR?\fIswitches\fR? \fIindex1 \fR?\fIindex2\fR? . Return the contents of the text widget from \fIindex1\fR up to, but not including \fIindex2\fR, including the text and information about marks, tags, and embedded windows. If \fIindex2\fR is not specified, then it defaults to one character past \fIindex1\fR. The information is returned in the following format: .RS .LP \fIkey1 value1 index1 key2 value2 index2\fR ... .LP The possible \fIkey\fR values are \fBtext\fR, \fBmark\fR, \fBtagon\fR, \fBtagoff\fR, \fBimage\fR, and \fBwindow\fR. The corresponding \fIvalue\fR is the text, mark name, tag name, image name, or window name. The \fIindex\fR information is the index of the start of the text, mark, tag transition, image or window. One or more of the following switches (or abbreviations thereof) may be specified to control the dump: .TP \fB\-all\fR . Return information about all elements: text, marks, tags, images and windows. This is the default. .TP \fB\-command \fIcommand\fR . Instead of returning the information as the result of the dump operation, invoke the \fIcommand\fR on each element of the text widget within the range. The command has three arguments appended to it before it is evaluated: the \fIkey\fR, \fIvalue\fR, and \fIindex\fR. .TP \fB\-image\fR . Include information about images in the dump results. .TP \fB\-mark\fR . Include information about marks in the dump results. .TP \fB\-tag\fR . Include information about tag transitions in the dump results. Tag information is returned as \fBtagon\fR and \fBtagoff\fR elements that indicate the begin and end of each range of each tag, respectively. .TP \fB\-text\fR . Include information about text in the dump results. The value is the text up to the next element or the end of range indicated by \fIindex2\fR. A text element does not span newlines. A multi-line block of text that contains no marks or tag transitions will still be dumped as a set of text segments that each end with a newline. The newline is part of the value. .TP \fB\-window\fR . Include information about embedded windows in the dump results. The value of a window is its Tk pathname, unless the window has not been created yet. (It must have a create script.) In this case an empty string is returned, and you must query the window by its index position to get more information. .RE .TP \fIpathName \fBedit \fIoption \fR?\fIarg ...\fR? . This command controls the undo mechanism and the modified flag. The exact behavior of the command depends on the \fIoption\fR argument that follows the \fBedit\fR argument. The following forms of the command are currently supported: | > > > > > > > > > > | 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 | All indices are first checked for validity before any deletions are made. They are sorted and the text is removed from the last range to the first range so deleted text does not cause an undesired index shifting side-effects. If multiple ranges with the same start index are given, then the longest range is used. If overlapping ranges are given, then they will be merged into spans that do not cause deletion of text outside the given ranges due to text shifted during deletion. .\" METHOD: dlineinfo .TP \fIpathName \fBdlineinfo \fIindex\fR . Returns a list with five elements describing the area occupied by the display line containing \fIindex\fR. The first two elements of the list give the x and y coordinates of the upper-left corner of the area occupied by the line, the third and fourth elements give the width and height of the area, and the fifth element gives the position of the baseline for the line, measured down from the top of the area. All of this information is measured in pixels. If the current wrap mode is \fBnone\fR and the line extends beyond the boundaries of the window, the area returned reflects the entire area of the line, including the portions that are out of the window. If the line is shorter than the full width of the window then the area returned reflects just the portion of the line that is occupied by characters and embedded windows. If the display line containing \fIindex\fR is not visible on the screen then the return value is an empty list. .\" METHOD: dump .TP \fIpathName \fBdump \fR?\fIswitches\fR? \fIindex1 \fR?\fIindex2\fR? . Return the contents of the text widget from \fIindex1\fR up to, but not including \fIindex2\fR, including the text and information about marks, tags, and embedded windows. If \fIindex2\fR is not specified, then it defaults to one character past \fIindex1\fR. The information is returned in the following format: .RS .LP \fIkey1 value1 index1 key2 value2 index2\fR ... .LP The possible \fIkey\fR values are \fBtext\fR, \fBmark\fR, \fBtagon\fR, \fBtagoff\fR, \fBimage\fR, and \fBwindow\fR. The corresponding \fIvalue\fR is the text, mark name, tag name, image name, or window name. The \fIindex\fR information is the index of the start of the text, mark, tag transition, image or window. One or more of the following switches (or abbreviations thereof) may be specified to control the dump: .\" OPTION: -all .TP \fB\-all\fR . Return information about all elements: text, marks, tags, images and windows. This is the default. .\" OPTION: -command .TP \fB\-command \fIcommand\fR . Instead of returning the information as the result of the dump operation, invoke the \fIcommand\fR on each element of the text widget within the range. The command has three arguments appended to it before it is evaluated: the \fIkey\fR, \fIvalue\fR, and \fIindex\fR. .\" OPTION: -image .TP \fB\-image\fR . Include information about images in the dump results. .\" OPTION: -mark .TP \fB\-mark\fR . Include information about marks in the dump results. .\" OPTION: -tag .TP \fB\-tag\fR . Include information about tag transitions in the dump results. Tag information is returned as \fBtagon\fR and \fBtagoff\fR elements that indicate the begin and end of each range of each tag, respectively. .\" OPTION: -text .TP \fB\-text\fR . Include information about text in the dump results. The value is the text up to the next element or the end of range indicated by \fIindex2\fR. A text element does not span newlines. A multi-line block of text that contains no marks or tag transitions will still be dumped as a set of text segments that each end with a newline. The newline is part of the value. .\" OPTION: -window .TP \fB\-window\fR . Include information about embedded windows in the dump results. The value of a window is its Tk pathname, unless the window has not been created yet. (It must have a create script.) In this case an empty string is returned, and you must query the window by its index position to get more information. .RE .\" METHOD: edit .TP \fIpathName \fBedit \fIoption \fR?\fIarg ...\fR? . This command controls the undo mechanism and the modified flag. The exact behavior of the command depends on the \fIoption\fR argument that follows the \fBedit\fR argument. The following forms of the command are currently supported: |
︙ | ︙ | |||
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 | . Undoes the last edit action when the \fB\-undo\fR option is true, and returns a list of indices indicating what ranges were changed by the undo operation. An edit action is defined as all the insert and delete commands that are recorded on the undo stack in between two separators. Generates an error when the undo stack is empty. Does nothing when the \fB\-undo\fR option is false. .RE .TP \fIpathName \fBget\fR ?\fB\-displaychars\fR? ?\fB\-\-\fR? \fIindex1\fR ?\fIindex2 ...\fR? . Return a range of characters from the text. The return value will be all the characters in the text starting with the one whose index is \fIindex1\fR and ending just before the one whose index is \fIindex2\fR (the character at \fIindex2\fR will not be returned). If \fIindex2\fR is omitted then the single character at \fIindex1\fR is returned. If there are no characters in the specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR is less than or equal to \fIindex1\fR) then an empty string is returned. If the specified range contains embedded windows, no information about them is included in the returned string. If multiple index pairs are given, multiple ranges of text will be returned in a list. Invalid ranges will not be represented with empty strings in the list. The ranges are returned in the order passed to \fIpathName \fBget\fR. If the \fB\-displaychars\fR option is 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 | > > | | 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 | . Undoes the last edit action when the \fB\-undo\fR option is true, and returns a list of indices indicating what ranges were changed by the undo operation. An edit action is defined as all the insert and delete commands that are recorded on the undo stack in between two separators. Generates an error when the undo stack is empty. Does nothing when the \fB\-undo\fR option is false. .RE .\" METHOD: get .TP \fIpathName \fBget\fR ?\fB\-displaychars\fR? ?\fB\-\-\fR? \fIindex1\fR ?\fIindex2 ...\fR? . Return a range of characters from the text. The return value will be all the characters in the text starting with the one whose index is \fIindex1\fR and ending just before the one whose index is \fIindex2\fR (the character at \fIindex2\fR will not be returned). If \fIindex2\fR is omitted then the single character at \fIindex1\fR is returned. If there are no characters in the specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR is less than or equal to \fIindex1\fR) then an empty string is returned. If the specified range contains embedded windows, no information about them is included in the returned string. If multiple index pairs are given, multiple ranges of text will be returned in a list. Invalid ranges will not be represented with empty strings in the list. The ranges are returned in the order passed to \fIpathName \fBget\fR. If the \fB\-displaychars\fR option is 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. .\" METHOD: image .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 |
︙ | ︙ | |||
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 | identifier returned. .TP \fIpathName \fBimage names\fR . Returns a list whose elements are the names of all image instances currently embedded in \fIwindow\fR. .RE .TP \fIpathName \fBindex \fIindex\fR . Returns the position corresponding to \fIindex\fR in the form \fIline.char\fR where \fIline\fR is the line number and \fIchar\fR is the character number. \fIIndex\fR may have any of the forms described under \fBINDICES\fR above. .TP \fIpathName \fBinsert \fIindex chars \fR?\fItagList chars tagList ...\fR? . Inserts all of the \fIchars\fR arguments just before the character at \fIindex\fR. If \fIindex\fR refers to the end of the text (the character after the last newline) then the new text is inserted just before the last newline instead. If there is a single \fIchars\fR argument and no \fItagList\fR, then the new text will receive any tags that are present on both the character before and the character after the insertion point; if a tag is present on only one of these characters then it will not be applied to the new text. If \fItagList\fR is specified then it consists of a list of tag names; the new characters will receive all of the tags in this list and no others, regardless of the tags present around the insertion point. If multiple \fIchars\fR\-\fItagList\fR argument pairs are present, they produce the same effect as if a separate \fIpathName \fBinsert\fR widget command had been issued for each pair, in order. The last \fItagList\fR argument may be omitted. .TP \fIpathName \fBmark \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate marks. The exact behavior of the command depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The following forms of the command are currently supported: .RS | > > > | 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 | identifier returned. .TP \fIpathName \fBimage names\fR . Returns a list whose elements are the names of all image instances currently embedded in \fIwindow\fR. .RE .\" METHOD: index .TP \fIpathName \fBindex \fIindex\fR . Returns the position corresponding to \fIindex\fR in the form \fIline.char\fR where \fIline\fR is the line number and \fIchar\fR is the character number. \fIIndex\fR may have any of the forms described under \fBINDICES\fR above. .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex chars \fR?\fItagList chars tagList ...\fR? . Inserts all of the \fIchars\fR arguments just before the character at \fIindex\fR. If \fIindex\fR refers to the end of the text (the character after the last newline) then the new text is inserted just before the last newline instead. If there is a single \fIchars\fR argument and no \fItagList\fR, then the new text will receive any tags that are present on both the character before and the character after the insertion point; if a tag is present on only one of these characters then it will not be applied to the new text. If \fItagList\fR is specified then it consists of a list of tag names; the new characters will receive all of the tags in this list and no others, regardless of the tags present around the insertion point. If multiple \fIchars\fR\-\fItagList\fR argument pairs are present, they produce the same effect as if a separate \fIpathName \fBinsert\fR widget command had been issued for each pair, in order. The last \fItagList\fR argument may be omitted. .\" METHOD: mark .TP \fIpathName \fBmark \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate marks. The exact behavior of the command depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The following forms of the command are currently supported: .RS |
︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | specified in numerical form, then the search for the next mark begins at that index. If \fIindex\fR is the name of a mark, then the search for the next mark begins immediately after that mark. This can still return a mark at the same position if there are multiple marks at the same index. These semantics mean that the \fBmark next\fR operation can be used to step through all the marks in a text widget in the same order as the mark information returned by the \fIpathName \fBdump\fR operation. If a mark has been set to the special | | | 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 | specified in numerical form, then the search for the next mark begins at that index. If \fIindex\fR is the name of a mark, then the search for the next mark begins immediately after that mark. This can still return a mark at the same position if there are multiple marks at the same index. These semantics mean that the \fBmark next\fR operation can be used to step through all the marks in a text widget in the same order as the mark information returned by the \fIpathName \fBdump\fR operation. If a mark has been set to the special \fBend\fR index, then it appears to be \fIafter \fBend\fR with respect to the \fIpathName \fBmark next\fR operation. An empty string is returned if there are no marks after \fIindex\fR. .TP \fIpathName \fBmark previous \fIindex\fR . Returns the name of the mark at or before \fIindex\fR. If \fIindex\fR is specified in numerical form, then the search for the previous mark begins with |
︙ | ︙ | |||
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 | . Remove the mark corresponding to each of the \fImarkName\fR arguments. The removed marks will not be usable in indices and will not be returned by future calls to .QW "\fIpathName \fBmark names\fR" . This command returns an empty string. .RE .TP \fIpathName \fBpeer \fIoption args\fR . This command is used to create and query widget peers. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBpeer create \fInewPathName\fR ?\fIoptions\fR? . Creates a peer text widget with the given \fInewPathName\fR, and any optional standard configuration options (as for the \fItext\fR command). By default the peer will have the same start and end line as the parent widget, but these can be overridden with the standard configuration options. .TP \fIpathName \fBpeer names\fR . Returns a list of peers of this widget (this does not include the widget itself). The order within this list is undefined. .RE .TP \fIpathName \fBpendingsync\fR Returns 1 if the line heights calculations are not up-to-date, 0 otherwise. .TP | > > > > | > > | 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 | . Remove the mark corresponding to each of the \fImarkName\fR arguments. The removed marks will not be usable in indices and will not be returned by future calls to .QW "\fIpathName \fBmark names\fR" . This command returns an empty string. .RE .\" METHOD: peer .TP \fIpathName \fBpeer \fIoption args\fR . This command is used to create and query widget peers. It has two forms, depending on \fIoption\fR: .RS .TP \fIpathName \fBpeer create \fInewPathName\fR ?\fIoptions\fR? . Creates a peer text widget with the given \fInewPathName\fR, and any optional standard configuration options (as for the \fItext\fR command). By default the peer will have the same start and end line as the parent widget, but these can be overridden with the standard configuration options. .TP \fIpathName \fBpeer names\fR . Returns a list of peers of this widget (this does not include the widget itself). The order within this list is undefined. .RE .\" METHOD: pendingsync .TP \fIpathName \fBpendingsync\fR . Returns 1 if the line heights calculations are not up-to-date, 0 otherwise. .\" METHOD: replace .TP \fIpathName \fBreplace\fI index1 index2 chars\fR ?\fItagList chars tagList ...\fR? . Replaces the range of characters between \fIindex1\fR and \fIindex2\fR with the given characters and tags. See the section on \fIpathName \fBinsert\fR for an explanation of the handling of the \fItagList...\fR arguments, and the section on \fIpathName \fBdelete\fR for an explanation of the handling of the indices. If \fIindex2\fR corresponds to an index earlier in the text than \fIindex1\fR, an error will be generated. .RS .PP The deletion and insertion are arranged so that no unnecessary scrolling of the window or movement of insertion cursor occurs. In addition the undo/redo stack are correctly modified, if undo operations are active in the text widget. The command returns an empty string. .RE .\" METHOD: scan .TP \fIpathName \fBscan \fIoption args\fR . This command is used to implement scanning on texts. It has two forms, depending on \fIoption\fR: .RS .TP |
︙ | ︙ | |||
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 | This command computes the difference between its \fIx\fR and \fIy\fR arguments and the \fIx\fR and \fIy\fR arguments to the last \fIpathName \fBscan mark\fR command for the widget. It then adjusts the view by 10 times the difference in coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the text at high speed through the window. The return value is an empty string. .RE .TP \fIpathName \fBsearch \fR?\fIswitches\fR? \fIpattern index \fR?\fIstopIndex\fR? . Searches the text in \fIpathName\fR starting at \fIindex\fR for a range of characters that matches \fIpattern\fR. If a match is found, the index of the first character in the match is returned as result; otherwise an empty string is returned. One or more of the following switches (or abbreviations thereof) may be specified to control the search: .RS .TP \fB\-forwards\fR . The search will proceed forward through the text, finding the first matching range starting at or after the position given by \fIindex\fR. This is the default. .TP \fB\-backwards\fR . The search will proceed backward through the text, finding the matching range closest to \fIindex\fR whose first character is before \fIindex\fR (it is not allowed to be at \fIindex\fR). Note that, for a variety of reasons, backwards searches can be substantially slower than forwards searches (particularly when using \fB\-regexp\fR), so it is recommended that performance-critical code use forward searches. .TP \fB\-exact\fR . Use exact matching: the characters in the matching range must be identical to those in \fIpattern\fR. This is the default. .TP \fB\-regexp\fR . Treat \fIpattern\fR as a regular expression and match it against the text using the rules for regular expressions (see the \fBregexp\fR command and the \fBre_syntax\fR page for details). The default matching automatically passes both the \fB\-lineanchor\fR and \fB\-linestop\fR options to the regexp engine (unless \fB\-nolinestop\fR is used), so that \fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR sequences will never match the newline character \fI\en\fR. .TP \fB\-nolinestop\fR . This allows \fI.\fR and \fI[^\fR sequences to match the newline character \fI\en\fR, which they will otherwise not do (see the \fBregexp\fR command for details). This option is only meaningful if \fB\-regexp\fR is also given, and an error will be thrown otherwise. For example, to match the entire text, use .QW "\fIpathName \fBsearch \-nolinestop \-regexp\fR \N'34'.*\N'34' 1.0" . .TP \fB\-nocase\fR . Ignore case differences between the pattern and the text. .TP \fB\-count\fI varName\fR . The argument following \fB\-count\fR gives the name of a variable; if a match is found, the number of index positions between beginning and end of the matching range will be stored in the variable. If there are no embedded images or windows in the matching range (and there are no elided characters if \fB\-elide\fR is not given), this is equivalent to the number of characters matched. In either case, the range \fImatchIdx\fR to \fImatchIdx + $count chars\fR will return the entire matched text. .TP \fB\-all\fR . Find all matches in the given range and return a list of the indices of the first character of each match. If a \fB\-count\fI varName\fR switch is given, then \fIvarName\fR is also set to a list containing one element for each successful match. Note that, even for exact searches, the elements of this list may be different, if there are embedded images, windows or hidden text. Searches with \fB\-all\fR behave very similarly to the Tcl command \fBregexp \-all\fR, in that overlapping matches are not normally returned. For example, applying an \fB\-all\fR search of the pattern .QW \ew+ against .QW "hello there" will just match twice, once for each word, and matching .QW "Z[a\-z]+Z" against .QW ZooZooZoo will just match once. .TP \fB\-overlap\fR . When performing \fB\-all\fR searches, the normal behaviour is that matches which overlap an already-found match will not be returned. This switch changes that behaviour so that all matches which are not totally enclosed within another match are returned. For example, applying an \fB\-overlap\fR search of the pattern .QW \ew+ against .QW "hello there" will just match twice (i.e. no different to just \fB\-all\fR), but matching .QW Z[a\-z]+Z against .QW ZooZooZoo will now match twice. An error will be thrown if this switch is used without \fB\-all\fR. .TP \fB\-strictlimits\fR . When performing any search, the normal behaviour is that the start and stop limits are checked with respect to the start of the matching text. With the \fB\-strictlimits\fR flag, the entire matching range must lie inside the start and stop limits specified for the match to be valid. .TP \fB\-elide\fR . Find elided (hidden) text as well. By default only displayed text is searched. .TP \fB\-\|\-\fR . This switch has no effect except to terminate the list of switches: the next argument will be treated as \fIpattern\fR even if it starts with \fB\-\fR. .PP The matching range may be within a single line of text, or run across multiple | > > > > > > > > > > > > > | 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 | This command computes the difference between its \fIx\fR and \fIy\fR arguments and the \fIx\fR and \fIy\fR arguments to the last \fIpathName \fBscan mark\fR command for the widget. It then adjusts the view by 10 times the difference in coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the text at high speed through the window. The return value is an empty string. .RE .\" METHOD: search .TP \fIpathName \fBsearch \fR?\fIswitches\fR? \fIpattern index \fR?\fIstopIndex\fR? . Searches the text in \fIpathName\fR starting at \fIindex\fR for a range of characters that matches \fIpattern\fR. If a match is found, the index of the first character in the match is returned as result; otherwise an empty string is returned. One or more of the following switches (or abbreviations thereof) may be specified to control the search: .RS .\" OPTION: -forwards .TP \fB\-forwards\fR . The search will proceed forward through the text, finding the first matching range starting at or after the position given by \fIindex\fR. This is the default. .\" OPTION: -backwards .TP \fB\-backwards\fR . The search will proceed backward through the text, finding the matching range closest to \fIindex\fR whose first character is before \fIindex\fR (it is not allowed to be at \fIindex\fR). Note that, for a variety of reasons, backwards searches can be substantially slower than forwards searches (particularly when using \fB\-regexp\fR), so it is recommended that performance-critical code use forward searches. .\" OPTION: -exact .TP \fB\-exact\fR . Use exact matching: the characters in the matching range must be identical to those in \fIpattern\fR. This is the default. .\" OPTION: -regexp .TP \fB\-regexp\fR . Treat \fIpattern\fR as a regular expression and match it against the text using the rules for regular expressions (see the \fBregexp\fR command and the \fBre_syntax\fR page for details). The default matching automatically passes both the \fB\-lineanchor\fR and \fB\-linestop\fR options to the regexp engine (unless \fB\-nolinestop\fR is used), so that \fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR sequences will never match the newline character \fI\en\fR. .\" OPTION: -nolinestop .TP \fB\-nolinestop\fR . This allows \fI.\fR and \fI[^\fR sequences to match the newline character \fI\en\fR, which they will otherwise not do (see the \fBregexp\fR command for details). This option is only meaningful if \fB\-regexp\fR is also given, and an error will be thrown otherwise. For example, to match the entire text, use .QW "\fIpathName \fBsearch \-nolinestop \-regexp\fR \N'34'.*\N'34' 1.0" . .\" OPTION: -nocase .TP \fB\-nocase\fR . Ignore case differences between the pattern and the text. .\" OPTION: -count .TP \fB\-count\fI varName\fR . The argument following \fB\-count\fR gives the name of a variable; if a match is found, the number of index positions between beginning and end of the matching range will be stored in the variable. If there are no embedded images or windows in the matching range (and there are no elided characters if \fB\-elide\fR is not given), this is equivalent to the number of characters matched. In either case, the range \fImatchIdx\fR to \fImatchIdx + $count chars\fR will return the entire matched text. .\" OPTION: -all .TP \fB\-all\fR . Find all matches in the given range and return a list of the indices of the first character of each match. If a \fB\-count\fI varName\fR switch is given, then \fIvarName\fR is also set to a list containing one element for each successful match. Note that, even for exact searches, the elements of this list may be different, if there are embedded images, windows or hidden text. Searches with \fB\-all\fR behave very similarly to the Tcl command \fBregexp \-all\fR, in that overlapping matches are not normally returned. For example, applying an \fB\-all\fR search of the pattern .QW \ew+ against .QW "hello there" will just match twice, once for each word, and matching .QW "Z[a\-z]+Z" against .QW ZooZooZoo will just match once. .\" OPTION: -overlap .TP \fB\-overlap\fR . When performing \fB\-all\fR searches, the normal behaviour is that matches which overlap an already-found match will not be returned. This switch changes that behaviour so that all matches which are not totally enclosed within another match are returned. For example, applying an \fB\-overlap\fR search of the pattern .QW \ew+ against .QW "hello there" will just match twice (i.e. no different to just \fB\-all\fR), but matching .QW Z[a\-z]+Z against .QW ZooZooZoo will now match twice. An error will be thrown if this switch is used without \fB\-all\fR. .\" OPTION: -strictlimits .TP \fB\-strictlimits\fR . When performing any search, the normal behaviour is that the start and stop limits are checked with respect to the start of the matching text. With the \fB\-strictlimits\fR flag, the entire matching range must lie inside the start and stop limits specified for the match to be valid. .\" OPTION: -elide .TP \fB\-elide\fR . Find elided (hidden) text as well. By default only displayed text is searched. .\" OPTION: -- .TP \fB\-\|\-\fR . This switch has no effect except to terminate the list of switches: the next argument will be treated as \fIpattern\fR even if it starts with \fB\-\fR. .PP The matching range may be within a single line of text, or run across multiple |
︙ | ︙ | |||
1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 | beginning or end of the text is reached, the search continues at the other end until the starting location is reached again; if \fIstopIndex\fR is specified, no wrap-around will occur. This means that, for example, if the search is \fB\-forwards\fR but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR, nothing will ever be found. See \fBKNOWN BUGS\fR below for a number of minor limitations of the \fIpathName \fBsearch\fR command. .RE .TP \fIpathName \fBsee \fIindex\fR . Adjusts the view in the window so that the character given by \fIindex\fR is completely visible. If \fIindex\fR is already visible then the command does nothing. If \fIindex\fR is a short distance out of view, the command adjusts the view just enough to make \fIindex\fR visible at the edge of the window. If \fIindex\fR is far out of view, then the command centers \fIindex\fR in the window. .TP | > > | > > | > > | 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 | beginning or end of the text is reached, the search continues at the other end until the starting location is reached again; if \fIstopIndex\fR is specified, no wrap-around will occur. This means that, for example, if the search is \fB\-forwards\fR but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR, nothing will ever be found. See \fBKNOWN BUGS\fR below for a number of minor limitations of the \fIpathName \fBsearch\fR command. .RE .\" METHOD: see .TP \fIpathName \fBsee \fIindex\fR . Adjusts the view in the window so that the character given by \fIindex\fR is completely visible. If \fIindex\fR is already visible then the command does nothing. If \fIindex\fR is a short distance out of view, the command adjusts the view just enough to make \fIindex\fR visible at the edge of the window. If \fIindex\fR is far out of view, then the command centers \fIindex\fR in the window. .\" METHOD: sync .TP \fIpathName \fBsync\fR ?\fB\-command \fIcommand\fR? . Controls the synchronization of the view of the text widget. .RS .TP \fIpathName \fBsync\fR . Immediately brings the line metrics up-to-date by forcing computation of any outdated line heights. The command returns immediately if there is no such outdated line heights, otherwise it returns only at the end of the computation. The command returns an empty string. .TP \fIpathName \fBsync \-command \fIcommand\fR . Schedules \fIcommand\fR to be executed (by the event loop) exactly once as soon as all line heights are up-to-date. If there are no pending line metrics calculations, the scheduling is immediate. The command returns the empty string. \fBbgerror\fR is called on \fIcommand\fR failure. .RE .\" METHOD: tag .TP \fIpathName \fBtag \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate tags. The exact behavior of the command depends on the \fIoption\fR argument that follows the \fBtag\fR argument. The following forms of the command are currently supported: .RS |
︙ | ︙ | |||
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, | | > | | > | | 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 | \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 |
︙ | ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | starting at \fIindex2\fR will be considered). If several matching ranges exist, the one closest to \fIindex1\fR is chosen. The command's return value is a list containing two elements, which are the index of the first character of the range and the index of the character just after the last one in the range. If no matching range is found then the return value is an empty string. If \fIindex2\fR is not given then it defaults to the beginning of the text. .TP | | | 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 | starting at \fIindex2\fR will be considered). If several matching ranges exist, the one closest to \fIindex1\fR is chosen. The command's return value is a list containing two elements, which are the index of the first character of the range and the index of the character just after the last one in the range. If no matching range is found then the return value is an empty string. If \fIindex2\fR is not given then it defaults to the beginning of the text. .TP \fIpathName \fBtag raise \fItagName \fR?\fIaboveThis\fR? . Changes the priority of tag \fItagName\fR so that it is just higher in priority than the tag whose name is \fIaboveThis\fR. If \fIaboveThis\fR is omitted, then \fItagName\fR's priority is changed to make it highest priority of all tags. .TP \fIpathName \fBtag ranges \fItagName\fR |
︙ | ︙ | |||
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | \fIindex2\fR is not affected). A single command may contain any number of \fIindex1\fR\-\fIindex2\fR pairs. If the last \fIindex2\fR is omitted then the tag is removed from the single character at \fIindex1\fR. If there are no characters in the specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command has no effect. This command returns an empty string. .RE .TP \fIpathName \fBwindow \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate embedded windows. The behavior of the command depends on the \fIoption\fR argument that follows the \fBwindow\fR argument. The following forms of the command are currently supported: .RS | > | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 | \fIindex2\fR is not affected). A single command may contain any number of \fIindex1\fR\-\fIindex2\fR pairs. If the last \fIindex2\fR is omitted then the tag is removed from the single character at \fIindex1\fR. If there are no characters in the specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command has no effect. This command returns an empty string. .RE .\" METHOD: window .TP \fIpathName \fBwindow \fIoption \fR?\fIarg ...\fR? . This command is used to manipulate embedded windows. The behavior of the command depends on the \fIoption\fR argument that follows the \fBwindow\fR argument. The following forms of the command are currently supported: .RS |
︙ | ︙ | |||
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 | information on the options that are supported. Returns an empty string. .TP \fIpathName \fBwindow names\fR . Returns a list whose elements are the names of all windows currently embedded in \fIwindow\fR. .RE .TP \fIpathName \fBxview \fIoption args\fR . This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms: .RS .TP | > | 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 | information on the options that are supported. Returns an empty string. .TP \fIpathName \fBwindow names\fR . Returns a list whose elements are the names of all windows currently embedded in \fIwindow\fR. .RE .\" METHOD: xview .TP \fIpathName \fBxview \fIoption args\fR . This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms: .RS .TP |
︙ | ︙ | |||
1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | pixels are assumed). If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view adjusts by \fInumber\fR pixels; if it is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. .RE .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms: .RS .TP | > | 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 | pixels are assumed). If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view adjusts by \fInumber\fR pixels; if it is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. .RE .\" METHOD: yview .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms: .RS .TP |
︙ | ︙ | |||
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] | | | 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 | 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 |
︙ | ︙ | |||
2245 2246 2247 2248 2249 2250 2251 | means in the case where the first extra line added results in no match and Tcl's regexp system returns the incorrect code and adding a second extra line would actually match, the text widget will return the wrong result. In practice this is a rare problem, but it can occur, for example: .CS pack [\fBtext\fR .t] \&.t insert 1.0 "aaaa\enbbbb\encccc\enbbbb\enaaaa\en" | | | | 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 | means in the case where the first extra line added results in no match and Tcl's regexp system returns the incorrect code and adding a second extra line would actually match, the text widget will return the wrong result. In practice this is a rare problem, but it can occur, for example: .CS pack [\fBtext\fR .t] \&.t insert 1.0 "aaaa\enbbbb\encccc\enbbbb\enaaaa\en" \&.t search -regexp -- {(a+|b+\enc+\enb+)+\ena+} 1.0 .CE will not find a match when one exists of 19 characters starting from the first .QW b . .PP Whenever one possible match is fully enclosed in another, the search command will attempt to ensure only the larger match is returned. When performing backwards regexp searches it is possible that Tcl will not always achieve this, in the case where a match is preceded by one or more short, non-overlapping matches, all of which are preceded by a large match which actually encompasses all of them. The search algorithm used by the widget does not look back arbitrarily far for a possible match which might cover large portions of the widget. For example: .CS pack [\fBtext\fR .t] \&.t insert 1.0 "aaaa\enbbbb\enbbbb\enbbbb\enbbbb\\n" \&.t search -regexp -backward -- {b+\en|a+\en(b+\en)+} end .CE matches at .QW 5.0 when a true greedy match would match at .QW 1.0 . Similarly if we add \fB\-all\fR to this case, it matches at all of .QW 5.0 , |
︙ | ︙ |
Changes to doc/tk.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH tk n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk \- Manipulate Tk internal state .SH SYNOPSIS | | > | 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 | .TH tk n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk \- Manipulate Tk internal state .SH SYNOPSIS \fBtk\fI option \fR?\fIarg ...\fR? .BE .SH DESCRIPTION .PP The \fBtk\fR command provides access to miscellaneous elements of Tk's internal state. Most of the information manipulated by this command pertains to the application as a whole, or to a screen or display, rather than to a particular window. The command can take any of a number of different forms depending on the \fIoption\fR argument. The legal forms are: .\" METHOD: appname .TP \fBtk appname \fR?\fInewName\fR? . If \fInewName\fR is not specified, this command returns the name of the application (the name that may be used in \fBsend\fR commands to communicate with the application). If \fInewName\fR is specified, then the name of the application |
︙ | ︙ | |||
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 | \fInewName\fR should not start with a capital letter. This will interfere with option processing, since names starting with capitals are assumed to be classes; as a result, Tk may not be able to find some options for the application. If sends have been disabled by deleting the \fBsend\fR command, this command will reenable them and recreate the \fBsend\fR command. .TP \fBtk busy \fIsubcommand\fR ... . This command controls the marking of window hierarchies as .QW busy , rendering them non-interactive while some other operation is proceeding. For more details see the \fBbusy\fR manual page. .TP \fBtk caret \fIwindow \fR?\fB\-x \fIx\fR? ?\fB\-y \fIy\fR? ?\fB\-height \fIheight\fR? . Sets and queries the caret location for the display of the specified Tk window \fIwindow\fR. The caret is the per-display cursor location used for indicating global focus (e.g. to comply with Microsoft Accessibility guidelines), as well as for location of the over-the-spot XIM (X Input Methods) or Windows IME windows. If no options are specified, the last values used for setting the caret are return in option-value pair format. \fB\-x\fR and \fB\-y\fR represent window-relative coordinates, and \fB\-height\fR is the height of the current cursor location, or the height of the specified \fIwindow\fR if none is given. .TP \fBtk inactive \fR?\fB\-displayof \fIwindow\fR? ?\fBreset\fR? . Returns a positive integer, the number of milliseconds since the last time the user interacted with the system. If the \fB\-displayof\fR option is given then the return value refers to the display of \fIwindow\fR; otherwise it refers to the display of the application's main window. .RS .PP \fBtk inactive\fR will return \-1, if querying the user inactive time is not supported by the system, and in safe interpreters. .PP If the literal string \fBreset\fR is given as an additional argument, the timer is reset and an empty string is returned. Resetting the 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 | > > > > > > > > > > > > > > | 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 | \fInewName\fR should not start with a capital letter. This will interfere with option processing, since names starting with capitals are assumed to be classes; as a result, Tk may not be able to find some options for the application. If sends have been disabled by deleting the \fBsend\fR command, this command will reenable them and recreate the \fBsend\fR command. .\" METHOD: busy .TP \fBtk busy \fIsubcommand\fR ... . This command controls the marking of window hierarchies as .QW busy , rendering them non-interactive while some other operation is proceeding. For more details see the \fBbusy\fR manual page. .\" METHOD: caret .TP \fBtk caret \fIwindow \fR?\fB\-x \fIx\fR? ?\fB\-y \fIy\fR? ?\fB\-height \fIheight\fR? . Sets and queries the caret location for the display of the specified Tk window \fIwindow\fR. The caret is the per-display cursor location used for indicating global focus (e.g. to comply with Microsoft Accessibility guidelines), as well as for location of the over-the-spot XIM (X Input Methods) or Windows IME windows. If no options are specified, the last values used for setting the caret are return in option-value pair format. \fB\-x\fR and \fB\-y\fR represent window-relative coordinates, and \fB\-height\fR is the height of the current cursor location, or the height of the specified \fIwindow\fR if none is given. .\" METHOD: inactive .TP \fBtk inactive \fR?\fB\-displayof \fIwindow\fR? ?\fBreset\fR? . Returns a positive integer, the number of milliseconds since the last time the user interacted with the system. If the \fB\-displayof\fR option is given then the return value refers to the display of \fIwindow\fR; otherwise it refers to the display of the application's main window. .RS .PP \fBtk inactive\fR will return \-1, if querying the user inactive time is not supported by the system, and in safe interpreters. .PP If the literal string \fBreset\fR is given as an additional argument, the timer is reset and an empty string is returned. Resetting the inactivity time is forbidden in safe interpreters and will throw an error if tried. .RE .\" METHOD: fontchooser .TP \fBtk fontchooser \fIsubcommand\fR ... . Controls the Tk font selection dialog. For more details see the \fBfontchooser\fR manual page. .\" METHOD: print .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. .\" METHOD: scaling .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 |
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | displayed 1.25 times as large as normal. The initial value for the scaling 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" | > > > > > > > > > > > > > > > > | | | 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 | displayed 1.25 times as large as normal. The initial value for the scaling 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 .\" METHOD: sysnotify .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. .\" METHOD: systray .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. .\" METHOD: useinputmethods .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. .\" METHOD: windowingsystem .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.
︙ | ︙ | |||
31 32 33 34 35 36 37 | \fB::tk::mac::standardAboutPanel\fR \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR \fB::tk::mac::CGAntialiasLimit \fIlimit\fR \fB::tk::mac::antialiasedtext \fInumber\fR \fB::tk::mac::useThemedToplevel \fIboolean\fR | < > > > > > | 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 | \fB::tk::mac::standardAboutPanel\fR \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR \fB::tk::mac::CGAntialiasLimit \fIlimit\fR \fB::tk::mac::antialiasedtext \fInumber\fR \fB::tk::mac::useThemedToplevel \fIboolean\fR \fB::tk::mac::iconBitmap \fIname width height \-kind value\fR .fi .BE .SH "EVENT HANDLER CALLBACKS" .PP The Aqua/Mac OS X application environment defines a number of additional events that applications should respond to. These events are mapped by Tk to calls to commands in the \fB::tk::mac\fR namespace; unless otherwise noted, if the command is absent, no action will be taken. .\" COMMAND: DoScriptFile .TP \fB::tk::mac::DoScriptFile\fR . The default Apple Event handler for AEDoScriptHandler. This command executes a Tcl file when an AppleScript sends a .QW "do script" command to Wish with a file path as a parameter. .\" COMMAND: DoScriptText .TP \fB::tk::mac::DoScriptText\fR . The default Apple Event handler for AEDoScriptHandler. This command executes Tcl code when an AppleScript sends a .QW "do script" command to Wish with Tcl code or a Tcl procedure as a parameter. .\" COMMAND: ShowPreferences .TP \fB::tk::mac::ShowPreferences\fR . The default Apple Event handler for kAEShowPreferences, .QW pref . The application menu .QW "Preferences" menu item is only enabled when this proc is defined. Typically this command is used to wrap a specific own preferences command, which pops up a preferences window. Something like: .RS .PP .CS proc ::tk::mac::ShowPreferences {} { setPref } .CE .RE .\" COMMAND: OpenApplication .TP \fB::tk::mac::OpenApplication\fR . If a proc of this name is defined, this proc fill fire when your application is initially opened. It is the default Apple Event handler for kAEOpenApplication, .QW oapp . .\" COMMAND: ReopenApplication .TP \fB::tk::mac::ReopenApplication\fR . If a proc of this name is defined it is the default Apple Event handler for kAEReopenApplication, .QW rapp , the Apple Event sent when your application is opened when it is already |
︙ | ︙ | |||
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 | } else { wm deiconify . } raise . } .CE .RE .TP \fB::tk::mac::OpenDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEOpenDocuments, .QW odoc , the Apple Event sent when your application is asked to open one or more documents (e.g., by drag & drop onto the app or by opening a document of a type associated to the app). The proc should take as arguments paths to the files to be opened, like so: .RS .PP .CS proc ::tk::mac::OpenDocument {args} { foreach f $args {my_open_document $f} } .CE .RE .TP \fB::tk::mac::PrintDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , the Apple Event sent when your application is asked to print a document. It takes a single absolute file path as an argument. .TP \fB::tk::mac::Quit\fR . If a proc of this name is defined it is the default Apple Event handler for kAEQuitApplication, .QW quit , the Apple Event sent when your application is asked to be quit, e.g. via the quit menu item in the application menu, the quit menu item in the Dock menu, or during a logout/restart/shutdown etc. If this is not defined, \fBexit\fR is called instead. .TP \fB::tk::mac::OnHide\fR . If defined, this is called when your application receives a kEventAppHidden event, e.g. via the hide menu item in the application or Dock menus. .TP \fB::tk::mac::OnShow\fR . If defined, this is called when your application receives a kEventAppShown event, e.g. via the show all menu item in the application menu, or by clicking the Dock icon of a hidden application. .TP \fB::tk::mac::ShowHelp\fR . Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the application's Info.plist (or displaying an alert if no Help Book is set). .TP \fB::tk::mac::PerformService\fR . Executes a Tcl procedure called from the macOS .QW Services menu in the Application menu item. The .QW Services | > > > > > > > | 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 | } else { wm deiconify . } raise . } .CE .RE .\" COMMAND: OpenDocument .TP \fB::tk::mac::OpenDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEOpenDocuments, .QW odoc , the Apple Event sent when your application is asked to open one or more documents (e.g., by drag & drop onto the app or by opening a document of a type associated to the app). The proc should take as arguments paths to the files to be opened, like so: .RS .PP .CS proc ::tk::mac::OpenDocument {args} { foreach f $args {my_open_document $f} } .CE .RE .\" COMMAND: PrintDocument .TP \fB::tk::mac::PrintDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , the Apple Event sent when your application is asked to print a document. It takes a single absolute file path as an argument. .\" COMMAND: Quit .TP \fB::tk::mac::Quit\fR . If a proc of this name is defined it is the default Apple Event handler for kAEQuitApplication, .QW quit , the Apple Event sent when your application is asked to be quit, e.g. via the quit menu item in the application menu, the quit menu item in the Dock menu, or during a logout/restart/shutdown etc. If this is not defined, \fBexit\fR is called instead. .\" COMMAND: OnHide .TP \fB::tk::mac::OnHide\fR . If defined, this is called when your application receives a kEventAppHidden event, e.g. via the hide menu item in the application or Dock menus. .\" COMMAND: OnShow .TP \fB::tk::mac::OnShow\fR . If defined, this is called when your application receives a kEventAppShown event, e.g. via the show all menu item in the application menu, or by clicking the Dock icon of a hidden application. .\" COMMAND: ShowHelp .TP \fB::tk::mac::ShowHelp\fR . Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the application's Info.plist (or displaying an alert if no Help Book is set). .\" COMMAND: PerformService .TP \fB::tk::mac::PerformService\fR . Executes a Tcl procedure called from the macOS .QW Services menu in the Application menu item. The .QW Services |
︙ | ︙ | |||
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | the application's Info.plist file. The underlying code supporting this command also allows the text, entry and ttk::entry widgets to access services from other applications via the Services menu. The NSPortName key in Wish's Info.plist file is currently set as .QW "Wish" ; if a developer changes the name of the Wish executable to something else, this key should be modified with the same name. .TP \fB::tk::mac::LaunchURL \fIURL...\fR . If defined, launches a URL within Tk. This would be used if a Tk application wants to handle a URL itself, such as displaying data from an RSS feed, rather than launching a default application to handle the URL, although it can defined as such. Wish includes a stub URL scheme of .QW foo:// | > | | | < < > | | | > > > > | < > > > > > > > > | 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 | the application's Info.plist file. The underlying code supporting this command also allows the text, entry and ttk::entry widgets to access services from other applications via the Services menu. The NSPortName key in Wish's Info.plist file is currently set as .QW "Wish" ; if a developer changes the name of the Wish executable to something else, this key should be modified with the same name. .\" COMMAND: LaunchURL .TP \fB::tk::mac::LaunchURL \fIURL...\fR . If defined, launches a URL within Tk. This would be used if a Tk application wants to handle a URL itself, such as displaying data from an RSS feed, rather than launching a default application to handle the URL, although it can defined as such. Wish includes a stub URL scheme of .QW foo:// in the CFBundleURLSchemes key of its Info.plist file; this should be customized for the specific URL scheme the developer wants to support. .TP \fB::tk::mac::GetAppPath\fR . Returns the current applications's file path. .PP .SH "ADDITIONAL DIALOGS" .PP The Aqua/Mac OS X defines additional dialogs that applications should support. .\" COMMAND: standardAboutPanel .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. .\" COMMAND: useCompatibilityMetrics .TP \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR . Preserves compatibility with older Tk/Aqua metrics; set to \fBfalse\fR for more native spacing. .\" COMMAND: CGAntialiasLimit .TP \fB::tk::mac::CGAntialiasLimit \fIlimit\fR . Sets the antialiasing limit; lines thinner that \fIlimit\fR pixels will not be antialiased. Integer, set to 0 by default, making all lines be antialiased. .\" COMMAND: antialiasedtext .TP \fB::tk::mac::antialiasedtext \fInumber\fR . Sets anti-aliased text. Controls text antialiasing, possible values for \fInumber\fR are -1 (default, use system default for text AA), 0 (no text AA), 1 (use text AA). .\" COMMAND: useThemedToplevel .TP \fB::tk::mac::useThemedToplevel \fIboolean\fR . Sets toplevel windows to draw with the modern grayish/ pinstripe Mac background. Equivalent to configuring the toplevel with .QW "\fB\-background systemWindowHeaderBackground\fR" , or to using a \fBttk::frame\fR. .SH "SUPPORT COMMANDS" .\" COMMAND: iconBitmap .TP \fB::tk::mac::iconBitmap \fIname width height \-kind value\fR . Renders native icons and bitmaps in Tk applications (including any image file readable by NSImage). A native bitmap name is interpreted as follows (in order): .RS |
︙ | ︙ | |||
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 | .IP \(bu 3 NSImage url string .IP \(bu 3 4-char OSType of IconServices icon .PP The \fIwidth\fR and \fIheight\fR arguments to \fBtk::mac::iconBitmap\fR define the dimensions of the image to create, and \fI\-kind\fR must be one of: .TP \fB\-file\fR . icon of file at given path .TP \fB\-fileType\fR . icon of given file type .TP \fB\-osType\fR . icon of given 4-char OSType file type .TP \fB\-systemType\fR . icon for given IconServices 4-char OSType .TP \fB\-namedImage\fR . named NSImage for given name .TP \fB\-imageFile\fR . image at given path .RE .SH "SEE ALSO" bind(n), wm(n) .SH KEYWORDS about dialog, antialiasing, Apple event, icon, NSImage '\" Local Variables: '\" mode: nroff '\" End: | > > > > > > | 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 | .IP \(bu 3 NSImage url string .IP \(bu 3 4-char OSType of IconServices icon .PP The \fIwidth\fR and \fIheight\fR arguments to \fBtk::mac::iconBitmap\fR define the dimensions of the image to create, and \fI\-kind\fR must be one of: .\" OPTION: -file .TP \fB\-file\fR . icon of file at given path .\" OPTION: -fileType .TP \fB\-fileType\fR . icon of given file type .\" OPTION: -osType .TP \fB\-osType\fR . icon of given 4-char OSType file type .\" OPTION: -systemType .TP \fB\-systemType\fR . icon for given IconServices 4-char OSType .\" OPTION: -namedImage .TP \fB\-namedImage\fR . named NSImage for given name .\" OPTION: -imageFile .TP \fB\-imageFile\fR . image at given path .RE .SH "SEE ALSO" bind(n), wm(n) .SH KEYWORDS about dialog, antialiasing, Apple event, icon, NSImage '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/tkerror.n.
︙ | ︙ | |||
14 15 16 17 18 19 20 | .SH SYNOPSIS \fBtkerror \fImessage\fR .BE .SH DESCRIPTION .PP Note: as of Tk 4.1 the \fBtkerror\fR command has been renamed to \fBbgerror\fR because the event loop (which is what usually invokes | > > | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | .SH SYNOPSIS \fBtkerror \fImessage\fR .BE .SH DESCRIPTION .PP Note: as of Tk 4.1 the \fBtkerror\fR command has been renamed to \fBbgerror\fR because the event loop (which is what usually invokes it) is now part of Tcl. Using the \fBtkerror\fR name is deprecated. .PP For backward compatibility the \fBbgerror\fR provided by the current Tk version still tries to call \fBtkerror\fR if there is one (or an auto loadable one), so old script defining that error handler should still work, but you should anyhow modify your scripts to use \fBbgerror\fR instead of \fBtkerror\fR because that support for the old name might vanish in the future. If that call fails, \fBbgerror\fR posts a dialog showing the error and offering to see the stack trace to the user. If you want your own error management you should directly override \fBbgerror\fR instead of \fBtkerror\fR. Documentation for \fBbgerror\fR is available as part of Tcl's documentation. .SH KEYWORDS background error, reporting |
︙ | ︙ |
Changes to doc/tkvars.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 1990-1994 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 tkvars n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .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 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 | '\" '\" Copyright (c) 1990-1994 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 tkvars n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME geometry, tk_library, tk_patchLevel, tk::scalingPct, tk_strictMotif, tk::svgFmt, tk_version \- Variables used or set by Tk .BE .SH DESCRIPTION .PP The following Tcl variables are either set or used by Tk at various times in its execution: .\" VARIABLE: tk_library .TP 15 \fBtk_library\fR . 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, the location of the binary containing the application, and the current working directory. .PP The variable can be modified by an application to switch to a different library. .RE .\" VARIABLE: tk_patchLevel .TP \fBtk_patchLevel\fR . 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 .\" VARIABLE: scalingPct .TP \fBtk::scalingPct\fR . Tk sets this variable at initialization time to the scaling percentage corresponding to the display's DPI scaling level. This value is at least 100 and is restricted to multiples of 25 (100, 125, 150, 175, 200, 225, ...). The sizes and various attributes of the Tk core and Ttk widgets and their components, as well as the sizes of the images used by Tk are chosen according to the scaling percentage, and this is recommended for applications and library packages, too. .RS .PP Note that any access to this variable is supposed to be strictly read-only! Note also that whenever the scaling factor used to convert between physical units and pixels is changed via \fBtk scaling\fR, the value of the variable \fBtk::scalingPct\fR is automatically updated. .PP On the windowing systems \fBwin32\fR and \fBaqua\fR the scaling percentage is computed by rounding [\fBtk scaling\fR] * 75 to the nearest multiple of 25 that is at least 100. (On \fBaqua\fR the result is always 100, and the desktop engine automatically scales everything as needed.) On \fBx11\fR, deriving the scaling percentage from [\fBtk scaling\fR] is done as fallback method only, because the implementation of display scaling is highly dependent on the desktop environment and it mostly manipulates system resources that are resident outside of Xlib, which Tk is based on. Moreover, for technical reasons, the value assigned to the variable \fBtk::scalingPct\fR can be different from the one selected in the system settings (e.g., 200 rather than 125, 150, or 175 when running GNOME on Xorg or the Cinnamon desktop). On \fBx11\fR the scaling percentage is computed mostly (but not exclusively) from the value of the X resource Xft.dpi, and, as an additional step, Tk synchronizes the scaling factor used to convert between physical units and pixels with the scaling percentage, with the aid of the \fBtk scaling\fR command. .RE .\" VARIABLE: tk_strictMotif .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. For example, active elements such as buttons and scrollbar sliders will not change color when the pointer passes over them. Modern applications should not normally set this variable. .\" VARIABLE: svgFmt .TP \fBtk::svgFmt\fR . This variable is set at Tk initialization time to .RS .RS 4 .PP [\fBlist svg \-scale\fR [\fBexpr\fR {$\fBtk::scalingPct\fR / 100.0}]] .RE .PP Typical values are {\fBsvg \-scale\fR 1.0}, {\fBsvg \-scale\fR 1.25}, {\fBsvg \-scale\fR 2.0}, etc. It is recommended to pass the value of this variable to the commands \fBimage create photo\fR, \fIimageName\fB configure\fR, \fIimageName\fB put\fR, and \fIimageName\fB read\fR as the value of their \fB\-format\fR option when creating or manipulating SVG images, to make sure that their sizes will correspond to the display's DPI scaling level. .PP Note that any access to this variable is supposed to be strictly read-only! Note also that whenever the scaling factor used to convert between physical units and pixels is changed via \fBtk scaling\fR, the value of the variable \fBtk::svgFmt\fR is automatically updated. .RE .\" VARIABLE: tk_version .TP \fBtk_version\fR . Tk sets this variable in the interpreter for each application. The variable holds the current version number of the Tk library in the form \fImajor\fR.\fIminor\fR. \fIMajor\fR and \fIminor\fR are integers. The major version number increases in any Tk release that includes changes that are not backward compatible (i.e. whenever existing Tk applications and scripts may have to change to work with the new release). The minor version number increases with each new release of Tk, except that it resets to zero whenever the major version number changes. .SS "INTERNAL AND DEBUGGING VARIABLES" .PP These variables should not normally be set by user code. .\" VARIABLE: Priv .TP \fBtk::Priv\fR . This variable is an array containing several pieces of information that are private to Tk. The elements of \fBtk::Priv\fR are used by Tk library procedures and default bindings. They should not be accessed by any code outside Tk. .\" VARIABLE: tk_textRedraw .\" VARIABLE: tk_textRelayout .TP \fBtk_textRedraw\fR .TP \fBtk_textRelayout\fR . These variables are set by text widgets when they have debugging turned on. The values written to these variables can be used to test or debug text widget operations. These variables are mostly used by Tk's test suite. .SH "OTHER GLOBAL VARIABLES" The following variables are only guaranteed to exist in \fBwish\fR executables; the Tk library does not define them itself but many Tk environments do. .\" VARIABLE: geometry .TP \fBgeometry\fR . If set, contains the user-supplied geometry specification to use for the main Tk window. .SH "SEE ALSO" package(n), tclvars(n), wish(1) .SH KEYWORDS environment, text, variables, version '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/tkwait.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 | .TH tkwait n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tkwait \- Wait for variable to change or window to be destroyed .SH SYNOPSIS \fBtkwait variable \fIname\fR | > < < > > > > | 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 | .TH tkwait n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tkwait \- Wait for variable to change or window to be destroyed .SH SYNOPSIS .nf \fBtkwait variable \fIname\fR \fBtkwait visibility \fIname\fR \fBtkwait window \fIname\fR .fi .BE .SH DESCRIPTION .PP The \fBtkwait\fR command waits for one of several things to happen, then it returns without taking any other actions. The return value is always an empty string. .\" METHOD: variable If the first argument is \fBvariable\fR (or any abbreviation of it) then the second argument is the name of a global variable and the command waits for that variable to be modified. .\" METHOD: visibility If the first argument is \fBvisibility\fR (or any abbreviation of it) then the second argument is the name of a window and the \fBtkwait\fR command waits for a change in its visibility state (as indicated by the arrival of a VisibilityNotify event). This form is typically used to wait for a newly-created window to appear on the screen before taking some action. .\" METHOD: window If the first argument is \fBwindow\fR (or any abbreviation of it) then the second argument is the name of a window and the \fBtkwait\fR command waits for that window to be destroyed. This form is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction. .PP While the \fBtkwait\fR command is waiting it processes events in |
︙ | ︙ |
Changes to doc/toplevel.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH toplevel n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME toplevel \- Create and manipulate 'toplevel' main and popup window widgets .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | .TH toplevel n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME toplevel \- Create and manipulate 'toplevel' main and popup window widgets .SH SYNOPSIS \fBtoplevel\fI pathName \fR?\fIoptions\fR? .SO \-borderwidth \-highlightcolor \-pady \-cursor \-highlightthickness \-relief \-highlightbackground \-padx \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background background Background |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | \fIpathName option \fR?\fIarg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the toplevel widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for toplevel widgets: .TP \fIpathName \fBcget \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 \fBtoplevel\fR command. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified | > > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | \fIpathName option \fR?\fIarg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the toplevel widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for toplevel widgets: .\" METHOD: cget .TP \fIpathName \fBcget \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 \fBtoplevel\fR command. .\" METHOD: configure .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified |
︙ | ︙ |
Changes to doc/ttk_Geometry.3.
︙ | ︙ | |||
96 97 98 99 100 101 102 | \fBTTK_SIDE_RIGHT\fR, or \fBTTK_SIDE_BOTTOM\fR. .AP unsigned sticky in A bitmask containing one or more of the bits \fBTTK_STICK_W\fR (west, or left), \fBTTK_STICK_E\fR (east, or right), \fBTTK_STICK_N\fR (north, or top), and \fBTTK_STICK_S\fR (south, or bottom). | | > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | \fBTTK_SIDE_RIGHT\fR, or \fBTTK_SIDE_BOTTOM\fR. .AP unsigned sticky in A bitmask containing one or more of the bits \fBTTK_STICK_W\fR (west, or left), \fBTTK_STICK_E\fR (east, or right), \fBTTK_STICK_N\fR (north, or top), and \fBTTK_STICK_S\fR (south, or bottom). \fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR), \fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR), and \fBTTK_FILL_BOTH\fR is a synonym for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR). See also: \fIgrid(n)\fR. .AP Tk_Window tkwin in Window whose screen geometry determines the conversion between absolute units and pixels. |
︙ | ︙ |
Changes to doc/ttk_button.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::button n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::button \- Widget that issues a command when pressed .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::button n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::button \- Widget that issues a command when pressed .SH SYNOPSIS \fBttk::button\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBttk::button\fR widget displays a textual label and/or image, and evaluates a command when pressed. .SO ttk_widget \-class \-compound \-cursor \-image \-justify \-state \-style |
︙ | ︙ | |||
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 76 77 | .\" .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: .\" METHOD: invoke .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 |
︙ | ︙ | |||
90 91 92 93 94 95 96 | .br \fB\-relief\fP \fIrelief\fP .br \fB\-shiftrelief\fP \fIamount\fP .RS \fB\-shiftrelief\fP specifies how far the button contents are shifted down and right in the \fIpressed\fP state. | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | .br \fB\-relief\fP \fIrelief\fP .br \fB\-shiftrelief\fP \fIamount\fP .RS \fB\-shiftrelief\fP specifies how far the button contents are shifted down and right in the \fIpressed\fP state. This action provides additional skeuomorphic feedback. .RE \fB\-width\fP \fIamount\fP .PP Some options are only available for specific themes. .PP See the \fBttk::style\fP manual page for information on how to configure ttk styles. |
︙ | ︙ |
Changes to doc/ttk_checkbutton.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::checkbutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::checkbutton \- On/off widget .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::checkbutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::checkbutton \- On/off widget .SH SYNOPSIS \fBttk::checkbutton\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBttk::checkbutton\fR widget is used to show or change a setting. It has two states, selected and deselected. The state of the checkbutton may be linked to a Tcl variable. .SO ttk_widget \-class \-compound \-cursor |
︙ | ︙ | |||
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 51 52 53 54 | 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: .\" METHOD: invoke .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 Returns the result of the \fB\-command\fR. .\" Missing: select, deselect, toggle |
︙ | ︙ |
Changes to doc/ttk_combobox.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::combobox n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::combobox \- text field with popdown selection list .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::combobox n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::combobox \- text field with popdown selection list .SH SYNOPSIS \fBttk::combobox\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::combobox\fR combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list. .SO ttk_widget |
︙ | ︙ | |||
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 93 94 95 96 97 98 99 100 | .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: .\" METHOD: current .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, moreover the same simple interpretation as for the command \fBstring index\fR is supported, with simple integer index arithmetic and indexing relative to \fBend\fR). Otherwise, returns the index of the current value in the list of \fB\-values\fR or \fB{}\fR if the current value does not appear in the list. .\" METHOD: get .TP \fIpathName \fBget\fR . Returns the current value of the combobox. .\" METHOD: set .TP \fIpathName \fBset\fI value\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.
︙ | ︙ | |||
8 9 10 11 12 13 14 | '\" .TH ttk::entry n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::entry \- Editable text field widget .SH SYNOPSIS | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | '\" .TH ttk::entry n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::entry \- Editable text field widget .SH SYNOPSIS \fBttk::entry\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP An \fBttk::entry\fR widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the \fB\-textvariable\fR option. |
︙ | ︙ | |||
133 134 135 136 137 138 139 140 141 | .LP Abbreviations may be used for any of the forms above, e.g.\| .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 | > > > > > > > | > > | < < < < < < < > > > > > | < < < > > > | < < < > > > | > | < < < > < < < < < < < < | 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 | .LP Abbreviations may be used for any of the forms above, e.g.\| .QW \fBe\fR or .QW \fBsel.l\fR . In general, out-of-range indices are automatically rounded to the nearest legal value. Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. .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: .\" METHOD: bbox .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. .\" METHOD: delete .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. .\" METHOD: get .TP \fIpathName \fBget\fR . Returns the entry's string. .\" METHOD: icursor .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. .\" METHOD: index .TP \fIpathName \fBindex\fI index\fR . Returns the numerical index corresponding to \fIindex\fR. .\" METHOD: insert .TP \fIpathName \fBinsert \fIindex string\fR . Insert \fIstring\fR just before the character indicated by \fIindex\fR. Returns the empty string. .\" METHOD: selection .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 . Clear the selection if it is currently in this widget. If the selection is not in this widget then the command has no effect. Returns the empty string. .TP \fIpathName \fBselection present\fR . Returns 1 if there is are characters selected in the entry, 0 if nothing is selected. .TP \fIpathName \fBselection range \fIstart end\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 .\" METHOD: validate .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, |
︙ | ︙ | |||
440 441 442 443 444 445 446 | .RE \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .RS | | > | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | .RE \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .RS Some themes use a graphical background and their field background colors cannot be changed. .RE \fB\-foreground\fP \fIcolor\fP .br \fB\-insertcolor\fP \fIcolor\fP .br \fB\-insertwidth\fP \fIamount\fP .br |
︙ | ︙ |
Changes to doc/ttk_frame.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::frame n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::frame \- Simple container widget .SH SYNOPSIS | | | | | | > | | 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 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::frame n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::frame \- Simple container widget .SH SYNOPSIS \fBttk::frame\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::frame\fR widget is a container, used to group other widgets together. .SO ttk_widget \-class \-cursor \-padding \-style \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-borderwidth borderWidth BorderWidth The desired width of the widget border. Defaults to 0. May be ignored depending on the theme used. .OP \-relief relief Relief One of the standard Tk border styles: \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR, or \fBsunken\fR. 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.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk_image n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk_image \- Define an element based on an image .SH SYNOPSIS | | > | > | | > > > | > | | > | > > > > > > | | | | | | 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 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk_image n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk_image \- Define an element based on an image .SH SYNOPSIS \fBttk::style element create \fIname \fBimage\fI imageSpec\fR ?\fIoptions\fR? .BE .SH DESCRIPTION .PP The \fIimage\fR element factory creates a new element in the current theme whose visual appearance is determined by Tk images. \fIimageSpec\fP is a list of one or more elements. The first element is the default image name. The rest of the list is a sequence of \fIstatespec / value\fR pairs specifying other images to use when the element is in a particular state or combination of states. .SH OPTIONS .PP Valid \fIoptions\fR are: .\" OPTION: -border .TP \fB\-border\fI padding\fR . \fIpadding\fR is a list of up to four integers, specifying the left, top, right, and bottom borders, respectively. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right border; a list of two numbers specify the horizontal and the vertical border; a single number specifies the same border all the way around the element. See \fBIMAGE STRETCHING\fR, below. .\" OPTION: -height .TP \fB\-height \fIheight\fR . Specifies a minimum height for the element. If less than zero, the base image's height is used as a default. .\" OPTION: -padding .TP \fB\-padding\fI padding\fR . Specifies the element's interior padding. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. Defaults to \fB\-border\fR if not specified. .\" OPTION: -sticky .TP \fB\-sticky\fI spec\fR . Specifies how the image is placed within the final parcel. \fIspec\fR contains zero or more characters .QW n , .QW s , .QW w , or .QW e . .\" OPTION: -width .TP \fB\-width \fIwidth\fR . Specifies a minimum width for the element. If less than zero, the base image's width is used as a default. .SH "IMAGE STRETCHING" .PP If the element's allocated parcel is larger than the image, the image will be placed in the parcel based on the \fB\-sticky\fR option. If the image needs to stretch horizontally (i.e., \fB\-sticky ew\fR) 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 '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_intro.n.
︙ | ︙ | |||
79 80 81 82 83 84 85 | the side specified by the \fB\-side\fR option, and placed within the parcel according to the \fB\-sticky\fR option. For example, the layout for a horizontal scrollbar is: .PP .CS ttk::\fBstyle layout\fR Horizontal.TScrollbar { | | | | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | the side specified by the \fB\-side\fR option, and placed within the parcel according to the \fB\-sticky\fR option. For example, the layout for a horizontal scrollbar is: .PP .CS ttk::\fBstyle layout\fR Horizontal.TScrollbar { Scrollbar.trough -children { Scrollbar.leftarrow -side left -sticky w Scrollbar.rightarrow -side right -sticky e Scrollbar.thumb -sticky ew } } .CE .PP By default, the layout for a widget is the same as its class name. Some widgets may override this (for example, the \fBttk::scrollbar\fR widget chooses different layouts based on the \fB\-orient\fR option). |
︙ | ︙ | |||
147 148 149 150 151 152 153 | which specifies values for element options. Style names use a recursive dotted notation like layouts and elements; by default, widgets use the class name to look up a style in the current theme. For example: .PP .CS ttk::\fBstyle configure\fR TButton \e | | | | | | | | 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 | which specifies values for element options. Style names use a recursive dotted notation like layouts and elements; by default, widgets use the class name to look up a style in the current theme. For example: .PP .CS ttk::\fBstyle configure\fR TButton \e -background #d9d9d9 \e -foreground black \e -relief raised \e ; .CE .PP Many elements are displayed differently depending on the widget state. For example, buttons have a different background when they are active, a different foreground when disabled, and a different relief when pressed. The \fBstyle map\fR command specifies dynamic option settings for a particular style: .PP .CS ttk::\fBstyle map\fR TButton \e -background [list disabled #d9d9d9 active #ececec] \e -foreground [list disabled #a3a3a3] \e -relief [list {pressed !disabled} sunken] \e ; .CE .SH "SEE ALSO" ttk::widget(n), ttk::style(n) '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_label.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::label n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::label \- Display a text string and/or image .SH SYNOPSIS | | | | | > | 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 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::label n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::label \- Display a text string and/or image .SH SYNOPSIS \fBttk::label\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::label\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO ttk_widget \-anchor \-class \-compound \-cursor \-font \-foreground \-image \-justify \-padding \-state \-style \-takefocus \-text \-textvariable \-underline \-width \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background frameColor FrameColor The widget's background color. If unspecified, the theme default is used. |
︙ | ︙ | |||
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 | | | > | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::labelframe n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::labelframe \- Container widget with optional label .SH SYNOPSIS | | | | | 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 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::labelframe n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::labelframe \- Container widget with optional label .SH SYNOPSIS \fBttk::labelframe\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::labelframe\fR widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget. .SO ttk_widget \-class \-cursor \-padding \-style \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .\" XXX: Currently included, but may go away: .\" XXX: .OP -borderwidth borderWidth BorderWidth .\" XXX: The desired width of the widget border. Default is theme-dependent. .\" XXX: .OP -relief relief Relief .\" XXX: One of the standard Tk border styles: |
︙ | ︙ | |||
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.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::menubutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::menubutton \- Widget that pops down a menu when pressed .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::menubutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::menubutton \- Widget that pops down a menu when pressed .SH SYNOPSIS \fBttk::menubutton\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::menubutton\fR widget displays a textual label and/or image, and displays a menu when pressed. .SO ttk_widget \-class \-compound \-cursor |
︙ | ︙ | |||
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::notebook n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::notebook \- Multi-paned container widget .SH SYNOPSIS .nf | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::notebook n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::notebook \- Multi-paned container widget .SH SYNOPSIS .nf \fBttk::notebook\fI pathname \fR?\fIoptions...\fR? .br \fIpathname \fBadd\fI window\fR ?\fIoptions...\fR? \fIpathname \fBinsert\fI index window\fR ?\fIoptions...\fR? .fi .BE .SH DESCRIPTION A \fBttk::notebook\fR widget manages a collection of windows and displays a single one at a time. Each content window is associated with a \fItab\fR, which the user may select to change the currently-displayed window. |
︙ | ︙ | |||
37 38 39 40 41 42 43 | of the notebook. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | of the notebook. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. .OP \-width width Width If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used. .SH "TAB OPTIONS" |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | which identifies the currently-selected tab; or: .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. | > > > > > > > > > > > > < < | < < < > > > > > | > | > > > > > | < < > | < < > > > | 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 | which identifies the currently-selected tab; or: .IP \(bu The literal string .QW \fBend\fR , which returns the number of tabs (only valid for .QW "\fIpathname \fBindex\fR" ). .PP Indexes support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\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: .\" METHOD: add .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. .\" METHOD: forget .TP \fIpathname \fBforget \fItabid\fR . Removes the tab specified by \fItabid\fR, unmaps and unmanages the associated window. .\" METHOD: hide .TP \fIpathname \fBhide \fItabid\fR . Hides the tab specified by \fItabid\fR. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the \fBadd\fR command. .\" METHOD: identify .TP \fIpathname \fBidentify\fI component x y\fR . Returns the name of the element under the point given by \fIx\fR and \fIy\fR, or the empty string if no component is present at that location. The following subcommands are supported: .RS .TP \fIpathname \fBidentify element\fI x y\fR . Returns the name of the element at the specified location. .TP \fIpathname \fBidentify tab\fI x y\fR . Returns the index of the tab at the specified location. .RE .\" METHOD: index .TP \fIpathname \fBindex \fItabid\fR . Returns the numeric index of the tab specified by \fItabid\fR, or the total number of tabs if \fItabid\fR is the string .QW \fBend\fR . .\" METHOD: insert .TP \fIpathname \fBinsert \fIpos subwindow options...\fR . 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. .\" METHOD: select .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. .\" METHOD: tab .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. See \fBTAB OPTIONS\fR for the available options. .\" METHOD: tabs .TP \fIpathname \fBtabs\fR . Returns the list of windows managed by the notebook, in the index order of their associated tabs. .SH "KEYBOARD TRAVERSAL" To enable keyboard traversal for a toplevel window containing a notebook widget \fI$nb\fR, call: .CS ttk::notebook::enableTraversal $nb |
︙ | ︙ | |||
199 200 201 202 203 204 205 | are direct children of the notebook. .SH "VIRTUAL EVENTS" The notebook widget generates a \fB<<NotebookTabChanged>>\fR virtual event after a new tab is selected. .SH "EXAMPLE" .CS pack [\fBttk::notebook\fR .nb] | | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | are direct children of the notebook. .SH "VIRTUAL EVENTS" The notebook widget generates a \fB<<NotebookTabChanged>>\fR virtual event after a new tab is selected. .SH "EXAMPLE" .CS pack [\fBttk::notebook\fR .nb] \&.nb add [frame .nb.f1] -text "First tab" \&.nb add [frame .nb.f2] -text "Second tab" \&.nb select .nb.f2 ttk::notebook::enableTraversal .nb .CE .SH "STYLING OPTIONS" .PP The class name for a \fBttk::notebook\fP is \fBTNotebook\fP. The tab has a class name of \fBTNotebook.Tab\fP |
︙ | ︙ | |||
228 229 230 231 232 233 234 | .br \fB\-lightcolor\fP \fIcolor\fP .br \fB\-padding\fP \fIpadding\fP .br \fB\-tabmargins\fP \fIpadding\fP .br | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .br \fB\-lightcolor\fP \fIcolor\fP .br \fB\-padding\fP \fIpadding\fP .br \fB\-tabmargins\fP \fIpadding\fP .br \fB\-tabposition\fP \fIposition\fP .RS Specifies the position of the tab row or column as a string of length 1 or 2. The first character indicates the side as \fBn\fP, \fBs\fP, \fBw\fP, or \fBe\fP, while the second character (if present) is the sticky bit (specified as \fBw\fP, \fBe\fP, \fBn\fP, or \fBs\fP) within the tab position. The default position is \fBn\fP for the \fBaqua\fP theme and \fBnw\fP for all the other built-in themes. .RE .br .PP \fBTNotebook.Tab\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-compound\fP \fIcompound\fP .br \fB\-expand\fP \fIpadding\fP .RS Defines how much the tab grows in size. Usually used with the \fBselected\fP dynamic state. \fB\-tabmargins\fP should be set appropriately so that there is room for the tab growth. For example, the Ttk library file \fBvistaTheme.tcl\fP contains the lines .CS ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab -expand {selected {2 2 2 2}} .CE which are valid for the default value \fBnw\fP of the \fB\-tabposition\fP style option. For a \fBttk::notebook\fP style \fBnbStyle\fP defined by .CS set nbStyle SW.TNotebook ttk::style configure $nbStyle -tabposition sw .CE you will have to adapt the above settings as follows: .CS ttk::style configure $nbStyle -tabmargins {2 0 2 2} ttk::style map $nbStyle.Tab -expand {selected {2 2 2 2}} .CE .RE \fB\-font\fP \fIfont\fP .br \fB\-foreground\fP \fIcolor\fP .br \fB\-padding\fP \fIpadding\fP .RS Some themes (e.g., \fBclam\fP) use a different \fIpadding\fP for the selected tab. For example, the Ttk library file \fBclamTheme.tcl\fP contains the lines .CS ttk::style configure TNotebook.Tab \\ -padding {4.5p 1.5p 4.5p 1.5p} ttk::style map TNotebook.Tab \\ -padding {selected {4.5p 3p 4.5p 1.5p}} .CE which are valid for the default value \fBnw\fP of the \fB\-tabposition\fP style option. Again, for a different tab position you will have to adapt the above settings accordingly. .RE .PP Some options are only available for specific themes. .PP See the \fBttk::style\fP manual page for information on how to configure ttk styles. .SH "SEE ALSO" ttk::widget(n), grid(n) .SH "KEYWORDS" pane, tab '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_panedwindow.n.
1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::panedwindow n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::panedwindow \- Multi-pane container window .SH SYNOPSIS .nf | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::panedwindow n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::panedwindow \- Multi-pane container window .SH SYNOPSIS .nf \fBttk::panedwindow\fI pathname \fR?\fIoptions\fR? .br \fIpathname \fBadd\fI window\fR ?\fIoptions...\fR? \fIpathname \fBinsert\fI index window\fR ?\fIoptions...\fR? .fi .BE .SH DESCRIPTION A \fBttk::panedwindow\fR widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows by dragging the sash between panes. |
︙ | ︙ | |||
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 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 | .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: .\" METHOD: add .TP \fIpathname \fBadd \fIsubwindow options...\fR . Adds a new pane to the window. See \fBPANE OPTIONS\fR for the list of available options. .\" METHOD: forget .TP \fIpathname \fBforget \fIpane\fR . Removes the specified subpane from the widget. \fIpane\fR is either an integer index or the name of a managed subwindow. .\" METHOD: identify .TP \fIpathname \fBidentify \fIcomponent x y\fR . Returns the name of the element under the point given by \fIx\fR and \fIy\fR, or the empty string if no component is present at that location. If \fIcomponent\fR is omitted, it defaults to \fBsash\fR. The following subcommands are supported: .RS .TP \fIpathname \fBidentify element \fIx y\fR . Returns the name of the element at the specified location. .TP \fIpathname \fBidentify sash \fIx y\fR . Returns the index of the sash at the specified location. .RE .\" METHOD: insert .TP \fIpathname \fBinsert \fIpos subwindow options...\fR . 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 paned window, moves it to the specified position. See \fBPANE OPTIONS\fR for the list of available options. .\" METHOD: pane .TP \fIpathname \fBpane \fIpane \-option \fR?\fIvalue \fR?\fI\-option value...\fR . Query or modify the options of the specified \fIpane\fR, where \fIpane\fR is either an integer index or the name of a managed subwindow. If no \fI\-option\fR is specified, returns a dictionary of the pane 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. .\" METHOD: panes .TP \fIpathname \fBpanes\fR . Returns the list of all windows managed by the widget, in the index order of their associated panes. .\" METHOD: sashpos .TP \fIpathname \fBsashpos \fIindex\fR ?\fInewpos\fR? . If \fInewpos\fR is specified, sets the position of sash number \fIindex\fR. May adjust the positions of adjacent sashes to ensure that positions are monotonically increasing. 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. .SH "STYLING OPTIONS" .PP The class name for a \fBttk::panedwindow\fP is \fBTPanedwindow\fP. The sash has a class name of \fBSash\fP. .PP \fBTPanedwindow\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .PP \fBSash\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-gripsize\fP \fIsize\fP (number of screen units) .br \fB\-handlepad\fP \fIamount\fP .br \fB\-handlesize\fP \fIamount\fP .br \fB\-lightcolor\fP \fIcolor\fP .br |
︙ | ︙ |
Changes to doc/ttk_progressbar.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::progressbar n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::progressbar \- Provide progress feedback .SH SYNOPSIS | | | | | | 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 | '\" '\" Copyright (c) 2005 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::progressbar n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::progressbar \- Provide progress feedback .SH SYNOPSIS \fBttk::progressbar\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::progressbar\fR widget shows the status of a long-running operation. They can operate in two modes: \fIdeterminate\fR mode shows the amount completed relative to the total amount of work to be done, and \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .PP If the value of \fB\-orient\fR is \fBhorizontal\fR a text string can be displayed inside the progressbar. This string can be configured using the \fB\-anchor\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-justify\fR, \fB\-text\fR and \fB\-wraplength\fR options. If the value of \fB\-orient\fR is \fBvertical\fR then these options are ignored. .SO ttk_widget \-anchor \-class \-cursor \-font \-foreground \-justify \-style \-takefocus \-text \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" |
︙ | ︙ | |||
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 88 89 90 91 92 93 94 95 96 97 98 | .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: .\" METHOD: start .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). .\" METHOD: step .TP \fIpathName \fBstep\fR ?\fIamount\fR? . Increments the \fB\-value\fR by \fIamount\fR. \fIamount\fR defaults to 1.0 if omitted. .\" METHOD: stop .TP \fIpathName \fBstop\fR . Stop autoincrement mode: cancels any recurring timer event initiated by \fIpathName \fBstart\fR. .SH "STYLING OPTIONS" .PP The class name for a \fBttk::progressbar\fP is \fBTProgressbar\fP. .PP \fBTProgressbar\fP styling options configurable with \fBttk::style\fP |
︙ | ︙ |
Changes to doc/ttk_radiobutton.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::radiobutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::radiobutton \- Mutually exclusive option widget .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::radiobutton n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::radiobutton \- Mutually exclusive option widget .SH SYNOPSIS \fBttk::radiobutton\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP \fBttk::radiobutton\fR widgets are used in groups to show or change a set of mutually-exclusive options. Radiobuttons are linked to a Tcl variable, and have an associated value; when a radiobutton is clicked, |
︙ | ︙ | |||
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 51 52 53 54 | 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: .\" METHOD: invoke .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? .\" Missing: flash. This is definitely not useful. .SH "WIDGET STATES" |
︙ | ︙ |
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 91 92 93 94 95 96 | .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: .\" METHOD: get .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. .\" METHOD: see .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 .\" METHOD: coords .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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::scrollbar n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::scrollbar \- Control the viewport of a scrollable widget .SH SYNOPSIS | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | '\" '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::scrollbar n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::scrollbar \- Control the viewport of a scrollable widget .SH SYNOPSIS \fBttk::scrollbar\fI pathName \fR?\fIoptions...\fR? .BE .SH DESCRIPTION .PP \fBttk::scrollbar\fR widgets are typically linked to an associated window that displays a document of some sort, such as a file being edited or a drawing. A scrollbar displays a \fIthumb\fR in the middle portion of the scrollbar, |
︙ | ︙ | |||
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 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 | 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: .\" METHOD: get .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. .\" METHOD: set .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. .\" METHOD: delta .TP \fIpathName \fBdelta \fIdeltaX deltaY\fR . Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in thumb position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the thumb \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the thumb \fIdeltaY\fR pixels down. The arguments and the result may be zero or negative. .\" METHOD: fraction .TP \fIpathName \fBfraction \fIx y\fR . Returns a real number between 0 and 1 indicating where the point given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar, where 0.0 corresponds to the top or left of the trough and 1.0 corresponds to the bottom or right. \fIX\fR and \fIy\fR are pixel coordinates relative to the scrollbar widget. If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest point in the trough is used. .SH "SCROLLING COMMANDS" .PP When the user interacts with the scrollbar, for example by dragging the thumb, the scrollbar notifies the associated widget that it must change its view. The scrollbar makes the notification by evaluating a Tcl command generated from the scrollbar's \fB\-command\fR option. The command may take any of the following forms. In each case, \fIprefix\fR is the contents of the \fB\-command\fR option, which usually has a form like \fB.t yview\fR .TP \fIprefix \fBmoveto \fIfraction\fR . \fIFraction\fR is a real number between 0 and 1. The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP \fIprefix \fBscroll \fInumber \fBpages\fR . The widget should adjust its view by \fInumber\fR pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. \fINumber\fR is either 1, which means the next page should become visible, or \-1, which means that the previous page should become visible. .TP \fIprefix \fBscroll \fInumber \fBunits\fR . The widget should adjust its view by \fInumber\fR units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. \fINumber\fR is either 1, which means one unit should scroll off the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. .SH "WIDGET STATES" .PP The scrollbar automatically sets the \fBdisabled\fR state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the \fBactive\fR and \fBpressed\fR state flags of individual elements, based on the position and state of the mouse pointer. .SH EXAMPLE .PP .CS set f [frame .f] \fBttk::scrollbar\fR $f.hsb -orient horizontal -command [list $f.t xview] \fBttk::scrollbar\fR $f.vsb -orient vertical -command [list $f.t yview] text $f.t -xscrollcommand [list $f.hsb set] -yscrollcommand [list $f.vsb set] grid $f.t -row 0 -column 0 -sticky nsew grid $f.vsb -row 0 -column 1 -sticky nsew grid $f.hsb -row 1 -column 0 -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 pack $f .CE .SH "STYLING OPTIONS" .PP The class name for a \fBttk::scrollbar\fP is \fBTScrollbar\fP. .PP Dynamic states: \fBactive\fP, \fBdisabled\fP. |
︙ | ︙ | |||
173 174 175 176 177 178 179 | .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP (color of the dark part of the 3D relief) .br \fB\-foreground\fP \fIcolor\fP .br | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP (color of the dark part of the 3D relief) .br \fB\-foreground\fP \fIcolor\fP .br \fB\-gripsize\fP \fIsize\fP (number of screen units) .br \fB\-lightcolor\fP \fIcolor\fP (color of the light part of the 3D relief) .br \fB\-troughcolor\fP \fIcolor\fP .PP Some options are only available for specific themes. .PP |
︙ | ︙ |
Changes to doc/ttk_separator.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::separator n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::separator \- Separator bar .SH SYNOPSIS | | | | > | | 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 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::separator n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::separator \- Separator bar .SH SYNOPSIS \fBttk::separator\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::separator\fR widget displays a horizontal or vertical separator bar. .SO ttk_widget \-class \-cursor \-style \-takefocus .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.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2006 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::sizegrip n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::sizegrip \- Bottom-right corner resize widget .SH SYNOPSIS | | | | > | | | | | 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 | '\" '\" Copyright (c) 2006 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::sizegrip n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::sizegrip \- Bottom-right corner resize widget .SH SYNOPSIS \fBttk::sizegrip\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::sizegrip\fR widget (also known as a \fIgrow box\fR) allows the user to resize the containing toplevel window 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 .PP Using pack: .CS pack [ttk::frame $top.statusbar] -side bottom -fill x pack [\fBttk::sizegrip\fR $top.statusbar.grip] -side right -anchor se .CE .PP Using grid: .CS grid [\fBttk::sizegrip\fR $top.statusbar.grip] \e -row $lastRow -column $lastColumn -sticky se # ... optional: add vertical scrollbar in $lastColumn, # ... optional: add horizontal scrollbar in $lastRow .CE .SH "BUGS" .PP If the containing toplevel's position was specified relative to the right or bottom of the screen |
︙ | ︙ |
Changes to doc/ttk_spinbox.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2008 Pat Thoyts '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::spinbox n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::spinbox \- Selecting text field widget .SH SYNOPSIS | | | > | | | | | 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 | '\" '\" Copyright (c) 2008 Pat Thoyts '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::spinbox n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::spinbox \- Selecting text field widget .SH SYNOPSIS \fBttk::spinbox\fI pathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION .PP A \fBttk::spinbox\fR widget is a \fBttk::entry\fR widget with built-in up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the \fBttk::entry\fR widget including support of the \fB\-textvariable\fR option to link the value displayed by the widget to a Tcl variable. .SO ttk_widget \-class \-cursor \-state \-style \-takefocus \-xscrollcommand \-placeholder \-placeholderforeground .SE .SO ttk_entry \-validate \-validatecommand .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command Specifies a Tcl command to be invoked whenever a spinbutton is invoked. .OP \-format format Format Specifies an alternate format to use when setting the string value when using the \fB\-from\fR and \fB\-to\fR range. This must be a format specifier of the form \fB%<pad>.<pad>f\fR, as it will format a floating-point number. .OP \-from from From A floating-point value specifying the lowest value for the spinbox. This is used in conjunction with \fB\-to\fR and \fB\-increment\fR to set a numerical range. .OP \-increment increment Increment A floating-point value specifying the change in value to be applied each time one of the widget spin buttons is pressed. The up button applies a positive increment, the down button applies a negative increment. .OP \-to to To A floating-point value specifying the highest permissible value for the widget. See also \fB\-from\fR and \fB\-increment\fR. range. .OP \-values values Values This must be a Tcl list of values. If this option is set then this will override any range set using the \fB\-from\fR, \fB\-to\fR and \fB\-increment\fR options. The widget will instead use the values specified beginning with the first value. |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | .PP See the \fBttk::entry\fR manual for information about using the \fB\-validate\fR and \fB\-validatecommand\fR options. .SH "WIDGET COMMAND" .PP The following subcommands are possible for spinbox widgets in addition to the commands described for the \fBttk::entry\fR widget: .TP \fIpathName \fBget\fR Returns the spinbox's current value. .TP \fIpathName \fBset \fIvalue\fR Set the spinbox string to \fIvalue\fR. If a \fB\-format\fR option has been configured then this format will be applied. If formatting fails or is not set or the \fB\-values\fR option has been used then the value is set directly. .SH "VIRTUAL EVENTS" .PP The spinbox widget generates a \fB<<Increment>>\fR virtual event when | > > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | .PP See the \fBttk::entry\fR manual for information about using the \fB\-validate\fR and \fB\-validatecommand\fR options. .SH "WIDGET COMMAND" .PP The following subcommands are possible for spinbox widgets in addition to the commands described for the \fBttk::entry\fR widget: .\" METHOD: get .TP \fIpathName \fBget\fR . Returns the spinbox's current value. .\" METHOD: set .TP \fIpathName \fBset \fIvalue\fR . Set the spinbox string to \fIvalue\fR. If a \fB\-format\fR option has been configured then this format will be applied. If formatting fails or is not set or the \fB\-values\fR option has been used then the value is set directly. .SH "VIRTUAL EVENTS" .PP The spinbox widget generates a \fB<<Increment>>\fR virtual event when |
︙ | ︙ |
Changes to doc/ttk_style.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::style n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::style \- Manipulate style database .SH SYNOPSIS | | > > > > > > > > > > > | | > > > > > > | > > > > | > > > > > > | | > > | > > > > > > > | > > > > | > > > > > | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | '\" '\" Copyright (c) 2004 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk::style n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk::style \- Manipulate style database .SH SYNOPSIS \fBttk::style\fI option\fR ?\fIargs\fR? .BE .SH NOTES .PP See also the Tcl'2004 conference presentation, available at https://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: .\" METHOD: configure .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. .\" METHOD: element .TP \fBttk::style element\fI args\fR .RS .TP \fBttk::style element create\fI elementName type\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 (see \fBttk_image\fR(n)) but themes may define other element types (see \fBTtk_RegisterElementFactory\fR). On suitable versions of Windows an element factory is registered to create Windows theme elements (see \fBttk_vsapi\fR(n)). .TP \fBttk::style element names\fR . Returns the list of elements defined in the current theme. .TP \fBttk::style element options \fIelement\fR . Returns the list of \fIelement\fR's options. .RE .\" METHOD: layout .TP \fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR? . Define the widget layout for style \fIstyle\fR. See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR. If \fIlayoutSpec\fR is omitted, return the layout specification for style \fIstyle\fR. .\" METHOD: lookup .TP \fBttk::style lookup \fIstyle \-option \fR?\fIstate \fR?\fIdefault\fR?? . Returns the value specified for \fI\-option\fR in style \fIstyle\fR in state \fIstate\fR, using the standard lookup rules for element options. \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. .\" METHOD: map .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. .\" METHOD: theme .TP \fBttk::style theme\fI args\fR .RS .TP \fBttk::style theme create\fI themeName\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 script\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 .PP A \fIlayout\fR specifies a list of elements, each followed by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the \fBpack\fR geometry manager: given an initial cavity, each element is allocated a parcel. Then the parcel actually used by the element is adjusted within the allocated parcel. Valid options are: .\" -border should remain undocumented for now (dubious usefulness) .\" .TP .\" \fB\-border\fI boolean\fR .\" . .\" Specifies whether the element is drawn after its children. Defaults to 0. .\" OPTION: -children .TP \fB\-children { \fIsublayout...\fB }\fR . Specifies a list of elements to place inside the element. .\" OPTION: -expand .TP \fB\-expand\fI boolean\fR . Specifies whether the allocated parcel is the entire cavity. If so, simultaneous specification of \fB\-side\fR is ignored. Defaults to 0. .\" OPTION: -side .TP \fB\-side \fIside\fR . Specifies which side of the cavity to place the element; one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. For instance, \fB\-side top\fR allocates the parcel along the top of the cavity having width and height respectively the width of the cavity and the height of the element. If omitted, the allocated parcel is the entire cavity (same effect as \fB\-expand\fR 1). .\" OPTION: -sticky .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR . Specifies the actual parcel position and size inside the allocated parcel. If specified as an empty string then the actual parcel is centered in the allocated parcel. Default is \fBnswe\fR. .\" -unit should remain undocumented for now (dubious usefulness) .\" .TP .\" \fB\-unit\fI boolean\fR .\" . .\" Specifies whether the element propagates its state to its children. .\" Defaults to 0. .PP For example: .CS ttk::style layout Horizontal.TScrollbar { Scrollbar.trough -children { Scrollbar.leftarrow -side left Scrollbar.rightarrow -side right Horizontal.Scrollbar.thumb -side left -sticky ew } } .CE .SH ROOT STYLE .PP The .QW . theme root style can be configured like any other style, providing defaults for its derived styles. In addition to the usual options, .QW . styling options configurable with \fBttk::style\fP are: .PP \fB\-insertofftime\fP \fIamount\fP .RS Specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain .QW off in each blink cycle. If this option is zero then the cursor does not blink: it is on all the time. Defaults to 300 ms, unless overriden with a \fBRESOURCE_MANAGER\fR property or \fB.Xdefaults\fR file. .RE .PP \fB\-insertontime\fP \fIamount\fP .RS Specifies a non-negative integer value indicating the number of milliseconds the insertion cursor should remain .QW on in each blink cycle. Defaults to 600 ms, unless overriden with a \fBRESOURCE_MANAGER\fR property or \fB.Xdefaults\fR file. .RE .SH "SEE ALSO" ttk::intro(n), ttk::widget(n), photo(n), ttk_image(n) .SH KEYWORDS style, theme, appearance '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_treeview.n.
︙ | ︙ | |||
58 59 60 61 62 63 64 | specifying which data columns are displayed and the order in which they appear, or the string \fB#all\fP. If set to \fB#all\fP (the default), all columns are shown in the order given. .OP \-height height Height Specifies the number of rows which should be visible. | | > > > | > > > > > > > > > > > > > > > > > > | < < | | > > > > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > > > > > > > | > > | | | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < > > > > > > > > > > > > > > > > > | > | > > > | < < > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > < < < < < < < | | > > | | > > > > | > > > > | | | > | > | > | | > > > | > | > > > > > > > > | > > > | 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 | specifying which data columns are displayed and the order in which they appear, or the string \fB#all\fP. If set to \fB#all\fP (the default), all columns are shown in the order given. .OP \-height height Height Specifies the number of rows which should be visible. Note that the requested width is determined from the sum of the column widths. .OP \-selectmode selectMode SelectMode Controls how the built-in class bindings manage the selection. One of \fBextended\fR, \fBbrowse\fR, or \fBnone\fR. .RS .PP 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 that 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: .\" METHOD: bbox .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). .\" METHOD: cellselection .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 lastCell\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 lastCell\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 lastCell\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 lastCell\fR . Toggle the cell selection state of each cell in the rectangle defined. .RE .\" METHOD: children .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 with \fInewchildren\fR. Items in the old child list not present in the new child list are detached from the tree. None of the items in \fInewchildren\fR may be an ancestor of \fIitem\fR. .RE .\" METHOD: column .TP \fIpathname \fBcolumn \fIcolumn\fR ?\fI\-option \fR?\fIvalue \-option value...\fR? . Query or modify the options for the specified \fIcolumn\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 options are updated with the specified values. The following options may be set on each column: .RS .\" OPTION: -id .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 \fB\-id #0\fR. .\" OPTION: -anchor .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. .\" OPTION: -minwidth .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. .\" OPTION: -separator .TP \fB\-separator \fIboolean\fR . Specifies whether or not a column separator should be drawn to the right of the column. Default is false. .\" OPTION: -stretch .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. .\" OPTION: -width .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 fBcolumn #0\fR to configure the tree column. .RE .\" METHOD: delete .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. .\" METHOD: detach .TP \fIpathname \fBdetach \fIitemList\fR . Unlinks all of the specified items in \fIitemList\fR from the tree. The items and all of their descendants are still present and may be reinserted at another point in the tree with the \fBmove\fR operation, but will not be displayed until that is done. The root item may not be detached. See also: \fBdelete\fR. .\" METHOD: detached .TP \fIpathname \fBdetached \fR?\fIitem\fR? . If \fIitem\fR is provided, returns a boolean value indicating whether it is the name of a detached item (see \fBdetach\fR). Otherwise, returns a list of all the detached items (in an arbitrary order). The root item is never detached. .\" METHOD: exists .TP \fIpathname \fBexists \fIitem\fR . Returns 1 if the specified \fIitem\fR is present in the tree, 0 otherwise. .\" METHOD: focus .TP \fIpathname \fBfocus \fR?\fIitem\fR? . If \fIitem\fR is specified, sets the focus item to \fIitem\fR. Otherwise, returns the current focus item, or \fB{}\fR if there is none. .\" Need: way to clear the focus item. {} works for this... .\" .\" METHOD: heading .TP \fIpathname \fBheading \fIcolumn\fR ?\fI\-option \fR?\fIvalue \-option value...\fR? . Query or modify the heading options for the specified \fIcolumn\fR. Valid options are: .RS .\" OPTION: -text .TP \fB\-text \fItext\fR . The text to display in the column heading. .\" OPTION: -image .TP \fB\-image \fIimageName\fR . Specifies an image to display to the right of the column heading. .\" OPTION: -anchor .TP \fB\-anchor \fIanchor\fR . Specifies how the heading text should be aligned. One of the standard Tk anchor values. .\" OPTION: -command .TP \fB\-command \fIscript\fR . A script to evaluate when the heading label is pressed. .PP Use \fIpathname heading #0\fR to configure the tree column heading. .RE .\" METHOD: identify .TP \fIpathname \fBidentify \fIcomponent x y\fR . Returns a description of the specified \fIcomponent\fR under the point given by \fIx\fR and \fIy\fR, or the empty string if no such \fIcomponent\fR is present at that position. The values \fIx\fR and \fIy\fR may have any of the forms acceptable to \fBTk_GetPixels\fR. The following subcommands are supported: .RS .TP \fIpathname \fBidentify region \fIx y\fR .RS Returns one of: .IP heading Tree heading area; use [\fBpathname identify column \fIx y\fR] to determine the heading number. .IP separator Space between two column headings; [\fBpathname identify column \fIx y\fR] 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 and data columns. .RE .\" METHOD: index .TP \fIpathname \fBindex \fIitem\fR . Returns the integer index of \fIitem\fR within its parent's list of children. .\" METHOD: insert .TP \fIpathname \fBinsert \fIparent index\fR ?\fB\-id \fIid\fR? \fIoptions...\fR . Creates a new item. \fIparent\fR is the item ID of the parent item, or the empty string \fB{}\fR to create a new top-level item. \fIindex\fR is an integer, or the value \fBend\fR, specifying where in the list of \fIparent\fR's children to insert the new item. If \fIindex\fR is less than or equal to zero, the new node is inserted at the beginning; if \fIindex\fR is greater than or equal to the current number of children, it is inserted at the end. If \fB\-id\fR is specified, it is used as the item identifier; \fIid\fR must not already exist in the tree. Otherwise, a new unique identifier is generated. .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 .\" METHOD: item .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. See \fBITEM OPTIONS\fR for the list of available options. .\" METHOD: move .TP \fIpathname \fBmove \fIitem parent index\fR . Moves \fIitem\fR to position \fIindex\fR in \fIparent\fR's list of children. It is illegal to move an item under one of its descendants. .RS .PP If \fIindex\fR is less than or equal to zero, \fIitem\fR is moved to the beginning; if greater than or equal to the number of children, it is moved to the end. .RE .\" METHOD: next .TP \fIpathname \fBnext \fIitem\fR . Returns the identifier of \fIitem\fR's next sibling, or \fB{}\fR if \fIitem\fR is the last child of its parent. .\" METHOD: parent .TP \fIpathname \fBparent \fIitem\fR . Returns the ID of the parent of \fIitem\fR, or \fB{}\fR if \fIitem\fR is at the top level of the hierarchy. .\" METHOD: prev .TP \fIpathname \fBprev \fIitem\fR . Returns the identifier of \fIitem\fR's previous sibling, or \fB{}\fR if \fIitem\fR is the first child of its parent. .\" METHOD: see .TP \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. .\" METHOD: selection .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 \fIpathname \fBselection add \fIitemList\fR . Add \fIitemList\fR to the selection. .TP \fIpathname \fBselection remove \fIitemList\fR . Remove \fIitemList\fR from the selection. .TP \fIpathname \fBselection toggle \fIitemList\fR . Toggle the selection state of each item in \fIitemList\fR. .RE .\" METHOD: set .TP \fIpathname \fBset \fIitem\fR ?\fIcolumn\fR? ?\fIvalue\fR? . 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. .\" METHOD: tag .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\fR(n) for details. .RE .TP \fIpathName \fBtag cell \fIsubcommand...\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. .IP \(bu A string of the form \fB#\fIn\fR, where \fIn\fR is an integer, specifying the \fIn\fRth display column. .PP Column identifiers support the same simple interpretation as for the command \fBstring index\fR, with simple integer index arithmetic and indexing relative to \fBend\fR. .PP \fBNOTE:\fR Item \fB\-values\fR may be displayed in a different order than the order in which they are stored. .PP \fBNOTE:\fR Column #0 always refers to the tree column, even if \fB\-show tree\fR is not specified. .PP A \fIdata column number\fR is an index into an item's \fB\-values\fR list; a \fIdisplay column number\fR is the column number in the tree where the values are displayed. Tree labels are displayed in column #0. 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. |
︙ | ︙ | |||
503 504 505 506 507 508 509 510 511 512 | \fB\-background\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .br \fB\-font\fP \fIfont\fP .br \fB\-foreground\fP \fIcolor\fP .br \fB\-rowheight\fP \fIamount\fP .RS | > > > > > > > > > > > > > > | > | > > | | < < < > | > > | 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 | \fB\-background\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .br \fB\-font\fP \fIfont\fP .br \fB\-foreground\fP \fIcolor\fP .br \fB\-indent\fP \fIamount\fP .RS Specifies how far items are indented from their parents. Defaults to 20 pixels. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. .RE .br \fB\-columnseparatorwidth\fP \fIamount\fP .RS Specifies the width of column separators. Defaults to 1 pixel. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. .RE .br \fB\-rowheight\fP \fIamount\fP .RS This is the standard height for an item. Defaults to 20 pixels. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. 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_vsapi.n.
1 2 3 4 5 6 7 8 9 10 11 12 | '\" '\" Copyright (c) 2008 Pat Thoyts '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk_vsapi n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk_vsapi \- Define a Microsoft Visual Styles element .SH SYNOPSIS | | | > | | > > > | 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 | '\" '\" Copyright (c) 2008 Pat Thoyts '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH ttk_vsapi n 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME ttk_vsapi \- Define a Microsoft Visual Styles element .SH SYNOPSIS \fBttk::style element create \fIname \fBvsapi\fI className partId\fR ?\fIstateMap\fR? ?\fIoptions\fR? .BE .SH DESCRIPTION .PP The \fBvsapi\fR element factory creates a new element in the current theme whose visual appearance is drawn using the Microsoft Visual Styles API which is responsible for the themed styles on Windows XP and Vista. This factory permits any of the Visual Styles parts to be declared as Ttk elements that can then be included in a style layout to modify the appearance of Ttk widgets. .PP The \fIclassName\fR and \fIpartId\fR are required parameters and specify the Visual Styles class and part as given in the Microsoft documentation. The \fIstateMap\fR may be provided to map Ttk states to Visual Styles API states (see \fBSTATE MAP\fR). .SH "OPTIONS" .PP Valid \fIoptions\fR are: .\" OPTION: -padding .TP \fB\-padding \fIpadding\fR . Specify the element's interior padding. \fIpadding\fR is a list of up to four integers specifying the left, top, right and bottom padding quantities respectively. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. This option may not be mixed with any other options. .\" OPTION: -margins .TP \fB\-margins \fIpadding\fR . Specifies the elements exterior padding. \fIpadding\fR is a list of up to four integers specifying the left, top, right and bottom padding quantities respectively. This option may not be mixed with any other options. .\" OPTION: -width .TP \fB\-width \fIwidth\fR . Specifies the height for the element. If this option is set then the Visual Styles API will not be queried for the recommended size or the part. If this option is set then \fB\-height\fR should also be set. The \fB\-width\fR and \fB\-height\fR options cannot be mixed with the \fB\-padding\fR or \fB\-margins\fR options. .\" OPTION: -height .TP \fB\-height \fIheight\fR . Specifies the height of the element. See the comments for \fB\-width\fR. .SH "STATE MAP" .PP The \fIstateMap\fR parameter is a list of ttk states and the |
︙ | ︙ |
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. |
︙ | ︙ | |||
121 122 123 124 125 126 127 | Specifies the internal padding for the widget. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. | | | | | | > | 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 | Specifies the internal padding for the widget. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. .OP \-text text Text Specifies a text string to be displayed inside the widget (unless overridden by \fB\-textvariable\fR for the widgets supporting this option). .OP \-textvariable textVariable Variable Specifies the name of a global variable whose value will be used in place of the \fB\-text\fR resource. .OP \-underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. \fBend\fR corresponds to the last character, \fBend\fR-1 to the before last character, and so on. The underlined character is used for mnemonic activation. .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero \fB\-width\fR |
︙ | ︙ | |||
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 | May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. 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. | > > > | > > > > > > > > > > > | > > > > > > | > > > | > < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < | 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 | May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. 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 .\" METHOD: cget .TP \fIpathName \fBcget \fIoption\fR . Returns the current value of the configuration option given by \fIoption\fR. .\" METHOD: configure .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. .\" METHOD: identify .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. .\" METHOD: instate .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 .\" METHOD: state .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 .\" METHOD: style .TP \fIpathName \fBstyle\fR . Return the style used by the widget. .\" METHOD: xview .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 . Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the widget's content is off-screen to the left, the middle 40% is visible in the window, and 40% of the content is off-screen to the right. These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR option. .TP \fIpathName \fBxview\fI index\fR . Adjusts the view in the window so that the content given by \fIindex\fR is displayed at the left edge of the window. .TP \fIpathName \fBxview moveto\fI fraction\fR . Adjusts the view in the window so that the character \fIfraction\fR of the way through the content appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. '\" or an abbreviation of one of these, but we don't document that. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. .RE .\" METHOD: yview .TP \fIpathName \fByview \fIargs\fR . This command is used to query and change the vertical position of the content in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fByview\fR . Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the vertical span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the widget's content is off-screen to the top, the middle 40% is visible in the window, and 40% of the content is off-screen to the bottom. These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR option. .TP \fIpathName \fByview\fI index\fR . Adjusts the view in the window so that the content given by \fIindex\fR is displayed at the top edge of the window. .TP \fIpathName \fByview moveto\fI fraction\fR . Adjusts the view in the window so that the item \fIfraction\fR of the way through the content appears at the top edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR . This command shifts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer or a float, but if it is a float then it is converted to an integer, rounded away from 0. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. '\" or an abbreviation of one of these, but we don't document that. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then items farther to the top become visible; if it is positive then items farther to the bottom become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by \fInumber\fR average-width characters on the display. .RE .SH "WIDGET STATES" The widget state is a bitmap of independent state flags. Widget state flags include: .IP \fBactive\fR The mouse cursor is over the widget and pressing a mouse button will cause some action to occur. (aka .QW prelight (Gnome), .QW hot (Windows), .QW hover ). .IP \fBdisabled\fR Widget is disabled under program control (aka .QW unavailable , .QW inactive ). .IP \fBfocus\fR Widget has keyboard focus. .IP \fBpressed\fR Widget is being pressed (aka .QW armed in Motif). .IP \fBselected\fR .QW On , .QW true , or .QW current for things like checkbuttons and radiobuttons. .IP \fBbackground\fR Windows and the Mac have a notion of an .QW active or foreground window. The \fBbackground\fR state is set for widgets in a background window, and cleared for those in the foreground window. .IP \fBreadonly\fR Widget should not allow user modification. .IP \fBalternate\fR A widget-specific alternate display format. For example, used for checkbuttons and radiobuttons in the .QW tristate or .QW mixed state, and for buttons with \fB\-default active\fR. .IP \fBinvalid\fR The widget's value is invalid. (Potential uses: scale widget value out of bounds, entry widget value failed validation.) .IP \fBhover\fR The mouse cursor is within the widget. This is similar to the \fBactive\fP state; it is used in some themes for widgets that provide distinct visual feedback for the active widget in addition to the active element within the widget. .PP |
︙ | ︙ |
Changes to doc/winfo.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH winfo n 4.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME winfo \- Return window-related information .SH SYNOPSIS | | > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | .TH winfo n 4.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME winfo \- Return window-related information .SH SYNOPSIS \fBwinfo\fI option \fR?\fIarg ...\fR? .BE .SH DESCRIPTION .PP The \fBwinfo\fR command is used to retrieve information about windows managed by Tk. It can take any of a number of different forms, depending on the \fIoption\fR argument. The legal forms are: .\" METHOD: atom .TP \fBwinfo atom \fR?\fB\-displayof \fIwindow\fR? \fIname\fR . Returns a decimal string giving the integer identifier for the atom whose name is \fIname\fR. If no atom exists with the name \fIname\fR then a new one is created. If the \fB\-displayof\fR option is given then the atom is looked up on the display of \fIwindow\fR; otherwise it is looked up on the display of the application's main window. .\" METHOD: atomname .TP \fBwinfo atomname \fR?\fB\-displayof \fIwindow\fR? \fIid\fR . Returns the textual name for the atom whose integer identifier is \fIid\fR. If the \fB\-displayof\fR option is given then the identifier is looked up on the display of \fIwindow\fR; otherwise it is looked up on the display of the application's main window. This command is the inverse of the \fBwinfo atom\fR command. It generates an error if no such atom exists. .\" METHOD: cells .TP \fBwinfo cells \fIwindow\fR . Returns a decimal string giving the number of cells in the color map for \fIwindow\fR. .\" METHOD: children .TP \fBwinfo children \fIwindow\fR . Returns a list containing the path names of all the children of \fIwindow\fR. Top-level windows are returned as children of their logical parents. The list is in stacking order, with the lowest window first, except for Top-level windows which are not returned in stacking order. Use the \fBwm stackorder\fR command to query the stacking order of Top-level windows. .\" METHOD: class .TP \fBwinfo class \fIwindow\fR . Returns the class name for \fIwindow\fR. .\" METHOD: colormapfull .TP \fBwinfo colormapfull \fIwindow\fR . Returns 1 if the colormap for \fIwindow\fR is known to be full, 0 otherwise. The colormap for a window is .QW known to be full if the last attempt to allocate a new color on that window failed and this application has not freed any colors in the colormap since the failed allocation. .\" METHOD: containing .TP \fBwinfo containing \fR?\fB\-displayof \fIwindow\fR? \fIrootX rootY\fR . Returns the path name for the window containing the point given by \fIrootX\fR and \fIrootY\fR. \fIRootX\fR and \fIrootY\fR are specified in screen units (i.e. any form acceptable to \fBTk_GetPixels\fR) in the coordinate system of the root window (if a virtual-root window manager is in use then the coordinate system of the virtual root window is used). If the \fB\-displayof\fR option is given then the coordinates refer to the screen containing \fIwindow\fR; otherwise they refer to the screen of the application's main window. If no window in this application contains the point then an empty string is returned. An empty string is also returned if the point lies in the title bar or border of its highest containing toplevel in this application. (Note that with some window managers the borders may be invisible.) In selecting the containing window, children are given higher priority than parents and among siblings the highest one in the stacking order is chosen. .\" METHOD: depth .TP \fBwinfo depth \fIwindow\fR . Returns a decimal string giving the depth of \fIwindow\fR (number of bits per pixel). .\" METHOD: exists .TP \fBwinfo exists \fIwindow\fR . Returns 1 if there exists a window named \fIwindow\fR, 0 if no such window exists. .\" METHOD: fpixels .TP \fBwinfo fpixels \fIwindow number\fR . Returns a floating-point value giving the number of pixels in \fIwindow\fR corresponding to the distance given by \fInumber\fR. \fINumber\fR may be specified in any of the forms acceptable to \fBTk_GetScreenMM\fR, such as .QW 2.0c or .QW 1i . The return value may be fractional; for an integer value, use \fBwinfo pixels\fR. .\" METHOD: geometry .TP \fBwinfo geometry \fIwindow\fR . Returns the geometry for \fIwindow\fR, in the form \fIwidth\fBx\fIheight\fB+\fIx\fB+\fIy\fR. All dimensions are in pixels. .\" METHOD: height .TP \fBwinfo height \fIwindow\fR . Returns a decimal string giving \fIwindow\fR's height in pixels. When a window is first created its height will be 1 pixel; the height will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true height immediately after creating a widget, invoke \fBupdate\fR to force the geometry manager to arrange it, or use \fBwinfo reqheight\fR to get the window's requested height instead of its actual height. .\" METHOD: id .TP \fBwinfo id \fIwindow\fR . Returns a hexadecimal string giving a low-level platform-specific identifier for \fIwindow\fR. On Unix platforms, this is the X window identifier. Under Windows, this is the Windows HWND. On the Macintosh the value has no meaning outside Tk. .\" METHOD: interps .TP \fBwinfo interps \fR?\fB\-displayof \fIwindow\fR? . Returns a list whose members are the names of all Tcl interpreters (e.g. all Tk-based applications) currently registered for a particular display. If the \fB\-displayof\fR option is given then the return value refers to the display of \fIwindow\fR; otherwise it refers to the display of the application's main window. .\" METHOD: ismapped .TP \fBwinfo ismapped \fIwindow\fR . Returns \fB1\fR if \fIwindow\fR is currently mapped, \fB0\fR otherwise. .\" METHOD: manager .TP \fBwinfo manager \fIwindow\fR . Returns the name of the geometry manager currently responsible for \fIwindow\fR, or an empty string if \fIwindow\fR is not managed by any geometry manager. The name is usually the name of the Tcl command for the geometry manager, such as \fBpack\fR or \fBplace\fR. If the geometry manager is a widget, such as canvases or text, the name is the widget's class command, such as \fBcanvas\fR. .\" METHOD: name .TP \fBwinfo name \fIwindow\fR . Returns \fIwindow\fR's name (i.e. its name within its parent, as opposed to its full path name). The command \fBwinfo name .\fR will return the name of the application. .\" METHOD: parent .TP \fBwinfo parent \fIwindow\fR . Returns the path name of \fIwindow\fR's parent, or an empty string if \fIwindow\fR is the main window of the application. .\" METHOD: pathname .TP \fBwinfo pathname \fR?\fB\-displayof \fIwindow\fR? \fIid\fR . Returns the path name of the window whose X identifier is \fIid\fR. \fIId\fR must be a decimal, hexadecimal, or octal integer and must correspond to a window in the invoking application. If the \fB\-displayof\fR option is given then the identifier is looked up on the display of \fIwindow\fR; otherwise it is looked up on the display of the application's main window. .\" METHOD: pixels .TP \fBwinfo pixels \fIwindow number\fR . Returns the number of pixels in \fIwindow\fR corresponding to the distance given by \fInumber\fR. \fINumber\fR may be specified in any of the forms acceptable to \fBTk_GetPixels\fR, such as .QW 2.0c or .QW 1i . The result is rounded to the nearest integer value; for a fractional result, use \fBwinfo fpixels\fR. .\" METHOD: pointerx .TP \fBwinfo pointerx \fIwindow\fR . If the mouse pointer is on the same screen as \fIwindow\fR, returns the pointer's x coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is measured in the virtual root. If the mouse pointer is not on the same screen as \fIwindow\fR then -1 is returned. .\" METHOD: pointerxy .TP \fBwinfo pointerxy \fIwindow\fR . If the mouse pointer is on the same screen as \fIwindow\fR, returns a list with two elements, which are the pointer's x and y coordinates measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is computed in the virtual root. If the mouse pointer is not on the same screen as \fIwindow\fR then both of the returned coordinates are \-1. .\" METHOD: pointery .TP \fBwinfo pointery \fIwindow\fR . If the mouse pointer is on the same screen as \fIwindow\fR, returns the pointer's y coordinate, measured in pixels in the screen's root window. If a virtual root window is in use on the screen, the position is computed in the virtual root. If the mouse pointer is not on the same screen as \fIwindow\fR then -1 is returned. .\" METHOD: reqheight .TP \fBwinfo reqheight \fIwindow\fR . Returns a decimal string giving \fIwindow\fR's requested height, in pixels. This is the value used by \fIwindow\fR's geometry manager to compute its geometry. .\" METHOD: reqwidth .TP \fBwinfo reqwidth \fIwindow\fR . Returns a decimal string giving \fIwindow\fR's requested width, in pixels. This is the value used by \fIwindow\fR's geometry manager to compute its geometry. .\" METHOD: rgb .TP \fBwinfo rgb \fIwindow color\fR . Returns a list containing three decimal values in the range 0 to 65535, which are the red, green, and blue intensities that correspond to \fIcolor\fR in the window given by \fIwindow\fR. \fIColor\fR may be specified in any of the forms acceptable for a color option. .\" METHOD: rootx .TP \fBwinfo rootx \fIwindow\fR . Returns a decimal string giving the x-coordinate, in the root window of the screen, of the upper-left corner of \fIwindow\fR's border (or \fIwindow\fR if it has no border). .\" METHOD: rooty .TP \fBwinfo rooty \fIwindow\fR . Returns a decimal string giving the y-coordinate, in the root window of the screen, of the upper-left corner of \fIwindow\fR's border (or \fIwindow\fR if it has no border). .\" METHOD: screen .TP \fBwinfo screen \fIwindow\fR . Returns the name of the screen associated with \fIwindow\fR, in the form \fIdisplayName\fR.\fIscreenIndex\fR. .\" METHOD: screencells .TP \fBwinfo screencells \fIwindow\fR . Returns a decimal string giving the number of cells in the default color map for \fIwindow\fR's screen. .\" METHOD: screendepth .TP \fBwinfo screendepth \fIwindow\fR . Returns a decimal string giving the depth of the root window of \fIwindow\fR's screen (number of bits per pixel). .\" METHOD: screenheight .TP \fBwinfo screenheight \fIwindow\fR . Returns a decimal string giving the height of \fIwindow\fR's screen, in pixels. .\" METHOD: screenmmheight .TP \fBwinfo screenmmheight \fIwindow\fR . Returns a decimal string giving the height of \fIwindow\fR's screen, in millimeters. .\" METHOD: screenmmwidth .TP \fBwinfo screenmmwidth \fIwindow\fR . Returns a decimal string giving the width of \fIwindow\fR's screen, in millimeters. .\" METHOD: screenvisual .TP \fBwinfo screenvisual \fIwindow\fR . Returns one of the following strings to indicate the default visual class for \fIwindow\fR's screen: \fBdirectcolor\fR, \fBgrayscale\fR, \fBpseudocolor\fR, \fBstaticcolor\fR, \fBstaticgray\fR, or \fBtruecolor\fR. .\" METHOD: screenwidth .TP \fBwinfo screenwidth \fIwindow\fR . Returns a decimal string giving the width of \fIwindow\fR's screen, in pixels. .\" METHOD: server .TP \fBwinfo server \fIwindow\fR . Returns a string containing information about the server for \fIwindow\fR's display. The exact format of this string may vary from platform to platform. For X servers the string has the form .QW "\fBX\fImajor\fBR\fIminor vendor vendorVersion\fR" where \fImajor\fR and \fIminor\fR are the version and revision numbers provided by the server (e.g., \fBX11R5\fR), \fIvendor\fR is the name of the vendor for the server, and \fIvendorRelease\fR is an integer release number provided by the server. .\" METHOD: toplevel .TP \fBwinfo toplevel \fIwindow\fR . Returns the path name of the top-of-hierarchy window containing \fIwindow\fR. In standard Tk this will always be a \fBtoplevel\fR widget, but extensions may create other kinds of top-of-hierarchy widgets. .\" METHOD: viewable .TP \fBwinfo viewable \fIwindow\fR . Returns 1 if \fIwindow\fR and all of its ancestors up through the nearest toplevel window are mapped. Returns 0 if any of these windows are not mapped. .\" METHOD: visual .TP \fBwinfo visual \fIwindow\fR . Returns one of the following strings to indicate the visual class for \fIwindow\fR: \fBdirectcolor\fR, \fBgrayscale\fR, \fBpseudocolor\fR, \fBstaticcolor\fR, \fBstaticgray\fR, or \fBtruecolor\fR. .\" METHOD: visualid .TP \fBwinfo visualid \fIwindow\fR . Returns the X identifier for the visual for \fIwindow\fR. .\" METHOD: visualsavailable .TP \fBwinfo visualsavailable \fIwindow\fR ?\fBincludeids\fR? . Returns a list whose elements describe the visuals available for \fIwindow\fR's screen. Each element consists of a visual class followed by an integer depth. The class has the same form as returned by \fBwinfo visual\fR. The depth gives the number of bits per pixel in the visual. In addition, if the \fBincludeids\fR argument is provided, then the depth is followed by the X identifier for the visual. .\" METHOD: vrootheight .TP \fBwinfo vrootheight \fIwindow\fR . Returns the height of the virtual root window associated with \fIwindow\fR if there is one; otherwise returns the height of \fIwindow\fR's screen. .\" METHOD: vrootwidth .TP \fBwinfo vrootwidth \fIwindow\fR . Returns the width of the virtual root window associated with \fIwindow\fR if there is one; otherwise returns the width of \fIwindow\fR's screen. .\" METHOD: vrootx .TP \fBwinfo vrootx \fIwindow\fR . Returns the x-offset of the virtual root window associated with \fIwindow\fR, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for \fIwindow\fR. .\" METHOD: vrooty .TP \fBwinfo vrooty \fIwindow\fR . Returns the y-offset of the virtual root window associated with \fIwindow\fR, relative to the root window of its screen. This is normally either zero or negative. Returns 0 if there is no virtual root window for \fIwindow\fR. .\" METHOD: width .TP \fBwinfo width \fIwindow\fR . Returns a decimal string giving \fIwindow\fR's width in pixels. When a window is first created its width will be 1 pixel; the width will eventually be changed by a geometry manager to fulfil the window's needs. If you need the true width immediately after creating a widget, invoke \fBupdate\fR to force the geometry manager to arrange it, or use \fBwinfo reqwidth\fR to get the window's requested width instead of its actual width. .\" METHOD: x .TP \fBwinfo x \fIwindow\fR . Returns a decimal string giving the x-coordinate, in \fIwindow\fR's parent, of the upper-left corner of \fIwindow\fR's border (or \fIwindow\fR if it has no border). .\" METHOD: y .TP \fBwinfo y \fIwindow\fR . Returns a decimal string giving the y-coordinate, in \fIwindow\fR's parent, of the upper-left corner of \fIwindow\fR's border (or \fIwindow\fR if it has no border). .SH EXAMPLE .PP Print where the mouse pointer is and what window it is currently over: .CS lassign [\fBwinfo pointerxy\fR .] x y puts -nonewline "Mouse pointer at ($x,$y) which is " set win [\fBwinfo containing\fR $x $y] if {$win eq ""} { puts "over no window" } else { puts "over $win" } .CE .SH KEYWORDS atom, children, class, geometry, height, identifier, information, interpreters, mapped, parent, path name, screen, virtual root, width, window '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/wish.1.
︙ | ︙ | |||
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 | .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME wish \- Simple windowing shell .SH SYNOPSIS \fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg ...\fR? .SH OPTIONS .IP "\fB\-encoding \fIname\fR" 20 Specifies the encoding of the text stored in \fIfileName\fR. This option is only recognized prior to the \fIfileName\fR argument. .IP "\fB\-colormap \fInew\fR" 20 Specifies that the window should have a new private colormap instead of using the default colormap for the screen. .IP "\fB\-display \fIdisplay\fR" 20 Display (and screen) on which to display window. .IP "\fB\-geometry \fIgeometry\fR" 20 Initial geometry to use for window. If this option is specified, its value is stored in the \fBgeometry\fR global variable of the application's Tcl interpreter. .IP "\fB\-name \fIname\fR" 20 Use \fIname\fR as the title to be displayed in the window, and as the name of the interpreter for \fBsend\fR commands. .IP "\fB\-sync\fR" 20 Execute all X server commands synchronously, so that errors are reported immediately. This will result in much slower execution, but it is useful for debugging. .IP "\fB\-use\fR \fIid\fR" 20 Specifies that the main window for the application is to be embedded in the window whose identifier is \fIid\fR, instead of being created as an independent toplevel window. \fIId\fR must be specified in the same way as the value for the \fB\-use\fR option for toplevel widgets (i.e. it has a form like that returned by the \fBwinfo id\fR command). .RS Note that on some platforms this will only work correctly if \fIid\fR refers to a Tk \fBframe\fR or \fBtoplevel\fR that has its \fB\-container\fR option enabled. .RE .IP "\fB\-visual \fIvisual\fR" 20 Specifies the visual to use for the window. \fIVisual\fR may have any of the forms supported by the \fBTk_GetVisual\fR procedure. .IP "\fB\-\|\-\fR" 20 Pass all remaining arguments through to the script's \fBargv\fR variable without interpreting them. This provides a mechanism for passing arguments such as \fB\-name\fR to a script instead of having \fBwish\fR interpret them. .BE .SH DESCRIPTION | > > > > > > > > > | 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 | .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME wish \- Simple windowing shell .SH SYNOPSIS \fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg ...\fR? .SH OPTIONS .\" OPTION: -encoding .IP "\fB\-encoding \fIname\fR" 20 Specifies the encoding of the text stored in \fIfileName\fR. This option is only recognized prior to the \fIfileName\fR argument. .\" OPTION: -colormap .IP "\fB\-colormap \fInew\fR" 20 Specifies that the window should have a new private colormap instead of using the default colormap for the screen. .\" OPTION: -display .IP "\fB\-display \fIdisplay\fR" 20 Display (and screen) on which to display window. .\" OPTION: -geometry .IP "\fB\-geometry \fIgeometry\fR" 20 Initial geometry to use for window. If this option is specified, its value is stored in the \fBgeometry\fR global variable of the application's Tcl interpreter. .\" OPTION: -name .IP "\fB\-name \fIname\fR" 20 Use \fIname\fR as the title to be displayed in the window, and as the name of the interpreter for \fBsend\fR commands. .\" OPTION: -sync .IP "\fB\-sync\fR" 20 Execute all X server commands synchronously, so that errors are reported immediately. This will result in much slower execution, but it is useful for debugging. .\" OPTION: -use .IP "\fB\-use\fR \fIid\fR" 20 Specifies that the main window for the application is to be embedded in the window whose identifier is \fIid\fR, instead of being created as an independent toplevel window. \fIId\fR must be specified in the same way as the value for the \fB\-use\fR option for toplevel widgets (i.e. it has a form like that returned by the \fBwinfo id\fR command). .RS Note that on some platforms this will only work correctly if \fIid\fR refers to a Tk \fBframe\fR or \fBtoplevel\fR that has its \fB\-container\fR option enabled. .RE .\" OPTION: -visual .IP "\fB\-visual \fIvisual\fR" 20 Specifies the visual to use for the window. \fIVisual\fR may have any of the forms supported by the \fBTk_GetVisual\fR procedure. .\" OPTION: -- .IP "\fB\-\|\-\fR" 20 Pass all remaining arguments through to the script's \fBargv\fR variable without interpreting them. This provides a mechanism for passing arguments such as \fB\-name\fR to a script instead of having \fBwish\fR interpret them. .BE .SH DESCRIPTION |
︙ | ︙ | |||
113 114 115 116 117 118 119 | .PP The class of the application, which is used for purposes such as specifying options with a \fBRESOURCE_MANAGER\fR property or .Xdefaults file, is the same as its name except that the first letter is capitalized. .SH "VARIABLES" .PP | | > > > > > > > > > > | 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 | .PP The class of the application, which is used for purposes such as specifying options with a \fBRESOURCE_MANAGER\fR property or .Xdefaults file, is the same as its name except that the first letter is capitalized. .SH "VARIABLES" .PP \fBWish\fR sets the following global Tcl variables: .\" VARIABLE: argc .TP 15 \fBargc\fR . Contains a count of the number of \fIarg\fR arguments (0 if none), not including the options described above. .\" VARIABLE: argv .TP 15 \fBargv\fR . Contains a Tcl list whose elements are the \fIarg\fR arguments that follow a \fB\-\|\-\fR option or do not match any of the options described in \fBOPTIONS\fR above, in order, or an empty string if there are no such arguments. .\" VARIABLE: argv0 .TP 15 \fBargv0\fR . Contains \fIfileName\fR if it was specified. Otherwise, contains the name by which \fBwish\fR was invoked. .\" VARIABLE: geometry .TP 15 \fBgeometry\fR . If the \fB\-geometry\fR option is specified, \fBwish\fR copies its value into this variable. If the variable still exists after \fIfileName\fR has been evaluated, \fBwish\fR uses the value of the variable in a \fBwm geometry\fR command to set the main window's geometry. .\" VARIABLE: tcl_interactive .TP 15 \fBtcl_interactive\fR . Contains 1 if \fBwish\fR is reading commands interactively (\fIfileName\fR was not specified and standard input is a terminal-like device), 0 otherwise. .SH "SCRIPT FILES" .PP If you create a Tcl script in a file whose first line is .CS |
︙ | ︙ |
Changes to doc/wm.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | .TH wm n 8.5 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME wm \- Communicate with window manager .SH SYNOPSIS | | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < > > > | 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 | .TH wm n 8.5 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME wm \- Communicate with window manager .SH SYNOPSIS \fBwm\fI option window \fR?\fIargs\fR? .BE .SH DESCRIPTION .PP The \fBwm\fR command is used to interact with window managers in order to control such things as the title for a window, its geometry, or the increments in terms of which it may be resized. The \fBwm\fR command can take any of a number of different forms, depending on the \fIoption\fR argument. All of the forms expect at least one additional argument, \fIwindow\fR, which must be the path name of a top-level window. .PP The legal forms for the \fBwm\fR command are: .\" METHOD: aspect .TP \fBwm aspect \fIwindow\fR ?\fIminNumer minDenom maxNumer maxDenom\fR? . If \fIminNumer\fR, \fIminDenom\fR, \fImaxNumer\fR, and \fImaxDenom\fR are all specified, then they will be passed to the window manager and the window manager should use them to enforce a range of acceptable aspect ratios for \fIwindow\fR. The aspect ratio of \fIwindow\fR (width/length) will be constrained to lie between \fIminNumer\fR/\fIminDenom\fR and \fImaxNumer\fR/\fImaxDenom\fR. If \fIminNumer\fR etc. are all specified as empty strings, then any existing aspect ratio restrictions are removed. If \fIminNumer\fR etc. are specified, then the command returns an empty string. Otherwise, it returns a Tcl list containing four elements, which are the current values of \fIminNumer\fR, \fIminDenom\fR, \fImaxNumer\fR, and \fImaxDenom\fR (if no aspect restrictions are in effect, then an empty string is returned). .\" METHOD: attributes .TP \fBwm attributes \fIwindow\fR .TP \fBwm attributes \fIwindow\fR ?\fBoption\fR? .TP \fBwm attributes \fIwindow\fR ?\fBoption value option value...\fR? . This subcommand returns or sets platform specific attributes associated with a window. The first form returns a list of the platform specific flags and their values. The second form returns the value for the specific option. The third form sets one or more of the values. The values are as follows: .RS .PP All platforms support the following attributes (though X11 users should see the notes below): .\" OPTION: -alpha .TP \fB\-alpha\fR . Specifies the alpha transparency level of the toplevel. It accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque). Values outside that range will be constrained. Where not supported, the \fB\-alpha\fR value remains at \fB1.0\fR. .\" OPTION: -fullscreen .TP \fB\-fullscreen\fR . Places the window in a mode that takes up the entire screen, has no borders, and covers the general use area (i.e. Start menu and taskbar on Windows, dock and menubar on OSX, general window decorations on X11). .\" OPTION: -topmost .TP \fB\-topmost\fR . Specifies whether this is a topmost window (displays above all other windows). .PP On Windows, the following attributes may be set. .\" OPTION: -disabled .TP \fB\-disabled\fR . Specifies whether the window is in a disabled state. .\" OPTION: -toolwindow .TP \fB\-toolwindow\fR . Specifies a toolwindow style window (as defined in the MSDN). .\" OPTION: -transparentcolor .TP \fB\-transparentcolor\fR . Specifies the transparent color index of the toplevel. It takes any color value accepted by \fBTk_GetColor\fR. If the empty string is specified (default), no transparent color is used. This is supported on Windows 2000/XP+. Where not supported, the \fB\-transparentcolor\fR value remains at \fB{}\fR. .PP On MacOS, the following attributes may be set. .\" OPTION: -appearance .TP \fB\-appearance\fR . Specifies whether the window is rendered in "dark mode". Allowed values are \fBauto\fR, \fBaqua\fR and \fBdarkaqua\fR. If the setting is auto then the appearance of the window is controlled by the System Settings. .\" OPTION: -class .TP \fB\-class\fR . Specifies whether the underlying Aqua window for a toplevel is an object of the NSWindow class or the NSPanel class. The two allowed values for this option are \fBnswindow\fR and \fBnspanel\fR. It is not possible to change the class of the underlying Aqua window once that window has been instantiated, and attempting to do that is an error. However it is allowed to set this option for a pathname that does not correspond to an existing window. Doing that causes the class name to be cached for later use. When a toplevel with that pathname is eventually created, the cached class name will determine which class is used for the underlying Aqua window. .\" OPTION: -isdark .TP \fB\-isdark\fR . Returns a boolean value which is true if the window is currently in dark mode. .\" OPTION: -modified .TP \fB\-modified\fR . Specifies the modification state of the window (determines whether the window close widget contains the modification indicator and whether the proxy icon is draggable). .\" OPTION: -notify .TP \fB\-notify\fR . Specifies process notification state (bouncing of the application dock icon). .\" OPTION: -stylemask .TP \fB\-stylemask\fR . Specifies an integer to be assigned as the styleMask of the underlying Aqua window. (See the Apple documentation for styleMask property of the NSWindow class.) The value of this option should be a list of bitnames. Each bit named in the list will be set to 1, and all other bits will be set to 0. The allowed bitnames are: \fBtitled\fR, \fBclosable\fR, \fBminiaturizable\fR, \fBresizable\fR, \fBfullsizecontentview\fR, \fBdocmodal\fR, \fButility\fR, \fBnonactivatingpanel\fR, and \fBHUDwindow\fR. Note that a side effect of setting the fullsizecontentview bit is that the window title bar becomes transparent. .\" OPTION: -tabbingid .TP \fB\-tabbingid\fR . Controls how tabbed toplevel windows are grouped together. Two tabs in the same group must correspond to toplevels with the same tabbingid, which can be an arbitrary UTF8 string. In the Tk implementation, changing the tabbingid of a toplevel in a tab group will cause it to be moved into a different group, in which all tabs have the new tabbingid or, if the new tabbingid is unique, to become a normal non-tabbed toplevel. It is allowed to set the tabbingid before the toplevel is created. If the pathname provided in the command does not correspond to a toplevel, the value will be cached and used later when the toplevel is actually created. .\" OPTION: -tabbingmode .TP \fB\-tabbingmode\fR . Controls whether a toplevel can be opened as a tab within a tab group. The allowed values are \fBauto\fR, \fBpreferred\fR or \fBdisallowed\fR. A toplevel can be opened as a tab in exactly two situations: if its tabbingmode is \fBpreferred\fR; or if its tabbingmode is \fBauto\fR and the user has selected "prefer tabs when opening documents" in the Desktop and Dock panel of the System Settings application. It is allowed to set the tabbingmode before the toplevel is created. If the pathname provided in the command does not correspond to a toplevel, the value will be cached and used later when the toplevel is actually created. .\" OPTION: -titlepath .TP \fB\-titlepath\fR . Specifies the path of the file referenced as the window proxy icon (which can be dragged and dropped in lieu of the file's finder icon). .\" OPTION: -transparent .TP \fB\-transparent\fR . 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/ .\" OPTION: -type .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 preference. The following values are mapped to constants defined in the EWMH specification (using others is possible, but not advised): .RS .IP \fBdesktop\fR indicates a desktop feature, .IP \fBdock\fR indicates a dock/panel feature, .IP \fBtoolbar\fR indicates a toolbar window that should be acting on behalf of another window, as indicated with \fBwm transient\fR, .IP \fBmenu\fR indicates a torn-off menu that should be acting on behalf of another window, as indicated with \fBwm transient\fR, .IP \fButility\fR indicates a utility window (e.g., palette or toolbox) that should be acting on behalf of another window, as indicated with \fBwm transient\fR, .IP \fBsplash\fR indicates a splash screen, displayed during application start up, .IP \fBdialog\fR indicates a general dialog window, that should be acting on behalf of another window, as indicated with \fBwm transient\fR, .IP \fBdropdown_menu\fR indicates a menu summoned from a menu bar, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBpopup_menu\fR indicates a popup menu, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBtooltip\fR indicates a tooltip window, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBnotification\fR indicates a window that provides a background notification of some event, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBcombo\fR indicates the drop-down list of a combobox widget, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBdnd\fR indicates a window that represents something being dragged, which should usually also be set to be override-redirected (with \fBwm overrideredirect\fR), .IP \fBnormal\fR indicates a window that has no special interpretation. .RE .VE 8.6 .\" OPTION: -zoomed .TP \fB\-zoomed\fR . Requests that the window should be maximized. This is the same as \fBwm state zoomed\fR on Windows and Mac OS X. .PP On X11, changes to window attributes are performed asynchronously. Querying the value of an attribute returns the current state, which will not be the same as the value most recently set if the window manager has not yet processed the request or if it does not support the attribute. .RE .\" METHOD: client .TP \fBwm client \fIwindow\fR ?\fIname\fR? . If \fIname\fR is specified, this command stores \fIname\fR (which should be the name of the host on which the application is executing) in \fIwindow\fR's \fBWM_CLIENT_MACHINE\fR property for use by the window manager or session manager. The command returns an empty string in this case. If \fIname\fR is not specified, the command returns the last name set in a \fBwm client\fR command for \fIwindow\fR. If \fIname\fR is specified as an empty string, the command deletes the \fBWM_CLIENT_MACHINE\fR property from \fIwindow\fR. .\" METHOD: colormapwindows .TP \fBwm colormapwindows \fIwindow\fR ?\fIwindowList\fR? . This command is used to manipulate the \fBWM_COLORMAP_WINDOWS\fR property, which provides information to the window managers about windows that have private colormaps. .RS |
︙ | ︙ | |||
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 | If \fBwm colormapwindows\fR is not invoked, Tk will automatically set the property for each top-level window to all the internal windows whose colormaps differ from their parents, followed by the top-level itself; the order of the internal windows is undefined. See the ICCCM documentation for more information on the \fBWM_COLORMAP_WINDOWS\fR property. .RE .TP \fBwm command \fIwindow\fR ?\fIvalue\fR? . If \fIvalue\fR is specified, this command stores \fIvalue\fR in \fIwindow\fR's \fBWM_COMMAND\fR property for use by the window manager or session manager and returns an empty string. \fIValue\fR must have proper list structure; the elements should contain the words of the command used to invoke the application. If \fIvalue\fR is not specified then the command returns the last value set in a \fBwm command\fR command for \fIwindow\fR. If \fIvalue\fR is specified as an empty string, the command deletes the \fBWM_COMMAND\fR property from \fIwindow\fR. .TP \fBwm deiconify \fIwindow\fR . Arrange for \fIwindow\fR to be displayed in normal (non-iconified) form. This is done by mapping the window. If the window has never been mapped then this command will not map the window, but it will ensure that when the window is first mapped it will be displayed in de-iconified form. On Windows, a deiconified window will also be raised and be given the focus (made the active window). Returns an empty string. .TP \fBwm focusmodel \fIwindow\fR ?\fBactive\fR|\fBpassive\fR? . If \fBactive\fR or \fBpassive\fR is supplied as an optional argument to the command, then it specifies the focus model for \fIwindow\fR. In this case the command returns an empty string. If no additional argument is supplied, then the command returns the current focus model for \fIwindow\fR. .RS .PP An \fBactive\fR focus model means that \fIwindow\fR will claim the input focus for itself or its descendants, even at times when the focus is currently in some other application. \fBPassive\fR means that \fIwindow\fR will never claim the focus for itself: the window manager should give the focus to \fIwindow\fR at appropriate times. However, once the focus has been given to \fIwindow\fR or one of its descendants, the application may re-assign the focus among \fIwindow\fR's descendants. The focus model defaults to \fBpassive\fR, and Tk's \fBfocus\fR command assumes a passive model of focusing. .RE .TP \fBwm forget \fIwindow\fR . The \fIwindow\fR will be unmapped from the screen and will no longer be managed by \fBwm\fR. Windows created with the \fBtoplevel\fR command will be treated like \fBframe\fR windows once they are no longer managed by \fBwm\fR, however, the \fB\-menu\fR configuration will be remembered and the menus will return once the widget is managed again. .TP \fBwm frame \fIwindow\fR . If \fIwindow\fR has been reparented by the window manager into a decorative frame, the command returns the platform specific window identifier for the outermost frame that contains \fIwindow\fR (the window whose parent is the root or virtual root). If \fIwindow\fR has not been reparented by the window manager then the command returns the platform specific window identifier for \fIwindow\fR. .TP \fBwm geometry \fIwindow\fR ?\fInewGeometry\fR? . If \fInewGeometry\fR is specified, then the geometry of \fIwindow\fR is changed and an empty string is returned. Otherwise the current geometry for \fIwindow\fR is returned (this is the most recent geometry specified either by manual resizing or | > > > > > > | 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 | If \fBwm colormapwindows\fR is not invoked, Tk will automatically set the property for each top-level window to all the internal windows whose colormaps differ from their parents, followed by the top-level itself; the order of the internal windows is undefined. See the ICCCM documentation for more information on the \fBWM_COLORMAP_WINDOWS\fR property. .RE .\" METHOD: command .TP \fBwm command \fIwindow\fR ?\fIvalue\fR? . If \fIvalue\fR is specified, this command stores \fIvalue\fR in \fIwindow\fR's \fBWM_COMMAND\fR property for use by the window manager or session manager and returns an empty string. \fIValue\fR must have proper list structure; the elements should contain the words of the command used to invoke the application. If \fIvalue\fR is not specified then the command returns the last value set in a \fBwm command\fR command for \fIwindow\fR. If \fIvalue\fR is specified as an empty string, the command deletes the \fBWM_COMMAND\fR property from \fIwindow\fR. .\" METHOD: deiconify .TP \fBwm deiconify \fIwindow\fR . Arrange for \fIwindow\fR to be displayed in normal (non-iconified) form. This is done by mapping the window. If the window has never been mapped then this command will not map the window, but it will ensure that when the window is first mapped it will be displayed in de-iconified form. On Windows, a deiconified window will also be raised and be given the focus (made the active window). Returns an empty string. .\" METHOD: focusmodel .TP \fBwm focusmodel \fIwindow\fR ?\fBactive\fR|\fBpassive\fR? . If \fBactive\fR or \fBpassive\fR is supplied as an optional argument to the command, then it specifies the focus model for \fIwindow\fR. In this case the command returns an empty string. If no additional argument is supplied, then the command returns the current focus model for \fIwindow\fR. .RS .PP An \fBactive\fR focus model means that \fIwindow\fR will claim the input focus for itself or its descendants, even at times when the focus is currently in some other application. \fBPassive\fR means that \fIwindow\fR will never claim the focus for itself: the window manager should give the focus to \fIwindow\fR at appropriate times. However, once the focus has been given to \fIwindow\fR or one of its descendants, the application may re-assign the focus among \fIwindow\fR's descendants. The focus model defaults to \fBpassive\fR, and Tk's \fBfocus\fR command assumes a passive model of focusing. .RE .\" METHOD: forget .TP \fBwm forget \fIwindow\fR . The \fIwindow\fR will be unmapped from the screen and will no longer be managed by \fBwm\fR. Windows created with the \fBtoplevel\fR command will be treated like \fBframe\fR windows once they are no longer managed by \fBwm\fR, however, the \fB\-menu\fR configuration will be remembered and the menus will return once the widget is managed again. .\" METHOD: frame .TP \fBwm frame \fIwindow\fR . If \fIwindow\fR has been reparented by the window manager into a decorative frame, the command returns the platform specific window identifier for the outermost frame that contains \fIwindow\fR (the window whose parent is the root or virtual root). If \fIwindow\fR has not been reparented by the window manager then the command returns the platform specific window identifier for \fIwindow\fR. .\" METHOD: geometry .TP \fBwm geometry \fIwindow\fR ?\fInewGeometry\fR? . If \fInewGeometry\fR is specified, then the geometry of \fIwindow\fR is changed and an empty string is returned. Otherwise the current geometry for \fIwindow\fR is returned (this is the most recent geometry specified either by manual resizing or |
︙ | ︙ | |||
355 356 357 358 359 360 361 362 363 364 365 366 367 368 | actual size and location of \fIwindow\fR, whereas \fBwm geometry\fR allows both setting and querying of the \fIwindow manager\fR's understanding of the size and location of the window. This can vary significantly, for example to reflect the addition of decorative elements to \fIwindow\fR such as title bars, and window managers are not required to precisely follow the requests made through this command. .RE .TP \fBwm grid \fIwindow\fR ?\fIbaseWidth baseHeight widthInc heightInc\fR? . This command indicates that \fIwindow\fR is to be managed as a gridded window. It also specifies the relationship between grid units and pixel units. \fIBaseWidth\fR and \fIbaseHeight\fR specify the number of grid | > | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | actual size and location of \fIwindow\fR, whereas \fBwm geometry\fR allows both setting and querying of the \fIwindow manager\fR's understanding of the size and location of the window. This can vary significantly, for example to reflect the addition of decorative elements to \fIwindow\fR such as title bars, and window managers are not required to precisely follow the requests made through this command. .RE .\" METHOD: grid .TP \fBwm grid \fIwindow\fR ?\fIbaseWidth baseHeight widthInc heightInc\fR? . This command indicates that \fIwindow\fR is to be managed as a gridded window. It also specifies the relationship between grid units and pixel units. \fIBaseWidth\fR and \fIbaseHeight\fR specify the number of grid |
︙ | ︙ | |||
387 388 389 390 391 392 393 | .PP Otherwise the return value is a Tcl list containing four elements corresponding to the current \fIbaseWidth\fR, \fIbaseHeight\fR, \fIwidthInc\fR, and \fIheightInc\fR; if \fIwindow\fR is not currently gridded, then an empty string is returned. .PP | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .PP Otherwise the return value is a Tcl list containing four elements corresponding to the current \fIbaseWidth\fR, \fIbaseHeight\fR, \fIwidthInc\fR, and \fIheightInc\fR; if \fIwindow\fR is not currently gridded, then an empty string is returned. .PP Note that this command should not be needed very often, since the \fBTk_SetGrid\fR library procedure and the \fBsetGrid\fR option provide easier access to the same functionality. .RE .\" METHOD: group .TP \fBwm group \fIwindow\fR ?\fIpathName\fR? . If \fIpathName\fR is specified, it gives the path name for the leader of 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. .\" METHOD: iconbadge .TP \fBwm iconbadge \fIwindow badge\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 .\" METHOD: iconbitmap .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 |
︙ | ︙ | |||
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 | any file which contains a valid Windows icon is also accepted (usually .ico or .icr files), or any file for which the shell has assigned an icon. Tcl will first test if the file contains an icon, then if it has an assigned icon, and finally, if that fails, test for a bitmap. .RE .TP \fBwm iconify \fIwindow\fR . Arrange for \fIwindow\fR to be iconified. It \fIwindow\fR has not yet been mapped for the first time, this command will arrange for it to appear in the iconified state when it is eventually mapped. .TP \fBwm iconmask \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 used as a mask in conjunction with the \fBiconbitmap\fR option: where the mask has zeroes no icon will be displayed; where it has ones, the bits from the icon bitmap will be displayed. If an empty string is specified for \fIbitmap\fR then any current icon mask is cancelled for \fIwindow\fR (this is equivalent to specifying a bitmap of all ones). If \fIbitmap\fR is specified then the command returns an empty string. Otherwise it returns the name of the current icon mask associated with \fIwindow\fR, or an empty string if no mask is in effect. .TP \fBwm iconname \fIwindow\fR ?\fInewName\fR? . If \fInewName\fR is specified, then it is passed to the window manager; the window manager should display \fInewName\fR inside the icon associated with \fIwindow\fR. In this case an empty string is returned as result. If \fInewName\fR is not specified then the command returns the current icon name for \fIwindow\fR, or an empty string if no icon name has been specified (in this case the window manager will normally display the window's title, as specified with the \fBwm title\fR command). .TP \fBwm iconphoto \fIwindow\fR ?\fB\-default\fR? \fIimage1\fR ?\fIimage2 ...\fR? . Sets the titlebar icon for \fIwindow\fR based on the named photo images. If \fB\-default\fR is specified, this is applied to all future created toplevels as well. The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not 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 | > > > > | | > > > | > > > > > > | 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 | any file which contains a valid Windows icon is also accepted (usually .ico or .icr files), or any file for which the shell has assigned an icon. Tcl will first test if the file contains an icon, then if it has an assigned icon, and finally, if that fails, test for a bitmap. .RE .\" METHOD: iconify .TP \fBwm iconify \fIwindow\fR . Arrange for \fIwindow\fR to be iconified. It \fIwindow\fR has not yet been mapped for the first time, this command will arrange for it to appear in the iconified state when it is eventually mapped. .\" METHOD: iconmask .TP \fBwm iconmask \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 used as a mask in conjunction with the \fBiconbitmap\fR option: where the mask has zeroes no icon will be displayed; where it has ones, the bits from the icon bitmap will be displayed. If an empty string is specified for \fIbitmap\fR then any current icon mask is cancelled for \fIwindow\fR (this is equivalent to specifying a bitmap of all ones). If \fIbitmap\fR is specified then the command returns an empty string. Otherwise it returns the name of the current icon mask associated with \fIwindow\fR, or an empty string if no mask is in effect. .\" METHOD: iconname .TP \fBwm iconname \fIwindow\fR ?\fInewName\fR? . If \fInewName\fR is specified, then it is passed to the window manager; the window manager should display \fInewName\fR inside the icon associated with \fIwindow\fR. In this case an empty string is returned as result. If \fInewName\fR is not specified then the command returns the current icon name for \fIwindow\fR, or an empty string if no icon name has been specified (in this case the window manager will normally display the window's title, as specified with the \fBwm title\fR command). .\" METHOD: iconphoto .TP \fBwm iconphoto \fIwindow\fR ?\fB\-default\fR? \fIimage1\fR ?\fIimage2 ...\fR? . Sets the titlebar icon for \fIwindow\fR based on the named photo images. If \fB\-default\fR is specified, this is applied to all future created toplevels as well. The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not 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 (preferably 512 pixels) to ensure smooth rendering on the Mac. .RE .\" METHOD: iconposition .TP \fBwm iconposition \fIwindow\fR ?\fIx y\fR? . If \fIx\fR and \fIy\fR are specified, they are passed to the window manager as a hint about where to position the icon for \fIwindow\fR. In this case an empty string is returned. If \fIx\fR and \fIy\fR are specified as empty strings then any existing icon position hint is cancelled. If neither \fIx\fR nor \fIy\fR is specified, then the command returns a Tcl list containing two values, which are the current icon position hints (if no hints are in effect then an empty string is returned). .\" METHOD: iconwindow .TP \fBwm iconwindow \fIwindow\fR ?\fIpathName\fR? . If \fIpathName\fR is specified, it is the path name for a window to use as icon for \fIwindow\fR: when \fIwindow\fR is iconified then \fIpathName\fR will be mapped to serve as icon, and when \fIwindow\fR is de-iconified then \fIpathName\fR will be unmapped again. If \fIpathName\fR is specified as an empty string then any existing icon window association for \fIwindow\fR will be cancelled. If the \fIpathName\fR argument is specified then an empty string is returned. Otherwise the command returns the path name of the current icon window for \fIwindow\fR, or an empty string if there is no icon window currently specified for \fIwindow\fR. Button press events are disabled for \fIwindow\fR as long as it is an icon window; this is needed in order to allow window managers to .QW own those events. Note that not all window managers support the notion of an icon window, and the concept is entirely meaningless on non-X11 platforms. .\" METHOD: manage .TP \fBwm manage \fIwidget\fR . The \fIwidget\fR specified will become a stand alone top-level window. The window will be decorated with the window managers title bar, etc. Only \fIframe\fR, \fIlabelframe\fR and \fItoplevel\fR widgets can be used with this command. Attempting to pass any other widget type will raise an error. Attempting to manage a \fItoplevel\fR widget is benign and achieves nothing. See also \fBGEOMETRY MANAGEMENT\fR. .\" METHOD: maxsize .TP \fBwm maxsize \fIwindow\fR ?\fIwidth height\fR? . If \fIwidth\fR and \fIheight\fR are specified, they give the maximum permissible dimensions for \fIwindow\fR. For gridded windows the dimensions are specified in grid units; otherwise they are specified in pixel units. The window manager will restrict the window's dimensions to be less than or equal to \fIwidth\fR and \fIheight\fR. If \fIwidth\fR and \fIheight\fR are specified, then the command returns an empty string. Otherwise it returns a Tcl list with two elements, which are the maximum width and height currently in effect. The maximum size defaults to the size of the screen. See the sections on geometry management below for more information. .\" METHOD: minsize .TP \fBwm minsize \fIwindow\fR ?\fIwidth height\fR? . If \fIwidth\fR and \fIheight\fR are specified, they give the minimum permissible dimensions for \fIwindow\fR. For gridded windows the dimensions are specified in grid units; otherwise they are specified in pixel units. The window manager will restrict the window's dimensions to be greater than or equal to \fIwidth\fR and \fIheight\fR. If \fIwidth\fR and \fIheight\fR are specified, then the command returns an empty string. Otherwise it returns a Tcl list with two elements, which are the minimum width and height currently in effect. The minimum size defaults to one pixel in each dimension. See the sections on geometry management below for more information. .\" METHOD: overrideredirect .TP \fBwm overrideredirect \fIwindow\fR ?\fIboolean\fR? . If \fIboolean\fR is specified, it must have a proper boolean form and the override-redirect flag for \fIwindow\fR is set to that value. If \fIboolean\fR is not specified then \fB1\fR or \fB0\fR is returned to indicate whether or not the override-redirect flag is currently set for \fIwindow\fR. Setting the override-redirect flag for a window causes it to be ignored by the window manager; among other things, this means that the window will not be reparented from the root window into a decorative frame and the user will not be able to manipulate the window using the normal window manager mechanisms. .RS .PP Note that the override-redirect flag is only guaranteed to be taken notice of when the window is first mapped or when mapped after the state is changed from withdrawn to normal. Some, but not all, platforms will take notice at additional times. .RE .\" METHOD: positionfrom .TP \fBwm positionfrom \fIwindow\fR ?\fIwho\fR? . If \fIwho\fR is specified, it must be either \fBprogram\fR or \fBuser\fR, or an abbreviation of one of these two. It indicates whether \fIwindow\fR's current position was requested by the program or by the user. Many window managers ignore program-requested |
︙ | ︙ | |||
600 601 602 603 604 605 606 607 608 609 | source of the window's current position, or an empty string if no source has been specified yet. Most window managers interpret .QW "no source" 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? . | > | < | | | | | | | | > | | | < | | | | | | < > | > > | > > | > > > > | > > | > > | > | > > > > > > > > | | 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 | source of the window's current position, or an empty string if no source has been specified yet. Most window managers interpret .QW "no source" 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. .\" METHOD: protocol .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 .\" METHOD: resizable .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 width and height of \fIwindow\fR may be modified by the user. In this case the command returns an empty string. If \fIwidth\fR and \fIheight\fR are omitted then the command returns a list with two 0/1 elements that indicate whether the width and height of \fIwindow\fR are currently resizable. By default, windows are resizable in both dimensions. If resizing is disabled, then the window's size will be the size from the most recent interactive resize or \fBwm geometry\fR command. If there has been no such operation then the window's natural size will be used. .\" METHOD: sizefrom .TP \fBwm sizefrom \fIwindow\fR ?\fIwho\fR? . If \fIwho\fR is specified, it must be either \fBprogram\fR or \fBuser\fR, or an abbreviation of one of these two. It indicates whether \fIwindow\fR's current size was requested by the program or by the user. Some window managers ignore program-requested sizes and ask the user to manually size the window; if \fBuser\fR is specified then the window manager should give the window its specified size without asking the user for assistance. If \fIwho\fR is specified as an empty string, then the current size source is cancelled. If \fIwho\fR is specified, then the command returns an empty string. Otherwise it returns \fBuser\fR or \fBwindow\fR to indicate the source of the window's current size, or an empty string if no source has been specified yet. Most window managers interpret .QW "no source" as equivalent to \fBprogram\fR. .\" METHOD: stackorder .TP \fBwm stackorder \fIwindow\fR ?\fBisabove\fR|\fBisbelow \fIwindow\fR? . The \fBstackorder\fR command returns a list of toplevel windows in stacking order, from lowest to highest. When a single toplevel window is passed, the returned list recursively includes all of the window's children that are toplevels. Only those toplevels that are currently mapped to the screen are returned. The \fBstackorder\fR command can also be used to determine if one toplevel is positioned above or below a second toplevel. When two window arguments separated by either \fBisabove\fR or \fBisbelow\fR are passed, a boolean result indicates whether or not the first window is currently above or below the second window in the stacking order. .\" METHOD: state .TP \fBwm state \fIwindow\fR ?newstate? . If \fInewstate\fR is specified, the window will be set to the new state, otherwise it returns the current state of \fIwindow\fR: either \fBnormal\fR, \fBiconic\fR, \fBwithdrawn\fR, \fBicon\fR, or (Windows and Mac OS X only) \fBzoomed\fR. The difference between \fBiconic\fR and \fBicon\fR is that \fBiconic\fR refers to a window that has been iconified (e.g., with the \fBwm iconify\fR command) while \fBicon\fR refers to a window whose only purpose is to serve as the icon for some other window (via the \fBwm iconwindow\fR command). The \fBicon\fR state cannot be set. .\" METHOD: title .TP \fBwm title \fIwindow\fR ?\fIstring\fR? . If \fIstring\fR is specified, then it will be passed to the window manager for use as the title for \fIwindow\fR (the window manager should display this string in \fIwindow\fR's title bar). In this case the command returns an empty string. If \fIstring\fR is not specified then the command returns the current title for the \fIwindow\fR. The title for a window defaults to its name. .\" METHOD: transient .TP \fBwm transient \fIwindow\fR ?\fIcontainer\fR? . If \fIcontainer\fR is specified, then the window manager is informed that \fIwindow\fR is a transient window (e.g. pull-down menu) working on behalf of \fIcontainer\fR (where \fIcontainer\fR is the path name for a top-level window). If \fIcontainer\fR is specified as an empty string then \fIwindow\fR is marked as not being a transient window any more. Otherwise the command returns the path name of \fIwindow\fR's current container, or an empty string if \fIwindow\fR is not currently a transient window. A transient window will mirror state changes in the container and inherit the state of the container when initially mapped. The directed graph with an edge from each transient to its container must be acyclic. In particular, it is an error to attempt to make a window a transient of itself. The window manager may also decorate a transient window differently, removing some features normally present (e.g., minimize and maximize buttons) though this is entirely at the discretion of the window manager. .\" METHOD: widthdraw .TP \fBwm withdraw \fIwindow\fR . Arranges for \fIwindow\fR to be withdrawn from the screen. This causes the window to be unmapped and forgotten about by the window manager. If the window has never been mapped, then this command causes the window to be mapped in the withdrawn state. Not all window managers appear to know how to handle windows that are mapped in the withdrawn state. Note that it sometimes seems to be necessary to withdraw a window and then re-map it (e.g. with \fBwm deiconify\fR) to get some window managers to pay attention to changes in window attributes such as group. .SH "GEOMETRY MANAGEMENT" .PP By default a top-level window appears on the screen in its \fInatural size\fR, which is the one determined internally by its |
︙ | ︙ | |||
758 759 760 761 762 763 764 | .PP Normally a top-level window can have any size from one pixel in each dimension up to the size of its screen. However, you can use the \fBwm minsize\fR and \fBwm maxsize\fR commands to limit the range of allowable sizes. The range set by \fBwm minsize\fR and \fBwm maxsize\fR applies to all forms of resizing, including the window's natural size as | | > | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | .PP Normally a top-level window can have any size from one pixel in each dimension up to the size of its screen. However, you can use the \fBwm minsize\fR and \fBwm maxsize\fR commands to limit the range of allowable sizes. The range set by \fBwm minsize\fR and \fBwm maxsize\fR applies to all forms of resizing, including the window's natural size as well as manual resizes and the \fBwm geometry\fR command. You can use any value accepted by \fBTk_GetPixels\fR. You can also use the command \fBwm resizable\fR to completely disable interactive resizing in one or both dimensions. .PP The \fBwm manage\fR and \fBwm forget\fR commands may be used to perform undocking and docking of windows. After a widget is managed by \fBwm manage\fR command, all other \fBwm\fR subcommands may be used with the widget. Only widgets created using the toplevel command may |
︙ | ︙ | |||
828 829 830 831 832 833 834 | \fBwm resizable\fR .fixed 0 0 .CE .PP A simple dialog-like window, centred on the screen: .CS # Create and arrange the dialog contents. toplevel .msg | | | | | | | | > | 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 | \fBwm resizable\fR .fixed 0 0 .CE .PP A simple dialog-like window, centred on the screen: .CS # Create and arrange the dialog contents. toplevel .msg label .msg.l -text "This is a very simple dialog demo." button .msg.ok -text OK -default active -command {destroy .msg} pack .msg.ok -side bottom -fill x pack .msg.l -expand 1 -fill both # Now set the widget up as a centred dialog. # But first, we need the geometry managers to finish setting # up the interior of the dialog, for which we need to run the # event loop with the widget hidden completely... \fBwm withdraw\fR .msg update set x [expr {([winfo screenwidth .] - [winfo width .msg]) / 2}] set y [expr {([winfo screenheight .] - [winfo height .msg]) / 2}] \fBwm geometry\fR .msg +$x+$y \fBwm transient\fR .msg . \fBwm title\fR .msg "Dialog demo" \fBwm deiconify\fR .msg .CE .SH "SEE ALSO" toplevel(n), winfo(n) .SH KEYWORDS aspect ratio, deiconify, focus model, geometry, grid, group, icon, iconify, increments, position, size, title, top-level window, units, window manager '\" Local Variables: '\" mode: nroff '\" End: |
Changes to generic/default.h.
1 2 3 4 5 6 | /* * default.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * default.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * * Copyright © 1991-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. */ #ifndef _DEFAULT #define _DEFAULT |
︙ | ︙ |
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 96 97 | { "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 }, #ifndef TK_NO_DEPRECATED { "Page_Up", 0xFF55 }, #endif { "Next", 0xFF56 }, #ifndef TK_NO_DEPRECATED { "Page_Down", 0xFF56 }, #endif { "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 }, { "script_switch", 0xFF7E }, { "kana_switch", 0xFF7E }, { "Arabic_switch", 0xFF7E }, { "Greek_switch", 0xFF7E }, { "Hebrew_switch", 0xFF7E }, { "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 }, | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < > > > | 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 | { "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 }, { "F8", 0xFFC5 }, { "F9", 0xFFC6 }, { "F10", 0xFFC7 }, { "F11", 0xFFC8 }, #ifndef TK_NO_DEPRECATED { "L1", 0xFFC8 }, #endif { "F12", 0xFFC9 }, #ifndef TK_NO_DEPRECATED { "L2", 0xFFC9 }, #endif { "F13", 0xFFCA }, #ifndef TK_NO_DEPRECATED { "L3", 0xFFCA }, #endif { "F14", 0xFFCB }, #ifndef TK_NO_DEPRECATED { "L4", 0xFFCB }, #endif { "F15", 0xFFCC }, #ifndef TK_NO_DEPRECATED { "L5", 0xFFCC }, #endif { "F16", 0xFFCD }, #ifndef TK_NO_DEPRECATED { "L6", 0xFFCD }, #endif { "F17", 0xFFCE }, #ifndef TK_NO_DEPRECATED { "L7", 0xFFCE }, #endif { "F18", 0xFFCF }, #ifndef TK_NO_DEPRECATED { "L8", 0xFFCF }, #endif { "F19", 0xFFD0 }, #ifndef TK_NO_DEPRECATED { "L9", 0xFFD0 }, #endif { "F20", 0xFFD1 }, #ifndef TK_NO_DEPRECATED { "L10", 0xFFD1 }, #endif { "F21", 0xFFD2 }, #ifndef TK_NO_DEPRECATED { "R1", 0xFFD2 }, #endif { "F22", 0xFFD3 }, #ifndef TK_NO_DEPRECATED { "R2", 0xFFD3 }, #endif { "F23", 0xFFD4 }, #ifndef TK_NO_DEPRECATED { "R3", 0xFFD4 }, #endif { "F24", 0xFFD5 }, #ifndef TK_NO_DEPRECATED { "R4", 0xFFD5 }, #endif { "F25", 0xFFD6 }, #ifndef TK_NO_DEPRECATED { "R5", 0xFFD6 }, #endif { "F26", 0xFFD7 }, #ifndef TK_NO_DEPRECATED { "R6", 0xFFD7 }, #endif { "F27", 0xFFD8 }, #ifndef TK_NO_DEPRECATED { "R7", 0xFFD8 }, #endif { "F28", 0xFFD9 }, #ifndef TK_NO_DEPRECATED { "R8", 0xFFD9 }, #endif { "F29", 0xFFDA }, #ifndef TK_NO_DEPRECATED { "R9", 0xFFDA }, #endif { "F30", 0xFFDB }, #ifndef TK_NO_DEPRECATED { "R10", 0xFFDB }, #endif { "F31", 0xFFDC }, #ifndef TK_NO_DEPRECATED { "R11", 0xFFDC }, #endif { "F32", 0xFFDD }, #ifndef TK_NO_DEPRECATED { "R12", 0xFFDD }, #endif { "F33", 0xFFDE }, #ifndef TK_NO_DEPRECATED { "R13", 0xFFDE }, #endif { "F34", 0xFFDF }, #ifndef TK_NO_DEPRECATED { "R14", 0xFFDF }, #endif { "F35", 0xFFE0 }, #ifndef TK_NO_DEPRECATED { "R15", 0xFFE0 }, #endif { "Shift_L", 0xFFE1 }, { "Shift_R", 0xFFE2 }, { "Control_L", 0xFFE3 }, { "Control_R", 0xFFE4 }, { "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_Shift", 0xFF7E }, { "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 }, | < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | { "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_schwa", 0xFE8A }, #ifndef TK_NO_DEPRECATED { "dead_small_schwa", 0xFE8A }, #endif { "dead_SCHWA", 0xFE8B }, #ifndef TK_NO_DEPRECATED { "dead_capital_schwa", 0xFE8B }, #endif { "dead_greek", 0xFE8C }, { "dead_hamza", 0xFE8D }, { "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 }, | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > | 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 | { "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 }, | > > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | { "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 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 | { "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 }, { "diaeresis", 0xA8 }, { "copyright", 0xA9 }, { "ordfeminine", 0xAA }, { "guillemotleft", 0xAB }, { "notsign", 0xAC }, { "hyphen", 0xAD }, { "registered", 0xAE }, { "macron", 0xAF }, { "degree", 0xB0 }, { "plusminus", 0xB1 }, { "twosuperior", 0xB2 }, { "threesuperior", 0xB3 }, { "acute", 0xB4 }, { "mu", 0xB5 }, { "paragraph", 0xB6 }, { "periodcentered", 0xB7 }, { "cedilla", 0xB8 }, { "onesuperior", 0xB9 }, { "masculine", 0xBA }, { "guillemotright", 0xBB }, { "onequarter", 0xBC }, { "onehalf", 0xBD }, { "threequarters", 0xBE }, { "questiondown", 0xBF }, { "Agrave", 0xC0 }, { "Aacute", 0xC1 }, | > > > > > > > > > | 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 | { "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 }, { "diaeresis", 0xA8 }, { "copyright", 0xA9 }, { "ordfeminine", 0xAA }, { "guillemetleft", 0xAB }, { "guillemotleft", 0xAB }, { "notsign", 0xAC }, { "hyphen", 0xAD }, { "registered", 0xAE }, { "macron", 0xAF }, { "degree", 0xB0 }, { "plusminus", 0xB1 }, { "twosuperior", 0xB2 }, { "threesuperior", 0xB3 }, { "acute", 0xB4 }, { "mu", 0xB5 }, { "paragraph", 0xB6 }, { "periodcentered", 0xB7 }, { "cedilla", 0xB8 }, { "onesuperior", 0xB9 }, { "ordmasculine", 0xBA }, { "masculine", 0xBA }, { "guillemetright", 0xBB }, { "guillemotright", 0xBB }, { "onequarter", 0xBC }, { "onehalf", 0xBD }, { "threequarters", 0xBE }, { "questiondown", 0xBF }, { "Agrave", 0xC0 }, { "Aacute", 0xC1 }, |
︙ | ︙ | |||
556 557 558 559 560 561 562 563 564 565 566 567 568 569 | { "ugrave", 0xF9 }, { "uacute", 0xFA }, { "ucircumflex", 0xFB }, { "udiaeresis", 0xFC }, { "yacute", 0xFD }, { "thorn", 0xFE }, { "ydiaeresis", 0xFF }, { "Aogonek", 0x1A1 }, { "breve", 0x1A2 }, { "Lstroke", 0x1A3 }, { "Lcaron", 0x1A5 }, { "Sacute", 0x1A6 }, { "Scaron", 0x1A9 }, { "Scedilla", 0x1AA }, | > | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | { "ugrave", 0xF9 }, { "uacute", 0xFA }, { "ucircumflex", 0xFB }, { "udiaeresis", 0xFC }, { "yacute", 0xFD }, { "thorn", 0xFE }, { "ydiaeresis", 0xFF }, #endif { "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 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | { "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 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | { "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 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | { "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 }, | > > | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | { "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 }, | < | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | { "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 | < | 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | #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 }, | < < < < < < < < < < < < < < < < | 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | { "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 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | { "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 }, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | { "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 110 111 112 113 114 115 | #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_UNDEF = -1, NSVG_PAINT_NONE = 0, NSVG_PAINT_COLOR = 1, NSVG_PAINT_LINEAR_GRADIENT = 2, NSVG_PAINT_RADIAL_GRADIENT = 3 }; enum NSVGspreadType { |
︙ | ︙ | |||
147 148 149 150 151 152 153 | char spread; float fx, fy; int nstops; NSVGgradientStop stops[1]; } NSVGgradient; typedef struct NSVGpaint { | | | | | | | | | | | | | | | | | | | | | > > > | | | | | | | | | < < > | | | | | 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 | char spread; float fx, fy; int nstops; NSVGgradientStop stops[1]; } NSVGgradient; typedef struct NSVGpaint { signed char type; union { 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]. */ char fillGradient[64]; // Optional 'id' of fill gradient char strokeGradient[64]; // Optional 'id' of stroke gradient float xform[6]; // Root transformation for fill/stroke gradient 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; } | | | | | | | | | | | | | | | | | | 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 | 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++; |
︙ | ︙ | |||
428 429 430 431 432 433 434 | NSVGcoordinate cx, cy, r, fx, fy; } NSVGradialData; typedef struct NSVGgradientData { char id[64]; char ref[64]; | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | NSVGcoordinate cx, cy, r, fx, fy; } NSVGradialData; typedef struct NSVGgradientData { char id[64]; char ref[64]; signed char type; union { NSVGlinearData linear; NSVGradialData radial; }; char spread; char units; float xform[6]; |
︙ | ︙ | |||
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]; | | | | | | 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 | 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)); | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | 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; | | | < | | | | | | | | 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 | 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) { NSVGgradientData* grad = p->gradients; if (id == NULL || *id == '\0') return NULL; while (grad != NULL) { if (strcmp(grad->id, id) == 0) return grad; grad = grad->next; } return NULL; } static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, float *xform, signed char* paintType) { NSVGgradientData* data = NULL; NSVGgradientData* ref = NULL; NSVGgradientStop* stops = NULL; NSVGgradient* grad; 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; } nsvg__xformMultiply(grad->xform, data->xform); nsvg__xformMultiply(grad->xform, xform); grad->spread = data->spread; memcpy(grad->stops, stops, nstops*sizeof(NSVGgradientStop)); grad->nstops = nstops; *paintType = data->type; |
︙ | ︙ | |||
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | return; shape = (NSVGshape*)NANOSVG_malloc(sizeof(NSVGshape)); if (shape == NULL) goto error; memset(shape, 0, sizeof(NSVGshape)); memcpy(shape->id, attr->id, sizeof shape->id); scale = nsvg__getAverageScale(attr->xform); shape->strokeWidth = attr->strokeWidth * scale; shape->strokeDashOffset = attr->strokeDashOffset * scale; shape->strokeDashCount = (char)attr->strokeDashCount; for (i = 0; i < attr->strokeDashCount; i++) shape->strokeDashArray[i] = attr->strokeDashArray[i] * scale; shape->strokeLineJoin = attr->strokeLineJoin; shape->strokeLineCap = attr->strokeLineCap; shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; | > > > | | < < < < < | | | < | < < < < < | | | | 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 | return; shape = (NSVGshape*)NANOSVG_malloc(sizeof(NSVGshape)); if (shape == NULL) goto error; memset(shape, 0, sizeof(NSVGshape)); memcpy(shape->id, attr->id, sizeof shape->id); memcpy(shape->fillGradient, attr->fillGradient, sizeof shape->fillGradient); memcpy(shape->strokeGradient, attr->strokeGradient, sizeof shape->strokeGradient); memcpy(shape->xform, attr->xform, sizeof shape->xform); scale = nsvg__getAverageScale(attr->xform); shape->strokeWidth = attr->strokeWidth * scale; shape->strokeDashOffset = attr->strokeDashOffset * scale; shape->strokeDashCount = (char)attr->strokeDashCount; for (i = 0; i < attr->strokeDashCount; i++) shape->strokeDashArray[i] = attr->strokeDashArray[i] * scale; shape->strokeLineJoin = attr->strokeLineJoin; shape->strokeLineCap = attr->strokeLineCap; 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) { shape->fill.type = NSVG_PAINT_UNDEF; } /* 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) { shape->stroke.type = NSVG_PAINT_UNDEF; } /* 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]); | | | | | 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 | 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); } } | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > | | | < < < < < < | < > | < < > > | < < < < | > > > > > | > > > > > | | > > > > > | > > > > > > > > > | > > > > > > > > > > > > > > > | < > | > > > > > > | 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 | 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__getNextPathItemWhenArcFlag(const char* s, char* it) { it[0] = '\0'; while (*s && (nsvg__isspace(*s) || *s == ',')) s++; if (!*s) return s; if (*s == '0' || *s == '1') { it[0] = *s++; it[1] = '\0'; return s; } 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) { | | | | | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 | 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; | | | | | | | | | | | | 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 | 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; | | | 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | 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; | | | 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 | 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) { | | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 | 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]; } | | | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 | } 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; | | | 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 | 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) { | | | | | | | | | | | | | | | | | | | | | | | > > > > > | | | | 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 | 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; } |
︙ | ︙ | |||
2330 2331 2332 2333 2334 2335 2336 | cpx = 0; cpy = 0; cpx2 = 0; cpy2 = 0; initPoint = 0; closedFlag = 0; nargs = 0; while (*s) { | > > > > | | | | 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 | cpx = 0; cpy = 0; cpx2 = 0; cpy2 = 0; initPoint = 0; closedFlag = 0; nargs = 0; while (*s) { item[0] = '\0'; if ((cmd == 'A' || cmd == 'a') && (nargs == 3 || nargs == 4)) s = nsvg__getNextPathItemWhenArcFlag(s, item); if (!*item) s = nsvg__getNextPathItem(s, item); if (!*item) break; if (cmd != '\0' && nsvg__isCoordinate(item)) { 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') { | | | | | | | | | | | 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 | 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 { | | | 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 | 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) { | | | | | | | 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 | 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; } } } } } static void nsvg__parseGradient(NSVGparser* p, const char** attr, signed char type) { int i; NSVGgradientData* grad = (NSVGgradientData*)NANOSVG_malloc(sizeof(NSVGgradientData)); if (grad == NULL) return; memset(grad, 0, sizeof(NSVGgradientData)); grad->units = NSVG_OBJECT_SPACE; grad->type = type; |
︙ | ︙ | |||
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]); } | | | | 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 | 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) { | | | | 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 | } 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; | | | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 | 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; | | | 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | { 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; | | | | | | | 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 | 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; |
︙ | ︙ | |||
3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 | shape->strokeWidth *= avgs; shape->strokeDashOffset *= avgs; for (i = 0; i < shape->strokeDashCount; i++) shape->strokeDashArray[i] *= avgs; } } NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi) { NSVGparser* p; NSVGimage* ret = 0; p = nsvg__createParser(); if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | shape->strokeWidth *= avgs; shape->strokeDashOffset *= avgs; for (i = 0; i < shape->strokeDashCount; i++) shape->strokeDashArray[i] *= avgs; } } static void nsvg__createGradients(NSVGparser* p) { NSVGshape* shape; for (shape = p->image->shapes; shape != NULL; shape = shape->next) { if (shape->fill.type == NSVG_PAINT_UNDEF) { if (shape->fillGradient[0] != '\0') { float inv[6], localBounds[4]; nsvg__xformInverse(inv, shape->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->fill.gradient = nsvg__createGradient(p, shape->fillGradient, localBounds, shape->xform, &shape->fill.type); } if (shape->fill.type == NSVG_PAINT_UNDEF) { shape->fill.type = NSVG_PAINT_NONE; } } if (shape->stroke.type == NSVG_PAINT_UNDEF) { if (shape->strokeGradient[0] != '\0') { float inv[6], localBounds[4]; nsvg__xformInverse(inv, shape->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->stroke.gradient = nsvg__createGradient(p, shape->strokeGradient, localBounds, shape->xform, &shape->stroke.type); } if (shape->stroke.type == NSVG_PAINT_UNDEF) { shape->stroke.type = NSVG_PAINT_NONE; } } } } NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi) { NSVGparser* p; NSVGimage* ret = 0; p = nsvg__createParser(); if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); // Create gradients after all definitions have been parsed nsvg__createGradients(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; | | | 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 | 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 | > > | 3208 3209 3210 3211 3212 3213 3214 3215 3216 | 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 |
︙ | ︙ | |||
119 120 121 122 123 124 125 | typedef struct NSVGmemPage { unsigned char mem[NSVG__MEMPAGE_SIZE]; int size; struct NSVGmemPage* next; } NSVGmemPage; typedef struct NSVGcachedPaint { | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | typedef struct NSVGmemPage { unsigned char mem[NSVG__MEMPAGE_SIZE]; int size; struct NSVGmemPage* next; } NSVGmemPage; typedef struct NSVGcachedPaint { signed char type; char spread; float xform[6]; unsigned int colors[256]; } NSVGcachedPaint; struct NSVGrasterizer { |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
338 339 340 341 342 343 344 345 346 347 348 349 350 351 | *x *= id; *y *= id; } return d; } static float nsvg__absf(float x) { return x < 0 ? -x : x; } static void nsvg__flattenCubicBez(NSVGrasterizer* r, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level, int type) { float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234; | > | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | *x *= id; *y *= id; } return d; } static float nsvg__absf(float x) { return x < 0 ? -x : x; } static float nsvg__roundf(float x) { return (x >= 0) ? floorf(x + 0.5) : ceilf(x - 0.5); } static void nsvg__flattenCubicBez(NSVGrasterizer* r, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level, int type) { float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234; |
︙ | ︙ | |||
360 361 362 363 364 365 366 | x34 = (x3+x4)*0.5f; y34 = (y3+y4)*0.5f; x123 = (x12+x23)*0.5f; y123 = (y12+y23)*0.5f; dx = x4 - x1; dy = y4 - y1; | | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | x34 = (x3+x4)*0.5f; y34 = (y3+y4)*0.5f; x123 = (x12+x23)*0.5f; y123 = (y12+y23)*0.5f; dx = x4 - x1; dy = y4 - y1; d2 = nsvg__absf((x2 - x4) * dy - (y2 - y4) * dx); d3 = nsvg__absf((x3 - x4) * dy - (y3 - y4) * dx); if ((d2 + d3)*(d2 + d3) < r->tessTol * (dx*dx + dy*dy)) { nsvg__addPathPoint(r, x4, y4, type); return; } x234 = (x23+x34)*0.5f; |
︙ | ︙ | |||
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; | | | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | 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) { | | | | | | | 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 | 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) { | | | | | | | | | | | 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 | } 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) { | | | | | | | | | | | | 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 | 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) { | | | | | | | | | | 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 | 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)(-nsvg__roundf(NSVG__FIX * -dxdy)); else z->dx = (int)nsvg__roundf(NSVG__FIX * dxdy); z->x = (int)nsvg__roundf(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) { | | | | | | | | | | > | | | | | | | | 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 | { 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; | | | | | | 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 | 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; | | | | | | | 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 | 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; | | | | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | 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; | | | | | | | | | | | | | | | | | | | | 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 | } 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]; |
︙ | ︙ | |||
1290 1291 1292 1293 1294 1295 1296 | cache->spread = grad->spread; memcpy(cache->xform, grad->xform, sizeof(float)*6); if (grad->nstops == 0) { for (i = 0; i < 256; i++) cache->colors[i] = 0; | | > | | 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | cache->spread = grad->spread; memcpy(cache->xform, grad->xform, sizeof(float)*6); if (grad->nstops == 0) { for (i = 0; i < 256; i++) cache->colors[i] = 0; } else if (grad->nstops == 1) { unsigned int color = nsvg__applyOpacity(grad->stops[0].color, opacity); for (i = 0; i < 256; i++) cache->colors[i] = color; } else { unsigned int ca, cb = 0; float ua, ub, du, u; int ia, ib, count; ca = nsvg__applyOpacity(grad->stops[0].color, opacity); ua = nsvg__clampf(grad->stops[0].offset, 0, 1); |
︙ | ︙ | |||
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); | | | > | | | | | > | | > > | 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 | 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: |
︙ | ︙ | |||
50 51 52 53 54 55 56 | } declare 5 { void Tk_AddOption(Tk_Window tkwin, const char *name, const char *value, int priority) } declare 6 { void Tk_BindEvent(Tk_BindingTable bindingTable, | | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | } declare 5 { void Tk_AddOption(Tk_Window tkwin, const char *name, const char *value, int priority) } declare 6 { void Tk_BindEvent(Tk_BindingTable bindingTable, XEvent *eventPtr, Tk_Window tkwin, Tcl_Size numObjects, void **objectPtr) } declare 7 { void Tk_CanvasDrawableCoords(Tk_Canvas canvas, double x, double y, short *drawableXPtr, short *drawableYPtr) } declare 8 { |
︙ | ︙ | |||
84 85 86 87 88 89 90 | } declare 13 { int Tk_CanvasPsFont(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font) } declare 14 { void Tk_CanvasPsPath(Tcl_Interp *interp, | | | | | | | | | | | | | | | | | | | | | | | | | 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 | } declare 13 { int Tk_CanvasPsFont(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font) } declare 14 { void Tk_CanvasPsPath(Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, Tcl_Size numPoints) } declare 15 { int Tk_CanvasPsStipple(Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap) } declare 16 { double Tk_CanvasPsY(Tk_Canvas canvas, double y) } declare 17 { void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc) } declare 18 { int Tk_CanvasTagsParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 19 { const char *Tk_CanvasTagsPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 20 { Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas) } declare 21 { void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr) } declare 22 { void Tk_ChangeWindowAttributes(Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr) } declare 23 { int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) } declare 24 { void Tk_ClearSelection(Tk_Window tkwin, Atom selection) } declare 25 { int Tk_ClipboardAppend(Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer) } declare 26 { int Tk_ClipboardClear(Tcl_Interp *interp, Tk_Window tkwin) } declare 27 { int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags) } declare 28 { int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags) } declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags) } declare 30 { void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr) } declare 31 { Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr) } declare 32 { Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin) } declare 33 { unsigned long Tk_CreateBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr, const char *script, int append) } declare 34 { Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp *interp) } declare 35 { Tk_ErrorHandler Tk_CreateErrorHandler(Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, void *clientData) } declare 36 { void Tk_CreateEventHandler(Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData) } declare 37 { void Tk_CreateGenericHandler(Tk_GenericProc *proc, void *clientData) } declare 38 { void Tk_CreateImageType(const Tk_ImageType *typePtr) } declare 39 { void Tk_CreateItemType(Tk_ItemType *typePtr) } declare 40 { void Tk_CreatePhotoImageFormat(const Tk_PhotoImageFormat *formatPtr) } declare 41 { void Tk_CreateSelHandler(Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc *proc, void *clientData, Atom format) } declare 42 { Tk_Window Tk_CreateWindow(Tcl_Interp *interp, Tk_Window parent, const char *name, const char *screenName) } declare 43 { Tk_Window Tk_CreateWindowFromPath(Tcl_Interp *interp, Tk_Window tkwin, const char *pathName, const char *screenName) } declare 44 { int Tk_DefineBitmap(Tcl_Interp *interp, const char *name, const void *source, int width, int height) } declare 45 { void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor) } declare 46 { void Tk_DeleteAllBindings(Tk_BindingTable bindingTable, void *object) } declare 47 { int Tk_DeleteBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr) } declare 48 { void Tk_DeleteBindingTable(Tk_BindingTable bindingTable) } declare 49 { void Tk_DeleteErrorHandler(Tk_ErrorHandler handler) } declare 50 { void Tk_DeleteEventHandler(Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData) } declare 51 { void Tk_DeleteGenericHandler(Tk_GenericProc *proc, void *clientData) } declare 52 { void Tk_DeleteImage(Tcl_Interp *interp, const char *name) } declare 53 { void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target) } declare 54 { void Tk_DestroyWindow(Tk_Window tkwin) } declare 55 { const char *Tk_DisplayName(Tk_Window tkwin) } declare 56 { int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y) } declare 57 { void Tk_Draw3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief) } declare 58 { void Tk_Draw3DRectangle(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief) } declare 59 { void Tk_DrawChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, int x, int y) } declare 60 { void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, int width, Drawable drawable) } declare 61 { void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, Tcl_Size firstChar, Tcl_Size lastChar) } declare 62 { void Tk_Fill3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief) } declare 63 { void Tk_Fill3DRectangle(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief) |
︙ | ︙ | |||
314 315 316 317 318 319 320 | void Tk_FreeGC(Display *display, GC gc) } declare 73 { void Tk_FreeImage(Tk_Image image) } declare 74 { void Tk_FreeOptions(const Tk_ConfigSpec *specs, | | < < < | | | 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 | void Tk_FreeGC(Display *display, GC gc) } declare 73 { void Tk_FreeImage(Tk_Image image) } declare 74 { void Tk_FreeOptions(const Tk_ConfigSpec *specs, void *widgRec, Display *display, int needFlags) } declare 75 { void Tk_FreePixmap(Display *display, Pixmap pixmap) } declare 76 { void Tk_FreeTextLayout(Tk_TextLayout textLayout) } declare 78 { GC Tk_GCForColor(XColor *colorPtr, Drawable drawable) } declare 79 { void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight) } declare 80 { Tk_3DBorder Tk_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName) } declare 81 { void Tk_GetAllBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object) } declare 82 { int Tk_GetAnchor(Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr) } declare 83 { const char *Tk_GetAtomName(Tk_Window tkwin, Atom atom) } declare 84 { const char *Tk_GetBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr) } declare 85 { Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, const char *str) } declare 86 { Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp, |
︙ | ︙ | |||
396 397 398 399 400 401 402 | void Tk_GetFontMetrics(Tk_Font font, Tk_FontMetrics *fmPtr) } declare 96 { GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr) } declare 97 { Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, | | | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | void Tk_GetFontMetrics(Tk_Font font, Tk_FontMetrics *fmPtr) } declare 96 { GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr) } declare 97 { Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, void *clientData) } declare 98 { void *Tk_GetImageModelData(Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr) } declare 99 { Tk_ItemType *Tk_GetItemTypes(void) } declare 100 { int Tk_GetJoinStyle(Tcl_Interp *interp, const char *str, int *joinPtr) |
︙ | ︙ | |||
435 436 437 438 439 440 441 | int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr) } declare 107 { void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr) } declare 108 { int Tk_GetScrollInfo(Tcl_Interp *interp, | | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr) } declare 107 { void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr) } declare 108 { int Tk_GetScrollInfo(Tcl_Interp *interp, Tcl_Size argc, const char **argv, double *dblPtr, int *intPtr) } declare 109 { int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr) } declare 110 { int Tk_GetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData) } declare 111 { Tk_Uid Tk_GetUid(const char *str) } declare 112 { Visual *Tk_GetVisual(Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *depthPtr, |
︙ | ︙ | |||
471 472 473 474 475 476 477 | declare 116 { Tk_Window Tk_IdToWindow(Display *display, Window window) } declare 117 { void Tk_ImageChanged(Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight) } | < < < | | | 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 | declare 116 { Tk_Window Tk_IdToWindow(Display *display, Window window) } declare 117 { void Tk_ImageChanged(Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight) } declare 119 { Atom Tk_InternAtom(Tk_Window tkwin, const char *name) } declare 120 { int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y, int width, int height) } declare 121 { void Tk_MaintainGeometry(Tk_Window window, Tk_Window container, int x, int y, int width, int height) } declare 122 { Tk_Window Tk_MainWindow(Tcl_Interp *interp) } declare 123 { void Tk_MakeWindowExist(Tk_Window tkwin) } declare 124 { void Tk_ManageGeometry(Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, void *clientData) } declare 125 { void Tk_MapWindow(Tk_Window tkwin) } declare 126 { int Tk_MeasureChars(Tk_Font tkfont, const char *source, Tcl_Size numBytes, int maxPixels, int flags, int *lengthPtr) } declare 127 { void Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y, int width, int height) } declare 128 { |
︙ | ︙ | |||
553 554 555 556 557 558 559 | declare 141 { Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin) } declare 142 { void Tk_OwnSelection(Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, | | < < < < < < < < < < < < < < < < < | 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 | declare 141 { Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin) } declare 142 { void Tk_OwnSelection(Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, void *clientData) } declare 143 { int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags) } declare 146 { int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr) } declare 147 { void Tk_PhotoBlank(Tk_PhotoHandle handle) } declare 149 { void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr) } declare 151 { int Tk_PointToChar(Tk_TextLayout layout, int x, int y) } declare 152 { int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString *dsPtr) } declare 153 { |
︙ | ︙ | |||
611 612 613 614 615 616 617 | void Tk_ResizeWindow(Tk_Window tkwin, int width, int height) } declare 157 { int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other) } declare 158 { Tk_RestrictProc *Tk_RestrictEvents(Tk_RestrictProc *proc, | | < < < | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | void Tk_ResizeWindow(Tk_Window tkwin, int width, int height) } declare 157 { int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other) } declare 158 { Tk_RestrictProc *Tk_RestrictEvents(Tk_RestrictProc *proc, void *arg, void **prevArgPtr) } declare 160 { const char *Tk_SetAppName(Tk_Window tkwin, const char *name) } declare 161 { void Tk_SetBackgroundFromBorder(Tk_Window tkwin, Tk_3DBorder border) } |
︙ | ︙ | |||
668 669 670 671 672 673 674 | declare 174 { int Tk_StrictMotif(Tk_Window tkwin) } declare 175 { void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout) } declare 176 { | | | | | 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | declare 174 { int Tk_StrictMotif(Tk_Window tkwin) } declare 175 { void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout) } declare 176 { int Tk_TextWidth(Tk_Font font, const char *str, Tcl_Size numBytes) } declare 177 { void Tk_UndefineCursor(Tk_Window window) } declare 178 { void Tk_UnderlineChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, Tcl_Size firstByte, Tcl_Size lastByte) } declare 179 { void Tk_UnderlineTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline) } declare 180 { |
︙ | ︙ | |||
795 796 797 798 799 800 801 | } declare 209 { int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) } declare 210 { int Tk_GetScrollInfoObj(Tcl_Interp *interp, | | < < < < | < < < | 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 | } declare 209 { int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) } declare 210 { int Tk_GetScrollInfoObj(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) } declare 211 { int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } declare 213 { void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr) } declare 214 { int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr) } declare 215 { void Tk_InitConsoleChannels(Tcl_Interp *interp) } declare 217 { void Tk_CreateSmoothMethod(Tcl_Interp *interp, const Tk_SmoothMethod *method) } #declare 218 { # void Tk_CreateCanvasVisitor(Tcl_Interp *interp, void *typePtr) #} #declare 219 { |
︙ | ︙ | |||
888 889 890 891 892 893 894 | declare 234 { int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass) } declare 235 { void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, | | | 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | declare 234 { int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass) } declare 235 { void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, double *coordPtr, Tcl_Size numPoints) } declare 236 { int Tk_PostscriptStipple(Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap) } declare 237 { double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo) |
︙ | ︙ | |||
920 921 922 923 924 925 926 | # declare 241 { Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp, Tk_Window parent, const char *screenName) } declare 242 { void Tk_SetClassProcs(Tk_Window tkwin, | | < < < < < < < < < < < | 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 | # declare 241 { Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp, Tk_Window parent, const char *screenName) } declare 242 { void Tk_SetClassProcs(Tk_Window tkwin, const Tk_ClassProcs *procs, void *instanceData) } # New in 8.4a4 # declare 243 { void Tk_SetInternalBorderEx(Tk_Window tkwin, int left, int right, int top, int bottom) } declare 244 { void Tk_SetMinimumRequestSize(Tk_Window tkwin, int minWidth, int minHeight) } # New in 8.4a5 # declare 245 { void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) } declare 248 { int Tk_CollapseMotionEvents(Display *display, int collapse) } # Style engine declare 249 { Tk_StyleEngine Tk_RegisterStyleEngine(const char *name, |
︙ | ︙ | |||
971 972 973 974 975 976 977 | Tk_ElementSpec *templatePtr) } declare 252 { int Tk_GetElementId(const char *name) } declare 253 { Tk_Style Tk_CreateStyle(const char *name, Tk_StyleEngine engine, | | < < < < < < | | 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 | Tk_ElementSpec *templatePtr) } declare 252 { int Tk_GetElementId(const char *name) } declare 253 { Tk_Style Tk_CreateStyle(const char *name, Tk_StyleEngine engine, void *clientData) } declare 254 { Tk_Style Tk_GetStyle(Tcl_Interp *interp, const char *name) } declare 255 { void Tk_FreeStyle(Tk_Style style) } declare 256 { const char *Tk_NameOfStyle(Tk_Style style) } declare 257 { Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr) } declare 260 { Tk_StyledElement Tk_GetStyledElement(Tk_Style style, Tcl_Size elementId, Tk_OptionTable optionTable) } declare 261 { void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr) } |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | } # TIP #264 declare 271 { Tcl_Interp *Tk_Interp(Tk_Window tkwin) } | < < < < < < < < < < < < < < < < < | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | } # TIP #264 declare 271 { Tcl_Interp *Tk_Interp(Tk_Window tkwin) } # TIP#580 declare 274 { int Tk_AlwaysShowSelection(Tk_Window tkwin) } declare 275 { unsigned Tk_GetButtonMask(unsigned button) } |
︙ | ︙ | |||
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 ################################ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 ################################ |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | } declare 2 win { HWND Tk_GetHWND(Window window) } declare 3 win { Tk_Window Tk_HWNDToWindow(HWND hwnd) } | < < < < < < < < < < < < < < < | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | } declare 2 win { HWND Tk_GetHWND(Window window) } declare 3 win { Tk_Window Tk_HWNDToWindow(HWND hwnd) } ################################ # Aqua specific functions declare 4 aqua { void TkMacOSXInitAppleEvents(Tcl_Interp *interp) } declare 6 aqua { void TkMacOSXInvalClipRgns(Tk_Window tkwin) } # Stub removed because it just returned NULL. #declare 7 aqua { # void *TkMacOSXGetDrawablePort(Drawable drawable) #} |
︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | # Public functions that are not accessible via the stubs table. export { const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact) } export { | | | | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | # Public functions that are not accessible via the stubs table. export { const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact) } export { void Tk_MainEx(Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp) } export { void Tk_MainExW(Tcl_Size argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); } # Local Variables: # mode: tcl # End: |
Changes to generic/tk.h.
1 2 3 4 5 6 | /* * tk.h -- * * Declarations for Tk-related things that are visible outside of the Tk * module itself. * | | | | | | | | 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 | /* * tk.h -- * * Declarations for Tk-related things that are visible outside of the Tk * module itself. * * Copyright © 1989-1994 The Regents of the University of California. * Copyright © 1994 The Australian National University. * Copyright © 1994-1998 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. */ #ifndef _TK #define _TK #include <tcl.h> #if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) # error Tk 9.0 must be compiled with tcl.h from Tcl 8.7 or better #endif #ifndef EXTERN # define EXTERN extern TCL_STORAGE_CLASS #endif /* |
︙ | ︙ | |||
61 62 63 64 65 66 67 | * unix/tk.spec (1 LOC patch) * win/tcl.m4 (not patchlevel) * * 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. */ | > | > > | | | | | > | 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 | * unix/tk.spec (1 LOC patch) * win/tcl.m4 (not patchlevel) * * 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. */ #ifndef TK_MAJOR_VERSION # define TK_MAJOR_VERSION 9 #endif #if TK_MAJOR_VERSION == 9 # define TK_MINOR_VERSION 0 # define TK_RELEASE_LEVEL TCL_BETA_RELEASE # define TK_RELEASE_SERIAL 2 # define TK_VERSION "9.0" # define TK_PATCH_LEVEL "9.0b2" #endif /* TK_MAJOR_VERSION */ /* * 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 | < < | < | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # 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, | | > < | | < < < < | 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 | 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. */ typedef struct Tk_OptionSpec { Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR; * see definitions above. Last option in table * must have type TK_OPTION_END. */ const char *optionName; /* Name used to specify option in Tcl * commands. */ const char *dbName; /* Name for option in option database. */ const char *dbClass; /* Class for option in database. */ const char *defValue; /* Default value for option if not specified * in command line, the option database, or * the system. */ Tcl_Size objOffset; /* Where in record to store a Tcl_Obj * that * holds the value of this option, specified * as an offset in bytes from the start of the * record. Use the offsetof macro to generate * values for this. TCL_INDEX_NONE means don't * store the Tcl_Obj in the record. */ Tcl_Size internalOffset; /* Where in record to store the internal * representation of the value of this option, * such as an int or XColor *. This field is * specified as an offset in bytes from the * start of the record. Use the offsetof * macro to generate values for it. * TCL_INDEX_NONE means don't store the * internal representation in the record. */ int flags; /* Any combination of the values defined * below. */ const void *clientData; /* An alternate place to put option-specific * data. Used for the monochrome default value * for colors, etc. */ int typeMask; /* An arbitrary bit mask defined by the class * manager; typically bits correspond to |
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* * Flag values for Tk_OptionSpec structures. These flags are shared by * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully. */ #define TK_OPTION_NULL_OK (1 << 0) #define TK_OPTION_DONT_SET_DEFAULT (1 << 3) /* * The following structure and function types are used by TK_OPTION_CUSTOM * options; the structure holds pointers to the functions needed by the Tk * option config code to handle a custom option. */ | > > < | < < < < < < | | | < | | | < < < < < < < < < < < < < > | | | | | | > > > < | < < < | 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 | /* * Flag values for Tk_OptionSpec structures. These flags are shared by * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully. */ #define TK_OPTION_NULL_OK (1 << 0) #define TK_OPTION_DONT_SET_DEFAULT (1 << 3) #define TK_OPTION_VAR(type) ((sizeof(type) < 2 * sizeof(int)) ? ((int)(sizeof(type)&(sizeof(int)-1))<<6) : (3<<6)) #define TK_OPTION_ENUM_VAR TK_OPTION_VAR(Tk_OptionType) /* * The following structure and function types are used by TK_OPTION_CUSTOM * options; the structure holds pointers to the functions needed by the Tk * option config code to handle a custom option. */ typedef int (Tk_CustomOptionSetProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *widgRec, Tcl_Size offset, char *saveInternalPtr, int flags); typedef Tcl_Obj *(Tk_CustomOptionGetProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset); typedef void (Tk_CustomOptionRestoreProc) (void *clientData, Tk_Window tkwin, char *internalPtr, char *saveInternalPtr); typedef void (Tk_CustomOptionFreeProc) (void *clientData, Tk_Window tkwin, char *internalPtr); typedef struct Tk_ObjCustomOption { const char *name; /* Name of the custom option. */ Tk_CustomOptionSetProc *setProc; /* Function to use to set a record's option * value from a Tcl_Obj */ Tk_CustomOptionGetProc *getProc; /* Function to use to get a Tcl_Obj * representation from an internal * representation of an option. */ Tk_CustomOptionRestoreProc *restoreProc; /* Function to use to restore a saved value * for the internal representation. */ Tk_CustomOptionFreeProc *freeProc; /* Function to use to free the internal * representation of an option. */ void *clientData; /* Arbitrary one-word value passed to the * handling procs. */ } Tk_ObjCustomOption; /* * The following two structures are used for error handling. When config * options are being modified, the old values are saved in a Tk_SavedOptions * structure. If an error occurs, then the contents of the structure can be * used to restore all of the old values. The contents of this structure are * for the private use Tk. No-one outside Tk should ever read or write any of * the fields of these structures. */ typedef struct Tk_SavedOption { struct TkOption *optionPtr; /* Points to information that describes the * option. */ Tcl_Obj *valuePtr; /* The old value of the option, in the form of * a Tcl object; may be NULL if the value was * not saved as an object. */ #if TCL_MAJOR_VERSION > 8 long double internalForm; /* The old value of the option, in some * internal representation such as an int or * (XColor *). Valid only if the field * optionPtr->specPtr->objOffset is -1. The * space must be large enough to accommodate a * long double, a double, a long, or a pointer; * right now it looks like a long double (i.e., 16 * bytes) is big enough. Also, using a long double * guarantees that the field is properly aligned * for storing large values. */ #else double internalForm; #endif } Tk_SavedOption; #ifdef TCL_MEM_DEBUG # define TK_NUM_SAVED_OPTIONS 2 #else # define TK_NUM_SAVED_OPTIONS 20 #endif typedef struct Tk_SavedOptions { void *recordPtr; /* The data structure in which to restore * configuration options. */ Tk_Window tkwin; /* Window associated with recordPtr; needed to * restore certain options. */ Tcl_Size numItems; /* The number of valid items in items field. */ Tk_SavedOption items[TK_NUM_SAVED_OPTIONS]; /* Items used to hold old values. */ struct Tk_SavedOptions *nextPtr; /* Points to next structure in list; needed if * too many options changed to hold all the * old values in a single structure. NULL * means no more structures. */ |
︙ | ︙ | |||
351 352 353 354 355 356 357 | /* * This is a temporary flag used while tkObjConfig and new widgets are in * development. */ #ifndef __NO_OLD_CONFIG | < | | | < < < < < | < | | 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 | /* * This is a temporary flag used while tkObjConfig and new widgets are in * development. */ #ifndef __NO_OLD_CONFIG typedef int (Tk_OptionParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); typedef const char *(Tk_OptionPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); typedef struct Tk_CustomOption { Tk_OptionParseProc *parseProc; /* Procedure to call to parse an option and * store it in converted form. */ Tk_OptionPrintProc *printProc; /* Procedure to return a printable string * describing an existing option. */ void *clientData; /* Arbitrary one-word value used by option * parser: passed to parseProc and * printProc. */ } Tk_CustomOption; /* * Structure used to specify information for Tk_ConfigureWidget. Each * structure gives complete information for one option, including how the |
︙ | ︙ | |||
392 393 394 395 396 397 398 | * must have type TK_CONFIG_END. */ const char *argvName; /* Switch used to specify option in argv. NULL * means this spec is part of a group. */ Tk_Uid dbName; /* Name for option in option database. */ Tk_Uid dbClass; /* Class for option in database. */ Tk_Uid defValue; /* Default value for option if not specified * in command line or database. */ | < | < < < | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | * must have type TK_CONFIG_END. */ const char *argvName; /* Switch used to specify option in argv. NULL * means this spec is part of a group. */ Tk_Uid dbName; /* Name for option in option database. */ Tk_Uid dbClass; /* Class for option in database. */ Tk_Uid defValue; /* Default value for option if not specified * in command line or database. */ Tcl_Size offset; /* Where in widget record to store value; use * offsetof macro to generate values for * this. */ int specFlags; /* Any combination of the values defined * below; other bits are used internally by * tkConfig.c. */ const Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a * pointer to info about how to parse and * print the option. Otherwise it is |
︙ | ︙ | |||
442 443 444 445 446 447 448 | * (internal-use-only flags are defined there). */ #define TK_CONFIG_NULL_OK (1 << 0) #define TK_CONFIG_COLOR_ONLY (1 << 1) #define TK_CONFIG_MONO_ONLY (1 << 2) #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) | < < < | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | * (internal-use-only flags are defined there). */ #define TK_CONFIG_NULL_OK (1 << 0) #define TK_CONFIG_COLOR_ONLY (1 << 1) #define TK_CONFIG_MONO_ONLY (1 << 2) #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) #define TK_CONFIG_USER_BIT 0x100 #endif /* __NO_OLD_CONFIG */ /* * Structure used to specify how to handle argv options. */ |
︙ | ︙ | |||
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. */ | > > | 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 | #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. */ |
︙ | ︙ | |||
600 601 602 603 604 605 606 | /* * Widget class procedures used to implement platform specific widget * behavior. */ typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent, | | | < | < < < | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | /* * Widget class procedures used to implement platform specific widget * behavior. */ typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent, void *instanceData); typedef void (Tk_ClassWorldChangedProc) (void *instanceData); typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr); typedef struct Tk_ClassProcs { Tcl_Size size; Tk_ClassWorldChangedProc *worldChangedProc; /* Procedure to invoke when the widget needs * to respond in some way to a change in the * world (font changes, etc.) */ Tk_ClassCreateProc *createProc; /* Procedure to invoke when the platform- * dependent window needs to be created. */ |
︙ | ︙ | |||
634 635 636 637 638 639 640 | * (or NULL if the structure is NULL). * * A more general version of this function may be useful if other * size-versioned structure pop up in the future: * * #define Tk_GetField(name, who, which) \ * (((who) == NULL) ? NULL : | | | | | | 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 | * (or NULL if the structure is NULL). * * A more general version of this function may be useful if other * size-versioned structure pop up in the future: * * #define Tk_GetField(name, who, which) \ * (((who) == NULL) ? NULL : * (((size_t)(who)->size <= offsetof(name, which)) ? NULL :(name)->which)) */ #define Tk_GetClassProc(procs, which) \ (((procs) == NULL) ? NULL : \ (((size_t)(procs)->size <= offsetof(Tk_ClassProcs, which)) ? NULL:(procs)->which)) /* * Each geometry manager (the packer, the placer, etc.) is represented by a * structure of the following form, which indicates procedures to invoke in * the geometry manager to carry out certain functions. */ #define Tk_GeomLostSlaveProc Tk_GeomLostContentProc typedef void (Tk_GeomRequestProc) (void *clientData, Tk_Window tkwin); typedef void (Tk_GeomLostContentProc) (void *clientData, Tk_Window tkwin); typedef struct Tk_GeomMgr { const char *name; /* Name of the geometry manager (command used * to invoke it, or name of widget class that * allows embedded widgets). */ Tk_GeomRequestProc *requestProc; /* Procedure to invoke when a content's |
︙ | ︙ | |||
686 687 688 689 690 691 692 | *---------------------------------------------------------------------- */ #define VirtualEvent (MappingNotify + 1) #define ActivateNotify (MappingNotify + 2) #define DeactivateNotify (MappingNotify + 3) #define MouseWheelEvent (MappingNotify + 4) | > | > | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | *---------------------------------------------------------------------- */ #define VirtualEvent (MappingNotify + 1) #define ActivateNotify (MappingNotify + 2) #define DeactivateNotify (MappingNotify + 3) #define MouseWheelEvent (MappingNotify + 4) #define TouchpadScroll (MappingNotify + 5) #define TK_LASTEVENT (MappingNotify + 6) #define TouchpadScrollMask (1L << 27) #define MouseWheelMask (1L << 28) #define ActivateMask (1L << 29) #define VirtualEventMask (1L << 30) /* * A virtual event shares most of its fields with the XKeyEvent and * XButtonEvent structures. 99% of the time a virtual event will be an |
︙ | ︙ | |||
781 782 783 784 785 786 787 | (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED) #define Tk_TopWinHierarchy(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) #define Tk_IsManageable(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) | < < < < | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED) #define Tk_TopWinHierarchy(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) #define Tk_IsManageable(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) #define Tk_InternalBorderLeft(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderLeft) #define Tk_InternalBorderRight(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderRight) #define Tk_InternalBorderTop(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderTop) #define Tk_InternalBorderBottom(tkwin) \ |
︙ | ︙ | |||
832 833 834 835 836 837 838 | XSetWindowAttributes atts; 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 */ | | | | | | | 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 | XSetWindowAttributes atts; 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 */ void **dummy10; /* tagPtr */ Tcl_Size dummy11; /* numTags */ Tcl_Size dummy12; /* optionLevel */ char *dummy13; /* selHandlerList */ char *dummy14; /* geomMgrPtr */ void *dummy15; /* geomData */ int reqWidth, reqHeight; int internalBorderLeft; char *dummy16; /* wmInfoPtr */ char *dummy17; /* classProcPtr */ void *dummy18; /* instanceData */ char *dummy19; /* privatePtr */ int internalBorderRight; int internalBorderTop; int internalBorderBottom; int minReqWidth; int minReqHeight; #if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) |
︙ | ︙ | |||
981 982 983 984 985 986 987 | * structure. Each actual item is represented by a record with the following * stuff at its beginning, plus additional type-specific stuff after that. */ #define TK_TAG_SPACE 3 typedef struct Tk_Item { | < | < < < < | | < < < | 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 | * structure. Each actual item is represented by a record with the following * stuff at its beginning, plus additional type-specific stuff after that. */ #define TK_TAG_SPACE 3 typedef struct Tk_Item { Tcl_Size id; /* Unique identifier for this item (also * serves as first tag for item). */ struct Tk_Item *nextPtr; /* Next in display list of all items in this * canvas. Later items in list are drawn on * top of earlier ones. */ Tk_Uid staticTagSpace[TK_TAG_SPACE]; /* Built-in space for limited # of tags. */ Tk_Uid *tagPtr; /* Pointer to array of tags. Usually points to * staticTagSpace, but may point to malloc-ed * space if there are lots of tags. */ Tcl_Size tagSpace; /* Total amount of tag space available at * tagPtr. */ Tcl_Size numTags; /* Number of tag slots actually used at * *tagPtr. */ struct Tk_ItemType *typePtr;/* Table of procedures that implement this * type of item. */ int x1, y1, x2, y2; /* Bounding box for item, in integer canvas * units. Set by item-specific code and * guaranteed to contain every pixel drawn in * item. Item area includes x1 and y1 but not * x2 and y2. */ |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | #define TK_ITEM_DONT_REDRAW 2 /* * Records of the following type are used to describe a type of item (e.g. * lines, circles, etc.) that can form part of a canvas widget. */ | < | < < | < < < < < < < < < < < < < < | < | | < < < < < < < < < < | | | | < < | < < < | < < | 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 | #define TK_ITEM_DONT_REDRAW 2 /* * Records of the following type are used to describe a type of item (e.g. * lines, circles, etc.) that can form part of a canvas widget. */ typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size beforeThis, Tcl_Obj *string); typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *indexString, Tcl_Size *indexPtr); typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); typedef void (Tk_ItemDisplayProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); typedef void (Tk_ItemRotateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRadians); typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size index); typedef Tcl_Size (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size first, Tcl_Size last); #ifndef __NO_OLD_CONFIG typedef struct Tk_ItemType { const char *name; /* The name of this type of item, such as * "line". */ Tcl_Size itemSize; /* Total amount of space needed for item's * record. */ Tk_ItemCreateProc *createProc; /* Procedure to create a new item of this * type. */ const Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for * this type. Used for returning configuration * info. */ Tk_ItemConfigureProc *configProc; /* Procedure to call to change configuration * options. */ Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's * coordinates. */ Tk_ItemDeleteProc *deleteProc; /* Procedure to delete existing item of this * type. */ Tk_ItemDisplayProc *displayProc; /* Procedure to display items of this type. */ int flags; /* Combination of TK_ALWAYS_REDRAW/TK_MOVABLE_POINTS */ Tk_ItemPointProc *pointProc;/* Computes distance from item to a given * point. */ Tk_ItemAreaProc *areaProc; /* Computes whether item is inside, outside, * or overlapping an area. */ Tk_ItemPostscriptProc *postscriptProc; /* Procedure to write a Postscript description * for items of this type. */ |
︙ | ︙ | |||
1176 1177 1178 1179 1180 1181 1182 | * about a point. */ int reserved2; /* Carefully compatible with */ char *reserved3; /* Jan Nijtmans dash patch */ char *reserved4; } Tk_ItemType; /* | | < > | | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | * about a point. */ int reserved2; /* Carefully compatible with */ char *reserved3; /* Jan Nijtmans dash patch */ char *reserved4; } Tk_ItemType; /* * Possible flags for 'flags' field. */ #define TK_ALWAYS_REDRAW 1 /* item should be redrawn always*/ #define TK_MOVABLE_POINTS 2 /* item supports point-level manipulation */ #endif /* __NO_OLD_CONFIG */ /* * The following structure provides information about the selection and the * insertion cursor. It is needed by only a few items, such as those that * display text. It is shared by the generic canvas code and the item-specific |
︙ | ︙ | |||
1202 1203 1204 1205 1206 1207 1208 | int selBorderWidth; /* Width of border around selection. Read-only * to items. */ XColor *selFgColorPtr; /* Foreground color for selected text. * Read-only to items. */ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means * selection isn't in this canvas. Writable by * items. */ | < | | < < < < | < < < | 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 | int selBorderWidth; /* Width of border around selection. Read-only * to items. */ XColor *selFgColorPtr; /* Foreground color for selected text. * Read-only to items. */ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means * selection isn't in this canvas. Writable by * items. */ Tcl_Size selectFirst; /* Character index of first selected * character. Writable by items. */ Tcl_Size selectLast; /* Character index of last selected character. * Writable by items. */ Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": not * necessarily selItemPtr. Read-only to * items. */ Tcl_Size selectAnchor; /* Character index of fixed end of selection * (i.e. "select to" operation will use this * as one end of the selection). Writable by * items. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. Read-only to items. */ int insertWidth; /* Total width of insertion cursor. Read-only * to items. */ int insertBorderWidth; /* Width of 3-D border around insert cursor. * Read-only to items. */ Tk_Item *focusItemPtr; /* Item that currently has the input focus, or |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | * * Procedure prototypes and structures used for managing images: * *---------------------------------------------------------------------- */ typedef struct Tk_ImageType Tk_ImageType; | < | < < < < | < | | | | | | | 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 | * * Procedure prototypes and structures used for managing images: * *---------------------------------------------------------------------- */ typedef struct Tk_ImageType Tk_ImageType; typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); typedef void *(Tk_ImageGetProc) (Tk_Window tkwin, void *clientData); typedef void (Tk_ImageDisplayProc) (void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); typedef void (Tk_ImageFreeProc) (void *clientData, Display *display); typedef void (Tk_ImageDeleteProc) (void *clientData); typedef void (Tk_ImageChangedProc) (void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); typedef int (Tk_ImagePostscriptProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); /* * The following structure represents a particular type of image (bitmap, xpm * image, etc.). It provides information common to all images of that type, * such as the type name and a collection of procedures in the image manager |
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 | /* * Procedure prototypes and structures used in reading and writing photo * images: */ typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat; | < < < < < < < < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Procedure prototypes and structures used in reading and writing photo * images: */ typedef struct Tk_PhotoImageFormat Tk_PhotoImageFormat; typedef int (Tk_ImageFileMatchProc) (Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); typedef int (Tk_ImageStringMatchProc) (Tcl_Obj *dataObj, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); typedef int (Tk_ImageFileReadProc) (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); typedef int (Tk_ImageStringReadProc) (Tcl_Interp *interp, Tcl_Obj *dataObj, 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); /* * 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: * *---------------------------------------------------------------------- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * 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: * *---------------------------------------------------------------------- |
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | #define TK_STYLE_VERSION TK_STYLE_VERSION_1 /* * The following structures and prototypes are used as static templates to * declare widget elements. */ | | | | | | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | #define TK_STYLE_VERSION TK_STYLE_VERSION_1 /* * The following structures and prototypes are used as static templates to * declare widget elements. */ typedef void (Tk_GetElementSizeProc) (void *clientData, char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); typedef void (Tk_GetElementBoxProc) (void *clientData, char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); typedef int (Tk_GetElementBorderWidthProc) (void *clientData, char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin); typedef void (Tk_DrawElementProc) (void *clientData, char *recordPtr, const Tk_OptionSpec **optionsPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); typedef struct Tk_ElementOptionSpec { char *name; /* Name of the required option. */ Tk_OptionType type; /* Accepted option type. TK_OPTION_END means * any. */ |
︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | #define TK_ELEMENT_STATE_FOCUS 1<<2 #define TK_ELEMENT_STATE_PRESSED 1<<3 /* *---------------------------------------------------------------------- * * The definitions below provide backward compatibility for functions and | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | #define TK_ELEMENT_STATE_FOCUS 1<<2 #define TK_ELEMENT_STATE_PRESSED 1<<3 /* *---------------------------------------------------------------------- * * The definitions below provide backward compatibility for functions and * types that used to be in Tk but have moved to Tcl. * *---------------------------------------------------------------------- */ /* Removed Tk_Main, use macro instead */ #if defined(_WIN32) || defined(__CYGWIN__) #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) #else #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) #endif const char * Tk_InitStubs(Tcl_Interp *interp, const char *version, int exact); EXTERN const char * Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact); #ifndef USE_TK_STUBS #define Tk_InitStubs(interp, version, exact) \ Tk_PkgInitStubsCheck(interp, version, exact) #endif /* USE_TK_STUBS */ /* *---------------------------------------------------------------------- * * Additional procedure types defined by Tk. * *---------------------------------------------------------------------- */ typedef int (Tk_ErrorProc) (void *clientData, XErrorEvent *errEventPtr); typedef void (Tk_EventProc) (void *clientData, XEvent *eventPtr); typedef int (Tk_GenericProc) (void *clientData, XEvent *eventPtr); typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); typedef int (Tk_GetSelProc) (void *clientData, Tcl_Interp *interp, const char *portion); typedef void (Tk_LostSelProc) (void *clientData); typedef Tk_RestrictAction (Tk_RestrictProc) (void *clientData, XEvent *eventPtr); typedef Tcl_Size (Tk_SelectionProc) (void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); /* *---------------------------------------------------------------------- * * Platform independent exported procedures and variables. * *---------------------------------------------------------------------- */ #include "tkDecls.h" #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* RC_INVOKED */ /* * end block for C++ |
︙ | ︙ |
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: */ |
︙ | ︙ | |||
42 43 44 45 46 47 48 | * The following structure defines the implementation of the "border" Tcl * object, used for drawing. The border object remembers the hash table entry * associated with a border. The actual allocation and deallocation of the * border should be done by the configuration package when the border option * is set. */ | | | | > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | * The following structure defines the implementation of the "border" Tcl * object, used for drawing. The border object remembers the hash table entry * associated with a border. The actual allocation and deallocation of the * border should be done by the configuration package when the border option * is set. */ const TkObjType tkBorderObjType = { {"border", /* name */ FreeBorderObjProc, /* freeIntRepProc */ DupBorderObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *---------------------------------------------------------------------- * * Tk_Alloc3DBorderFromObj -- * |
︙ | ︙ | |||
83 84 85 86 87 88 89 | Tcl_Interp *interp, /* Interp for error results. */ Tk_Window tkwin, /* Need the screen the border is used on.*/ Tcl_Obj *objPtr) /* Object giving name of color for window * background. */ { TkBorder *borderPtr; | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | Tcl_Interp *interp, /* Interp for error results. */ Tk_Window tkwin, /* Need the screen the border is used on.*/ Tcl_Obj *objPtr) /* Object giving name of color for window * background. */ { TkBorder *borderPtr; if (objPtr->typePtr != &tkBorderObjType.objType) { InitBorderObj(objPtr); } borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBorder, see if it's the one we * want. If so, increment its reference count and return. |
︙ | ︙ | |||
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. */ { | | | < > | | < | | | > | | > | | > | > | | | | > > > > | 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 | 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 -- * * Parse a relief description and return the corresponding relief value, * or an error. * * Results: * A standard Tcl return value. If all goes well then *reliefPtr is * filled in with one of the values TK_RELIEF_* * * Side effects: * None. * *---------------------------------------------------------------------- */ int Tk_GetRelief( Tcl_Interp *interp, /* For error messages. */ const char *name, /* Name of a relief type. */ int *reliefPtr) /* Where to store converted relief. */ { char c; size_t length; int relief; c = name[0]; length = strlen(name); if ((c == 'f') && (strncmp(name, "flat", length) == 0)) { relief = TK_RELIEF_FLAT; } else if ((c == 'g') && (strncmp(name, "groove", length) == 0)) { relief = TK_RELIEF_GROOVE; } else if ((c == 'r') && (strncmp(name, "raised", length) == 0) && (length >= 2)) { relief = TK_RELIEF_RAISED; } else if ((c == 'r') && (strncmp(name, "ridge", length) == 0) && (length >= 2)) { relief = TK_RELIEF_RIDGE; } else if ((c == 's') && (strncmp(name, "solid", length) == 0) && (length >= 2)) { relief = TK_RELIEF_SOLID; } else if ((c == 's') && (strncmp(name, "sunken", length) == 0) && (length >= 2)) { relief = TK_RELIEF_SUNKEN; } else { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad relief \"%.50s\": must be %s", name, "flat, groove, raised, ridge, solid, or sunken")); Tcl_SetErrorCode(interp, "TK", "VALUE", "RELIEF", NULL); } return TCL_ERROR; } if (reliefPtr) { *reliefPtr = relief; } return TCL_OK; } /* *-------------------------------------------------------------- * * Tk_NameOfRelief -- |
︙ | ︙ | |||
744 745 746 747 748 749 750 | Tk_Draw3DPolygon( Tk_Window tkwin, /* Window for which border was allocated. */ Drawable drawable, /* X window or pixmap in which to draw. */ Tk_3DBorder border, /* Token for border to draw. */ XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ | | > | | 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 | Tk_Draw3DPolygon( Tk_Window tkwin, /* Window for which border was allocated. */ Drawable drawable, /* X window or pixmap in which to draw. */ Tk_3DBorder border, /* Token for border to draw. */ XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ Tcl_Size numPoints, /* Number of points at *pointPtr. */ int borderWidth, /* Width of border, measured in pixels to the * left of the polygon's trajectory. May be * negative. */ int leftRelief) /* TK_RELIEF_RAISED or TK_RELIEF_SUNKEN: * indicates how stuff to left of trajectory * looks relative to stuff on right. */ { XPoint poly[4], b1, b2, newB1, newB2; XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */ XPoint *p1Ptr, *p2Ptr; TkBorder *borderPtr = (TkBorder *) border; GC gc; Tcl_Size i; int lightOnLeft, dx, dy, parallel, pointsSeen; Display *display = Tk_Display(tkwin); if (borderPtr->lightGC == NULL) { TkpGetShadows(borderPtr, tkwin); } /* |
︙ | ︙ | |||
830 831 832 833 834 835 836 | * so some parts of the processing are ommitted for these points. The * variable "pointsSeen" keeps track of the priming process; it has to be * separate from i in order to be able to ignore duplicate points in the * polygon. */ pointsSeen = 0; | | | | | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | * so some parts of the processing are ommitted for these points. The * variable "pointsSeen" keeps track of the priming process; it has to be * separate from i in order to be able to ignore duplicate points in the * polygon. */ pointsSeen = 0; for (i = 0, p1Ptr = &pointPtr[numPoints-2], p2Ptr = p1Ptr+1; i < numPoints + 2; i++, p1Ptr = p2Ptr, p2Ptr++) { if ((i == 1) || (i == numPoints + 1)) { p2Ptr = pointPtr; } if ((p2Ptr->x == p1Ptr->x) && (p2Ptr->y == p1Ptr->y)) { /* * Ignore duplicate points (they'd cause core dumps in ShiftLine * calls below). */ |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | Tk_Fill3DPolygon( Tk_Window tkwin, /* Window for which border was allocated. */ Drawable drawable, /* X window or pixmap in which to draw. */ Tk_3DBorder border, /* Token for border to draw. */ XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ | | | | 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 | Tk_Fill3DPolygon( Tk_Window tkwin, /* Window for which border was allocated. */ Drawable drawable, /* X window or pixmap in which to draw. */ Tk_3DBorder border, /* Token for border to draw. */ XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ Tcl_Size numPoints, /* Number of points at *pointPtr. */ int borderWidth, /* Width of border, measured in pixels to the * left of the polygon's trajectory. May be * negative. */ int leftRelief) /* Indicates 3D effect of left side of * trajectory relative to right: * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or * TK_RELIEF_SUNKEN. */ { TkBorder *borderPtr = (TkBorder *) border; XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC, pointPtr, (int)numPoints, Complex, CoordModeOrigin); if (leftRelief != TK_RELIEF_FLAT) { Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints, borderWidth, leftRelief); } } /* |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | Tcl_Obj *objPtr) /* The object whose string value selects a * border. */ { TkBorder *borderPtr = NULL; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | Tcl_Obj *objPtr) /* The object whose string value selects a * border. */ { TkBorder *borderPtr = NULL; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objPtr->typePtr != &tkBorderObjType.objType) { InitBorderObj(objPtr); } /* * If we are lucky (and the user doesn't use too many different displays, * screens, or colormaps...) then the TkBorder structure we need will be * cached in the internal representation of the Tcl_Obj. Check it out... |
︙ | ︙ | |||
1330 1331 1332 1333 1334 1335 1336 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } | | | 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkBorderObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; } /* *---------------------------------------------------------------------- * * TkDebugBorder -- |
︙ | ︙ | |||
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: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 |
︙ | ︙ | |||
24 25 26 27 28 29 30 | Screen *screen; /* Screen on which the border will be used. */ Visual *visual; /* Visual for all windows and pixmaps using * the border. */ int depth; /* Number of bits per pixel of drawables where * the border will be used. */ Colormap colormap; /* Colormap out of which pixels are * allocated. */ | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | Screen *screen; /* Screen on which the border will be used. */ Visual *visual; /* Visual for all windows and pixmaps using * the border. */ int depth; /* Number of bits per pixel of drawables where * the border will be used. */ Colormap colormap; /* Colormap out of which pixels are * allocated. */ Tcl_Size resourceRefCount; /* Number of active uses of this color (each * active use corresponds to a call to * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder). * If this count is 0, then this structure is * no longer valid and it isn't present in * borderTable: it is being kept around only * because there are objects referring to it. * The structure is freed when objRefCount and * resourceRefCount are both 0. */ Tcl_Size objRefCount; /* The number of Tcl objects that reference * this structure. */ XColor *bgColorPtr; /* Background color (intensity between * lightColorPtr and darkColorPtr). */ XColor *darkColorPtr; /* Color for darker areas (must free when * deleting structure). NULL means shadows * haven't been allocated yet.*/ XColor *lightColorPtr; /* Color used for lighter areas of border |
︙ | ︙ |
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" |
︙ | ︙ | |||
79 80 81 82 83 84 85 | int srcIndex; /* Location from which to read next argument * from argv. */ int dstIndex; /* Index into argv to which next unused * argument should be copied (never greater * than srcIndex). */ int argc; /* # arguments in argv still to process. */ size_t length; /* Number of characters in current argument. */ | < | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | int srcIndex; /* Location from which to read next argument * from argv. */ int dstIndex; /* Index into argv to which next unused * argument should be copied (never greater * than srcIndex). */ int argc; /* # arguments in argv still to process. */ size_t length; /* Number of characters in current argument. */ int i; if (flags & TK_ARGV_DONT_SKIP_FIRST_ARG) { srcIndex = dstIndex = 0; argc = *argcPtr; } else { srcIndex = dstIndex = 1; |
︙ | ︙ | |||
102 103 104 105 106 107 108 | if (length > 0) { c = curArg[1]; } else { c = 0; } /* | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | if (length > 0) { c = curArg[1]; } else { c = 0; } /* * Loop through the argument descriptors searching for one with the * matching key string. If found, leave a pointer to it in matchPtr. */ matchPtr = NULL; for (i = 0; i < 2; i++) { if (i == 0) { infoPtr = argTable; |
︙ | ︙ | |||
171 172 173 174 175 176 177 | * Take the appropriate action based on the option type */ gotMatch: infoPtr = matchPtr; switch (infoPtr->type) { case TK_ARGV_CONSTANT: | | | < < < < < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | * Take the appropriate action based on the option type */ gotMatch: infoPtr = matchPtr; switch (infoPtr->type) { case TK_ARGV_CONSTANT: *((int *) infoPtr->dst) = (int)PTR2INT(infoPtr->src); break; case TK_ARGV_INT: if (argc == 0) { goto missingArg; } if (Tcl_GetInt(interp, argv[srcIndex], (int *) infoPtr->dst) != TCL_OK) { return TCL_ERROR; } srcIndex++; argc--; break; case TK_ARGV_STRING: if (argc == 0) { |
︙ | ︙ | |||
211 212 213 214 215 216 217 | case TK_ARGV_REST: *((int *) infoPtr->dst) = dstIndex; goto argsDone; case TK_ARGV_FLOAT: if (argc == 0) { goto missingArg; } | | < < < < < | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | case TK_ARGV_REST: *((int *) infoPtr->dst) = dstIndex; goto argsDone; case TK_ARGV_FLOAT: if (argc == 0) { goto missingArg; } if (Tcl_GetDouble(interp, argv[srcIndex], ((double *) infoPtr->dst)) != TCL_OK) { return TCL_ERROR; } srcIndex++; argc--; break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); |
︙ | ︙ | |||
359 360 361 362 363 364 365 | length = strlen(infoPtr->key); if (length > width) { width = length; } } } | | | | 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 | length = strlen(infoPtr->key); if (length > width) { width = length; } } } message = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE); for (i = 0; ; i++) { for (infoPtr = i ? defaultTable : argTable; infoPtr->type != TK_ARGV_END; infoPtr++) { if ((infoPtr->type == TK_ARGV_HELP) && (infoPtr->key == NULL)) { Tcl_AppendPrintfToObj(message, "\n%s", infoPtr->help); continue; } Tcl_AppendPrintfToObj(message, "\n %s:", infoPtr->key); numSpaces = width + 1 - strlen(infoPtr->key); while (numSpaces-- > 0) { Tcl_AppendToObj(message, " ", 1); } Tcl_AppendToObj(message, infoPtr->help, TCL_INDEX_NONE); switch (infoPtr->type) { case TK_ARGV_INT: Tcl_AppendPrintfToObj(message, "\n\t\tDefault value: %d", *((int *) infoPtr->dst)); break; case TK_ARGV_FLOAT: Tcl_AppendPrintfToObj(message, "\n\t\tDefault value: %f", |
︙ | ︙ | |||
399 400 401 402 403 404 405 | break; } } if ((flags & TK_ARGV_NO_DEFAULTS) || (i > 0)) { break; } | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | break; } } if ((flags & TK_ARGV_NO_DEFAULTS) || (i > 0)) { break; } Tcl_AppendToObj(message, "\nGeneric options for all commands:", TCL_INDEX_NONE); } Tcl_SetObjResult(interp, message); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
27 28 29 30 31 32 33 | #ifdef NDEBUG # define DEBUG(expr) #else # define DEBUG(expr) expr #endif | < < < < < < < < | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #ifdef NDEBUG # define DEBUG(expr) #else # define DEBUG(expr) expr #endif #define SIZE_OF_ARRAY(arr) (sizeof(arr)/sizeof(arr[0])) /* * File structure: * * Structure definitions and static variables. * |
︙ | ︙ | |||
139 140 141 142 143 144 145 | struct PatSeq; /* forward declaration */ /* We need this array for bookkeeping the last matching modifier mask per pattern. */ TK_ARRAY_DEFINE(PSModMaskArr, unsigned); typedef struct PSEntry { | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | struct PatSeq; /* forward declaration */ /* We need this array for bookkeeping the last matching modifier mask per pattern. */ TK_ARRAY_DEFINE(PSModMaskArr, unsigned); typedef struct PSEntry { TK_DLIST_LINKS(PSEntry); /* Makes this struct a doubly linked list; must be first entry. */ Window window; /* Window of last match. */ struct PatSeq* psPtr; /* Pointer to pattern sequence. */ PSModMaskArr *lastModMaskArr; /* Last matching modifier mask per pattern (except last pattern). * Only needed if pattern sequence is not single (more than one * pattern), and if one of these patterns contains a non-zero * modifier mask. */ |
︙ | ︙ | |||
184 185 186 187 188 189 190 | * binding tables may exist at once, either because there are multiple * applications open, or because there are multiple domains within an * application with separate event bindings for each (for example, each canvas * widget has a separate binding table for associating events with the items * in the canvas). */ | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | * binding tables may exist at once, either because there are multiple * applications open, or because there are multiple domains within an * application with separate event bindings for each (for example, each canvas * widget has a separate binding table for associating events with the items * in the canvas). */ /* Defining the whole PromArr_* stuff (array of PSList entries) */ TK_ARRAY_DEFINE(PromArr, PSList); typedef struct Tk_BindingTable_ { Event eventInfo[TK_LASTEVENT]; /* Containing the most recent event for every event type. */ PromArr *promArr; /* Contains the promoted pattern sequences. */ Event *curEvent; /* Pointing to most recent event. */ |
︙ | ︙ | |||
235 236 237 238 239 240 241 | * * The same key is used for both types of pattern tables so that the helper * functions that traverse and match patterns will work for both binding * tables and virtual event tables. */ typedef struct { | | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | * * The same key is used for both types of pattern tables so that the helper * functions that traverse and match patterns will work for both binding * tables and virtual event tables. */ typedef struct { void *object; /* For binding table, identifies the binding tag of the object * (or class of objects) relative to which the event occurred. * For virtual event table, always NULL. */ unsigned type; /* Type of event (from X). */ Detail detail; /* Additional information, such as keysym, button, Tk_Uid, or zero * if nothing additional. */ } PatternTableKey; |
︙ | ︙ | |||
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 | | | 320 321 322 323 324 325 326 327 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 * 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 |
︙ | ︙ | |||
415 416 417 418 419 420 421 | /* * Flags for ModInfo structures: * * DOUBLE - Non-zero means duplicate this event, e.g. for double-clicks. * TRIPLE - Non-zero means triplicate this event, e.g. for triple-clicks. * QUADRUPLE - Non-zero means quadruple this event, e.g. for 4-fold-clicks. | | > > | 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 | /* * Flags for ModInfo structures: * * DOUBLE - Non-zero means duplicate this event, e.g. for double-clicks. * TRIPLE - Non-zero means triplicate this event, e.g. for triple-clicks. * QUADRUPLE - Non-zero means quadruple this event, e.g. for 4-fold-clicks. * MULT_CLICKS - Combination of all the above. */ #define DOUBLE (1<<0) #define TRIPLE (1<<1) #define QUADRUPLE (1<<2) #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 */ | > > > > > > > > > > > > | 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 | {"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 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | * 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}, {"Visibility", VisibilityNotify, VisibilityChangeMask}, {"Destroy", DestroyNotify, StructureNotifyMask}, {"Unmap", UnmapNotify, StructureNotifyMask}, {"Map", MapNotify, StructureNotifyMask}, {"Reparent", ReparentNotify, StructureNotifyMask}, {"Configure", ConfigureNotify, StructureNotifyMask}, {"Gravity", GravityNotify, StructureNotifyMask}, {"Circulate", CirculateNotify, StructureNotifyMask}, {"Property", PropertyNotify, PropertyChangeMask}, {"Colormap", ColormapNotify, ColormapChangeMask}, {"Activate", ActivateNotify, ActivateMask}, {"Deactivate", DeactivateNotify, ActivateMask}, {"MouseWheel", MouseWheelEvent, MouseWheelMask}, {"CirculateRequest", CirculateRequest, SubstructureRedirectMask}, {"ConfigureRequest", ConfigureRequest, SubstructureRedirectMask}, {"Create", CreateNotify, SubstructureNotifyMask}, {"MapRequest", MapRequest, SubstructureRedirectMask}, {"ResizeRequest", ResizeRequest, ResizeRedirectMask}, {NULL, 0, 0} }; | > > > > > | 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 | * 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}, {"Visibility", VisibilityNotify, VisibilityChangeMask}, {"Destroy", DestroyNotify, StructureNotifyMask}, {"Unmap", UnmapNotify, StructureNotifyMask}, {"Map", MapNotify, StructureNotifyMask}, {"Reparent", ReparentNotify, StructureNotifyMask}, {"Configure", ConfigureNotify, StructureNotifyMask}, {"Gravity", GravityNotify, StructureNotifyMask}, {"Circulate", CirculateNotify, StructureNotifyMask}, {"Property", PropertyNotify, PropertyChangeMask}, {"Colormap", ColormapNotify, ColormapChangeMask}, {"Activate", ActivateNotify, ActivateMask}, {"Deactivate", DeactivateNotify, ActivateMask}, {"MouseWheel", MouseWheelEvent, MouseWheelMask}, {"TouchpadScroll", TouchpadScroll, TouchpadScrollMask}, {"CirculateRequest", CirculateRequest, SubstructureRedirectMask}, {"ConfigureRequest", ConfigureRequest, SubstructureRedirectMask}, {"Create", CreateNotify, SubstructureNotifyMask}, {"MapRequest", MapRequest, SubstructureRedirectMask}, {"ResizeRequest", ResizeRequest, ResizeRedirectMask}, {NULL, 0, 0} }; |
︙ | ︙ | |||
560 561 562 563 564 565 566 | #define MAPREQ (1<<20) #define CONFIGREQ (1<<21) #define RESIZEREQ (1<<22) #define CIRCREQ (1<<23) /* * These structs agree with xkey for the fields type, serial, send_event, display, | | | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | #define MAPREQ (1<<20) #define CONFIGREQ (1<<21) #define RESIZEREQ (1<<22) #define CIRCREQ (1<<23) /* * These structs agree with xkey for the fields type, serial, send_event, display, * window, root, subwindow, time, x, y, x_root, and y_root. So when accessing * these fields we may pretend that we are using a struct xkey. */ #define HAS_XKEY_HEAD (KEY|BUTTON|MOTION|VIRTUAL|CROSSING|WHEEL) /* * The xcrossing struct puts the state field in a different location, but the other |
︙ | ︙ | |||
618 619 620 621 622 623 624 | /* SelectionNotify */ 0, /* ColormapNotify */ COLORMAP, /* ClientMessage */ 0, /* MappingNotify */ 0, /* VirtualEvent */ VIRTUAL, /* Activate */ ACTIVATE, /* Deactivate */ ACTIVATE, | | > | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | /* SelectionNotify */ 0, /* ColormapNotify */ COLORMAP, /* ClientMessage */ 0, /* MappingNotify */ 0, /* VirtualEvent */ VIRTUAL, /* Activate */ ACTIVATE, /* Deactivate */ ACTIVATE, /* MouseWheel */ WHEEL, /* TouchpadScroll */ WHEEL }; /* * The following table is used to map between the location where an generated * event should be queued and the string used to specify the location. */ |
︙ | ︙ | |||
709 710 711 712 713 714 715 | char *virtString, const char *eventString); static int DeleteVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, char *virtString, const char *eventString); static void DeleteVirtualEventTable(VirtualEventTable *vetPtr); static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPtr, unsigned scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables, | | | | | | | | | | | | 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 | char *virtString, const char *eventString); static int DeleteVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, char *virtString, const char *eventString); static void DeleteVirtualEventTable(VirtualEventTable *vetPtr); static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPtr, unsigned scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables, void *object, const char *eventString, int create, int allowVirtual, unsigned *maskPtr); static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr); static const char * GetField(const char *p, char *copy, unsigned size); static Tcl_Obj * GetPatternObj(const PatSeq *psPtr); static int GetVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, Tcl_Obj *virtName); static Tk_Uid GetVirtualEventUid(Tcl_Interp *interp, char *virtString); static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main, Tcl_Size objc, Tcl_Obj *const objv[]); static void InitVirtualEventTable(VirtualEventTable *vetPtr); static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSList *psList, PSList *psSuccList, unsigned patIndex, const Event *eventPtr, void *object, PatSeq **physPtrPtr); static int NameToWindow(Tcl_Interp *interp, Tk_Window main, Tcl_Obj *objPtr, Tk_Window *tkwinPtr); static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, TkPattern *patPtr, unsigned *eventMaskPtr); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents); static void ClearLookupTable(LookupTables *lookupTables, void *object); static void ClearPromotionLists(Tk_BindingTable bindPtr, void *object); static PSEntry * MakeListEntry(PSList *pool, PatSeq *psPtr, int needModMasks); static void RemovePatSeqFromLookup(LookupTables *lookupTables, PatSeq *psPtr); static void RemovePatSeqFromPromotionLists(Tk_BindingTable bindPtr, PatSeq *psPtr); static PatSeq * DeletePatSeq(PatSeq *psPtr); static void InsertPatSeq(LookupTables *lookupTables, PatSeq *psPtr); #if SUPPORT_DEBUGGING 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 Tcl_Size Max(Tcl_Size a, Tcl_Size 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; } static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_PIXELS; } static int IsSubsetOf( unsigned lhsMask, /* Is this a subset... */ unsigned rhsMask) /* ...of this bit field? */ { return (lhsMask & rhsMask) == lhsMask; } static const char* SkipSpaces( const char* s) |
︙ | ︙ | |||
790 791 792 793 794 795 796 | static unsigned GetButtonNumber( const char *field) { unsigned button; assert(field); | | > | 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | static unsigned GetButtonNumber( const char *field) { unsigned button; assert(field); button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? (unsigned)(field[0] - '0') : 0; 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, |
︙ | ︙ | |||
846 847 848 849 850 851 852 | for (i = 0; i < sndMatchPtr->numPats; ++i) { if (GetInfo(sndMatchPtr, i)) { sndCount += GetCount(sndMatchPtr, i); } } return sndCount - fstCount; } | | | | | | | | | 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 | for (i = 0; i < sndMatchPtr->numPats; ++i) { if (GetInfo(sndMatchPtr, i)) { sndCount += GetCount(sndMatchPtr, i); } } return sndCount - fstCount; } static int IsKeyEventType( int eventType) { return eventType == KeyPress || eventType == KeyRelease; } static int IsButtonEventType( unsigned eventType) { return eventType == ButtonPress || eventType == ButtonRelease; } static int MatchEventNearby( const XEvent *lhs, /* Previous button event */ const XEvent *rhs) /* Current button event */ { assert(lhs); assert(rhs); assert(IsButtonEventType(lhs->type)); assert(lhs->type == rhs->type); /* assert: lhs->xbutton.time <= rhs->xbutton.time */ return TestNearbyTime(rhs->xbutton.time, lhs->xbutton.time) && TestNearbyCoords(rhs->xbutton.x_root, lhs->xbutton.x_root) && TestNearbyCoords(rhs->xbutton.y_root, lhs->xbutton.y_root); } static int MatchEventRepeat( const XKeyEvent *lhs, /* Previous key event */ const XKeyEvent *rhs) /* Current key event */ { assert(lhs); assert(rhs); assert(IsKeyEventType(lhs->type)); assert(lhs->type == rhs->type); /* assert: lhs->time <= rhs->time */ |
︙ | ︙ | |||
925 926 927 928 929 930 931 | PSList_Append(pool, psEntry); } static void ClearList( PSList *psList, PSList *pool, | | | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | PSList_Append(pool, psEntry); } static void ClearList( PSList *psList, PSList *pool, void *object) { assert(psList); assert(pool); if (object) { PSEntry *psEntry; PSEntry *psNext; |
︙ | ︙ | |||
1109 1110 1111 1112 1113 1114 1115 | { PatternTableKey key; Tcl_HashEntry *hPtr; assert(lookupTables); assert(eventPtr); | | | 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | { PatternTableKey key; Tcl_HashEntry *hPtr; assert(lookupTables); assert(eventPtr); /* Otherwise on some systems the key contains uninitialized bytes. */ memset(&key, 0, sizeof(PatternTableKey)); if (onlyConsiderDetailedEvents) { switch (eventPtr->xev.type) { case ButtonPress: /* fallthru */ case ButtonRelease: key.detail.info = eventPtr->xev.xbutton.button; break; case MotionNotify: key.detail.info = ButtonNumberFromState(eventPtr->xev.xmotion.state); break; |
︙ | ︙ | |||
1153 1154 1155 1156 1157 1158 1159 | * None. * *-------------------------------------------------------------- */ static void ClearLookupTable( LookupTables *lookupTables, | | | 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | * None. * *-------------------------------------------------------------- */ static void ClearLookupTable( LookupTables *lookupTables, void *object) { Tcl_HashSearch search; Tcl_HashEntry *hPtr; Tcl_HashEntry *nextPtr; PSList *pool = &lookupTables->entryPool; assert(lookupTables); |
︙ | ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | * *-------------------------------------------------------------- */ static void ClearPromotionLists( Tk_BindingTable bindPtr, | | | < | 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | * *-------------------------------------------------------------- */ static void ClearPromotionLists( Tk_BindingTable bindPtr, void *object) { size_t i, newArraySize = 0; assert(bindPtr); for (i = 0; i < PromArr_Size(bindPtr->promArr); ++i) { PSList *psList = PromArr_Get(bindPtr->promArr, i); ClearList(psList, &bindPtr->lookupTables.entryPool, object); if (!PSList_IsEmpty(psList)) { |
︙ | ︙ | |||
1240 1241 1242 1243 1244 1245 1246 | * Side effects: * Memory allocated. * *--------------------------------------------------------------------------- */ /* | | | | | | | | | | | 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 | * Side effects: * Memory allocated. * *--------------------------------------------------------------------------- */ /* * Windows compiler does not allow the definition of these static variables inside a function, * otherwise this should belong to function TkBindInit(). */ TCL_DECLARE_MUTEX(bindMutex); static int initialized = 0; void TkBindInit( TkMainInfo *mainPtr) /* The newly created application. */ { BindInfo *bindInfoPtr; assert(mainPtr); /* Otherwise virtual events can't be supported. */ assert(sizeof(XEvent) >= sizeof(XVirtualEvent)); /* Is type of TkPattern.info well defined? */ assert(sizeof(Info) >= sizeof(KeySym)); assert(sizeof(Info) >= sizeof(unsigned)); /* Ensure that our matching algorithm is working (when testing detail). */ assert(sizeof(Detail) == sizeof(Tk_Uid)); /* Test expected indices of Button1..Button5, otherwise our button handling is not working. */ assert(Button1 == 1 && Button2 == 2 && Button3 == 3 && Button4 == 4 && Button5 == 5); assert(Button2Mask == (Button1Mask << 1)); assert(Button3Mask == (Button1Mask << 2)); assert(Button4Mask == (Button1Mask << 3)); assert(Button5Mask == (Button1Mask << 4)); /* Test expected values of button motion masks, otherwise our button handling is not working. */ assert(Button1MotionMask == Button1Mask); assert(Button2MotionMask == Button2Mask); assert(Button3MotionMask == Button3Mask); assert(Button4MotionMask == Button4Mask); assert(Button5MotionMask == Button5Mask); /* Because we expect zero if keySym is empty. */ assert(NoSymbol == 0L); /* This must be a union, not a struct, otherwise comparison with NULL will not work. */ assert(offsetof(Detail, name) == offsetof(Detail, info)); /* We use some constraints about X*Event. */ assert(offsetof(XButtonEvent, time) == offsetof(XMotionEvent, time)); assert(offsetof(XButtonEvent, x_root) == offsetof(XMotionEvent, x_root)); assert(offsetof(XButtonEvent, y_root) == offsetof(XMotionEvent, y_root)); assert(offsetof(XCreateWindowEvent, border_width) == offsetof(XConfigureEvent, border_width)); assert(offsetof(XCreateWindowEvent, width) == offsetof(XConfigureEvent, width)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XCirculateRequestEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XConfigureEvent, window)); |
︙ | ︙ | |||
1628 1629 1630 1631 1632 1633 1634 | *-------------------------------------------------------------- */ unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ | | | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | *-------------------------------------------------------------- */ unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ void *object, /* Token for object with which binding is associated. */ const char *eventString, /* String describing event sequence that triggers binding. */ const char *script, /* Contains Tcl script to execute when binding triggers. */ int append) /* 0 means replace any existing binding for eventString; * 1 means append to that binding. If the existing binding is * for a callback function and not a Tcl command string, the * existing binding will always be replaced. */ { |
︙ | ︙ | |||
1727 1728 1729 1730 1731 1732 1733 | *-------------------------------------------------------------- */ int Tk_DeleteBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to delete binding. */ | | | 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | *-------------------------------------------------------------- */ int Tk_DeleteBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to delete binding. */ void *object, /* Token for object with which binding is associated. */ const char *eventString) /* String describing event sequence that triggers binding. */ { PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); |
︙ | ︙ | |||
1800 1801 1802 1803 1804 1805 1806 | *-------------------------------------------------------------- */ const char * Tk_GetBinding( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to look for binding. */ | | | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | *-------------------------------------------------------------- */ const char * Tk_GetBinding( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to look for binding. */ void *object, /* Token for object with which binding is associated. */ const char *eventString) /* String describing event sequence that triggers binding. */ { const PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); |
︙ | ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | *-------------------------------------------------------------- */ void Tk_GetAllBindings( Tcl_Interp *interp, /* Interpreter returning result or error. */ Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ | | | 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 | *-------------------------------------------------------------- */ void Tk_GetAllBindings( Tcl_Interp *interp, /* Interpreter returning result or error. */ Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ void *object) /* Token for object. */ { Tcl_HashEntry *hPtr; assert(bindPtr); assert(object); if ((hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object))) { |
︙ | ︙ | |||
1929 1930 1931 1932 1933 1934 1935 | */ static void RemovePatSeqFromPromotionLists( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr) /* Remove this pattern sequence. */ { | | | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | */ static void RemovePatSeqFromPromotionLists( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr) /* Remove this pattern sequence. */ { size_t i; assert(bindPtr); assert(psPtr); for (i = 0; i < PromArr_Size(bindPtr->promArr); ++i) { PSList *psList = PromArr_Get(bindPtr->promArr, i); PSEntry *psEntry; |
︙ | ︙ | |||
2027 2028 2029 2030 2031 2032 2033 | * *-------------------------------------------------------------- */ void Tk_DeleteAllBindings( Tk_BindingTable bindPtr, /* Table in which to delete bindings. */ | | | 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 | * *-------------------------------------------------------------- */ void Tk_DeleteAllBindings( Tk_BindingTable bindPtr, /* Table in which to delete bindings. */ void *object) /* Token for object. */ { PatSeq *psPtr; PatSeq *nextPtr; Tcl_HashEntry *hPtr; assert(bindPtr); assert(object); |
︙ | ︙ | |||
2154 2155 2156 2157 2158 2159 2160 | void Tk_BindEvent( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ XEvent *eventPtr, /* What actually happened. */ Tk_Window tkwin, /* Window on display where event occurred (needed in order to * locate display information). */ | | | | | | 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 | void Tk_BindEvent( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ XEvent *eventPtr, /* What actually happened. */ Tk_Window tkwin, /* Window on display where event occurred (needed in order to * locate display information). */ Tcl_Size numObjects, /* Number of objects at *objArr. */ void **objArr) /* Array of one or more objects to check for a matching binding. */ { Tcl_Interp *interp; ScreenInfo *screenPtr; TkDisplay *dispPtr; TkDisplay *oldDispPtr; Event *curEvent; TkWindow *winPtr = (TkWindow *)tkwin; BindInfo *bindInfoPtr; Tcl_InterpState interpState; LookupTables *physTables; PatSeq *psPtr[2]; PatSeq *matchPtrBuf[32]; PatSeq **matchPtrArr = matchPtrBuf; PSList *psl[2]; Tcl_DString scripts; const char *p; const char *end; unsigned scriptCount; int oldScreen; unsigned flags; Tcl_Size arraySize; unsigned newArraySize; Tcl_Size i, k; assert(bindPtr); assert(eventPtr); assert(tkwin); assert(numObjects >= 0); /* |
︙ | ︙ | |||
2215 2216 2217 2218 2219 2220 2221 | } dispPtr = ((TkWindow *) tkwin)->dispPtr; bindInfoPtr = winPtr->mainPtr->bindInfo; curEvent = bindPtr->eventInfo + eventPtr->type; /* | < < < < < < < | > < < < < < < < < < | | | | | 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 | } dispPtr = ((TkWindow *) tkwin)->dispPtr; bindInfoPtr = winPtr->mainPtr->bindInfo; curEvent = bindPtr->eventInfo + eventPtr->type; /* * Compute current time needed for "event generate", * and reset counters for Key and Button events. */ switch (eventPtr->type) { case EnterNotify: case LeaveNotify: if (eventPtr->xcrossing.time) { bindInfoPtr->lastCurrentTime = CurrentTimeInMilliSecs(); bindInfoPtr->lastEventTime = eventPtr->xcrossing.time; } break; case KeyPress: case KeyRelease: { int reset = 1; if (eventPtr->xkey.time) { bindInfoPtr->lastCurrentTime = CurrentTimeInMilliSecs(); bindInfoPtr->lastEventTime = eventPtr->xkey.time; } /* Modifier keys should not influence button events. */ for (i = 0; i < dispPtr->numModKeyCodes; ++i) { if (dispPtr->modKeyCodes[i] == eventPtr->xkey.keycode) { reset = 0; } } if (reset) { /* Reset repetition count for button events. */ bindPtr->eventInfo[ButtonPress].countAny = 0; bindPtr->eventInfo[ButtonPress].countDetailed = 0; bindPtr->eventInfo[ButtonRelease].countAny = 0; bindPtr->eventInfo[ButtonRelease].countDetailed = 0; } break; } case ButtonPress: case ButtonRelease: /* Reset repetition count for key events. */ bindPtr->eventInfo[KeyPress].countAny = 0; bindPtr->eventInfo[KeyPress].countDetailed = 0; bindPtr->eventInfo[KeyRelease].countAny = 0; bindPtr->eventInfo[KeyRelease].countDetailed = 0; /* fallthru */ case MotionNotify: if (eventPtr->xmotion.time) { |
︙ | ︙ | |||
2371 2372 2373 2374 2375 2376 2377 | bindPtr->curEvent = curEvent; physTables = &bindPtr->lookupTables; scriptCount = 0; arraySize = 0; Tcl_DStringInit(&scripts); if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) { | | | | | | | | | 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 | bindPtr->curEvent = curEvent; physTables = &bindPtr->lookupTables; scriptCount = 0; arraySize = 0; Tcl_DStringInit(&scripts); if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) { /* It's unrealistic that the buffer size is too small, but who knows? */ matchPtrArr = (PatSeq **)ckalloc(numObjects*sizeof(matchPtrArr[0])); } memset(matchPtrArr, 0, numObjects*sizeof(matchPtrArr[0])); if (!PromArr_IsEmpty(bindPtr->promArr)) { for (k = 0; k < numObjects; ++k) { psl[1] = PromArr_Last(bindPtr->promArr); psl[0] = psl[1] - 1; /* * Loop over all promoted bindings, finding the longest matching one. * * Note that we must process all lists, because all matching patterns * have to be promoted. Normally at most one list will be processed, and * usually this list only contains one or two patterns. */ for (i = PromArr_Size(bindPtr->promArr); i > 0; --i, --psl[0], --psl[1]) { psPtr[0] = MatchPatterns(dispPtr, bindPtr, psl[0], psl[1], i, curEvent, objArr[k], NULL); if (IsBetterMatch(matchPtrArr[k], psPtr[0])) { /* We will process it later, because we still may find a pattern with better match. */ matchPtrArr[k] = psPtr[0]; } if (!PSList_IsEmpty(psl[1])) { /* We have promoted sequences, adjust array size. */ arraySize = Max(i + 1, arraySize); } } } } /* * 1. Look for bindings for the specific detail (button and key events). * 2. Look for bindings without detail. */ for (k = 0; k < numObjects; ++k) { PSList *psSuccList = PromArr_First(bindPtr->promArr); PatSeq *bestPtr; psl[0] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 1); psl[1] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 0); assert(psl[0] == NULL || psl[0] != psl[1]); psPtr[0] = MatchPatterns(dispPtr, bindPtr, psl[0], psSuccList, 0, curEvent, objArr[k], NULL); psPtr[1] = MatchPatterns(dispPtr, bindPtr, psl[1], psSuccList, 0, curEvent, objArr[k], NULL); if (!PSList_IsEmpty(psSuccList)) { /* We have promoted sequences, adjust array size. */ arraySize = Max(1, arraySize); } bestPtr = psPtr[0] ? psPtr[0] : psPtr[1]; if (matchPtrArr[k]) { if (IsBetterMatch(matchPtrArr[k], bestPtr)) { matchPtrArr[k] = bestPtr; |
︙ | ︙ | |||
2475 2476 2477 2478 2479 2480 2481 | matchPtrArr[k] = matchPtr; } } } if (matchPtrArr[k]) { ExpandPercents(winPtr, matchPtrArr[k]->script, curEvent, scriptCount++, &scripts); | | | | 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 | matchPtrArr[k] = matchPtr; } } } if (matchPtrArr[k]) { ExpandPercents(winPtr, matchPtrArr[k]->script, curEvent, scriptCount++, &scripts); /* Null is added to the scripts string to separate the various scripts. */ Tcl_DStringAppend(&scripts, "", 1); } } PromArr_SetSize(bindPtr->promArr, arraySize); /* * Remove expired pattern sequences. */ for (i = 0, newArraySize = 0; i < arraySize; ++i) { PSList *psList = PromArr_Get(bindPtr->promArr, i); PSEntry *psEntry; PSEntry *psNext; for (psEntry = PSList_First(psList); psEntry; psEntry = psNext) { const TkPattern *patPtr; assert(i + 1 < (Tcl_Size)psEntry->psPtr->numPats); psNext = PSList_Next(psEntry); patPtr = &psEntry->psPtr->pats[i + 1]; /* * We have to remove the following entries from promotion list (but * only if we don't want to keep it): |
︙ | ︙ | |||
2540 2541 2542 2543 2544 2545 2546 | } break; } } } if (!PSList_IsEmpty(psList)) { | | | | 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 | } break; } } } if (!PSList_IsEmpty(psList)) { /* We still have promoted sequences, adjust array size. */ newArraySize = Max(i + 1, newArraySize); } } PromArr_SetSize(bindPtr->promArr, newArraySize); if (matchPtrArr != matchPtrBuf) { ckfree(matchPtrArr); } if (Tcl_DStringLength(&scripts) == 0) { return; /* Nothing to do. */ } /* * Now go back through and evaluate the binding for each object, in order, * dealing with "break" and "continue" exceptions appropriately. * * There are two tricks here: |
︙ | ︙ | |||
2599 2600 2601 2602 2603 2604 2605 | * something that destroys ".", bindInfoPtr would have been freed, but we * can tell that by first checking to see if winPtr->mainPtr == NULL. */ Tcl_Preserve(bindInfoPtr); for (p = Tcl_DStringValue(&scripts), end = p + Tcl_DStringLength(&scripts); p < end; ) { | | | 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 | * something that destroys ".", bindInfoPtr would have been freed, but we * can tell that by first checking to see if winPtr->mainPtr == NULL. */ Tcl_Preserve(bindInfoPtr); for (p = Tcl_DStringValue(&scripts), end = p + Tcl_DStringLength(&scripts); p < end; ) { Tcl_Size len = strlen(p); int code; if (!bindInfoPtr->deleted) { ++screenPtr->bindingDepth; } Tcl_AllowExceptions(interp); |
︙ | ︙ | |||
2664 2665 2666 2667 2668 2669 2670 | */ /* helper function */ static int VirtPatIsBound( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr, /* Test this pattern. */ | | | | | 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 | */ /* helper function */ static int VirtPatIsBound( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr, /* Test this pattern. */ void *object, /* Check for this binding tag. */ PatSeq **physPtrPtr) /* Input: the best physical event. * Output: the physical event associated with matching virtual event. */ { PatternTableKey key; const struct VirtOwners *owners; unsigned i; assert(bindPtr); assert(psPtr); assert(!psPtr->object); assert(physPtrPtr); if (*physPtrPtr) { const TkPattern *physPatPtr = (*physPtrPtr)->pats; const TkPattern *virtPatPtr = psPtr->pats; if (physPatPtr->info || !virtPatPtr->info) { if (IsSubsetOf(virtPatPtr->modMask, physPatPtr->modMask)) { return 0; /* We cannot surpass this match. */ } } } /* Otherwise on some systems the key contains uninitialized bytes. */ memset(&key, 0, sizeof(key)); key.object = object; key.type = VirtualEvent; owners = psPtr->ptr.owners; for (i = 0; i < VirtOwners_Size(owners); ++i) { |
︙ | ︙ | |||
2714 2715 2716 2717 2718 2719 2720 | return 0; } /* helper function */ static int Compare( const PatSeq *fstMatchPtr, | | | 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 | return 0; } /* helper function */ static int Compare( const PatSeq *fstMatchPtr, const PatSeq *sndMatchPtr) /* Most recent match. */ { int diff; if (!fstMatchPtr) { return +1; } assert(sndMatchPtr); diff = CountSpecialized(fstMatchPtr, sndMatchPtr); return diff ? diff : (int) sndMatchPtr->count - (int) fstMatchPtr->count; |
︙ | ︙ | |||
2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | /* Finally compare modifier masks of last pattern. */ if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } return fstCount - sndCount; } static PatSeq * MatchPatterns( TkDisplay *dispPtr, /* Display from which the event came. */ Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PSList *psList, /* List of potentially matching patterns, can be NULL. */ PSList *psSuccList, /* Add all matching higher-level pattern sequences to this list. * Can be NULL. */ unsigned patIndex, /* Match only this tag in sequence. */ const Event *curEvent, /* Match this event. */ | > > > > > > > > > > > > > > | | > | 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 | /* Finally compare modifier masks of last pattern. */ if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } return fstCount - sndCount; } /* helper function */ static int IsPSInPSList( const PatSeq *psPtr, /* Is this pattern sequence... */ const PSList *psList) /* ...an element of this list of patterns sequence? */ { PSEntry *psEntry; TK_DLIST_FOREACH(psEntry, psList) { if (psEntry->psPtr == psPtr) { return 1; } } return 0; } static PatSeq * MatchPatterns( TkDisplay *dispPtr, /* Display from which the event came. */ Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PSList *psList, /* List of potentially matching patterns, can be NULL. */ PSList *psSuccList, /* Add all matching higher-level pattern sequences to this list. * Can be NULL. */ unsigned patIndex, /* Match only this tag in sequence. */ const Event *curEvent, /* Match this event. */ void *object, /* Check for this binding tag. */ PatSeq **physPtrPtr) /* Input: the best physical event; NULL if we test physical events. * Output: the associated physical event for the best matching virtual * event; NULL when we match physical events. */ { Window window; PSEntry *psEntry; PatSeq *bestPtr; PatSeq *bestPhysPtr; unsigned bestModMask; const PSModMaskArr *bestModMaskArr = NULL; int isModKeyOnly = 0; Tcl_Size i; assert(dispPtr); assert(bindPtr); assert(curEvent); if (!psList) { return NULL; |
︙ | ︙ | |||
2839 2840 2841 2842 2843 2844 2845 | assert(psPtr->numPats > patIndex); if (psPtr->object ? psPtr->object == object : VirtPatIsBound(bindPtr, psPtr, object, physPtrPtr)) { TkPattern *patPtr = psPtr->pats + patIndex; | | | | | | 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 | assert(psPtr->numPats > patIndex); if (psPtr->object ? psPtr->object == object : VirtPatIsBound(bindPtr, psPtr, object, physPtrPtr)) { TkPattern *patPtr = psPtr->pats + patIndex; /* Ignore modifier key events, and KeyRelease events if the current event * is of a different type (e.g. a Button event) */ psEntry->keepIt = isModKeyOnly || \ ((patPtr->eventType != (unsigned) curEvent->xev.type) && curEvent->xev.type == KeyRelease); if (patPtr->eventType == (unsigned) curEvent->xev.type && (curEvent->xev.type != CreateNotify || curEvent->xev.xcreatewindow.parent == window) && (!patPtr->name || patPtr->name == curEvent->detail.name) && (!patPtr->info || patPtr->info == curEvent->detail.info)) { /* * Resolve the modifier mask for Alt and Mod keys. Unfortunately this * cannot be done in ParseEventDescription, otherwise this function would * be the better place. */ unsigned modMask = ResolveModifiers(dispPtr, patPtr->modMask); unsigned curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); psEntry->expired = 1; /* Remove it from promotion list. */ psEntry->keepIt = 0; /* Don't keep matching patterns. */ if (IsSubsetOf(modMask, curModMask)) { unsigned count = patPtr->info ? curEvent->countDetailed : curEvent->countAny; if (patIndex < PSModMaskArr_Size(psEntry->lastModMaskArr)) { PSModMaskArr_Set(psEntry->lastModMaskArr, patIndex, &modMask); } /* * This pattern is finally matching. */ if (psPtr->numPats == patIndex + 1) { if (patPtr->count <= count) { /* * This is also a final pattern (i.e. the pattern sequence is complete). * We always prefer the pattern with better match. * If completely equal than prefer most recently defined pattern. */ int cmp = Compare(bestPtr, psPtr); if (cmp == 0) { |
︙ | ︙ | |||
2897 2898 2899 2900 2901 2902 2903 | bestModMaskArr = psEntry->lastModMaskArr; if (physPtrPtr) { bestPhysPtr = *physPtrPtr; } } } else { DEBUG(psEntry->expired = 0;) | | | > > | | | | | | | | | | | | | | | | | > > > > > > > > | 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 | bestModMaskArr = psEntry->lastModMaskArr; if (physPtrPtr) { bestPhysPtr = *physPtrPtr; } } } else { DEBUG(psEntry->expired = 0;) psEntry->keepIt = 1; /* Don't remove it from promotion list. */ } } else if (psSuccList) { /* * Not a final pattern, but matching (i.e. successive patterns match the pattern sequence so far), * so promote the pattern sequence to next level if not already promoted in the success list. * But do not promote if count of current pattern is not yet reached. */ if (!IsPSInPSList(psPtr, psSuccList)) { if (patPtr->count == psEntry->count) { PSEntry *psNewEntry; assert(!patPtr->name); psNewEntry = MakeListEntry( &bindPtr->lookupTables.entryPool, psPtr, psPtr->modMaskUsed); if (!PSModMaskArr_IsEmpty(psNewEntry->lastModMaskArr)) { PSModMaskArr_Set(psNewEntry->lastModMaskArr, patIndex, &modMask); } assert(psNewEntry->keepIt); assert(psNewEntry->count == 1u); PSList_Append(psSuccList, psNewEntry); psNewEntry->window = window; /* Bind to current window. */ } else { assert(psEntry->count < patPtr->count); DEBUG(psEntry->expired = 0;) psEntry->count += 1; psEntry->keepIt = 1; /* Don't remove it from promotion list. */ } } else { /* * Pattern sequence is already present in the success list. */ DEBUG(psEntry->expired = 0;) psEntry->keepIt = 1; /* Don't remove it from promotion list. */ } } } } } } } |
︙ | ︙ | |||
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; | | | | | 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 | 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) ; if (string != before) { Tcl_DStringAppend(dsPtr, before, (Tcl_Size)(string - before)); before = string; } if (!*before) { break; } /* |
︙ | ︙ | |||
3252 3253 3254 3255 3256 3257 3258 | numStorage[0] = before[1]; numStorage[1] = '\0'; string = numStorage; break; } { /* local scope */ int cvtFlags; | | | | 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 | numStorage[0] = before[1]; numStorage[1] = '\0'; string = numStorage; break; } { /* local scope */ int cvtFlags; Tcl_Size spaceNeeded = Tcl_ScanElement(string, &cvtFlags); Tcl_Size length = Tcl_DStringLength(dsPtr); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); spaceNeeded = Tcl_ConvertElement( string, Tcl_DStringValue(dsPtr) + length, cvtFlags | TCL_DONT_USE_BRACES); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); before += 2; } |
︙ | ︙ | |||
3327 3328 3329 3330 3331 3332 3333 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_EventObjCmd( | | | > > > > > | > > > > > < < < < < < < < < < | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_EventObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { 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) { | > > > > > > > > > > > > > > > > | 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 | 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) { |
︙ | ︙ | |||
3541 3542 3543 3544 3545 3546 3547 | assert(eventString); if (!(virtUid = GetVirtualEventUid(interp, virtString))) { return 0; } /* | | | 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 | assert(eventString); if (!(virtUid = GetVirtualEventUid(interp, virtString))) { return 0; } /* * Find/create physical event. */ if (!(psPtr = FindSequence(interp, &vetPtr->lookupTables, NULL, eventString, 1, 0, NULL))) { return 0; } assert(TEST_PSENTRY(psPtr)); |
︙ | ︙ | |||
3649 3650 3651 3652 3653 3654 3655 | assert(TEST_PSENTRY(psPtr)); if (!eventPSPtr || psPtr == eventPSPtr) { VirtOwners *owners = psPtr->ptr.owners; int iVirt = VirtOwners_Find(owners, vhPtr); | | | 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 | assert(TEST_PSENTRY(psPtr)); if (!eventPSPtr || psPtr == eventPSPtr) { VirtOwners *owners = psPtr->ptr.owners; int iVirt = VirtOwners_Find(owners, vhPtr); assert(iVirt != -1); /* Otherwise we couldn't find owner, and this should not happen. */ /* * Remove association between this physical event and the given * virtual event that it triggers. */ if (VirtOwners_Size(owners) > 1) { |
︙ | ︙ | |||
3839 3840 3841 3842 3843 3844 3845 | *--------------------------------------------------------------------------- */ static int HandleEventGenerate( Tcl_Interp *interp, /* Interp for errors return and name lookup. */ Tk_Window mainWin, /* Main window associated with interp. */ | | | | 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 | *--------------------------------------------------------------------------- */ static int HandleEventGenerate( Tcl_Interp *interp, /* Interp for errors return and name lookup. */ Tk_Window mainWin, /* Main window associated with interp. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { union { XEvent general; XVirtualEvent virt; } event; const char *p; const char *name; const char *windowName; Tcl_QueuePosition pos; TkPattern pat; Tk_Window tkwin; Tk_Window tkwin2; TkWindow *mainPtr; unsigned eventMask; Tcl_Obj *userDataObj; int synch; int warp; unsigned count; unsigned flags; int number; Tcl_Size i; static const char *const fieldStrings[] = { "-when", "-above", "-borderwidth", "-button", "-count", "-data", "-delta", "-detail", "-focus", "-height", "-keycode", "-keysym", "-mode", "-override", "-place", "-root", "-rootx", "-rooty", |
︙ | ︙ | |||
3909 3910 3911 3912 3913 3914 3915 | eventMask = 0; userDataObj = NULL; if ((count = ParseEventDescription(interp, &p, &pat, &eventMask)) == 0) { return TCL_ERROR; } if (count != 1u) { Tcl_SetObjResult(interp, | | | | 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 | eventMask = 0; userDataObj = NULL; if ((count = ParseEventDescription(interp, &p, &pat, &eventMask)) == 0) { return TCL_ERROR; } if (count != 1u) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Double, Triple, or Quadruple modifier not allowed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "BAD_MODIFIER", NULL); return TCL_ERROR; } if (*p) { Tcl_SetObjResult(interp, Tcl_NewStringObj("only one event specification allowed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "MULTIPLE", NULL); return TCL_ERROR; } memset(&event, 0, sizeof(event)); event.general.xany.type = pat.eventType; event.general.xany.serial = NextRequest(Tk_Display(tkwin)); |
︙ | ︙ | |||
3969 3970 3971 3972 3973 3974 3975 | * Process the remaining arguments to fill in additional fields of the event. */ synch = 1; warp = 0; pos = TCL_QUEUE_TAIL; | | > > > > > | 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 | * Process the remaining arguments to fill in additional fields of the event. */ synch = 1; warp = 0; pos = TCL_QUEUE_TAIL; for (i = 2; i < 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) { |
︙ | ︙ | |||
4629 4630 4631 4632 4633 4634 4635 | *---------------------------------------------------------------------- */ static PatSeq * FindSequence( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ LookupTables *lookupTables, /* Tables used for lookup. */ | | | 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 | *---------------------------------------------------------------------- */ static PatSeq * FindSequence( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ LookupTables *lookupTables, /* Tables used for lookup. */ void *object, /* For binding table, token for object with which binding is * associated. For virtual event table, NULL. */ const char *eventString, /* String description of pattern to match on. See user * documentation for details. */ int create, /* 0 means don't create the entry if it doesn't already exist. * 1 means create. */ int allowVirtual, /* 0 means that virtual events are not allowed in the sequence. * 1 otherwise. */ |
︙ | ︙ | |||
4683 4684 4685 4686 4687 4688 4689 | ckfree(psPtr); return NULL; } if (eventMask & VirtualEventMask) { if (!allowVirtual) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 | ckfree(psPtr); return NULL; } if (eventMask & VirtualEventMask) { if (!allowVirtual) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "virtual event not allowed in definition of another virtual event", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "INNER", NULL); ckfree(psPtr); return NULL; } virtualFound = 1; } |
︙ | ︙ | |||
4707 4708 4709 4710 4711 4712 4713 | *------------------------------------------------------------------ * Step 2: find the sequence in the binding table if it exists, and * add a new sequence to the table if it doesn't. *------------------------------------------------------------------ */ if (numPats == 0) { | | | | 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 | *------------------------------------------------------------------ * Step 2: find the sequence in the binding table if it exists, and * add a new sequence to the table if it doesn't. *------------------------------------------------------------------ */ if (numPats == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("no events specified in binding", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "NO_EVENTS", NULL); ckfree(psPtr); return NULL; } if (numPats > 1u && virtualFound) { Tcl_SetObjResult(interp, Tcl_NewStringObj("virtual events may not be composed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "COMPOSITION", NULL); ckfree(psPtr); return NULL; } if (patsBufSize > numPats) { psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats)); } |
︙ | ︙ | |||
4837 4838 4839 4840 4841 4842 4843 | unsigned count = 1; assert(eventStringPtr); assert(patPtr); assert(eventMaskPtr); p = *eventStringPtr; | | | 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 | unsigned count = 1; assert(eventStringPtr); assert(patPtr); assert(eventMaskPtr); p = *eventStringPtr; memset(patPtr, 0, sizeof(TkPattern)); /* Otherwise memcmp doesn't work. */ /* * Handle simple ASCII characters. */ if (*p != '<') { char string[2]; |
︙ | ︙ | |||
4897 4898 4899 4900 4901 4902 4903 | unsigned size; p = strchr(field, '>'); if (p == field) { return FinalizeParseEventDescription( interp, patPtr, 0, | | | | 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 | unsigned size; p = strchr(field, '>'); if (p == field) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_NewStringObj("virtual event \"<<>>\" is badly formed", TCL_INDEX_NONE), "MALFORMED"); } if (!p || p[1] != '>') { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_NewStringObj("missing \">\" in virtual binding", TCL_INDEX_NONE), "MALFORMED"); } size = p - field; if (size >= sizeof(buf)) { bufPtr = (char *)ckalloc(size + 1); } strncpy(bufPtr, field, size); |
︙ | ︙ | |||
4956 4957 4958 4959 4960 4961 4962 | } p = SkipFieldDelims(p); } eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); | < | | 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 | } p = SkipFieldDelims(p); } eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); patPtr->eventType = eiPtr->type; eventFlags = flagArray[eiPtr->type]; eventMask = eiPtr->eventMask; p = GetField(SkipFieldDelims(p), field, sizeof(field)); } if (*field) { unsigned button = GetButtonNumber(field); if ((eventFlags & BUTTON) || (button && eventFlags == 0) || (SUPPORT_ADDITIONAL_MOTION_SYNTAX && (eventFlags & MOTION) && button == 0)) { /* This must be a button (or bad motion) event. */ if (button == 0) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON"); } patPtr->info = button; |
︙ | ︙ | |||
5027 5028 5029 5030 5031 5032 5033 | Tcl_ObjPrintf("specified keysym \"%s\" for non-key event", field), "NON_KEY"); } } else if (eventFlags == 0) { return FinalizeParseEventDescription( interp, patPtr, 0, | | < | | | 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 | Tcl_ObjPrintf("specified keysym \"%s\" for non-key event", field), "NON_KEY"); } } else if (eventFlags == 0) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_NewStringObj("no event type or button # or keysym", TCL_INDEX_NONE), "UNMODIFIABLE"); } else if (patPtr->eventType == MotionNotify) { patPtr->info = ButtonNumberFromState(patPtr->modMask); } p = SkipFieldDelims(p); if (*p != '>') { while (*p) { ++p; if (*p == '>') { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_NewStringObj("extra characters after detail in binding", TCL_INDEX_NONE), "PAST_DETAIL"); } } return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_NewStringObj("missing \">\" in binding", TCL_INDEX_NONE), "MALFORMED"); } ++p; } } *eventStringPtr = p; *eventMaskPtr |= eventMask; |
︙ | ︙ | |||
5175 5176 5177 5178 5179 5180 5181 | modMask &= ~modPtr->mask; Tcl_AppendPrintfToObj(patternObj, "%s-", modPtr->name); } } assert(patPtr->eventType < TK_LASTEVENT); assert(((size_t) eventArrayIndex[patPtr->eventType]) < SIZE_OF_ARRAY(eventArray)); | | | | 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 | modMask &= ~modPtr->mask; Tcl_AppendPrintfToObj(patternObj, "%s-", modPtr->name); } } assert(patPtr->eventType < TK_LASTEVENT); assert(((size_t) eventArrayIndex[patPtr->eventType]) < SIZE_OF_ARRAY(eventArray)); Tcl_AppendToObj(patternObj, eventArray[eventArrayIndex[patPtr->eventType]].name, TCL_INDEX_NONE); if (patPtr->info) { switch (patPtr->eventType) { case KeyPress: case KeyRelease: { const char *string = TkKeysymToString(patPtr->info); if (string) { Tcl_AppendToObj(patternObj, "-", 1); Tcl_AppendToObj(patternObj, string, TCL_INDEX_NONE); } break; } case ButtonPress: case ButtonRelease: assert(patPtr->info <= 13); Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) ((patPtr->info > 7) ? (patPtr->info - 4) : patPtr->info)); |
︙ | ︙ | |||
5236 5237 5238 5239 5240 5241 5242 | */ KeySym TkStringToKeysym( const char *name) /* Name of a keysym. */ { #ifdef REDO_KEYSYM_LOOKUP | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | 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 | */ 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 = Tcl_UtfToUniChar(name, &keysym); if (name[len] == '\0') { if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ } else if ((unsigned)(keysym - 0x21) <= 0x5D) { return (KeySym)keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { return (KeySym)keysym; } else if (keysym == 0x20AC) { return 0x20AC; } else { return (KeySym)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 | | > > > > > > > > > > > > > > > > > > > > > > > > < < < | 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 | */ 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[Tcl_UniCharToUtf(keysym - 0x1000000, buf)] = '\0'; } else if (keysym >= 0x1010000) { snprintf(buf, sizeof(buf), "U%08X", (int)(keysym - 0x1000000)); } else { snprintf(buf, sizeof(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 17 18 19 20 21 22 23 24 25 26 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The includes below are for pre-defined bitmaps. * * Platform-specific issue: Windows complains when the bitmaps are included, * because an array of characters is being initialized with integers as * elements. For lint purposes, the following pragmas temporarily turn off |
︙ | ︙ | |||
117 118 119 120 121 122 123 | /* * The following structure defines the implementation of the "bitmap" Tcl * object, which maps a string bitmap name to a TkBitmap object. The ptr1 * field of the Tcl_Obj points to a TkBitmap object. */ | | | | > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | /* * The following structure defines the implementation of the "bitmap" Tcl * object, which maps a string bitmap name to a TkBitmap object. The ptr1 * field of the Tcl_Obj points to a TkBitmap object. */ const TkObjType tkBitmapObjType = { {"bitmap", /* name */ FreeBitmapObjProc, /* freeIntRepProc */ DupBitmapObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *---------------------------------------------------------------------- * * Tk_AllocBitmapFromObj -- * |
︙ | ︙ | |||
160 161 162 163 164 165 166 | * NULL. */ Tk_Window tkwin, /* Need the screen the bitmap is used on.*/ Tcl_Obj *objPtr) /* Object describing bitmap; see manual entry * for legal syntax of string value. */ { TkBitmap *bitmapPtr; | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | * NULL. */ Tk_Window tkwin, /* Need the screen the bitmap is used on.*/ Tcl_Obj *objPtr) /* Object describing bitmap; see manual entry * for legal syntax of string value. */ { TkBitmap *bitmapPtr; if (objPtr->typePtr != &tkBitmapObjType.objType) { InitBitmapObj(objPtr); } bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBitmap, see if it's the one we * want. If so, increment its reference count and return. |
︙ | ︙ | |||
340 341 342 343 344 345 346 | if (*string == '@') { /* INTL: ISO char */ Tcl_DString buffer; int result; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify bitmap with '@' in a safe interpreter", | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | if (*string == '@') { /* INTL: ISO char */ Tcl_DString buffer; int result; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify bitmap with '@' in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); goto error; } /* * Note that we need to cast away the const from the string because * Tcl_TranslateFileName is non-const, even though it doesn't modify |
︙ | ︙ | |||
830 831 832 833 834 835 836 | nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; | | | 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; snprintf(string, sizeof(string), "_tk%d", dispPtr->bitmapAutoNumber); name = string; Tcl_SetHashValue(dataHashPtr, name); if (Tk_DefineBitmap(interp, name, source, width, height) != TCL_OK) { Tcl_DeleteHashEntry(dataHashPtr); return TCL_ERROR; } } |
︙ | ︙ | |||
901 902 903 904 905 906 907 | Tcl_Obj *objPtr) /* The object that describes the desired * bitmap. */ { TkBitmap *bitmapPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | Tcl_Obj *objPtr) /* The object that describes the desired * bitmap. */ { TkBitmap *bitmapPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objPtr->typePtr != &tkBitmapObjType.objType) { InitBitmapObj(objPtr); } bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { if ((bitmapPtr->resourceRefCount > 0) && (Tk_Display(tkwin) == bitmapPtr->display)) { |
︙ | ︙ | |||
976 977 978 979 980 981 982 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } | | | 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkBitmapObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; } /* *---------------------------------------------------------------------- * * BitmapInit -- |
︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | * or NULL if unavailable. */ { Tcl_Interp *dummy; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* | | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | * 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); |
︙ | ︙ | |||
1074 1075 1076 1077 1078 1079 1080 | /* *---------------------------------------------------------------------- * * TkReadBitmapFile -- * * Loads a bitmap image in X bitmap format into the specified drawable. | | | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | /* *---------------------------------------------------------------------- * * TkReadBitmapFile -- * * Loads a bitmap image in X bitmap format into the specified drawable. * This is equivalent to the XReadBitmapFile in X. * * Results: * Sets the size, hotspot, and bitmap on success. * * Side effects: * Creates a new bitmap from the file data. * |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | } /* *---------------------------------------------------------------------- * * TkGetBitmapPredefTable -- * | | | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | } /* *---------------------------------------------------------------------- * * 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/tkBusy.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkBusy.h" #include "default.h" /* * Things about the busy system that may be configured. Note that on some * platforms this may or may not have an effect. */ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUSY_CURSOR, TCL_INDEX_NONE, offsetof(Busy, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations of functions defined in this file. */ | > > > > | | | | | | | | | 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 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkBusy.h" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Things about the busy system that may be configured. Note that on some * platforms this may or may not have an effect. */ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUSY_CURSOR, TCL_INDEX_NONE, offsetof(Busy, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations of functions defined in this file. */ static void BusyEventProc(void *clientData, XEvent *eventPtr); static void BusyGeometryProc(void *clientData, Tk_Window tkwin); static void BusyCustodyProc(void *clientData, Tk_Window tkwin); static int ConfigureBusy(Tcl_Interp *interp, Busy *busyPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static Busy * CreateBusy(Tcl_Interp *interp, Tk_Window tkRef); static Tcl_FreeProc DestroyBusy; static void DoConfigureNotify(Tk_FakeWin *winPtr); static inline Tk_Window FirstChild(Tk_Window parent); static Busy * GetBusy(Tcl_Interp *interp, Tcl_HashTable *busyTablePtr, Tcl_Obj *const windowObj); static int HoldBusy(Tcl_HashTable *busyTablePtr, Tcl_Interp *interp, Tcl_Obj *const windowObj, Tcl_Size configObjc, Tcl_Obj *const configObjv[]); static void MakeTransparentWindowExist(Tk_Window tkwin, Window parent); static inline Tk_Window NextChild(Tk_Window tkwin); static void RefWinEventProc(void *clientData, XEvent *eventPtr); static inline void SetWindowInstanceData(Tk_Window tkwin, void *instanceData); /* * The "busy" geometry manager definition. */ static Tk_GeomMgr busyMgrInfo = { "busy", /* Name of geometry manager used by winfo */ |
︙ | ︙ | |||
92 93 94 95 96 97 98 | } return (Tk_Window) winPtr->nextPtr; } static inline void SetWindowInstanceData( Tk_Window tkwin, | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | } return (Tk_Window) winPtr->nextPtr; } static inline void SetWindowInstanceData( Tk_Window tkwin, void *instanceData) { struct TkWindow *winPtr = (struct TkWindow *) tkwin; winPtr->instanceData = instanceData; } /* |
︙ | ︙ | |||
120 121 122 123 124 125 126 | * The Busy structure is freed at the next idle point. * *---------------------------------------------------------------------- */ static void BusyCustodyProc( | | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | * The Busy structure is freed at the next idle point. * *---------------------------------------------------------------------- */ static void BusyCustodyProc( void *clientData, /* Information about the busy window. */ TCL_UNUSED(Tk_Window)) /* Not used. */ { Busy *busyPtr = (Busy *)clientData; Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); TkpHideBusyWindow(busyPtr); busyPtr->tkBusy = NULL; Tcl_EventuallyFree(busyPtr, DestroyBusy); } /* *---------------------------------------------------------------------- * * BusyGeometryProc -- * |
︙ | ︙ | |||
242 243 244 245 246 247 248 | * it's hidden, the busy window is unmapped. * *---------------------------------------------------------------------- */ static void RefWinEventProc( | | | | 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 | * it's hidden, the busy window is unmapped. * *---------------------------------------------------------------------- */ static void RefWinEventProc( void *clientData, /* Busy window record */ XEvent *eventPtr) /* Event which triggered call to routine */ { Busy *busyPtr = (Busy *)clientData; switch (eventPtr->type) { case ReparentNotify: case DestroyNotify: /* * Arrange for the busy structure to be removed at a proper time. */ Tcl_EventuallyFree(busyPtr, DestroyBusy); break; case ConfigureNotify: if ((busyPtr->width != Tk_Width(busyPtr->tkRef)) || (busyPtr->height != Tk_Height(busyPtr->tkRef)) || (busyPtr->x != Tk_X(busyPtr->tkRef)) || (busyPtr->y != Tk_Y(busyPtr->tkRef))) { |
︙ | ︙ | |||
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | * Memory and resources are released and the Tk event handler is removed. * *---------------------------------------------------------------------- */ static void DestroyBusy( void *data) /* Busy window structure record */ { Busy *busyPtr = (Busy *)data; if (busyPtr->hashPtr != NULL) { Tcl_DeleteHashEntry(busyPtr->hashPtr); } Tk_DeleteEventHandler(busyPtr->tkRef, StructureNotifyMask, | > > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | * Memory and resources are released and the Tk event handler is removed. * *---------------------------------------------------------------------- */ static void DestroyBusy( #if TCL_MAJOR_VERSION > 8 void *data) /* Busy window structure record */ #else char *data) #endif { Busy *busyPtr = (Busy *)data; if (busyPtr->hashPtr != NULL) { Tcl_DeleteHashEntry(busyPtr->hashPtr); } Tk_DeleteEventHandler(busyPtr->tkRef, StructureNotifyMask, |
︙ | ︙ | |||
368 369 370 371 372 373 374 | * with it released at the next idle point. * *---------------------------------------------------------------------- */ static void BusyEventProc( | | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | * with it released at the next idle point. * *---------------------------------------------------------------------- */ static void BusyEventProc( void *clientData, /* Busy window record */ XEvent *eventPtr) /* Event which triggered call to routine */ { Busy *busyPtr = (Busy *)clientData; if (eventPtr->type == DestroyNotify) { busyPtr->tkBusy = NULL; Tcl_EventuallyFree(busyPtr, DestroyBusy); } } /* *---------------------------------------------------------------------- * * MakeTransparentWindowExist -- |
︙ | ︙ | |||
546 547 548 549 550 551 552 | y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width; } } for (tkChild = FirstChild(tkParent); tkChild != NULL; tkChild = NextChild(tkChild)) { Tk_MakeWindowExist(tkChild); } | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width; } } for (tkChild = FirstChild(tkParent); tkChild != NULL; tkChild = NextChild(tkChild)) { Tk_MakeWindowExist(tkChild); } snprintf(name, length + 6, fmt, Tk_Name(tkRef)); tkBusy = Tk_CreateWindow(interp, tkParent, name, NULL); ckfree(name); if (tkBusy == NULL) { return NULL; } Tk_MakeWindowExist(tkRef); |
︙ | ︙ | |||
628 629 630 631 632 633 634 | *---------------------------------------------------------------------- */ static int ConfigureBusy( Tcl_Interp *interp, Busy *busyPtr, | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | *---------------------------------------------------------------------- */ static int ConfigureBusy( Tcl_Interp *interp, Busy *busyPtr, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_Cursor oldCursor = busyPtr->cursor; if (Tk_SetOptions(interp, busyPtr, busyPtr->optionTable, objc, objv, busyPtr->tkBusy, NULL, NULL) != TCL_OK) { return TCL_ERROR; |
︙ | ︙ | |||
678 679 680 681 682 683 684 | Tcl_Interp *interp, /* Interpreter to look up main window of. */ Tcl_HashTable *busyTablePtr,/* Busy hash table */ Tcl_Obj *const windowObj) /* Path name of parent window */ { Tcl_HashEntry *hPtr; Tk_Window tkwin; | | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | Tcl_Interp *interp, /* Interpreter to look up main window of. */ Tcl_HashTable *busyTablePtr,/* Busy hash table */ Tcl_Obj *const windowObj) /* Path name of parent window */ { Tcl_HashEntry *hPtr; Tk_Window tkwin; tkwin = Tk_MainWindow(interp); if (!tkwin || (TkGetWindowFromObj(interp, tkwin, windowObj, &tkwin) != TCL_OK)) { return NULL; } hPtr = Tcl_FindHashEntry(busyTablePtr, tkwin); if (hPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find busy window \"%s\"", Tcl_GetString(windowObj))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "BUSY", |
︙ | ︙ | |||
719 720 721 722 723 724 725 | */ static int HoldBusy( Tcl_HashTable *busyTablePtr,/* Busy hash table. */ Tcl_Interp *interp, /* Interpreter to report errors to. */ Tcl_Obj *const windowObj, /* Window name. */ | | > | 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 | */ static int HoldBusy( Tcl_HashTable *busyTablePtr,/* Busy hash table. */ Tcl_Interp *interp, /* Interpreter to report errors to. */ Tcl_Obj *const windowObj, /* Window name. */ Tcl_Size configObjc, /* Option pairs. */ Tcl_Obj *const configObjv[]) { Tk_Window tkwin; Tcl_HashEntry *hPtr; Busy *busyPtr; int isNew, result; if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), windowObj, &tkwin) != TCL_OK) { return TCL_ERROR; } hPtr = Tcl_CreateHashEntry(busyTablePtr, (char *) tkwin, &isNew); if (isNew) { busyPtr = CreateBusy(interp, tkwin); if (busyPtr == NULL) { Tcl_DeleteHashEntry(hPtr); return TCL_ERROR; } Tcl_SetHashValue(hPtr, busyPtr); busyPtr->hashPtr = hPtr; } else { busyPtr = (Busy *)Tcl_GetHashValue(hPtr); } |
︙ | ︙ | |||
757 758 759 760 761 762 763 | if (Tk_IsMapped(busyPtr->tkRef)) { TkpShowBusyWindow(busyPtr); } else { TkpHideBusyWindow(busyPtr); } if (result == TCL_OK) { | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | if (Tk_IsMapped(busyPtr->tkRef)) { TkpShowBusyWindow(busyPtr); } else { TkpHideBusyWindow(busyPtr); } if (result == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE)); } return result; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
781 782 783 784 785 786 787 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BusyObjCmd( | | | | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BusyObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable; Busy *busyPtr; Tcl_Obj *objPtr; int index, result = TCL_OK; |
︙ | ︙ | |||
832 833 834 835 836 837 838 | return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } | | | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE)); return TCL_OK; case BUSY_CGET: if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "window option"); return TCL_ERROR; } |
︙ | ︙ | |||
909 910 911 912 913 914 915 | return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { return TCL_ERROR; } TkpHideBusyWindow(busyPtr); | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { return TCL_ERROR; } TkpHideBusyWindow(busyPtr); Tcl_EventuallyFree(busyPtr, DestroyBusy); return TCL_OK; case BUSY_HOLD: if (objc < 3 || objc%2 != 1) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?"); return TCL_ERROR; } |
︙ | ︙ |
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; |
︙ | ︙ | |||
72 73 74 75 76 77 78 | {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_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_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}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), TK_OPTION_ENUM_VAR, 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_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} }; static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_BUTTON_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_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_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, "-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}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkButton, justify), TK_OPTION_ENUM_VAR, 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", tkDefButtonPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefButtonPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", 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} }; static const Tk_OptionSpec checkbuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_CHKRAD_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_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_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, "-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), TK_OPTION_ENUM_VAR, 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), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; static const Tk_OptionSpec radiobuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_CHKRAD_ACTIVE_FG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, TCL_INDEX_NONE, offsetof(TkButton, anchor), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, TCL_INDEX_NONE, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_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_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, "-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), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", DEF_BUTTON_RELIEF, TCL_INDEX_NONE, offsetof(TkButton, offRelief), 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), |
︙ | ︙ | |||
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}, |
︙ | ︙ | |||
517 518 519 520 521 522 523 | COMMAND_INVOKE, COMMAND_SELECT} }; /* * Forward declarations for functions defined later in this file: */ | | | | | | | | | | | < < | | 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 | COMMAND_INVOKE, COMMAND_SELECT} }; /* * Forward declarations for functions defined later in this file: */ static void ButtonCmdDeletedProc(void *clientData); static int ButtonCreate(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type); static void ButtonEventProc(void *clientData, XEvent *eventPtr); static void ButtonImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static void ButtonSelectImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static void ButtonTristateImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static char * ButtonTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static char * ButtonVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_ObjCmdProc ButtonWidgetObjCmd; static int ConfigureButton(Tcl_Interp *interp, TkButton *butPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DestroyButton(TkButton *butPtr); /* *-------------------------------------------------------------- * * Tk_ButtonCmd, Tk_CheckbuttonCmd, Tk_LabelCmd, Tk_RadiobuttonCmd -- * |
︙ | ︙ | |||
566 567 568 569 570 571 572 | * call ButtonCreate to do all of the real work. * *-------------------------------------------------------------- */ int Tk_ButtonObjCmd( | | | | | | 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 | * call ButtonCreate to do all of the real work. * *-------------------------------------------------------------- */ int Tk_ButtonObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { return ButtonCreate(clientData, interp, objc, objv, TYPE_BUTTON); } int Tk_CheckbuttonObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { return ButtonCreate(clientData, interp, objc, objv, TYPE_CHECK_BUTTON); } int Tk_LabelObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { return ButtonCreate(clientData, interp, objc, objv, TYPE_LABEL); } int Tk_RadiobuttonObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { return ButtonCreate(clientData, interp, objc, objv, TYPE_RADIO_BUTTON); } |
︙ | ︙ | |||
624 625 626 627 628 629 630 | * See the user documentation. * *-------------------------------------------------------------- */ static int ButtonCreate( | | | < | 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 | * See the user documentation. * *-------------------------------------------------------------- */ static int ButtonCreate( TCL_UNUSED(void *), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument values. */ int type) /* Type of button to create: TYPE_LABEL, * TYPE_BUTTON, TYPE_CHECK_BUTTON, or * TYPE_RADIO_BUTTON. */ { TkButton *butPtr; Tk_OptionTable optionTable; Tk_Window tkwin; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->defaultsInitialized) { TkpButtonSetDefaults(); tsdPtr->defaultsInitialized = 1; } if (objc < 2) { |
︙ | ︙ | |||
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; | | | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | 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; |
︙ | ︙ | |||
780 781 782 783 784 785 786 | * See the user documentation. * *-------------------------------------------------------------- */ static int ButtonWidgetObjCmd( | | | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | * See the user documentation. * *-------------------------------------------------------------- */ static int ButtonWidgetObjCmd( void *clientData, /* Information about button widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { TkButton *butPtr = (TkButton *)clientData; int index; int result; |
︙ | ︙ | |||
1004 1005 1006 1007 1008 1009 1010 | Tk_FreeTextLayout(butPtr->textLayout); } if (butPtr->selVarNamePtr != NULL) { Tcl_UntraceVar2(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, butPtr); } | | | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | Tk_FreeTextLayout(butPtr->textLayout); } if (butPtr->selVarNamePtr != NULL) { Tcl_UntraceVar2(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, butPtr); } Tk_FreeConfigOptions(butPtr, butPtr->optionTable, butPtr->tkwin); butPtr->tkwin = NULL; Tcl_EventuallyFree(butPtr, TCL_DYNAMIC); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 | */ static int ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ | | | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | */ static int ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; Tcl_Obj *errorResult = NULL; int error, haveImage; Tk_Image image; |
︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | * Button will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ void TkButtonWorldChanged( | | | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | * Button will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ void TkButtonWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC newGC; unsigned long mask; TkButton *butPtr = (TkButton *)instanceData; /* |
︙ | ︙ | |||
1453 1454 1455 1456 1457 1458 1459 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ButtonEventProc( | | | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ButtonEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkButton *butPtr = (TkButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { /* |
︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ButtonCmdDeletedProc( | | | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ButtonCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkButton *butPtr = (TkButton *)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 BUTTON_DELETED flag |
︙ | ︙ | |||
1602 1603 1604 1605 1606 1607 1608 | * The button may become selected or deselected. * *-------------------------------------------------------------- */ static char * ButtonVarProc( | | | | < < | | | 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 | * The button may become selected or deselected. * *-------------------------------------------------------------- */ static char * ButtonVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), /* Name of variable. */ TCL_UNUSED(const char *), /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkButton *butPtr = (TkButton *)clientData; const char *value; Tcl_Obj *valuePtr; /* * 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 |
︙ | ︙ | |||
1713 1714 1715 1716 1717 1718 1719 | * The text displayed in the button will change to match the variable. * *-------------------------------------------------------------- */ static char * ButtonTextVarProc( | | | 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 | * The text displayed in the button will change to match the variable. * *-------------------------------------------------------------- */ static char * ButtonTextVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Not used. */ const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { TkButton *butPtr = (TkButton *)clientData; Tcl_Obj *valuePtr; |
︙ | ︙ | |||
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 ? */ | | | | 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 | 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 |
︙ | ︙ | |||
1809 1810 1811 1812 1813 1814 1815 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonImageProc( | | | 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonImageProc( void *clientData, /* Pointer to widget record. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (might be * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { TkButton *butPtr = (TkButton *)clientData; |
︙ | ︙ | |||
1853 1854 1855 1856 1857 1858 1859 | * May arrange for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonSelectImageProc( | | | 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 | * May arrange for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonSelectImageProc( void *clientData, /* Pointer to widget record. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (might be * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { TkButton *butPtr = (TkButton *)clientData; |
︙ | ︙ | |||
1906 1907 1908 1909 1910 1911 1912 | * May arrange for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonTristateImageProc( | | | 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | * May arrange for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void ButtonTristateImageProc( void *clientData, /* Pointer to widget record. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (might be * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { TkButton *butPtr = (TkButton *)clientData; |
︙ | ︙ |
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 |
︙ | ︙ | |||
304 305 306 307 308 309 310 | /* * Declaration of functions used in the implementation of the button widget. */ #ifndef TkpButtonSetDefaults MODULE_SCOPE void TkpButtonSetDefaults(void); #endif | | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | /* * Declaration of functions used in the implementation of the button widget. */ #ifndef TkpButtonSetDefaults MODULE_SCOPE void TkpButtonSetDefaults(void); #endif MODULE_SCOPE void TkButtonWorldChanged(void *instanceData); MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr); MODULE_SCOPE TkButton *TkpCreateButton(Tk_Window tkwin); #ifndef TkpDestroyButton MODULE_SCOPE void TkpDestroyButton(TkButton *butPtr); #endif #ifndef TkpDisplayButton MODULE_SCOPE void TkpDisplayButton(void *clientData); #endif MODULE_SCOPE int TkInvokeButton(TkButton *butPtr); #endif /* _TKBUTTON */ |
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" |
︙ | ︙ | |||
82 83 84 85 86 87 88 | #define PIE_OUTLINE1_PTS 6 #define PIE_OUTLINE2_PTS 7 /* * Information used for parsing configuration specs: */ | | | | | | | 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 PIE_OUTLINE1_PTS 6 #define PIE_OUTLINE2_PTS 7 /* * Information used for parsing configuration specs: */ static int StyleParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); static const char * StylePrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption styleOption = { StyleParseProc, StylePrintProc, NULL }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_CustomOption dashOption = { TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; |
︙ | ︙ | |||
180 181 182 183 184 185 186 | /* * Prototypes for functions defined in this file: */ static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr); static int ConfigureArc(Tcl_Interp *interp, | | | | | 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 | /* * Prototypes for functions defined in this file: */ static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr); static int ConfigureArc(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static void ComputeArcParametersFromHeight(ArcItem *arcPtr); static int CreateArc(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static int ArcCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ArcToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double ArcToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *coordPtr); static int ArcToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void ScaleArc(Tk_Canvas canvas, |
︙ | ︙ | |||
230 231 232 233 234 235 236 | sizeof(ArcItem), /* itemSize */ CreateArc, /* createProc */ configSpecs, /* configSpecs */ ConfigureArc, /* configureProc */ ArcCoords, /* coordProc */ DeleteArc, /* deleteProc */ DisplayArc, /* displayProc */ | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | sizeof(ArcItem), /* itemSize */ CreateArc, /* createProc */ configSpecs, /* configSpecs */ ConfigureArc, /* configureProc */ ArcCoords, /* coordProc */ DeleteArc, /* deleteProc */ DisplayArc, /* displayProc */ 0, /* flags */ ArcToPoint, /* pointProc */ ArcToArea, /* areaProc */ ArcToPostscript, /* postscriptProc */ ScaleArc, /* scaleProc */ TranslateArc, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
271 272 273 274 275 276 277 | static int CreateArc( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | static int CreateArc( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing arc. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Carry out initialization that is needed in order to clean up after |
︙ | ︙ | |||
350 351 352 353 354 355 356 | static int ArcCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | 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 | static int ArcCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { ArcItem *arcPtr = (ArcItem *) itemPtr; if (objc == 0) { Tcl_Obj *objs[4]; objs[0] = Tcl_NewDoubleObj(arcPtr->bbox[0]); objs[1] = Tcl_NewDoubleObj(arcPtr->bbox[1]); objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]); objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs)); } else if ((objc == 1) || (objc == 4)) { if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 4, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "ARC", (char *)NULL); return TCL_ERROR; } } if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &arcPtr->bbox[0]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &arcPtr->bbox[1]) != TCL_OK) |
︙ | ︙ | |||
400 401 402 403 404 405 406 | arcPtr->startPoint[1] = arcPtr->bbox[1]; arcPtr->endPoint[0] = arcPtr->bbox[2]; arcPtr->endPoint[1] = arcPtr->bbox[3]; ComputeArcBbox(canvas, arcPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | arcPtr->startPoint[1] = arcPtr->bbox[1]; arcPtr->endPoint[0] = arcPtr->bbox[2]; arcPtr->endPoint[1] = arcPtr->bbox[3]; ComputeArcBbox(canvas, arcPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 4, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "ARC", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
431 432 433 434 435 436 437 | */ static int ConfigureArc( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Arc item to reconfigure. */ | | | | 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 | */ static int ConfigureArc( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Arc item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; XGCValues gcValues; GC newGC; unsigned long mask; int i; Tk_Window tkwin; Tk_TSOffset *tsoffset; XColor *color; Pixmap stipple; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, arcPtr, flags)) { return TCL_ERROR; } state = itemPtr->state; /* * A few of the options require additional processing, such as style and |
︙ | ︙ | |||
503 504 505 506 507 508 509 | tsoffset->yoffset = (int) (arcPtr->bbox[1] + 0.5); } else if (flags & TK_OFFSET_MIDDLE) { tsoffset->yoffset = (int) ((arcPtr->bbox[1]+arcPtr->bbox[3]+1)/2); } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5); } | | | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | tsoffset->yoffset = (int) (arcPtr->bbox[1] + 0.5); } else if (flags & TK_OFFSET_MIDDLE) { tsoffset->yoffset = (int) ((arcPtr->bbox[1]+arcPtr->bbox[3]+1)/2); } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5); } mask = (unsigned long)Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline)); if (mask) { gcValues.cap_style = CapButt; mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { newGC = NULL; } |
︙ | ︙ | |||
2072 2073 2074 2075 2076 2077 2078 | Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); if (arcPtr->style != CHORD_STYLE) { | | | | | | 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 | Tcl_AppendPrintfToObj(psObj, "matrix currentmatrix\n" "%.15g %.15g translate %.15g %.15g scale\n", (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2, (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); if (arcPtr->style != CHORD_STYLE) { Tcl_AppendToObj(psObj, "0 0 moveto ", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(psObj, "0 0 1 %.15g %.15g arc closepath\nsetmatrix\n", ang1, ang2); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, fillColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (arcPtr->outline.gc != NULL) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } /* * If there's an outline for the arc, draw it. */ |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | ang1, ang2); Tcl_ResetResult(interp); Tk_CanvasPsOutline(canvas, itemPtr, &arcPtr->outline); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (arcPtr->style != ARC_STYLE) { | | | | | | | | 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 | ang1, ang2); Tcl_ResetResult(interp); Tk_CanvasPsOutline(canvas, itemPtr, &arcPtr->outline); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (arcPtr->style != ARC_STYLE) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); if (arcPtr->style == CHORD_STYLE) { Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS); } else { Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS); Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS, PIE_OUTLINE2_PTS); } Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } } /* * Plug the accumulated postscript back into the result. */ |
︙ | ︙ | |||
2194 2195 2196 2197 2198 2199 2200 | static int StyleParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ | | | 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 | static int StyleParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { int c; size_t length; Style *stylePtr = (Style *) (widgRec + offset); if (value == NULL || *value == 0) { *stylePtr = PIESLICE_STYLE; |
︙ | ︙ | |||
2224 2225 2226 2227 2228 2229 2230 | *stylePtr = PIESLICE_STYLE; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad -style option \"%s\": must be arc, chord, or pieslice", value)); | | | 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 | *stylePtr = PIESLICE_STYLE; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad -style option \"%s\": must be arc, chord, or pieslice", value)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ARC_STYLE", (char *)NULL); *stylePtr = PIESLICE_STYLE; return TCL_ERROR; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
2255 2256 2257 2258 2259 2260 2261 | */ static const char * StylePrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Ignored. */ char *widgRec, /* Pointer to record for item. */ | | | 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 | */ static const char * StylePrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Ignored. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Style *stylePtr = (Style *) (widgRec + offset); if (*stylePtr == ARC_STYLE) { |
︙ | ︙ |
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" |
︙ | ︙ | |||
41 42 43 44 45 46 47 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activebackground", NULL, NULL, NULL, offsetof(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL, NULL, offsetof(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL}, |
︙ | ︙ | |||
81 82 83 84 85 86 87 | }; /* * Prototypes for functions defined in this file: */ static int BitmapCoords(Tcl_Interp *interp, | | | | | 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 | }; /* * Prototypes for functions defined in this file: */ static int BitmapCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int BitmapToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double BitmapToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *coordPtr); static int BitmapToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void ComputeBitmapBbox(Tk_Canvas canvas, BitmapItem *bmapPtr); static int ConfigureBitmap(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int TkcCreateBitmap(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); |
︙ | ︙ | |||
124 125 126 127 128 129 130 | sizeof(BitmapItem), /* itemSize */ TkcCreateBitmap, /* createProc */ configSpecs, /* configSpecs */ ConfigureBitmap, /* configureProc */ BitmapCoords, /* coordProc */ DeleteBitmap, /* deleteProc */ DisplayBitmap, /* displayProc */ | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | sizeof(BitmapItem), /* itemSize */ TkcCreateBitmap, /* createProc */ configSpecs, /* configSpecs */ ConfigureBitmap, /* configureProc */ BitmapCoords, /* coordProc */ DeleteBitmap, /* deleteProc */ DisplayBitmap, /* displayProc */ 0, /* flags */ BitmapToPoint, /* pointProc */ BitmapToArea, /* areaProc */ BitmapToPostscript, /* postscriptProc */ ScaleBitmap, /* scaleProc */ TranslateBitmap, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
165 166 167 168 169 170 171 | static int TkcCreateBitmap( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | static int TkcCreateBitmap( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Initialize item's record. |
︙ | ︙ | |||
241 242 243 244 245 246 247 | static int BitmapCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | | | 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 | static int BitmapCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, obj, Tcl_NewDoubleObj(bmapPtr->x)); Tcl_ListObjAppendElement(NULL, obj, Tcl_NewDoubleObj(bmapPtr->y)); Tcl_SetObjResult(interp, obj); } else if (objc < 3) { if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "BITMAP", (char *)NULL); return TCL_ERROR; } } if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &bmapPtr->x) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &bmapPtr->y) != TCL_OK)) { return TCL_ERROR; } ComputeBitmapBbox(canvas, bmapPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "BITMAP", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
304 305 306 307 308 309 310 | */ static int ConfigureBitmap( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Bitmap item to reconfigure. */ | | | | 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 | */ static int ConfigureBitmap( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Bitmap item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; XGCValues gcValues; GC newGC; Tk_Window tkwin; unsigned long mask; XColor *fgColor; XColor *bgColor; Pixmap bitmap; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, bmapPtr, flags)) { return TCL_ERROR; } /* * A few of the options require additional processing, such as those that * determine the graphics context. */ |
︙ | ︙ | |||
413 414 415 416 417 418 419 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteBitmap( | | < | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteBitmap( TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; if (bmapPtr->bitmap != None) { Tk_FreeBitmap(display, bmapPtr->bitmap); } if (bmapPtr->activeBitmap != None) { Tk_FreeBitmap(display, bmapPtr->activeBitmap); } |
︙ | ︙ | |||
536 537 538 539 540 541 542 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | 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. |
︙ | ︙ | |||
669 670 671 672 673 674 675 | * None. * *-------------------------------------------------------------- */ static double BitmapToPoint( | | < | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | * None. * *-------------------------------------------------------------- */ static double BitmapToPoint( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against point. */ double *coordPtr) /* Pointer to x and y coordinates. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; x1 = bmapPtr->header.x1; y1 = bmapPtr->header.y1; x2 = bmapPtr->header.x2; y2 = bmapPtr->header.y2; /* |
︙ | ︙ | |||
726 727 728 729 730 731 732 | * None. * *-------------------------------------------------------------- */ static int BitmapToArea( | | < | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | * None. * *-------------------------------------------------------------- */ static int BitmapToArea( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against rectangle. */ double *rectPtr) /* Pointer to array of four coordinates * (x1,y1,x2,y2) describing rectangular * area. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; if ((rectPtr[2] <= bmapPtr->header.x1) || (rectPtr[0] >= bmapPtr->header.x2) || (rectPtr[3] <= bmapPtr->header.y1) || (rectPtr[1] >= bmapPtr->header.y2)) { return -1; } |
︙ | ︙ | |||
875 876 877 878 879 880 881 | */ static int BitmapToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ | | < | 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 | */ static int BitmapToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; double x, y; int width, height, rowsAtOnce, rowsThisTime; int curRow; XColor *fgColor; XColor *bgColor; Pixmap bitmap; Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } fgColor = bmapPtr->fgColor; bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; |
︙ | ︙ | |||
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; | | | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | 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(); |
︙ | ︙ | |||
965 966 967 968 969 970 971 | "%d 0 rlineto closepath\n", x, y, width, height, -width); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, bgColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); | | | | | 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 | "%d 0 rlineto closepath\n", x, y, width, height, -width); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, bgColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } /* * Draw the bitmap, if there is a foreground color. If the bitmap is very * large, then chop it up into multiple bitmaps, each consisting of one or * more rows. This is needed because Postscript can't handle single * strings longer than 64 KBytes long. */ if (fgColor != NULL) { Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, fgColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (width > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't generate Postscript for bitmaps more than 60000" " pixels wide", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", (char *)NULL); goto error; } rowsAtOnce = 60000/width; if (rowsAtOnce < 1) { rowsAtOnce = 1; } |
︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | (double) rowsThisTime, width, rowsThisTime); Tcl_ResetResult(interp); Tk_CanvasPsBitmap(interp, canvas, bitmap, 0, curRow, width, rowsThisTime); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); | | | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | (double) rowsThisTime, width, rowsThisTime); Tcl_ResetResult(interp); Tk_CanvasPsBitmap(interp, canvas, bitmap, 0, curRow, width, rowsThisTime); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "\n} imagemask\n", TCL_INDEX_NONE); } } /* * Plug the accumulated postscript back into the result. */ |
︙ | ︙ |
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" |
︙ | ︙ | |||
43 44 45 46 47 48 49 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-activeimage", NULL, NULL, NULL, offsetof(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, |
︙ | ︙ | |||
66 67 68 69 70 71 72 | {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ | | | | | | | | 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 | {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ static void ImageChangedProc(void *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, Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int CreateImage(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size 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); |
︙ | ︙ | |||
112 113 114 115 116 117 118 | sizeof(ImageItem), /* itemSize */ CreateImage, /* createProc */ configSpecs, /* configSpecs */ ConfigureImage, /* configureProc */ ImageCoords, /* coordProc */ DeleteImage, /* deleteProc */ DisplayImage, /* displayProc */ | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | sizeof(ImageItem), /* itemSize */ CreateImage, /* createProc */ configSpecs, /* configSpecs */ ConfigureImage, /* configureProc */ ImageCoords, /* coordProc */ DeleteImage, /* deleteProc */ DisplayImage, /* displayProc */ 0, /* flags */ ImageToPoint, /* pointProc */ ImageToArea, /* areaProc */ ImageToPostscript, /* postscriptProc */ ScaleImage, /* scaleProc */ TranslateImage, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
153 154 155 156 157 158 159 | static int CreateImage( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | static int CreateImage( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Initialize item's record. |
︙ | ︙ | |||
225 226 227 228 229 230 231 | static int ImageCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | | | 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 | static int ImageCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { ImageItem *imgPtr = (ImageItem *) itemPtr; if (objc == 0) { Tcl_Obj *objs[2]; objs[0] = Tcl_NewDoubleObj(imgPtr->x); objs[1] = Tcl_NewDoubleObj(imgPtr->y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, objs)); } else if (objc < 3) { if (objc==1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "IMAGE", (char *)NULL); return TCL_ERROR; } } if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &imgPtr->x) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &imgPtr->y) != TCL_OK)) { return TCL_ERROR; } ComputeImageBbox(canvas, imgPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "IMAGE", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
288 289 290 291 292 293 294 | */ static int ConfigureImage( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Image item to reconfigure. */ | | | | 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 | */ static int ConfigureImage( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Image item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; Tk_Window tkwin; Tk_Image image; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, imgPtr, flags)) { return TCL_ERROR; } /* * Create the image. Save the old image around and don't free it until * after the new one is allocated. This keeps the reference count from * going to zero so the image doesn't have to be recreated if it hasn't |
︙ | ︙ | |||
376 377 378 379 380 381 382 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteImage( | | | < < | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteImage( TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ TCL_UNUSED(Display *)) /* Display containing window for canvas. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; if (imgPtr->imageString != NULL) { ckfree(imgPtr->imageString); } if (imgPtr->activeImageString != NULL) { ckfree(imgPtr->activeImageString); } |
︙ | ︙ | |||
487 488 489 490 491 492 493 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | 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. |
︙ | ︙ | |||
587 588 589 590 591 592 593 | * None. * *-------------------------------------------------------------- */ static double ImageToPoint( | | < | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | * None. * *-------------------------------------------------------------- */ static double ImageToPoint( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against point. */ double *coordPtr) /* Pointer to x and y coordinates. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; x1 = imgPtr->header.x1; y1 = imgPtr->header.y1; x2 = imgPtr->header.x2; y2 = imgPtr->header.y2; /* |
︙ | ︙ | |||
644 645 646 647 648 649 650 | * None. * *-------------------------------------------------------------- */ static int ImageToArea( | | < | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | * None. * *-------------------------------------------------------------- */ static int ImageToArea( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against rectangle. */ double *rectPtr) /* Pointer to array of four coordinates * (x1,y1,x2,y2) describing rectangular * area. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; if ((rectPtr[2] <= imgPtr->header.x1) || (rectPtr[0] >= imgPtr->header.x2) || (rectPtr[3] <= imgPtr->header.y1) || (rectPtr[1] >= imgPtr->header.y2)) { return -1; } |
︙ | ︙ | |||
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; | | | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | 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); |
︙ | ︙ | |||
881 882 883 884 885 886 887 | * Arranges for the canvas to get redisplayed. * *---------------------------------------------------------------------- */ static void ImageChangedProc( | | | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | * Arranges for the canvas to get redisplayed. * *---------------------------------------------------------------------- */ static void ImageChangedProc( void *clientData, /* Pointer to canvas item for image. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (may be <= * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { ImageItem *imgPtr = (ImageItem *)clientData; |
︙ | ︙ |
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 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 | /* * 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" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The structure below defines the record for each line item. */ typedef enum { ARROWS_NONE, ARROWS_FIRST, ARROWS_LAST, ARROWS_BOTH } Arrows; typedef struct LineItem { Tk_Item header; /* Generic stuff that's the same for all * types. MUST BE FIRST IN STRUCTURE. */ Tk_Outline outline; /* Outline structure */ Tk_Canvas canvas; /* Canvas containing item. Needed for parsing * arrow shapes. */ Tcl_Size numPoints; /* Number of points in line (always >= 0). */ double *coordPtr; /* Pointer to malloc-ed array containing x- * and y-coords of all points in line. * X-coords are even-valued indices, y-coords * are corresponding odd-valued indices. If * the line has arrowheads then the first and * last points have been adjusted to refer to * the necks of the arrowheads rather than |
︙ | ︙ | |||
75 76 77 78 79 80 81 | */ static int ArrowheadPostscript(Tcl_Interp *interp, Tk_Canvas canvas, LineItem *linePtr, double *arrowPtr, Tcl_Obj *psObj); static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr); static int ConfigureLine(Tcl_Interp *interp, | | | | | | | | | | | | | | | | 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 | */ static int ArrowheadPostscript(Tcl_Interp *interp, Tk_Canvas canvas, LineItem *linePtr, double *arrowPtr, Tcl_Obj *psObj); static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr); static int ConfigureLine(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int ConfigureArrows(Tk_Canvas canvas, LineItem *linePtr); static int CreateLine(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteLine(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayLine(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static int GetLineIndex(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *obj, Tcl_Size *indexPtr); static int LineCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void LineDeleteCoords(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size first, Tcl_Size last); static void LineInsert(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size beforeThis, Tcl_Obj *obj); static int LineToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double LineToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *coordPtr); static int LineToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int ArrowParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, Tcl_Size offset); static const char * ArrowPrintProc(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); static int ParseArrowShape(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, Tcl_Size offset); static const char * PrintArrowShape(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); static void RotateLine(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleLine(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateLine(Tk_Canvas canvas, |
︙ | ︙ | |||
141 142 143 144 145 146 147 | static const Tk_CustomOption smoothOption = { TkSmoothParseProc, TkSmoothPrintProc, NULL }; static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | static const Tk_CustomOption smoothOption = { TkSmoothParseProc, TkSmoothPrintProc, NULL }; static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_CustomOption dashOption = { TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE|TK_OFFSET_INDEX) |
︙ | ︙ | |||
226 227 228 229 230 231 232 | sizeof(LineItem), /* itemSize */ CreateLine, /* createProc */ configSpecs, /* configSpecs */ ConfigureLine, /* configureProc */ LineCoords, /* coordProc */ DeleteLine, /* deleteProc */ DisplayLine, /* displayProc */ | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | sizeof(LineItem), /* itemSize */ CreateLine, /* createProc */ configSpecs, /* configSpecs */ ConfigureLine, /* configureProc */ LineCoords, /* coordProc */ DeleteLine, /* deleteProc */ DisplayLine, /* displayProc */ TK_MOVABLE_POINTS, /* flags */ LineToPoint, /* pointProc */ LineToArea, /* areaProc */ LineToPostscript, /* postscriptProc */ ScaleLine, /* scaleProc */ TranslateLine, /* translateProc */ GetLineIndex, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
275 276 277 278 279 280 281 | static int CreateLine( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | static int CreateLine( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing line. */ { LineItem *linePtr = (LineItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Carry out initialization that is needed to set defaults and to allow |
︙ | ︙ | |||
354 355 356 357 358 359 360 | static int LineCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | static int LineCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { LineItem *linePtr = (LineItem *) itemPtr; Tcl_Size i, numPoints; double *coordPtr; if (objc == 0) { Tcl_Size numCoords; Tcl_Obj *subobj, *obj = Tcl_NewObj(); numCoords = 2*linePtr->numPoints; if (linePtr->firstArrowPtr != NULL) { coordPtr = linePtr->firstArrowPtr; } else { coordPtr = linePtr->coordPtr; |
︙ | ︙ | |||
392 393 394 395 396 397 398 | if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } if (objc & 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | | | | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } if (objc & 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected an even number, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "LINE", (char *)NULL); return TCL_ERROR; } else if (objc < 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected at least 4, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "LINE", (char *)NULL); return TCL_ERROR; } numPoints = objc/2; if (linePtr->numPoints != numPoints) { coordPtr = (double *)ckalloc(sizeof(double) * objc); if (linePtr->coordPtr != NULL) { |
︙ | ︙ | |||
464 465 466 467 468 469 470 | */ static int ConfigureLine( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Line item to reconfigure. */ | | | | 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 | */ static int ConfigureLine( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Line item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { LineItem *linePtr = (LineItem *) itemPtr; XGCValues gcValues; GC newGC, arrowGC; unsigned long mask; Tk_Window tkwin; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, linePtr, flags)) { return TCL_ERROR; } /* * A few of the options require additional processing, such as graphics * contexts. */ |
︙ | ︙ | |||
645 646 647 648 649 650 651 | static void ComputeLineBbox( Tk_Canvas canvas, /* Canvas that contains item. */ LineItem *linePtr) /* Item whose bbos is to be recomputed. */ { double *coordPtr; | > | | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | static void ComputeLineBbox( Tk_Canvas canvas, /* Canvas that contains item. */ LineItem *linePtr) /* Item whose bbos is to be recomputed. */ { double *coordPtr; Tcl_Size i; int intWidth; double width; Tk_State state = linePtr->header.state; Tk_TSOffset *tsoffset; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } |
︙ | ︙ | |||
951 952 953 954 955 956 957 | *-------------------------------------------------------------- */ static void LineInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ | | | > > | | > > > > > > | | | > > < > | | > | | | | > > > > > | > > > > > > > > | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | 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 | *-------------------------------------------------------------- */ static void LineInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ Tcl_Size beforeThis, /* Index before which new coordinates are to * be inserted. */ Tcl_Obj *obj) /* New coordinates to be inserted. */ { LineItem *linePtr = (LineItem *) itemPtr; Tcl_Size 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 < 0) { beforeThis = 0; } if (beforeThis > length) { 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]; } newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc)); for (i=0; i<beforeThis; i++) { newCoordPtr[i] = linePtr->coordPtr[i]; } for (i=0; i<objc; i++) { if (Tcl_GetDoubleFromObj(NULL, objv[i], &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 (beforeThis == (Tcl_Size)-4) { objc += 2; } if (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); } } |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | *-------------------------------------------------------------- */ static void LineDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ | | | | > > | | > > > > > > > | > > > > > | > | > | > > > > > > > | | > > > > | | > > > | | | > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > | > > | | 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 | *-------------------------------------------------------------- */ static void LineDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ Tcl_Size first, /* Index of first character to delete. */ Tcl_Size 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; | | | | | 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 | 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); } } |
︙ | ︙ | |||
1679 1680 1681 1682 1683 1684 1685 | double originX, double originY, /* Origin about which to scale rect. */ double scaleX, /* Amount to scale in X direction. */ double scaleY) /* Amount to scale in Y direction. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; | | | 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 | double originX, double originY, /* Origin about which to scale rect. */ double scaleX, /* Amount to scale in X direction. */ double scaleY) /* Amount to scale in Y direction. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; Tcl_Size i; /* * Delete any arrowheads before scaling all the points (so that the * end-points of the line get restored). */ if (linePtr->firstArrowPtr != NULL) { |
︙ | ︙ | |||
1732 1733 1734 1735 1736 1737 1738 | * *-------------------------------------------------------------- */ static int GetLineIndex( Tcl_Interp *interp, /* Used for error reporting. */ | | | | | < | | | | | | | | | | > | > > > > > | > | < < < < < < | | 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 | * *-------------------------------------------------------------- */ static int GetLineIndex( Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ Tcl_Size *indexPtr) /* Where to store converted index. */ { Tcl_Size idx, length; LineItem *linePtr = (LineItem *) itemPtr; char *string; if (TCL_OK == TkGetIntForIndex(obj, 2*linePtr->numPoints - 1, 1, &idx)) { if (idx < 0) { idx = 0; } else if (idx > (2*(Tcl_Size)linePtr->numPoints)) { idx = 2*linePtr->numPoints; } else { idx &= (Tcl_Size)-2; /* If index is odd, make it even. */ } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { Tcl_Size i; double x, y, bestDist, dist, *coordPtr; char savechar; char *p, *sep; p = string+1; sep = strchr(p, ','); if (!sep) { goto badIndex; } savechar = *sep; *sep = '\0'; i = Tcl_GetDouble(NULL, p, &x); *sep = savechar; if (i != TCL_OK) { goto badIndex; } p = sep+1; i = Tcl_GetDouble(NULL, p, &y); if (i != TCL_OK) { goto badIndex; } bestDist = 1.0e36; coordPtr = linePtr->coordPtr; *indexPtr = 0; for (i=0; i<linePtr->numPoints; i++) { dist = hypot(coordPtr[0] - x, coordPtr[1] - y); if (dist < bestDist) { bestDist = dist; *indexPtr = 2*i; } coordPtr += 2; } } else { badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "LINE", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1826 1827 1828 1829 1830 1831 1832 | Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double deltaX, double deltaY) /* Amount by which item is to be moved. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; | | | 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double deltaX, double deltaY) /* Amount by which item is to be moved. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; Tcl_Size i; for (i = 0, coordPtr = linePtr->coordPtr; i < linePtr->numPoints; i++, coordPtr += 2) { coordPtr[0] += deltaX; coordPtr[1] += deltaY; } if (linePtr->firstArrowPtr != NULL) { |
︙ | ︙ | |||
1878 1879 1880 1881 1882 1883 1884 | Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; | | | 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 | Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; Tcl_Size i; double s = sin(angleRad), c = cos(angleRad); for (i = 0, coordPtr = linePtr->coordPtr; i < linePtr->numPoints; i++, coordPtr += 2) { TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]); } if (linePtr->firstArrowPtr != NULL) { |
︙ | ︙ | |||
1927 1928 1929 1930 1931 1932 1933 | ParseArrowShape( TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Window), /* Not used. */ const char *value, /* Textual specification of arrow shape. */ char *recordPtr, /* Pointer to item record in which to store * arrow information. */ | | | | 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 | ParseArrowShape( TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Window), /* Not used. */ const char *value, /* Textual specification of arrow shape. */ char *recordPtr, /* Pointer to item record in which to store * arrow information. */ Tcl_Size offset) /* Offset of shape information in widget * record. */ { LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; Tcl_Size 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) { |
︙ | ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | return TCL_OK; syntaxError: Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad arrow shape \"%s\": must be list with three numbers", value)); | | | 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 | return TCL_OK; syntaxError: Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad arrow shape \"%s\": must be list with three numbers", value)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ARROW_SHAPE", (char *)NULL); if (argv != NULL) { ckfree(argv); } return TCL_ERROR; } /* |
︙ | ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | static const char * PrintArrowShape( TCL_UNUSED(void *), /* Not used. */ TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ | | | | 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | static const char * PrintArrowShape( TCL_UNUSED(void *), /* Not used. */ TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ TCL_UNUSED(Tcl_Size), /* Offset of arrow information in record. */ Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free * string here. */ { LineItem *linePtr = (LineItem *) recordPtr; char *buffer = (char *)ckalloc(120); snprintf(buffer, 120, "%.5g %.5g %.5g", linePtr->arrowShapeA, linePtr->arrowShapeB, linePtr->arrowShapeC); *freeProcPtr = TCL_DYNAMIC; return buffer; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
2031 2032 2033 2034 2035 2036 2037 | static int ArrowParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ | | | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 | static int ArrowParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { int c; size_t length; Arrows *arrowPtr = (Arrows *) (widgRec + offset); if (value == NULL || *value == 0) { *arrowPtr = ARROWS_NONE; |
︙ | ︙ | |||
2065 2066 2067 2068 2069 2070 2071 | *arrowPtr = ARROWS_BOTH; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad arrow spec \"%s\": must be none, first, last, or both", value)); | | | 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 | *arrowPtr = ARROWS_BOTH; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad arrow spec \"%s\": must be none, first, last, or both", value)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ARROW", (char *)NULL); *arrowPtr = ARROWS_NONE; return TCL_ERROR; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
2096 2097 2098 2099 2100 2101 2102 | */ static const char * ArrowPrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ | | | 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 | */ static const char * ArrowPrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Arrows *arrowPtr = (Arrows *) (widgRec + offset); switch (*arrowPtr) { |
︙ | ︙ | |||
2354 2355 2356 2357 2358 2359 2360 | interpState = Tcl_SaveInterpState(interp, TCL_OK); /* * Check if we're just doing a "pixel". */ if (linePtr->numPoints == 1) { | | | | | | 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 | interpState = Tcl_SaveInterpState(interp, TCL_OK); /* * Check if we're just doing a "pixel". */ if (linePtr->numPoints == 1) { Tcl_AppendToObj(psObj, "matrix currentmatrix\n", TCL_INDEX_NONE); Tcl_AppendPrintfToObj(psObj, "%.15g %.15g translate %.15g %.15g", linePtr->coordPtr[0], Tk_CanvasPsY(canvas, linePtr->coordPtr[1]), width/2.0, width/2.0); Tcl_AppendToObj(psObj, " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } goto done; } /* * Generate a path for the line's center-line (do this differently for * straight lines and smoothed lines). |
︙ | ︙ | |||
2446 2447 2448 2449 2450 2451 2452 | /* * Output polygons for the arrowheads, if there are any. */ if (linePtr->firstArrowPtr != NULL) { if (stipple != None) { | | | | 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 | /* * Output polygons for the arrowheads, if there are any. */ if (linePtr->firstArrowPtr != NULL) { if (stipple != None) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } ArrowheadPostscript(interp, canvas, linePtr, linePtr->firstArrowPtr, psObj); } if (linePtr->lastArrowPtr != NULL) { if (stipple != None) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } ArrowheadPostscript(interp, canvas, linePtr, linePtr->lastArrowPtr, psObj); } /* * Plug the accumulated postscript back into the result. |
︙ | ︙ | |||
2524 2525 2526 2527 2528 2529 2530 | } Tcl_ResetResult(interp); Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { | | | | 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 | } Tcl_ResetResult(interp); Tk_CanvasPsPath(interp, canvas, arrowPtr, PTS_IN_ARROW); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
58 59 60 61 62 63 64 | static const Tk_CustomOption smoothOption = { TkSmoothParseProc, TkSmoothPrintProc, NULL }; static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | static const Tk_CustomOption smoothOption = { TkSmoothParseProc, TkSmoothPrintProc, NULL }; static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_CustomOption dashOption = { TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE|TK_OFFSET_INDEX) |
︙ | ︙ | |||
147 148 149 150 151 152 153 | /* * Prototypes for functions defined in this file: */ static void ComputePolygonBbox(Tk_Canvas canvas, PolygonItem *polyPtr); static int ConfigurePolygon(Tcl_Interp *interp, | | | | | | | | 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 | /* * Prototypes for functions defined in this file: */ static void ComputePolygonBbox(Tk_Canvas canvas, PolygonItem *polyPtr); static int ConfigurePolygon(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int CreatePolygon(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeletePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayPolygon(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static int GetPolygonIndex(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *obj, Tcl_Size *indexPtr); static int PolygonCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void PolygonDeleteCoords(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size first, Tcl_Size last); static void PolygonInsert(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size beforeThis, Tcl_Obj *obj); static int PolygonToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double PolygonToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int PolygonToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void RotatePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, |
︙ | ︙ | |||
195 196 197 198 199 200 201 | sizeof(PolygonItem), /* itemSize */ CreatePolygon, /* createProc */ configSpecs, /* configSpecs */ ConfigurePolygon, /* configureProc */ PolygonCoords, /* coordProc */ DeletePolygon, /* deleteProc */ DisplayPolygon, /* displayProc */ | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | sizeof(PolygonItem), /* itemSize */ CreatePolygon, /* createProc */ configSpecs, /* configSpecs */ ConfigurePolygon, /* configureProc */ PolygonCoords, /* coordProc */ DeletePolygon, /* deleteProc */ DisplayPolygon, /* displayProc */ TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ ScalePolygon, /* scaleProc */ TranslatePolygon, /* translateProc */ GetPolygonIndex, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
244 245 246 247 248 249 250 | static int CreatePolygon( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | static int CreatePolygon( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing polygon. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Carry out initialization that is needed in order to clean up after |
︙ | ︙ | |||
328 329 330 331 332 333 334 | static int PolygonCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | > | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | static int PolygonCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i; int numPoints; if (objc == 0) { /* * Print the coords used to create the polygon. If we auto closed the * polygon then we don't report the last point. */ |
︙ | ︙ | |||
357 358 359 360 361 362 363 | if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } if (objc & 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } } if (objc & 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected an even number, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "POLYGON", (char *)NULL); return TCL_ERROR; } numPoints = objc/2; if (polyPtr->pointsAllocated <= numPoints) { if (polyPtr->coordPtr != NULL) { ckfree(polyPtr->coordPtr); |
︙ | ︙ | |||
426 427 428 429 430 431 432 | */ static int ConfigurePolygon( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Polygon item to reconfigure. */ | | | | 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 | */ static int ConfigurePolygon( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Polygon item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; XGCValues gcValues; GC newGC; unsigned long mask; Tk_Window tkwin; XColor *color; Pixmap stipple; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, polyPtr, flags)) { return TCL_ERROR; } /* * A few of the options require additional processing, such as graphics * contexts. */ |
︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | *-------------------------------------------------------------- */ static void PolygonInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ | | | > > > | 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 | *-------------------------------------------------------------- */ static void PolygonInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Line item to be modified. */ Tcl_Size 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, nbInsPoints, i; Tcl_Size objc; 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) { | > > > > > > > > > | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 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 | /* * 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); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | *-------------------------------------------------------------- */ static void PolygonDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ | | | | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | *-------------------------------------------------------------- */ static void PolygonDeleteCoords( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ Tcl_Size first, /* Index of first character to delete. */ Tcl_Size last) /* Index of last character to delete. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int count, i; int length = 2*(polyPtr->numPoints - polyPtr->autoClosed); while ((int)first >= length) { first -= length; |
︙ | ︙ | |||
1669 1670 1671 1672 1673 1674 1675 | GetPolygonIndex( Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ | | | | | > > | | | | > > | | | | < < < < < | | 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 | GetPolygonIndex( Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in * itemPtr's line. */ Tcl_Size *indexPtr) /* Where to store converted index. */ { Tcl_Size length, idx; PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string; Tcl_Size count = 2*(polyPtr->numPoints - polyPtr->autoClosed); if (TCL_OK == TkGetIntForIndex(obj, (INT_MAX - 1) - ((INT_MAX) % count), 1, &idx)) { if (idx < 0) { idx = 0; } else if (idx >= INT_MAX - ((INT_MAX) % count)) { idx = count; } else { idx = (idx & (Tcl_Size)-2) % count; } *indexPtr = idx; return TCL_OK; } string = Tcl_GetStringFromObj(obj, &length); if (string[0] == '@') { int i; double x, y, bestDist, dist, *coordPtr; char *rest; const char *p; p = string+1; rest = strchr((char *)p, ','); *rest = '\0'; if (Tcl_GetDouble(NULL, p, &x) != TCL_OK) { *rest = ','; goto badIndex; } *rest = ','; p = rest+1; if (Tcl_GetDouble(NULL, p, &y) != TCL_OK) { goto badIndex; } bestDist = 1.0e36; coordPtr = polyPtr->coordPtr; *indexPtr = 0; for (i=0; i<polyPtr->numPoints-1; i++) { dist = hypot(coordPtr[0] - x, coordPtr[1] - y); if (dist < bestDist) { bestDist = dist; *indexPtr = 2*i; } coordPtr += 2; } } else { badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "POLY", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1925 1926 1927 1928 1929 1930 1931 | */ Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { | | | | 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | */ Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } goto done; } /* * Fill the area of the polygon. */ |
︙ | ︙ | |||
1953 1954 1955 1956 1957 1958 1959 | polyPtr->smooth->postscriptProc(interp, canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps); } Tk_CanvasPsColor(interp, canvas, fillColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { | | | | | 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 | polyPtr->smooth->postscriptProc(interp, canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps); } Tk_CanvasPsColor(interp, canvas, fillColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { Tcl_AppendToObj(psObj, "eoclip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (color != NULL) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { Tcl_AppendToObj(psObj, "eofill\n", TCL_INDEX_NONE); } } /* * Now draw the outline, if there is one. */ |
︙ | ︙ |
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" |
︙ | ︙ | |||
138 139 140 141 142 143 144 | int startX, int startY, int width, int height, Tcl_Obj *psObj); static inline Tcl_Obj * GetPostscriptBuffer(Tcl_Interp *interp); /* *-------------------------------------------------------------- * | | | | | | | 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 | int startX, int startY, int width, int height, Tcl_Obj *psObj); static inline Tcl_Obj * GetPostscriptBuffer(Tcl_Interp *interp); /* *-------------------------------------------------------------- * * TkCanvPostscriptObjCmd -- * * This function is invoked to process the "postscript" options of the * widget command for canvas widgets. See the user documentation for * details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *-------------------------------------------------------------- */ int TkCanvPostscriptObjCmd( TkCanvas *canvasPtr, /* Information about canvas widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. Caller has already parsed * this command enough to know that objv[1] is * "postscript". */ { TkPostscriptInfo psInfo, *psInfoPtr = &psInfo; Tk_PostscriptInfo oldInfoPtr; int result; Tk_Item *itemPtr; #define STRING_LENGTH 400 |
︙ | ︙ | |||
188 189 190 191 192 193 194 | /* * Get the generic preamble. We only ever bother with the ASCII encoding; * the others just make life too complicated and never actually worked as * such. */ | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /* * Get the generic preamble. We only ever bother with the ASCII encoding; * the others just make life too complicated and never actually worked as * such. */ result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { return result; } preambleObj = Tcl_GetVar2Ex(interp, "::tk::ps_preamble", NULL, TCL_LEAVE_ERR_MSG); if (preambleObj == NULL) { return TCL_ERROR; |
︙ | ︙ | |||
232 233 234 235 236 237 238 | psInfo.fileName = NULL; psInfo.channelName = NULL; psInfo.chan = NULL; psInfo.prepass = 0; psInfo.prolog = 1; psInfo.tkwin = tkwin; Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS); | | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | psInfo.fileName = NULL; psInfo.channelName = NULL; psInfo.chan = NULL; psInfo.prepass = 0; psInfo.prolog = 1; psInfo.tkwin = tkwin; Tcl_InitHashTable(&psInfo.fontTable, TCL_STRING_KEYS); result = Tk_ConfigureWidget(interp, tkwin, configSpecs, objc-2, objv+2, &psInfo, TK_CONFIG_ARGV_ONLY); if (result != TCL_OK) { goto cleanup; } if (psInfo.width == -1) { psInfo.width = Tk_Width(tkwin); } |
︙ | ︙ | |||
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 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 | } 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) { psInfo.colorLevel = 0; } else if (strncmp(psInfo.colorMode, "gray", length) == 0) { psInfo.colorLevel = 1; } else if (strncmp(psInfo.colorMode, "color", length) == 0) { psInfo.colorLevel = 2; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad color mode \"%s\": must be monochrome, gray, or color", psInfo.colorMode)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "COLORMODE", (char *)NULL); result = TCL_ERROR; goto cleanup; } } if (psInfo.fileName != NULL) { /* * Check that -file and -channel are not both specified. */ if (psInfo.channelName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify both -file and -channel", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "USAGE", (char *)NULL); result = TCL_ERROR; goto cleanup; } /* * Check that we are not in a safe interpreter. If we are, disallow * the -file specification. */ if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify -file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PS_FILE", (char *)NULL); result = TCL_ERROR; goto cleanup; } p = Tcl_TranslateFileName(interp, psInfo.fileName, &buffer); if (p == NULL) { goto cleanup; |
︙ | ︙ | |||
384 385 386 387 388 389 390 | result = TCL_ERROR; goto cleanup; } if (!(mode & TCL_WRITABLE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "channel \"%s\" wasn't opened for writing", psInfo.channelName)); | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | result = TCL_ERROR; goto cleanup; } if (!(mode & TCL_WRITABLE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "channel \"%s\" wasn't opened for writing", psInfo.channelName)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "UNWRITABLE", (char *)NULL); result = TCL_ERROR; goto cleanup; } } /* * Make a pre-pass over all of the items, generating Postscript and then |
︙ | ︙ | |||
431 432 433 434 435 436 437 | /* * Generate the header and prolog for the Postscript. */ if (psInfo.prolog) { Tcl_AppendToObj(psObj, "%!PS-Adobe-3.0 EPSF-3.0\n" | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | /* * Generate the header and prolog for the Postscript. */ if (psInfo.prolog) { Tcl_AppendToObj(psObj, "%!PS-Adobe-3.0 EPSF-3.0\n" "%%Creator: Tk Canvas Widget\n", TCL_INDEX_NONE); #ifdef HAVE_PW_GECOS if (!Tcl_IsSafe(interp)) { struct passwd *pwPtr = getpwuid(getuid()); /* INTL: Native. */ Tcl_AppendPrintfToObj(psObj, "%%%%For: %s\n", (pwPtr ? pwPtr->pw_gecos : "Unknown")); |
︙ | ︙ | |||
477 478 479 480 481 482 483 | p = "%%%%DocumentNeededResources: font %s\n"; for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_AppendPrintfToObj(psObj, p, Tcl_GetHashKey(&psInfo.fontTable, hPtr)); p = "%%%%+ font %s\n"; } | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | p = "%%%%DocumentNeededResources: font %s\n"; for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_AppendPrintfToObj(psObj, p, Tcl_GetHashKey(&psInfo.fontTable, hPtr)); p = "%%%%+ font %s\n"; } Tcl_AppendToObj(psObj, "%%EndComments\n\n", TCL_INDEX_NONE); /* * Insert the prolog */ Tcl_AppendObjToObj(psObj, preambleObj); |
︙ | ︙ | |||
510 511 512 513 514 515 516 | "%%%%BeginSetup\n/CL %d def\n", psInfo.colorLevel); for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_AppendPrintfToObj(psObj, "%%%%IncludeResource: font %s\n", (char *) Tcl_GetHashKey(&psInfo.fontTable, hPtr)); } | | | | | 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 | "%%%%BeginSetup\n/CL %d def\n", psInfo.colorLevel); for (hPtr = Tcl_FirstHashEntry(&psInfo.fontTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_AppendPrintfToObj(psObj, "%%%%IncludeResource: font %s\n", (char *) Tcl_GetHashKey(&psInfo.fontTable, hPtr)); } Tcl_AppendToObj(psObj, "%%EndSetup\n\n", TCL_INDEX_NONE); /* * Page setup: move to page positioning point, rotate if needed, set * scale factor, offset for proper anchor position, and set clip * region. */ Tcl_AppendToObj(psObj, "%%Page: 1 1\nsave\n", TCL_INDEX_NONE); Tcl_AppendPrintfToObj(psObj, "%.1f %.1f translate\n", psInfo.pageX, psInfo.pageY); if (psInfo.rotate) { Tcl_AppendToObj(psObj, "90 rotate\n", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(psObj, "%.4g %.4g scale\n", psInfo.scale, psInfo.scale); Tcl_AppendPrintfToObj(psObj, "%d %d translate\n", deltaX - psInfo.x, deltaY); Tcl_AppendPrintfToObj(psObj, "%d %.15g moveto %d %.15g lineto %d %.15g lineto %d %.15g " |
︙ | ︙ | |||
576 577 578 579 580 581 582 | if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (generating Postscript for item %d)", (int)itemPtr->id)); goto cleanup; } | | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (generating Postscript for item %d)", (int)itemPtr->id)); goto cleanup; } Tcl_AppendToObj(psObj, "gsave\n", TCL_INDEX_NONE); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "grestore\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { goto channelWriteFailed; } Tcl_DecrRefCount(psObj); |
︙ | ︙ | |||
600 601 602 603 604 605 606 | */ if (psInfo.prolog) { Tcl_AppendToObj(psObj, "restore showpage\n\n" "%%Trailer\n" "end\n" | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | */ if (psInfo.prolog) { Tcl_AppendToObj(psObj, "restore showpage\n\n" "%%Trailer\n" "end\n" "%%EOF\n", TCL_INDEX_NONE); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { goto channelWriteFailed; } } } |
︙ | ︙ | |||
783 784 785 786 787 788 789 | * there is an entry for this font, it consists of a list containing font * name and size. Use this information. */ if (psInfoPtr->fontVar != NULL) { const char *name = Tk_NameOfFont(tkfont); Tcl_Obj **objv; | | | | 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 | * there is an entry for this font, it consists of a list containing font * name and size. Use this information. */ if (psInfoPtr->fontVar != NULL) { const char *name = Tk_NameOfFont(tkfont); Tcl_Obj **objv; Tcl_Size objc; double size; Tcl_Obj *list = Tcl_GetVar2Ex(interp, psInfoPtr->fontVar, name, 0); if (list != NULL) { if (Tcl_ListObjGetElements(interp, list, &objc, &objv) != TCL_OK || objc != 2 || (fontname = Tcl_GetString(objv[0]))[0] == '\0' || strchr(fontname, ' ') != NULL || Tcl_GetDoubleFromObj(interp, objv[1], &size) != TCL_OK || size <= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad font map entry for \"%s\": \"%s\"", name, Tcl_GetString(list))); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "FONTMAP", (char *)NULL); return TCL_ERROR; } Tcl_AppendPrintfToObj(GetPostscriptBuffer(interp), "/%s findfont %d scalefont%s setfont\n", fontname, (int) size, strncasecmp(fontname, "Symbol", 7) ? " ISOEncode" : ""); |
︙ | ︙ | |||
899 900 901 902 903 904 905 | 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); | > > > > > > > > | > > > > | | | 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 | 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, "<>", TCL_INDEX_NONE); return; } Tcl_AppendToObj(psObj, "<", TCL_INDEX_NONE); mask = 0x80; value = 0; charsInLine = 0; lastX = startX + width - 1; lastY = startY + height - 1; for (y = lastY; y >= startY; y--) { for (x = startX; x <= lastX; x++) { if (XGetPixel(imagePtr, x, y)) { value |= mask; } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02x", value); mask = 0x80; value = 0; charsInLine += 2; if (charsInLine >= 60) { Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); charsInLine = 0; } } } if (mask != 0x80) { Tcl_AppendPrintfToObj(psObj, "%02x", value); mask = 0x80; value = 0; charsInLine += 2; } } Tcl_AppendToObj(psObj, ">", TCL_INDEX_NONE); XDestroyImage(imagePtr); } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
990 991 992 993 994 995 996 | XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot, (int *) &dummyX, (int *) &dummyY, (unsigned *) &width, (unsigned *) &height, &dummyBorderwidth, &dummyDepth); psObj = GetPostscriptBuffer(interp); Tcl_AppendPrintfToObj(psObj, "%d %d ", width, height); PostscriptBitmap(tkwin, bitmap, 0, 0, width, height, psObj); | | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | XGetGeometry(Tk_Display(tkwin), bitmap, &dummyRoot, (int *) &dummyX, (int *) &dummyY, (unsigned *) &width, (unsigned *) &height, &dummyBorderwidth, &dummyDepth); psObj = GetPostscriptBuffer(interp); Tcl_AppendPrintfToObj(psObj, "%d %d ", width, height); PostscriptBitmap(tkwin, bitmap, 0, 0, width, height, psObj); Tcl_AppendToObj(psObj, " StippleFill\n", TCL_INDEX_NONE); return TCL_OK; } /* *-------------------------------------------------------------- * * Tk_PostscriptY -- |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | void Tk_PostscriptPath( Tcl_Interp *interp, Tk_PostscriptInfo psInfo, /* Canvas on whose behalf Postscript is being * generated. */ double *coordPtr, /* Pointer to first in array of 2*numPoints * coordinates giving points for path. */ | | | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | void Tk_PostscriptPath( Tcl_Interp *interp, Tk_PostscriptInfo psInfo, /* Canvas on whose behalf Postscript is being * generated. */ double *coordPtr, /* Pointer to first in array of 2*numPoints * coordinates giving points for path. */ Tcl_Size numPoints) /* Number of points at *coordPtr. */ { TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo; Tcl_Obj *psObj; if (psInfoPtr->prepass) { return; } |
︙ | ︙ | |||
1092 1093 1094 1095 1096 1097 1098 | static int GetPostscriptPoints( Tcl_Interp *interp, /* Use this for error reporting. */ char *string, /* String describing a screen distance. */ double *doublePtr) /* Place to store converted result. */ { | | > | > > > > > > > > > > | | > > > > | < > > > | > > > > | < < < < < < < < < < < < < < < < < | 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 | static int GetPostscriptPoints( Tcl_Interp *interp, /* Use this for error reporting. */ char *string, /* String describing a screen distance. */ double *doublePtr) /* Place to store converted result. */ { const char *rest; double d; Tcl_DString ds; if (Tcl_GetDouble(NULL, string, &d) == TCL_OK) { *doublePtr = d; return TCL_OK; } rest = string + strlen(string); while ((rest > string) && isspace(UCHAR(rest[-1]))) { --rest; /* skip all spaces at the end */ } if (rest > string) { --rest; /* point to the character just before the last space */ } if (rest == string) { error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad distance \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "POINTS", (char *)NULL); } return TCL_ERROR; } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, string, rest-string); if (Tcl_GetDouble(NULL, Tcl_DStringValue(&ds), &d) != TCL_OK) { Tcl_DStringFree(&ds); goto error; } Tcl_DStringFree(&ds); switch (*rest) { case 'c': d *= 72.0/2.54; break; case 'i': d *= 72.0; break; case 'm': d *= 72.0/25.4; break; case 'p': break; default: goto error; } *doublePtr = d; return TCL_OK; } /* *-------------------------------------------------------------- * * TkImageGetColor -- * |
︙ | ︙ | |||
1184 1185 1186 1187 1188 1189 1190 | #define GetBValue(rgb) ((rgb & cdata->blue_mask) >> cdata->blue_shift) #endif /* _WIN32 */ #if defined(_WIN32) || defined(MAC_OSX_TK) static void TkImageGetColor( | | | | 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | #define GetBValue(rgb) ((rgb & cdata->blue_mask) >> cdata->blue_shift) #endif /* _WIN32 */ #if defined(_WIN32) || defined(MAC_OSX_TK) static void TkImageGetColor( TkColormapData *cdata, unsigned long pixel, /* Pixel value to look up */ double *red, double *green, double *blue) /* Color data to return */ { (void)cdata; *red = (double) GetRValue(pixel) / 255.0; *green = (double) GetGValue(pixel) / 255.0; *blue = (double) GetBValue(pixel) / 255.0; } #else /* ! (_WIN32 || MAC_OSX_TK) */ static void |
︙ | ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | int TkPostscriptImage( Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, /* postscript info */ XImage *ximage, /* Image to draw */ | | < | 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 | int TkPostscriptImage( Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, /* postscript info */ XImage *ximage, /* Image to draw */ int x, TCL_UNUSED(int), /* First pixel to output */ int width, int height) /* Width and height of area */ { TkPostscriptInfo *psInfoPtr = (TkPostscriptInfo *) psInfo; int xx, yy, band, maxRows; double red, green, blue; int bytesPerLine = 0, maxWidth = 0; int level = psInfoPtr->colorLevel; Colormap cmap; int i, ncolors; Visual *visual; TkColormapData cdata; Tcl_Obj *psObj; if (psInfoPtr->prepass) { return TCL_OK; } cmap = Tk_Colormap(tkwin); visual = Tk_Visual(tkwin); |
︙ | ︙ | |||
1348 1349 1350 1351 1352 1353 1354 | } if (bytesPerLine > 60000) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't generate Postscript for images more than %d pixels wide", maxWidth)); | | | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | } if (bytesPerLine > 60000) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't generate Postscript for images more than %d pixels wide", maxWidth)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", (char *)NULL); ckfree(cdata.colors); return TCL_ERROR; } maxRows = 60000 / bytesPerLine; psObj = GetPostscriptBuffer(interp); |
︙ | ︙ | |||
1394 1395 1396 1397 1398 1399 1400 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen > 60) { lineLen = 0; | | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen > 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; } } if ((width % 8) != 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); |
︙ | ︙ | |||
1422 1423 1424 1425 1426 1427 1428 | &red, &green, &blue); Tcl_AppendPrintfToObj(psObj, "%02X", (int) floor(0.5 + 255.0 * (0.30 * red + 0.59 * green + 0.11 * blue))); lineLen += 2; if (lineLen > 60) { lineLen = 0; | | | | | | 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 | &red, &green, &blue); Tcl_AppendPrintfToObj(psObj, "%02X", (int) floor(0.5 + 255.0 * (0.30 * red + 0.59 * green + 0.11 * blue))); lineLen += 2; if (lineLen > 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; default: /* * Finally, color mode. Here, just output the red, green, and * blue values directly. */ for (xx = x; xx < x+width; xx++) { TkImageGetColor(&cdata, XGetPixel(ximage, xx, yy), &red, &green, &blue); Tcl_AppendPrintfToObj(psObj, "%02X%02X%02X", (int) floor(0.5 + 255.0 * red), (int) floor(0.5 + 255.0 * green), (int) floor(0.5 + 255.0 * blue)); lineLen += 6; if (lineLen > 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; } } switch (level) { case 0: case 1: Tcl_AppendToObj(psObj, ">\n} image\n", TCL_INDEX_NONE); break; default: Tcl_AppendToObj(psObj, ">\n} false 3 colorimage\n", TCL_INDEX_NONE); break; } Tcl_AppendPrintfToObj(psObj, "0 %d translate\n", rows); } ckfree(cdata.colors); return TCL_OK; } |
︙ | ︙ | |||
1534 1535 1536 1537 1538 1539 1540 | default: bytesPerLine = 3 * width; maxWidth = 20000; break; } if (bytesPerLine > 60000) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't generate Postscript for images more than %d pixels wide", maxWidth)); | | | | | | 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 | default: bytesPerLine = 3 * width; maxWidth = 20000; break; } if (bytesPerLine > 60000) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't generate Postscript for images more than %d pixels wide", maxWidth)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", (char *)NULL); return TCL_ERROR; } /* * Set up the postscript code except for the image-data stream. */ psObj = GetPostscriptBuffer(interp); switch (colorLevel) { case 0: Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", TCL_INDEX_NONE); decode = "1 0"; bpc = 1; break; case 1: Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", TCL_INDEX_NONE); decode = "0 1"; bpc = 8; break; default: Tcl_AppendToObj(psObj, "/DeviceRGB setcolorspace\n\n", TCL_INDEX_NONE); decode = "0 1 0 1 0 1"; bpc = 8; break; } Tcl_AppendPrintfToObj(psObj, "<<\n /ImageType 1\n" |
︙ | ︙ | |||
1631 1632 1633 1634 1635 1636 1637 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen >= 60) { lineLen = 0; | | | 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; } } if ((width % 8) != 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen >= 60) { lineLen = 0; | | | 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 | } mask >>= 1; if (mask == 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); lineLen += 2; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; } } if ((width % 8) != 0) { Tcl_AppendPrintfToObj(psObj, "%02X", data); |
︙ | ︙ | |||
1696 1697 1698 1699 1700 1701 1702 | for (xx = 0; xx < width; xx ++) { alpha = *(alphaPtr + (yy * alphaPitch) + (xx * alphaIncr) + alphaOffset); Tcl_AppendPrintfToObj(psObj, "%02X", alpha | 0x01); lineLen += 2; if (lineLen >= 60) { lineLen = 0; | | | 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 | for (xx = 0; xx < width; xx ++) { alpha = *(alphaPtr + (yy * alphaPitch) + (xx * alphaIncr) + alphaOffset); Tcl_AppendPrintfToObj(psObj, "%02X", alpha | 0x01); lineLen += 2; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } /* * Generate data in gray mode; in this case, take a weighted sum * of the red, green, and blue values. */ |
︙ | ︙ | |||
1718 1719 1720 1721 1722 1723 1724 | blue = pixelPtr[blockPtr->offset[2]]; Tcl_AppendPrintfToObj(psObj, "%02X", (int) floor(0.5 + ( 0.3086 * red + 0.6094 * green + 0.0820 * blue))); lineLen += 2; if (lineLen >= 60) { lineLen = 0; | | | | | | 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 | blue = pixelPtr[blockPtr->offset[2]]; Tcl_AppendPrintfToObj(psObj, "%02X", (int) floor(0.5 + ( 0.3086 * red + 0.6094 * green + 0.0820 * blue))); lineLen += 2; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; } default: /* * Generate transparency data. We must prevent a transparent value * of 0 because of a bug in some HP printers. */ for (xx = 0; xx < width; xx ++) { alpha = *(alphaPtr + (yy * alphaPitch) + (xx * alphaIncr) + alphaOffset); Tcl_AppendPrintfToObj(psObj, "%02X", alpha | 0x01); lineLen += 2; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } /* * Finally, color mode. Here, just output the red, green, and blue * values directly. */ for (xx = 0; xx < width; xx ++) { pixelPtr = blockPtr->pixelPtr + (yy * blockPtr->pitch) + (xx * blockPtr->pixelSize); Tcl_AppendPrintfToObj(psObj, "%02X%02X%02X", pixelPtr[blockPtr->offset[0]], pixelPtr[blockPtr->offset[1]], pixelPtr[blockPtr->offset[2]]); lineLen += 6; if (lineLen >= 60) { lineLen = 0; Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; } } /* * The end-of-data marker. */ Tcl_AppendToObj(psObj, ">\n", TCL_INDEX_NONE); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 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 | /* * 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" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The structure below defines the record for each text item. */ typedef struct TextItem { Tk_Item header; /* Generic stuff that's the same for all * types. MUST BE FIRST IN STRUCTURE. */ Tk_CanvasTextInfo *textInfoPtr; /* Pointer to a structure containing * information about the selection and * insertion cursor. The structure is owned by * (and shared with) the generic canvas * code. */ /* * Fields that are set by widget commands other than "configure". */ double x, y; /* Positioning point for text. */ Tcl_Size insertPos; /* Character index of character just before * which the insertion cursor is displayed. */ /* * Configuration settings that are updated by Tk_ConfigureWidget. */ Tk_Anchor anchor; /* Where to anchor text relative to (x,y). */ Tk_TSOffset tsoffset; XColor *color; /* Color for text. */ XColor *activeColor; /* Color for text. */ XColor *disabledColor; /* Color for text. */ Tk_Font tkfont; /* Font for drawing text. */ Tk_Justify justify; /* Justification mode for text. */ 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. */ Tcl_Size numChars; /* Length of text in characters. */ Tcl_Size numBytes; /* Length of text in bytes. */ Tk_TextLayout textLayout; /* Cached text layout information. */ int actualWidth; /* Width of text as computed. Used to make * selections of wrapped text display * right. */ double drawOrigin[2]; /* Where we start drawing from. */ GC gc; /* Graphics context for drawing text. */ GC selTextGC; /* Graphics context for selected text. */ |
︙ | ︙ | |||
83 84 85 86 87 88 89 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; static int UnderlineParseProc( TCL_UNUSED(void *), /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item (ignored). */ { int *underlinePtr = (int *) (widgRec + offset); Tcl_Obj obj; int code; Tcl_Size underline; 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_NONE, 0, &underline); if (code == TCL_OK) { if (underline < INT_MIN) { underline = INT_MIN; } else if (underline > INT_MAX) { underline = INT_MAX; } *underlinePtr = (int)underline; } else { Tcl_AppendResult(interp, "bad index \"", value, "\": must be integer?[+-]integer?, end?[+-]integer?, or \"\"", (char *)NULL); } return code; } static const char * UnderlinePrintProc( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size 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; if (underline == INT_MIN) { p = (char *)""; *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) { snprintf(p, 32, "end%d", 1 + underline); } else { snprintf(p, 32, "%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}, | | | | | | | | | | | | | | 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 | 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, Tcl_Size argc, Tcl_Obj *const objv[], int flags); static int CreateText(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size 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 Tcl_Size GetSelText(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static int GetTextIndex(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Obj *obj, Tcl_Size *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, Tcl_Size index); static int TextCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void TextDeleteChars(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size first, Tcl_Size last); static void TextInsert(Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size beforeThis, Tcl_Obj *obj); static int TextToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double TextToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int TextToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void RotateText(Tk_Canvas canvas, Tk_Item *itemPtr, |
︙ | ︙ | |||
185 186 187 188 189 190 191 | sizeof(TextItem), /* itemSize */ CreateText, /* createProc */ configSpecs, /* configSpecs */ ConfigureText, /* configureProc */ TextCoords, /* coordProc */ DeleteText, /* deleteProc */ DisplayCanvText, /* displayProc */ | | | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | sizeof(TextItem), /* itemSize */ CreateText, /* createProc */ configSpecs, /* configSpecs */ ConfigureText, /* configureProc */ TextCoords, /* coordProc */ DeleteText, /* deleteProc */ DisplayCanvText, /* displayProc */ 0, /* flags */ TextToPoint, /* pointProc */ TextToArea, /* areaProc */ TextToPostscript, /* postscriptProc */ ScaleText, /* scaleProc */ TranslateText, /* translateProc */ GetTextIndex, /* indexProc */ SetTextCursor, /* icursorProc */ |
︙ | ︙ | |||
227 228 229 230 231 232 233 | static int CreateText( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | static int CreateText( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { TextItem *textPtr = (TextItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Carry out initialization that is needed in order to clean up after |
︙ | ︙ | |||
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; | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | 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; |
︙ | ︙ | |||
324 325 326 327 328 329 330 | static int TextCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | | | 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 | static int TextCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { TextItem *textPtr = (TextItem *) itemPtr; if (objc == 0) { Tcl_Obj *obj = Tcl_NewObj(); Tcl_Obj *subobj = Tcl_NewDoubleObj(textPtr->x); Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewDoubleObj(textPtr->y); Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_SetObjResult(interp, obj); return TCL_OK; } else if (objc > 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "TEXT", (char *)NULL); return TCL_ERROR; } if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "TEXT", (char *)NULL); return TCL_ERROR; } } if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &textPtr->x) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &textPtr->y) != TCL_OK)) { |
︙ | ︙ | |||
390 391 392 393 394 395 396 | */ static int ConfigureText( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ | | | | 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 | */ static int ConfigureText( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { TextItem *textPtr = (TextItem *) itemPtr; XGCValues gcValues; GC newGC, newSelGC; unsigned long mask; Tk_Window tkwin; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; XColor *selBgColorPtr; XColor *color; Pixmap stipple; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, textPtr, flags)) { return TCL_ERROR; } /* * A few of the options require additional processing, such as graphics * contexts. */ |
︙ | ︙ | |||
506 507 508 509 510 511 512 | * keep them inside the item. */ textPtr->numBytes = strlen(textPtr->text); textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes); if (textInfoPtr->selItemPtr == itemPtr) { | | | | | | 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 | * keep them inside the item. */ textPtr->numBytes = strlen(textPtr->text); textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes); if (textInfoPtr->selItemPtr == itemPtr) { if (textInfoPtr->selectFirst >= textPtr->numChars) { textInfoPtr->selItemPtr = NULL; } else { if (textInfoPtr->selectLast >= textPtr->numChars) { textInfoPtr->selectLast = textPtr->numChars - 1; } if ((textInfoPtr->anchorItemPtr == itemPtr) && (textInfoPtr->selectAnchor >= textPtr->numChars)) { textInfoPtr->selectAnchor = textPtr->numChars - 1; } } } if (textPtr->insertPos >= textPtr->numChars) { textPtr->insertPos = textPtr->numChars; } /* * Restrict so that 0.0 <= angle < 360.0, and then recompute the cached * sine and cosine of the angle. Note that fmod() can produce negative * results, and we try to avoid negative zero as well. |
︙ | ︙ | |||
561 562 563 564 565 566 567 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteText( | | < | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | * 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; | | | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | 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. */ | < < | | | < | | < < < | | | | < | < < < | | | 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 | } /* * 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; |
︙ | ︙ | |||
798 799 800 801 802 803 804 | Drawable drawable, /* Pixmap or window in which to draw item. */ int x, int y, int width, int height) /* Describes region of canvas that must be * redisplayed (not used). */ { TextItem *textPtr; Tk_CanvasTextInfo *textInfoPtr; | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | Drawable drawable, /* Pixmap or window in which to draw item. */ int x, int y, int width, int height) /* Describes region of canvas that must be * redisplayed (not used). */ { TextItem *textPtr; Tk_CanvasTextInfo *textInfoPtr; Tcl_Size selFirstChar, selLastChar; short drawableX, drawableY; Pixmap stipple; Tk_State state = itemPtr->state; textPtr = (TextItem *) itemPtr; textInfoPtr = textPtr->textInfoPtr; |
︙ | ︙ | |||
842 843 844 845 846 847 848 | selLastChar = 0; Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0], textPtr->drawOrigin[1], &drawableX, &drawableY); if (textInfoPtr->selItemPtr == itemPtr) { selFirstChar = textInfoPtr->selectFirst; selLastChar = textInfoPtr->selectLast; | | | | 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | selLastChar = 0; Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0], textPtr->drawOrigin[1], &drawableX, &drawableY); if (textInfoPtr->selItemPtr == itemPtr) { selFirstChar = textInfoPtr->selectFirst; selLastChar = textInfoPtr->selectLast; if (selLastChar > textPtr->numChars) { selLastChar = textPtr->numChars - 1; } if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) { int xFirst, yFirst, hFirst; int xLast, yLast, wLast; /* * Draw a special background under the selection. */ |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | *---------------------------------------------------------------------- */ static void TextInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Text item to be modified. */ | | | | | | | 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 | *---------------------------------------------------------------------- */ static void TextInsert( Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Text item to be modified. */ Tcl_Size index, /* Character index before which string is to * be inserted. */ Tcl_Obj *obj) /* New characters to be inserted. */ { TextItem *textPtr = (TextItem *) itemPtr; int byteIndex, charsAdded; Tcl_Size byteCount; char *newStr, *text; const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; string = Tcl_GetStringFromObj(obj, &byteCount); text = textPtr->text; if (index < 0) { index = 0; } if (index > textPtr->numChars) { index = textPtr->numChars; } byteIndex = Tcl_UtfAtIndex(text, index) - text; byteCount = strlen(string); if (byteCount == 0) { return; } |
︙ | ︙ | |||
1049 1050 1051 1052 1053 1054 1055 | /* * Inserting characters invalidates indices such as those for the * selection and cursor. Update the indices appropriately. */ if (textInfoPtr->selItemPtr == itemPtr) { | | | | | | 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 | /* * Inserting characters invalidates indices such as those for the * selection and cursor. Update the indices appropriately. */ if (textInfoPtr->selItemPtr == itemPtr) { if (textInfoPtr->selectFirst >= index) { textInfoPtr->selectFirst += charsAdded; } if (textInfoPtr->selectLast >= index) { textInfoPtr->selectLast += charsAdded; } if ((textInfoPtr->anchorItemPtr == itemPtr) && (textInfoPtr->selectAnchor >= index)) { textInfoPtr->selectAnchor += charsAdded; } } if (textPtr->insertPos >= index) { textPtr->insertPos += charsAdded; } ComputeTextBbox(canvas, textPtr); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | *-------------------------------------------------------------- */ static void TextDeleteChars( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ | | | | | | | 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 | *-------------------------------------------------------------- */ static void TextDeleteChars( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Item in which to delete characters. */ Tcl_Size first, /* Character index of first character to * delete. */ Tcl_Size last) /* Character index of last character to delete * (inclusive). */ { TextItem *textPtr = (TextItem *) itemPtr; int byteIndex, byteCount, charsRemoved; char *newStr, *text; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; text = textPtr->text; if (first < 0) { first = 0; } if (last >= textPtr->numChars) { last = textPtr->numChars - 1; } if (first > last) { return; } charsRemoved = last + 1 - first; byteIndex = Tcl_UtfAtIndex(text, first) - text; byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); |
︙ | ︙ | |||
1128 1129 1130 1131 1132 1133 1134 | /* * Update indexes for the selection and cursor to reflect the renumbering * of the remaining characters. */ if (textInfoPtr->selItemPtr == itemPtr) { | | | | | | | | | | | 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 | /* * Update indexes for the selection and cursor to reflect the renumbering * of the remaining characters. */ if (textInfoPtr->selItemPtr == itemPtr) { if (textInfoPtr->selectFirst > first) { textInfoPtr->selectFirst -= charsRemoved; if (textInfoPtr->selectFirst < first) { textInfoPtr->selectFirst = first; } } if (textInfoPtr->selectLast >= first) { textInfoPtr->selectLast -= charsRemoved; if (textInfoPtr->selectLast < first - 1) { textInfoPtr->selectLast = first - 1; } } if (textInfoPtr->selectFirst > textInfoPtr->selectLast) { textInfoPtr->selItemPtr = NULL; } if ((textInfoPtr->anchorItemPtr == itemPtr) && (textInfoPtr->selectAnchor > first)) { textInfoPtr->selectAnchor -= charsRemoved; if (textInfoPtr->selectAnchor < first) { textInfoPtr->selectAnchor = first; } } } if (textPtr->insertPos > first) { textPtr->insertPos -= charsRemoved; if (textPtr->insertPos < first) { textPtr->insertPos = first; } } ComputeTextBbox(canvas, textPtr); return; } |
︙ | ︙ | |||
1376 1377 1378 1379 1380 1381 1382 | GetTextIndex( Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular character in * itemPtr's text. */ | | | | | | | | | | | > > > > > | > | | < < < < < < | | 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 | GetTextIndex( Tcl_Interp *interp, /* Used for error reporting. */ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular character in * itemPtr's text. */ Tcl_Size *indexPtr) /* Where to store converted character * index. */ { TextItem *textPtr = (TextItem *) itemPtr; Tcl_Size length, idx; int c; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; const char *string; if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) { if (idx < 0) { idx = 0; } 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)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", (char *)NULL); return TCL_ERROR; } *indexPtr = textInfoPtr->selectFirst; } else if ((c == 's') && (length >= 5) && (strncmp(string, "sel.last", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", (char *)NULL); return TCL_ERROR; } *indexPtr = textInfoPtr->selectLast; } else if (c == '@') { int x, y; double tmp, cs = textPtr->cosine, s = textPtr->sine; char *rest; const char *p; p = string+1; rest = strchr((char *)p, ','); if (!rest) { goto badIndex; } *rest = '\0'; if (Tcl_GetDouble(NULL, p, &tmp) != TCL_OK) { *rest = ','; goto badIndex; } *rest = ','; x = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5); p = rest+1; if (Tcl_GetDouble(NULL, p, &tmp) != TCL_OK) { goto badIndex; } y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5); x -= (int) textPtr->drawOrigin[0]; y -= (int) textPtr->drawOrigin[1]; *indexPtr = Tk_PointToChar(textPtr->textLayout, (int) (x*cs - y*s), (int) (y*cs + x*s)); } else { badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "TEXT", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | */ static void SetTextCursor( TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */ Tk_Item *itemPtr, /* Text item in which cursor position is to be * set. */ | | | | 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | */ static void SetTextCursor( TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */ Tk_Item *itemPtr, /* Text item in which cursor position is to be * set. */ Tcl_Size index) /* Character index of character just before * which cursor is to be positioned. */ { TextItem *textPtr = (TextItem *) itemPtr; if (index < 0) { textPtr->insertPos = 0; } else if (index > textPtr->numChars) { textPtr->insertPos = textPtr->numChars; } else { textPtr->insertPos = index; } } |
︙ | ︙ | |||
1510 1511 1512 1513 1514 1515 1516 | * * Side effects: * None. * *-------------------------------------------------------------- */ | | | | | | | | 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 | * * Side effects: * None. * *-------------------------------------------------------------- */ static Tcl_Size GetSelText( TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */ Tk_Item *itemPtr, /* Text item containing selection. */ Tcl_Size offset, /* Byte offset within selection of first * character to be returned. */ char *buffer, /* Location in which to place selection. */ Tcl_Size maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { TextItem *textPtr = (TextItem *) itemPtr; Tcl_Size byteCount; char *text; const char *selStart, *selEnd; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; if ((textInfoPtr->selectFirst < 0) || (textInfoPtr->selectFirst > textInfoPtr->selectLast)) { return 0; } text = textPtr->text; selStart = Tcl_UtfAtIndex(text, textInfoPtr->selectFirst); selEnd = Tcl_UtfAtIndex(selStart, textInfoPtr->selectLast + 1 - textInfoPtr->selectFirst); if (selEnd <= selStart + offset) { |
︙ | ︙ | |||
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))); } | < | < > | 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 | 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 15 16 17 18 19 20 21 22 23 24 25 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Structures defined only in this file. */ typedef struct SmoothAssocData { struct SmoothAssocData *nextPtr; |
︙ | ︙ | |||
38 39 40 41 42 43 44 | }; /* * Function forward-declarations. */ | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | }; /* * Function forward-declarations. */ static void SmoothMethodCleanupProc(void *clientData, Tcl_Interp *interp); static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp); static int DashConvert(char *l, const char *p, int n, double width); static void TranslateAndAppendCoords(TkCanvas *canvPtr, double x, double y, XPoint *outArr, int numOut); static inline Tcl_Obj * GetPostscriptBuffer(Tcl_Interp *interp); |
︙ | ︙ | |||
227 228 229 230 231 232 233 | * None. * *-------------------------------------------------------------- */ int Tk_CanvasGetCoord( | | < < | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | * None. * *-------------------------------------------------------------- */ int Tk_CanvasGetCoord( TCL_UNUSED(Tcl_Interp *), /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ const char *string, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string, doublePtr) != TCL_OK) { return TCL_ERROR; } *doublePtr *= Canvas(canvas)->pixelsPerMM; return TCL_OK; } |
︙ | ︙ | |||
265 266 267 268 269 270 271 | * None. * *-------------------------------------------------------------- */ int Tk_CanvasGetCoordFromObj( | | < < | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | * None. * *-------------------------------------------------------------- */ int Tk_CanvasGetCoordFromObj( TCL_UNUSED(Tcl_Interp *), /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ Tcl_Obj *obj, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr); } /* *---------------------------------------------------------------------- * * Tk_CanvasSetStippleOrigin -- |
︙ | ︙ | |||
398 399 400 401 402 403 404 | * The tags for a given item get replaced by those indicated in the value * argument. * *-------------------------------------------------------------- */ int | | | | | | < < < | | | 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 | * The tags for a given item get replaced by those indicated in the value * argument. * *-------------------------------------------------------------- */ int Tk_CanvasTagsParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ TCL_UNUSED(Tcl_Size)) /* Offset into item (ignored). */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; Tcl_Size argc, i; const char **argv; Tk_Uid *newPtr; /* * 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; |
︙ | ︙ | |||
468 469 470 471 472 473 474 | * Side effects: * None. * *-------------------------------------------------------------- */ const char * | | | | | < < < | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | * Side effects: * None. * *-------------------------------------------------------------- */ const char * Tk_CanvasTagsPrintProc( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ TCL_UNUSED(Tcl_Size), /* Ignored. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; return ""; } if (itemPtr->numTags == 1) { *freeProcPtr = NULL; |
︙ | ︙ | |||
514 515 516 517 518 519 520 | * indicated in the value argument. * *-------------------------------------------------------------- */ int TkCanvasDashParseProc( | | | | < < < | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | * indicated in the value argument. * *-------------------------------------------------------------- */ int TkCanvasDashParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } /* *-------------------------------------------------------------- * * TkCanvasDashPrintProc -- |
︙ | ︙ | |||
551 552 553 554 555 556 557 | * None. * *-------------------------------------------------------------- */ const char * TkCanvasDashPrintProc( | | | | < < | | | | | 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 | * None. * *-------------------------------------------------------------- */ const char * TkCanvasDashPrintProc( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset in record for item. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Tk_Dash *dash = (Tk_Dash *) (widgRec+offset); char *buffer, *p; int i = dash->number; if (i < 0) { i = -i; *freeProcPtr = TCL_DYNAMIC; buffer = (char *)ckalloc((Tcl_Size)i + 1); p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; memcpy(buffer, p, (unsigned int) i); buffer[i] = 0; return buffer; } else if (!i) { *freeProcPtr = NULL; return ""; } buffer = (char *)ckalloc(4 * (Tcl_Size)i); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; snprintf(buffer, 4 * (size_t)i, "%d", *p++ & 0xff); while (--i) { snprintf(buffer + strlen(buffer), 4 * (size_t)i - strlen(buffer), " %d", *p++ & 0xff); } return buffer; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
705 706 707 708 709 710 711 | * Smooth methods are removed. * *---------------------------------------------------------------------- */ static void SmoothMethodCleanupProc( | | | < | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | * Smooth methods are removed. * *---------------------------------------------------------------------- */ static void SmoothMethodCleanupProc( void *clientData, /* Points to "smoothMethod" AssocData for the * interpreter. */ TCL_UNUSED(Tcl_Interp *)) /* Interpreter that is being deleted. */ { SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData; while (methods != NULL) { ptr = methods; methods = methods->nextPtr; ckfree(ptr); } } |
︙ | ︙ | |||
738 739 740 741 742 743 744 | * indicated in the value argument. * *-------------------------------------------------------------- */ int TkSmoothParseProc( | | | | < < | | | 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 | * indicated in the value argument. * *-------------------------------------------------------------- */ int TkSmoothParseProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { const Tk_SmoothMethod **smoothPtr = (const Tk_SmoothMethod **) (widgRec + offset); const Tk_SmoothMethod *smooth = NULL; int b; size_t length; SmoothAssocData *methods; if (value == NULL || *value == 0) { *smoothPtr = NULL; return TCL_OK; } length = strlen(value); methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Not initialized yet; fix that now. */ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* * Backward compatibility hack. */ if (strncmp(value, "bezier", length) == 0) { smooth = &tkBezierSmoothMethod; } /* * Search the list of installed smooth methods. */ while (methods != NULL) { if (strncmp(value, methods->smooth.name, length) == 0) { if (smooth != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "ambiguous smooth method \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "SMOOTH", value, (char *)NULL); return TCL_ERROR; } smooth = &methods->smooth; } methods = methods->nextPtr; } if (smooth) { |
︙ | ︙ | |||
832 833 834 835 836 837 838 | * None. * *-------------------------------------------------------------- */ const char * TkSmoothPrintProc( | | | | | < < < | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | * None. * *-------------------------------------------------------------- */ const char * TkSmoothPrintProc( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); return smoothPtr ? smoothPtr->name : "0"; } /* *-------------------------------------------------------------- * * Tk_GetDash |
︙ | ︙ | |||
873 874 875 876 877 878 879 | int Tk_GetDash( Tcl_Interp *interp, /* Used for error reporting. */ const char *value, /* Textual specification of dash list. */ Tk_Dash *dash) /* Pointer to record in which to store dash * information. */ { | > | | | 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 | int Tk_GetDash( Tcl_Interp *interp, /* Used for error reporting. */ const char *value, /* Textual specification of dash list. */ Tk_Dash *dash) /* Pointer to record in which to store dash * information. */ { Tcl_Size argc; int i; const char **largv, **argv = NULL; char *pt; if ((value == NULL) || (*value == '\0')) { dash->number = 0; return TCL_OK; } /* * switch is usually compiled more efficiently than a chain of conditions. */ switch (*value) { case '.': case ',': case '-': case '_': i = DashConvert(NULL, value, -1, 0.0); if (i <= 0) { goto badDashList; } i = (int)strlen(value); if (i > (int) sizeof(char *)) { dash->pattern.pt = pt = (char *)ckalloc(strlen(value)); } else { pt = dash->pattern.array; } memcpy(pt, value, (unsigned) i); dash->number = -i; |
︙ | ︙ | |||
924 925 926 927 928 929 930 | largv = argv; while (argc > 0) { if (Tcl_GetInt(interp, *largv, &i) != TCL_OK || i < 1 || i>255) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer in the range 1..255 but got \"%s\"", *largv)); | | | | 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 | largv = argv; while (argc > 0) { if (Tcl_GetInt(interp, *largv, &i) != TCL_OK || i < 1 || i>255) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer in the range 1..255 but got \"%s\"", *largv)); Tcl_SetErrorCode(interp, "TK", "VALUE", "DASH", (char *)NULL); goto syntaxError; } *pt++ = i; argc--; largv++; } if (argv != NULL) { ckfree(argv); } return TCL_OK; /* * Something went wrong. Generate error message, clean up and return. */ badDashList: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad dash list \"%s\": must be a list of integers or a format like \"-..\"", value)); Tcl_SetErrorCode(interp, "TK", "VALUE", "DASH", (char *)NULL); syntaxError: if (argv != NULL) { ckfree(argv); } if ((unsigned) ABS(dash->number) > sizeof(char *)) { ckfree(dash->pattern.pt); } |
︙ | ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | } } Tcl_AppendPrintfToObj(psObj, "%.15g setlinewidth\n", width); ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; | | | | | | | | 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 | } } Tcl_AppendPrintfToObj(psObj, "%.15g setlinewidth\n", width); ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; Tcl_AppendToObj(psObj, "[", TCL_INDEX_NONE); if (dash->number > 0) { Tcl_Obj *converted; char *p = ptr; converted = Tcl_ObjPrintf("%d", *p++ & 0xff); for (i = dash->number-1 ; i>0 ; i--) { Tcl_AppendPrintfToObj(converted, " %d", *p++ & 0xff); } Tcl_AppendObjToObj(psObj, converted); if (dash->number & 1) { Tcl_AppendToObj(psObj, " ", TCL_INDEX_NONE); Tcl_AppendObjToObj(psObj, converted); } Tcl_DecrRefCount(converted); Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else if (dash->number < 0) { if (dash->number < -5) { lptr = (char *)ckalloc(1 - 2*dash->number); } i = DashConvert(lptr, ptr, -dash->number, width); if (i > 0) { char *p = lptr; Tcl_AppendPrintfToObj(psObj, "%d", *p++ & 0xff); for (; --i>0 ;) { Tcl_AppendPrintfToObj(psObj, " %d", *p++ & 0xff); } Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else { Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } if (lptr != pattern) { ckfree(lptr); } } else { Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } Tk_CanvasPsColor(interp, canvas, color); if (stipple != None) { Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", TCL_INDEX_NONE); Tk_CanvasPsStipple(interp, canvas, stipple); } else { Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", TCL_INDEX_NONE); } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1657 1658 1659 1660 1661 1662 1663 | int TkCanvTranslatePath( TkCanvas *canvPtr, /* The canvas */ int numVertex, /* Number of vertices specified by * coordArr[] */ double *coordArr, /* X and Y coordinates for each vertex */ | | < | 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 | int TkCanvTranslatePath( TkCanvas *canvPtr, /* The canvas */ int numVertex, /* Number of vertices specified by * coordArr[] */ double *coordArr, /* X and Y coordinates for each vertex */ TCL_UNUSED(int), /* True if this is a closed polygon */ XPoint *outArr) /* Write results here, if not NULL */ { int numOutput = 0; /* Number of output coordinates */ double lft, rgh; /* Left and right sides of the bounding box */ double top, btm; /* Top and bottom sizes of the bounding box */ double *tempArr; /* Temporary storage used by the clipper */ double *a, *b, *t; /* Pointers to parts of the temporary * storage */ int i, j; /* Loop counters */ double limit[4]; /* Boundries at which clipping occurs */ double staticSpace[480]; /* Temp space from the stack */ /* * Constrain all vertices of the path to be within a box that is no larger * than 32000 pixels wide or height. The top-left corner of this clipping * box is 1000 pixels above and to the left of the top left corner of the * window on which the canvas is displayed. * |
︙ | ︙ |
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" |
︙ | ︙ | |||
37 38 39 40 41 42 43 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, "0", offsetof(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, |
︙ | ︙ | |||
63 64 65 66 67 68 69 | /* * Prototypes for functions defined in this file: */ static void ComputeWindowBbox(Tk_Canvas canvas, WindowItem *winItemPtr); static int ConfigureWinItem(Tcl_Interp *interp, | | | | | | | | | | 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 | /* * Prototypes for functions defined in this file: */ static void ComputeWindowBbox(Tk_Canvas canvas, WindowItem *winItemPtr); static int ConfigureWinItem(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int CreateWinItem(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void WinItemLostContentProc(void *clientData, Tk_Window tkwin); static void WinItemRequestProc(void *clientData, Tk_Window tkwin); static void WinItemStructureProc(void *clientData, XEvent *eventPtr); static int WinItemToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static int WinItemToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static double WinItemToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); #ifdef X_GetImage static int xerrorhandler(void *clientData, XErrorEvent *e); #endif static int CanvasPsWindow(Tcl_Interp *interp, Tk_Window tkwin, Tk_Canvas canvas, double x, double y, int width, int height); /* * The structure below defines the window item type by means of functions * that can be invoked by generic item code. */ Tk_ItemType tkWindowType = { "window", /* name */ sizeof(WindowItem), /* itemSize */ CreateWinItem, /* createProc */ configSpecs, /* configSpecs */ ConfigureWinItem, /* configureProc */ WinItemCoords, /* coordProc */ DeleteWinItem, /* deleteProc */ DisplayWinItem, /* displayProc */ TK_ALWAYS_REDRAW, /* flags */ WinItemToPoint, /* pointProc */ WinItemToArea, /* areaProc */ WinItemToPostscript, /* postscriptProc */ ScaleWinItem, /* scaleProc */ TranslateWinItem, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ |
︙ | ︙ | |||
168 169 170 171 172 173 174 | static int CreateWinItem( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | static int CreateWinItem( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing window. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Initialize item's record. |
︙ | ︙ | |||
206 207 208 209 210 211 212 | if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; } } if (WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) { goto error; } | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; } } if (WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) { goto error; } if (ConfigureWinItem(interp, canvas, itemPtr, objc - i, objv + i, 0) == TCL_OK) { return TCL_OK; } error: DeleteWinItem(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas))); return TCL_ERROR; |
︙ | ︙ | |||
239 240 241 242 243 244 245 | static int WinItemCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | | | | | 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 | static int WinItemCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; if (objc == 0) { Tcl_Obj *objs[2]; objs[0] = Tcl_NewDoubleObj(winItemPtr->x); objs[1] = Tcl_NewDoubleObj(winItemPtr->y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, objs)); } else if (objc < 3) { if (objc==1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "WINDOW", (char *)NULL); return TCL_ERROR; } } if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &winItemPtr->x) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1], &winItemPtr->y) != TCL_OK)) { return TCL_ERROR; } ComputeWindowBbox(canvas, winItemPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 2, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "WINDOW", (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
301 302 303 304 305 306 307 | */ static int ConfigureWinItem( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Window item to reconfigure. */ | | | | 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 | */ static int ConfigureWinItem( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Window item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; Tk_Window oldWindow; Tk_Window canvasTkwin; oldWindow = winItemPtr->tkwin; canvasTkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc, objv, winItemPtr, flags)) { return TCL_ERROR; } /* * A few of the options require additional processing. */ |
︙ | ︙ | |||
374 375 376 377 378 379 380 | ComputeWindowBbox(canvas, winItemPtr); return TCL_OK; badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use %s in a window item of this canvas", Tk_PathName(winItemPtr->tkwin))); | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | ComputeWindowBbox(canvas, winItemPtr); return TCL_OK; badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use %s in a window item of this canvas", Tk_PathName(winItemPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL); winItemPtr->tkwin = NULL; return TCL_ERROR; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
400 401 402 403 404 405 406 | *-------------------------------------------------------------- */ static void DeleteWinItem( Tk_Canvas canvas, /* Overall info about widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ | | < | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | *-------------------------------------------------------------- */ static void DeleteWinItem( Tk_Canvas canvas, /* Overall info about widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ TCL_UNUSED(Display *)) /* Display containing window for canvas. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); if (winItemPtr->tkwin != NULL) { Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, WinItemStructureProc, winItemPtr); Tk_ManageGeometry(winItemPtr->tkwin, NULL, NULL); if (canvasTkwin != Tk_Parent(winItemPtr->tkwin)) { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); |
︙ | ︙ | |||
514 515 516 517 518 519 520 | y -= height; break; case TK_ANCHOR_W: y -= height/2; break; case TK_ANCHOR_NW: break; | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | 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. |
︙ | ︙ | |||
556 557 558 559 560 561 562 | *-------------------------------------------------------------- */ static void DisplayWinItem( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ | | < | | > > < < < < < > > > > | 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 | *-------------------------------------------------------------- */ static void DisplayWinItem( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ TCL_UNUSED(Display *), /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ TCL_UNUSED(int), /* Describes region of canvas that must be */ TCL_UNUSED(int), /* redisplayed (not used). */ TCL_UNUSED(int), TCL_UNUSED(int)) { WindowItem *winItemPtr = (WindowItem *) itemPtr; int width, height; short x, y; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); Tk_State state = itemPtr->state; 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); } | > > > | > > > | 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 | 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 -- * |
︙ | ︙ | |||
654 655 656 657 658 659 660 | * None. * *-------------------------------------------------------------- */ static double WinItemToPoint( | | < | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | * None. * *-------------------------------------------------------------- */ static double WinItemToPoint( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against point. */ double *pointPtr) /* Pointer to x and y coordinates. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; x1 = winItemPtr->header.x1; y1 = winItemPtr->header.y1; x2 = winItemPtr->header.x2; y2 = winItemPtr->header.y2; /* |
︙ | ︙ | |||
711 712 713 714 715 716 717 | * None. * *-------------------------------------------------------------- */ static int WinItemToArea( | | < | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | * None. * *-------------------------------------------------------------- */ static int WinItemToArea( TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against rectangle. */ double *rectPtr) /* Pointer to array of four coordinates * (x1,y1,x2,y2) describing rectangular * area. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; if ((rectPtr[2] <= winItemPtr->header.x1) || (rectPtr[0] >= winItemPtr->header.x2) || (rectPtr[3] <= winItemPtr->header.y1) || (rectPtr[1] >= winItemPtr->header.y2)) { return -1; } |
︙ | ︙ | |||
755 756 757 758 759 760 761 | * *-------------------------------------------------------------- */ #ifdef X_GetImage static int xerrorhandler( | | | < < < | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | * *-------------------------------------------------------------- */ #ifdef X_GetImage static int xerrorhandler( TCL_UNUSED(void *), TCL_UNUSED(XErrorEvent *)) { return 0; } #endif /* X_GetImage */ /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
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; | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | 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( |
︙ | ︙ | |||
871 872 873 874 875 876 877 | if (result == TCL_OK) { Tcl_AppendPrintfToObj(psObj, "50 dict begin\nsave\ngsave\n" "0 %d moveto %d 0 rlineto 0 -%d rlineto -%d 0 rlineto closepath\n" "1.000 1.000 1.000 setrgbcolor AdjustColor\nfill\ngrestore\n", height, width, height, width); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); | | | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | if (result == TCL_OK) { Tcl_AppendPrintfToObj(psObj, "50 dict begin\nsave\ngsave\n" "0 %d moveto %d 0 rlineto 0 -%d rlineto -%d 0 rlineto closepath\n" "1.000 1.000 1.000 setrgbcolor AdjustColor\nfill\ngrestore\n", height, width, height, width); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "\nrestore\nend\n\n\n", TCL_INDEX_NONE); goto done; } /* * If the window is off the screen it will generate a BadMatch/XError. We * catch any BadMatch errors here */ |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | * The window is disassociated from the window item when it is deleted. * *-------------------------------------------------------------- */ static void WinItemStructureProc( | | | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | * The window is disassociated from the window item when it is deleted. * *-------------------------------------------------------------- */ static void WinItemStructureProc( void *clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { WindowItem *winItemPtr = (WindowItem *)clientData; if (eventPtr->type == DestroyNotify) { winItemPtr->tkwin = NULL; } |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 | * depending on the options specified for the window item. * *-------------------------------------------------------------- */ static void WinItemRequestProc( | | | < | 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | * depending on the options specified for the window item. * *-------------------------------------------------------------- */ static void WinItemRequestProc( void *clientData, /* Pointer to record for window item. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { WindowItem *winItemPtr = (WindowItem *)clientData; ComputeWindowBbox(winItemPtr->canvas, winItemPtr); /* * A drawable argument of None to DisplayWinItem is used by the canvas * UnmapNotify handler to indicate that we should no longer display * ourselves, so need to pass a (bogus) non-zero drawable value here. |
︙ | ︙ | |||
1114 1115 1116 1117 1118 1119 1120 | * Forgets all canvas-related information about the content window. * *-------------------------------------------------------------- */ static void WinItemLostContentProc( | | | < | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | * Forgets all canvas-related information about the content window. * *-------------------------------------------------------------- */ static void WinItemLostContentProc( void *clientData, /* WindowItem structure for content window window that * was stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { WindowItem *winItemPtr = (WindowItem *)clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, WinItemStructureProc, winItemPtr); if (canvasTkwin != Tk_Parent(winItemPtr->tkwin)) { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } Tk_UnmapWindow(winItemPtr->tkwin); |
︙ | ︙ |
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 30 31 32 | /* * 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 #ifdef _WIN32 #include "tkWinInt.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 |
︙ | ︙ | |||
48 49 50 51 52 53 54 | Tk_Item *currentPtr; /* Pointer to last item returned. */ Tk_Item *lastPtr; /* The item right before the currentPtr is * tracked so if the currentPtr is deleted we * don't have to start from the beginning. */ int searchOver; /* Non-zero means NextItem should always * return NULL. */ int type; /* Search type (see #defs below) */ | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | Tk_Item *currentPtr; /* Pointer to last item returned. */ Tk_Item *lastPtr; /* The item right before the currentPtr is * tracked so if the currentPtr is deleted we * don't have to start from the beginning. */ int searchOver; /* Non-zero means NextItem should always * return NULL. */ int type; /* Search type (see #defs below) */ Tcl_Size id; /* Item id for searches by id */ const char *string; /* Tag expression string */ int stringIndex; /* Current position in string scan */ int stringLength; /* Length of tag expression string */ char *rewritebuffer; /* Tag string (after removing escapes) */ unsigned int rewritebufferAllocated; /* Available space for rewrites. */ TagSearchExpr *expr; /* Compiled tag expression. */ |
︙ | ︙ | |||
212 213 214 215 216 217 218 | static Tcl_ThreadDataKey dataKey; static SearchUids * GetStaticUids(void); /* * Prototypes for functions defined later in this file: */ | | | | | | | | | | | | | | | | | | | | | < | 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 | 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 Tcl_Size CanvasFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size 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, Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const *objv, int flags); static void DefaultRotateImplementation(TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians); static Tcl_FreeProc DestroyCanvas; 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, Tcl_Size objc, Tcl_Obj *const *objv, Tcl_Obj *newTagObj, Tcl_Size 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 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); |
︙ | ︙ | |||
320 321 322 323 324 325 326 | * ---------------------------------------------------------------------- */ static inline int AlwaysRedraw( Tk_Item *itemPtr) { | | | < < | | < < < < < < < < < < | | | < < < < < | < < < | < < | < < < < < < < < < < | 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 | * ---------------------------------------------------------------------- */ static inline int AlwaysRedraw( Tk_Item *itemPtr) { return itemPtr->typePtr->flags & TK_ALWAYS_REDRAW; } static inline int ItemConfigure( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; return itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY); } static inline int ItemConfigInfo( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Obj *fieldName) { return Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin, itemPtr->typePtr->configSpecs, itemPtr, (fieldName ? Tcl_GetString(fieldName) : NULL), 0); } static inline int ItemConfigValue( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Obj *fieldName) { return Tk_ConfigureValue(canvasPtr->interp, canvasPtr->tkwin, itemPtr->typePtr->configSpecs, itemPtr, Tcl_GetString(fieldName), 0); } static inline int ItemCoords( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; int result; if (itemPtr->typePtr->coordProc == NULL) { result = TCL_OK; } else { result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objc, objv); } return result; } static inline int ItemCreate( TkCanvas *canvasPtr, Tk_Item *itemPtr, /* Warning: incomplete! typePtr field must be * set by this point. */ Tcl_Size objc, Tcl_Obj *const objv[]) { Tcl_Interp *interp = canvasPtr->interp; return itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3); } static inline void ItemCursor( TkCanvas *canvasPtr, Tk_Item *itemPtr, int index) |
︙ | ︙ | |||
468 469 470 471 472 473 474 | } static int ItemIndex( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Obj *objPtr, | | < > | | < < < < < | | < < < < | 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 | } static int ItemIndex( TkCanvas *canvasPtr, Tk_Item *itemPtr, Tcl_Obj *objPtr, Tcl_Size *indexPtr) { Tcl_Interp *interp = canvasPtr->interp; if (itemPtr->typePtr->indexProc == NULL) { return TCL_OK; } return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr, itemPtr, objPtr, indexPtr); } static inline void ItemInsert( TkCanvas *canvasPtr, Tk_Item *itemPtr, int beforeThis, Tcl_Obj *toInsert) { itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr, beforeThis, toInsert); } static inline int ItemOverlap( TkCanvas *canvasPtr, Tk_Item *itemPtr, double rect[]) |
︙ | ︙ | |||
533 534 535 536 537 538 539 | double xOrigin, double yOrigin, double xScale, double yScale) { itemPtr->typePtr->scaleProc((Tk_Canvas) canvasPtr, itemPtr, xOrigin, yOrigin, xScale, yScale); } | | | | | | 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 | double xOrigin, double yOrigin, double xScale, double yScale) { itemPtr->typePtr->scaleProc((Tk_Canvas) canvasPtr, itemPtr, xOrigin, yOrigin, xScale, yScale); } static inline Tcl_Size ItemSelection( TkCanvas *canvasPtr, Tk_Item *itemPtr, int offset, char *buffer, Tcl_Size maxBytes) { if (itemPtr == NULL || itemPtr->typePtr->selectionProc == NULL) { return TCL_INDEX_NONE; } return itemPtr->typePtr->selectionProc((Tk_Canvas) canvasPtr, itemPtr, offset, buffer, (int)maxBytes); } static inline void ItemTranslate( TkCanvas *canvasPtr, Tk_Item *itemPtr, double xDelta, |
︙ | ︙ | |||
595 596 597 598 599 600 601 | DefaultRotateImplementation( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { | > | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | DefaultRotateImplementation( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { Tcl_Size i, objc; int ok = 1; Tcl_Obj **objv, **newObjv; double *coordv; double s = sin(angleRadians); double c = cos(angleRadians); Tcl_Interp *interp = canvasPtr->interp; /* |
︙ | ︙ | |||
644 645 646 647 648 649 650 | newObjv[i] = Tcl_NewDoubleObj(coordv[i]); Tcl_IncrRefCount(newObjv[i]); } ItemCoords(canvasPtr, itemPtr, objc, newObjv); for (i=0 ; i<objc ; i++) { Tcl_DecrRefCount(newObjv[i]); } | | | | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | newObjv[i] = Tcl_NewDoubleObj(coordv[i]); Tcl_IncrRefCount(newObjv[i]); } ItemCoords(canvasPtr, itemPtr, objc, newObjv); for (i=0 ; i<objc ; i++) { Tcl_DecrRefCount(newObjv[i]); } ckfree(newObjv); } ckfree(coordv); } /* * The interpreter result was (probably) modified above; reset it. */ Tcl_ResetResult(interp); |
︙ | ︙ | |||
675 676 677 678 679 680 681 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_CanvasObjCmd( | | | | | | | | 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 | * 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); | | | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | 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( | | | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | * 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 |
︙ | ︙ | |||
883 884 885 886 887 888 889 | result = TCL_ERROR; goto done; } result = FIND_ITEMS(objv[2], 3); break; case CANV_BBOX: { | | > | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | result = TCL_ERROR; goto done; } result = FIND_ITEMS(objv[2], 3); break; case CANV_BBOX: { int gotAny; Tcl_Size i; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; /* Initializations needed only * to prevent overcautious * compiler warnings. */ if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?tagOrId ...?"); result = TCL_ERROR; |
︙ | ︙ | |||
966 967 968 969 970 971 972 | object = itemPtr; } if (object == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item \"%s\" doesn't exist", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM", | | | 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | object = itemPtr; } if (object == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item \"%s\" doesn't exist", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM", Tcl_GetString(objv[2]), (char *)NULL); result = TCL_ERROR; goto done; } } else { object = (char *)searchPtr->expr->uid; } |
︙ | ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) { Tk_DeleteBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3])); Tcl_SetObjResult(interp, Tcl_NewStringObj( "requested illegal events; only key, button, motion," | | | | 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) { Tk_DeleteBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3])); Tcl_SetObjResult(interp, Tcl_NewStringObj( "requested illegal events; only key, button, motion," " enter, leave, and virtual events may be used", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "BAD_EVENTS", (char *)NULL); result = TCL_ERROR; goto done; } } else if (objc == 4) { const char *command; command = Tk_GetBinding(interp, canvasPtr->bindingTable, |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | if (string[0] != '\0') { result = TCL_ERROR; goto done; } Tcl_ResetResult(interp); } else { | | | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | if (string[0] != '\0') { result = TCL_ERROR; goto done; } Tcl_ResetResult(interp); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj(command, TCL_INDEX_NONE)); } } else { Tk_GetAllBindings(interp, canvasPtr->bindingTable, object); } break; } case CANV_CANVASX: { |
︙ | ︙ | |||
1134 1135 1136 1137 1138 1139 1140 | case CANV_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } result = Tk_ConfigureValue(interp, canvasPtr->tkwin, configSpecs, | | | | | 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | case CANV_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } result = Tk_ConfigureValue(interp, canvasPtr->tkwin, configSpecs, canvasPtr, Tcl_GetString(objv[2]), 0); break; case CANV_CONFIGURE: if (objc == 2) { result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs, canvasPtr, NULL, 0); } else if (objc == 3) { result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs, canvasPtr, Tcl_GetString(objv[2]), 0); } else { result = ConfigureCanvas(interp, canvasPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } break; case CANV_COORDS: if (objc < 3) { |
︙ | ︙ | |||
1190 1191 1192 1193 1194 1195 1196 | * Make a temporary object here that we can reuse for all the * modifications in the loop. */ tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { | | | | 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 | * Make a temporary object here that we can reuse for all the * modifications in the loop. */ tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { Tcl_Size index; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; /* * The TK_MOVABLE_POINTS flag should only be set for types that * support the same semantics of index, dChars and insert methods * as lines and canvases. */ if (itemPtr == NULL || !(itemPtr->typePtr->flags & TK_MOVABLE_POINTS)) { continue; } result = ItemIndex(canvasPtr, itemPtr, objv[3], &index); if (result != TCL_OK) { break; } |
︙ | ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | } case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; | | | | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | } case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; Tcl_Size 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. */ |
︙ | ︙ | |||
1285 1286 1287 1288 1289 1290 1291 | Tcl_MutexUnlock(&typeListMutex); if (matchPtr == NULL) { badType: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown or ambiguous item type \"%s\"", arg)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM_TYPE", arg, | | | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | Tcl_MutexUnlock(&typeListMutex); if (matchPtr == NULL) { badType: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown or ambiguous item type \"%s\"", arg)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM_TYPE", arg, (char *)NULL); result = TCL_ERROR; goto done; } if (objc < 4) { /* * Allow more specific error return. */ |
︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | itemPtr->redraw_flags |= FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); break; } case CANV_DCHARS: { | | | 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | itemPtr->redraw_flags |= FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); break; } case CANV_DCHARS: { Tcl_Size first, last; int x1, x2, y1, y2; if ((objc != 4) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first ?last?"); result = TCL_ERROR; goto done; } |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } break; } case CANV_DELETE: { | | | 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } break; } case CANV_DELETE: { Tcl_Size i; Tcl_HashEntry *entryPtr; for (i = 2; i < objc; i++) { FOR_EVERY_CANVAS_ITEM_MATCHING(objv[i], &searchPtr, goto done) { EventuallyRedrawItem(canvasPtr, itemPtr); if (canvasPtr->bindingTable != NULL) { Tk_DeleteAllBindings(canvasPtr->bindingTable, itemPtr); |
︙ | ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | } } } break; } case CANV_DTAG: { Tk_Uid tag; | | | | 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 | } } } break; } case CANV_DTAG: { Tk_Uid tag; Tcl_Size 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), |
︙ | ︙ | |||
1527 1528 1529 1530 1531 1532 1533 | FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done); if (itemPtr != NULL) { int i; Tcl_Obj *resultObj = Tcl_NewObj(); for (i = 0; i < (int)itemPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, resultObj, | | | | 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done); if (itemPtr != NULL) { int i; Tcl_Obj *resultObj = Tcl_NewObj(); for (i = 0; i < (int)itemPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(itemPtr->tagPtr[i], TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); } break; case CANV_ICURSOR: { Tcl_Size index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index"); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { |
︙ | ︙ | |||
1558 1559 1560 1561 1562 1563 1564 | && (canvasPtr->textInfo.cursorOn)) { EventuallyRedrawItem(canvasPtr, itemPtr); } } break; } case CANV_INDEX: { | | | | | 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 | && (canvasPtr->textInfo.cursorOn)) { EventuallyRedrawItem(canvasPtr, itemPtr); } } break; } case CANV_INDEX: { Tcl_Size index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string"); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { if (itemPtr->typePtr->indexProc != NULL) { break; } } if (itemPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find an indexable item \"%s\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "CANVAS", "INDEXABLE_ITEM", (char *)NULL); result = TCL_ERROR; goto done; } result = ItemIndex(canvasPtr, itemPtr, objv[3], &index); if (result != TCL_OK) { goto done; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } case CANV_INSERT: { Tcl_Size beforeThis; int x1, x2, y1, y2; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId beforeThis string"); result = TCL_ERROR; goto done; } |
︙ | ︙ | |||
1767 1768 1769 1770 1771 1772 1773 | EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; } } break; } case CANV_POSTSCRIPT: { | < < | < < < | 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 | EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; } } break; } case CANV_POSTSCRIPT: { result = TkCanvPostscriptObjCmd(canvasPtr, interp, objc, objv); break; } case CANV_RAISE: { Tk_Item *prevPtr; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?aboveThis?"); |
︙ | ︙ | |||
1803 1804 1805 1806 1807 1808 1809 | goto done; } } RELINK_ITEMS(objv[2], prevPtr); break; } case CANV_RCHARS: { | | | 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | goto done; } } RELINK_ITEMS(objv[2], prevPtr); break; } case CANV_RCHARS: { Tcl_Size first, last; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; if (objc != 6) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId first last string"); result = TCL_ERROR; goto done; |
︙ | ︙ | |||
1898 1899 1900 1901 1902 1903 1904 | || (Tcl_GetDoubleFromObj(interp, objv[5], &xScale)!=TCL_OK) || (Tcl_GetDoubleFromObj(interp, objv[6], &yScale)!=TCL_OK)) { result = TCL_ERROR; goto done; } if ((xScale == 0.0) || (yScale == 0.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | | | 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 | || (Tcl_GetDoubleFromObj(interp, objv[5], &xScale)!=TCL_OK) || (Tcl_GetDoubleFromObj(interp, objv[6], &yScale)!=TCL_OK)) { result = TCL_ERROR; goto done; } if ((xScale == 0.0) || (yScale == 0.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "scale factor cannot be zero", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "BAD_SCALE", (char *)NULL); result = TCL_ERROR; goto done; } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { EventuallyRedrawItem(canvasPtr, itemPtr); ItemScale(canvasPtr, itemPtr, xOrigin, yOrigin, xScale, yScale); EventuallyRedrawItem(canvasPtr, itemPtr); 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; |
︙ | ︙ | |||
1956 1957 1958 1959 1960 1961 1962 | - canvasPtr->scrollY1; newYOrigin = canvasPtr->scrollY1 + tmp; CanvasSetOrigin(canvasPtr, newXOrigin, newYOrigin); } break; } case CANV_SELECT: { | | | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 | - canvasPtr->scrollY1; newYOrigin = canvasPtr->scrollY1 + tmp; CanvasSetOrigin(canvasPtr, newXOrigin, newYOrigin); } break; } case CANV_SELECT: { Tcl_Size index; int optionindex; static const char *const optionStrings[] = { "adjust", "clear", "from", "item", "to", NULL }; enum options { CANV_ADJUST, CANV_CLEAR, CANV_FROM, CANV_ITEM, CANV_TO }; |
︙ | ︙ | |||
1982 1983 1984 1985 1986 1987 1988 | } } if (itemPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find an indexable and selectable item \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SELECTABLE_ITEM", | | | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 | } } if (itemPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find an indexable and selectable item \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SELECTABLE_ITEM", (char *)NULL); result = TCL_ERROR; goto done; } } if (objc == 5) { result = ItemIndex(canvasPtr, itemPtr, objv[4], &index); if (result != TCL_OK) { |
︙ | ︙ | |||
2066 2067 2068 2069 2070 2071 2072 | Tcl_WrongNumArgs(interp, 2, objv, "tag"); result = TCL_ERROR; goto done; } FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done); if (itemPtr != NULL) { Tcl_SetObjResult(interp, | | < < | < < < < < < > > > < < | < < < < < < > > > | 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 | Tcl_WrongNumArgs(interp, 2, objv, "tag"); result = TCL_ERROR; goto done; } FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done); if (itemPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(itemPtr->typePtr->name, TCL_INDEX_NONE)); } break; case CANV_XVIEW: { int count, type; int newX = 0; /* Initialization needed only to prevent gcc * warnings. */ double fraction; if (objc == 2) { Tcl_SetObjResult(interp, ScrollFractions( canvasPtr->xOrigin + canvasPtr->inset, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin) - canvasPtr->inset, canvasPtr->scrollX1, canvasPtr->scrollX2)); break; } type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count); switch (type) { case TK_SCROLL_MOVETO: newX = canvasPtr->scrollX1 - canvasPtr->inset + (int) (fraction * (canvasPtr->scrollX2 - canvasPtr->scrollX1) + 0.5); break; case TK_SCROLL_PAGES: newX = (int) (canvasPtr->xOrigin + count * .9 * (Tk_Width(canvasPtr->tkwin) - 2*canvasPtr->inset)); break; case TK_SCROLL_UNITS: if (canvasPtr->xScrollIncrement > 0) { newX = canvasPtr->xOrigin + count*canvasPtr->xScrollIncrement; } else { newX = (int) (canvasPtr->xOrigin + count * .1 * (Tk_Width(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; default: result = TCL_ERROR; goto done; } CanvasSetOrigin(canvasPtr, newX, canvasPtr->yOrigin); break; } case CANV_YVIEW: { int count, type; int newY = 0; /* Initialization needed only to prevent gcc * warnings. */ double fraction; if (objc == 2) { Tcl_SetObjResult(interp, ScrollFractions( canvasPtr->yOrigin + canvasPtr->inset, canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin) - canvasPtr->inset, canvasPtr->scrollY1, canvasPtr->scrollY2)); break; } type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count); switch (type) { case TK_SCROLL_MOVETO: newY = canvasPtr->scrollY1 - canvasPtr->inset + (int) ( fraction*(canvasPtr->scrollY2-canvasPtr->scrollY1) + 0.5); break; case TK_SCROLL_PAGES: newY = (int) (canvasPtr->yOrigin + count * .9 * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); break; case TK_SCROLL_UNITS: if (canvasPtr->yScrollIncrement > 0) { newY = canvasPtr->yOrigin + count*canvasPtr->yScrollIncrement; } else { newY = (int) (canvasPtr->yOrigin + count * .1 * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; default: result = TCL_ERROR; goto done; } CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY); break; } case CANV_IMAGE: { Tk_PhotoHandle photohandle; int subsample = 1, zoom = 1; |
︙ | ︙ | |||
2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 | * Everything associated with the canvas is freed up. * *---------------------------------------------------------------------- */ static void DestroyCanvas( void *memPtr) /* Info about canvas widget. */ { TkCanvas *canvasPtr = (TkCanvas *)memPtr; Tk_Item *itemPtr; TagSearchExpr *expr, *next; /* * Free up all of the items in the canvas. | > > > > | 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 | * Everything associated with the canvas is freed up. * *---------------------------------------------------------------------- */ static void DestroyCanvas( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about canvas widget. */ #else char *memPtr) #endif { TkCanvas *canvasPtr = (TkCanvas *)memPtr; Tk_Item *itemPtr; TagSearchExpr *expr, *next; /* * Free up all of the items in the canvas. |
︙ | ︙ | |||
2267 2268 2269 2270 2271 2272 2273 | TagSearchExprDestroy(expr); expr = next; } Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler); if (canvasPtr->bindingTable != NULL) { Tk_DeleteBindingTable(canvasPtr->bindingTable); } | | | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 | TagSearchExprDestroy(expr); expr = next; } Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler); if (canvasPtr->bindingTable != NULL) { Tk_DeleteBindingTable(canvasPtr->bindingTable); } Tk_FreeOptions(configSpecs, canvasPtr, canvasPtr->display, 0); canvasPtr->tkwin = NULL; ckfree(canvasPtr); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2297 2298 2299 2300 2301 2302 2303 | */ static int ConfigureCanvas( Tcl_Interp *interp, /* Used for error reporting. */ TkCanvas *canvasPtr, /* Information about widget; may or may not * already have values for some fields. */ | | | | | 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 | */ static int ConfigureCanvas( Tcl_Interp *interp, /* Used for error reporting. */ TkCanvas *canvasPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[], /* Argument objects. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { XGCValues gcValues; GC newGC; Tk_State old_canvas_state=canvasPtr->canvas_state; if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs, objc, objv, canvasPtr, flags) != TCL_OK) { return TCL_ERROR; } /* * A few options need special processing, such as setting the background * from a 3-D border and creating a GC for copying bits to the screen. */ |
︙ | ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | */ canvasPtr->scrollX1 = 0; canvasPtr->scrollY1 = 0; canvasPtr->scrollX2 = 0; canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { | | | | 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 | */ canvasPtr->scrollX1 = 0; canvasPtr->scrollY1 = 0; canvasPtr->scrollX2 = 0; canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { Tcl_Size argc2; const char **argv2; if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString, &argc2, &argv2) != TCL_OK) { return TCL_ERROR; } if (argc2 != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad scrollRegion \"%s\"", canvasPtr->regionString)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SCROLL_REGION", (char *)NULL); badRegion: ckfree(canvasPtr->regionString); ckfree(argv2); canvasPtr->regionString = NULL; return TCL_ERROR; } if ((Tk_GetPixels(canvasPtr->interp, canvasPtr->tkwin, |
︙ | ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | * to be redisplayed. * *---------------------------------------------------------------------- */ static void CanvasWorldChanged( | | | 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 | * 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) { |
︙ | ︙ | |||
2562 2563 2564 2565 2566 2567 2568 | * *---------------------------------------------------------------------- */ #define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap * that the canvas objects are drawn into */ | | | > > > | | 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 | * *---------------------------------------------------------------------- */ #define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap * that the canvas objects are drawn into */ #ifdef WORDS_BIGENDIAN #define IS_BIG_ENDIAN 1 #else #define IS_BIG_ENDIAN 0 #endif #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; |
︙ | ︙ | |||
2597 2598 2599 2600 2601 2602 2603 | rshift, gshift, bshift, rbits, gbits, bbits; #ifdef DEBUG_DRAWCANVAS char buffer[128]; #endif if ((tkwin = canvasPtr->tkwin) == NULL) { | | | | | | 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 | rshift, gshift, bshift, rbits, gbits, bbits; #ifdef DEBUG_DRAWCANVAS char buffer[128]; #endif if ((tkwin = canvasPtr->tkwin) == NULL) { Tcl_AppendResult(interp, "canvas tkwin is NULL!", (char *)NULL); result = TCL_ERROR; goto done; } /* * If this canvas is unmapped, then we won't have a window id, so we will * try the ancestors of the canvas until we find a window that has a * valid window id. The Tk_GetPixmap() call requires a valid window id. */ do { if ((displayPtr = Tk_Display(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", (char *)NULL); result = TCL_ERROR; goto done; } if ((wid = Tk_WindowId(tkwin)) != 0) { continue; } if ((tkwin = Tk_Parent(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", (char *)NULL); result = TCL_ERROR; goto done; } } while (wid == 0); bitsPerPixel = Tk_Depth(tkwin); visualPtr = Tk_Visual(tkwin); if (subsample == 0) { Tcl_AppendResult(interp, "subsample cannot be zero", (char *)NULL); result = TCL_ERROR; goto done; } /* * Scan through the item list, registering the bounding box for all items * that didn't do that for the final coordinates yet. This can be |
︙ | ︙ | |||
2693 2694 2695 2696 2697 2698 2699 | pixmapY1 = canvasY1 - OVERDRAW_PIXELS; pixmapX2 = canvasX2 + OVERDRAW_PIXELS; pixmapY2 = canvasY2 + OVERDRAW_PIXELS; pmWidth = pixmapX2 - pixmapX1 + 1; pmHeight = pixmapY2 - pixmapY1 + 1; if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight, bitsPerPixel)) == 0) { | | | 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 | pixmapY1 = canvasY1 - OVERDRAW_PIXELS; pixmapX2 = canvasX2 + OVERDRAW_PIXELS; pixmapY2 = canvasY2 + OVERDRAW_PIXELS; pmWidth = pixmapX2 - pixmapX1 + 1; pmHeight = pixmapY2 - pixmapY1 + 1; if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight, bitsPerPixel)) == 0) { Tcl_AppendResult(interp, "failed to create drawing Pixmap", (char *)NULL); result = TCL_ERROR; goto done; } /* * Before we can draw the canvas objects into the pixmap it's background * should be filled with canvas background colour. |
︙ | ︙ | |||
2740 2741 2742 2743 2744 2745 2746 | * to the photo image. This seems to be the only way to get Pixmap image * data out of an image. Note we have to account for the OVERDRAW_PIXELS * border width. */ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth, cHeight, AllPlanes, ZPixmap)) == NULL) { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > | | | | | | | | | | 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 | * to the photo image. This seems to be the only way to get Pixmap image * data out of an image. Note we have to account for the OVERDRAW_PIXELS * border width. */ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth, cHeight, AllPlanes, ZPixmap)) == NULL) { Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", (char *)NULL); result = TCL_ERROR; goto done; } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, "ximagePtr {", (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->width); Tcl_AppendResult(interp, " width ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->height); Tcl_AppendResult(interp, " height ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->xoffset); Tcl_AppendResult(interp, " xoffset ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->format); Tcl_AppendResult(interp, " format ", buffer, (char *)NULL); Tcl_AppendResult(interp, " ximagePtr->data", (char *)NULL); if (ximagePtr->data != NULL) { int ix, iy; Tcl_AppendResult(interp, " {", (char *)NULL); for (iy = 0; iy < ximagePtr->height; ++ iy) { Tcl_AppendResult(interp, " {", (char *)NULL); for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) { if (ix > 0) { if (ix % 4 == 0) Tcl_AppendResult(interp, "-", (char *)NULL); else Tcl_AppendResult(interp, " ", (char *)NULL); } snprintf(buffer,sizeof(buffer),"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); Tcl_AppendResult(interp, buffer, (char *)NULL); } Tcl_AppendResult(interp, " }", (char *)NULL); } Tcl_AppendResult(interp, " }", (char *)NULL); } else snprintf(buffer,sizeof(buffer)," NULL"); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->byte_order); Tcl_AppendResult(interp, " byte_order ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->bitmap_unit); Tcl_AppendResult(interp, " bitmap_unit ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->bitmap_bit_order); Tcl_AppendResult(interp, " bitmap_bit_order ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->bitmap_pad); Tcl_AppendResult(interp, " bitmap_pad ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->depth); Tcl_AppendResult(interp, " depth ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->bytes_per_line); Tcl_AppendResult(interp, " bytes_per_line ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",ximagePtr->bits_per_pixel); Tcl_AppendResult(interp, " bits_per_pixel ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",ximagePtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",ximagePtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",ximagePtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, (char *)NULL); Tcl_AppendResult(interp, " }", (char *)NULL); Tcl_AppendResult(interp, "\nvisualPtr {", (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",visualPtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",visualPtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"0x%8.8lx",visualPtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, (char *)NULL); Tcl_AppendResult(interp, " }", (char *)NULL); #endif /* * Fill in the PhotoImageBlock structure abd allocate a block of memory * for the converted image data. Note we allocate an alpha channel even * though we don't use one, because this layout helps Tk_PhotoPutBlock() * 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(). */ DecomposeMaskToShiftAndBits(visualPtr->red_mask,&rshift,&rbits); DecomposeMaskToShiftAndBits(visualPtr->green_mask,&gshift,&gbits); DecomposeMaskToShiftAndBits(visualPtr->blue_mask,&bshift,&bbits); #ifdef DEBUG_DRAWCANVAS snprintf(buffer,sizeof(buffer),"%d",rshift); Tcl_AppendResult(interp, "\nbits { rshift ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",gshift); Tcl_AppendResult(interp, " gshift ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",bshift); Tcl_AppendResult(interp, " bshift ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",rbits); Tcl_AppendResult(interp, " rbits ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",gbits); Tcl_AppendResult(interp, " gbits ", buffer, (char *)NULL); snprintf(buffer,sizeof(buffer),"%d",bbits); Tcl_AppendResult(interp, " bbits ", buffer, " }", (char *)NULL); Tcl_AppendResult(interp, "\nConverted_image {", (char *)NULL); #endif /* Ok, had to use ximagePtr->bits_per_pixel here and in the switch (...) * below to get this to work on Windows. X11 correctly sets the bitmap *_pad and bitmap_unit fields to 32, but on Windows they are 0 and 8 * respectively! */ bytesPerPixel = ximagePtr->bits_per_pixel/8; for (y = 0; y < blockPtr.height; ++y) { #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " {", (char *)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 | | > | > | > | > > > > > > | > > > > > > > > | | | | > > > > > > > | | > | | | | | 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 | * 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, "-", (char *)NULL); for (ix = 0; ix < 4; ++ix) { if (ix > 0) Tcl_AppendResult(interp, " ", (char *)NULL); snprintf(buffer,sizeof(buffer),"%2.2x", blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + ix]&0xFF); Tcl_AppendResult(interp, buffer, (char *)NULL); } } #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", (char *)NULL); #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", (char *)NULL); #endif /* * Now put the copied pixmap into the photo. * If either zoom or subsample are not 1, we use the zoom function. */ |
︙ | ︙ | |||
2993 2994 2995 2996 2997 2998 2999 | * Information appears on the screen. * *---------------------------------------------------------------------- */ static void DisplayCanvas( | | > > > > | | | 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 | * 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); | | | 3114 3115 3116 3117 3118 3119 3120 3121 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); 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 | | | 3173 3174 3175 3176 3177 3178 3179 3180 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 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)); | | | | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 | 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( | | | 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 | * 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; |
︙ | ︙ | |||
3276 3277 3278 3279 3280 3281 3282 | canvasPtr->tkwin = NULL; Tcl_DeleteCommandFromToken(canvasPtr->interp, canvasPtr->widgetCmd); } if (canvasPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayCanvas, canvasPtr); } | | | 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | canvasPtr->tkwin = NULL; Tcl_DeleteCommandFromToken(canvasPtr->interp, canvasPtr->widgetCmd); } if (canvasPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayCanvas, canvasPtr); } Tcl_EventuallyFree(canvasPtr, DestroyCanvas); } else if (eventPtr->type == ConfigureNotify) { canvasPtr->flags |= UPDATE_SCROLLBARS; /* * The call below is needed in order to recenter the canvas if it's * confined and its scroll region is smaller than the window. */ |
︙ | ︙ | |||
3304 3305 3306 3307 3308 3309 3310 | CanvasFocusProc(canvasPtr, 0); } } else if (eventPtr->type == UnmapNotify) { Tk_Item *itemPtr; /* * Special hack: if the canvas is unmapped, then must notify all items | | | | 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 | CanvasFocusProc(canvasPtr, 0); } } else if (eventPtr->type == UnmapNotify) { Tk_Item *itemPtr; /* * Special hack: if the canvas is unmapped, then must notify all items * with flag TK_ALWAYS_REDRAW set, so that they know that they are no * longer displayed. */ for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if (AlwaysRedraw(itemPtr)) { ItemDisplay(canvasPtr, itemPtr, None, 0, 0, 0, 0); } |
︙ | ︙ | |||
3337 3338 3339 3340 3341 3342 3343 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void CanvasCmdDeletedProc( | | | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 | * 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 |
︙ | ︙ | |||
3975 3976 3977 3978 3979 3980 3981 | case '\n': case '\r': break; case '!': /* Negate next tag or subexpr */ if (looking_for_tag > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 | case '\n': case '\r': break; case '!': /* Negate next tag or subexpr */ if (looking_for_tag > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "too many '!' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "COMPLEXITY", (char *)NULL); return TCL_ERROR; } looking_for_tag++; negate_result = 1; break; case '(': /* Scan (negated) subexpr recursively */ |
︙ | ︙ | |||
4025 4026 4027 4028 4029 4030 4031 | found_endquote = 1; break; } *tag++ = c; } if (!found_endquote) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | | | 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 | found_endquote = 1; break; } *tag++ = c; } if (!found_endquote) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing endquote in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "ENDQUOTE", (char *)NULL); return TCL_ERROR; } if (!(tag - searchPtr->rewritebuffer)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "null quoted tag string in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "EMPTY", (char *)NULL); return TCL_ERROR; } *tag++ = '\0'; expr->uids[expr->index++] = Tk_GetUid(searchPtr->rewritebuffer); looking_for_tag = 0; found_tag = 1; break; case '&': /* Illegal chars when looking for tag */ case '|': case '^': case ')': Tcl_SetObjResult(interp, Tcl_NewStringObj( "unexpected operator in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "UNEXPECTED", (char *)NULL); return TCL_ERROR; default: /* Unquoted tag string */ if (negate_result) { expr->uids[expr->index++] = searchUids->negtagvalUid; negate_result = 0; } else { |
︙ | ︙ | |||
4114 4115 4116 4117 4118 4119 4120 | case '\r': break; case '&': /* AND operator */ c = searchPtr->string[searchPtr->stringIndex++]; if (c != '&') { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | | | | | 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 | case '\r': break; case '&': /* AND operator */ c = searchPtr->string[searchPtr->stringIndex++]; if (c != '&') { Tcl_SetObjResult(interp, Tcl_NewStringObj( "singleton '&' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "INCOMPLETE_OP", (char *)NULL); return TCL_ERROR; } expr->uids[expr->index++] = searchUids->andUid; looking_for_tag = 1; break; case '|': /* OR operator */ c = searchPtr->string[searchPtr->stringIndex++]; if (c != '|') { Tcl_SetObjResult(interp, Tcl_NewStringObj( "singleton '|' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "INCOMPLETE_OP", (char *)NULL); return TCL_ERROR; } expr->uids[expr->index++] = searchUids->orUid; looking_for_tag = 1; break; case '^': /* XOR operator */ expr->uids[expr->index++] = searchUids->xorUid; looking_for_tag = 1; break; case ')': /* End subexpression */ expr->uids[expr->index++] = searchUids->endparenUid; goto breakwhile; default: /* syntax error */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid boolean operator in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "BAD_OP", (char *)NULL); return TCL_ERROR; } } } breakwhile: if (found_tag && !looking_for_tag) { return TCL_OK; } Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing tag in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "NO_TAG", (char *)NULL); return TCL_ERROR; } /* *-------------------------------------------------------------- * * TagSearchEvalExpr -- |
︙ | ︙ | |||
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)); | | | 4583 4584 4585 4586 4587 4588 4589 4590 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)); 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]; } |
︙ | ︙ | |||
4635 4636 4637 4638 4639 4640 4641 | *-------------------------------------------------------------- */ static int FindItems( Tcl_Interp *interp, /* Interpreter for error reporting. */ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */ | | | | 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 | *-------------------------------------------------------------- */ static int FindItems( Tcl_Interp *interp, /* Interpreter for error reporting. */ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */ Tcl_Size objc, /* Number of entries in argv. Must be greater * than zero. */ Tcl_Obj *const *objv, /* Arguments that describe what items to * search for (see user doc on "find" and * "addtag" options). */ Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all * found items; if NULL, then ids of found * items are returned in the interp's * result. */ Tcl_Size first /* For error messages: gives number of * elements of objv which are already * handled. */ ,TagSearch **searchPtrPtr /* From CanvasWidgetCmd local vars*/ ) { Tk_Item *itemPtr; Tk_Uid uid; |
︙ | ︙ | |||
5072 5073 5074 5075 5076 5077 5078 | * any). * *-------------------------------------------------------------- */ static void CanvasBindProc( | | | 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 | * 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; | | > | | | > > > > > > > | | 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 | */ if ((canvasPtr->newCurrentPtr != canvasPtr->currentItemPtr) && (canvasPtr->currentItemPtr != NULL) && !(canvasPtr->flags & LEFT_GRABBED_ITEM)) { XEvent event; Tk_Item *itemPtr = canvasPtr->currentItemPtr; Tcl_Size i; event = canvasPtr->pickEvent; event.type = LeaveNotify; /* * Behaviour before ticket #47d4f29159: * If the event's detail happens to be NotifyInferior the binding * mechanism will discard the event. To be consistent, always use * NotifyAncestor. * * Behaviour after ticket #47d4f29159: * The binding mechanism doesn't discard events with detail field * NotifyInferior anymore. It would be best to base the detail * field on the ancestry relationship between the old and new * canvas items. For the time being, retain the choice from before * ticket #47d4f29159, which doesn't harm. */ event.xcrossing.detail = NotifyAncestor; canvasPtr->flags |= REPICK_IN_PROGRESS; CanvasDoEvent(canvasPtr, &event); canvasPtr->flags &= ~REPICK_IN_PROGRESS; /* * 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; | | | | 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 | 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; Tcl_Size numObjects, i; Tk_Item *itemPtr; TagSearchExpr *expr; Tcl_Size numExprs; SearchUids *searchUids = GetStaticUids(); if (canvasPtr->bindingTable == NULL) { return; } itemPtr = canvasPtr->currentItemPtr; |
︙ | ︙ | |||
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; | | | 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 | 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( | | | 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 | * 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) { |
︙ | ︙ | |||
5622 5623 5624 5625 5626 5627 5628 | *---------------------------------------------------------------------- */ static void CanvasSelectTo( TkCanvas *canvasPtr, /* Information about widget. */ Tk_Item *itemPtr, /* Item that is to hold selection. */ | | | | 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 | *---------------------------------------------------------------------- */ static void CanvasSelectTo( TkCanvas *canvasPtr, /* Information about widget. */ Tk_Item *itemPtr, /* Item that is to hold selection. */ Tcl_Size index) /* Index of element that is to become the * "other" end of the selection. */ { Tcl_Size oldFirst, oldLast; Tk_Item *oldSelPtr; oldFirst = canvasPtr->textInfo.selectFirst; oldLast = canvasPtr->textInfo.selectLast; oldSelPtr = canvasPtr->textInfo.selItemPtr; /* |
︙ | ︙ | |||
5648 5649 5650 5651 5652 5653 5654 | } canvasPtr->textInfo.selItemPtr = itemPtr; if (canvasPtr->textInfo.anchorItemPtr != itemPtr) { canvasPtr->textInfo.anchorItemPtr = itemPtr; canvasPtr->textInfo.selectAnchor = index; } | | | 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 | } canvasPtr->textInfo.selItemPtr = itemPtr; if (canvasPtr->textInfo.anchorItemPtr != itemPtr) { canvasPtr->textInfo.anchorItemPtr = itemPtr; canvasPtr->textInfo.selectAnchor = index; } if (canvasPtr->textInfo.selectAnchor <= index) { canvasPtr->textInfo.selectFirst = canvasPtr->textInfo.selectAnchor; canvasPtr->textInfo.selectLast = index; } else { canvasPtr->textInfo.selectFirst = ((int)index < 0) ? TCL_INDEX_NONE : index; canvasPtr->textInfo.selectLast = canvasPtr->textInfo.selectAnchor - 1; } if ((canvasPtr->textInfo.selectFirst != oldFirst) |
︙ | ︙ | |||
5683 5684 5685 5686 5687 5688 5689 | * * Side effects: * None. * *-------------------------------------------------------------- */ | | | | | | 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 | * * Side effects: * None. * *-------------------------------------------------------------- */ static Tcl_Size CanvasFetchSelection( void *clientData, /* Information about canvas widget. */ Tcl_Size offset, /* Offset within selection of first character * to be returned. */ char *buffer, /* Location in which to place selection. */ Tcl_Size maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { TkCanvas *canvasPtr = (TkCanvas *)clientData; return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset, buffer, maxBytes); |
︙ | ︙ | |||
5719 5720 5721 5722 5723 5724 5725 | * not containing a selection. * *---------------------------------------------------------------------- */ static void CanvasLostSelection( | | | 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 | * 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; } |
︙ | ︙ | |||
5872 5873 5874 5875 5876 5877 5878 | scrollY2 = canvasPtr->scrollY2; canvasPtr->flags &= ~UPDATE_SCROLLBARS; if (canvasPtr->xScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions(xOrigin + inset, xOrigin + width - inset, scrollX1, scrollX2); Tcl_DStringInit(&buf); | | | | | | | | | | 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 | scrollY2 = canvasPtr->scrollY2; canvasPtr->flags &= ~UPDATE_SCROLLBARS; if (canvasPtr->xScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions(xOrigin + inset, xOrigin + width - inset, scrollX1, scrollX2); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, xScrollCmd, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, Tcl_GetString(fractions), TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { Tcl_BackgroundException(interp, result); } Tcl_ResetResult(interp); Tcl_Release(xScrollCmd); } if (yScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions(yOrigin + inset, yOrigin + height - inset, scrollY1, scrollY2); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, yScrollCmd, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, Tcl_GetString(fractions), TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { Tcl_BackgroundException(interp, result); } Tcl_ResetResult(interp); Tcl_Release(yScrollCmd); |
︙ | ︙ | |||
6034 6035 6036 6037 6038 6039 6040 | canvasPtr->yOrigin = yOrigin; canvasPtr->flags |= UPDATE_SCROLLBARS; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 | canvasPtr->yOrigin = yOrigin; canvasPtr->flags |= UPDATE_SCROLLBARS; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } /* *-------------------------------------------------------------- * * Tk_CanvasPsColor -- * * This function is called by individual canvas items when they want to * set a color value for output. Given information about an X color, this |
︙ | ︙ | |||
6251 6252 6253 6254 6255 6256 6257 | Tk_CanvasPsPath( Tcl_Interp *interp, /* Put generated Postscript in this * interpreter's result field. */ Tk_Canvas canvas, /* Canvas on whose behalf Postscript is being * generated. */ double *coordPtr, /* Pointer to first in array of 2*numPoints * coordinates giving points for path. */ | | | 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 | Tk_CanvasPsPath( Tcl_Interp *interp, /* Put generated Postscript in this * interpreter's result field. */ Tk_Canvas canvas, /* Canvas on whose behalf Postscript is being * generated. */ double *coordPtr, /* Pointer to first in array of 2*numPoints * coordinates giving points for path. */ Tcl_Size numPoints) /* Number of points at *coordPtr. */ { Tk_PostscriptPath(interp, Canvas(canvas)->psInfo, coordPtr, numPoints); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 |
︙ | ︙ | |||
210 211 212 213 214 215 216 | char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ double pixelsPerMM; /* Scale factor between MM and pixels; used * when converting coordinates. */ int flags; /* Various flags; see below for * definitions. */ | | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ double pixelsPerMM; /* Scale factor between MM and pixels; used * when converting coordinates. */ int flags; /* Various flags; see below for * definitions. */ Tcl_Size nextId; /* Number to use as id for next item created * in widget. */ Tk_PostscriptInfo psInfo; /* Pointer to information used for generating * Postscript for the canvas. NULL means no * Postscript is currently being generated. */ Tcl_HashTable idTable; /* Table of integer indices. */ /* |
︙ | ︙ | |||
286 287 288 289 290 291 292 | #define FORCE_REDRAW 8 /* * Canvas-related functions that are shared among Tk modules but not exported * to the outside world: */ | | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | #define FORCE_REDRAW 8 /* * Canvas-related functions that are shared among Tk modules but not exported * to the outside world: */ MODULE_SCOPE int TkCanvPostscriptObjCmd(TkCanvas *canvasPtr, Tcl_Interp *interp, Tcl_Size argc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkCanvTranslatePath(TkCanvas *canvPtr, int numVertex, double *coordPtr, int closed, XPoint *outPtr); /* * Standard item types provided by Tk: */ |
︙ | ︙ |
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 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* * 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" /* * Prototypes for functions used only in this file: */ static Tcl_Size ClipboardAppHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static Tcl_Size ClipboardHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static Tcl_Size ClipboardWindowHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static void ClipboardLostSel(void *clientData); static int ClipboardGetProc(void *clientData, Tcl_Interp *interp, const char *portion); /* *---------------------------------------------------------------------- * * ClipboardHandler -- * |
︙ | ︙ | |||
44 45 46 47 48 49 50 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | | | 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 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size ClipboardHandler( void *clientData, /* Information about data to fetch. */ Tcl_Size offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ Tcl_Size maxBytes) /* Maximum # of bytes to store at buffer. */ { TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; Tcl_Size count = 0; Tcl_Size scanned = 0; Tcl_Size length, freeCount; /* * Skip to buffer containing offset byte */ for (cbPtr = targetPtr->firstBufferPtr; ; cbPtr = cbPtr->nextPtr) { if (cbPtr == NULL) { |
︙ | ︙ | |||
122 123 124 125 126 127 128 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size ClipboardAppHandler( void *clientData, /* Pointer to TkDisplay structure. */ Tcl_Size offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ Tcl_Size maxBytes) /* Maximum # of bytes to store at buffer. */ { TkDisplay *dispPtr = (TkDisplay *)clientData; Tcl_Size length; const char *p; p = dispPtr->clipboardAppPtr->winPtr->nameUid; length = strlen(p); if (length <= offset) { return 0; } |
︙ | ︙ | |||
167 168 169 170 171 172 173 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size ClipboardWindowHandler( TCL_UNUSED(void *), /* Not used. */ TCL_UNUSED(Tcl_Size), /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ TCL_UNUSED(Tcl_Size)) /* Maximum # of bytes to store at buffer. */ { buffer[0] = '.'; buffer[1] = 0; return 1; } /* |
︙ | ︙ | |||
200 201 202 203 204 205 206 | * The clipboard is marked as inactive. * *---------------------------------------------------------------------- */ static void ClipboardLostSel( | | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | * The clipboard is marked as inactive. * *---------------------------------------------------------------------- */ static void ClipboardLostSel( void *clientData) /* Pointer to TkDisplay structure. */ { TkDisplay *dispPtr = (TkDisplay *)clientData; dispPtr->clipboardActive = 0; } /* |
︙ | ︙ | |||
414 415 416 417 418 419 420 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ClipboardObjCmd( | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ClipboardObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; |
︙ | ︙ | |||
447 448 449 450 451 452 453 | const char *formatName = NULL; const char *string; static const char *const appendOptionStrings[] = { "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; int subIndex; | | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | const char *formatName = NULL; const char *string; static const char *const appendOptionStrings[] = { "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; int subIndex; Tcl_Size 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. */ |
︙ | ︙ | |||
699 700 701 702 703 704 705 | * argument. * *-------------------------------------------------------------- */ static int ClipboardGetProc( | | > > > > | > > | 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 | * argument. * *-------------------------------------------------------------- */ static int ClipboardGetProc( void *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; const char *str = Tcl_ExternalToUtfDString(utf8, portion, TCL_INDEX_NONE, &ds); Tcl_DStringAppend((Tcl_DString *) clientData, str, 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 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 | /* * 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" #if defined(_WIN32) #include "tkWinInt.h" #elif defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #else #include "tkUnixInt.h" #endif /* * Forward declarations for functions defined later in this file: */ static TkWindow * GetTopHierarchy(Tk_Window tkwin); static char * WaitVariableProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void WaitVisibilityProc(void *clientData, XEvent *eventPtr); static void WaitWindowProc(void *clientData, XEvent *eventPtr); static int AppnameCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); static int CaretCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); static int InactiveCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); static int ScalingCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); static int UseinputmethodsCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); static int WindowingsystemCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv); #if defined(_WIN32) || defined(MAC_OSX_TK) MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[]; #else #define tkFontchooserEnsemble NULL #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 -- |
︙ | ︙ | |||
86 87 88 89 90 91 92 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BellObjCmd( | | > | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BellObjCmd( void *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 bellOptions[] = { "-displayof", "-nice", NULL }; enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; Tk_Window tkwin = (Tk_Window)clientData; Tcl_Size i; int index, nice = 0; Tk_ErrorHandler handler; if (objc > 4) { wrongArgs: Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?-nice?"); return TCL_ERROR; } |
︙ | ︙ | |||
154 155 156 157 158 159 160 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BindObjCmd( | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BindObjCmd( 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; TkWindow *winPtr; void *object; const char *string; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, "window ?pattern? ?command?"); return TCL_ERROR; } string = Tcl_GetString(objv[1]); /* * Bind tags either a window name or a tag name for the first argument. * If the argument starts with ".", assume it is a window; otherwise, it * is a tag. */ 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. |
︙ | ︙ | |||
232 233 234 235 236 237 238 | command = Tk_GetBinding(interp, winPtr->mainPtr->bindingTable, object, Tcl_GetString(objv[2])); if (command == NULL) { Tcl_ResetResult(interp); return TCL_OK; } | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | command = Tk_GetBinding(interp, winPtr->mainPtr->bindingTable, object, Tcl_GetString(objv[2])); if (command == NULL) { Tcl_ResetResult(interp); return TCL_OK; } Tcl_SetObjResult(interp, Tcl_NewStringObj(command, TCL_INDEX_NONE)); } else { Tk_GetAllBindings(interp, winPtr->mainPtr->bindingTable, object); } return TCL_OK; } /* |
︙ | ︙ | |||
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 | | | | | | | | | | | 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 | 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; Tcl_Size 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); } } |
︙ | ︙ | |||
338 339 340 341 342 343 344 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BindtagsObjCmd( | | | | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_BindtagsObjCmd( 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; TkWindow *winPtr, *winPtr2; Tcl_Size i, length; const char *p; Tcl_Obj *listPtr, **tags; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "window ?taglist?"); return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; } if (objc == 2) { listPtr = Tcl_NewObj(); if (winPtr->numTags == 0) { Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(winPtr->classUid, TCL_INDEX_NONE)); winPtr2 = winPtr; while ((winPtr2 != NULL) && !(Tk_TopWinHierarchy(winPtr2))) { winPtr2 = winPtr2->parentPtr; } if ((winPtr != winPtr2) && (winPtr2 != NULL)) { Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(winPtr2->pathName, TCL_INDEX_NONE)); } Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj("all", TCL_INDEX_NONE)); } else { for (i = 0; i < winPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj((const char *)winPtr->tagPtr[i], TCL_INDEX_NONE)); } } Tcl_SetObjResult(interp, listPtr); return TCL_OK; } if (winPtr->tagPtr != NULL) { TkFreeBindingTags(winPtr); |
︙ | ︙ | |||
410 411 412 413 414 415 416 | * 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); | | | | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | * 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. */ { | | | | 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 | *---------------------------------------------------------------------- */ void TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { Tcl_Size 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 * have to be freed. */ ckfree((void *)p); } } ckfree(winPtr->tagPtr); winPtr->numTags = 0; winPtr->tagPtr = NULL; } |
︙ | ︙ | |||
478 479 480 481 482 483 484 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_DestroyObjCmd( | | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_DestroyObjCmd( 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 window; Tk_Window tkwin = (Tk_Window)clientData; Tcl_Size i; for (i = 1; i < objc; i++) { window = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin); if (window == NULL) { Tcl_ResetResult(interp); continue; } |
︙ | ︙ | |||
525 526 527 528 529 530 531 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_LowerObjCmd( | | | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_LowerObjCmd( 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 mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; |
︙ | ︙ | |||
584 585 586 587 588 589 590 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_RaiseObjCmd( | | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_RaiseObjCmd( 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 mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; |
︙ | ︙ | |||
643 644 645 646 647 648 649 | * * ---------------------------------------------------------------------- */ int TkInitTkCmd( Tcl_Interp *interp, | | > > | > | > | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | * * ---------------------------------------------------------------------- */ int TkInitTkCmd( Tcl_Interp *interp, void *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; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
672 673 674 675 676 677 678 | * See the user documentation. * *---------------------------------------------------------------------- */ int AppnameCmd( | | | | | > > > < < < < | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int AppnameCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; const char *string; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "appname not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "APPLICATION", NULL); return TCL_ERROR; } winPtr = (TkWindow *) tkwin; if (objc == 2) { string = Tcl_GetString(objv[1]); winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string)); } else if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, "?newName?"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, TCL_INDEX_NONE)); return TCL_OK; } int CaretCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; int index; Tcl_Obj *objPtr; TkCaret *caretPtr; Tk_Window window; |
︙ | ︙ | |||
770 771 772 773 774 775 776 | } else if (index == TK_CARET_Y) { value = caretPtr->y; } else /* if (index == TK_CARET_HEIGHT) -- last case */ { value = caretPtr->height; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { | > | | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | } else if (index == TK_CARET_Y) { value = caretPtr->y; } else /* if (index == TK_CARET_HEIGHT) -- last case */ { value = caretPtr->height; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { Tcl_Size i; int value, x = 0, y = 0, height = -1; for (i = 2; i < objc; i += 2) { if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings, "caret option", 0, &index) != TCL_OK) || Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
796 797 798 799 800 801 802 | Tk_SetCaretPos(window, x, y, height); } return TCL_OK; } int ScalingCmd( | | | > | | < < < < < < < | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | 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 | Tk_SetCaretPos(window, x, y, height); } return TCL_OK; } int ScalingCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; Screen *screenPtr; Tcl_Size skip; int width, height, intPct; double d, dblPct; skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { return TCL_ERROR; } screenPtr = Tk_Screen(tkwin); if (objc == 1 + skip) { d = 25.4 / 72; d *= WidthOfScreen(screenPtr); d /= WidthMMOfScreen(screenPtr); Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d)); } else if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "setting the scaling not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "SCALING", NULL); return TCL_ERROR; } else if (objc == 2 + skip) { if (Tcl_GetDoubleFromObj(interp, objv[1+skip], &d) != TCL_OK) { return TCL_ERROR; } dblPct = d * 75; d = (25.4 / 72) / d; width = (int) (d * WidthOfScreen(screenPtr) + 0.5); if (width <= 0) { width = 1; } height = (int) (d * HeightOfScreen(screenPtr) + 0.5); if (height <= 0) { height = 1; } WidthMMOfScreen(screenPtr) = width; HeightMMOfScreen(screenPtr) = height; /* * Keep the variables ::tk::scalingPct and ::tk::svgFmt * in sync with the new value of the scaling factor */ for (intPct = 100; 1; intPct += 25) { if (dblPct < intPct + 12.5) { break; } } Tcl_SetVar2Ex(interp, "::tk::scalingPct", NULL, Tcl_NewIntObj(intPct), TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "::tk::svgFmt", NULL, Tcl_NewStringObj("svg", TCL_INDEX_NONE), TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "::tk::svgFmt", NULL, Tcl_NewStringObj("-scale", TCL_INDEX_NONE), TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT); Tcl_SetVar2Ex(interp, "::tk::svgFmt", NULL, Tcl_NewDoubleObj(intPct / 100.0), TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT); } else { Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?factor?"); return TCL_ERROR; } return TCL_OK; } int UseinputmethodsCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; TkDisplay *dispPtr; Tcl_Size skip; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "useinputmethods not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "INPUT_METHODS", NULL); return TCL_ERROR; } skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { return TCL_ERROR; } dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc == 2 + skip) { int boolVal; if (Tcl_GetBooleanFromObj(interp, objv[1+skip], &boolVal) != TCL_OK) { return TCL_ERROR; } if (boolVal && (dispPtr->inputMethod != NULL)) { dispPtr->flags |= TK_DISPLAY_USE_IM; } else { dispPtr->flags &= ~TK_DISPLAY_USE_IM; } } else if (objc != 1 + skip) { Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?boolean?"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(dispPtr->flags & TK_DISPLAY_USE_IM)); return TCL_OK; } int WindowingsystemCmd( TCL_UNUSED(void *), /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *windowingsystem; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } #if defined(_WIN32) windowingsystem = "win32"; #elif defined(MAC_OSX_TK) windowingsystem = "aqua"; #else windowingsystem = "x11"; #endif Tcl_SetObjResult(interp, Tcl_NewStringObj(windowingsystem, TCL_INDEX_NONE)); return TCL_OK; } int InactiveCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window)clientData; Tcl_Size skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc == 1 + skip) { Tcl_WideInt inactive; inactive = (Tcl_IsSafe(interp) ? -1 : Tk_GetUserInactiveTime(Tk_Display(tkwin))); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(inactive)); } else if (objc == 2 + skip) { const char *string; string = Tcl_GetString(objv[objc-1]); if (strcmp(string, "reset") != 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be reset", string)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option", string, NULL); return TCL_ERROR; } if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "resetting the user inactivity timer " "is not allowed in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "INACTIVITY_TIMER", NULL); return TCL_ERROR; } Tk_ResetUserInactiveTime(Tk_Display(tkwin)); Tcl_ResetResult(interp); } else { Tcl_WrongNumArgs(interp, 1, objv, "?-displayof window? ?reset?"); |
︙ | ︙ | |||
980 981 982 983 984 985 986 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_TkwaitObjCmd( | | | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_TkwaitObjCmd( 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; int done, index; int code = TCL_OK; |
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | Tcl_ResetResult(interp); return code; } static char * WaitVariableProc( | | | | | | > > | | | 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 | Tcl_ResetResult(interp); return code; } static char * WaitVariableProc( void *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( void *clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event (not used). */ { int *donePtr = (int *)clientData; if (eventPtr->type == VisibilityNotify) { *donePtr = 1; } else if (eventPtr->type == DestroyNotify) { *donePtr = 2; } } static void WaitWindowProc( void *clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event. */ { int *donePtr = (int *)clientData; if (eventPtr->type == DestroyNotify) { *donePtr = 1; } |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_UpdateObjCmd( | | | 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_UpdateObjCmd( TCL_UNUSED(void *), /* 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 updateOptions[] = {"idletasks", NULL}; int flags, index; TkDisplay *dispPtr; |
︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_WinfoObjCmd( | | | > | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_WinfoObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int index, x, y, width, height, useX, useY, c_class; Tcl_Size skip; const char *string; TkWindow *winPtr; Tk_Window tkwin = (Tk_Window)clientData; static const TkStateMap visualMap[] = { {PseudoColor, "pseudocolor"}, {GrayScale, "grayscale"}, |
︙ | ︙ | |||
1354 1355 1356 1357 1358 1359 1360 | break; case WIN_CHILDREN: { Tcl_Obj *strPtr, *resultPtr = Tcl_NewObj(); winPtr = winPtr->childList; for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) { if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) { | | | | | | | | 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 | break; case WIN_CHILDREN: { Tcl_Obj *strPtr, *resultPtr = Tcl_NewObj(); winPtr = winPtr->childList; for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) { if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) { strPtr = Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } } Tcl_SetObjResult(interp, resultPtr); break; } case WIN_CLASS: Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Class(tkwin), TCL_INDEX_NONE)); break; case WIN_COLORMAPFULL: Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TkpCmapStressed(tkwin,Tk_Colormap(tkwin)))); break; case WIN_DEPTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Depth(tkwin))); break; case WIN_GEOMETRY: Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d+%d+%d", Tk_Width(tkwin), Tk_Height(tkwin), Tk_X(tkwin), Tk_Y(tkwin))); break; case WIN_HEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Height(tkwin))); break; case WIN_ID: { char buf[TCL_INTEGER_SPACE]; Tk_MakeWindowExist(tkwin); TkpPrintWindowId(buf, Tk_WindowId(tkwin)); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); break; } case WIN_ISMAPPED: Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tk_IsMapped(tkwin))); break; case WIN_MANAGER: if (winPtr->geomMgrPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->geomMgrPtr->name, TCL_INDEX_NONE)); } break; case WIN_NAME: Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Name(tkwin), TCL_INDEX_NONE)); break; case WIN_PARENT: if (winPtr->parentPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->parentPtr->pathName, TCL_INDEX_NONE)); } break; case WIN_POINTERX: useX = 1; useY = 0; goto pointerxy; case WIN_POINTERY: |
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | goto visual; case WIN_SERVER: TkGetServerInfo(interp, tkwin); break; case WIN_TOPLEVEL: winPtr = GetTopHierarchy(tkwin); if (winPtr != NULL) { | | | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | goto visual; case WIN_SERVER: TkGetServerInfo(interp, tkwin); break; case WIN_TOPLEVEL: winPtr = GetTopHierarchy(tkwin); if (winPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE)); } break; case WIN_VIEWABLE: { int viewable = 0; for ( ; ; winPtr = winPtr->parentPtr) { if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) { |
︙ | ︙ | |||
1514 1515 1516 1517 1518 1519 1520 | c_class = Tk_Visual(tkwin)->c_class; visual: string = TkFindStateString(visualMap, c_class); if (string == NULL) { string = "unknown"; } | | | 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | c_class = Tk_Visual(tkwin)->c_class; visual: string = TkFindStateString(visualMap, c_class); if (string == NULL) { string = "unknown"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(string, TCL_INDEX_NONE)); break; case WIN_VISUALID: Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) XVisualIDFromVisual(Tk_Visual(tkwin)))); break; case WIN_VROOTHEIGHT: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); |
︙ | ︙ | |||
1555 1556 1557 1558 1559 1560 1561 | */ case WIN_ATOM: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } | | | | | | | | | 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 | */ case WIN_ATOM: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 3 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? name"); return TCL_ERROR; } objv += skip; string = Tcl_GetString(objv[2]); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string))); break; case WIN_ATOMNAME: { const char *name; Tcl_WideInt id; skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 3 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id"); return TCL_ERROR; } objv += skip; if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } name = Tk_GetAtomName(tkwin, (Atom) id); if (strcmp(name, "?bad atom?") == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no atom exists with id \"%s\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "ATOM", Tcl_GetString(objv[2]), NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE)); break; } case WIN_CONTAINING: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 4 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? rootX rootY"); return TCL_ERROR; } objv += skip; string = Tcl_GetString(objv[2]); if (Tk_GetPixels(interp, tkwin, string, &x) != TCL_OK) { return TCL_ERROR; } string = Tcl_GetString(objv[3]); if (Tk_GetPixels(interp, tkwin, string, &y) != TCL_OK) { return TCL_ERROR; } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE)); } break; case WIN_INTERPS: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 2 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?"); return TCL_ERROR; } return TkGetInterpNames(interp, tkwin); case WIN_PATHNAME: { Window id; skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 3 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id"); return TCL_ERROR; } string = Tcl_GetString(objv[2 + skip]); if (TkpScanWindowId(interp, string, &id) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 | * If the window is a utility window with no associated path (such as * a wrapper window or send communication window), just return an * empty string. */ tkwin = (Tk_Window) winPtr; if (Tk_PathName(tkwin) != NULL) { | | | 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 | * If the window is a utility window with no associated path (such as * a wrapper window or send communication window), just return an * empty string. */ tkwin = (Tk_Window) winPtr; if (Tk_PathName(tkwin) != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE)); } break; } /* * objv[3] is window. */ |
︙ | ︙ | |||
1783 1784 1785 1786 1787 1788 1789 | } templ.screen = Tk_ScreenNumber(tkwin); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask, &templ, &count); if (visInfoPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | | | | | | | | | | | | | | 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 | } templ.screen = Tk_ScreenNumber(tkwin); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask, &templ, &count); if (visInfoPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't find any visuals for screen", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VISUAL", "NONE", NULL); return TCL_ERROR; } resultPtr = Tcl_NewObj(); for (i = 0; i < count; i++) { string = TkFindStateString(visualMap, visInfoPtr[i].c_class); if (string == NULL) { strcpy(buf, "unknown"); } else { snprintf(buf, sizeof(buf), "%s %d", string, visInfoPtr[i].depth); } if (includeVisualId) { snprintf(visualIdString, sizeof(visualIdString), " 0x%lx", (unsigned long) visInfoPtr[i].visualid); strcat(buf, visualIdString); } strPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } Tcl_SetObjResult(interp, resultPtr); XFree(visInfoPtr); break; } } return TCL_OK; } /* *---------------------------------------------------------------------- * * TkGetDisplayOf -- * * Parses a "-displayof window" option for various commands. If present, * the literal "-displayof" should be in objv[0] and the window name in * objv[1]. * * Results: * The return value is 0 if the argument strings did not contain the * "-displayof" option. The return value is 2 if the argument strings * contained both the "-displayof" option and a valid window name. * Otherwise, the return value is TCL_INDEX_NONE if the window name * was missing or did not specify a valid window. * * If the return value was 2, *tkwinPtr is filled with the token for the * window specified on the command line. If the return value was * TCL_INDEX_NONE, an error message is left in interp's result object. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Size TkGetDisplayOf( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. If it is present, * "-displayof" should be in objv[0] and * objv[1] the name of a window. */ Tk_Window *tkwinPtr) /* On input, contains main window of * application associated with interp. On * output, filled with window specified as * option to "-displayof" argument, or * unmodified if "-displayof" argument was not * present. */ { const char *string; Tcl_Size length; if (objc + 1 < 2) { 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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_VALUE", "DISPLAYOF", NULL); return TCL_INDEX_NONE; } *tkwinPtr = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), *tkwinPtr); if (*tkwinPtr == NULL) { return TCL_INDEX_NONE; } return 2; } return 0; } /* |
︙ | ︙ | |||
1898 1899 1900 1901 1902 1903 1904 | *---------------------------------------------------------------------- */ int TkDeadAppObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ | | | | 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 | *---------------------------------------------------------------------- */ int TkDeadAppObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't invoke \"%s\" command: application has been destroyed", Tcl_GetString(objv[0]))); return TCL_ERROR; } |
︙ | ︙ | |||
1928 1929 1930 1931 1932 1933 1934 | * *---------------------------------------------------------------------- */ static TkWindow * GetTopHierarchy( Tk_Window tkwin) /* Window for which the top-of-hierarchy | | | 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | * *---------------------------------------------------------------------- */ static TkWindow * GetTopHierarchy( Tk_Window tkwin) /* Window for which the top-of-hierarchy * ancestor should be determined. */ { TkWindow *winPtr = (TkWindow *) tkwin; while ((winPtr != NULL) && !(winPtr->flags & TK_TOP_HIERARCHY)) { winPtr = winPtr->parentPtr; } return winPtr; |
︙ | ︙ |
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 17 18 19 20 21 22 23 24 25 26 27 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Structures of the following following type are used as keys for * colorValueTable (in TkDisplay). */ typedef struct { |
︙ | ︙ | |||
48 49 50 51 52 53 54 | /* * The following structure defines the implementation of the "color" Tcl * object, which maps a string color name to a TkColor object. The ptr1 field * of the Tcl_Obj points to a TkColor object. */ | | | | > > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /* * The following structure defines the implementation of the "color" Tcl * object, which maps a string color name to a TkColor object. The ptr1 field * of the Tcl_Obj points to a TkColor object. */ const TkObjType tkColorObjType = { {"color", /* name */ FreeColorObjProc, /* freeIntRepProc */ DupColorObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *---------------------------------------------------------------------- * * Tk_AllocColorFromObj -- * |
︙ | ︙ | |||
91 92 93 94 95 96 97 | Tk_Window tkwin, /* Window in which the color will be used.*/ Tcl_Obj *objPtr) /* Object that describes the color; string * value is a color name such as "red" or * "#ff0000".*/ { TkColor *tkColPtr; | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | Tk_Window tkwin, /* Window in which the color will be used.*/ Tcl_Obj *objPtr) /* Object that describes the color; string * value is a color name such as "red" or * "#ff0000".*/ { TkColor *tkColPtr; if (objPtr->typePtr != &tkColorObjType.objType) { InitColorObj(objPtr); } tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkColor, see if it's the one we * want. If so, increment its reference count and return. |
︙ | ︙ | |||
367 368 369 370 371 372 373 | if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); snprintf(tsdPtr->rgbString, sizeof(tsdPtr->rgbString), "#%04x%04x%04x", colorPtr->red, colorPtr->green, colorPtr->blue); /* * If the string has the form #RSRSTUTUVWVW (where equal letters * denote equal hexdigits) then this is equivalent to #RSTUVW. Then * output the shorter form. */ |
︙ | ︙ | |||
653 654 655 656 657 658 659 | Tcl_Obj *objPtr) /* String value contains the name of the * desired color. */ { TkColor *tkColPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | Tcl_Obj *objPtr) /* String value contains the name of the * desired color. */ { TkColor *tkColPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objPtr->typePtr != &tkColorObjType.objType) { InitColorObj(objPtr); } /* * First check to see if the internal representation of the object is * defined and is a color that is valid for the current screen and color * map. If it is, we are done. |
︙ | ︙ | |||
741 742 743 744 745 746 747 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } | | | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkColorObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; } /* *---------------------------------------------------------------------- * * ColorInit -- |
︙ | ︙ | |||
814 815 816 817 818 819 820 | if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); } for ( ; (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); } for ( ; (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((Tcl_WideInt)tkColPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((Tcl_WideInt)tkColPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } #ifndef _WIN32 |
︙ | ︙ |
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 |
︙ | ︙ | |||
34 35 36 37 38 39 40 | * color and all other fields defaulted. May * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was * allocated. */ Visual *visual; /* Visual associated with colormap. */ | | | | 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 | * color and all other fields defaulted. May * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was * allocated. */ Visual *visual; /* Visual associated with colormap. */ Tcl_Size resourceRefCount; /* Number of active uses of this color (each * active use corresponds to a call to * Tk_AllocColorFromObj or Tk_GetColor). If * this count is 0, then this TkColor * structure is no longer valid and it isn't * present in a hash table: it is being kept * around only because there are objects * referring to it. The structure is freed * when resourceRefCount and objRefCount are * both 0. */ Tcl_Size objRefCount; /* The number of Tcl objects that reference * this structure. */ int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */ Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this * structure. (for use in deleting entry). */ struct TkColor *nextPtr; /* Points to the next TkColor structure with * the same color name. Colors with the same * name but different screens or colormaps are |
︙ | ︙ |
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 46 47 48 49 | #define __NO_OLD_CONFIG #endif #include "tkInt.h" #include "tkFont.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The following encoding is used in TK_OPTION_VAR: * * if sizeof(type) == sizeof(int) => TK_OPTION_VAR(type) = 0 * if sizeof(type) == 1 => TK_OPTION_VAR(type) = 64 * if sizeof(type) == 2 => TK_OPTION_VAR(type) = 128 * if sizeof(type) == sizeof(long long) => TK_OPTION_VAR(type) = 192 */ #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. */ |
︙ | ︙ | |||
134 135 136 137 138 139 140 | /* * The structure below defines an object type that is used to cache the result * of looking up an option name. If an object has this type, then its * internalPtr1 field points to the OptionTable in which it was looked up, and * the internalPtr2 field points to the entry that matched. */ | | | | > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* * The structure below defines an object type that is used to cache the result * of looking up an option name. If an object has this type, then its * internalPtr1 field points to the OptionTable in which it was looked up, and * the internalPtr2 field points to the entry that matched. */ static const TkObjType optionObjType = { {"option", /* name */ FreeOptionInternalRep, /* freeIntRepProc */ DupOptionInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *-------------------------------------------------------------- * * Tk_CreateOptionTable -- * |
︙ | ︙ | |||
255 256 257 258 259 260 261 | if (specPtr->dbName != NULL) { optionPtr->dbNameUID = Tk_GetUid(specPtr->dbName); } if (specPtr->dbClass != NULL) { optionPtr->dbClassUID = Tk_GetUid(specPtr->dbClass); } if (specPtr->defValue != NULL) { | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | if (specPtr->dbName != NULL) { optionPtr->dbNameUID = Tk_GetUid(specPtr->dbName); } if (specPtr->dbClass != NULL) { optionPtr->dbClassUID = Tk_GetUid(specPtr->dbClass); } if (specPtr->defValue != NULL) { optionPtr->defaultPtr = Tcl_NewStringObj(specPtr->defValue, TCL_INDEX_NONE); Tcl_IncrRefCount(optionPtr->defaultPtr); } if (((specPtr->type == TK_OPTION_COLOR) || (specPtr->type == TK_OPTION_BORDER)) && (specPtr->clientData != NULL)) { optionPtr->extra.monoColorPtr = Tcl_NewStringObj((const char *)specPtr->clientData, TCL_INDEX_NONE); Tcl_IncrRefCount(optionPtr->extra.monoColorPtr); } if (specPtr->type == TK_OPTION_CUSTOM) { /* * Get the custom parsing, etc., functions. */ |
︙ | ︙ | |||
392 393 394 395 396 397 398 | * window they are used in to be able to * calculate their values. Not needed unless * one of these options is in the configSpecs * record. */ { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | * window they are used in to be able to * calculate their values. Not needed unless * one of these options is in the configSpecs * record. */ { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; size_t count; Tk_Uid value; Tcl_Obj *valuePtr; enum { OPTION_DATABASE, SYSTEM_DEFAULT, TABLE_DEFAULT } source; /* |
︙ | ︙ | |||
440 441 442 443 444 445 446 | */ valuePtr = NULL; if (optionPtr->dbNameUID != NULL) { value = Tk_GetOption(tkwin, optionPtr->dbNameUID, optionPtr->dbClassUID); if (value != NULL) { | | | | 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 | */ valuePtr = NULL; if (optionPtr->dbNameUID != NULL) { value = Tk_GetOption(tkwin, optionPtr->dbNameUID, optionPtr->dbClassUID); if (value != NULL) { valuePtr = Tcl_NewStringObj(value, TCL_INDEX_NONE); source = OPTION_DATABASE; } } /* * 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; } } /* |
︙ | ︙ | |||
495 496 497 498 499 500 501 | if (DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, NULL) != TCL_OK) { if (interp != NULL) { char msg[200]; switch (source) { case OPTION_DATABASE: | | | | | | 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 | if (DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, NULL) != TCL_OK) { if (interp != NULL) { char msg[200]; switch (source) { case OPTION_DATABASE: snprintf(msg, 200, "\n (database entry for \"%.50s\")", optionPtr->specPtr->optionName); break; case SYSTEM_DEFAULT: snprintf(msg, 200, "\n (system default for \"%.50s\")", optionPtr->specPtr->optionName); break; case TABLE_DEFAULT: snprintf(msg, 200, "\n (default value for \"%.50s\")", optionPtr->specPtr->optionName); } if (tkwin != NULL) { snprintf(msg + strlen(msg) - 1, 200 - (strlen(msg) - 1), " in widget \"%.50s\")", Tk_PathName(tkwin)); } Tcl_AddErrorInfo(interp, msg); } Tcl_DecrRefCount(valuePtr); return TCL_ERROR; } |
︙ | ︙ | |||
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; } | | > > > | > > > > > > > > > > > > > > > | | | > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > | > > > > > > > > | | | | | | > > > | > > > > > > > > > > > > | | > | 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 | 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) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = (char)newBool; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = (short)newBool; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN"); } } else { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newBool; } } break; } case TK_OPTION_INT: { int newInt; if ((optionPtr->specPtr->flags & TYPE_MASK) == 0) { if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newInt = INT_MIN; } else if (Tcl_GetIntFromObj(nullOK ? NULL : interp, valuePtr, &newInt) != TCL_OK) { invalidIntValue: if (nullOK && interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer or \"\" but got \"%.50s\"", Tcl_GetString(valuePtr))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newInt; } } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) { Tcl_WideInt newWideInt; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newWideInt = (sizeof(long) > sizeof(int)) ? LONG_MIN : LLONG_MIN; } else if (Tcl_GetWideIntFromObj(nullOK ? NULL : interp, valuePtr, &newWideInt) != TCL_OK) { goto invalidIntValue; } if (internalPtr != NULL) { if (sizeof(long) > sizeof(int)) { *((long *) oldInternalPtr) = *((long *) internalPtr); *((long *) internalPtr) = (long)newWideInt; } else { *((long long *) oldInternalPtr) = *((long long *) internalPtr); *((long long *) internalPtr) = (long long)newWideInt; } } } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_INT"); } break; } case TK_OPTION_INDEX: { Tcl_Size newIndex; if (TkGetIntForIndex(valuePtr, TCL_INDEX_NONE, 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 < INT_MIN) { newIndex = INT_MIN; } else if (newIndex > INT_MAX) { newIndex = INT_MAX; } 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 \"", TCL_INDEX_NONE); Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), TCL_INDEX_NONE, 50, ""); Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE); 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; Tcl_Size 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 (slotPtrPtr != NULL && valuePtr != NULL) { valuePtr = Tcl_DuplicateObj(valuePtr); Tcl_InvalidateStringRep(valuePtr); } } if (internalPtr != NULL) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = (char)newValue; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = (short)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; | | | | | < > > > > > > > > > > > | | > > > > > | 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 | } 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) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = (char)newRelief; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = (short)newRelief; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_RELIEF"); } } else { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newRelief; } } if (slotPtrPtr != NULL && valuePtr != NULL) { valuePtr = Tcl_DuplicateObj(valuePtr); Tcl_InvalidateStringRep(valuePtr); } break; } case TK_OPTION_CURSOR: { Tk_Cursor newCursor; if (nullOK && ObjectIsEmpty(valuePtr)) { |
︙ | ︙ | |||
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: { | | > > > | > > > | > > > > > > > > > | > > > > > | > > > | > > > | > > > > > > > > > | > > > > > | < | | > | > > > < | | | < | 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 | *((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) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = (char)newJustify; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = (short)newJustify; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY"); } } else { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newJustify; } } if (slotPtrPtr != NULL && valuePtr != NULL) { valuePtr = Tcl_DuplicateObj(valuePtr); Tcl_InvalidateStringRep(valuePtr); } 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) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); *((char *) internalPtr) = (char)newAnchor; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = (short)newAnchor; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY"); } } else { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newAnchor; } } if (slotPtrPtr != NULL && valuePtr != NULL) { valuePtr = Tcl_DuplicateObj(valuePtr); Tcl_InvalidateStringRep(valuePtr); } break; } case TK_OPTION_PIXELS: { int newPixels; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newPixels = INT_MIN; } else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr, &newPixels) != TCL_OK) { if (nullOK && interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance or \"\" but got \"%.50s\"", Tcl_GetString(valuePtr))); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } 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; } |
︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 | Option *bestPtr; const char *name; /* * First, check to see if the object already has the answer cached. */ | | | 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | Option *bestPtr; const char *name; /* * First, check to see if the object already has the answer cached. */ if (objPtr->typePtr == &optionObjType.objType) { if (objPtr->internalRep.twoPtrValue.ptr1 == (void *) tablePtr) { return (Option *) objPtr->internalRep.twoPtrValue.ptr2; } } /* * The answer isn't cached. |
︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | if ((objPtr->typePtr != NULL) && (objPtr->typePtr->freeIntRepProc != NULL)) { objPtr->typePtr->freeIntRepProc(objPtr); } objPtr->internalRep.twoPtrValue.ptr1 = (void *) tablePtr; objPtr->internalRep.twoPtrValue.ptr2 = (void *) bestPtr; | | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | if ((objPtr->typePtr != NULL) && (objPtr->typePtr->freeIntRepProc != NULL)) { objPtr->typePtr->freeIntRepProc(objPtr); } objPtr->internalRep.twoPtrValue.ptr1 = (void *) tablePtr; objPtr->internalRep.twoPtrValue.ptr2 = (void *) bestPtr; objPtr->typePtr = &optionObjType.objType; tablePtr->refCount++; return bestPtr; error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\"", name)); |
︙ | ︙ | |||
1225 1226 1227 1228 1229 1230 1231 | int Tk_SetOptions( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is returned.*/ void *recordPtr, /* The record to configure. */ Tk_OptionTable optionTable, /* Describes valid options. */ | | | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 | int Tk_SetOptions( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is returned.*/ void *recordPtr, /* The record to configure. */ Tk_OptionTable optionTable, /* Describes valid options. */ Tcl_Size objc, /* The number of elements in objv. */ Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */ Tk_Window tkwin, /* Window associated with the thing being * configured; needed for some options (such * as colors). */ Tk_SavedOptions *savePtr, /* If non-NULL, the old values of modified * options are saved here so that they can be * restored after an error. */ |
︙ | ︙ | |||
1341 1342 1343 1344 1345 1346 1347 | */ void Tk_RestoreSavedOptions( Tk_SavedOptions *savePtr) /* Holds saved option information; must have * been passed to Tk_SetOptions. */ { | | | | | | 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 | */ void Tk_RestoreSavedOptions( Tk_SavedOptions *savePtr) /* Holds saved option information; must have * been passed to Tk_SetOptions. */ { Tcl_Size i; Option *optionPtr; Tcl_Obj *newPtr; /* New object value of option, which we * replace with old value and free. Taken from * record. */ void *internalPtr; /* Points to internal value of option in * record. */ const Tk_OptionSpec *specPtr; /* * Be sure to restore the options in the opposite order they were set. * This is important because it's possible that the same option name was * used twice in a single call to Tk_SetOptions. */ if (savePtr->nextPtr != NULL) { Tk_RestoreSavedOptions(savePtr->nextPtr); ckfree(savePtr->nextPtr); savePtr->nextPtr = NULL; } for (i = savePtr->numItems - 1; i >= 0; i--) { optionPtr = savePtr->items[i].optionPtr; specPtr = optionPtr->specPtr; /* * First free the new value of the option, which is currently in the * record. */ if (specPtr->objOffset >= 0) { newPtr = *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset)); } else { newPtr = NULL; } if (specPtr->internalOffset >= 0) { internalPtr = (char *)savePtr->recordPtr + specPtr->internalOffset; } else { internalPtr = NULL; } if (optionPtr->flags & OPTION_NEEDS_FREEING) { FreeResources(optionPtr, newPtr, internalPtr, savePtr->tkwin); } |
︙ | ︙ | |||
1401 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: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > | > > > > > > > > > > | > > > | > > > > > > > > | 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 | } if (specPtr->internalOffset != TCL_INDEX_NONE) { char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { case TK_OPTION_BOOLEAN: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) internalPtr) = *((short *) ptr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; case TK_OPTION_INT: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) { if (sizeof(long) > sizeof(int)) { *((long *) internalPtr) = *((long *) ptr); } else { *((long long *) internalPtr) = *((long long *) ptr); } } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_INT"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; 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) == TK_OPTION_VAR(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(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; case TK_OPTION_STYLE: *((Tk_Style *) internalPtr) = *((Tk_Style *) ptr); break; case TK_OPTION_BITMAP: *((Pixmap *) internalPtr) = *((Pixmap *) ptr); break; case TK_OPTION_BORDER: *((Tk_3DBorder *) internalPtr) = *((Tk_3DBorder *) ptr); break; case TK_OPTION_RELIEF: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) internalPtr) = *((short *) ptr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_RELIEF"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; case TK_OPTION_CURSOR: *((Tk_Cursor *) internalPtr) = *((Tk_Cursor *) ptr); Tk_DefineCursor(savePtr->tkwin, *((Tk_Cursor *) internalPtr)); break; case TK_OPTION_JUSTIFY: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) internalPtr) = *((short *) ptr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; case TK_OPTION_ANCHOR: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) internalPtr) = *((short *) ptr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_ANCHOR"); } } else { *((int *) internalPtr) = *((int *) ptr); } break; case TK_OPTION_PIXELS: *((int *) internalPtr) = *((int *) ptr); break; case TK_OPTION_WINDOW: *((Tk_Window *) internalPtr) = *((Tk_Window *) ptr); break; |
︙ | ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | * particular option. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *listPtr, *elementPtr; listPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, listPtr, | | | | | | 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 | * particular option. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *listPtr, *elementPtr; listPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(optionPtr->specPtr->optionName, TCL_INDEX_NONE)); if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) { elementPtr = Tcl_NewStringObj( optionPtr->extra.synonymPtr->specPtr->optionName, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); } else { if (optionPtr->dbNameUID == NULL) { elementPtr = Tcl_NewObj(); } else { elementPtr = Tcl_NewStringObj(optionPtr->dbNameUID, TCL_INDEX_NONE); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); if (optionPtr->dbClassUID == NULL) { elementPtr = Tcl_NewObj(); } else { elementPtr = Tcl_NewStringObj(optionPtr->dbClassUID, TCL_INDEX_NONE); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); if ((tkwin != NULL) && ((optionPtr->specPtr->type == TK_OPTION_COLOR) || (optionPtr->specPtr->type == TK_OPTION_BORDER)) && (Tk_Depth(tkwin) <= 1) && (optionPtr->extra.monoColorPtr != NULL)) { |
︙ | ︙ | |||
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. */ { | | | < < | > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > | | > > > > > > > > > > > > > | | > > | | | | | | > > > > > > > > > > > > > | > > | | > > > > > > > > > > > > > | < > > | > > > > > > > > > > > > > | < > > > | > | | | | 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 | 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: { int value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { value = *((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { value = *((short *)internalPtr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN"); } } else { value = *((int *)internalPtr); } if (value != -1) { objPtr = Tcl_NewBooleanObj(value); } break; } case TK_OPTION_INT: { Tcl_WideInt value; int nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)); if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) { if (sizeof(long) > sizeof(int)) { value = *((long *)internalPtr); if (nullOK && (value == LONG_MIN)) {break;} } else { value = *((long long *)internalPtr); if (nullOK && (value == LLONG_MIN)) {break;} } } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_INT"); } } else { value = *((int *)internalPtr); if (nullOK && (value == INT_MIN)) {break;} } objPtr = Tcl_NewWideIntObj(value); break; } case TK_OPTION_INDEX: if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) { if (*((int *) internalPtr) == INT_MIN) { objPtr = TkNewIndexObj(TCL_INDEX_NONE); } else if (*((int *) internalPtr) == INT_MAX) { objPtr = Tcl_NewStringObj("end+1", TCL_INDEX_NONE); } else if (*((int *) internalPtr) == -1) { objPtr = Tcl_NewStringObj("end", TCL_INDEX_NONE); } else if (*((int *) internalPtr) < 0) { char buf[32]; snprintf(buf, 32, "end%d", 1 + *((int *) internalPtr)); objPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE); } 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), TCL_INDEX_NONE); break; case TK_OPTION_STRING_TABLE: { int value = 0; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { value = *((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(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], TCL_INDEX_NONE); } break; } case TK_OPTION_COLOR: { XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), TCL_INDEX_NONE); } break; } case TK_OPTION_FONT: { Tk_Font tkfont = *((Tk_Font *)internalPtr); if (tkfont != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), TCL_INDEX_NONE); } break; } case TK_OPTION_STYLE: { Tk_Style style = *((Tk_Style *)internalPtr); if (style != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), TCL_INDEX_NONE); } break; } case TK_OPTION_BITMAP: { Pixmap pixmap = *((Pixmap *)internalPtr); if (pixmap != None) { objPtr = Tcl_NewStringObj( Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), TCL_INDEX_NONE); } break; } case TK_OPTION_BORDER: { Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); if (border != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), TCL_INDEX_NONE); } break; } case TK_OPTION_RELIEF: { int value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { value = *((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { value = *((short *)internalPtr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_RELIEF"); } } else { value = *((int *)internalPtr); } if (value != TK_RELIEF_NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfRelief(value), TCL_INDEX_NONE); } break; } case TK_OPTION_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); if (cursor != NULL) { objPtr = Tcl_NewStringObj( Tk_NameOfCursor(Tk_Display(tkwin), cursor), TCL_INDEX_NONE); } break; } case TK_OPTION_JUSTIFY: { Tk_Justify value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { value = (Tk_Justify)*((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { value = (Tk_Justify)*((short *)internalPtr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY"); } } else { value = (Tk_Justify)*((int *)internalPtr); } if (value != TK_JUSTIFY_NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfJustify(value), TCL_INDEX_NONE); } break; } case TK_OPTION_ANCHOR: { Tk_Anchor value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { value = (Tk_Anchor)*((signed char *)internalPtr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { value = (Tk_Anchor)*((short *)internalPtr); } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_ANCHOR"); } } else { value = (Tk_Anchor)*((int *)internalPtr); } if (value != TK_ANCHOR_NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(value), TCL_INDEX_NONE); } 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), TCL_INDEX_NONE); } break; } case TK_OPTION_CUSTOM: { const Tk_ObjCustomOption *custom = optionPtr->extra.custom; objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr, optionPtr->specPtr->internalOffset); break; } default: Tcl_Panic("bad option type in GetObjectForOption"); } } if (objPtr == NULL) { objPtr = Tcl_NewObj(); } return objPtr; |
︙ | ︙ | |||
2087 2088 2089 2090 2091 2092 2093 | for (hashEntryPtr = Tcl_FirstHashEntry(&tsdPtr->hashTable, &search); hashEntryPtr != NULL; hashEntryPtr = Tcl_NextHashEntry(&search)) { if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, | | | | | 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 | for (hashEntryPtr = Tcl_FirstHashEntry(&tsdPtr->hashTable, &search); hashEntryPtr != NULL; hashEntryPtr = Tcl_NextHashEntry(&search)) { if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((Tcl_WideInt)tablePtr->refCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((Tcl_WideInt)tablePtr->numOptions)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj( tablePtr->options[0].specPtr->optionName, TCL_INDEX_NONE)); } break; } } return objPtr; } |
︙ | ︙ |
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" |
︙ | ︙ | |||
39 40 41 42 43 44 45 | int type; /* TCL_STDOUT or TCL_STDERR */ } ChannelData; /* * Prototypes for local procedures defined in this file: */ | | | | | | | | < | | | | | | < | 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 | int type; /* TCL_STDOUT or TCL_STDERR */ } ChannelData; /* * Prototypes for local procedures defined in this file: */ static int ConsoleClose(void *instanceData, Tcl_Interp *interp); static int Console2Close(void *instanceData, Tcl_Interp *interp, int flags); static void ConsoleDeleteProc(void *clientData); static void ConsoleEventProc(void *clientData, XEvent *eventPtr); static int ConsoleHandle(void *instanceData, int direction, void **handlePtr); static int ConsoleInput(void *instanceData, char *buf, int toRead, int *errorCode); static Tcl_ObjCmdProc ConsoleObjCmd; static int ConsoleOutput(void *instanceData, const char *buf, int toWrite, int *errorCode); static void ConsoleWatch(void *instanceData, int mask); static void DeleteConsoleInterp(void *clientData); static void InterpDeleteProc(void *clientData, Tcl_Interp *interp); static Tcl_ObjCmdProc InterpreterObjCmd; /* * This structure describes the channel type structure for file based IO: */ static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ |
︙ | ︙ | |||
220 221 222 223 224 225 226 | ConsoleInfo *info; Tcl_Channel consoleChannel; /* * Ensure that we are getting a compatible version of Tcl. */ | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | ConsoleInfo *info; Tcl_Channel consoleChannel; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return; } consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); if (*consoleInitPtr) { /* * We've already initialized console channels in this thread. |
︙ | ︙ | |||
440 441 442 443 444 445 446 | Tk_CreateEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); info->refCount++; } Tcl_Preserve(consoleInterp); result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | Tk_CreateEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); info->refCount++; } Tcl_Preserve(consoleInterp); result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp)); } Tcl_Release(consoleInterp); if (result == TCL_ERROR) { |
︙ | ︙ | |||
489 490 491 492 493 494 495 | * Writes output on the actual channel. * *---------------------------------------------------------------------- */ static int ConsoleOutput( | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | * Writes output on the actual channel. * *---------------------------------------------------------------------- */ static int ConsoleOutput( void *instanceData, /* Indicates which device to use. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ { ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; |
︙ | ︙ | |||
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. */ | < | | | | | | 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 | /* * 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. */ const char *bytes = Tcl_ExternalToUtfDString(utf8, buf, toWrite, &ds); Tcl_Size numBytes = Tcl_DStringLength(&ds); Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", TCL_INDEX_NONE); Tcl_FreeEncoding(utf8); if (data->type == TCL_STDERR) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("stderr", TCL_INDEX_NONE)); } else { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("stdout", TCL_INDEX_NONE)); } Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj(bytes, numBytes)); Tcl_DStringFree(&ds); Tcl_IncrRefCount(cmd); Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); |
︙ | ︙ | |||
584 585 586 587 588 589 590 | * Frees the dummy file associated with the channel. * *---------------------------------------------------------------------- */ static int ConsoleClose( | | | | 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 | * Frees the dummy file associated with the channel. * *---------------------------------------------------------------------- */ static int ConsoleClose( void *instanceData, TCL_UNUSED(Tcl_Interp *)) { ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; if (info) { if (info->refCount-- <= 1) { /* * Assuming the Tcl_Interp * fields must already be NULL. */ ckfree(info); } } ckfree(data); return 0; } static int Console2Close( void *instanceData, /* Unused. */ Tcl_Interp *interp, /* Unused. */ int flags) { if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))==0) { return ConsoleClose(instanceData, interp); } return EINVAL; |
︙ | ︙ | |||
689 690 691 692 693 694 695 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ConsoleObjCmd( | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ConsoleObjCmd( void *clientData, /* Access to the console interp */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { int index, result; static const char *const options[] = { "eval", "hide", "show", "title", NULL}; |
︙ | ︙ | |||
724 725 726 727 728 729 730 | cmd = objv[2]; break; case CON_HIDE: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } | | | | | | 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 | cmd = objv[2]; break; case CON_HIDE: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } cmd = Tcl_NewStringObj("wm withdraw .", TCL_INDEX_NONE); break; case CON_SHOW: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } cmd = Tcl_NewStringObj("wm deiconify .", TCL_INDEX_NONE); break; case CON_TITLE: if (objc > 3) { Tcl_WrongNumArgs(interp, 2, objv, "?title?"); return TCL_ERROR; } cmd = Tcl_NewStringObj("wm title .", TCL_INDEX_NONE); if (objc == 3) { Tcl_ListObjAppendElement(NULL, cmd, objv[2]); } break; default: CLANG_ASSERT(0); } Tcl_IncrRefCount(cmd); if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_Preserve(consoleInterp); result = Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp)); Tcl_Release(consoleInterp); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no active console interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NONE", NULL); result = TCL_ERROR; } Tcl_DecrRefCount(cmd); return result; } |
︙ | ︙ | |||
781 782 783 784 785 786 787 | * A standard Tcl result. * *---------------------------------------------------------------------- */ static int InterpreterObjCmd( | | | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | * A standard Tcl result. * *---------------------------------------------------------------------- */ static int InterpreterObjCmd( void *clientData, /* */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { int index, result = TCL_OK; static const char *const options[] = {"eval", "record", NULL}; enum option {OTHER_EVAL, OTHER_RECORD}; |
︙ | ︙ | |||
808 809 810 811 812 813 814 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "script"); return TCL_ERROR; } if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "script"); return TCL_ERROR; } if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no active parent interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL); return TCL_ERROR; } Tcl_Preserve(otherInterp); switch ((enum option) index) { case OTHER_EVAL: |
︙ | ︙ | |||
855 856 857 858 859 860 861 | * lives in gets torn down. * *---------------------------------------------------------------------- */ static void DeleteConsoleInterp( | | | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | * lives in gets torn down. * *---------------------------------------------------------------------- */ static void DeleteConsoleInterp( void *clientData) { Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_DeleteInterp(interp); } /* |
︙ | ︙ | |||
881 882 883 884 885 886 887 | * A new console it created. * *---------------------------------------------------------------------- */ static void InterpDeleteProc( | | | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | * A new console it created. * *---------------------------------------------------------------------- */ static void InterpDeleteProc( void *clientData, Tcl_Interp *interp) { ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; |
︙ | ︙ | |||
914 915 916 917 918 919 920 | * A new console it created. * *---------------------------------------------------------------------- */ static void ConsoleDeleteProc( | | | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | * A new console it created. * *---------------------------------------------------------------------- */ static void ConsoleDeleteProc( void *clientData) { ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); } if (info->refCount-- <= 1) { |
︙ | ︙ | |||
947 948 949 950 951 952 953 | * Invokes the "::tk::ConsoleExit" command in the console interp. * *---------------------------------------------------------------------- */ static void ConsoleEventProc( | | | | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | * Invokes the "::tk::ConsoleExit" command in the console interp. * *---------------------------------------------------------------------- */ static void ConsoleEventProc( void *clientData, XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (info->refCount-- <= 1) { ckfree(info); } } } |
︙ | ︙ |
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 17 18 19 20 21 22 23 24 25 26 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * A TkCursor structure exists for each cursor that is currently active. Each * structure is indexed with two hash tables defined below. One of the tables * is cursorIdTable, and the other is either cursorNameTable or * cursorDataTable, each of which are stored in the TkDisplay structure for * the current thread. |
︙ | ︙ | |||
51 52 53 54 55 56 57 | * The following structure defines the implementation of the "cursor" Tcl * object, used for drawing. The color object remembers the hash table * entry associated with a color. The actual allocation and deallocation * of the color should be done by the configuration package when the cursor * option is set. */ | | | | > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | * The following structure defines the implementation of the "cursor" Tcl * object, used for drawing. The color object remembers the hash table * entry associated with a color. The actual allocation and deallocation * of the color should be done by the configuration package when the cursor * option is set. */ const TkObjType tkCursorObjType = { {"cursor", /* name */ FreeCursorObjProc, /* freeIntRepProc */ DupCursorObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *---------------------------------------------------------------------- * * Tk_AllocCursorFromObj -- * |
︙ | ︙ | |||
93 94 95 96 97 98 99 | Tk_Window tkwin, /* Window in which the cursor will be used.*/ Tcl_Obj *objPtr) /* Object describing cursor; see manual entry * for description of legal syntax of this * obj's string rep. */ { TkCursor *cursorPtr; | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | Tk_Window tkwin, /* Window in which the cursor will be used.*/ Tcl_Obj *objPtr) /* Object describing cursor; see manual entry * for description of legal syntax of this * obj's string rep. */ { TkCursor *cursorPtr; if (objPtr->typePtr != &tkCursorObjType.objType) { InitCursorObj(objPtr); } cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we * want. If so, increment its reference count and return. |
︙ | ︙ | |||
421 422 423 424 425 426 427 | TkCursor *cursorPtr; TkDisplay *dispPtr; dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { printid: | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | TkCursor *cursorPtr; TkDisplay *dispPtr; dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { printid: snprintf(dispPtr->cursorString, sizeof(dispPtr->cursorString), "cursor id 0x%" TCL_Z_MODIFIER "x", PTR2INT(cursor)); return dispPtr->cursorString; } idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor); if (idHashPtr == NULL) { goto printid; } cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr); |
︙ | ︙ | |||
690 691 692 693 694 695 696 | Tcl_Obj *objPtr) /* The object that describes the desired * cursor. */ { TkCursor *cursorPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | Tcl_Obj *objPtr) /* The object that describes the desired * cursor. */ { TkCursor *cursorPtr; Tcl_HashEntry *hashPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objPtr->typePtr != &tkCursorObjType.objType) { InitCursorObj(objPtr); } /* * The internal representation is a cache of the last cursor used with the * given name. But there can be lots different cursors for each cursor * name; one cursor for each display. Check to see if the cursor we have |
︙ | ︙ | |||
767 768 769 770 771 772 773 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } | | | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkCursorObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; } /* *---------------------------------------------------------------------- * * CursorInit -- |
︙ | ︙ |
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 |
︙ | ︙ | |||
436 437 438 439 440 441 442 | } \ \ __TK_DLIST_UNUSED \ static void \ LT##_Free(struct ElemType *elem) \ { \ LT##_Remove(elem); \ | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | } \ \ __TK_DLIST_UNUSED \ static void \ LT##_Free(struct ElemType *elem) \ { \ LT##_Remove(elem); \ ckfree((void *)elem); \ } \ \ __TK_DLIST_UNUSED \ static void \ LT##_RemoveHead(LT *head) \ { \ assert(!LT##_IsEmpty(head)); \ |
︙ | ︙ | |||
504 505 506 507 508 509 510 | LT##_Clear(LT *head) \ { \ struct ElemType *p; \ struct ElemType *next; \ assert(head); \ for (p = head->first; p; p = next) { \ next = LT##_Next(p); \ | | | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | LT##_Clear(LT *head) \ { \ struct ElemType *p; \ struct ElemType *next; \ assert(head); \ for (p = head->first; p; p = next) { \ next = LT##_Next(p); \ ckfree((void *)p); \ } \ LT##_Init(head); \ } \ \ __TK_DLIST_UNUSED \ static void \ LT##_Traverse(LT *head, LT##_Func func) \ |
︙ | ︙ |
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 © 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 |
︙ | ︙ | |||
60 61 62 63 64 65 66 | int relief); /* 5 */ EXTERN void Tk_AddOption(Tk_Window tkwin, const char *name, const char *value, int priority); /* 6 */ EXTERN void Tk_BindEvent(Tk_BindingTable bindingTable, XEvent *eventPtr, Tk_Window tkwin, | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | int relief); /* 5 */ EXTERN void Tk_AddOption(Tk_Window tkwin, const char *name, const char *value, int priority); /* 6 */ EXTERN void Tk_BindEvent(Tk_BindingTable bindingTable, XEvent *eventPtr, Tk_Window tkwin, Tcl_Size numObjects, void **objectPtr); /* 7 */ EXTERN void Tk_CanvasDrawableCoords(Tk_Canvas canvas, double x, double y, short *drawableXPtr, short *drawableYPtr); /* 8 */ EXTERN void Tk_CanvasEventuallyRedraw(Tk_Canvas canvas, int x1, int y1, int x2, int y2); |
︙ | ︙ | |||
86 87 88 89 90 91 92 | EXTERN int Tk_CanvasPsColor(Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 13 */ EXTERN int Tk_CanvasPsFont(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 14 */ EXTERN void Tk_CanvasPsPath(Tcl_Interp *interp, Tk_Canvas canvas, | | | | > | | | | | | | | | | | | | < | | | | | | | | | | | | | 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 | EXTERN int Tk_CanvasPsColor(Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 13 */ EXTERN int Tk_CanvasPsFont(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 14 */ EXTERN void Tk_CanvasPsPath(Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, Tcl_Size numPoints); /* 15 */ EXTERN int Tk_CanvasPsStipple(Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap); /* 16 */ EXTERN double Tk_CanvasPsY(Tk_Canvas canvas, double y); /* 17 */ EXTERN void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc); /* 18 */ EXTERN int Tk_CanvasTagsParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 19 */ EXTERN const char * Tk_CanvasTagsPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 20 */ EXTERN Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas); /* 21 */ EXTERN void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 22 */ EXTERN void Tk_ChangeWindowAttributes(Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 23 */ EXTERN int Tk_CharBbox(Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 24 */ EXTERN void Tk_ClearSelection(Tk_Window tkwin, Atom selection); /* 25 */ EXTERN int Tk_ClipboardAppend(Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 26 */ EXTERN int Tk_ClipboardClear(Tcl_Interp *interp, Tk_Window tkwin); /* 27 */ EXTERN int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 28 */ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags); /* 30 */ EXTERN void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 31 */ EXTERN Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 32 */ EXTERN Tk_Window Tk_CoordsToWindow(int rootX, int rootY, Tk_Window tkwin); /* 33 */ EXTERN unsigned long Tk_CreateBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr, const char *script, int append); /* 34 */ EXTERN Tk_BindingTable Tk_CreateBindingTable(Tcl_Interp *interp); /* 35 */ EXTERN Tk_ErrorHandler Tk_CreateErrorHandler(Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, void *clientData); /* 36 */ EXTERN void Tk_CreateEventHandler(Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData); /* 37 */ EXTERN void Tk_CreateGenericHandler(Tk_GenericProc *proc, void *clientData); /* 38 */ EXTERN void Tk_CreateImageType(const Tk_ImageType *typePtr); /* 39 */ EXTERN void Tk_CreateItemType(Tk_ItemType *typePtr); /* 40 */ EXTERN void Tk_CreatePhotoImageFormat( const Tk_PhotoImageFormat *formatPtr); /* 41 */ EXTERN void Tk_CreateSelHandler(Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc *proc, void *clientData, Atom format); /* 42 */ EXTERN Tk_Window Tk_CreateWindow(Tcl_Interp *interp, Tk_Window parent, const char *name, const char *screenName); /* 43 */ EXTERN Tk_Window Tk_CreateWindowFromPath(Tcl_Interp *interp, Tk_Window tkwin, const char *pathName, const char *screenName); /* 44 */ EXTERN int Tk_DefineBitmap(Tcl_Interp *interp, const char *name, const void *source, int width, int height); /* 45 */ EXTERN void Tk_DefineCursor(Tk_Window window, Tk_Cursor cursor); /* 46 */ EXTERN void Tk_DeleteAllBindings(Tk_BindingTable bindingTable, void *object); /* 47 */ EXTERN int Tk_DeleteBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr); /* 48 */ EXTERN void Tk_DeleteBindingTable(Tk_BindingTable bindingTable); /* 49 */ EXTERN void Tk_DeleteErrorHandler(Tk_ErrorHandler handler); /* 50 */ EXTERN void Tk_DeleteEventHandler(Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData); /* 51 */ EXTERN void Tk_DeleteGenericHandler(Tk_GenericProc *proc, void *clientData); /* 52 */ EXTERN void Tk_DeleteImage(Tcl_Interp *interp, const char *name); /* 53 */ EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target); /* 54 */ EXTERN void Tk_DestroyWindow(Tk_Window tkwin); /* 55 */ EXTERN const char * Tk_DisplayName(Tk_Window tkwin); /* 56 */ EXTERN int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y); /* 57 */ EXTERN void Tk_Draw3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 58 */ EXTERN void Tk_Draw3DRectangle(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 59 */ EXTERN void Tk_DrawChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, int x, int y); /* 60 */ EXTERN void Tk_DrawFocusHighlight(Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 61 */ EXTERN void Tk_DrawTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, Tcl_Size firstChar, Tcl_Size lastChar); /* 62 */ EXTERN void Tk_Fill3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 63 */ EXTERN void Tk_Fill3DRectangle(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 64 */ |
︙ | ︙ | |||
278 279 280 281 282 283 284 | EXTERN void Tk_FreeFont(Tk_Font f); /* 72 */ EXTERN void Tk_FreeGC(Display *display, GC gc); /* 73 */ EXTERN void Tk_FreeImage(Tk_Image image); /* 74 */ EXTERN void Tk_FreeOptions(const Tk_ConfigSpec *specs, | | | < < | < | | | 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 | EXTERN void Tk_FreeFont(Tk_Font f); /* 72 */ EXTERN void Tk_FreeGC(Display *display, GC gc); /* 73 */ EXTERN void Tk_FreeImage(Tk_Image image); /* 74 */ EXTERN void Tk_FreeOptions(const Tk_ConfigSpec *specs, void *widgRec, Display *display, int needFlags); /* 75 */ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap); /* 76 */ EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout); /* Slot 77 is reserved */ /* 78 */ EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable); /* 79 */ EXTERN void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight); /* 80 */ EXTERN Tk_3DBorder Tk_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 81 */ EXTERN void Tk_GetAllBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object); /* 82 */ EXTERN int Tk_GetAnchor(Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr); /* 83 */ EXTERN const char * Tk_GetAtomName(Tk_Window tkwin, Atom atom); /* 84 */ EXTERN const char * Tk_GetBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr); /* 85 */ EXTERN Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 86 */ EXTERN Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp, Tk_Window tkwin, const void *source, int width, int height); |
︙ | ︙ | |||
349 350 351 352 353 354 355 | /* 96 */ EXTERN GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 97 */ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, | | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | /* 96 */ EXTERN GC Tk_GetGC(Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 97 */ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, void *clientData); /* 98 */ EXTERN void * Tk_GetImageModelData(Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 99 */ EXTERN Tk_ItemType * Tk_GetItemTypes(void); /* 100 */ EXTERN int Tk_GetJoinStyle(Tcl_Interp *interp, const char *str, int *joinPtr); |
︙ | ︙ | |||
380 381 382 383 384 385 386 | /* 106 */ EXTERN int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr); /* 107 */ EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr); /* 108 */ | | | | < | < | | 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 | /* 106 */ EXTERN int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr); /* 107 */ EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr); /* 108 */ EXTERN int Tk_GetScrollInfo(Tcl_Interp *interp, Tcl_Size argc, const char **argv, double *dblPtr, int *intPtr); /* 109 */ EXTERN int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr); /* 110 */ EXTERN int Tk_GetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData); /* 111 */ EXTERN Tk_Uid Tk_GetUid(const char *str); /* 112 */ EXTERN Visual * Tk_GetVisual(Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *depthPtr, Colormap *colormapPtr); /* 113 */ EXTERN void Tk_GetVRootGeometry(Tk_Window tkwin, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 114 */ EXTERN int Tk_Grab(Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 115 */ EXTERN void Tk_HandleEvent(XEvent *eventPtr); /* 116 */ EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window); /* 117 */ EXTERN void Tk_ImageChanged(Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* Slot 118 is reserved */ /* 119 */ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name); /* 120 */ EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y, int width, int height); /* 121 */ EXTERN void Tk_MaintainGeometry(Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 122 */ EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp); /* 123 */ EXTERN void Tk_MakeWindowExist(Tk_Window tkwin); /* 124 */ EXTERN void Tk_ManageGeometry(Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, void *clientData); /* 125 */ EXTERN void Tk_MapWindow(Tk_Window tkwin); /* 126 */ EXTERN int Tk_MeasureChars(Tk_Font tkfont, const char *source, Tcl_Size numBytes, int maxPixels, int flags, int *lengthPtr); /* 127 */ EXTERN void Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y, int width, int height); /* 128 */ EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y); /* 129 */ |
︙ | ︙ | |||
469 470 471 472 473 474 475 | /* 140 */ EXTERN const char * Tk_NameOfRelief(int relief); /* 141 */ EXTERN Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 142 */ EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection, | | | < < < < | < < < < < < | < < < | < < < | 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 | /* 140 */ EXTERN const char * Tk_NameOfRelief(int relief); /* 141 */ EXTERN Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 142 */ EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, void *clientData); /* 143 */ EXTERN int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* Slot 144 is reserved */ /* Slot 145 is reserved */ /* 146 */ EXTERN int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 147 */ EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle); /* Slot 148 is reserved */ /* 149 */ EXTERN void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* Slot 150 is reserved */ /* 151 */ EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y); /* 152 */ EXTERN int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString *dsPtr); /* 153 */ EXTERN void Tk_PreserveColormap(Display *display, |
︙ | ︙ | |||
525 526 527 528 529 530 531 | /* 156 */ EXTERN void Tk_ResizeWindow(Tk_Window tkwin, int width, int height); /* 157 */ EXTERN int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 158 */ | | | | < | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | /* 156 */ EXTERN void Tk_ResizeWindow(Tk_Window tkwin, int width, int height); /* 157 */ EXTERN int Tk_RestackWindow(Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 158 */ EXTERN Tk_RestrictProc * Tk_RestrictEvents(Tk_RestrictProc *proc, void *arg, void **prevArgPtr); /* Slot 159 is reserved */ /* 160 */ EXTERN const char * Tk_SetAppName(Tk_Window tkwin, const char *name); /* 161 */ EXTERN void Tk_SetBackgroundFromBorder(Tk_Window tkwin, Tk_3DBorder border); /* 162 */ EXTERN void Tk_SetClass(Tk_Window tkwin, const char *className); |
︙ | ︙ | |||
574 575 576 577 578 579 580 | /* 174 */ EXTERN int Tk_StrictMotif(Tk_Window tkwin); /* 175 */ EXTERN void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout); /* 176 */ EXTERN int Tk_TextWidth(Tk_Font font, const char *str, | | | | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | /* 174 */ EXTERN int Tk_StrictMotif(Tk_Window tkwin); /* 175 */ EXTERN void Tk_TextLayoutToPostscript(Tcl_Interp *interp, Tk_TextLayout layout); /* 176 */ EXTERN int Tk_TextWidth(Tk_Font font, const char *str, Tcl_Size numBytes); /* 177 */ EXTERN void Tk_UndefineCursor(Tk_Window window); /* 178 */ EXTERN void Tk_UnderlineChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, Tcl_Size firstByte, Tcl_Size lastByte); /* 179 */ EXTERN void Tk_UnderlineTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 180 */ EXTERN void Tk_Ungrab(Tk_Window tkwin); |
︙ | ︙ | |||
671 672 673 674 675 676 677 | EXTERN int Tk_GetPixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 209 */ EXTERN int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 210 */ | | | | | < < < | | < | 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 | EXTERN int Tk_GetPixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 209 */ EXTERN int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 210 */ EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 211 */ EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* Slot 212 is reserved */ /* 213 */ EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr); /* 214 */ EXTERN int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 215 */ EXTERN void Tk_InitConsoleChannels(Tcl_Interp *interp); /* Slot 216 is reserved */ /* 217 */ EXTERN void Tk_CreateSmoothMethod(Tcl_Interp *interp, const Tk_SmoothMethod *method); /* Slot 218 is reserved */ /* Slot 219 is reserved */ /* 220 */ EXTERN int Tk_GetDash(Tcl_Interp *interp, const char *value, |
︙ | ︙ | |||
749 750 751 752 753 754 755 | EXTERN int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); /* 235 */ EXTERN void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, double *coordPtr, | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | EXTERN int Tk_PostscriptImage(Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); /* 235 */ EXTERN void Tk_PostscriptPath(Tcl_Interp *interp, Tk_PostscriptInfo psInfo, double *coordPtr, Tcl_Size numPoints); /* 236 */ EXTERN int Tk_PostscriptStipple(Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap); /* 237 */ EXTERN double Tk_PostscriptY(double y, Tk_PostscriptInfo psInfo); /* 238 */ |
︙ | ︙ | |||
773 774 775 776 777 778 779 | Tk_ClientMessageProc *proc); /* 241 */ EXTERN Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp, Tk_Window parent, const char *screenName); /* 242 */ EXTERN void Tk_SetClassProcs(Tk_Window tkwin, const Tk_ClassProcs *procs, | | | < < < < | < < < < < | | < | < | > | 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 | Tk_ClientMessageProc *proc); /* 241 */ EXTERN Tk_Window Tk_CreateAnonymousWindow(Tcl_Interp *interp, Tk_Window parent, const char *screenName); /* 242 */ EXTERN void Tk_SetClassProcs(Tk_Window tkwin, const Tk_ClassProcs *procs, void *instanceData); /* 243 */ EXTERN void Tk_SetInternalBorderEx(Tk_Window tkwin, int left, int right, int top, int bottom); /* 244 */ EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin, int minWidth, int minHeight); /* 245 */ EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height); /* Slot 246 is reserved */ /* Slot 247 is reserved */ /* 248 */ EXTERN int Tk_CollapseMotionEvents(Display *display, int collapse); /* 249 */ EXTERN Tk_StyleEngine Tk_RegisterStyleEngine(const char *name, Tk_StyleEngine parent); /* 250 */ EXTERN Tk_StyleEngine Tk_GetStyleEngine(const char *name); /* 251 */ EXTERN int Tk_RegisterStyledElement(Tk_StyleEngine engine, Tk_ElementSpec *templatePtr); /* 252 */ EXTERN int Tk_GetElementId(const char *name); /* 253 */ EXTERN Tk_Style Tk_CreateStyle(const char *name, Tk_StyleEngine engine, void *clientData); /* 254 */ EXTERN Tk_Style Tk_GetStyle(Tcl_Interp *interp, const char *name); /* 255 */ EXTERN void Tk_FreeStyle(Tk_Style style); /* 256 */ EXTERN const char * Tk_NameOfStyle(Tk_Style style); /* 257 */ EXTERN Tk_Style Tk_AllocStyleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); /* Slot 258 is reserved */ /* Slot 259 is reserved */ /* 260 */ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, Tcl_Size elementId, Tk_OptionTable optionTable); /* 261 */ EXTERN void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 262 */ |
︙ | ︙ | |||
869 870 871 872 873 874 875 | Tk_PhotoHandle handle, int width, int height); /* 269 */ EXTERN long Tk_GetUserInactiveTime(Display *dpy); /* 270 */ EXTERN void Tk_ResetUserInactiveTime(Display *dpy); /* 271 */ EXTERN Tcl_Interp * Tk_Interp(Tk_Window tkwin); | | < | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | Tk_PhotoHandle handle, int width, int height); /* 269 */ EXTERN long Tk_GetUserInactiveTime(Display *dpy); /* 270 */ EXTERN void Tk_ResetUserInactiveTime(Display *dpy); /* 271 */ EXTERN Tcl_Interp * Tk_Interp(Tk_Window tkwin); /* Slot 272 is reserved */ /* Slot 273 is reserved */ /* 274 */ EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin); /* 275 */ EXTERN unsigned Tk_GetButtonMask(unsigned button); /* 276 */ EXTERN int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 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; typedef struct TkStubs { int magic; const TkStubHooks *hooks; void (*tk_MainLoop) (void); /* 0 */ XColor * (*tk_3DBorderColor) (Tk_3DBorder border); /* 1 */ GC (*tk_3DBorderGC) (Tk_Window tkwin, Tk_3DBorder border, int which); /* 2 */ void (*tk_3DHorizontalBevel) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftIn, int rightIn, int topBevel, int relief); /* 3 */ void (*tk_3DVerticalBevel) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int leftBevel, int relief); /* 4 */ void (*tk_AddOption) (Tk_Window tkwin, const char *name, const char *value, int priority); /* 5 */ void (*tk_BindEvent) (Tk_BindingTable bindingTable, XEvent *eventPtr, Tk_Window tkwin, Tcl_Size numObjects, void **objectPtr); /* 6 */ void (*tk_CanvasDrawableCoords) (Tk_Canvas canvas, double x, double y, short *drawableXPtr, short *drawableYPtr); /* 7 */ void (*tk_CanvasEventuallyRedraw) (Tk_Canvas canvas, int x1, int y1, int x2, int y2); /* 8 */ int (*tk_CanvasGetCoord) (Tcl_Interp *interp, Tk_Canvas canvas, const char *str, double *doublePtr); /* 9 */ Tk_CanvasTextInfo * (*tk_CanvasGetTextInfo) (Tk_Canvas canvas); /* 10 */ int (*tk_CanvasPsBitmap) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap, int x, int y, int width, int height); /* 11 */ int (*tk_CanvasPsColor) (Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 12 */ int (*tk_CanvasPsFont) (Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 13 */ void (*tk_CanvasPsPath) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, Tcl_Size numPoints); /* 14 */ int (*tk_CanvasPsStipple) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap); /* 15 */ double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */ void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */ int (*tk_CanvasTagsParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 18 */ const char * (*tk_CanvasTagsPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 19 */ Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */ int (*tk_CharBbox) (Tk_TextLayout layout, Tcl_Size index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 27 */ int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 28 */ int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size objc, Tcl_Obj *const *objv, void *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ unsigned long (*tk_CreateBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr, const char *script, int append); /* 33 */ Tk_BindingTable (*tk_CreateBindingTable) (Tcl_Interp *interp); /* 34 */ Tk_ErrorHandler (*tk_CreateErrorHandler) (Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, void *clientData); /* 35 */ void (*tk_CreateEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData); /* 36 */ void (*tk_CreateGenericHandler) (Tk_GenericProc *proc, void *clientData); /* 37 */ void (*tk_CreateImageType) (const Tk_ImageType *typePtr); /* 38 */ void (*tk_CreateItemType) (Tk_ItemType *typePtr); /* 39 */ void (*tk_CreatePhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 40 */ void (*tk_CreateSelHandler) (Tk_Window tkwin, Atom selection, Atom target, Tk_SelectionProc *proc, void *clientData, Atom format); /* 41 */ Tk_Window (*tk_CreateWindow) (Tcl_Interp *interp, Tk_Window parent, const char *name, const char *screenName); /* 42 */ Tk_Window (*tk_CreateWindowFromPath) (Tcl_Interp *interp, Tk_Window tkwin, const char *pathName, const char *screenName); /* 43 */ int (*tk_DefineBitmap) (Tcl_Interp *interp, const char *name, const void *source, int width, int height); /* 44 */ void (*tk_DefineCursor) (Tk_Window window, Tk_Cursor cursor); /* 45 */ void (*tk_DeleteAllBindings) (Tk_BindingTable bindingTable, void *object); /* 46 */ int (*tk_DeleteBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr); /* 47 */ void (*tk_DeleteBindingTable) (Tk_BindingTable bindingTable); /* 48 */ void (*tk_DeleteErrorHandler) (Tk_ErrorHandler handler); /* 49 */ void (*tk_DeleteEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, void *clientData); /* 50 */ void (*tk_DeleteGenericHandler) (Tk_GenericProc *proc, void *clientData); /* 51 */ void (*tk_DeleteImage) (Tcl_Interp *interp, const char *name); /* 52 */ void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */ void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */ const char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */ int (*tk_DistanceToTextLayout) (Tk_TextLayout layout, int x, int y); /* 56 */ void (*tk_Draw3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 57 */ void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */ void (*tk_DrawChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, int x, int y); /* 59 */ void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */ void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, Tcl_Size firstChar, Tcl_Size lastChar); /* 61 */ void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, Tcl_Size numPoints, int borderWidth, int leftRelief); /* 62 */ void (*tk_Fill3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 63 */ Tk_PhotoHandle (*tk_FindPhoto) (Tcl_Interp *interp, const char *imageName); /* 64 */ Font (*tk_FontId) (Tk_Font font); /* 65 */ void (*tk_Free3DBorder) (Tk_3DBorder border); /* 66 */ void (*tk_FreeBitmap) (Display *display, Pixmap bitmap); /* 67 */ void (*tk_FreeColor) (XColor *colorPtr); /* 68 */ void (*tk_FreeColormap) (Display *display, Colormap colormap); /* 69 */ void (*tk_FreeCursor) (Display *display, Tk_Cursor cursor); /* 70 */ void (*tk_FreeFont) (Tk_Font f); /* 71 */ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */ void (*tk_FreeImage) (Tk_Image image); /* 73 */ void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, void *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ void (*reserved77)(void); GC (*tk_GCForColor) (XColor *colorPtr, Drawable drawable); /* 78 */ void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */ Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */ void (*tk_GetAllBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object); /* 81 */ int (*tk_GetAnchor) (Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr); /* 82 */ const char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */ const char * (*tk_GetBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, void *object, const char *eventStr); /* 84 */ Pixmap (*tk_GetBitmap) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 85 */ Pixmap (*tk_GetBitmapFromData) (Tcl_Interp *interp, Tk_Window tkwin, const void *source, int width, int height); /* 86 */ int (*tk_GetCapStyle) (Tcl_Interp *interp, const char *str, int *capPtr); /* 87 */ XColor * (*tk_GetColor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); /* 88 */ XColor * (*tk_GetColorByValue) (Tk_Window tkwin, XColor *colorPtr); /* 89 */ Colormap (*tk_GetColormap) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 90 */ Tk_Cursor (*tk_GetCursor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid str); /* 91 */ Tk_Cursor (*tk_GetCursorFromData) (Tcl_Interp *interp, Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, Tk_Uid fg, Tk_Uid bg); /* 92 */ Tk_Font (*tk_GetFont) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 93 */ Tk_Font (*tk_GetFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 94 */ void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */ GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */ Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, void *clientData); /* 97 */ void * (*tk_GetImageModelData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */ Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */ int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */ int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */ int (*tk_GetNumMainWindows) (void); /* 102 */ Tk_Uid (*tk_GetOption) (Tk_Window tkwin, const char *name, const char *className); /* 103 */ int (*tk_GetPixels) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *intPtr); /* 104 */ Pixmap (*tk_GetPixmap) (Display *display, Drawable d, int width, int height, int depth); /* 105 */ int (*tk_GetRelief) (Tcl_Interp *interp, const char *name, int *reliefPtr); /* 106 */ void (*tk_GetRootCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 107 */ int (*tk_GetScrollInfo) (Tcl_Interp *interp, Tcl_Size argc, const char **argv, double *dblPtr, int *intPtr); /* 108 */ int (*tk_GetScreenMM) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr); /* 109 */ int (*tk_GetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData); /* 110 */ Tk_Uid (*tk_GetUid) (const char *str); /* 111 */ Visual * (*tk_GetVisual) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *depthPtr, Colormap *colormapPtr); /* 112 */ void (*tk_GetVRootGeometry) (Tk_Window tkwin, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 113 */ int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */ void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */ Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */ void (*tk_ImageChanged) (Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ void (*reserved118)(void); Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */ int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */ void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */ Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */ void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */ void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, void *clientData); /* 124 */ void (*tk_MapWindow) (Tk_Window tkwin); /* 125 */ int (*tk_MeasureChars) (Tk_Font tkfont, const char *source, Tcl_Size numBytes, int maxPixels, int flags, int *lengthPtr); /* 126 */ void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */ void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */ void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */ const char * (*tk_NameOf3DBorder) (Tk_3DBorder border); /* 130 */ const char * (*tk_NameOfAnchor) (Tk_Anchor anchor); /* 131 */ const char * (*tk_NameOfBitmap) (Display *display, Pixmap bitmap); /* 132 */ const char * (*tk_NameOfCapStyle) (int cap); /* 133 */ const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */ const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */ const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */ const char * (*tk_NameOfImage) (Tk_ImageModel model); /* 137 */ const char * (*tk_NameOfJoinStyle) (int join); /* 138 */ const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */ const char * (*tk_NameOfRelief) (int relief); /* 140 */ Tk_Window (*tk_NameToWindow) (Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 141 */ void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, void *clientData); /* 142 */ int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* 143 */ void (*reserved144)(void); void (*reserved145)(void); int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 146 */ void (*tk_PhotoBlank) (Tk_PhotoHandle handle); /* 147 */ void (*reserved148)(void); void (*tk_PhotoGetSize) (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 149 */ void (*reserved150)(void); int (*tk_PointToChar) (Tk_TextLayout layout, int x, int y); /* 151 */ int (*tk_PostscriptFontName) (Tk_Font tkfont, Tcl_DString *dsPtr); /* 152 */ void (*tk_PreserveColormap) (Display *display, Colormap colormap); /* 153 */ void (*tk_QueueWindowEvent) (XEvent *eventPtr, Tcl_QueuePosition position); /* 154 */ void (*tk_RedrawImage) (Tk_Image image, int imageX, int imageY, int width, int height, Drawable drawable, int drawableX, int drawableY); /* 155 */ void (*tk_ResizeWindow) (Tk_Window tkwin, int width, int height); /* 156 */ int (*tk_RestackWindow) (Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 157 */ Tk_RestrictProc * (*tk_RestrictEvents) (Tk_RestrictProc *proc, void *arg, void **prevArgPtr); /* 158 */ void (*reserved159)(void); const char * (*tk_SetAppName) (Tk_Window tkwin, const char *name); /* 160 */ void (*tk_SetBackgroundFromBorder) (Tk_Window tkwin, Tk_3DBorder border); /* 161 */ void (*tk_SetClass) (Tk_Window tkwin, const char *className); /* 162 */ void (*tk_SetGrid) (Tk_Window tkwin, int reqWidth, int reqHeight, int gridWidth, int gridHeight); /* 163 */ void (*tk_SetInternalBorder) (Tk_Window tkwin, int width); /* 164 */ void (*tk_SetWindowBackground) (Tk_Window tkwin, unsigned long pixel); /* 165 */ void (*tk_SetWindowBackgroundPixmap) (Tk_Window tkwin, Pixmap pixmap); /* 166 */ void (*tk_SetWindowBorder) (Tk_Window tkwin, unsigned long pixel); /* 167 */ void (*tk_SetWindowBorderWidth) (Tk_Window tkwin, int width); /* 168 */ void (*tk_SetWindowBorderPixmap) (Tk_Window tkwin, Pixmap pixmap); /* 169 */ void (*tk_SetWindowColormap) (Tk_Window tkwin, Colormap colormap); /* 170 */ int (*tk_SetWindowVisual) (Tk_Window tkwin, Visual *visual, int depth, Colormap colormap); /* 171 */ void (*tk_SizeOfBitmap) (Display *display, Pixmap bitmap, int *widthPtr, int *heightPtr); /* 172 */ void (*tk_SizeOfImage) (Tk_Image image, int *widthPtr, int *heightPtr); /* 173 */ int (*tk_StrictMotif) (Tk_Window tkwin); /* 174 */ void (*tk_TextLayoutToPostscript) (Tcl_Interp *interp, Tk_TextLayout layout); /* 175 */ int (*tk_TextWidth) (Tk_Font font, const char *str, Tcl_Size numBytes); /* 176 */ void (*tk_UndefineCursor) (Tk_Window window); /* 177 */ void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, Tcl_Size firstByte, Tcl_Size lastByte); /* 178 */ void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */ void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */ void (*tk_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 181 */ void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */ void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */ void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */ Pixmap (*tk_AllocBitmapFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 185 */ |
︙ | ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */ Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */ int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ | | | | | | | | | | | | | | | > > > > > > > > > > > | 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 | Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */ Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */ int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ void (*reserved212)(void); void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */ int (*tk_SetOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */ void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */ void (*reserved216)(void); void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, const Tk_SmoothMethod *method); /* 217 */ void (*reserved218)(void); void (*reserved219)(void); int (*tk_GetDash) (Tcl_Interp *interp, const char *value, Tk_Dash *dash); /* 220 */ void (*tk_CreateOutline) (Tk_Outline *outline); /* 221 */ void (*tk_DeleteOutline) (Display *display, Tk_Outline *outline); /* 222 */ int (*tk_ConfigOutlineGC) (XGCValues *gcValues, Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 223 */ int (*tk_ChangeOutlineGC) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 224 */ int (*tk_ResetOutlineGC) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 225 */ int (*tk_CanvasPsOutline) (Tk_Canvas canvas, Tk_Item *item, Tk_Outline *outline); /* 226 */ void (*tk_SetTSOrigin) (Tk_Window tkwin, GC gc, int x, int y); /* 227 */ int (*tk_CanvasGetCoordFromObj) (Tcl_Interp *interp, Tk_Canvas canvas, Tcl_Obj *obj, double *doublePtr); /* 228 */ void (*tk_CanvasSetOffset) (Tk_Canvas canvas, GC gc, Tk_TSOffset *offset); /* 229 */ void (*tk_DitherPhoto) (Tk_PhotoHandle handle, int x, int y, int width, int height); /* 230 */ int (*tk_PostscriptBitmap) (Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap, int startX, int startY, int width, int height); /* 231 */ int (*tk_PostscriptColor) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, XColor *colorPtr); /* 232 */ int (*tk_PostscriptFont) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, Tk_Font font); /* 233 */ int (*tk_PostscriptImage) (Tk_Image image, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); /* 234 */ void (*tk_PostscriptPath) (Tcl_Interp *interp, Tk_PostscriptInfo psInfo, double *coordPtr, Tcl_Size numPoints); /* 235 */ int (*tk_PostscriptStipple) (Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap); /* 236 */ double (*tk_PostscriptY) (double y, Tk_PostscriptInfo psInfo); /* 237 */ int (*tk_PostscriptPhoto) (Tcl_Interp *interp, Tk_PhotoImageBlock *blockPtr, Tk_PostscriptInfo psInfo, int width, int height); /* 238 */ void (*tk_CreateClientMessageHandler) (Tk_ClientMessageProc *proc); /* 239 */ void (*tk_DeleteClientMessageHandler) (Tk_ClientMessageProc *proc); /* 240 */ Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp *interp, Tk_Window parent, const char *screenName); /* 241 */ void (*tk_SetClassProcs) (Tk_Window tkwin, const Tk_ClassProcs *procs, void *instanceData); /* 242 */ void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */ void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */ void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */ void (*reserved246)(void); void (*reserved247)(void); int (*tk_CollapseMotionEvents) (Display *display, int collapse); /* 248 */ Tk_StyleEngine (*tk_RegisterStyleEngine) (const char *name, Tk_StyleEngine parent); /* 249 */ Tk_StyleEngine (*tk_GetStyleEngine) (const char *name); /* 250 */ int (*tk_RegisterStyledElement) (Tk_StyleEngine engine, Tk_ElementSpec *templatePtr); /* 251 */ int (*tk_GetElementId) (const char *name); /* 252 */ Tk_Style (*tk_CreateStyle) (const char *name, Tk_StyleEngine engine, void *clientData); /* 253 */ Tk_Style (*tk_GetStyle) (Tcl_Interp *interp, const char *name); /* 254 */ void (*tk_FreeStyle) (Tk_Style style); /* 255 */ const char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */ Tk_Style (*tk_AllocStyleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 257 */ void (*reserved258)(void); void (*reserved259)(void); Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, Tcl_Size elementId, Tk_OptionTable optionTable); /* 260 */ void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */ void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */ int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 263 */ void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */ int (*tk_PhotoExpand) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 265 */ int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */ int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */ int (*tk_PhotoSetSize) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 268 */ long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */ void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */ Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ void (*reserved272)(void); void (*reserved273)(void); 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 |
︙ | ︙ | |||
1349 1350 1351 1352 1353 1354 1355 | (tkStubsPtr->tk_FreeImage) /* 73 */ #define Tk_FreeOptions \ (tkStubsPtr->tk_FreeOptions) /* 74 */ #define Tk_FreePixmap \ (tkStubsPtr->tk_FreePixmap) /* 75 */ #define Tk_FreeTextLayout \ (tkStubsPtr->tk_FreeTextLayout) /* 76 */ | < | | 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | (tkStubsPtr->tk_FreeImage) /* 73 */ #define Tk_FreeOptions \ (tkStubsPtr->tk_FreeOptions) /* 74 */ #define Tk_FreePixmap \ (tkStubsPtr->tk_FreePixmap) /* 75 */ #define Tk_FreeTextLayout \ (tkStubsPtr->tk_FreeTextLayout) /* 76 */ /* Slot 77 is reserved */ #define Tk_GCForColor \ (tkStubsPtr->tk_GCForColor) /* 78 */ #define Tk_GeometryRequest \ (tkStubsPtr->tk_GeometryRequest) /* 79 */ #define Tk_Get3DBorder \ (tkStubsPtr->tk_Get3DBorder) /* 80 */ #define Tk_GetAllBindings \ |
︙ | ︙ | |||
1431 1432 1433 1434 1435 1436 1437 | (tkStubsPtr->tk_Grab) /* 114 */ #define Tk_HandleEvent \ (tkStubsPtr->tk_HandleEvent) /* 115 */ #define Tk_IdToWindow \ (tkStubsPtr->tk_IdToWindow) /* 116 */ #define Tk_ImageChanged \ (tkStubsPtr->tk_ImageChanged) /* 117 */ | < | | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 | (tkStubsPtr->tk_Grab) /* 114 */ #define Tk_HandleEvent \ (tkStubsPtr->tk_HandleEvent) /* 115 */ #define Tk_IdToWindow \ (tkStubsPtr->tk_IdToWindow) /* 116 */ #define Tk_ImageChanged \ (tkStubsPtr->tk_ImageChanged) /* 117 */ /* Slot 118 is reserved */ #define Tk_InternAtom \ (tkStubsPtr->tk_InternAtom) /* 119 */ #define Tk_IntersectTextLayout \ (tkStubsPtr->tk_IntersectTextLayout) /* 120 */ #define Tk_MaintainGeometry \ (tkStubsPtr->tk_MaintainGeometry) /* 121 */ #define Tk_MainWindow \ |
︙ | ︙ | |||
1483 1484 1485 1486 1487 1488 1489 | (tkStubsPtr->tk_NameOfRelief) /* 140 */ #define Tk_NameToWindow \ (tkStubsPtr->tk_NameToWindow) /* 141 */ #define Tk_OwnSelection \ (tkStubsPtr->tk_OwnSelection) /* 142 */ #define Tk_ParseArgv \ (tkStubsPtr->tk_ParseArgv) /* 143 */ | < | < | < | < | < | | 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 | (tkStubsPtr->tk_NameOfRelief) /* 140 */ #define Tk_NameToWindow \ (tkStubsPtr->tk_NameToWindow) /* 141 */ #define Tk_OwnSelection \ (tkStubsPtr->tk_OwnSelection) /* 142 */ #define Tk_ParseArgv \ (tkStubsPtr->tk_ParseArgv) /* 143 */ /* Slot 144 is reserved */ /* Slot 145 is reserved */ #define Tk_PhotoGetImage \ (tkStubsPtr->tk_PhotoGetImage) /* 146 */ #define Tk_PhotoBlank \ (tkStubsPtr->tk_PhotoBlank) /* 147 */ /* Slot 148 is reserved */ #define Tk_PhotoGetSize \ (tkStubsPtr->tk_PhotoGetSize) /* 149 */ /* Slot 150 is reserved */ #define Tk_PointToChar \ (tkStubsPtr->tk_PointToChar) /* 151 */ #define Tk_PostscriptFontName \ (tkStubsPtr->tk_PostscriptFontName) /* 152 */ #define Tk_PreserveColormap \ (tkStubsPtr->tk_PreserveColormap) /* 153 */ #define Tk_QueueWindowEvent \ (tkStubsPtr->tk_QueueWindowEvent) /* 154 */ #define Tk_RedrawImage \ (tkStubsPtr->tk_RedrawImage) /* 155 */ #define Tk_ResizeWindow \ (tkStubsPtr->tk_ResizeWindow) /* 156 */ #define Tk_RestackWindow \ (tkStubsPtr->tk_RestackWindow) /* 157 */ #define Tk_RestrictEvents \ (tkStubsPtr->tk_RestrictEvents) /* 158 */ /* Slot 159 is reserved */ #define Tk_SetAppName \ (tkStubsPtr->tk_SetAppName) /* 160 */ #define Tk_SetBackgroundFromBorder \ (tkStubsPtr->tk_SetBackgroundFromBorder) /* 161 */ #define Tk_SetClass \ (tkStubsPtr->tk_SetClass) /* 162 */ #define Tk_SetGrid \ |
︙ | ︙ | |||
1619 1620 1621 1622 1623 1624 1625 | (tkStubsPtr->tk_GetPixelsFromObj) /* 208 */ #define Tk_GetReliefFromObj \ (tkStubsPtr->tk_GetReliefFromObj) /* 209 */ #define Tk_GetScrollInfoObj \ (tkStubsPtr->tk_GetScrollInfoObj) /* 210 */ #define Tk_InitOptions \ (tkStubsPtr->tk_InitOptions) /* 211 */ | < | < | | 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | (tkStubsPtr->tk_GetPixelsFromObj) /* 208 */ #define Tk_GetReliefFromObj \ (tkStubsPtr->tk_GetReliefFromObj) /* 209 */ #define Tk_GetScrollInfoObj \ (tkStubsPtr->tk_GetScrollInfoObj) /* 210 */ #define Tk_InitOptions \ (tkStubsPtr->tk_InitOptions) /* 211 */ /* Slot 212 is reserved */ #define Tk_RestoreSavedOptions \ (tkStubsPtr->tk_RestoreSavedOptions) /* 213 */ #define Tk_SetOptions \ (tkStubsPtr->tk_SetOptions) /* 214 */ #define Tk_InitConsoleChannels \ (tkStubsPtr->tk_InitConsoleChannels) /* 215 */ /* Slot 216 is reserved */ #define Tk_CreateSmoothMethod \ (tkStubsPtr->tk_CreateSmoothMethod) /* 217 */ /* Slot 218 is reserved */ /* Slot 219 is reserved */ #define Tk_GetDash \ (tkStubsPtr->tk_GetDash) /* 220 */ #define Tk_CreateOutline \ |
︙ | ︙ | |||
1685 1686 1687 1688 1689 1690 1691 | (tkStubsPtr->tk_SetClassProcs) /* 242 */ #define Tk_SetInternalBorderEx \ (tkStubsPtr->tk_SetInternalBorderEx) /* 243 */ #define Tk_SetMinimumRequestSize \ (tkStubsPtr->tk_SetMinimumRequestSize) /* 244 */ #define Tk_SetCaretPos \ (tkStubsPtr->tk_SetCaretPos) /* 245 */ | < | < | < | < | | 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 | (tkStubsPtr->tk_SetClassProcs) /* 242 */ #define Tk_SetInternalBorderEx \ (tkStubsPtr->tk_SetInternalBorderEx) /* 243 */ #define Tk_SetMinimumRequestSize \ (tkStubsPtr->tk_SetMinimumRequestSize) /* 244 */ #define Tk_SetCaretPos \ (tkStubsPtr->tk_SetCaretPos) /* 245 */ /* Slot 246 is reserved */ /* Slot 247 is reserved */ #define Tk_CollapseMotionEvents \ (tkStubsPtr->tk_CollapseMotionEvents) /* 248 */ #define Tk_RegisterStyleEngine \ (tkStubsPtr->tk_RegisterStyleEngine) /* 249 */ #define Tk_GetStyleEngine \ (tkStubsPtr->tk_GetStyleEngine) /* 250 */ #define Tk_RegisterStyledElement \ (tkStubsPtr->tk_RegisterStyledElement) /* 251 */ #define Tk_GetElementId \ (tkStubsPtr->tk_GetElementId) /* 252 */ #define Tk_CreateStyle \ (tkStubsPtr->tk_CreateStyle) /* 253 */ #define Tk_GetStyle \ (tkStubsPtr->tk_GetStyle) /* 254 */ #define Tk_FreeStyle \ (tkStubsPtr->tk_FreeStyle) /* 255 */ #define Tk_NameOfStyle \ (tkStubsPtr->tk_NameOfStyle) /* 256 */ #define Tk_AllocStyleFromObj \ (tkStubsPtr->tk_AllocStyleFromObj) /* 257 */ /* Slot 258 is reserved */ /* Slot 259 is reserved */ #define Tk_GetStyledElement \ (tkStubsPtr->tk_GetStyledElement) /* 260 */ #define Tk_GetElementSize \ (tkStubsPtr->tk_GetElementSize) /* 261 */ #define Tk_GetElementBox \ (tkStubsPtr->tk_GetElementBox) /* 262 */ #define Tk_GetElementBorderWidth \ |
︙ | ︙ | |||
1737 1738 1739 1740 1741 1742 1743 | (tkStubsPtr->tk_PhotoSetSize) /* 268 */ #define Tk_GetUserInactiveTime \ (tkStubsPtr->tk_GetUserInactiveTime) /* 269 */ #define Tk_ResetUserInactiveTime \ (tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */ #define Tk_Interp \ (tkStubsPtr->tk_Interp) /* 271 */ | < | < | > > > > > > > > > > > > > > > > > > > > > > < | < < < | < | | < < < > > | | > > | > | > > > | | < < < < | | 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 | (tkStubsPtr->tk_PhotoSetSize) /* 268 */ #define Tk_GetUserInactiveTime \ (tkStubsPtr->tk_GetUserInactiveTime) /* 269 */ #define Tk_ResetUserInactiveTime \ (tkStubsPtr->tk_ResetUserInactiveTime) /* 270 */ #define Tk_Interp \ (tkStubsPtr->tk_Interp) /* 271 */ /* Slot 272 is reserved */ /* Slot 273 is reserved */ #define Tk_AlwaysShowSelection \ (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */ #define Tk_GetButtonMask \ (tkStubsPtr->tk_GetButtonMask) /* 275 */ #define Tk_GetDoublePixelsFromObj \ (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. */ #define Tk_GetImageMasterData Tk_GetImageModelData #ifndef MAC_OSX_TK # undef Tk_ClipDrawableToRect #endif EXTERN void Tk_MainEx(Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(Tcl_Size argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif EXTERN int Tk_Init(Tcl_Interp *interp); EXTERN int Tk_SafeInit(Tcl_Interp *interp); EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp); #if TK_MAJOR_VERSION < 9 /* Restore 8.x signature of Tk_ConfigureWidget, but panic if TK_CONFIG_OBJS flag is not set */ #undef Tk_ConfigureWidget #define Tk_ConfigureWidget(interp, tkwin, specs, argc, argv, widgRec, flags) \ ((int (*)(Tcl_Interp *, Tk_Window, const Tk_ConfigSpec *, \ int, const char **, char *, int))(void *)(tkStubsPtr->tk_ConfigureWidget)) \ (((flags & TK_CONFIG_OBJS) ? interp : (Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory in Tk_ConfigureWidget"), \ NULL)), tkwin, specs, argc, argv, widgRec, flags) #endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #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 20 21 22 23 24 25 26 27 28 29 30 31 | /* * 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" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The following macro defines how many extra pixels to leave on each side of * the text in the entry. */ #define XPAD 1 |
︙ | ︙ | |||
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, | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 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, | | | | | | | 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 | "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), TK_OPTION_ENUM_VAR, 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, |
︙ | ︙ | |||
172 173 174 175 176 177 178 | */ #define DEF_SPINBOX_REPEAT_DELAY "400" #define DEF_SPINBOX_REPEAT_INTERVAL "100" #define DEF_SPINBOX_CMD "" | | | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | */ #define DEF_SPINBOX_REPEAT_DELAY "400" #define DEF_SPINBOX_REPEAT_INTERVAL "100" #define DEF_SPINBOX_CMD "" #define DEF_SPINBOX_FROM "0.0" #define DEF_SPINBOX_TO "0.0" #define DEF_SPINBOX_INCREMENT "1.0" #define DEF_SPINBOX_FORMAT "" #define DEF_SPINBOX_VALUES "" #define DEF_SPINBOX_WRAP "0" static const Tk_OptionSpec sbOptSpec[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background", |
︙ | ︙ | |||
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, | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | 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, | | | | | 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 | {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}, {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), TK_OPTION_ENUM_VAR, 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_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[] = { | | | | | | | | | | | | | | | | | < < | | | | < < | 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 | /* * 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 #define LAST_PLUS_ONE_OK 2 /* * Forward declarations for functions defined later in this file: */ static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int DeleteChars(Entry *entryPtr, Tcl_Size index, Tcl_Size count); static Tcl_FreeProc DestroyEntry; static void DisplayEntry(void *clientData); static void EntryBlinkProc(void *clientData); static void EntryCmdDeletedProc(void *clientData); static void EntryComputeGeometry(Entry *entryPtr); static void EntryEventProc(void *clientData, XEvent *eventPtr); static void EntryFocusProc(Entry *entryPtr, int gotFocus); static Tcl_Size EntryFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static void EntryLostSelection(void *clientData); static void EventuallyRedraw(Entry *entryPtr); static void EntryScanTo(Entry *entryPtr, int y); static void EntrySetValue(Entry *entryPtr, const char *value); static void EntrySelectTo(Entry *entryPtr, Tcl_Size index); static char * EntryTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void EntryUpdateScrollbar(Entry *entryPtr); static int EntryValidate(Entry *entryPtr, char *cmd); static int EntryValidateChange(Entry *entryPtr, const char *change, const char *newStr, Tcl_Size index, int type); static void ExpandPercents(Entry *entryPtr, const char *before, const char *change, const char *newStr, Tcl_Size index, int type, Tcl_DString *dsPtr); static int EntryValueChanged(Entry *entryPtr, const char *newValue); static void EntryVisibleRange(Entry *entryPtr, double *firstPtr, double *lastPtr); static Tcl_ObjCmdProc EntryWidgetObjCmd; static void EntryWorldChanged(void *instanceData); static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr, Tcl_Obj *indexObj, Tcl_Size *indexPtr); static int InsertChars(Entry *entryPtr, Tcl_Size index, const char *string); /* * These forward declarations are the spinbox specific ones: */ static Tcl_ObjCmdProc SpinboxWidgetObjCmd; static int GetSpinboxElement(Spinbox *sbPtr, int x, int y); static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr, int element); static int ComputeFormat(Spinbox *sbPtr); /* * The structure below defines widget class behavior by means of functions |
︙ | ︙ | |||
480 481 482 483 484 485 486 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_EntryObjCmd( | | < | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_EntryObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Entry *entryPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), |
︙ | ︙ | |||
594 595 596 597 598 599 600 | * See the user documentation. * *-------------------------------------------------------------- */ static int EntryWidgetObjCmd( | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | * See the user documentation. * *-------------------------------------------------------------- */ static int EntryWidgetObjCmd( void *clientData, /* Information about entry widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Entry *entryPtr = (Entry *)clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; |
︙ | ︙ | |||
622 623 624 625 626 627 628 | if (result != TCL_OK) { return result; } Tcl_Preserve(entryPtr); switch ((enum entryCmd) cmdIndex) { case COMMAND_BBOX: { | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | if (result != TCL_OK) { return result; } Tcl_Preserve(entryPtr); switch ((enum entryCmd) cmdIndex) { case COMMAND_BBOX: { Tcl_Size index; int x, y, width, height; Tcl_Obj *bbox[4]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } |
︙ | ︙ | |||
676 677 678 679 680 681 682 | Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureEntry(interp, entryPtr, objc-2, objv+2); } break; case COMMAND_DELETE: { | | | | 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 | Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureEntry(interp, entryPtr, objc-2, objv+2); } break; case COMMAND_DELETE: { Tcl_Size first, last; int code; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], &first) != TCL_OK) { goto error; } if (objc == 3) { last = first + 1; } else if (GetEntryIndex(interp, entryPtr, objv[3], &last) != TCL_OK) { goto error; } if ((last >= first) && (entryPtr->state == STATE_NORMAL)) { code = DeleteChars(entryPtr, first, last - first); if (code != TCL_OK) { goto error; } } break; } |
︙ | ︙ | |||
723 724 725 726 727 728 729 | &entryPtr->insertPos) != TCL_OK) { goto error; } EventuallyRedraw(entryPtr); break; case COMMAND_INDEX: { | | | | 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 | &entryPtr->insertPos) != TCL_OK) { goto error; } EventuallyRedraw(entryPtr); break; case COMMAND_INDEX: { Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } case COMMAND_INSERT: { Tcl_Size index; int code; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index text"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], |
︙ | ︙ | |||
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( | | | | 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 | 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; } case COMMAND_SELECTION: { Tcl_Size index, index2; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?index?"); goto error; } /* |
︙ | ︙ | |||
829 830 831 832 833 834 835 | goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (entryPtr->selectFirst != TCL_INDEX_NONE) { | | | | | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (entryPtr->selectFirst != TCL_INDEX_NONE) { Tcl_Size half1, half2; half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2; half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2; if (index < half1) { entryPtr->selectAnchor = entryPtr->selectLast; } else if (index > half2) { entryPtr->selectAnchor = entryPtr->selectFirst; } else { /* * We're at about the halfway point in the selection; just * keep the existing anchor. */ } |
︙ | ︙ | |||
877 878 879 880 881 882 883 | case SELECTION_PRESENT: if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); goto error; } Tcl_SetObjResult(interp, | | | | 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 | case SELECTION_PRESENT: if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); goto error; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr->selectFirst != TCL_INDEX_NONE)); goto done; case SELECTION_RANGE: if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "start end"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (GetEntryIndex(interp, entryPtr, objv[4], &index2) != TCL_OK) { goto error; } if (index >= index2) { entryPtr->selectFirst = TCL_INDEX_NONE; entryPtr->selectLast = TCL_INDEX_NONE; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) |
︙ | ︙ | |||
944 945 946 947 948 949 950 | entryPtr->validate = selIndex; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); break; } case COMMAND_XVIEW: { | | | 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | entryPtr->validate = selIndex; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); break; } case COMMAND_XVIEW: { Tcl_Size index; if (objc == 2) { double first, last; Tcl_Obj *span[2]; EntryVisibleRange(entryPtr, &first, &last); span[0] = Tcl_NewDoubleObj(first); |
︙ | ︙ | |||
967 968 969 970 971 972 973 | } else { double fraction; int count; index = entryPtr->leftIndex; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { | < < > > | | 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 | } else { double fraction; int count; index = entryPtr->leftIndex; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: index = (int) ((fraction * entryPtr->numChars) + 0.5); break; case TK_SCROLL_PAGES: { int charsPerPage; charsPerPage = ((Tk_Width(entryPtr->tkwin) - 2 * entryPtr->inset) / entryPtr->avgWidth) - 2; if (charsPerPage < 1) { charsPerPage = 1; } index += count * charsPerPage; break; } case TK_SCROLL_UNITS: index += count; break; default: goto error; } } if (index >= entryPtr->numChars) { index = entryPtr->numChars - 1; } if ((int)index < 0) { index = 0; } entryPtr->leftIndex = index; entryPtr->flags |= UPDATE_SCROLLBAR; |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | * Everything associated with the entry is freed up. * *---------------------------------------------------------------------- */ static void DestroyEntry( void *memPtr) /* Info about entry widget. */ { Entry *entryPtr = (Entry *)memPtr; /* * Free up all the stuff that requires special handling, then let * Tk_FreeOptions handle all the standard option-related stuff. */ | > > > > | | | | 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 | * Everything associated with the entry is freed up. * *---------------------------------------------------------------------- */ static void DestroyEntry( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about entry widget. */ #else char *memPtr) #endif { Entry *entryPtr = (Entry *)memPtr; /* * Free up all the stuff that requires special handling, then let * Tk_FreeOptions handle all the standard option-related stuff. */ ckfree((void *)entryPtr->string); if (entryPtr->textVarName != NULL) { Tcl_UntraceVar2(entryPtr->interp, entryPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } if (entryPtr->textGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } if (entryPtr->selTextGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler); if (entryPtr->displayString != entryPtr->string) { ckfree((void *)entryPtr->displayString); } if (entryPtr->type == TK_SPINBOX) { Spinbox *sbPtr = (Spinbox *) entryPtr; if (sbPtr->listObj != NULL) { Tcl_DecrRefCount(sbPtr->listObj); sbPtr->listObj = NULL; } if (sbPtr->formatBuf) { ckfree(sbPtr->formatBuf); } } Tk_FreeTextLayout(entryPtr->textLayout); Tk_FreeConfigOptions(entryPtr, entryPtr->optionTable, entryPtr->tkwin); Tcl_Release(entryPtr->tkwin); entryPtr->tkwin = NULL; ckfree(entryPtr); } |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 | */ static int ConfigureEntry( Tcl_Interp *interp, /* Used for error reporting. */ Entry *entryPtr, /* Information about widget; may or may not * already have values for some fields. */ | | > | 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 | */ static int ConfigureEntry( Tcl_Interp *interp, /* Used for error reporting. */ Entry *entryPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; Tk_3DBorder border; Tcl_Obj *errorResult = NULL; Spinbox *sbPtr = (Spinbox *) entryPtr; /* Only used when this widget is of type * TK_SPINBOX */ char *oldValues = NULL; char *oldFormat = NULL; int error; int oldExport = 0; int valuesChanged = 0; double oldFrom = 0.0; double oldTo = 0.0; int code; size_t formatSpace = TCL_DOUBLE_SPACE; /* * Eliminate any existing trace on a variable monitored by the entry. */ if ((entryPtr->textVarName != NULL) && (entryPtr->flags & ENTRY_VAR_TRACED)) { |
︙ | ︙ | |||
1209 1210 1211 1212 1213 1214 1215 | /* * Make sure that the given format is somewhat correct, and * calculate the minimum space we'll need for the values as * strings. */ int min, max; | | | 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | /* * Make sure that the given format is somewhat correct, and * calculate the minimum space we'll need for the values as * strings. */ int min, max; size_t formatLen; char fbuf[4], *fmt = sbPtr->reqFormat; formatLen = strlen(fmt); if ((fmt[0] != '%') || (fmt[formatLen-1] != 'f')) { badFormatOpt: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad spinbox format specifier \"%s\"", |
︙ | ︙ | |||
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; | | | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | if (oldValues != sbPtr->valueStr) { if (sbPtr->listObj != NULL) { Tcl_DecrRefCount(sbPtr->listObj); } sbPtr->listObj = NULL; if (sbPtr->valueStr != NULL) { Tcl_Obj *newObjPtr; Tcl_Size nelems; newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, TCL_INDEX_NONE); if (Tcl_ListObjLength(interp, newObjPtr, &nelems) != TCL_OK) { valuesChanged = -1; continue; } |
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 | /* Scan failure */ dvalue = sbPtr->fromValue; } else if (dvalue > sbPtr->toValue) { dvalue = sbPtr->toValue; } else if (dvalue < sbPtr->fromValue) { dvalue = sbPtr->fromValue; } | | | | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | /* Scan failure */ dvalue = sbPtr->fromValue; } else if (dvalue > sbPtr->toValue) { dvalue = sbPtr->toValue; } else if (dvalue < sbPtr->fromValue) { dvalue = sbPtr->fromValue; } snprintf(sbPtr->formatBuf, formatSpace, sbPtr->valueFormat, dvalue); /* * No check for error return here as well, because any possible * error will be trapped below when attempting tracing. */ EntryValueChanged(entryPtr, sbPtr->formatBuf); } } |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 | * Entry will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void EntryWorldChanged( | | | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | * Entry will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void EntryWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc = NULL; unsigned long mask; Tk_3DBorder border; XColor *colorPtr; Entry *entryPtr = (Entry *)instanceData; |
︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 | * None. * *-------------------------------------------------------------- */ int TkpDrawEntryBorderAndFocus( | | | | < < < < | 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 | * None. * *-------------------------------------------------------------- */ int TkpDrawEntryBorderAndFocus( TCL_UNUSED(Entry *), TCL_UNUSED(Drawable), TCL_UNUSED(int)) { return 0; } /* *-------------------------------------------------------------- * * TkpDrawSpinboxButtons -- |
︙ | ︙ | |||
1587 1588 1589 1590 1591 1592 1593 | * None. * *-------------------------------------------------------------- */ int TkpDrawSpinboxButtons( | | | < < < | 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 | * None. * *-------------------------------------------------------------- */ int TkpDrawSpinboxButtons( TCL_UNUSED(Spinbox *), TCL_UNUSED(Pixmap)) { return 0; } #endif /* Not MAC_OSX_TK */ /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
1615 1616 1617 1618 1619 1620 1621 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayEntry( | | | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayEntry( void *clientData) /* Information about window. */ { Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->tkwin; int baseY, selStartX, selEndX, cursorX; int showSelection, xBound; Tk_FontMetrics fm; Pixmap pixmap; |
︙ | ︙ | |||
1705 1706 1707 1708 1709 1710 1711 | } else { border = entryPtr->normalBorder; } Tk_Fill3DRectangle(tkwin, pixmap, border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); if (showSelection && (entryPtr->state != STATE_DISABLED) | | | 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 | } else { border = entryPtr->normalBorder; } Tk_Fill3DRectangle(tkwin, pixmap, border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); if (showSelection && (entryPtr->state != STATE_DISABLED) && (entryPtr->selectLast > entryPtr->leftIndex)) { if (entryPtr->selectFirst <= entryPtr->leftIndex) { selStartX = entryPtr->leftX; } else { Tk_CharBbox(entryPtr->textLayout, entryPtr->selectFirst, &selStartX, NULL, NULL, NULL); selStartX += entryPtr->layoutX; } |
︙ | ︙ | |||
1748 1749 1750 1751 1752 1753 1754 | if ((entryPtr->state == STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) { Tk_CharBbox(entryPtr->textLayout, entryPtr->insertPos, &cursorX, NULL, NULL, NULL); cursorX += entryPtr->layoutX; cursorX -= (entryPtr->insertWidth == 1) ? 1 : (entryPtr->insertWidth)/2; Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent, fm.ascent + fm.descent); | | | 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 | if ((entryPtr->state == STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) { Tk_CharBbox(entryPtr->textLayout, entryPtr->insertPos, &cursorX, NULL, NULL, NULL); cursorX += entryPtr->layoutX; cursorX -= (entryPtr->insertWidth == 1) ? 1 : (entryPtr->insertWidth)/2; Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent, fm.ascent + fm.descent); if ((entryPtr->insertPos >= entryPtr->leftIndex) && cursorX < xBound) { if (entryPtr->flags & CURSOR_ON) { Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder, cursorX, baseY - fm.ascent, entryPtr->insertWidth, fm.ascent + fm.descent, entryPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (entryPtr->insertBorder == entryPtr->selBorder) { Tk_Fill3DRectangle(tkwin, pixmap, border, cursorX, |
︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 | entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY, entryPtr->placeholderLeftIndex, entryPtr->placeholderChars); } else { if (showSelection && (entryPtr->state != STATE_DISABLED) && (entryPtr->selTextGC != entryPtr->textGC) | | | | | 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 | entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY, entryPtr->placeholderLeftIndex, entryPtr->placeholderChars); } else { if (showSelection && (entryPtr->state != STATE_DISABLED) && (entryPtr->selTextGC != entryPtr->textGC) && (entryPtr->selectFirst < entryPtr->selectLast)) { /* * Draw the selected and unselected portions separately. */ Tcl_Size selFirst; if (entryPtr->selectFirst < entryPtr->leftIndex) { selFirst = entryPtr->leftIndex; } else { selFirst = entryPtr->selectFirst; } if (entryPtr->leftIndex < selFirst) { Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC, entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY, |
︙ | ︙ | |||
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); | | | | 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 | } 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 |
︙ | ︙ | |||
1969 1970 1971 1972 1973 1974 1975 | */ static void EntryComputeGeometry( Entry *entryPtr) /* Widget record for entry. */ { int totalLength, overflow, rightX; | | | | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 | */ static void EntryComputeGeometry( Entry *entryPtr) /* Widget record for entry. */ { int totalLength, overflow, rightX; Tcl_Size maxOffScreen; int height, width, i; Tk_FontMetrics fm; char *p; if (entryPtr->displayString != entryPtr->string) { ckfree((void *)entryPtr->displayString); entryPtr->displayString = entryPtr->string; entryPtr->numDisplayBytes = entryPtr->numBytes; } /* * If we're displaying a special character instead of the value of the * entry, recompute the displayString. |
︙ | ︙ | |||
1997 1998 1999 2000 2001 2002 2003 | /* * Normalize the special character so we can safely duplicate it in * the display string. If we didn't do this, then two malformed * characters might end up looking like one valid UTF character in the * resulting string. */ | | | | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 | /* * Normalize the special character so we can safely duplicate it in * the display string. If we didn't do this, then two malformed * characters might end up looking like one valid UTF character in the * resulting string. */ Tcl_UtfToUniChar(entryPtr->showChar, &ch); size = Tcl_UniCharToUtf(ch, buf); entryPtr->numDisplayBytes = entryPtr->numChars * size; p = (char *)ckalloc(entryPtr->numDisplayBytes + 1); entryPtr->displayString = p; for (i = entryPtr->numChars; i-- > 0; ) { memcpy(p, buf, size); |
︙ | ︙ | |||
2105 2106 2107 2108 2109 2110 2111 | maxOffScreen = Tk_PointToChar(entryPtr->textLayout, overflow, 0); Tk_CharBbox(entryPtr->textLayout, maxOffScreen, &rightX, NULL, NULL, NULL); if (rightX < overflow) { maxOffScreen++; } | | | 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 | maxOffScreen = Tk_PointToChar(entryPtr->textLayout, overflow, 0); Tk_CharBbox(entryPtr->textLayout, maxOffScreen, &rightX, NULL, NULL, NULL); if (rightX < overflow) { maxOffScreen++; } if (entryPtr->leftIndex > maxOffScreen) { entryPtr->leftIndex = maxOffScreen; } Tk_CharBbox(entryPtr->textLayout, entryPtr->leftIndex, &rightX, NULL, NULL, NULL); entryPtr->leftX = entryPtr->inset; entryPtr->layoutX = entryPtr->leftX - rightX; } |
︙ | ︙ | |||
2153 2154 2155 2156 2157 2158 2159 | * *---------------------------------------------------------------------- */ static int InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ | | | 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | * *---------------------------------------------------------------------- */ static int InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ Tcl_Size index, /* Add the new elements before this character * index. */ const char *value) /* New characters to add (NULL-terminated * string). */ { size_t byteIndex, byteCount, newByteCount, oldChars, charsAdded; const char *string; char *newStr; |
︙ | ︙ | |||
2183 2184 2185 2186 2187 2188 2189 | entryPtr->validate == VALIDATE_ALL) && EntryValidateChange(entryPtr, value, newStr, index, VALIDATE_INSERT) != TCL_OK) { ckfree(newStr); return TCL_OK; } | | | | 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 | entryPtr->validate == VALIDATE_ALL) && EntryValidateChange(entryPtr, value, newStr, index, VALIDATE_INSERT) != TCL_OK) { ckfree(newStr); return TCL_OK; } ckfree((void *)string); entryPtr->string = newStr; /* * The following construction is used because inserting improperly formed * UTF-8 sequences between other improperly formed UTF-8 sequences could * result in actually forming valid UTF-8 sequences; the number of * characters added may not be Tcl_NumUtfChars(string, TCL_INDEX_NONE), because of * context. The actual number of characters added is how many characters * are in the string now minus the number that used to be there. */ oldChars = entryPtr->numChars; entryPtr->numChars = Tcl_NumUtfChars(newStr, TCL_INDEX_NONE); charsAdded = entryPtr->numChars - oldChars; |
︙ | ︙ | |||
2213 2214 2215 2216 2217 2218 2219 | * Inserting characters invalidates all indexes into the string. Touch up * the indexes so that they still refer to the same characters (at new * positions). When updating the selection end-points, don't include the * new text in the selection unless it was completely surrounded by the * selection. */ | | | | | | | 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 | * Inserting characters invalidates all indexes into the string. Touch up * the indexes so that they still refer to the same characters (at new * positions). When updating the selection end-points, don't include the * new text in the selection unless it was completely surrounded by the * selection. */ if (entryPtr->selectFirst >= index) { entryPtr->selectFirst += charsAdded; } if (entryPtr->selectLast > index) { entryPtr->selectLast += charsAdded; } if ((entryPtr->selectAnchor > index) || (entryPtr->selectFirst >= index)) { entryPtr->selectAnchor += charsAdded; } if (entryPtr->leftIndex > index) { entryPtr->leftIndex += charsAdded; } if (entryPtr->insertPos >= index) { entryPtr->insertPos += charsAdded; } return EntryValueChanged(entryPtr, NULL); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2252 2253 2254 2255 2256 2257 2258 | * *---------------------------------------------------------------------- */ static int DeleteChars( Entry *entryPtr, /* Entry widget to modify. */ | | | | | 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 | * *---------------------------------------------------------------------- */ static int DeleteChars( Entry *entryPtr, /* Entry widget to modify. */ Tcl_Size index, /* Index of first character to delete. */ Tcl_Size count) /* How many characters to delete. */ { int byteIndex, byteCount, newByteCount; const char *string; char *newStr, *toDelete; if (index + count > entryPtr->numChars) { count = entryPtr->numChars - index; } if ((int)count <= 0) { return TCL_OK; } string = entryPtr->string; |
︙ | ︙ | |||
2289 2290 2291 2292 2293 2294 2295 | VALIDATE_DELETE) != TCL_OK) { ckfree(newStr); ckfree(toDelete); return TCL_OK; } ckfree(toDelete); | | | | | | | | | | | | | | 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 | VALIDATE_DELETE) != TCL_OK) { ckfree(newStr); ckfree(toDelete); return TCL_OK; } ckfree(toDelete); ckfree((void *)entryPtr->string); entryPtr->string = newStr; entryPtr->numChars -= count; entryPtr->numBytes -= byteCount; if (entryPtr->displayString == string) { entryPtr->displayString = newStr; entryPtr->numDisplayBytes = entryPtr->numBytes; } /* * Deleting characters results in the remaining characters being * renumbered. Update the various indexes into the string to reflect this * change. */ if (entryPtr->selectFirst >= index) { if (entryPtr->selectFirst >= index + count) { entryPtr->selectFirst -= count; } else { entryPtr->selectFirst = index; } } if (entryPtr->selectLast >= index) { if (entryPtr->selectLast >= index + count) { entryPtr->selectLast -= count; } else { entryPtr->selectLast = index; } } if (entryPtr->selectLast <= entryPtr->selectFirst) { entryPtr->selectFirst = TCL_INDEX_NONE; entryPtr->selectLast = TCL_INDEX_NONE; } if (entryPtr->selectAnchor >= index) { if (entryPtr->selectAnchor >= index + count) { entryPtr->selectAnchor -= count; } else { entryPtr->selectAnchor = index; } } if (entryPtr->leftIndex > index) { if (entryPtr->leftIndex >= index + count) { entryPtr->leftIndex -= count; } else { entryPtr->leftIndex = index; } } if (entryPtr->insertPos >= index) { if (entryPtr->insertPos >= index + count) { entryPtr->insertPos -= count; } else { entryPtr->insertPos = index; } } return EntryValueChanged(entryPtr, NULL); } |
︙ | ︙ | |||
2468 2469 2470 2471 2472 2473 2474 | char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); value = tmp; malloced = 1; entryPtr->flags |= VALIDATE_VAR; | | | | | | | | | | 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 | char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); value = tmp; malloced = 1; entryPtr->flags |= VALIDATE_VAR; (void) EntryValidateChange(entryPtr, NULL, value, TCL_INDEX_NONE, VALIDATE_FORCED); entryPtr->flags &= ~VALIDATE_VAR; /* * If VALIDATE_ABORT has been set, then this operation should be * aborted because the validatecommand did something else instead */ if (entryPtr->flags & VALIDATE_ABORT) { entryPtr->flags &= ~VALIDATE_ABORT; ckfree((void *)value); return; } } oldSource = entryPtr->string; ckfree((void *)entryPtr->string); if (malloced) { entryPtr->string = value; } else { char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); entryPtr->string = tmp; } entryPtr->numBytes = valueLen; entryPtr->numChars = Tcl_NumUtfChars(value, valueLen); if (entryPtr->displayString == oldSource) { entryPtr->displayString = entryPtr->string; entryPtr->numDisplayBytes = entryPtr->numBytes; } if (entryPtr->selectFirst != TCL_INDEX_NONE) { if (entryPtr->selectFirst >= entryPtr->numChars) { entryPtr->selectFirst = TCL_INDEX_NONE; entryPtr->selectLast = TCL_INDEX_NONE; } else if (entryPtr->selectLast > entryPtr->numChars) { entryPtr->selectLast = entryPtr->numChars; } } if (entryPtr->leftIndex >= entryPtr->numChars) { if (entryPtr->numChars > 0) { entryPtr->leftIndex = entryPtr->numChars - 1; } else { entryPtr->leftIndex = 0; } } if (entryPtr->insertPos > entryPtr->numChars) { entryPtr->insertPos = entryPtr->numChars; } entryPtr->flags |= UPDATE_SCROLLBAR; EntryComputeGeometry(entryPtr); EventuallyRedraw(entryPtr); } |
︙ | ︙ | |||
2547 2548 2549 2550 2551 2552 2553 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void EntryEventProc( | | | 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void EntryEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Entry *entryPtr = (Entry *)clientData; if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) { Spinbox *sbPtr = (Spinbox *)clientData; int elem; |
︙ | ︙ | |||
2590 2591 2592 2593 2594 2595 2596 | case DestroyNotify: if (!(entryPtr->flags & ENTRY_DELETED)) { entryPtr->flags |= (ENTRY_DELETED | VALIDATE_ABORT); Tcl_DeleteCommandFromToken(entryPtr->interp, entryPtr->widgetCmd); if (entryPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayEntry, clientData); } | | | 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 | case DestroyNotify: if (!(entryPtr->flags & ENTRY_DELETED)) { entryPtr->flags |= (ENTRY_DELETED | VALIDATE_ABORT); Tcl_DeleteCommandFromToken(entryPtr->interp, entryPtr->widgetCmd); if (entryPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayEntry, clientData); } Tcl_EventuallyFree(clientData, DestroyEntry); } break; case ConfigureNotify: Tcl_Preserve(entryPtr); entryPtr->flags |= UPDATE_SCROLLBAR; EntryComputeGeometry(entryPtr); EventuallyRedraw(entryPtr); |
︙ | ︙ | |||
2629 2630 2631 2632 2633 2634 2635 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void EntryCmdDeletedProc( | | | 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void EntryCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { Entry *entryPtr = (Entry *)clientData; /* * This function could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or * because the command was deleted, and then this function destroys the |
︙ | ︙ | |||
2671 2672 2673 2674 2675 2676 2677 | static int GetEntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry for which the index is being * specified. */ Tcl_Obj *indexObj, /* Specifies character in entryPtr. */ | | | | | | | 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 | static int GetEntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry for which the index is being * specified. */ Tcl_Obj *indexObj, /* Specifies character in entryPtr. */ Tcl_Size *indexPtr) /* Where to store converted character index */ { Tcl_Size length, idx; const char *string; if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->numChars - 1, 1, &idx)) { if (idx < 0) { idx = 0; } 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; break; case 'i': if (strncmp(string, "insert", length) != 0) { goto badIndex; } *indexPtr = entryPtr->insertPos; break; case 's': if (entryPtr->selectFirst < 0) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "selection isn't in widget %s", Tk_PathName(entryPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", (entryPtr->type == TK_ENTRY) ? "ENTRY" : "SPINBOX", "NO_SELECTION", NULL); |
︙ | ︙ | |||
2749 2750 2751 2752 2753 2754 2755 | /* * Special trick: if the x-position was off-screen to the right, round * the index up to refer to the character just after the last visible * one on the screen. This is needed to enable the last character to * be selected, for example. */ | | | 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 | /* * Special trick: if the x-position was off-screen to the right, round * the index up to refer to the character just after the last visible * one on the screen. This is needed to enable the last character to * be selected, for example. */ if (roundUp && (*indexPtr < entryPtr->numChars)) { *indexPtr += 1; } break; } default: badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad %s index \"%s\"", |
︙ | ︙ | |||
2788 2789 2790 2791 2792 2793 2794 | */ static void EntryScanTo( Entry *entryPtr, /* Information about widget. */ int x) /* X-coordinate to use for scan operation. */ { | | | | | 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 | */ static void EntryScanTo( Entry *entryPtr, /* Information about widget. */ int x) /* X-coordinate to use for scan operation. */ { Tcl_Size newLeftIndex; /* * Compute new leftIndex for entry by amplifying the difference between * the current position and the place where the scan started (the "mark" * position). If we run off the left or right side of the entry, then * reset the mark point so that the current position continues to * correspond to the edge of the window. This means that the picture will * start dragging as soon as the mouse reverses direction (without this * reset, might have to slide mouse a long ways back before the picture * starts moving again). */ newLeftIndex = entryPtr->scanMarkIndex - (10 * (x - entryPtr->scanMarkX)) / entryPtr->avgWidth; if (newLeftIndex >= entryPtr->numChars) { newLeftIndex = entryPtr->scanMarkIndex = entryPtr->numChars - 1; entryPtr->scanMarkX = x; } if (newLeftIndex < 0) { newLeftIndex = entryPtr->scanMarkIndex = 0; entryPtr->scanMarkX = x; } if (newLeftIndex != entryPtr->leftIndex) { entryPtr->leftIndex = newLeftIndex; entryPtr->flags |= UPDATE_SCROLLBAR; |
︙ | ︙ | |||
2844 2845 2846 2847 2848 2849 2850 | * *---------------------------------------------------------------------- */ static void EntrySelectTo( Entry *entryPtr, /* Information about widget. */ | | | | | | | 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 | * *---------------------------------------------------------------------- */ static void EntrySelectTo( Entry *entryPtr, /* Information about widget. */ Tcl_Size index) /* Character index of element that is to * become the "other" end of the selection. */ { Tcl_Size newFirst, newLast; /* * Grab the selection if we don't own it already. */ if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } /* * Pick new starting and ending points for the selection. */ if (entryPtr->selectAnchor > entryPtr->numChars) { entryPtr->selectAnchor = entryPtr->numChars; } if (entryPtr->selectAnchor <= index) { newFirst = entryPtr->selectAnchor; newLast = index; } else { newFirst = index; newLast = entryPtr->selectAnchor; if (newLast < 0) { newFirst = newLast = TCL_INDEX_NONE; } } if ((entryPtr->selectFirst == newFirst) && (entryPtr->selectLast == newLast)) { return; } |
︙ | ︙ | |||
2907 2908 2909 2910 2911 2912 2913 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | | 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 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size EntryFetchSelection( void *clientData, /* Information about entry widget. */ Tcl_Size offset, /* Byte offset within selection of first * character to be returned. */ char *buffer, /* Location in which to place selection. */ Tcl_Size maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NUL character. */ { Entry *entryPtr = (Entry *)clientData; Tcl_Size byteCount; const char *string; const char *selStart, *selEnd; if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection) || Tcl_IsSafe(entryPtr->interp)) { return -1; } string = entryPtr->displayString; selStart = Tcl_UtfAtIndex(string, entryPtr->selectFirst); selEnd = Tcl_UtfAtIndex(selStart, entryPtr->selectLast - entryPtr->selectFirst); |
︙ | ︙ | |||
2961 2962 2963 2964 2965 2966 2967 | * not containing a selection. * *---------------------------------------------------------------------- */ static void EntryLostSelection( | | | 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 | * not containing a selection. * *---------------------------------------------------------------------- */ static void EntryLostSelection( void *clientData) /* Information about entry widget. */ { Entry *entryPtr = (Entry *)clientData; entryPtr->flags &= ~GOT_SELECTION; /* * On Windows and Mac systems, we want to remember the selection for the |
︙ | ︙ | |||
3148 3149 3150 3151 3152 3153 3154 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void EntryBlinkProc( | | | 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void EntryBlinkProc( void *clientData) /* Pointer to record describing entry. */ { Entry *entryPtr = (Entry *)clientData; if ((entryPtr->state == STATE_DISABLED) || (entryPtr->state == STATE_READONLY) || !(entryPtr->flags & GOT_FOCUS) || (entryPtr->insertOffTime == 0)) { return; |
︙ | ︙ | |||
3203 3204 3205 3206 3207 3208 3209 | if (entryPtr->insertOffTime != 0) { entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler( entryPtr->insertOnTime, EntryBlinkProc, entryPtr); } if (entryPtr->validate == VALIDATE_ALL || entryPtr->validate == VALIDATE_FOCUS || entryPtr->validate == VALIDATE_FOCUSIN) { | | | | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 | if (entryPtr->insertOffTime != 0) { entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler( entryPtr->insertOnTime, EntryBlinkProc, entryPtr); } if (entryPtr->validate == VALIDATE_ALL || entryPtr->validate == VALIDATE_FOCUS || entryPtr->validate == VALIDATE_FOCUSIN) { EntryValidateChange(entryPtr, NULL, entryPtr->string, TCL_INDEX_NONE, VALIDATE_FOCUSIN); } } else { entryPtr->flags &= ~(GOT_FOCUS | CURSOR_ON); entryPtr->insertBlinkHandler = NULL; if (entryPtr->validate == VALIDATE_ALL || entryPtr->validate == VALIDATE_FOCUS || entryPtr->validate == VALIDATE_FOCUSOUT) { EntryValidateChange(entryPtr, NULL, entryPtr->string, TCL_INDEX_NONE, VALIDATE_FOCUSOUT); } } EventuallyRedraw(entryPtr); } /* |
︙ | ︙ | |||
3238 3239 3240 3241 3242 3243 3244 | * The text displayed in the entry will change to match the variable. * *-------------------------------------------------------------- */ static char * EntryTextVarProc( | | | | < < | | | 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 | * The text displayed in the entry will change to match the variable. * *-------------------------------------------------------------- */ static char * EntryTextVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), TCL_UNUSED(const char *), int flags) /* Information about what happened. */ { Entry *entryPtr = (Entry *)clientData; const char *value; if (entryPtr->flags & ENTRY_DELETED) { /* * Just abort early if we entered here while being deleted. */ return NULL; } /* * 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 == 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 |
︙ | ︙ | |||
3393 3394 3395 3396 3397 3398 3399 | static int EntryValidateChange( Entry *entryPtr, /* Entry that needs validation. */ const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ | | | 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 | static int EntryValidateChange( Entry *entryPtr, /* Entry that needs validation. */ const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ Tcl_Size index, /* index of insert/delete, TCL_INDEX_NONE otherwise */ int type) /* forced, delete, insert, focusin or * focusout */ { int code, varValidate = (entryPtr->flags & VALIDATE_VAR); char *p; Tcl_DString script; |
︙ | ︙ | |||
3484 3485 3486 3487 3488 3489 3490 | int result; Tcl_DStringInit(&script); ExpandPercents(entryPtr, entryPtr->invalidCmd, change, newValue, index, type, &script); Tcl_DStringAppend(&script, "", 1); p = Tcl_DStringValue(&script); | | | 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 | int result; Tcl_DStringInit(&script); ExpandPercents(entryPtr, entryPtr->invalidCmd, change, newValue, index, type, &script); Tcl_DStringAppend(&script, "", 1); p = Tcl_DStringValue(&script); result = Tcl_EvalEx(entryPtr->interp, p, TCL_INDEX_NONE, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); if (result != TCL_OK) { Tcl_AddErrorInfo(entryPtr->interp, "\n (in invalidcommand executed by entry)"); Tcl_BackgroundException(entryPtr->interp, result); code = TCL_ERROR; entryPtr->validate = VALIDATE_NONE; |
︙ | ︙ | |||
3539 3540 3541 3542 3543 3544 3545 | Entry *entryPtr, /* Entry that needs validation. */ const char *before, /* Command containing percent expressions to * be replaced. */ const char *change, /* Characters to added/deleted (NUL-terminated * string). */ const char *newValue, /* Potential new value of entry string */ | | | 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 | Entry *entryPtr, /* Entry that needs validation. */ const char *before, /* Command containing percent expressions to * be replaced. */ const char *change, /* Characters to added/deleted (NUL-terminated * string). */ const char *newValue, /* Potential new value of entry string */ Tcl_Size index, /* index of insert/delete */ int type, /* INSERT or DELETE */ Tcl_DString *dsPtr) /* Dynamic string in which to append new * command. */ { int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; |
︙ | ︙ | |||
3568 3569 3570 3571 3572 3573 3574 | /* * No need to convert '%', as it is in ascii range. */ string = Tcl_UtfFindFirst(before, '%'); if (string == NULL) { | | | | | 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 | /* * No need to convert '%', as it is in ascii range. */ string = Tcl_UtfFindFirst(before, '%'); if (string == NULL) { Tcl_DStringAppend(dsPtr, before, TCL_INDEX_NONE); break; } else if (string != before) { Tcl_DStringAppend(dsPtr, before, string-before); before = string; } /* * There's a percent sequence here. Process it. */ before++; /* skip over % */ if (*before != '\0') { before += Tcl_UtfToUniChar(before, &ch); } else { ch = '%'; } if (type == VALIDATE_BUTTON) { /* * -command %-substitution */ switch (ch) { case 's': /* Current string value of spinbox */ string = entryPtr->string; break; case 'd': /* direction, up or down */ string = change; break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->tkwin); break; default: length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; } } else { /* * -validatecommand / -invalidcommand %-substitution |
︙ | ︙ | |||
3624 3625 3626 3627 3628 3629 3630 | case VALIDATE_DELETE: number = 0; break; default: number = -1; break; } | | | | 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 | case VALIDATE_DELETE: number = 0; break; default: number = -1; break; } snprintf(numStorage, sizeof(numStorage), "%d", number); string = numStorage; break; case 'i': /* index of insert/delete */ snprintf(numStorage, sizeof(numStorage), "%d", (int)index); string = numStorage; break; case 'P': /* 'Peeked' new value of the string */ string = newValue; break; case 's': /* Current string value of spinbox */ string = entryPtr->string; |
︙ | ︙ | |||
3661 3662 3663 3664 3665 3666 3667 | break; } break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->tkwin); break; default: | | | | | 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 | break; } break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->tkwin); break; default: length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; } } spaceNeeded = Tcl_ScanCountedElement(string, TCL_INDEX_NONE, &cvtFlags); length = Tcl_DStringLength(dsPtr); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); spaceNeeded = Tcl_ConvertCountedElement(string, TCL_INDEX_NONE, Tcl_DStringValue(dsPtr) + length, cvtFlags | TCL_DONT_USE_BRACES); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); } } /* |
︙ | ︙ | |||
3697 3698 3699 3700 3701 3702 3703 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SpinboxObjCmd( | | < | 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SpinboxObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Entry *entryPtr; Spinbox *sbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), |
︙ | ︙ | |||
3831 3832 3833 3834 3835 3836 3837 | * See the user documentation. * *-------------------------------------------------------------- */ static int SpinboxWidgetObjCmd( | | | 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 | * See the user documentation. * *-------------------------------------------------------------- */ static int SpinboxWidgetObjCmd( void *clientData, /* Information about spinbox widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Entry *entryPtr = (Entry *)clientData; Spinbox *sbPtr = (Spinbox *)clientData; int cmdIndex, selIndex, result; |
︙ | ︙ | |||
3860 3861 3862 3863 3864 3865 3866 | if (result != TCL_OK) { return result; } Tcl_Preserve(entryPtr); switch ((enum sbCmd) cmdIndex) { case SB_CMD_BBOX: { | | | | 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 | if (result != TCL_OK) { return result; } Tcl_Preserve(entryPtr); switch ((enum sbCmd) cmdIndex) { case SB_CMD_BBOX: { Tcl_Size index; int x, y, width, height; Tcl_Obj *bbox[4]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { goto error; } if ((index == entryPtr->numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX); bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY); bbox[2] = Tcl_NewWideIntObj(width); bbox[3] = Tcl_NewWideIntObj(height); |
︙ | ︙ | |||
3913 3914 3915 3916 3917 3918 3919 | Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureEntry(interp, entryPtr, objc-2, objv+2); } break; case SB_CMD_DELETE: { | | | | | 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 | Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureEntry(interp, entryPtr, objc-2, objv+2); } break; case SB_CMD_DELETE: { Tcl_Size first, last; int code; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], &first) != TCL_OK) { goto error; } if (objc == 3) { last = first + 1; } else { if (GetEntryIndex(interp, entryPtr, objv[3], &last) != TCL_OK) { goto error; } } if ((last >= first) && (entryPtr->state == STATE_NORMAL)) { code = DeleteChars(entryPtr, first, last - first); if (code != TCL_OK) { goto error; } } break; } case SB_CMD_GET: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE)); break; case SB_CMD_ICURSOR: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); goto error; } |
︙ | ︙ | |||
3975 3976 3977 3978 3979 3980 3981 | if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { goto error; } elem = GetSpinboxElement(sbPtr, x, y); if (elem != SEL_NONE) { Tcl_SetObjResult(interp, | | | | | 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 | if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { goto error; } elem = GetSpinboxElement(sbPtr, x, y); if (elem != SEL_NONE) { Tcl_SetObjResult(interp, Tcl_NewStringObj(selElementNames[elem], TCL_INDEX_NONE)); } break; } case SB_CMD_INDEX: { Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } case SB_CMD_INSERT: { Tcl_Size index; int code; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index text"); goto error; } if (GetEntryIndex(interp, entryPtr, objv[2], |
︙ | ︙ | |||
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( | | | | 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 | 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; } case SB_CMD_SELECTION: { Tcl_Size index, index2; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?index?"); goto error; } /* |
︙ | ︙ | |||
4104 4105 4106 4107 4108 4109 4110 | goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (entryPtr->selectFirst != TCL_INDEX_NONE) { | | | | | 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 | goto error; } if (GetEntryIndex(interp, entryPtr, objv[3], &index) != TCL_OK) { goto error; } if (entryPtr->selectFirst != TCL_INDEX_NONE) { Tcl_Size half1, half2; half1 = (entryPtr->selectFirst + entryPtr->selectLast)/2; half2 = (entryPtr->selectFirst + entryPtr->selectLast + 1)/2; if (index < half1) { entryPtr->selectAnchor = entryPtr->selectLast; } else if (index > half2) { entryPtr->selectAnchor = entryPtr->selectFirst; } else { /* * We're at about the halfway point in the selection; just * keep the existing anchor. */ } |
︙ | ︙ | |||
4168 4169 4170 4171 4172 4173 4174 | objv[3], &index) != TCL_OK) { goto error; } if (GetEntryIndex(interp, entryPtr, objv[4],& index2) != TCL_OK) { goto error; } | | | 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 | objv[3], &index) != TCL_OK) { goto error; } if (GetEntryIndex(interp, entryPtr, objv[4],& index2) != TCL_OK) { goto error; } if (index >= index2) { entryPtr->selectFirst = TCL_INDEX_NONE; entryPtr->selectLast = TCL_INDEX_NONE; } else { entryPtr->selectFirst = index; entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) |
︙ | ︙ | |||
4204 4205 4206 4207 4208 4209 4210 | case SB_SEL_ELEMENT: if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 3, objv, "?elemName?"); goto error; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 | case SB_SEL_ELEMENT: if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 3, objv, "?elemName?"); goto error; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( selElementNames[sbPtr->selElement], TCL_INDEX_NONE)); } else { int lastElement = sbPtr->selElement; result = Tcl_GetIndexFromObj(interp, objv[3], selElementNames, "selection element", 0, &(sbPtr->selElement)); if (result != TCL_OK) { goto error; |
︙ | ︙ | |||
4235 4236 4237 4238 4239 4240 4241 | } if (objc == 3) { code = EntryValueChanged(entryPtr, Tcl_GetString(objv[2])); if (code != TCL_OK) { goto error; } } | | | | | 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 | } if (objc == 3) { code = EntryValueChanged(entryPtr, Tcl_GetString(objv[2])); if (code != TCL_OK) { goto error; } } Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE)); break; } case SB_CMD_VALIDATE: { int code; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } selIndex = entryPtr->validate; entryPtr->validate = VALIDATE_ALL; code = EntryValidateChange(entryPtr, NULL, entryPtr->string, TCL_INDEX_NONE, VALIDATE_FORCED); if (entryPtr->validate != VALIDATE_NONE) { entryPtr->validate = selIndex; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); break; } case SB_CMD_XVIEW: { Tcl_Size index; if (objc == 2) { double first, last; Tcl_Obj *span[2]; EntryVisibleRange(entryPtr, &first, &last); span[0] = Tcl_NewDoubleObj(first); |
︙ | ︙ | |||
4282 4283 4284 4285 4286 4287 4288 | } else { double fraction; int count; index = entryPtr->leftIndex; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { | < < > > | | | 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 | } else { double fraction; int count; index = entryPtr->leftIndex; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: index = ((fraction * entryPtr->numChars) + 0.5); break; case TK_SCROLL_PAGES: { int charsPerPage; charsPerPage = ((Tk_Width(entryPtr->tkwin) - 2 * entryPtr->inset - entryPtr->xWidth) / entryPtr->avgWidth) - 2; if (charsPerPage < 1) { charsPerPage = 1; } index += count * charsPerPage; break; } case TK_SCROLL_UNITS: index += count; break; default: goto error; } } if (index >= entryPtr->numChars) { index = entryPtr->numChars - 1; } if (index < 0) { index = 0; } entryPtr->leftIndex = index; entryPtr->flags |= UPDATE_SCROLLBAR; EntryComputeGeometry(entryPtr); EventuallyRedraw(entryPtr); 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. */ | | | | | 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 | 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. */ Tcl_Size i, listc; Tcl_Size 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; } } |
︙ | ︙ | |||
4502 4503 4504 4505 4506 4507 4508 | * greater than the toValue, because the user may have * manipulated the value by hand. */ dvalue = sbPtr->toValue; } } | | | | 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 | * greater than the toValue, because the user may have * manipulated the value by hand. */ dvalue = sbPtr->toValue; } } snprintf(sbPtr->formatBuf, TCL_DOUBLE_SPACE, sbPtr->valueFormat, dvalue); code = EntryValueChanged(entryPtr, sbPtr->formatBuf); } } if (code != TCL_OK) { return TCL_ERROR; } if (sbPtr->command != NULL) { Tcl_DStringInit(&script); ExpandPercents(entryPtr, sbPtr->command, type, "", 0, VALIDATE_BUTTON, &script); Tcl_DStringAppend(&script, "", 1); code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), TCL_INDEX_NONE, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); Tcl_DStringFree(&script); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (in command executed by spinbox)"); Tcl_BackgroundException(interp, code); |
︙ | ︙ | |||
4619 4620 4621 4622 4623 4624 4625 | if (afterDecimal > 0) { fDigits++; /* Decimal point. */ } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } if (fDigits <= eDigits) { | | | | 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 | if (afterDecimal > 0) { fDigits++; /* Decimal point. */ } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } if (fDigits <= eDigits) { snprintf(sbPtr->digitFormat, sizeof(sbPtr->digitFormat), "%%.%df", afterDecimal); } else { snprintf(sbPtr->digitFormat, sizeof(sbPtr->digitFormat), "%%.%de", numDigits-1); } sbPtr->valueFormat = sbPtr->digitFormat; return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
41 42 43 44 45 46 47 | /* * Fields that are set by widget commands other than "configure". */ const char *string; /* Pointer to storage for string; * NULL-terminated; malloc-ed. */ | | | | | | 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 | /* * Fields that are set by widget commands other than "configure". */ const char *string; /* Pointer to storage for string; * NULL-terminated; malloc-ed. */ Tcl_Size insertPos; /* Character index before which next typed * character will be inserted. */ /* * Information about what's selected, if any. */ Tcl_Size selectFirst; /* Character index of first selected character * (-1 means nothing selected. */ Tcl_Size selectLast; /* Character index just after last selected * character (-1 means nothing selected. */ Tcl_Size selectAnchor; /* Fixed end of selection (i.e. "select to" * operation will use this as one end of the * selection). */ /* * Information for scanning: */ |
︙ | ︙ | |||
130 131 132 133 134 135 136 | /* * Fields used in displaying help text if entry value is empty */ Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */ char *placeholderString; /* String value of placeholder. */ | | | | | | | 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 | /* * Fields used in displaying help text if entry value is empty */ Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */ char *placeholderString; /* String value of placeholder. */ Tcl_Size placeholderChars; /* Number of chars in placeholder. */ XColor *placeholderColorPtr;/* Color value of placeholder foreground. */ GC placeholderGC; /* For drawing placeholder text. */ int placeholderX; /* Origin for layout. */ int placeholderLeftIndex; /* Character index of left-most character * visible in window. */ /* * Fields whose values are derived from the current values of the * configuration settings above. */ const char *displayString; /* String to use when displaying. This may be * a pointer to string, or a pointer to * malloced memory with the same character * length as string but whose characters are * all equal to showChar. */ Tcl_Size numBytes; /* Length of string in bytes. */ Tcl_Size numChars; /* Length of string in characters. Both string * and displayString have the same character * length, but may have different byte lengths * due to being made from different UTF-8 * characters. */ Tcl_Size numDisplayBytes; /* Length of displayString in bytes. */ int inset; /* Number of pixels on the left and right * sides that are taken up by XPAD, * borderWidth (if any), and highlightWidth * (if any). */ Tk_TextLayout textLayout; /* Cached text layout information. */ int layoutX, layoutY; /* Origin for layout. */ int leftX; /* X position at which character at leftIndex * is drawn (varies depending on justify). */ Tcl_Size leftIndex; /* Character index of left-most character * visible in window. */ Tcl_TimerToken insertBlinkHandler; /* Timer handler used to blink cursor on and * off. */ GC textGC; /* For drawing normal text. */ GC selTextGC; /* For drawing selected text. */ GC highlightGC; /* For drawing traversal highlight. */ |
︙ | ︙ | |||
226 227 228 229 230 231 232 | double fromValue; /* Value corresponding to left/top of dial */ double toValue; /* Value corresponding to right/bottom of * dial */ double increment; /* If > 0, all values are rounded to an even * multiple of this value. */ char *formatBuf; /* string into which to format value. * Malloc'ed. */ | | | | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | double fromValue; /* Value corresponding to left/top of dial */ double toValue; /* Value corresponding to right/bottom of * dial */ double increment; /* If > 0, all values are rounded to an even * multiple of this value. */ char *formatBuf; /* string into which to format value. * Malloc'ed. */ char *reqFormat; /* Snprintf conversion specifier used for the * value that the users requests. Malloc'ed */ char *valueFormat; /* Snprintf conversion specifier used for the * value. */ char digitFormat[16]; /* Snprintf conversion specifier computed from * digits and other information; used for the * value. */ char *valueStr; /* Values List. Malloc'ed. */ Tcl_Obj *listObj; /* Pointer to the list object being used */ int eIndex; /* Holds the current index into elements */ int nElements; /* Holds the current count of elements */ |
︙ | ︙ | |||
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" |
︙ | ︙ | |||
106 107 108 109 110 111 112 | /* * Create the handler record. */ errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /* * Create the handler record. */ errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); errorPtr->lastRequest = (unsigned long) -1; errorPtr->error = error; errorPtr->request = request; errorPtr->minorCode = minorCode; errorPtr->errorProc = errorProc; errorPtr->clientData = clientData; errorPtr->nextPtr = dispPtr->errorPtr; dispPtr->errorPtr = errorPtr; |
︙ | ︙ |
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" |
︙ | ︙ | |||
119 120 121 122 123 124 125 | 0, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ 0, /* ClientMessage */ 0, /* Mapping Notify */ VirtualEventMask, /* VirtualEvents */ ActivateMask, /* ActivateNotify */ ActivateMask, /* DeactivateNotify */ | | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 0, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ 0, /* ClientMessage */ 0, /* Mapping Notify */ VirtualEventMask, /* VirtualEvents */ ActivateMask, /* ActivateNotify */ ActivateMask, /* DeactivateNotify */ MouseWheelMask, /* MouseWheelEvent */ TouchpadScrollMask /* TouchpadScroll */ }; /* * For each exit handler created with a call to TkCreateExitHandler or * TkCreateThreadExitHandler there is a structure of the following type: */ |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | InProgress ip; Tcl_Interp *interp = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #if !defined(_WIN32) && !defined(MAC_OSX_TK) | > | | | | | | | | | | > | 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 | InProgress ip; Tcl_Interp *interp = NULL; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #if !defined(_WIN32) && !defined(MAC_OSX_TK) if ((eventPtr->type == ButtonRelease) || (eventPtr->type == ButtonPress)) { if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) { if (eventPtr->type == ButtonRelease) { return; } else { /* 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. */ | | | 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 | * *---------------------------------------------------------------------- */ 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 | | | 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 | /* *---------------------------------------------------------------------- * * 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" |
︙ | ︙ | |||
75 76 77 78 79 80 81 | int TkGetFileFilters( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ FileFilterList *flistPtr, /* Stores the list of file filters. */ Tcl_Obj *types, /* Value of the -filetypes option. */ int isWindows) /* True if we are running on Windows. */ { | | < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | int TkGetFileFilters( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ FileFilterList *flistPtr, /* Stores the list of file filters. */ Tcl_Obj *types, /* Value of the -filetypes option. */ int isWindows) /* True if we are running on Windows. */ { Tcl_Size i, listObjc; Tcl_Obj ** listObjv = NULL; if (types == NULL) { return TCL_OK; } if (Tcl_ListObjGetElements(interp, types, &listObjc, &listObjv) != TCL_OK) { |
︙ | ︙ | |||
106 107 108 109 110 111 112 | for (i = 0; i<listObjc; i++) { /* * Each file type should have two or three elements: the first one is * the name of the type and the second is the filter of the type. The * third is the Mac OSType ID, but we don't care about them here. */ | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | for (i = 0; i<listObjc; i++) { /* * Each file type should have two or three elements: the first one is * the name of the type and the second is the filter of the type. The * third is the Mac OSType ID, but we don't care about them here. */ Tcl_Size count; FileFilter *filterPtr; Tcl_Obj **typeInfo; if (Tcl_ListObjGetElements(interp, listObjv[i], &count, &typeInfo) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
229 230 231 232 233 234 235 | Tcl_Obj *ostypesObj, /* A Tcl list of Mac OSType strings. */ int isWindows) /* True if we are running on Windows; False if * we are running on the Mac; Glob patterns * need to be processed differently on these * two platforms */ { Tcl_Obj **globList = NULL, **ostypeList = NULL; | | > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | Tcl_Obj *ostypesObj, /* A Tcl list of Mac OSType strings. */ int isWindows) /* True if we are running on Windows; False if * we are running on the Mac; Glob patterns * need to be processed differently on these * two platforms */ { Tcl_Obj **globList = NULL, **ostypeList = NULL; Tcl_Size globCount, ostypeCount, i; int code = TCL_OK; FileFilterClause *clausePtr; Tcl_Encoding macRoman = NULL; if (Tcl_ListObjGetElements(interp, patternsObj, &globCount, &globList) != TCL_OK) { code = TCL_ERROR; goto done; |
︙ | ︙ | |||
258 259 260 261 262 263 264 | /* * 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++) { | | | | 258 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++) { Tcl_Size 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_UtfToExternalDString(macRoman, strType, len, &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]))); |
︙ | ︙ | |||
318 319 320 321 322 323 324 | filterPtr->clausesTail = clausePtr; } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); | | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | filterPtr->clausesTail = clausePtr; } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); Tcl_Size 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 "*" */ |
︙ | ︙ | |||
371 372 373 374 375 376 377 | } if (ostypeList != NULL && ostypeCount > 0) { if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; | | | | < | 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 | } if (ostypeList != NULL && ostypeCount > 0) { if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; Tcl_Size 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 */ string = Tcl_UtfToExternalDString(macRoman, strType, len, &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" |
︙ | ︙ | |||
69 70 71 72 73 74 75 | /* * Debugging support... */ #define DEBUG(dispPtr, arguments) \ if ((dispPtr)->focusDebug) { \ | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /* * Debugging support... */ #define DEBUG(dispPtr, arguments) \ if ((dispPtr)->focusDebug) { \ printf arguments; fflush(stdout); \ } /* * Forward declarations for functions defined in this file: */ static DisplayFocusInfo*FindDisplayFocusInfo(TkMainInfo *mainPtr, |
︙ | ︙ | |||
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; } |
︙ | ︙ | |||
497 498 499 500 501 502 503 | * dispPtr->implicitWinPtr)!! In addition, we generate events because * the window manager won't give us a FocusOut event when we focus on * the root. */ if ((dispPtr->implicitWinPtr != NULL) && !(winPtr->flags & TK_EMBEDDED)) { | | > | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | * dispPtr->implicitWinPtr)!! In addition, we generate events because * the window manager won't give us a FocusOut event when we focus on * the root. */ if ((dispPtr->implicitWinPtr != NULL) && !(winPtr->flags & TK_EMBEDDED)) { DEBUG(dispPtr, ("Defocussed implicit Async from %s\n", displayFocusPtr->focusWinPtr->pathName)); GenerateFocusEvents(displayFocusPtr->focusWinPtr, NULL); XSetInputFocus(dispPtr->display, PointerRoot, RevertToPointerRoot, CurrentTime); displayFocusPtr->focusWinPtr = NULL; dispPtr->implicitWinPtr = NULL; dispPtr->focusPtr = 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 | | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | 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) { | > | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | 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 -- * | > > > > > > > > > > > | 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 | } 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 -- * |
︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | * * Free resources associated with maintaining the focus. * * Results: * None. * * Side effects: | | | 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | * * Free resources associated with maintaining the focus. * * Results: * None. * * Side effects: * This mainPtr should no longer access focus information. * *---------------------------------------------------------------------- */ void TkFocusFree( TkMainInfo *mainPtr) /* Record that identifies a particular |
︙ | ︙ | |||
1163 1164 1165 1166 1167 1168 1169 | } /* *---------------------------------------------------------------------- * * TkFocusJoin -- * | | | 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | } /* *---------------------------------------------------------------------- * * 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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* * 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" #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" /* Defines TK_DRAW_IN_CONTEXT */ #endif #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The following structure is used to keep track of all the fonts that exist * in the current application. It must be stored in the TkMainInfo for the * application. */ |
︙ | ︙ | |||
65 66 67 68 69 70 71 | * token. */ typedef struct LayoutChunk { const char *start; /* Pointer to simple string to be displayed. * This is a pointer into the TkTextLayout's * string. */ | | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | * token. */ typedef struct LayoutChunk { const char *start; /* Pointer to simple string to be displayed. * This is a pointer into the TkTextLayout's * string. */ Tcl_Size numBytes; /* The number of bytes in this chunk. */ Tcl_Size numChars; /* The number of characters in this chunk. */ Tcl_Size numDisplayChars; /* The number of characters to display when * this chunk is displayed. Can be less than * numChars if extra space characters were * absorbed by the end of the chunk. This will * be < 0 if this is a chunk that is holding a * tab or newline. */ int x, y; /* The origin of the first character in this * chunk with respect to the upper-left hand |
︙ | ︙ | |||
90 91 92 93 94 95 96 | } LayoutChunk; typedef struct TextLayout { Tk_Font tkfont; /* The font used when laying out the text. */ const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | } LayoutChunk; typedef struct TextLayout { Tk_Font tkfont; /* The font used when laying out the text. */ const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ Tcl_Size numChunks; /* Number of chunks actually used in following * array. */ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN * THE STRUCTURE. */ } TextLayout; /* |
︙ | ︙ | |||
320 321 322 323 324 325 326 | ((const TkFontAttributes *) &((TkFont *) (tkfont))->fa) #define GetFontMetrics(tkfont) \ ((const TkFontMetrics *) &((TkFont *) (tkfont))->fm) static int ConfigAttributesObj(Tcl_Interp *interp, | | | | | | | > > | 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 | ((const TkFontAttributes *) &((TkFont *) (tkfont))->fa) #define GetFontMetrics(tkfont) \ ((const TkFontMetrics *) &((TkFont *) (tkfont))->fm) static int ConfigAttributesObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Size objc, Tcl_Obj *const objv[], TkFontAttributes *faPtr); static void DupFontObjProc(Tcl_Obj *srcObjPtr, Tcl_Obj *dupObjPtr); static int FieldSpecified(const char *field); static void FreeFontObj(Tcl_Obj *objPtr); static void FreeFontObjProc(Tcl_Obj *objPtr); static int GetAttributeInfoObj(Tcl_Interp *interp, const TkFontAttributes *faPtr, Tcl_Obj *objPtr); static LayoutChunk * NewChunk(TextLayout **layoutPtrPtr, int *maxPtr, const char *start, Tcl_Size numChars, int curX, int newX, int y); static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, TkFontAttributes *faPtr); static void RecomputeWidgets(TkWindow *winPtr); static int SetFontFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void TheWorldHasChanged(void *clientData); static void UpdateDependentFonts(TkFontInfo *fiPtr, Tk_Window tkwin, Tcl_HashEntry *namedHashPtr); /* * The following structure defines the implementation of the "font" Tcl * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of each * font object points to the TkFont structure for the font, or NULL. */ const TkObjType tkFontObjType = { {"font", /* name */ FreeFontObjProc, /* freeIntRepProc */ DupFontObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *--------------------------------------------------------------------------- * * TkFontPkgInit -- * |
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | void TkFontPkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { TkFontInfo *fiPtr = mainPtr->fontInfoPtr; Tcl_HashEntry *hPtr, *searchPtr; Tcl_HashSearch search; int fontsLeft = 0; for (searchPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); searchPtr != NULL; searchPtr = Tcl_NextHashEntry(&search)) { fontsLeft++; #ifdef DEBUG_FONTS fprintf(stderr, "Font %s still in cache.\n", (char *) Tcl_GetHashKey(&fiPtr->fontCache, searchPtr)); #endif } #ifdef PURIFY | > > > > | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | void TkFontPkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { TkFontInfo *fiPtr = mainPtr->fontInfoPtr; Tcl_HashEntry *hPtr, *searchPtr; Tcl_HashSearch search; #ifdef PURIFY int fontsLeft = 0; #endif for (searchPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); searchPtr != NULL; searchPtr = Tcl_NextHashEntry(&search)) { #ifdef PURIFY fontsLeft++; #endif #ifdef DEBUG_FONTS fprintf(stderr, "Font %s still in cache.\n", (char *) Tcl_GetHashKey(&fiPtr->fontCache, searchPtr)); #endif } #ifdef PURIFY |
︙ | ︙ | |||
463 464 465 466 467 468 469 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_FontObjCmd( | | | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_FontObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int index; Tk_Window tkwin = (Tk_Window)clientData; TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; |
︙ | ︙ | |||
514 515 516 517 518 519 520 | return TCL_ERROR; } /* * Next parameter may be an option. */ | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | return TCL_ERROR; } /* * Next parameter may be an option. */ n = 3 + skip; optPtr = NULL; charPtr = NULL; if (n < objc) { s = Tcl_GetString(objv[n]); if (s[0] == '-' && s[1] != '-') { optPtr = objv[n]; n++; |
︙ | ︙ | |||
562 563 564 565 566 567 568 | /* * The 'charPtr' arg must be a single Unicode. */ if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); | | | | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | /* * The 'charPtr' arg must be a single Unicode. */ if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); size_t len = Tcl_UtfToUniChar(string, &uniChar); if (len != (size_t)charPtr->length) { resultPtr = Tcl_NewStringObj( "expected a single character but got \"", TCL_INDEX_NONE); Tcl_AppendLimitedToObj(resultPtr, string, TCL_INDEX_NONE, 40, "..."); Tcl_AppendToObj(resultPtr, "\"", TCL_INDEX_NONE); Tcl_SetObjResult(interp, resultPtr); Tcl_SetErrorCode(interp, "TK", "VALUE", "FONT_SAMPLE", NULL); return TCL_ERROR; } } /* |
︙ | ︙ | |||
656 657 658 659 660 661 662 | } if (name == NULL) { /* * No font name specified. Generate one of the form "fontX". */ for (i = 1; ; i++) { | | | | 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 | } if (name == NULL) { /* * No font name specified. Generate one of the form "fontX". */ for (i = 1; ; i++) { snprintf(buf, sizeof(buf), "font%d", i); namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, buf); if (namedHashPtr == NULL) { break; } } name = buf; skip = 2; } TkInitFontAttributes(&fa); if (ConfigAttributesObj(interp, tkwin, objc - skip, objv + skip, &fa) != TCL_OK) { return TCL_ERROR; } if (TkCreateNamedFont(interp, tkwin, name, &fa) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE)); break; } case FONT_DELETE: { int i, result = TCL_OK; const char *string; /* |
︙ | ︙ | |||
701 702 703 704 705 706 707 | } case FONT_FAMILIES: { int skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } | | | | | | | | 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 | } case FONT_FAMILIES: { int skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc != 2 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?"); return TCL_ERROR; } TkpGetFontFamilies(interp, tkwin); break; } case FONT_MEASURE: { const char *string; Tk_Font tkfont; Tcl_Size length = 0; int skip = 0; if (objc > 4) { skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); if (skip < 0) { return TCL_ERROR; } } if (objc != 4 + skip) { Tcl_WrongNumArgs(interp, 2, objv, "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 > 4 + skip)) { Tcl_WrongNumArgs(interp, 2, objv, "font ?-displayof window? ?-option?"); return TCL_ERROR; } tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]); if (tkfont == NULL) { return TCL_ERROR; |
︙ | ︙ | |||
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; | | | | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | 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: { |
︙ | ︙ | |||
801 802 803 804 805 806 807 | NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr); Tcl_ListObjAppendElement(NULL, resultPtr, | | | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(string, TCL_INDEX_NONE)); } namedHashPtr = Tcl_NextHashEntry(&search); } Tcl_SetObjResult(interp, resultPtr); break; } } |
︙ | ︙ | |||
869 870 871 872 873 874 875 | } cacheHashPtr = Tcl_NextHashEntry(&search); } } static void TheWorldHasChanged( | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | } cacheHashPtr = Tcl_NextHashEntry(&search); } } static void TheWorldHasChanged( void *clientData) /* Info about application's fonts. */ { TkFontInfo *fiPtr = (TkFontInfo *)clientData; /* * On macOS it is catastrophic to recompute all widgets while the * [NSView drawRect] method is drawing. The best that we can do in * that situation is to abort the recomputation and hope for the best. |
︙ | ︙ | |||
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 | > | | | | | | | > > > > > > > | 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 | 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 -- * |
︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | Tk_Window tkwin, /* For display on which font will be used. */ const char *string) /* String describing font, as: named font, * native format, or parseable string. */ { Tk_Font tkfont; Tcl_Obj *strPtr; | | | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | Tk_Window tkwin, /* For display on which font will be used. */ const char *string) /* String describing font, as: named font, * native format, or parseable string. */ { Tk_Font tkfont; Tcl_Obj *strPtr; strPtr = Tcl_NewStringObj(string, TCL_INDEX_NONE); Tcl_IncrRefCount(strPtr); tkfont = Tk_AllocFontFromObj(interp, tkwin, strPtr); Tcl_DecrRefCount(strPtr); return tkfont; } /* |
︙ | ︙ | |||
1106 1107 1108 1109 1110 1111 1112 | { TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; Tcl_HashEntry *cacheHashPtr, *namedHashPtr; TkFont *fontPtr, *firstFontPtr, *oldFontPtr; int isNew, descent; NamedFont *nfPtr; | | | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | { TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; Tcl_HashEntry *cacheHashPtr, *namedHashPtr; TkFont *fontPtr, *firstFontPtr, *oldFontPtr; int isNew, descent; NamedFont *nfPtr; if (objPtr->typePtr != &tkFontObjType.objType || objPtr->internalRep.twoPtrValue.ptr2 != fiPtr) { SetFontFromAny(interp, objPtr); } oldFontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (oldFontPtr != NULL) { if (oldFontPtr->resourceRefCount == 0) { |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | if (fontPtr == NULL) { if (isNew) { Tcl_DeleteHashEntry(cacheHashPtr); } Tcl_SetObjResult(interp, Tcl_NewStringObj( "failed to allocate font due to internal system font engine" | | | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | if (fontPtr == NULL) { if (isNew) { Tcl_DeleteHashEntry(cacheHashPtr); } Tcl_SetObjResult(interp, Tcl_NewStringObj( "failed to allocate font due to internal system font engine" " problem", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "FONT", "INTERNAL_PROBLEM", NULL); return NULL; } fontPtr->resourceRefCount = 1; fontPtr->objRefCount = 1; fontPtr->cacheHashPtr = cacheHashPtr; |
︙ | ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | * in. */ Tcl_Obj *objPtr) /* The object from which to get the font. */ { TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; TkFont *fontPtr; Tcl_HashEntry *hashPtr; | | > | 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 | * in. */ Tcl_Obj *objPtr) /* The object from which to get the font. */ { TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; TkFont *fontPtr; Tcl_HashEntry *hashPtr; if (objPtr->typePtr != &tkFontObjType.objType || objPtr->internalRep.twoPtrValue.ptr2 != fiPtr) { SetFontFromAny(NULL, objPtr); } fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if (fontPtr->resourceRefCount == 0) { /* * This is a stale reference: it refers to a TkFont that's no * longer in use. Clear the reference. */ FreeFontObj(objPtr); fontPtr = NULL; } else if (Tk_Screen(tkwin) == fontPtr->screen) { fontPtr->resourceRefCount++; return (Tk_Font) fontPtr; } } /* * Next, search the list of fonts that have the name we want, to see if * one of them is for the right screen. |
︙ | ︙ | |||
1372 1373 1374 1375 1376 1377 1378 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } | | | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | */ Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &tkFontObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->internalRep.twoPtrValue.ptr2 = NULL; return TCL_OK; } /* |
︙ | ︙ | |||
1713 1714 1715 1716 1717 1718 1719 | /* * Inline, capitalize the first letter of each word, lowercase the * rest of the letters in each word, and then take out the spaces * between the words. This may make the DString shorter, which is safe * to do. */ | | | | | | | 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 | /* * Inline, capitalize the first letter of each word, lowercase the * rest of the letters in each word, and then take out the spaces * between the words. This may make the DString shorter, which is safe * to do. */ Tcl_DStringAppend(dsPtr, family, TCL_INDEX_NONE); src = dest = Tcl_DStringValue(dsPtr) + len; upper = 1; for (; *src != '\0'; ) { while (isspace(UCHAR(*src))) { /* INTL: ISO space */ src++; upper = 1; } src += Tcl_UtfToUniChar(src, &ch); if (upper) { ch = Tcl_UniCharToUpper(ch); upper = 0; } else { ch = Tcl_UniCharToLower(ch); } dest += Tcl_UniCharToUtf(ch, dest); } *dest = '\0'; Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr)); family = Tcl_DStringValue(dsPtr) + len; } if (family != Tcl_DStringValue(dsPtr) + len) { Tcl_DStringAppend(dsPtr, family, TCL_INDEX_NONE); family = Tcl_DStringValue(dsPtr) + len; } if (strcasecmp(family, "NewCenturySchoolbook") == 0) { Tcl_DStringSetLength(dsPtr, len); Tcl_DStringAppend(dsPtr, "NewCenturySchlbk", TCL_INDEX_NONE); family = Tcl_DStringValue(dsPtr) + len; } /* * Get the string to use for the weight. */ |
︙ | ︙ | |||
1792 1793 1794 1795 1796 1797 1798 | * and not italic. */ if ((slantString == NULL) && (weightString == NULL)) { if ((strcmp(family, "Times") == 0) || (strcmp(family, "NewCenturySchlbk") == 0) || (strcmp(family, "Palatino") == 0)) { | | | | | | 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | * and not italic. */ if ((slantString == NULL) && (weightString == NULL)) { if ((strcmp(family, "Times") == 0) || (strcmp(family, "NewCenturySchlbk") == 0) || (strcmp(family, "Palatino") == 0)) { Tcl_DStringAppend(dsPtr, "-Roman", TCL_INDEX_NONE); } } else { Tcl_DStringAppend(dsPtr, "-", TCL_INDEX_NONE); if (weightString != NULL) { Tcl_DStringAppend(dsPtr, weightString, TCL_INDEX_NONE); } if (slantString != NULL) { Tcl_DStringAppend(dsPtr, slantString, TCL_INDEX_NONE); } } return (int)(fontPtr->fa.size + 0.5); } /* |
︙ | ︙ | |||
1829 1830 1831 1832 1833 1834 1835 | *--------------------------------------------------------------------------- */ int Tk_TextWidth( Tk_Font tkfont, /* Font in which text will be measured. */ const char *string, /* String whose width will be computed. */ | | | | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 | *--------------------------------------------------------------------------- */ int Tk_TextWidth( Tk_Font tkfont, /* Font in which text will be measured. */ const char *string, /* String whose width will be computed. */ Tcl_Size numBytes) /* Number of bytes to consider from string, or * TCL_INDEX_NONE for strlen(). */ { int width; if (numBytes < 0) { numBytes = strlen(string); } Tk_MeasureChars(tkfont, string, numBytes, -1, 0, &width); |
︙ | ︙ | |||
1876 1877 1878 1879 1880 1881 1882 | Tk_Font tkfont, /* Font used in GC; must have been allocated * by Tk_GetFont(). Used for character * dimensions, etc. */ const char *string, /* String containing characters to be * underlined or overstruck. */ int x, int y, /* Coordinates at which first character of * string is drawn. */ | | | | | | | 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 | Tk_Font tkfont, /* Font used in GC; must have been allocated * by Tk_GetFont(). Used for character * dimensions, etc. */ const char *string, /* String containing characters to be * underlined or overstruck. */ int x, int y, /* Coordinates at which first character of * string is drawn. */ Tcl_Size firstByte, /* Index of first byte of first character. */ Tcl_Size lastByte) /* Index of first byte after the last * character. */ { TkUnderlineCharsInContext(display, drawable, gc, tkfont, string, lastByte, x, y, firstByte, lastByte); } void TkUnderlineCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for actually drawing * line. */ Tk_Font tkfont, /* Font used in GC; must have been allocated * by Tk_GetFont(). Used for character * dimensions, etc. */ const char *string, /* String containing characters to be * underlined or overstruck. */ Tcl_Size numBytes, /* Number of bytes in string. */ int x, int y, /* Coordinates at which the first character of * the whole string would be drawn. */ Tcl_Size firstByte, /* Index of first byte of first character. */ Tcl_Size lastByte) /* Index of first byte after the last * character. */ { TkFont *fontPtr = (TkFont *) tkfont; int startX, endX; TkpMeasureCharsInContext(tkfont, string, numBytes, 0, firstByte, -1, 0, &startX); |
︙ | ︙ | |||
1949 1950 1951 1952 1953 1954 1955 | */ Tk_TextLayout Tk_ComputeTextLayout( Tk_Font tkfont, /* Font that will be used to display text. */ const char *string, /* String whose dimensions are to be * computed. */ | | | > | | 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 | */ Tk_TextLayout Tk_ComputeTextLayout( Tk_Font tkfont, /* Font that will be used to display text. */ const char *string, /* String whose dimensions are to be * computed. */ Tcl_Size numChars, /* Number of characters to consider from * string, or TCL_INDEX_NONE for strlen(). */ int wrapLength, /* Longest permissible line length, in pixels. * <= 0 means no automatic wrapping: just let * lines get as long as needed. */ Tk_Justify justify, /* How to justify lines. */ int flags, /* Flag bits OR-ed together. TK_IGNORE_TABS * means that tab characters should not be * expanded. TK_IGNORE_NEWLINES means that * newline characters should not cause a line * break. */ int *widthPtr, /* Filled with width of string. */ int *heightPtr) /* Filled with height of string. */ { TkFont *fontPtr = (TkFont *) tkfont; const char *start, *endp, *special; Tcl_Size n; int y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; LayoutChunk *chunkPtr; const TkFontMetrics *fmPtr; Tcl_DString lineBuffer; Tcl_DStringInit(&lineBuffer); |
︙ | ︙ | |||
1989 1990 1991 1992 1993 1994 1995 | } fmPtr = &fontPtr->fm; height = fmPtr->ascent + fmPtr->descent; if (numChars < 0) { | | | 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | } fmPtr = &fontPtr->fm; height = fmPtr->ascent + fmPtr->descent; if (numChars < 0) { numChars = Tcl_NumUtfChars(string, TCL_INDEX_NONE); } if (wrapLength == 0) { wrapLength = -1; } maxChunks = 1; |
︙ | ︙ | |||
2288 2289 2290 2291 2292 2293 2294 | 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). */ | | | > | | 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 | 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). */ Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { #if 0 /* Use TkDrawAngledTextLayout() implementation - testing purposes at this point */ TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar); #else TextLayout *layoutPtr = (TextLayout *) layout; int i, drawX; Tcl_Size numDisplayChars; const char *firstByte, *lastByte; LayoutChunk *chunkPtr; if (layoutPtr == NULL) { return; } |
︙ | ︙ | |||
2359 2360 2361 2362 2363 2364 2365 | 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). */ double angle, | | | | 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 | 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). */ double angle, Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { TextLayout *layoutPtr = (TextLayout *) layout; int i, numDisplayChars, drawX; const char *firstByte, *lastByte; LayoutChunk *chunkPtr; |
︙ | ︙ | |||
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, | | | 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | 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, | | | 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 | * 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; } |
︙ | ︙ | |||
2721 2722 2723 2724 2725 2726 2727 | *--------------------------------------------------------------------------- */ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ | | | > > > > | > | 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 | *--------------------------------------------------------------------------- */ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ Tcl_Size 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) { |
︙ | ︙ | |||
2762 2763 2764 2765 2766 2767 2768 | if (xPtr != NULL) { Tk_MeasureChars(tkfont, chunkPtr->start, end - chunkPtr->start, -1, 0, &x); x += chunkPtr->x; } if (widthPtr != NULL) { int ch; | | | 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 | if (xPtr != NULL) { Tk_MeasureChars(tkfont, chunkPtr->start, end - chunkPtr->start, -1, 0, &x); x += chunkPtr->x; } if (widthPtr != NULL) { int ch; Tk_MeasureChars(tkfont, end, Tcl_UtfToUniChar(end, &ch), -1, 0, &w); } goto check; } index -= chunkPtr->numChars; chunkPtr++; } if (index != 0) { |
︙ | ︙ | |||
3282 3283 3284 3285 3286 3287 3288 | Tk_TextLayout layout) /* The layout to be rendered. */ { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); int i, j; | | | | | | | | 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 | Tk_TextLayout layout) /* The layout to be rendered. */ { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); int i, j; Tcl_Size len; const char *p, *glyphname; char uindex[5], c, *ps; int ch; Tcl_AppendToObj(psObj, "[(", TCL_INDEX_NONE); for (i = 0; i < layoutPtr->numChunks; i++, chunkPtr++) { if (baseline != chunkPtr->y) { Tcl_AppendToObj(psObj, ")]\n[(", TCL_INDEX_NONE); baseline = chunkPtr->y; } if (chunkPtr->numDisplayChars <= 0) { if (chunkPtr->start[0] == '\t') { Tcl_AppendToObj(psObj, "\\t", TCL_INDEX_NONE); } continue; } for (p=chunkPtr->start, j=0; j<chunkPtr->numDisplayChars; j++) { /* * INTL: We only handle symbols that have an encoding as a glyph * from the standard set defined by Adobe. The rest get punted. * Eventually this should be revised to handle more sophsticiated * international postscript fonts. */ p += Tcl_UtfToUniChar(p, &ch); if ((ch == '(') || (ch == ')') || (ch == '\\') || (ch < 0x20)) { /* * Tricky point: the "03" is necessary in the snprintf below, * so that a full three digits of octal are always generated. * Without the "03", a number following this sequence could be * interpreted by Postscript as part of this sequence. */ Tcl_AppendPrintfToObj(psObj, "\\%03o", ch); continue; |
︙ | ︙ | |||
3337 3338 3339 3340 3341 3342 3343 | * This character doesn't belong to the ASCII character set, so we * use the full glyph name. */ if (ch > 0xffff) { goto noMapping; } | | | | | | | | 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 | * This character doesn't belong to the ASCII character set, so we * use the full glyph name. */ if (ch > 0xffff) { goto noMapping; } snprintf(uindex, sizeof(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 { Tcl_AppendToObj(psObj, ")/", TCL_INDEX_NONE); } Tcl_AppendToObj(psObj, glyphname, TCL_INDEX_NONE); Tcl_AppendToObj(psObj, "(", TCL_INDEX_NONE); } else { /* * No known mapping for the character into the space of * PostScript glyphs. Ignore it. :-( */ noMapping: ; #ifdef TK_DEBUG_POSTSCRIPT_OUTPUT fprintf(stderr, "Warning: no mapping to PostScript " "glyphs for \\u%04x\n", ch); #endif } } } Tcl_AppendToObj(psObj, ")]\n", TCL_INDEX_NONE); Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj); Tcl_DecrRefCount(psObj); } /* *--------------------------------------------------------------------------- * |
︙ | ︙ | |||
3396 3397 3398 3399 3400 3401 3402 | *--------------------------------------------------------------------------- */ static int ConfigAttributesObj( Tcl_Interp *interp, /* Interp for error return. */ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */ | | > | | 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 | *--------------------------------------------------------------------------- */ static int ConfigAttributesObj( Tcl_Interp *interp, /* Interp for error return. */ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */ Tcl_Size objc, /* Number of elements in argv. */ Tcl_Obj *const objv[], /* Command line options. */ TkFontAttributes *faPtr) /* Font attributes structure whose fields are * to be modified. Structure must already be * properly initialized. */ { Tcl_Size i; int n, index; Tcl_Obj *optionPtr, *valuePtr; const char *value; for (i = 0; i < objc; i += 2) { optionPtr = objv[i]; if (Tcl_GetIndexFromObj(interp, optionPtr, fontOpt, "option", 1, |
︙ | ︙ | |||
3539 3540 3541 3542 3543 3544 3545 | } else { valuePtr = Tcl_NewWideIntObj(-(Tcl_WideInt)(-faPtr->size + 0.5)); } break; case FONT_WEIGHT: str = TkFindStateString(weightMap, faPtr->weight); | | | | | 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 | } else { valuePtr = Tcl_NewWideIntObj(-(Tcl_WideInt)(-faPtr->size + 0.5)); } break; case FONT_WEIGHT: str = TkFindStateString(weightMap, faPtr->weight); valuePtr = Tcl_NewStringObj(str, TCL_INDEX_NONE); break; case FONT_SLANT: str = TkFindStateString(slantMap, faPtr->slant); valuePtr = Tcl_NewStringObj(str, TCL_INDEX_NONE); break; case FONT_UNDERLINE: valuePtr = Tcl_NewBooleanObj(faPtr->underline); break; case FONT_OVERSTRIKE: valuePtr = Tcl_NewBooleanObj(faPtr->overstrike); break; } if (objPtr != NULL) { Tcl_SetObjResult(interp, valuePtr); return TCL_OK; } Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(fontOpt[i], TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, resultPtr, valuePtr); } Tcl_SetObjResult(interp, resultPtr); return TCL_OK; } /* |
︙ | ︙ | |||
3601 3602 3603 3604 3605 3606 3607 | if (faPtr->size >= 0.0) { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5))); } else { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5))); } if (faPtr->weight != TK_FW_NORMAL) { str = TkFindStateString(weightMap, faPtr->weight); | | | | | | 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 | if (faPtr->size >= 0.0) { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5))); } else { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5))); } if (faPtr->weight != TK_FW_NORMAL) { str = TkFindStateString(weightMap, faPtr->weight); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->slant != TK_FS_ROMAN) { str = TkFindStateString(slantMap, faPtr->slant); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->underline) { str = TkFindStateString(underlineMap, faPtr->underline); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->overstrike) { str = TkFindStateString(overstrikeMap, faPtr->overstrike); Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } return resultPtr; } /* *--------------------------------------------------------------------------- * |
︙ | ︙ | |||
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; | | > | 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 | 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; Tcl_Size objc, i; Tcl_Obj **objv; const char *string; TkInitFontAttributes(faPtr); string = Tcl_GetString(objPtr); if (*string == '-') { |
︙ | ︙ | |||
3807 3808 3809 3810 3811 3812 3813 | */ static LayoutChunk * NewChunk( TextLayout **layoutPtrPtr, int *maxPtr, const char *start, | | | 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 | */ static LayoutChunk * NewChunk( TextLayout **layoutPtrPtr, int *maxPtr, const char *start, Tcl_Size numBytes, int curX, int newX, int y) { TextLayout *layoutPtr; LayoutChunk *chunkPtr; int maxChunks, numChars; |
︙ | ︙ | |||
3894 3895 3896 3897 3898 3899 3900 | str = string; if (*str == '-') { str++; } Tcl_DStringInit(&ds); | | | 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 | str = string; if (*str == '-') { str++; } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, str, TCL_INDEX_NONE); src = Tcl_DStringValue(&ds); field[0] = src; for (i = 0; *src != '\0'; src++) { if (!(*src & 0x80) && Tcl_UniCharIsUpper(UCHAR(*src))) { *src = (char) Tcl_UniCharToLower(UCHAR(*src)); |
︙ | ︙ | |||
4329 4330 4331 4332 4333 4334 4335 | Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ Tk_Font *font, char *dst) { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr; | | | 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 | Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ Tk_Font *font, char *dst) { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr; Tcl_Size numBytesInChunk; if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { dst[0] = '\0'; return 0; } chunkPtr = layoutPtr->chunks; |
︙ | ︙ |
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 |
︙ | ︙ | |||
85 86 87 88 89 90 91 | */ typedef struct TkFont { /* * Fields used and maintained exclusively by generic code. */ | | | | 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 | */ typedef struct TkFont { /* * Fields used and maintained exclusively by generic code. */ Tcl_Size resourceRefCount; /* Number of active uses of this font (each * active use corresponds to a call to * Tk_AllocFontFromTable or Tk_GetFont). If * this count is 0, then this TkFont structure * is no longer valid and it isn't present in * a hash table: it is being kept around only * because there are objects referring to it. * The structure is freed when * resourceRefCount and objRefCount are both * 0. */ Tcl_Size objRefCount; /* The number of Tcl objects that reference * this structure. */ Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure, * used when deleting it. */ Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that * corresponds to the named font that the * tkfont was based on, or NULL if the tkfont * was not based on a named font. */ |
︙ | ︙ |
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" |
︙ | ︙ | |||
39 40 41 42 43 44 45 | Tcl_Interp *interp; /* Interpreter associated with widget. Used to * delete widget command. */ Tcl_Command widgetCmd; /* Token for frame's widget command. */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this widget. */ char *className; /* Class name for widget (from configuration * option). Malloc-ed. */ | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | Tcl_Interp *interp; /* Interpreter associated with widget. Used to * delete widget command. */ Tcl_Command widgetCmd; /* Token for frame's widget command. */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this widget. */ char *className; /* Class name for widget (from configuration * option). Malloc-ed. */ int type; /* Type of widget, such as TYPE_FRAME. */ char *screenName; /* Screen on which widget is created. Non-null * only for top-levels. Malloc-ed, may be * NULL. */ char *visualName; /* Textual description of visual for window, * from -visual option. Malloc-ed, may be * NULL. */ char *colormapName; /* Textual description of colormap for window, |
︙ | ︙ | |||
324 325 326 327 328 329 330 | /* * Forward declarations for functions defined later in this file: */ static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, | | < < < | | | | | | | | | < < | | | 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 | /* * Forward declarations for functions defined later in this file: */ static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, Tcl_Size objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyFrame; static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(void *clientData); static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap, int highlightWidth, int borderWidth, Tk_Image bgimg, int bgtile); static void FrameBgImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static void FrameCmdDeletedProc(void *clientData); static void FrameEventProc(void *clientData, XEvent *eventPtr); static void FrameLostContentProc(void *clientData, Tk_Window tkwin); static void FrameRequestProc(void *clientData, Tk_Window tkwin); static void FrameStructureProc(void *clientData, XEvent *eventPtr); static Tcl_ObjCmdProc FrameWidgetObjCmd; static void FrameWorldChanged(void *instanceData); static void MapFrame(void *clientData); /* * The structure below defines frame class behavior by means of functions that * can be invoked from generic window code. */ static const Tk_ClassProcs frameClass = { |
︙ | ︙ | |||
396 397 398 399 400 401 402 | * call CreateFrame to do all of the real work. * *-------------------------------------------------------------- */ int Tk_FrameObjCmd( | | | | | | | < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < | 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 | * call CreateFrame to do all of the real work. * *-------------------------------------------------------------- */ int Tk_FrameObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { return TkCreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL); } int Tk_ToplevelObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { return TkCreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL); } int Tk_LabelframeObjCmd( void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { return TkCreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL); } /* *-------------------------------------------------------------- * * TkCreateFrame -- * * This function is the old command function for the "frame" and * "toplevel" commands. Now it is used directly by Tk_Init to create a * new main window. See the user documentation for the "frame" and * "toplevel" commands for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *-------------------------------------------------------------- */ int TkCreateFrame( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ int type, /* What widget type to create. */ const char *appName) /* Should only be non-NULL if there are no * Main window associated with the * interpreter. Gives the base name to use for * the new application. */ { Tk_Window tkwin; Frame *framePtr; Tk_OptionTable optionTable; Tk_Window newWin; const char *className, *screenName, *visualName, *colormapName; const char *arg, *useOption; int depth; Tcl_Size i, length; unsigned int mask; Colormap colormap; Visual *visual; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } /* |
︙ | ︙ | |||
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) { | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | * 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. | | | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | * 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) | | | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | } } 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"); |
︙ | ︙ | |||
719 720 721 722 723 724 725 | (ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) { goto error; } if (framePtr->isContainer) { if (framePtr->useThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "windows cannot have both the -use and the -container" | | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | (ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) { goto error; } if (framePtr->isContainer) { if (framePtr->useThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "windows cannot have both the -use and the -container" " option set", TCL_INDEX_NONE)); 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; |
︙ | ︙ | |||
758 759 760 761 762 763 764 | * See the user documentation. * *-------------------------------------------------------------- */ static int FrameWidgetObjCmd( | | | | | 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 | * See the user documentation. * *-------------------------------------------------------------- */ static int FrameWidgetObjCmd( void *clientData, /* Information about frame widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const frameOptions[] = { "cget", "configure", NULL }; enum options { FRAME_CGET, FRAME_CONFIGURE }; Frame *framePtr = (Frame *)clientData; int result = TCL_OK, index; int c; Tcl_Size i, length; Tcl_Obj *objPtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], frameOptions, |
︙ | ︙ | |||
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++) { | | | | | 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 | } 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 |
︙ | ︙ | |||
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | * Everything associated with the frame is freed up. * *---------------------------------------------------------------------- */ static void DestroyFrame( void *memPtr) /* Info about frame widget. */ { Frame *framePtr = (Frame *)memPtr; Labelframe *labelframePtr = (Labelframe *)memPtr; if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); if (labelframePtr->textGC != NULL) { | > > > > | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | * Everything associated with the frame is freed up. * *---------------------------------------------------------------------- */ static void DestroyFrame( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about frame widget. */ #else char *memPtr) #endif { Frame *framePtr = (Frame *)memPtr; Labelframe *labelframePtr = (Labelframe *)memPtr; if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); if (labelframePtr->textGC != NULL) { |
︙ | ︙ | |||
946 947 948 949 950 951 952 | if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) { Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin); } Tk_UnmapWindow(labelframePtr->labelWin); labelframePtr->labelWin = NULL; } | | | 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) { Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin); } Tk_UnmapWindow(labelframePtr->labelWin); labelframePtr->labelWin = NULL; } Tk_FreeConfigOptions(framePtr, framePtr->optionTable, framePtr->tkwin); } /* *---------------------------------------------------------------------- * * ConfigureFrame -- |
︙ | ︙ | |||
975 976 977 978 979 980 981 | */ static int ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ | | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | */ static int ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; char *oldMenuName; Tk_Window oldWindow = NULL; Labelframe *labelframePtr = (Labelframe *) framePtr; Tk_Image image = NULL; |
︙ | ︙ | |||
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) { | | | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | */ 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); } |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | * Frame will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void FrameWorldChanged( | | | 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 | * Frame will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void FrameWorldChanged( void *instanceData) /* Information about widget. */ { Frame *framePtr = (Frame *)instanceData; Labelframe *labelframePtr = (Labelframe *)instanceData; Tk_Window tkwin = framePtr->tkwin; XGCValues gcValues; GC gc; int anyTextLabel, anyWindowLabel; |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | labelframePtr->labelReqWidth = labelframePtr->labelReqHeight = 0; if (anyTextLabel) { labelText = Tcl_GetString(labelframePtr->textPtr); Tk_FreeTextLayout(labelframePtr->textLayout); labelframePtr->textLayout = Tk_ComputeTextLayout(labelframePtr->tkfont, | | | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | labelframePtr->labelReqWidth = labelframePtr->labelReqHeight = 0; if (anyTextLabel) { labelText = Tcl_GetString(labelframePtr->textPtr); Tk_FreeTextLayout(labelframePtr->textLayout); labelframePtr->textLayout = Tk_ComputeTextLayout(labelframePtr->tkfont, labelText, TCL_INDEX_NONE, 0, TK_JUSTIFY_CENTER, 0, &labelframePtr->labelReqWidth, &labelframePtr->labelReqHeight); labelframePtr->labelReqWidth += 2 * LABELSPACING; labelframePtr->labelReqHeight += 2 * LABELSPACING; } else if (anyWindowLabel) { labelframePtr->labelReqWidth = Tk_ReqWidth(labelframePtr->labelWin); labelframePtr->labelReqHeight = |
︙ | ︙ | |||
1471 1472 1473 1474 1475 1476 1477 | * Commands are output to X to display the frame in its current mode. * *---------------------------------------------------------------------- */ static void DisplayFrame( | | | | | | 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 | * Commands are output to X to display the frame in its current mode. * *---------------------------------------------------------------------- */ static void DisplayFrame( void *clientData) /* Information about widget. */ { Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; int bdX1, bdY1, bdX2, bdY2, hlWidth; Pixmap pixmap; Bool useClipping = False; framePtr->flags &= ~REDRAW_PENDING; if ((framePtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } /* * Highlight shall always be drawn if it exists, so do that first. */ hlWidth = framePtr->highlightWidth; if (hlWidth != 0) { 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. */ |
︙ | ︙ | |||
1616 1617 1618 1619 1620 1621 1622 | * Draw label. If there is not room for the entire label, use * clipping to get a nice appearance. */ if ((labelframePtr->labelBox.width < labelframePtr->labelReqWidth) || (labelframePtr->labelBox.height < labelframePtr->labelReqHeight)) { | < < | | < > | < | 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 | * Draw label. If there is not room for the entire label, use * clipping to get a nice appearance. */ if ((labelframePtr->labelBox.width < labelframePtr->labelReqWidth) || (labelframePtr->labelBox.height < labelframePtr->labelReqHeight)) { useClipping = True; XSetClipRectangles(framePtr->display, labelframePtr->textGC, 0, 0, &labelframePtr->labelBox, 1, Unsorted); } Tk_DrawTextLayout(framePtr->display, pixmap, labelframePtr->textGC, labelframePtr->textLayout, labelframePtr->labelTextX + LABELSPACING, labelframePtr->labelTextY + LABELSPACING, 0, -1); if (useClipping) { XSetClipMask(framePtr->display, labelframePtr->textGC, None); } } else { /* * Reposition and map the window (but in different ways depending * on whether the frame is the window's parent). */ |
︙ | ︙ | |||
1731 1732 1733 1734 1735 1736 1737 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void FrameEventProc( | | | | 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 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void FrameEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Frame *framePtr = (Frame *)clientData; 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 |
︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 | framePtr->tkwin = NULL; Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd); } if (framePtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayFrame, framePtr); } Tcl_CancelIdleCall(MapFrame, framePtr); | | | | 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 | framePtr->tkwin = NULL; Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd); } if (framePtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayFrame, framePtr); } Tcl_CancelIdleCall(MapFrame, framePtr); Tcl_EventuallyFree(framePtr, DestroyFrame); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { framePtr->flags |= GOT_FOCUS; if (framePtr->highlightWidth > 0) { goto redraw; } } } else if (eventPtr->type == FocusOut) { 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); |
︙ | ︙ | |||
1824 1825 1826 1827 1828 1829 1830 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void FrameCmdDeletedProc( | | | | 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void FrameCmdDeletedProc( void *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 |
︙ | ︙ | |||
1875 1876 1877 1878 1879 1880 1881 | * The frame given by the clientData argument is mapped. * *---------------------------------------------------------------------- */ static void MapFrame( | | | 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 | * The frame given by the clientData argument is mapped. * *---------------------------------------------------------------------- */ static void MapFrame( void *clientData) /* Pointer to frame structure. */ { Frame *framePtr = (Frame *)clientData; /* * Wait for all other background events to be processed before mapping * window. This ensures that the window's correct geometry will have been * determined before it is first mapped, so that the window manager |
︙ | ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | * The window is disassociated from the frame when it is deleted. * *-------------------------------------------------------------- */ static void FrameStructureProc( | | | 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 | * The window is disassociated from the frame when it is deleted. * *-------------------------------------------------------------- */ static void FrameStructureProc( void *clientData, /* Pointer to record describing frame. */ XEvent *eventPtr) /* Describes what just happened. */ { Labelframe *labelframePtr = (Labelframe *)clientData; if (eventPtr->type == DestroyNotify) { /* * This should only happen in a labelframe but it doesn't hurt to be |
︙ | ︙ | |||
2000 2001 2002 2003 2004 2005 2006 | * on the options specified for the frame. * *-------------------------------------------------------------- */ static void FrameRequestProc( | | | < | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 | * on the options specified for the frame. * *-------------------------------------------------------------- */ static void FrameRequestProc( void *clientData, /* Pointer to record for frame. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { Frame *framePtr = (Frame *)clientData; FrameWorldChanged(framePtr); } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
2028 2029 2030 2031 2032 2033 2034 | * Forgets all frame-related information about the content window. * *-------------------------------------------------------------- */ static void FrameLostContentProc( | | | < | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | * Forgets all frame-related information about the content window. * *-------------------------------------------------------------- */ static void FrameLostContentProc( void *clientData, /* Frame structure for content window window that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window window. */ { Frame *framePtr = (Frame *)clientData; Labelframe *labelframePtr = (Labelframe *)clientData; /* * This should only happen in a labelframe but it doesn't hurt to be * careful. */ if (labelframePtr->frame.type == TYPE_LABELFRAME) { |
︙ | ︙ | |||
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) { | | | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | 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. |
︙ | ︙ | |||
2148 2149 2150 2151 2152 2153 2154 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void FrameBgImageProc( | | | | | | | > < < < < < < < | 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void FrameBgImageProc( void *clientData, /* Pointer to widget record. */ TCL_UNUSED(int), /* Upper left pixel (within image) that must */ TCL_UNUSED(int), /* be redisplayed. */ TCL_UNUSED(int), /* Dimensions of area to redisplay (might be */ TCL_UNUSED(int), /* <= 0). */ TCL_UNUSED(int), /* New dimensions of image. */ TCL_UNUSED(int)) { Frame *framePtr = (Frame *)clientData; /* * Changing the background image never alters the dimensions of the frame. */ if (framePtr->tkwin && Tk_IsMapped(framePtr->tkwin) && !(framePtr->flags & REDRAW_PENDING)) { |
︙ | ︙ |
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"; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
567 568 569 570 571 572 573 | Tcl_Interp *interp, /* Use this for error reporting. */ Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ const char *string, /* String describing a screen distance. */ double *doublePtr) /* Place to store converted result. */ { | | > | | | > > | < < > | < < > | > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < | 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 | Tcl_Interp *interp, /* Use this for error reporting. */ Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ const char *string, /* String describing a screen distance. */ double *doublePtr) /* Place to store converted result. */ { const char *rest; double d; Tcl_DString ds; if (Tcl_GetDouble(NULL, string, &d) == TCL_OK) { if (!tkwin) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("bad screen", -1)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SCREEN_DISTANCE", NULL); } return TCL_ERROR; } d /= WidthOfScreen(Tk_Screen(tkwin)); d *= WidthMMOfScreen(Tk_Screen(tkwin)); *doublePtr = d; return TCL_OK; } rest = string + strlen(string); while ((rest > string) && isspace(UCHAR(rest[-1]))) { --rest; /* skip all spaces at the end */ } if (rest > string) { --rest; /* point to the character just before the last space */ } if (rest == string) { error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance or \"\" but got \"%.50s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } return TCL_ERROR; } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, string, rest-string); if (Tcl_GetDouble(NULL, Tcl_DStringValue(&ds), &d) != TCL_OK) { Tcl_DStringFree(&ds); goto error; } Tcl_DStringFree(&ds); switch (*rest) { case 'c': d *= 10; break; case 'i': d *= 25.4; break; case 'm': break; case 'p': d *= 25.4/72.0; break; default: goto error; } *doublePtr = d; return TCL_OK; } /* *-------------------------------------------------------------- * * Tk_GetPixels -- * |
︙ | ︙ | |||
687 688 689 690 691 692 693 | Tcl_Interp *interp, /* Use this for error reporting. */ Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ const char *string, /* String describing a number of pixels. */ double *doublePtr) /* Place to store converted result. */ { | | > | > > > > > > > > > > > > > > > > > | | > > > > | < > > > | > > > > | < < < < < < < < < < < < < < < < < < | 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 | Tcl_Interp *interp, /* Use this for error reporting. */ Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ const char *string, /* String describing a number of pixels. */ double *doublePtr) /* Place to store converted result. */ { const char *rest; double d; Tcl_DString ds; if (Tcl_GetDouble(NULL, string, &d) == TCL_OK) { *doublePtr = d; return TCL_OK; } if (!tkwin) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("bad screen", -1)); Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL); } return TCL_ERROR; } rest = string + strlen(string); while ((rest > string) && isspace(UCHAR(rest[-1]))) { --rest; /* skip all spaces at the end */ } if (rest > string) { --rest; /* point to the character just before the last space */ } if (rest == string) { error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance but got \"%.50s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } return TCL_ERROR; } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, string, rest-string); if (Tcl_GetDouble(NULL, Tcl_DStringValue(&ds), &d) != TCL_OK) { Tcl_DStringFree(&ds); goto error; } Tcl_DStringFree(&ds); switch (*rest) { case 'c': d *= 10*WidthOfScreen(Tk_Screen(tkwin)); d /= WidthMMOfScreen(Tk_Screen(tkwin)); break; case 'i': d *= 25.4*WidthOfScreen(Tk_Screen(tkwin)); d /= WidthMMOfScreen(Tk_Screen(tkwin)); break; case 'm': d *= WidthOfScreen(Tk_Screen(tkwin)); d /= WidthMMOfScreen(Tk_Screen(tkwin)); break; case 'p': d *= (25.4/72.0)*WidthOfScreen(Tk_Screen(tkwin)); d /= WidthMMOfScreen(Tk_Screen(tkwin)); break; default: goto error; } *doublePtr = d; return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * 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. |
︙ | ︙ | |||
164 165 166 167 168 169 170 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_GrabObjCmd( | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_GrabObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int globalGrab; Tk_Window tkwin; TkDisplay *dispPtr; const char *arg; int index; Tcl_Size len; static const char *const optionStrings[] = { "current", "release", "set", "status", NULL }; static const char *const flagStrings[] = { "-global", NULL }; enum options { |
︙ | ︙ | |||
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); |
︙ | ︙ | |||
351 352 353 354 355 356 357 | if (dispPtr->eventualGrabWinPtr != winPtr) { statusString = "none"; } else if (dispPtr->grabFlags & GRAB_GLOBAL) { statusString = "global"; } else { statusString = "local"; } | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | if (dispPtr->eventualGrabWinPtr != winPtr) { statusString = "none"; } else if (dispPtr->grabFlags & GRAB_GLOBAL) { statusString = "global"; } else { statusString = "local"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(statusString, TCL_INDEX_NONE)); break; } } return TCL_OK; } |
︙ | ︙ | |||
517 518 519 520 521 522 523 | } QueueGrabWindowChange(dispPtr, winPtr); return TCL_OK; grabError: if (grabResult == GrabNotViewable) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | 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 | } QueueGrabWindowChange(dispPtr, winPtr); return TCL_OK; grabError: if (grabResult == GrabNotViewable) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: window not viewable", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "UNVIEWABLE", NULL); } else if (grabResult == AlreadyGrabbed) { alreadyGrabbed: Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: another application has grab", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "GRABBED", NULL); } else if (grabResult == GrabFrozen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: keyboard or pointer frozen", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "FROZEN", NULL); } else if (grabResult == GrabInvalidTime) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "grab failed: invalid time", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "BAD_TIME", NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "grab failed for unknown reason (code %d)", grabResult)); Tcl_SetErrorCode(interp, "TK", "GRAB", "UNKNOWN", NULL); } return TCL_ERROR; |
︙ | ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | EatGrabEvents( TkDisplay *dispPtr, /* Display from which to consume events. */ unsigned int serial) /* Only discard events that have a serial * number at least this great. */ { Tk_RestrictProc *prevProc; GrabInfo info; | | | 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | EatGrabEvents( TkDisplay *dispPtr, /* Display from which to consume events. */ unsigned int serial) /* Only discard events that have a serial * number at least this great. */ { Tk_RestrictProc *prevProc; GrabInfo info; void *prevArg; info.display = dispPtr->display; info.serial = serial; TkpSync(info.display); prevProc = Tk_RestrictEvents(GrabRestrictProc, &info, &prevArg); while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) { /* EMPTY */ |
︙ | ︙ | |||
1295 1296 1297 1298 1299 1300 1301 | * None. * *---------------------------------------------------------------------- */ static Tk_RestrictAction GrabRestrictProc( | | | 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | * None. * *---------------------------------------------------------------------- */ static Tk_RestrictAction GrabRestrictProc( void *arg, XEvent *eventPtr) { GrabInfo *info = (GrabInfo *)arg; int mode, diff; /* * The diff caculation is trickier than it may seem. Don't forget that |
︙ | ︙ |
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" |
︙ | ︙ | |||
251 252 253 254 255 256 257 | /* * Prototypes for procedures used only in this file: */ static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); | | | | | | | | | | | | | | | | | | | 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 | /* * Prototypes for procedures used only in this file: */ static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int AdjustOffsets(int width, Tcl_Size elements, SlotInfo *slotPtr); static void ArrangeGrid(void *clientData); static int CheckSlotData(Gridder *containerPtr, Tcl_Size slot, int slotType, int checkOnly); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Size objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyGrid; static Gridder * GetGrid(Tk_Window tkwin); static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridForgetRemoveCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridLocationCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridPropagateCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridRowColumnConfigureCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static void GridStructureProc(void *clientData, XEvent *eventPtr); static void GridLostContentProc(void *clientData, Tk_Window tkwin); static void GridReqProc(void *clientData, Tk_Window tkwin); static void InitContainerData(Gridder *containerPtr); static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr, |
︙ | ︙ | |||
326 327 328 329 330 331 332 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_GridObjCmd( | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_GridObjCmd( 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[] = { "anchor", "bbox", "columnconfigure", "configure", |
︙ | ︙ | |||
412 413 414 415 416 417 418 | case GRID_COLUMNCONFIGURE: case GRID_ROWCONFIGURE: return GridRowColumnConfigureCommand(tkwin, interp, objc, objv); } /* This should not happen */ | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | case GRID_COLUMNCONFIGURE: case GRID_ROWCONFIGURE: return GridRowColumnConfigureCommand(tkwin, interp, objc, objv); } /* This should not happen */ Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
438 439 440 441 442 443 444 | *---------------------------------------------------------------------- */ static int GridAnchorCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | *---------------------------------------------------------------------- */ static int GridAnchorCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; GridContainer *gridPtr; Tk_Anchor old; |
︙ | ︙ | |||
507 508 509 510 511 512 513 | *---------------------------------------------------------------------- */ static int GridBboxCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | *---------------------------------------------------------------------- */ static int GridBboxCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; /* container grid record */ GridContainer *gridPtr; /* pointer to grid data */ int row, column; /* origin for bounding box */ int row2, column2; /* end of bounding box */ |
︙ | ︙ | |||
637 638 639 640 641 642 643 | *---------------------------------------------------------------------- */ static int GridForgetRemoveCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | *---------------------------------------------------------------------- */ static int GridForgetRemoveCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window content; Gridder *contentPtr; Tcl_Size i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; for (i = 2; i < objc; i++) { if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
690 691 692 693 694 695 696 | if (contentPtr->in != NULL) { Tcl_DecrRefCount(contentPtr->in); contentPtr->in = NULL; } if (contentPtr->containerPtr != NULL) { contentPtr->in = Tcl_NewStringObj( | | | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | if (contentPtr->in != NULL) { Tcl_DecrRefCount(contentPtr->in); contentPtr->in = NULL; } if (contentPtr->containerPtr != NULL) { contentPtr->in = Tcl_NewStringObj( Tk_PathName(contentPtr->containerPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(contentPtr->in); } } Tk_ManageGeometry(content, NULL, NULL); if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); |
︙ | ︙ | |||
727 728 729 730 731 732 733 | *---------------------------------------------------------------------- */ static int GridInfoCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | | | | 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 | *---------------------------------------------------------------------- */ static int GridInfoCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Gridder *contentPtr; Tk_Window content; Tcl_Obj *infoObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } contentPtr = GetGrid(content); if (contentPtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", TCL_INDEX_NONE), Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->numRows)); TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX); TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", TCL_INDEX_NONE), StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
789 790 791 792 793 794 795 | *---------------------------------------------------------------------- */ static int GridLocationCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | *---------------------------------------------------------------------- */ static int GridLocationCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; /* Container grid record. */ GridContainer *gridPtr; /* Pointer to grid data. */ SlotInfo *slotPtr; int x, y; /* Offset in pixels, from edge of container. */ |
︙ | ︙ | |||
818 819 820 821 822 823 824 | } if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) { return TCL_ERROR; } containerPtr = GetGrid(container); if (containerPtr->containerDataPtr == NULL) { | | | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | } if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) { return TCL_ERROR; } containerPtr = GetGrid(container); if (containerPtr->containerDataPtr == NULL) { Tcl_SetObjResult(interp, NewPairObj(-1, TCL_INDEX_NONE)); return TCL_OK; } gridPtr = containerPtr->containerDataPtr; /* * Update any pending requests. This is not always the steady state value, * as more configure events could be in the pipeline, but its as close as |
︙ | ︙ | |||
882 883 884 885 886 887 888 | *---------------------------------------------------------------------- */ static int GridPropagateCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | *---------------------------------------------------------------------- */ static int GridPropagateCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; int propagate, old; if (objc > 4) { |
︙ | ︙ | |||
970 971 972 973 974 975 976 | *---------------------------------------------------------------------- */ static int GridRowColumnConfigureCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | *---------------------------------------------------------------------- */ static int GridRowColumnConfigureCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { 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 */ Tcl_Size lObjc; /* Number of items in index list */ Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ Tcl_Size i, j, first, last; const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL }; enum options { ROWCOL_MINSIZE, ROWCOL_PAD, ROWCOL_UNIFORM, ROWCOL_WEIGHT }; |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | containerPtr = GetGrid(container); first = 0; last = 0; if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | containerPtr = GetGrid(container); first = 0; last = 0; if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "must specify a single element on retrieval", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "USAGE", NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, lObjv[0], &slot) != TCL_OK) { Tcl_AppendResult(interp, " (when retrieving options only integer indices are " |
︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | minsize = slotPtr[slot].minSize; pad = slotPtr[slot].pad; weight = slotPtr[slot].weight; uniform = slotPtr[slot].uniform; } Tcl_ListObjAppendElement(interp, res, | | | | | | | 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 | minsize = slotPtr[slot].minSize; pad = slotPtr[slot].pad; weight = slotPtr[slot].weight; uniform = slotPtr[slot].uniform; } Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-minsize", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-pad", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-uniform", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj(uniform == NULL ? "" : uniform, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-weight", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight)); Tcl_SetObjResult(interp, res); Tcl_DecrRefCount(listCopy); return TCL_OK; } /* |
︙ | ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | } else if (index == ROWCOL_WEIGHT) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].weight : 0)); } else if (index == ROWCOL_UNIFORM) { Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | } else if (index == ROWCOL_WEIGHT) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].weight : 0)); } else if (index == ROWCOL_UNIFORM) { Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; Tcl_SetObjResult(interp, Tcl_NewStringObj( (value == NULL) ? "" : value, TCL_INDEX_NONE)); } else if (index == ROWCOL_PAD) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].pad : 0)); } Tcl_DecrRefCount(listCopy); return TCL_OK; } |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | *---------------------------------------------------------------------- */ static int GridSizeCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | *---------------------------------------------------------------------- */ static int GridSizeCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; GridContainer *gridPtr; /* pointer to grid data */ if (objc != 3) { |
︙ | ︙ | |||
1354 1355 1356 1357 1358 1359 1360 | *---------------------------------------------------------------------- */ static int GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | *---------------------------------------------------------------------- */ static int GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; Gridder *containerPtr; /* container grid record */ Gridder *contentPtr; int i, value, index; int row = -1, column = -1; |
︙ | ︙ | |||
1436 1437 1438 1439 1440 1441 1442 | * the next idle point. * *---------------------------------------------------------------------- */ static void GridReqProc( | | | 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | * the next idle point. * *---------------------------------------------------------------------- */ static void GridReqProc( void *clientData, /* Grid's information about window that got * new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { Gridder *gridPtr = (Gridder *)clientData; gridPtr = gridPtr->containerPtr; |
︙ | ︙ | |||
1469 1470 1471 1472 1473 1474 1475 | * Forgets all grid-related information about the content. * *---------------------------------------------------------------------- */ static void GridLostContentProc( | | | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | * Forgets all grid-related information about the content. * *---------------------------------------------------------------------- */ static void GridLostContentProc( void *clientData, /* Grid structure for content window that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { Gridder *contentPtr = (Gridder *)clientData; if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); |
︙ | ︙ | |||
1505 1506 1507 1508 1509 1510 1511 | * *---------------------------------------------------------------------- */ static int AdjustOffsets( int size, /* The total layout size (in pixels). */ | | | | 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 | * *---------------------------------------------------------------------- */ static int AdjustOffsets( int size, /* The total layout size (in pixels). */ Tcl_Size slots, /* Number of slots. */ SlotInfo *slotPtr) /* Pointer to slot array. */ { Tcl_Size slot; /* Current slot. */ int diff; /* Extra pixels needed to add to the layout. */ int totalWeight; /* Sum of the weights for all the slots. */ int weight; /* Sum of the weights so far. */ int minSize; /* Minimum possible layout size. */ int newDiff; /* The most pixels that can be added on the * current pass. */ |
︙ | ︙ | |||
1728 1729 1730 1731 1732 1733 1734 | * The content of containerPtr may get resized or moved. * *---------------------------------------------------------------------- */ static void ArrangeGrid( | | | 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | * The content of containerPtr may get resized or moved. * *---------------------------------------------------------------------- */ static void ArrangeGrid( void *clientData) /* Structure describing container whose content * are to be re-layed out. */ { Gridder *containerPtr = (Gridder *)clientData; Gridder *contentPtr; GridContainer *slotPtr = containerPtr->containerDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ |
︙ | ︙ | |||
2590 2591 2592 2593 2594 2595 2596 | int newRow, newNumRows, lastRow; newRow = (row >= 0) ? row : contentPtr->row; newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows; lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { | | | 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 | int newRow, newNumRows, lastRow; newRow = (row >= 0) ? row : contentPtr->row; newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows; lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_ROW", NULL); return TCL_ERROR; } contentPtr->row = newRow; contentPtr->numRows = newNumRows; return TCL_OK; |
︙ | ︙ | |||
2623 2624 2625 2626 2627 2628 2629 | * *---------------------------------------------------------------------- */ static int CheckSlotData( Gridder *containerPtr, /* The geometry container for this grid. */ | | | | 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 | * *---------------------------------------------------------------------- */ static int CheckSlotData( Gridder *containerPtr, /* The geometry container for this grid. */ Tcl_Size slot, /* Which slot to look at. */ int slotType, /* ROW or COLUMN. */ int checkOnly) /* Don't allocate new space if true. */ { Tcl_Size numSlot; /* Number of slots already allocated (Space) */ int end; /* Last used constraint. */ /* * If slot is out of bounds, return immediately. */ if (slot < 0 || slot >= MAX_ELEMENT) { |
︙ | ︙ | |||
2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 | * Everything associated with the grid is freed up. * *---------------------------------------------------------------------- */ 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); } | > > > > > > > | 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 | * Everything associated with the grid is freed up. * *---------------------------------------------------------------------- */ static void DestroyGrid( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about window that is now dead. */ #else char *memPtr) #endif { 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); } |
︙ | ︙ | |||
2859 2860 2861 2862 2863 2864 2865 | * information. If it was just resized, re-configure its content, if any. * *---------------------------------------------------------------------- */ static void GridStructureProc( | | | 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 | * information. If it was just resized, re-configure its content, if any. * *---------------------------------------------------------------------- */ static void GridStructureProc( void *clientData, /* Our information about window referred to by * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { Gridder *gridPtr = (Gridder *)clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { |
︙ | ︙ | |||
2900 2901 2902 2903 2904 2905 2906 | } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; | | | 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 | } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, DestroyGrid); } else if (eventPtr->type == MapNotify) { if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { |
︙ | ︙ | |||
2942 2943 2944 2945 2946 2947 2948 | */ static int ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing * content. Used to look up content names. */ | | | 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 | */ static int ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing * content. Used to look up content names. */ Tcl_Size objc, /* Number of elements in argv. */ Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { Gridder *containerPtr = NULL; Gridder *contentPtr; |
︙ | ︙ | |||
2979 2980 2981 2982 2983 2984 2985 | /* * Count the number of windows, or window short-cuts. */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { | | | | 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 | /* * Count the number of windows, or window short-cuts. */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { Tcl_Size 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). */ |
︙ | ︙ | |||
3040 3041 3042 3043 3044 3045 3046 | Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); return TCL_ERROR; } if ((firstChar == REL_HORIZ) && ((numWindows == 0) || (prevChar == REL_SKIP) || (prevChar == REL_VERT))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 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 | Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); return TCL_ERROR; } if ((firstChar == REL_HORIZ) && ((numWindows == 0) || (prevChar == REL_SKIP) || (prevChar == REL_VERT))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "must specify window before shortcut '-'", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } if ((firstChar == REL_VERT) || (firstChar == REL_SKIP) || (firstChar == REL_HORIZ)) { continue; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid window shortcut, \"%s\" should be '-', 'x', or '^'", string)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } numWindows = i; if ((objc - numWindows) & 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra option or option with no value", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); return TCL_ERROR; } /* * Go through all options looking for -in and -row, which are needed to be * found first to handle the special case where ^ is used on a row without |
︙ | ︙ | |||
3213 3214 3215 3216 3217 3218 3219 | case CONF_IN: if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other) != TCL_OK) { return TCL_ERROR; } if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 | case CONF_IN: if (TkGetWindowFromObj(interp, tkwin, objv[i+1], &other) != TCL_OK) { return TCL_ERROR; } if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "window can't be managed in itself", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } positionGiven = 1; containerPtr = GetGrid(other); InitContainerData(containerPtr); break; |
︙ | ︙ | |||
3458 3459 3460 3461 3462 3463 3464 | } if (firstChar != REL_VERT) { continue; } if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 | } if (firstChar != REL_VERT) { continue; } if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't use '^', can't find container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } /* * Count the number of consecutive ^'s starting from this position. */ |
︙ | ︙ | |||
3512 3513 3514 3515 3516 3517 3518 | numSkip = 0; break; } } } if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 | numSkip = 0; break; } } } if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't find content to extend with \"^\"", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } } if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't determine container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } SetGridSize(containerPtr); /* * If we have emptied this container from content it means we are no longer |
︙ | ︙ |
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 314 315 316 317 318 319 320 321 322 | /* * 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" /* * 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( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_DString ds; Tcl_Size len; const char *str; UErrorCodex errorCode = U_ZERO_ERRORZ; void *it; Tcl_Size 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; Tcl_Size ulen = Tcl_GetCharLength(objv[1]); if (TkGetIntForIndex(objv[2], ulen-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 (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-16 index */ Tcl_Size newIdx = 0; for (Tcl_Size i = 0; i < idx; i++) { newIdx += 1 + (((newIdx < (Tcl_Size)len-1) && (ustr[newIdx]&0xFC00) == 0xD800) && ((ustr[newIdx+1]&0xFC00) == 0xDC00)); } idx = newIdx; } if (flags & FLAG_FOLLOWING) { if ((idx < 0) && (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]&0xFC00) == 0xD800) && ((ustr[idx+1]&0xFC00) == 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) { if (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-32 index */ Tcl_Size newIdx = 1; for (Tcl_Size i = 1; i < idx; i++) { if (((ustr[i-1]&0xFC00) != 0xD800) || ((ustr[i]&0xFC00) != 0xDC00)) newIdx++; } idx = newIdx; } 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] = "_80"; /* 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 60 */ while ((icu_fns.lib == NULL) && (icuversion[1] >= '6')) { 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], TCL_INDEX_NONE); 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", TCL_INDEX_NONE); 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", TCL_INDEX_NONE); 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 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 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Each call to Tk_GetImage returns a pointer to one of the following * structures, which is used as a token by clients (widgets) that display * images. */ typedef struct Image { Tk_Window tkwin; /* Window passed to Tk_GetImage (needed to * "re-get" the image later if the manager * changes). */ Display *display; /* Display for tkwin. Needed because when the * image is eventually freed tkwin may not * exist anymore. */ struct ImageModel *modelPtr; /* Model for this image (identifiers image * manager, for example). */ void *instanceData; /* One word argument to pass to image manager * when dealing with this image instance. */ Tk_ImageChangedProc *changeProc; /* Code in widget to call when image changes * in a way that affects redisplay. */ void *widgetClientData;/* Argument to pass to changeProc. */ struct Image *nextPtr; /* Next in list of all image instances * associated with the same name. */ struct Image *prevPtr; /* Previous in list of all image instances * associated with the same name. */ } Image; /* * For each image model there is one of the following structures, which * represents a name in the image table and all of the images instantiated * from it. Entries in mainPtr->imageTable point to these structures. */ typedef struct ImageModel { Tk_ImageType *typePtr; /* Information about image type. NULL means * that no image manager owns this image: the * image was deleted. */ void *modelData; /* One-word argument to pass to image mgr when * dealing with the model, as opposed to * instances. */ int width, height; /* Last known dimensions for image. */ Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the * imageTable field in some TkMainInfo * structure). */ Tcl_HashEntry *hPtr; /* Hash entry in mainPtr->imageTable for this |
︙ | ︙ | |||
77 78 79 80 81 82 83 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for local functions: */ | | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for local functions: */ static void ImageTypeThreadExitProc(void *clientData); static Tcl_FreeProc DeleteImage; static void EventuallyDeleteImage(ImageModel *modelPtr, int forgetImageHashNow); /* *---------------------------------------------------------------------- * * ImageTypeThreadExitProc -- |
︙ | ︙ | |||
121 122 123 124 125 126 127 | ckfree(freePtr); } } /* *---------------------------------------------------------------------- * | | < < < < < < < < < < < < < < < < < < < < < | 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 | ckfree(freePtr); } } /* *---------------------------------------------------------------------- * * Tk_CreateImageType -- * * This function is invoked by an image manager to tell Tk about a new * kind of image and the functions that manage the new type. The function * is typically invoked during Tcl_AppInit. * * Results: * None. * * Side effects: * The new image type is entered into a table used in the "image create" * command. * *---------------------------------------------------------------------- */ void Tk_CreateImageType( const Tk_ImageType *typePtr) /* Structure describing the type. All of the * fields except "nextPtr" must be filled in * by caller. */ { |
︙ | ︙ | |||
198 199 200 201 202 203 204 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ImageObjCmd( | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ImageObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { static const char *const imageOptions[] = { "create", "delete", "height", "inuse", "names", "type", "types", "width", NULL |
︙ | ︙ | |||
281 282 283 284 285 286 287 | /* * Figure out a name to use for the new image. */ if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) { do { dispPtr->imageId++; | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | /* * Figure out a name to use for the new image. */ if ((objc == 3) || (*(arg = Tcl_GetString(objv[3])) == '-')) { do { dispPtr->imageId++; snprintf(idString, sizeof(idString), "image%d", dispPtr->imageId); name = idString; } while (Tcl_FindCommand(interp, name, NULL, 0) != NULL); firstOption = 3; } else { TkWindow *topWin; name = arg; |
︙ | ︙ | |||
364 365 366 367 368 369 370 | args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); } args[objc] = NULL; } Tcl_Preserve(modelPtr); | > > > > > > > | | > > | | | | | | 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 | args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); } args[objc] = NULL; } Tcl_Preserve(modelPtr); if (oldimage) { typedef int (OldCreateProc)(Tcl_Interp*, char*, Tcl_Size, char**, Tk_ImageType*, Tk_ImageModel, ClientData*); i = ((OldCreateProc*)typePtr->createProc)(interp, (char*)name, objc, (char**)args, typePtr, (Tk_ImageModel)modelPtr, &modelPtr->modelData); } else { i = typePtr->createProc(interp, name, objc, args, typePtr, (Tk_ImageModel)modelPtr, &modelPtr->modelData); } if (i != TCL_OK){ EventuallyDeleteImage(modelPtr, 0); Tcl_Release(modelPtr); if (oldimage) { ckfree(args); } return TCL_ERROR; } Tcl_Release(modelPtr); if (oldimage) { ckfree(args); } modelPtr->typePtr = typePtr; for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin, modelPtr->modelData); } Tcl_SetObjResult(interp, Tcl_NewStringObj( (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE)); break; } case IMAGE_DELETE: for (i = 2; i < objc; i++) { arg = Tcl_GetString(objv[i]); hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, arg); if (hPtr == NULL) { goto alreadyDeleted; } modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); if (modelPtr->deleted) { goto alreadyDeleted; } DeleteImage((char *)modelPtr); } break; case IMAGE_NAMES: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search); resultObj = Tcl_NewObj(); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); if (modelPtr->deleted) { continue; } Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); break; case IMAGE_TYPES: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } resultObj = Tcl_NewObj(); for (typePtr = tsdPtr->imageTypeList; typePtr != NULL; typePtr = typePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( typePtr->name, TCL_INDEX_NONE)); } for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL; typePtr = typePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( typePtr->name, TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); break; case IMAGE_HEIGHT: case IMAGE_INUSE: case IMAGE_TYPE: |
︙ | ︙ | |||
477 478 479 480 481 482 483 | case IMAGE_INUSE: Tcl_SetObjResult(interp, Tcl_NewBooleanObj( modelPtr->typePtr && modelPtr->instancePtr)); break; case IMAGE_TYPE: if (modelPtr->typePtr != NULL) { Tcl_SetObjResult(interp, | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | case IMAGE_INUSE: Tcl_SetObjResult(interp, Tcl_NewBooleanObj( modelPtr->typePtr && modelPtr->instancePtr)); break; case IMAGE_TYPE: if (modelPtr->typePtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(modelPtr->typePtr->name, TCL_INDEX_NONE)); } break; case IMAGE_WIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->width)); break; default: Tcl_Panic("can't happen"); |
︙ | ︙ | |||
601 602 603 604 605 606 607 | * be found. */ Tk_Window tkwin, /* Token for window in which image will be * used. */ const char *name, /* Name of desired image. */ Tk_ImageChangedProc *changeProc, /* Function to invoke when redisplay is needed * because image's pixels or size changed. */ | | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | * be found. */ Tk_Window tkwin, /* Token for window in which image will be * used. */ const char *name, /* Name of desired image. */ Tk_ImageChangedProc *changeProc, /* Function to invoke when redisplay is needed * because image's pixels or size changed. */ void *clientData) /* One-word argument to pass to damageProc. */ { Tcl_HashEntry *hPtr; ImageModel *modelPtr; Image *imagePtr; hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name); if (hPtr == NULL) { |
︙ | ︙ | |||
627 628 629 630 631 632 633 634 635 636 637 638 639 640 | imagePtr->display = Tk_Display(tkwin); imagePtr->modelPtr = modelPtr; imagePtr->instanceData = modelPtr->typePtr->getProc(tkwin, modelPtr->modelData); imagePtr->changeProc = changeProc; imagePtr->widgetClientData = clientData; imagePtr->nextPtr = modelPtr->instancePtr; modelPtr->instancePtr = imagePtr; return (Tk_Image) imagePtr; noSuchImage: if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image \"%s\" doesn't exist", name)); | > > > > | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | imagePtr->display = Tk_Display(tkwin); imagePtr->modelPtr = modelPtr; imagePtr->instanceData = modelPtr->typePtr->getProc(tkwin, modelPtr->modelData); imagePtr->changeProc = changeProc; imagePtr->widgetClientData = clientData; imagePtr->nextPtr = modelPtr->instancePtr; if (imagePtr->nextPtr) { imagePtr->nextPtr->prevPtr = imagePtr; } imagePtr->prevPtr = NULL; modelPtr->instancePtr = imagePtr; return (Tk_Image) imagePtr; noSuchImage: if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image \"%s\" doesn't exist", name)); |
︙ | ︙ | |||
664 665 666 667 668 669 670 | void Tk_FreeImage( Tk_Image image) /* Token for image that is no longer needed by * a widget. */ { Image *imagePtr = (Image *) image; ImageModel *modelPtr = imagePtr->modelPtr; | < | | | > > | > | < | 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 | void Tk_FreeImage( Tk_Image image) /* Token for image that is no longer needed by * a widget. */ { Image *imagePtr = (Image *) image; ImageModel *modelPtr = imagePtr->modelPtr; /* * Clean up the particular instance. */ if (modelPtr->typePtr != NULL) { modelPtr->typePtr->freeProc(imagePtr->instanceData, imagePtr->display); } if (imagePtr->prevPtr) { imagePtr->prevPtr->nextPtr = imagePtr->nextPtr; if (imagePtr->nextPtr) { imagePtr->nextPtr->prevPtr = imagePtr->prevPtr; } } else { modelPtr->instancePtr = imagePtr->nextPtr; if (modelPtr->instancePtr) { modelPtr->instancePtr->prevPtr = NULL; } } ckfree(imagePtr); /* * If there are no more instances left for the model, and if the model * image has been deleted, then delete the model too. */ |
︙ | ︙ | |||
927 928 929 930 931 932 933 | if (winPtr == NULL) { return; } hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name); if (hPtr == NULL) { return; } | | | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | if (winPtr == NULL) { return; } hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name); if (hPtr == NULL) { return; } DeleteImage((char *)Tcl_GetHashValue(hPtr)); } /* *---------------------------------------------------------------------- * * DeleteImage -- * |
︙ | ︙ | |||
950 951 952 953 954 955 956 | * existing instances will not be deleted. * *---------------------------------------------------------------------- */ static void DeleteImage( | > | > > > > | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | * existing instances will not be deleted. * *---------------------------------------------------------------------- */ static void DeleteImage( #if TCL_MAJOR_VERSION > 8 void *blockPtr) /* Pointer to main data structure for image. */ #else char *blockPtr) #endif { Image *imagePtr; Tk_ImageType *typePtr; ImageModel *modelPtr = (ImageModel *)blockPtr; typePtr = modelPtr->typePtr; modelPtr->typePtr = NULL; if (typePtr != NULL) { for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { typePtr->freeProc(imagePtr->instanceData, imagePtr->display); |
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 | * to vanish. */ { if (forgetImageHashNow) { modelPtr->hPtr = NULL; } if (!modelPtr->deleted) { modelPtr->deleted = 1; | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | * to vanish. */ { if (forgetImageHashNow) { modelPtr->hPtr = NULL; } if (!modelPtr->deleted) { modelPtr->deleted = 1; Tcl_EventuallyFree(modelPtr, DeleteImage); } } /* *---------------------------------------------------------------------- * * TkDeleteAllImages -- |
︙ | ︙ | |||
1064 1065 1066 1067 1068 1069 1070 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | * * Side effects: * None. * *---------------------------------------------------------------------- */ void * Tk_GetImageModelData( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ const char *name, /* Name of image. */ const Tk_ImageType **typePtrPtr) /* Points to location to fill in with pointer * to type information for image. */ |
︙ | ︙ |
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 86 87 88 89 90 91 92 93 94 95 | /* * The type record for bitmap images: */ static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); static void *ImgBmapGet(Tk_Window tkwin, void *clientData); static void ImgBmapDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); static void ImgBmapFree(void *clientData, Display *display); static void ImgBmapDelete(void *clientData); static int ImgBmapPostscript(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); Tk_ImageType tkBitmapImageType = { "bitmap", /* name */ ImgBmapCreate, /* createProc */ |
︙ | ︙ | |||
141 142 143 144 145 146 147 | int wordLength; /* Number of non-NULL bytes in word. */ } ParseInfo; /* * Prototypes for procedures used only locally in this file: */ | | | | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | int wordLength; /* Number of non-NULL bytes in word. */ } ParseInfo; /* * Prototypes for procedures used only locally in this file: */ static int ImgBmapCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void ImgBmapCmdDeletedProc(void *clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); static int ImgBmapConfigureModel(BitmapModel *modelPtr, Tcl_Size 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | */ static int ImgBmapCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel)); modelPtr->tkModel = model; modelPtr->interp = interp; modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, modelPtr, ImgBmapCmdDeletedProc); modelPtr->width = modelPtr->height = 0; modelPtr->data = NULL; modelPtr->maskData = NULL; 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; } |
︙ | ︙ | |||
228 229 230 231 232 233 234 | *---------------------------------------------------------------------- */ static int ImgBmapConfigureModel( BitmapModel *modelPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ | | < < < < < < | < < | 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 | *---------------------------------------------------------------------- */ static int ImgBmapConfigureModel( BitmapModel *modelPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ Tcl_Size 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. */ { BitmapInstance *instancePtr; int maskWidth, maskHeight, dummy1, dummy2; if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), configSpecs, objc, objv, modelPtr, flags) != TCL_OK) { return TCL_ERROR; } /* * Parse the bitmap and/or mask to create binary data. Make sure that the * bitmap and mask have the same dimensions. */ if (modelPtr->data != NULL) { |
︙ | ︙ | |||
274 275 276 277 278 279 280 | ckfree(modelPtr->maskData); modelPtr->maskData = NULL; } if ((modelPtr->maskFileString != NULL) || (modelPtr->maskDataString != NULL)) { if (modelPtr->data == NULL) { Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( | | | | 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 | ckfree(modelPtr->maskData); modelPtr->maskData = NULL; } if ((modelPtr->maskFileString != NULL) || (modelPtr->maskDataString != NULL)) { if (modelPtr->data == NULL) { Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "can't have mask without bitmap", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "NO_BITMAP", NULL); return TCL_ERROR; } modelPtr->maskData = TkGetBitmapData(modelPtr->interp, modelPtr->maskDataString, modelPtr->maskFileString, &maskWidth, &maskHeight, &dummy1, &dummy2); if (modelPtr->maskData == NULL) { return TCL_ERROR; } if ((maskWidth != modelPtr->width) || (maskHeight != modelPtr->height)) { ckfree(modelPtr->maskData); modelPtr->maskData = NULL; Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "bitmap and mask have different sizes", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "MASK_SIZE", NULL); return TCL_ERROR; } } /* |
︙ | ︙ | |||
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; } | | | > > | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | 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; |
︙ | ︙ | |||
598 599 600 601 602 603 604 | goto getData; } } } else if ((pi.word[0] == '{') && (pi.word[1] == 0)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "format error in bitmap data; looks like it's an" | | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | goto getData; } } } else if ((pi.word[0] == '{') && (pi.word[1] == 0)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "format error in bitmap data; looks like it's an" " obsolete X10 bitmap file", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "OBSOLETE", NULL); } goto errorCleanup; } } |
︙ | ︙ | |||
643 644 645 646 647 648 649 | *hotXPtr = hotX; *hotYPtr = hotY; return data; error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | *hotXPtr = hotX; *hotYPtr = hotY; return data; error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "format error in bitmap data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "FORMAT", NULL); } errorCleanup: if (data != NULL) { ckfree(data); } |
︙ | ︙ | |||
747 748 749 750 751 752 753 | * See the user documentation. * *-------------------------------------------------------------- */ static int ImgBmapCmd( | | | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | * See the user documentation. * *-------------------------------------------------------------- */ static int ImgBmapCmd( void *clientData, /* Information about the image model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const bmapOptions[] = {"cget", "configure", NULL}; BitmapModel *modelPtr = (BitmapModel *)clientData; int index; |
︙ | ︙ | |||
771 772 773 774 775 776 777 | switch (index) { case 0: /* cget */ if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, | | | | | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | switch (index) { case 0: /* cget */ if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, modelPtr, Tcl_GetString(objv[2]), 0); case 1: /* configure */ if (objc == 2) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, modelPtr, NULL, 0); } else if (objc == 3) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, modelPtr, Tcl_GetString(objv[2]), 0); } else { return ImgBmapConfigureModel(modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } default: Tcl_Panic("bad const entries to bmapOptions in ImgBmapCmd"); |
︙ | ︙ | |||
808 809 810 811 812 813 814 | * Side effects: * A data structure is set up for the instance (or, an existing instance * is re-used for the new one). * *---------------------------------------------------------------------- */ | | | | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | * Side effects: * A data structure is set up for the instance (or, an existing instance * is re-used for the new one). * *---------------------------------------------------------------------- */ static void * ImgBmapGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ void *modelData) /* Pointer to our model structure for the * image. */ { BitmapModel *modelPtr = (BitmapModel *)modelData; BitmapInstance *instancePtr; /* * See if there is already an instance for this window. If so then just |
︙ | ︙ | |||
879 880 881 882 883 884 885 | * A portion of the image gets rendered in a pixmap or window. * *---------------------------------------------------------------------- */ static void ImgBmapDisplay( | | | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | * A portion of the image gets rendered in a pixmap or window. * *---------------------------------------------------------------------- */ static void ImgBmapDisplay( void *clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display, /* Display on which to draw image. */ Drawable drawable, /* Pixmap or window in which to draw image. */ int imageX, int imageY, /* Upper-left corner of region within image to * draw. */ int width, int height, /* Dimensions of region within image to draw. */ int drawableX, int drawableY) |
︙ | ︙ | |||
940 941 942 943 944 945 946 | * Internal data structures get cleaned up. * *---------------------------------------------------------------------- */ static void ImgBmapFree( | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | * Internal data structures get cleaned up. * *---------------------------------------------------------------------- */ static void ImgBmapFree( void *clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { BitmapInstance *instancePtr = (BitmapInstance *)clientData; BitmapInstance *prevPtr; if (instancePtr->refCount-- > 1) { |
︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 | * Resources associated with the image get freed. * *---------------------------------------------------------------------- */ static void ImgBmapDelete( | | | | 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 | * Resources associated with the image get freed. * *---------------------------------------------------------------------- */ static void ImgBmapDelete( void *modelData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { BitmapModel *modelPtr = (BitmapModel *)modelData; if (modelPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } modelPtr->tkModel = NULL; if (modelPtr->imageCmd != NULL) { Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } if (modelPtr->data != NULL) { ckfree(modelPtr->data); } if (modelPtr->maskData != NULL) { ckfree(modelPtr->maskData); } Tk_FreeOptions(configSpecs, modelPtr, NULL, 0); ckfree(modelPtr); } /* *---------------------------------------------------------------------- * * ImgBmapCmdDeletedProc -- |
︙ | ︙ | |||
1043 1044 1045 1046 1047 1048 1049 | * The image is deleted. * *---------------------------------------------------------------------- */ static void ImgBmapCmdDeletedProc( | | | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | * The image is deleted. * *---------------------------------------------------------------------- */ static void ImgBmapCmdDeletedProc( void *clientData) /* Pointer to BitmapModel structure for * image. */ { BitmapModel *modelPtr = (BitmapModel *)clientData; modelPtr->imageCmd = NULL; if (modelPtr->tkModel != NULL) { Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); |
︙ | ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | */ static int GetByte( Tcl_Channel chan) /* The channel we read from. */ { char buffer; | < | < | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | */ static int GetByte( Tcl_Channel chan) /* The channel we read from. */ { char buffer; if (Tcl_Read(chan, &buffer, 1) != 1) { return EOF; } else { return buffer; } } /* |
︙ | ︙ | |||
1160 1161 1162 1163 1164 1165 1166 | nBytePerRow = (width + 7) / 8; for (i=0; i<height; i++) { for (j=0; j<nBytePerRow; j++) { Tcl_AppendPrintfToObj(psObj, " %02x", bit_reverse[0xff & data[i*nBytePerRow + j]]); } | | | | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | nBytePerRow = (width + 7) / 8; for (i=0; i<height; i++) { for (j=0; j<nBytePerRow; j++) { Tcl_AppendPrintfToObj(psObj, " %02x", bit_reverse[0xff & data[i*nBytePerRow + j]]); } Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } Tcl_AppendToObj(psObj, ">} imagemask \n", TCL_INDEX_NONE); } /* *---------------------------------------------------------------------- * * ImgBmapPostscript -- * |
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | * None. * *---------------------------------------------------------------------- */ static int ImgBmapPostscript( | | | 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | * None. * *---------------------------------------------------------------------- */ static int ImgBmapPostscript( void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass) { BitmapModel *modelPtr = (BitmapModel *)clientData; |
︙ | ︙ | |||
1218 1219 1220 1221 1222 1223 1224 | * than about 60k characters. If the bitmap data is that big or bigger, * we bail out. */ if (modelPtr->width*modelPtr->height > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" | | | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | * than about 60k characters. If the bitmap data is that big or bigger, * we bail out. */ if (modelPtr->width*modelPtr->height > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" " pixels", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", NULL); return TCL_ERROR; } /* * Make our working space. */ |
︙ | ︙ | |||
1268 1269 1270 1271 1272 1273 1274 | goto error; } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (modelPtr->maskData == NULL) { Tcl_AppendToObj(psObj, "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto " | | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | goto error; } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (modelPtr->maskData == NULL) { Tcl_AppendToObj(psObj, "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto " "closepath fill\n", TCL_INDEX_NONE); } else { ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, modelPtr->maskData); } } /* |
︙ | ︙ |
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 56 57 | #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 */ int c; /* bits left over from previous character */ int state; /* decoder state (0-4 or GIF_DONE) */ | > > > > > > > > > > > > | | 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 | #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 */ int c; /* bits left over from previous character */ int state; /* decoder state (0-4 or GIF_DONE) */ Tcl_Size length; /* Total amount of bytes in data */ } MFile; /* * Non-ASCII encoding support: * Most data in a GIF image is binary and is treated as such. However, a few * key bits are stashed in ASCII. If we try to compare those pieces to the * char they represent, it will fail on any non-ASCII (eg, EBCDIC) system. To |
︙ | ︙ | |||
107 108 109 110 111 112 113 | } GIFImageConfig; /* * Type of a function used to do the writing to a file or buffer when * serializing in the GIF format. */ | | | | | | > | | > | > | > > | | > | > | > > | | 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 | } GIFImageConfig; /* * Type of a function used to do the writing to a file or buffer when * serializing in the GIF format. */ typedef Tcl_Size (WriteBytesFunc) (void *clientData, const char *bytes, Tcl_Size 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, void *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 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 | #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]); static int ReadGIFHeader(GIFImageConfig *gifConfPtr, Tcl_Channel chan, int *widthPtr, int *heightPtr); static int ReadImage(GIFImageConfig *gifConfPtr, Tcl_Interp *interp, unsigned char *imagePtr, Tcl_Channel chan, int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, int srcY, int interlace, int transparent); /* * these are for the BASE64 image reader code only */ static Tcl_Size Fread(GIFImageConfig *gifConfPtr, unsigned char *dst, Tcl_Size size, Tcl_Size count, Tcl_Channel chan); static Tcl_Size Mread(unsigned char *dst, Tcl_Size size, Tcl_Size count, MFile *handle); static int Mgetc(MFile *handle); static int char64(int c); static void mInit(unsigned char *string, MFile *handle, Tcl_Size length); /* * Types, defines and variables needed to write and compress a GIF. */ #define LSB(a) ((unsigned char) (((short)(a)) & 0x00FF)) #define MSB(a) ((unsigned char) (((short)(a)) >> 8)) |
︙ | ︙ | |||
276 277 278 279 280 281 282 | * codes are re-sized at this point, and a special CLEAR code is generated * for the decompressor. Late addition: construct the table according to * file size for noticeable speed improvement on small files. Please * direct questions about this implementation to ames!jaw. */ int initialBits; | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | * codes are re-sized at this point, and a special CLEAR code is generated * for the decompressor. Late addition: construct the table according to * file size for noticeable speed improvement on small files. Please * direct questions about this implementation to ames!jaw. */ int initialBits; void *destination; WriteBytesFunc *writeProc; int clearCode; int eofCode; unsigned long currentAccumulated; int currentBits; |
︙ | ︙ | |||
304 305 306 307 308 309 310 | /* * Definition of new functions to write GIFs */ static int ColorNumber(GifWriterState *statePtr, int red, int green, int blue); | | | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | /* * Definition of new functions to write GIFs */ static int ColorNumber(GifWriterState *statePtr, int red, int green, int blue); static void Compress(int initBits, void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr); static int IsNewColor(GifWriterState *statePtr, int red, int green, int blue); static void SaveMap(GifWriterState *statePtr, Tk_PhotoImageBlock *blockPtr); static int ReadValue(GifWriterState *statePtr); |
︙ | ︙ | |||
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 447 | 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, result = TCL_ERROR; Tcl_Size argc = 0, i; 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)); |
︙ | ︙ | |||
472 473 474 475 476 477 478 | return TCL_OK; } bitPixel = 2 << (buf[0] & 0x07); if (BitSet(buf[0], LOCALCOLORMAP)) { /* Global Colormap */ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | return TCL_OK; } bitPixel = 2 << (buf[0] & 0x07); if (BitSet(buf[0], LOCALCOLORMAP)) { /* Global Colormap */ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); return TCL_ERROR; } } if ((srcX + width) > fileWidth) { width = fileWidth - srcX; |
︙ | ︙ | |||
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) { | > > > > > > < < < < | < < < < | | | < < < < < | | > > | | 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 | */ 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", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", NULL); goto error; } continue; case GIF_START: if (Fread(gifConfPtr, buf, 1, 9, chan) != 9) { |
︙ | ︙ | |||
580 581 582 583 584 585 586 | /* * This is not the GIF frame we want to read: skip it. */ if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | /* * This is not the GIF frame we want to read: skip it. */ if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); goto error; } } /* |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | * 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 * this frame. */ if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | > > > > > > > | | 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 | * 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 * this frame. */ if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); goto error; } } /* * Extract the location within the overall visible image to put the data |
︙ | ︙ | |||
670 671 672 673 674 675 676 | } if (height > imageHeight) { height = imageHeight; } if ((width > 0) && (height > 0)) { Tk_PhotoImageBlock block; | > > > | | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | } 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 | 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. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > < > | < < | | 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 | 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", TCL_INDEX_NONE)); 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, TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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]; Tcl_Size 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 */ | > | > | | | 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 | */ 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; Tcl_Size 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, | | > | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | /* * 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 -- * |
︙ | ︙ | |||
918 919 920 921 922 923 924 | int number, unsigned char buffer[MAXCOLORMAPSIZE][4]) { int i; unsigned char rgb[3]; for (i = 0; i < number; ++i) { | | > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > > | | > | < < < < < < < | > > > > > > > > > > | > > | > > > > > | > > > > > | | > | > > > > > > > | | > > > > > > > > > > > > > > > > > > > | | | | | 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 | int number, unsigned char buffer[MAXCOLORMAPSIZE][4]) { int i; unsigned char rgb[3]; for (i = 0; i < number; ++i) { if (Fread(gifConfPtr, rgb, sizeof(rgb), 1, chan) <= 0) { return 0; } if (buffer) { buffer[i][CM_RED] = rgb[0]; buffer[i][CM_GREEN] = rgb[1]; 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) { unsigned char count; if (Fread(gifConfPtr, &count, 1, 1, chan) <= 0) { return -1; } if ((count != 0) && (Fread(gifConfPtr, buf, count, 1, chan) <= 0)) { return -1; } return count; } /* *---------------------------------------------------------------------- * * ReadImage -- * * Process a GIF image from a given source, with a given height, width, * transparency, etc. * * This code is based on the code found in the ImageMagick GIF decoder, * which is © 2000 ImageMagick Studio. * * Some thoughts on our implementation: * It sure would be nice if ReadImage didn't take 11 parameters! I think * that if we were smarter, we could avoid doing that. * * Possible further optimizations: we could pull the GetCode function * directly into ReadImage, which would improve our speed. |
︙ | ︙ | |||
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], | | > < < | | | 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 | 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 (Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) <= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading GIF image: %s", Tcl_PosixError(interp))); return TCL_ERROR; } if (initialCodeSize > MAX_LWZ_BITS) { Tcl_SetObjResult(interp, Tcl_NewStringObj("malformed image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "MALFORMED", NULL); return TCL_ERROR; } if (transparent != -1) { cmap[transparent][CM_RED] = 0; cmap[transparent][CM_GREEN] = 0; |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | *---------------------------------------------------------------------- */ static void mInit( unsigned char *string, /* string containing initial mmencoded data */ MFile *handle, /* mmdecode "file" handle */ | | | 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 | *---------------------------------------------------------------------- */ static void mInit( unsigned char *string, /* string containing initial mmencoded data */ MFile *handle, /* mmdecode "file" handle */ Tcl_Size length) /* Number of bytes in string */ { handle->data = string; handle->state = 0; handle->c = 0; handle->length = length; } |
︙ | ︙ | |||
1421 1422 1423 1424 1425 1426 1427 | * * Side effects: * The base64 handle will change state. * *---------------------------------------------------------------------- */ | | | | | | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 | * * Side effects: * The base64 handle will change state. * *---------------------------------------------------------------------- */ static Tcl_Size Mread( unsigned char *dst, /* where to put the result */ Tcl_Size chunkSize, /* size of each transfer */ Tcl_Size numChunks, /* number of chunks */ MFile *handle) /* mmdecode "file" handle */ { int c; Tcl_Size i, count = chunkSize * numChunks; for (i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) { *dst++ = c; } return i; } |
︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | * a base64 encoded string. * * Results: - same as POSIX fread() or Tcl Tcl_Read() * *---------------------------------------------------------------------- */ | | | > > > > | | | 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 | * a base64 encoded string. * * Results: - same as POSIX fread() or Tcl Tcl_Read() * *---------------------------------------------------------------------- */ static Tcl_Size Fread( GIFImageConfig *gifConfPtr, unsigned char *dst, /* where to put the result */ Tcl_Size hunk, Tcl_Size count, /* how many */ Tcl_Channel chan) { if (hunk < 0 || count < 0) { return -1; } if (gifConfPtr->fromData == INLINE_DATA_BASE64) { return Mread(dst, hunk, count, (MFile *) chan); } if (gifConfPtr->fromData == INLINE_DATA_BINARY) { MFile *handle = (MFile *) chan; if ((handle->length <= 0) || (handle->length < hunk*count)) { return -1; } memcpy(dst, handle->data, hunk * count); handle->data += hunk * count; handle->length -= hunk * count; return hunk * count; } |
︙ | ︙ | |||
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; } | > | > > | | | | | | | | > | < | 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 | 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; } static Tcl_Size WriteToChannel( void *clientData, const char *bytes, Tcl_Size byteCount) { Tcl_Channel handle = (Tcl_Channel)clientData; return Tcl_Write(handle, bytes, byteCount); } static Tcl_Size WriteToByteArray( void *clientData, const char *bytes, Tcl_Size byteCount) { Tcl_Obj *objPtr = (Tcl_Obj *)clientData; Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount); Tcl_IncrRefCount(tmpObj); Tcl_AppendObjToObj(objPtr, tmpObj); Tcl_DecrRefCount(tmpObj); return byteCount; } static int CommonWriteGIF( Tcl_Interp *interp, void *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; |
︙ | ︙ | |||
1749 1750 1751 1752 1753 1754 1755 | width = blockPtr->width; height = blockPtr->height; state.pixelOffset = blockPtr->pixelPtr + blockPtr->offset[0]; state.pixelPitch = blockPtr->pitch; SaveMap(&state, blockPtr); if (state.num >= MAXCOLORMAPSIZE) { | | | 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 | width = blockPtr->width; height = blockPtr->height; state.pixelOffset = blockPtr->pixelPtr + blockPtr->offset[0]; state.pixelPitch = blockPtr->pitch; SaveMap(&state, blockPtr); if (state.num >= MAXCOLORMAPSIZE) { Tcl_SetObjResult(interp, Tcl_NewStringObj("too many colors", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLORFUL", NULL); return TCL_ERROR; } if (state.num<2) { state.num = 2; } c = LSB(width); |
︙ | ︙ | |||
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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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) { Tcl_Size 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 |
︙ | ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) */ static void Compress( int initialBits, | | | 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 | * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) */ static void Compress( int initialBits, void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr) { long fcode, ent, disp, hSize, i = 0; int c, hshift; GIFState_t state; |
︙ | ︙ |
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 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 | * 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, * Australian National University. * * Simon Bachmann ([email protected]) */ #include "tkImgPhoto.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Message to generate when an attempt to allocate memory for an image fails. */ #define TK_PHOTO_ALLOC_FAILURE_MESSAGE \ "not enough free memory for image buffer" /* * 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, |
︙ | ︙ | |||
113 114 115 116 117 118 119 | }; /* * Forward declarations */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, | | | < | 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 | }; /* * Forward declarations */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size *indexPtr, struct FormatOptions *optPtr); static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts); static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadDef(Tcl_Interp *interp, Tcl_Obj *data, Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static int StringWriteDef(Tcl_Interp *interp, Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr); static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsList(const char *colorString, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString, int colorStrLen, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsStandard(Tcl_Interp *interp, |
︙ | ︙ | |||
183 184 185 186 187 188 189 | *---------------------------------------------------------------------- */ static int ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are * to be considered allowed */ | | | | | | 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 | *---------------------------------------------------------------------- */ static int ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are * to be considered allowed */ Tcl_Size objc, /* Number of elements in argv[] */ Tcl_Obj *const objv[], /* The arguments to parse */ Tcl_Size *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 */ { Tcl_Size optIndex, index; int 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, "", | | | | 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 | 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 |
︙ | ︙ | |||
304 305 306 307 308 309 310 | const char *badValue, /* the erroneous option */ int allowedOpts) /* bitfield specifying the allowed options */ { int i, bit; Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { | | | | | | | 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 | const char *badValue, /* the erroneous option */ int allowedOpts) /* bitfield specifying the allowed options */ { int i, bit; Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); } else { Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); bit = 1; for (i = 0; formatOptionNames[i] != NULL; i++) { if (allowedOpts & bit) { if (allowedOpts & (bit -1)) { /* * not the first option */ if (allowedOpts & ~((bit << 1) - 1)) { /* * not the last option */ Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); } else { Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); } } Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); } bit <<=1; } } return resObj; } |
︙ | ︙ | |||
355 356 357 358 359 360 361 | * Side effects: * None *---------------------------------------------------------------------- */ static int StringMatchDef( Tcl_Obj *data, /* The data to check */ | | | < | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | * Side effects: * None *---------------------------------------------------------------------- */ static int StringMatchDef( Tcl_Obj *data, /* The data to check */ TCL_UNUSED(Tcl_Obj *), /* Value of the -format option, not used here */ int *widthPtr, /* Width of image is written to this location */ int *heightPtr, /* Height of image is written to this location */ Tcl_Interp *interp) /* Error messages are left in this interpreter */ { Tcl_Size y, rowCount, colCount, curColCount; unsigned char dummy; Tcl_Obj **rowListPtr, *pixelData; /* * See if data can be parsed as a list, if every element is itself a valid * list and all sublists have the same length. */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) |
︙ | ︙ | |||
392 393 394 395 396 397 398 | if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { return 0; } if (colCount < 0) { colCount = curColCount; } else if (curColCount != colCount) { if (interp != NULL) { | | > | | 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 | if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { return 0; } if (colCount < 0) { colCount = curColCount; } else if (curColCount != colCount) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %" TCL_SIZE_MODIFIER "d: " "all rows must have the same number of elements", y)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_DATA", NULL); } return 0; } } /* * 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; } |
︙ | ︙ | |||
464 465 466 467 468 469 470 | * in destination image*/ int width, int height, /* dimensions of area to write to */ int srcX, int srcY) /* start reading source data at these * coordinates */ { Tcl_Obj **rowListPtr, **colListPtr; Tcl_Obj **objv; | | | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | * in destination image*/ int width, int height, /* dimensions of area to write to */ int srcX, int srcY) /* start reading source data at these * coordinates */ { Tcl_Obj **rowListPtr, **colListPtr; Tcl_Obj **objv; Tcl_Size objc, rowCount, colCount, curColCount; unsigned char *curPixelPtr; int x, y; Tk_PhotoImageBlock srcBlock; Display *display; Colormap colormap; struct FormatOptions opts; Tcl_Size optIndex; /* * Parse format suboptions * We don't use any format suboptions, but we still need to provide useful * error messages if suboptions were specified. */ |
︙ | ︙ | |||
621 622 623 624 625 626 627 | StringWriteDef( Tcl_Interp *interp, /* For the result and errors */ Tcl_Obj *formatString, /* The value of the -format option */ Tk_PhotoImageBlock *blockPtr) /* The image data to convert */ { int greenOffset, blueOffset, alphaOffset, hasAlpha; Tcl_Obj *result, **objv = NULL; | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | StringWriteDef( Tcl_Interp *interp, /* For the result and errors */ Tcl_Obj *formatString, /* The value of the -format option */ Tk_PhotoImageBlock *blockPtr) /* The image data to convert */ { int greenOffset, blueOffset, alphaOffset, hasAlpha; Tcl_Obj *result, **objv = NULL; Tcl_Size objc, allowedOpts, optIndex; struct FormatOptions opts; /* * Parse format suboptions */ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) != TCL_OK) { |
︙ | ︙ | |||
688 689 690 691 692 693 694 | * While this is not a problem if the data is used as * a list, it would cause problems if someone decides to parse * it as a string (and it looks kinda strange) */ switch (opts.colorFormat) { case COLORFORMAT_RGB2: | | | | | | | | | | | 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 | * While this is not a problem if the data is used as * a list, it would cause problems if someone decides to parse * it as a string (and it looks kinda strange) */ switch (opts.colorFormat) { case COLORFORMAT_RGB2: snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset]); Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); break; case COLORFORMAT_RGBA2: snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset], alphaVal); Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); break; case COLORFORMAT_LIST: Tcl_DStringStartSublist(&line); snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[0]); Tcl_DStringAppendElement(&line, colorBuf); snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[greenOffset]); Tcl_DStringAppendElement(&line, colorBuf); snprintf(colorBuf, sizeof(colorBuf), "%d", pixelPtr[blueOffset]); Tcl_DStringAppendElement(&line, colorBuf); snprintf(colorBuf, sizeof(colorBuf), "%d", alphaVal); Tcl_DStringAppendElement(&line, colorBuf); Tcl_DStringEndSublist(&line); break; default: Tcl_Panic("unexpected switch fallthrough"); } pixelPtr += blockPtr->pixelSize; } if (opts.colorFormat != COLORFORMAT_LIST) { /* * For the #XXX formats, we need to remove the last * whitespace. */ *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) = '\0'; } Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); Tcl_DStringFree(&line); } result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); Tcl_DStringFree(&data); } else { result = Tcl_NewObj(); } Tcl_SetObjResult(interp, result); return TCL_OK; |
︙ | ︙ | |||
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; | | | | | | | | < < < < | < < < < | | 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 | 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; Tcl_Size 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(specString, 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); } /* *---------------------------------------------------------------------- * * ParseColorAsList -- * * This function extracts color and alpha values from a list of 3 or 4 * integers (the list color format). * * Results: * On success, writes red, green, blue and alpha values to the * corresponding pointers. If the color spec contains no alpha * information, 255 is taken as transparency value. * Returns a standard Tcl result. * * Side effects: * None * *---------------------------------------------------------------------- */ static int ParseColorAsList( const char *colorString, /* the color data to parse */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { /* * This is kinda ugly. The code would be certainly nicer if it * used Tcl_ListObjGetElements() and Tcl_GetIntFromObj(). But with * strtol() it's *much* faster. */ const char *curPos; int values[4]; int i; curPos = colorString; i = 0; /* * strtol can give false positives with a sequence of space chars. * To avoid that, advance the pointer to the next non-blank char. */ while(isspace(UCHAR(*curPos))) { ++curPos; } while (i < 4 && *curPos != '\0') { values[i] = strtol(curPos, (char **)&curPos, 0); |
︙ | ︙ | |||
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; | | < | | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | 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]; double fracAlpha; unsigned int suffixAlpha = 0; int i; /* * Split color data string in color and suffix parts */ if ((suffixString = strrchr(specString, '@')) == NULL |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | */ switch (suffixString[0]) { case '\0': suffixAlpha = 255; break; case '@': | | < | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | */ switch (suffixString[0]) { case '\0': suffixAlpha = 255; break; case '@': if (Tcl_GetDouble(NULL, suffixString + 1, &fracAlpha) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " "suffix \"%s\": expected floating-point value", suffixString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID COLOR", NULL); return TCL_ERROR; } |
︙ | ︙ |
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 |
︙ | ︙ | |||
122 123 124 125 126 127 128 | /* * PNG data source/destination channel/object/byte array. */ Tcl_Channel channel; /* Channel for from-file reads. */ Tcl_Obj *objDataPtr; unsigned char *strDataBuf; /* Raw source data for from-string reads. */ | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /* * PNG data source/destination channel/object/byte array. */ Tcl_Channel channel; /* Channel for from-file reads. */ Tcl_Obj *objDataPtr; unsigned char *strDataBuf; /* Raw source data for from-string reads. */ Tcl_Size strDataLen; /* Length of source data. */ unsigned char *base64Data; /* base64 encoded string data. */ unsigned char base64Bits; /* Remaining bits from last base64 read. */ unsigned char base64State; /* Current state of base64 decoder. */ double alpha; /* Alpha from -format option. */ /* * Image header information. |
︙ | ︙ | |||
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 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 | 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, Tcl_Size destSz, unsigned long *crcPtr); static int ReadByteArray(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, Tcl_Size destSz, unsigned long *crcPtr); static int ReadData(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, Tcl_Size destSz, unsigned long *crcPtr); static int ReadChunkHeader(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Size *sizePtr, unsigned long *typePtr, unsigned long *crcPtr); static int ReadIDAT(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int ReadIHDR(Tcl_Interp *interp, PNGImage *pngPtr); static inline int ReadInt32(Tcl_Interp *interp, PNGImage *pngPtr, 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, Tcl_Size dataSize); static int WriteData(Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, Tcl_Size 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 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 | * 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)); /* * Initialize Zlib inflate/deflate stream. */ if (Tcl_ZlibStreamInit(NULL, dir, TCL_ZLIB_FORMAT_ZLIB, TCL_ZLIB_COMPRESS_DEFAULT, NULL, &pngPtr->stream) != TCL_OK) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "zlib initialization failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "ZLIB_INIT", NULL); } if (objPtr) { Tcl_DecrRefCount(objPtr); } return TCL_ERROR; } /* * Initialize physical size pHYS values */ pngPtr->DPI = -1; pngPtr->aspect = -1; return TCL_OK; } /* *---------------------------------------------------------------------- * * CleanupPNGImage -- |
︙ | ︙ | |||
426 427 428 429 430 431 432 | */ static int ReadBase64( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | */ static int ReadBase64( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, Tcl_Size destSz, unsigned long *crcPtr) { static const unsigned char from64[] = { 0x82, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x80, 0x83, 0x80, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x3e, |
︙ | ︙ | |||
453 454 455 456 457 458 459 | 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, | | | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83 }; /* * Definitions for the base-64 decoder. */ #define PNG64_SPECIAL 0x80 /* Flag bit */ |
︙ | ︙ | |||
516 517 518 519 520 521 522 | if (c64 & PNG64_SPECIAL) { break; } } if (destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | if (c64 & PNG64_SPECIAL) { break; } } if (destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unexpected end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL); return TCL_ERROR; } return TCL_OK; } |
︙ | ︙ | |||
551 552 553 554 555 556 557 | */ static int ReadByteArray( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | | | | 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 | */ static int ReadByteArray( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, Tcl_Size destSz, unsigned long *crcPtr) { /* * Check to make sure the number of requested bytes are available. */ if (pngPtr->strDataLen < destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unexpected end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL); return TCL_ERROR; } while (destSz) { Tcl_Size blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ); memcpy(destPtr, pngPtr->strDataBuf, blockSz); pngPtr->strDataBuf += blockSz; pngPtr->strDataLen -= blockSz; if (crcPtr) { |
︙ | ︙ | |||
609 610 611 612 613 614 615 | */ static int ReadData( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | | 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 | */ static int ReadData( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, Tcl_Size destSz, unsigned long *crcPtr) { if (pngPtr->base64Data) { return ReadBase64(interp, pngPtr, destPtr, destSz, crcPtr); } else if (pngPtr->strDataBuf) { return ReadByteArray(interp, pngPtr, destPtr, destSz, crcPtr); } while (destSz) { Tcl_Size blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ); blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz); if (blockSz == TCL_IO_FAILURE) { /* TODO: failure info... */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "channel read failed: %s", Tcl_PosixError(interp))); return TCL_ERROR; |
︙ | ︙ | |||
648 649 650 651 652 653 654 | /* * Check for EOF before all desired data was read. */ if (destSz && Tcl_Eof(pngPtr->channel)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | /* * Check for EOF before all desired data was read. */ if (destSz && Tcl_Eof(pngPtr->channel)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unexpected end of file", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EOF", NULL); return TCL_ERROR; } } return TCL_OK; } |
︙ | ︙ | |||
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; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
734 735 736 737 738 739 740 | } /* * Compare the read CRC to what we calculate to make sure they match. */ if (calculated != chunked) { | | | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | } /* * Compare the read CRC to what we calculate to make sure they match. */ if (calculated != chunked) { Tcl_SetObjResult(interp, Tcl_NewStringObj("CRC check failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "CRC", NULL); return TCL_ERROR; } return TCL_OK; } |
︙ | ︙ | |||
854 855 856 857 858 859 860 | *---------------------------------------------------------------------- */ static int ReadChunkHeader( Tcl_Interp *interp, PNGImage *pngPtr, | | | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | *---------------------------------------------------------------------- */ static int ReadChunkHeader( Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Size *sizePtr, unsigned long *typePtr, unsigned long *crcPtr) { unsigned long chunkType = 0; int chunkSz = 0; unsigned long crc = 0; |
︙ | ︙ | |||
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", |
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | * Check to see if the chunk type has legal bytes. */ for (i=0 ; i<4 ; i++) { if ((pc[i] < 65) || (pc[i] > 122) || ((pc[i] > 90) && (pc[i] < 97))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | * Check to see if the chunk type has legal bytes. */ for (i=0 ; i<4 ; i++) { if ((pc[i] < 65) || (pc[i] > 122) || ((pc[i] > 90) && (pc[i] < 97))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid chunk type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "INVALID_CHUNK", NULL); return TCL_ERROR; } } /* |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | break; case PNG_COLOR_RGBA: pngPtr->numChannels = 4; if ((8 != pngPtr->bitDepth) && (16 != pngPtr->bitDepth)) { unsupportedDepth: Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | break; case PNG_COLOR_RGBA: pngPtr->numChannels = 4; if ((8 != pngPtr->bitDepth) && (16 != pngPtr->bitDepth)) { unsupportedDepth: Tcl_SetObjResult(interp, Tcl_NewStringObj( "bit depth is not allowed for given color type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_DEPTH", NULL); return TCL_ERROR; } break; default: Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
1235 1236 1237 1238 1239 1240 1241 | static int ReadIHDR( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char sigBuf[PNG_SIG_SZ]; unsigned long chunkType; | | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | static int ReadIHDR( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char sigBuf[PNG_SIG_SZ]; unsigned long chunkType; Tcl_Size chunkSz; unsigned long crc; unsigned long width, height; int mismatch; /* * Read the appropriate number of bytes for the PNG signature. */ |
︙ | ︙ | |||
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 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 | 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; } mismatch = memcmp(sigBuf, pngSignature, PNG_SIG_SZ); } if (mismatch) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "data stream does not have a PNG signature", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NO_SIG", NULL); return TCL_ERROR; } if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } /* * Read in the IHDR (header) chunk for width, height, etc. * * The first chunk in the file must be the IHDR (headr) chunk. */ if (chunkType != CHUNK_IHDR) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "expected IHDR chunk type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NO_IHDR", NULL); return TCL_ERROR; } if (chunkSz != 13) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid IHDR chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IHDR", NULL); return TCL_ERROR; } /* * Read and verify the image width and height to be sure Tk can handle its * dimensions. The PNG specification does not permit zero-width or |
︙ | ︙ | |||
1441 1442 1443 1444 1445 1446 1447 | * This chunk is mandatory for color type 3 and forbidden for 2 and 6. */ switch (pngPtr->colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAYALPHA: Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 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 | * This chunk is mandatory for color type 3 and forbidden for 2 and 6. */ switch (pngPtr->colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAYALPHA: Tcl_SetObjResult(interp, Tcl_NewStringObj( "PLTE chunk type forbidden for grayscale", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "PLTE_UNEXPECTED", NULL); return TCL_ERROR; default: break; } /* * The palette chunk contains from 1 to 256 palette entries. Each entry * consists of a 3-byte RGB value. It must therefore contain a non-zero * multiple of 3 bytes, up to 768. */ if (!chunkSz || (chunkSz > PNG_PLTE_MAXSZ) || (chunkSz % 3)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid palette chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PLTE", NULL); return TCL_ERROR; } /* * Read the palette contents and stash them for later, possibly. */ |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | /* * For indexed color, there is up to one single-byte transparency value * per palette entry (thus a max of 256). */ if (chunkSz > PNG_TRNS_MAXSZ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | /* * For indexed color, there is up to one single-byte transparency value * per palette entry (thus a max of 256). */ if (chunkSz > PNG_TRNS_MAXSZ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid tRNS chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_TRNS", NULL); return TCL_ERROR; } /* * Read in the raw transparency information. */ |
︙ | ︙ | |||
1566 1567 1568 1569 1570 1571 1572 | * The number of tRNS entries must be less than or equal to the number * of PLTE entries, and consists of a single-byte alpha level for the * corresponding PLTE entry. */ if (chunkSz > pngPtr->paletteLen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | * The number of tRNS entries must be less than or equal to the number * of PLTE entries, and consists of a single-byte alpha level for the * corresponding PLTE entry. */ if (chunkSz > pngPtr->paletteLen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "size of tRNS chunk is too large for the palette", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TRNS_SIZE", NULL); return TCL_ERROR; } for (i=0 ; i<chunkSz ; i++) { pngPtr->palette[i].alpha = buffer[i]; } |
︙ | ︙ | |||
1611 1612 1613 1614 1615 1616 1617 | case PNG_COLOR_RGB: /* * TrueColor uses a single RRGGBB triplet. */ if (chunkSz != 6) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | case PNG_COLOR_RGB: /* * TrueColor uses a single RRGGBB triplet. */ if (chunkSz != 6) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid tRNS chunk size - must 6 bytes for RGB", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_TRNS", NULL); return TCL_ERROR; } /* * According to the PNG specs, if the bit depth is less than 16, then * only the lower byte is used. But the tRNS chunk still contains two |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | pngPtr->useTRNS = 1; break; } 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | pngPtr->useTRNS = 1; break; } 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", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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 |
︙ | ︙ | |||
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, (Tcl_Size *)NULL); unsigned char *lastLine = Tcl_GetByteArrayFromObj(pngPtr->lastLineObj, (Tcl_Size *)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, (Tcl_Size *)NULL); p++; if (UnfilterLine(interp, pngPtr) == TCL_ERROR) { return TCL_ERROR; } if (pngPtr->currentLine >= pngPtr->block.height) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
2093 2094 2095 2096 2097 2098 2099 | unsigned long crc) { /* * Process IDAT contents until there is no more in this chunk. */ while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) { | | | | 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 | unsigned long crc) { /* * Process IDAT contents until there is no more in this chunk. */ while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_Size len1, len2; /* * Read another block of input into the zlib stream if data remains. */ if (chunkSz) { Tcl_Obj *inputObj = NULL; int blockSz = PNG_MIN(chunkSz, PNG_BLOCK_SZ); unsigned char *inputPtr = NULL; /* * Check for end of zlib stream. */ if (Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra data after end of zlib stream", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; } inputObj = Tcl_NewObj(); Tcl_IncrRefCount(inputObj); |
︙ | ︙ | |||
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 2264 2265 | /* * 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 == (Tcl_Size)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", NULL); return TCL_ERROR; |
︙ | ︙ | |||
2202 2203 2204 2205 2206 2207 2208 | * Ensure that if we've got to the end of the compressed data, we've * also got to the end of the compressed stream. This sanity check is * enforced by most PNG readers. */ if (chunkSz != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | * Ensure that if we've got to the end of the compressed data, we've * also got to the end of the compressed stream. This sanity check is * enforced by most PNG readers. */ if (chunkSz != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "compressed data after stream finalize in PNG data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; } return CheckCRC(interp, pngPtr, crc); } |
︙ | ︙ | |||
2287 2288 2289 2290 2291 2292 2293 | static int ParseFormat( Tcl_Interp *interp, Tcl_Obj *fmtObj, PNGImage *pngPtr) { Tcl_Obj **objv = NULL; | | | 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 | static int ParseFormat( Tcl_Interp *interp, Tcl_Obj *fmtObj, PNGImage *pngPtr) { Tcl_Obj **objv = NULL; Tcl_Size objc = 0; static const char *const fmtOptions[] = { "-alpha", NULL }; enum fmtOptionsEnum { OPT_ALPHA }; |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | if (Tcl_GetDoubleFromObj(interp, objv[0], &pngPtr->alpha) == TCL_ERROR) { return TCL_ERROR; } if ((pngPtr->alpha < 0.0) || (pngPtr->alpha > 1.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | if (Tcl_GetDoubleFromObj(interp, objv[0], &pngPtr->alpha) == TCL_ERROR) { return TCL_ERROR; } if ((pngPtr->alpha < 0.0) || (pngPtr->alpha > 1.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-alpha value must be between 0.0 and 1.0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_ALPHA", NULL); return TCL_ERROR; } break; } } |
︙ | ︙ | |||
2378 2379 2380 2381 2382 2383 2384 | PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY) { unsigned long chunkType; | | | 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 | PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY) { unsigned long chunkType; Tcl_Size chunkSz; unsigned long crc; /* * Parse the PNG signature and IHDR (header) chunk. */ if (ReadIHDR(interp, pngPtr) == TCL_ERROR) { |
︙ | ︙ | |||
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 | * 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) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } } else if (PNG_COLOR_PLTE == pngPtr->colorType) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | > > > > > > > > > > > > > > > > > > > > > > > | | 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 | * 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) { return TCL_ERROR; } /* * Begin the next chunk. */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } } else if (PNG_COLOR_PLTE == pngPtr->colorType) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "PLTE chunk required for indexed color", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NEED_PLTE", NULL); return TCL_ERROR; } /* * The next chunk may be a tRNS (palette transparency) chunk, depending on * the color type. It must come after the PLTE chunk and before the IDAT |
︙ | ︙ | |||
2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | */ if (ReadChunkHeader(interp, pngPtr, &chunkSz, &chunkType, &crc) == TCL_ERROR) { return TCL_ERROR; } } /* * Other ancillary chunk types could appear here, but for now we're only * interested in IDAT. The others should have been skipped. */ if (chunkType != CHUNK_IDAT) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | > > > > > > > > > > > > > > > > > > > > > > > | | 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 | */ 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; } } /* * Other ancillary chunk types could appear here, but for now we're only * interested in IDAT. The others should have been skipped. */ if (chunkType != CHUNK_IDAT) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "at least one IDAT chunk is required", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NEED_IDAT", NULL); return TCL_ERROR; } /* * Expand the photo size (if not set by the user) to provide enough space * for the image being parsed. It does not matter if width or height wrap |
︙ | ︙ | |||
2519 2520 2521 2522 2523 2524 2525 | Tcl_IncrRefCount(pngPtr->lastLineObj); pngPtr->thisLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->thisLineObj); pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 | Tcl_IncrRefCount(pngPtr->lastLineObj); pngPtr->thisLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->thisLineObj); pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } /* * Determine size of the first phase if interlaced. Phase size should * always be <= line size, so probably not necessary to check for |
︙ | ︙ | |||
2571 2572 2573 2574 2575 2576 2577 | * Ensure that we've got to the end of the compressed stream now that * there are no more IDAT segments. This sanity check is enforced by most * PNG readers. */ if (!Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 | * Ensure that we've got to the end of the compressed stream now that * there are no more IDAT segments. This sanity check is enforced by most * PNG readers. */ if (!Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unfinalized data stream in PNG data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; } /* * Now skip the remaining chunks which we're also not interested in. */ |
︙ | ︙ | |||
2597 2598 2599 2600 2601 2602 2603 | /* * Got the IEND (end of image) chunk. Do some final checks... */ if (chunkSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 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 | /* * Got the IEND (end of image) chunk. Do some final checks... */ if (chunkSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "IEND chunk contents must be empty", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IEND", NULL); return TCL_ERROR; } /* * Check the CRC on the IEND chunk. */ if (CheckCRC(interp, pngPtr, crc) == TCL_ERROR) { return TCL_ERROR; } /* * TODO: verify that nothing else comes after the IEND chunk, or do we * really care? */ #if 0 if (ReadData(interp, pngPtr, &c, 1, NULL) != TCL_ERROR) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra data following IEND chunk", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IEND", NULL); return TCL_ERROR; } #endif /* * Apply overall image alpha if specified. |
︙ | ︙ | |||
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; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2853 2854 2855 2856 2857 2858 2859 | */ static int WriteData( Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, | | | | | | | | 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 | */ static int WriteData( Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, Tcl_Size srcSz, unsigned long *crcPtr) { if (!srcPtr || srcSz <= 0) { return TCL_OK; } if (crcPtr) { *crcPtr = Tcl_ZlibCRC32(*crcPtr, srcPtr, srcSz); } /* * TODO: is Tcl_AppendObjToObj faster here? i.e., does Tcl join the * objects immediately or store them in a multi-object rep? */ if (pngPtr->objDataPtr) { Tcl_Size 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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } destPtr = Tcl_SetByteArrayLength(pngPtr->objDataPtr, objSz + srcSz); if (!destPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } memcpy(destPtr+objSz, srcPtr, srcSz); } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == TCL_IO_FAILURE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
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 -- |
︙ | ︙ | |||
2968 2969 2970 2971 2972 2973 2974 | static inline int WriteChunk( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, | | | 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 | static inline int WriteChunk( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, Tcl_Size dataSize) { unsigned long crc = Tcl_ZlibCRC32(0, NULL, 0); int result = TCL_OK; /* * Write the length field for the chunk. */ |
︙ | ︙ | |||
3142 3143 3144 3145 3146 3147 3148 | Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr) { int rowNum, flush = TCL_ZLIB_NO_FLUSH, result; Tcl_Obj *outputObj; unsigned char *outputBytes; | | | 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 | Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr) { int rowNum, flush = TCL_ZLIB_NO_FLUSH, result; Tcl_Obj *outputObj; unsigned char *outputBytes; Tcl_Size outputSize; /* * Filter and compress each row one at a time. */ for (rowNum=0 ; rowNum < blockPtr->height ; rowNum++) { int colNum; |
︙ | ︙ | |||
3211 3212 3213 3214 3215 3216 3217 | if (rowNum + 1 == blockPtr->height) { flush = TCL_ZLIB_FINALIZE; } if (Tcl_ZlibStreamPut(pngPtr->stream, pngPtr->thisLineObj, flush) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | if (rowNum + 1 == blockPtr->height) { flush = TCL_ZLIB_FINALIZE; } if (Tcl_ZlibStreamPut(pngPtr->stream, pngPtr->thisLineObj, flush) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "deflate() returned error", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "DEFLATE", NULL); return TCL_ERROR; } /* * Swap line buffers to keep the last around for filtering next. */ |
︙ | ︙ | |||
3233 3234 3235 3236 3237 3238 3239 | } /* * Now get the compressed data and write it as one big IDAT chunk. */ outputObj = Tcl_NewObj(); | | | | 3426 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, TCL_INDEX_NONE); 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; |
︙ | ︙ | |||
3302 3303 3304 3305 3306 3307 3308 | * Say that it is Tk that made the PNG. Note that we *need* the NUL at the * end of "Software" to be transferred; do *not* change the length * parameter to -1 there! */ Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, "Software", 9); | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * Say that it is Tk that made the PNG. Note that we *need* the NUL at the * end of "Software" to be transferred; do *not* change the length * parameter to -1 there! */ Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, "Software", 9); Tcl_DStringAppend(&buf, "Tk Toolkit v", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, TK_PATCH_LEVEL, TCL_INDEX_NONE); if (WriteChunk(interp, pngPtr, CHUNK_tEXt, (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", TCL_INDEX_NONE)); 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). * |
︙ | ︙ | |||
3387 3388 3389 3390 3391 3392 3393 | pngPtr->lineSize = 1 + (pngPtr->bytesPerPixel * blockPtr->width); pngPtr->blockLen = pngPtr->lineSize * blockPtr->height; if ((blockPtr->width > (INT_MAX - 1) / (pngPtr->bytesPerPixel)) || (blockPtr->height > INT_MAX / pngPtr->lineSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 | pngPtr->lineSize = 1 + (pngPtr->bytesPerPixel * blockPtr->width); pngPtr->blockLen = pngPtr->lineSize * blockPtr->height; if ((blockPtr->width > (INT_MAX - 1) / (pngPtr->bytesPerPixel)) || (blockPtr->height > INT_MAX / pngPtr->lineSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "image is too large to encode pixel data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } pngPtr->lastLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->lastLineObj); pngPtr->thisLineObj = Tcl_NewObj(); |
︙ | ︙ | |||
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 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* * 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. */ #include "tkInt.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The maximum amount of memory to allocate for data read from the file. If we * need more than this, we do it in pieces. */ #define MAX_MEMORY 10000 /* don't allocate > 10KB */ |
︙ | ︙ | |||
197 198 199 200 201 202 203 | if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } if (srcY > 0) { | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | 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; | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | 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, |
︙ | ︙ | |||
303 304 305 306 307 308 309 | } if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } | | | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | } if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } snprintf(header, sizeof(header), "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); Tcl_Write(chan, header, TCL_INDEX_NONE); pixLinePtr = blockPtr->pixelPtr + blockPtr->offset[0]; greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if ((greenOffset == 1) && (blueOffset == 2) && (blockPtr->pixelSize == 3) && (blockPtr->pitch == (blockPtr->width * 3))) { |
︙ | ︙ | |||
374 375 376 377 378 379 380 | Tk_PhotoImageBlock *blockPtr) { int w, h, size, greenOffset, blueOffset; unsigned char *pixLinePtr, *byteArray; char header[16 + TCL_INTEGER_SPACE * 2]; Tcl_Obj *byteArrayObj; | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | Tk_PhotoImageBlock *blockPtr) { int w, h, size, greenOffset, blueOffset; unsigned char *pixLinePtr, *byteArray; char header[16 + TCL_INTEGER_SPACE * 2]; Tcl_Obj *byteArrayObj; snprintf(header, sizeof(header), "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); /* * Construct a byte array of the right size with the header and * get a pointer to the data part of it. */ size = strlen(header); |
︙ | ︙ | |||
495 496 497 498 499 500 501 | unsigned char *pixelPtr, *dataBuffer; Tk_PhotoImageBlock block; type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight, &maxIntensity, &dataBuffer, &dataSize); if (type == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | unsigned char *pixelPtr, *dataBuffer; Tk_PhotoImageBlock block; type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight, &maxIntensity, &dataBuffer, &dataSize); if (type == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't read raw PPM header from string", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "NO_HEADER", NULL); return TCL_ERROR; } if ((fileWidth <= 0) || (fileHeight <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "PPM image data has dimension(s) <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "DIMENSIONS", NULL); return TCL_ERROR; } if ((maxIntensity <= 0) || (maxIntensity > 0xffff)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "PPM image data has bad maximum intensity value %d", maxIntensity)); |
︙ | ︙ | |||
553 554 555 556 557 558 559 | if (maxIntensity == 0x00ff) { /* * We have all the data in memory, so write everything in one go. */ if (block.pitch*height > dataSize) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | if (maxIntensity == 0x00ff) { /* * We have all the data in memory, so write everything in one go. */ if (block.pitch*height > dataSize) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "truncated PPM data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "TRUNCATED", NULL); return TCL_ERROR; } block.pixelPtr = dataBuffer + srcX * block.pixelSize; block.height = height; return Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET); |
︙ | ︙ | |||
589 590 591 592 593 594 595 | if (nLines > h) { nLines = h; nBytes = nLines * block.pitch; } if (dataSize < nBytes) { ckfree(pixelPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | 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 | if (nLines > h) { nLines = h; nBytes = nLines * block.pitch; } if (dataSize < nBytes) { ckfree(pixelPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj( "truncated PPM data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "TRUNCATED", NULL); return TCL_ERROR; } 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, |
︙ | ︙ | |||
760 761 762 763 764 765 766 | * is stored here. */ unsigned char **dataBufferPtr, int *dataSizePtr) { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; int i, numFields, type = 0; | | | | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | * is stored here. */ unsigned char **dataBufferPtr, int *dataSizePtr) { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; int i, numFields, type = 0; Tcl_Size 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 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 | /* * 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. */ #include "tkImgPhoto.h" #include "tkPort.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Declaration for internal Xlib function used here: */ #if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) #ifdef __cplusplus extern "C" { #endif extern int _XInitImageFuncPtrs(XImage *image); #ifdef __cplusplus } #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); static void FreeColorTable(ColorTable *colorPtr, int force); static void AllocateColors(ColorTable *colorPtr); static void DisposeColorTable(void *clientData); static int ReclaimColors(ColorTableId *id, int numColors); /* * Hash table used to hash from (display, colormap, palette, gamma) to * ColorTable address. */ |
︙ | ︙ | |||
210 211 212 213 214 215 216 | *---------------------------------------------------------------------- */ ClientData TkImgPhotoGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ | | > > > | 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 | *---------------------------------------------------------------------- */ ClientData TkImgPhotoGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ void *modelData) /* Pointer to our model structure for the * image. */ { PhotoModel *modelPtr = (PhotoModel *)modelData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; XVisualInfo visualInfo, *visInfoPtr; char buf[TCL_INTEGER_SPACE * 3]; XColor *white, *black; XGCValues gcValues; #if (!defined(_WIN32) && !defined(MAC_OSX_TK)) int gcmask; #endif /* * Table of "best" choices for palette for PseudoColor displays with * between 3 and 15 bits/pixel. */ static const int paletteChoice[13][3] = { |
︙ | ︙ | |||
253 254 255 256 257 258 259 | * colormap. If so then just re-use it. */ colormap = Tk_Colormap(tkwin); for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if ((colormap == instancePtr->colormap) | | > > > > | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | * colormap. If so then just re-use it. */ colormap = Tk_Colormap(tkwin); for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if ((colormap == instancePtr->colormap) && (Tk_Display(tkwin) == instancePtr->display) #if (!defined(_WIN32) && !defined(MAC_OSX_TK)) && (Tk_Visual(tkwin) == instancePtr->visualInfo.visual) #endif ) { /* * Re-use this instance. */ if (instancePtr->refCount == 0) { /* * We are resurrecting this instance. |
︙ | ︙ | |||
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | Tcl_Panic("TkImgPhotoGet couldn't find visual for window"); } nRed = 2; nGreen = nBlue = 0; mono = 1; instancePtr->visualInfo = *visInfoPtr; switch (visInfoPtr->c_class) { case DirectColor: case TrueColor: nRed = 1 << CountBits(visInfoPtr->red_mask); nGreen = 1 << CountBits(visInfoPtr->green_mask); nBlue = 1 << CountBits(visInfoPtr->blue_mask); mono = 0; break; case PseudoColor: case StaticColor: if (visInfoPtr->depth > 15) { nRed = 32; nGreen = 32; nBlue = 32; | > > > > > > > > > > > > | 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 | Tcl_Panic("TkImgPhotoGet couldn't find visual for window"); } nRed = 2; nGreen = nBlue = 0; mono = 1; instancePtr->visualInfo = *visInfoPtr; #if (!defined(_WIN32) && !defined(MAC_OSX_TK)) gcmask = 0; instancePtr->visualInfo.visual = Tk_Visual(tkwin); #endif switch (visInfoPtr->c_class) { case DirectColor: case TrueColor: nRed = 1 << CountBits(visInfoPtr->red_mask); nGreen = 1 << CountBits(visInfoPtr->green_mask); nBlue = 1 << CountBits(visInfoPtr->blue_mask); mono = 0; #if (!defined(_WIN32) && !defined(MAC_OSX_TK)) if (visInfoPtr->depth > 24) { gcValues.plane_mask = visInfoPtr->red_mask | visInfoPtr->green_mask | visInfoPtr->blue_mask; gcmask = GCPlaneMask; } #endif break; case PseudoColor: case StaticColor: if (visInfoPtr->depth > 15) { nRed = 32; nGreen = 32; nBlue = 32; |
︙ | ︙ | |||
339 340 341 342 343 344 345 | } break; case GrayScale: case StaticGray: nRed = 1 << visInfoPtr->depth; break; } | | | | > > > > | > | 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 | } break; case GrayScale: case StaticGray: nRed = 1 << visInfoPtr->depth; break; } XFree(visInfoPtr); if (mono) { snprintf(buf, sizeof(buf), "%d", nRed); } else { snprintf(buf, sizeof(buf), "%d/%d/%d", nRed, nGreen, nBlue); } instancePtr->defaultPalette = Tk_GetUid(buf); /* * Make a GC with background = black and foreground = white. */ white = Tk_GetColor(modelPtr->interp, tkwin, "white"); black = Tk_GetColor(modelPtr->interp, tkwin, "black"); gcValues.foreground = (white != NULL)? white->pixel: WhitePixelOfScreen(Tk_Screen(tkwin)); gcValues.background = (black != NULL)? black->pixel: BlackPixelOfScreen(Tk_Screen(tkwin)); Tk_FreeColor(white); Tk_FreeColor(black); gcValues.graphics_exposures = False; #if (!defined(_WIN32) && !defined(MAC_OSX_TK)) instancePtr->gc = Tk_GetGC(tkwin, gcmask|GCForeground|GCBackground|GCGraphicsExposures, &gcValues); #else instancePtr->gc = Tk_GetGC(tkwin, GCForeground|GCBackground|GCGraphicsExposures, &gcValues); #endif /* * Set configuration options and finish the initialization of the * instance. This will also dither the image if necessary. */ TkImgPhotoConfigureInstance(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. * *---------------------------------------------------------------------- */ | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | * 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 } | | | | | > | | > | 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 | } 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. * * Results: * None. * * Side effects: * A portion of the image gets rendered in a pixmap or window. * *---------------------------------------------------------------------- */ void TkImgPhotoDisplay( void *clientData, /* Pointer to PhotoInstance structure for * instance to be displayed. */ Display *display, /* Display on which to draw image. */ Drawable drawable, /* Pixmap or window in which to draw image. */ int imageX, int imageY, /* Upper-left corner of region within image to * 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; |
︙ | ︙ | |||
682 683 684 685 686 687 688 | TkPutImage(NULL, 0, display, drawable, instancePtr->gc, bgImg, 0, 0, drawableX, drawableY, (unsigned int) width, (unsigned int) height); XDestroyImage(bgImg); Tk_DeleteErrorHandler(handler); } else { /* | | | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | TkPutImage(NULL, 0, display, drawable, instancePtr->gc, bgImg, 0, 0, drawableX, drawableY, (unsigned int) width, (unsigned int) height); XDestroyImage(bgImg); Tk_DeleteErrorHandler(handler); } else { /* * modelPtr->validRegion describes which parts of the image contain valid * data. We set this region as the clip mask for the gc, setting its * origin appropriately, and use it when drawing the image. */ fallBack: TkSetRegion(display, instancePtr->gc, instancePtr->modelPtr->validRegion); |
︙ | ︙ | |||
722 723 724 725 726 727 728 | * Internal data structures get cleaned up, later. * *---------------------------------------------------------------------- */ void TkImgPhotoFree( | | | < | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | * Internal data structures get cleaned up, later. * *---------------------------------------------------------------------- */ void TkImgPhotoFree( void *clientData, /* Pointer to PhotoInstance structure for * instance to be displayed. */ TCL_UNUSED(Display *)) /* Display containing window that used * image. */ { PhotoInstance *instancePtr = (PhotoInstance *)clientData; ColorTable *colorPtr; if (instancePtr->refCount-- > 1) { return; } /* * There are no more uses of the image within this widget. Decrement the |
︙ | ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | * which is used to locate color tables. * *---------------------------------------------------------------------- */ static void DisposeColorTable( | | | 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | * which is used to locate color tables. * *---------------------------------------------------------------------- */ static void DisposeColorTable( void *clientData) /* Pointer to the ColorTable whose * colors are to be released. */ { ColorTable *colorPtr = (ColorTable *)clientData; Tcl_HashEntry *entry; if (colorPtr->pixelMap != NULL) { if (colorPtr->numColors > 0) { |
︙ | ︙ | |||
1579 1580 1581 1582 1583 1584 1585 | * The instance data structure and the resources it references are freed. * *---------------------------------------------------------------------- */ void TkImgDisposeInstance( | | | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 | * The instance data structure and the resources it references are freed. * *---------------------------------------------------------------------- */ void TkImgDisposeInstance( void *clientData) /* Pointer to the instance whose resources are * to be released. */ { PhotoInstance *instancePtr = (PhotoInstance *)clientData; PhotoInstance *prevPtr; if (instancePtr->pixels != None) { Tk_FreePixmap(instancePtr->display, instancePtr->pixels); |
︙ | ︙ |
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 }; |
︙ | ︙ | |||
102 103 104 105 106 107 108 | "not enough free memory for image buffer" /* * Functions used in the type record for photo images. */ static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, | | | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | "not enough free memory for image buffer" /* * Functions used in the type record for photo images. */ static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); static void ImgPhotoDelete(void *clientData); static int ImgPhotoPostscript(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, int x, int y, int width, int height, int prepass); /* * The type record itself for photo images: */ |
︙ | ︙ | |||
131 132 133 134 135 136 137 | NULL }; typedef struct { Tk_PhotoImageFormat *formatList; /* Pointer to the first in the list of known * photo image formats.*/ | < | | < > > > > > > | | | | | > > > > > > | 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 | NULL }; typedef struct { Tk_PhotoImageFormat *formatList; /* Pointer to the first in the list of known * photo image formats.*/ 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 */ #define DEF_PHOTO_GAMMA "1" #define DEF_PHOTO_HEIGHT "0" #define DEF_PHOTO_PALETTE "" #define DEF_PHOTO_WIDTH "0" /* * Information used for parsing configuration specifications: */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-data", NULL, NULL, NULL, TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, NULL, offsetof(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-format", NULL, NULL, NULL, TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, DEF_PHOTO_GAMMA, offsetof(PhotoModel, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, DEF_PHOTO_HEIGHT, offsetof(PhotoModel, userHeight), 0, NULL}, {TK_CONFIG_STRING, "-metadata", NULL, NULL, NULL, TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, DEF_PHOTO_PALETTE, offsetof(PhotoModel, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, DEF_PHOTO_WIDTH, offsetof(PhotoModel, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Forward declarations */ static void PhotoFormatThreadExitProc(void *clientData); static int ImgPhotoCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ParseSubcommandOptions( struct SubcommandOptions *optPtr, Tcl_Interp *interp, int allowedOptions, Tcl_Size *indexPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void ImgPhotoCmdDeletedProc(void *clientData); static int ImgPhotoConfigureModel(Tcl_Interp *interp, PhotoModel *modelPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr); 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 | */ static void PhotoFormatThreadExitProc( TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | > < < < < < < < | > > > > > > | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | */ static void PhotoFormatThreadExitProc( TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; Tk_PhotoImageFormatVersion3 *freePtrVersion3; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); while (tsdPtr->formatList != NULL) { freePtr = tsdPtr->formatList; tsdPtr->formatList = tsdPtr->formatList->nextPtr; ckfree((void *)freePtr->name); ckfree(freePtr); } while (tsdPtr->formatListVersion3 != NULL) { freePtrVersion3 = tsdPtr->formatListVersion3; tsdPtr->formatListVersion3 = tsdPtr->formatListVersion3->nextPtr; ckfree((void *)freePtrVersion3->name); ckfree(freePtrVersion3); } } /* *---------------------------------------------------------------------- * * 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. * * Side effects: * The new image file format is entered into a table used in the photo * image "read" and "write" subcommands. * *---------------------------------------------------------------------- */ void Tk_CreatePhotoImageFormat( const Tk_PhotoImageFormat *formatPtr) /* Structure describing the format. All of the * fields except "nextPtr" must be filled in * by caller. */ { Tk_PhotoImageFormat *copyPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; { /* for compatibility with aMSN: make a copy of formatPtr->name */ 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 |
︙ | ︙ | |||
335 336 337 338 339 340 341 | */ static int ImgPhotoCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ | | | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | */ static int ImgPhotoCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { PhotoModel *modelPtr; /* * Allocate and initialize the photo image model record. */ |
︙ | ︙ | |||
394 395 396 397 398 399 400 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ImgPhotoCmd( | | | > > | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ImgPhotoCmd( void *clientData, /* Information about photo model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const photoOptions[] = { "blank", "cget", "configure", "copy", "data", "get", "put", "read", "redither", "transparency", "write", NULL }; enum PhotoOptions { PHOTO_BLANK, PHOTO_CGET, PHOTO_CONFIGURE, PHOTO_COPY, PHOTO_DATA, PHOTO_GET, PHOTO_PUT, PHOTO_READ, PHOTO_REDITHER, PHOTO_TRANS, PHOTO_WRITE }; PhotoModel *modelPtr = (PhotoModel *)clientData; int result, x, y, width, height; Tcl_Size index; struct SubcommandOptions options; unsigned char *pixelPtr; Tk_PhotoImageBlock block; Tk_PhotoImageFormat *imageFormat; Tk_PhotoImageFormatVersion3 *imageFormatVersion3; Tcl_Size length; int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { |
︙ | ︙ | |||
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; } | | > > > > | | | | > > > > > > > | | | | | > > > > > > > > > > > > > > | | 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 | 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, modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } case PHOTO_CONFIGURE: /* * photo configure command - handle this in the standard way. */ if (objc == 2) { Tcl_Obj *obj, *subobj; result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, modelPtr, NULL, 0); if (result != TCL_OK) { return result; } obj = Tcl_NewObj(); subobj = Tcl_NewStringObj("-data {} {} {}", 14); if (modelPtr->dataString) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString); } else { Tcl_AppendStringsToObj(subobj, " {}", (char *)NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); if (modelPtr->format) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { Tcl_AppendStringsToObj(subobj, " {}", (char *)NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-metadata {} {} {}", 18); if (modelPtr->metadata) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->metadata); } else { Tcl_AppendStringsToObj(subobj, " {}", (char *)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 {} {} {}", (char *)NULL); if (modelPtr->dataString) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->dataString); } else { Tcl_AppendResult(interp, " {}", (char *)NULL); } return TCL_OK; } else if (length > 1 && !strncmp(arg, "-format", length)) { Tcl_AppendResult(interp, "-format {} {} {}", (char *)NULL); if (modelPtr->format) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->format); } else { Tcl_AppendResult(interp, " {}", (char *)NULL); } return TCL_OK; } else if (length > 1 && !strncmp(arg, "-metadata", length)) { Tcl_AppendResult(interp, "-metadata {} {} {}", (char *)NULL); if (modelPtr->metadata) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->metadata); } else { Tcl_AppendResult(interp, " {}", (char *)NULL); } return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), configSpecs, modelPtr, arg, 0); } } else { return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } case PHOTO_COPY: |
︙ | ︙ | |||
573 574 575 576 577 578 579 | srcHandle = Tk_FindPhoto(interp, Tcl_GetString(options.name)); if (srcHandle == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image \"%s\" doesn't exist or is not a photo image", Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", | | < < < | | 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 | srcHandle = Tk_FindPhoto(interp, Tcl_GetString(options.name)); if (srcHandle == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image \"%s\" doesn't exist or is not a photo image", Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", Tcl_GetString(options.name), (char *)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", (char *)NULL); return TCL_ERROR; } /* * Hack to pass through the message that the place we're coming from * has a simple alpha channel. */ |
︙ | ︙ | |||
635 636 637 638 639 640 641 | options.toY2 = options.toY + height * options.zoomY; } /* * Copy the image data over using Tk_PhotoPutZoomedBlock. */ | > | | | | | | | | | > > > < < < | | > | | < < | | > > > | > > > > | | > > > | | > > > > > > > > > > | | | | | | | < | | | > | | | | | | > | | | < | | | | | > > > | | < | > > > > > > > > > > > > | | | < < < < < < < < < < < < | | | | | | | | | | | | | | | < < > > | > | > | > | 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 | 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, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)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", TCL_INDEX_NONE); 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; imageFormat = imageFormat->nextPtr) { if ((strncasecmp(Tcl_GetString(options.format), imageFormat->name, strlen(imageFormat->name)) == 0)) { matched = 1; if (imageFormat->stringWriteProc != NULL) { stringWriteProc = imageFormat->stringWriteProc; break; } } } 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), (char *)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, Tcl_GetString(options.format), &block); if (result == TCL_OK) { Tcl_DStringResult(interp, &buffer); } else { Tcl_DStringFree(&buffer); } } else { typedef int (*NewStringWriteProc)(Tcl_Interp *interp, Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr); result = ((NewStringWriteProc)(void *)stringWriteProc)(interp, options.format, &block); } 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. */ Tcl_Obj *channels[4]; int i, channelCount = 3; index = 3; memset(&options, 0, sizeof(options)); options.name = NULL; if (ParseSubcommandOptions(&options, interp, OPT_WITHALPHA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if (options.name == NULL || index < objc) { Tcl_WrongNumArgs(interp, 2, objv, "x y ?-withalpha?"); return TCL_ERROR; } if (options.options & OPT_WITHALPHA) { channelCount = 4; } if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { return TCL_ERROR; } if ((x < 0) || (x >= modelPtr->width) || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", (char *)NULL); return TCL_ERROR; } /* * Extract the value of the desired pixel and format it as a list. */ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; for (i = 0; i < channelCount; i++) { channels[i] = Tcl_NewWideIntObj(pixelPtr[i]); } Tcl_SetObjResult(interp, Tcl_NewListObj(channelCount, channels)); return TCL_OK; } case PHOTO_PUT: { Tcl_Obj *format, *data; /* * 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); } | > | | | | | | > > > > > > > > > > > > | 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 | 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, | > | | | | 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 | * 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; } /* * Prevent file system access in safe interpreters. */ if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); return TCL_ERROR; } /* * Open the image file and look for a handler for it. */ |
︙ | ︙ | |||
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, | | > | < > | > | < | > | | < | > > | | | | > > > > > > > > | 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 | 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", (char *)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, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)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: |
︙ | ︙ | |||
1124 1125 1126 1127 1128 1129 1130 | return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", | | | | | 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 | return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); return TCL_ERROR; } boolMode = 1; if (options.options & OPT_ALPHA) { boolMode = 0; } if ((x < 0) || (x >= modelPtr->width) || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", (char *)NULL); return TCL_ERROR; } /* * Extract and return the desired value */ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; if (boolMode) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(pixelPtr[3] == 0)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixelPtr[3])); } return TCL_OK; } case PHOTO_TRANS_SET: { |
︙ | ︙ | |||
1183 1184 1185 1186 1187 1188 1189 | return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", | | | | | 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 | return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); return TCL_ERROR; } boolMode = 1; if (options.options & OPT_ALPHA) { boolMode = 0; } if ((x < 0) || (x >= modelPtr->width) || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency set: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", (char *)NULL); return TCL_ERROR; } if (boolMode) { if (Tcl_GetBooleanFromObj(interp, objv[5], &newVal) != TCL_OK) { return TCL_ERROR; } } else { if (Tcl_GetIntFromObj(interp, objv[5], &newVal) != TCL_OK) { return TCL_ERROR; } if (newVal < 0 || newVal > 255) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid alpha value \"%d\": " "must be integer between 0 and 255", newVal)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_VALUE", (char *)NULL); return TCL_ERROR; } } /* * Set new alpha value for the pixel */ |
︙ | ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | } Tcl_Panic("unexpected fallthrough"); } case PHOTO_WRITE: { char *data; const char *fmtString; | | | | > | > > > > | | > > > | 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 | } 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)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't write image to a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); return TCL_ERROR; } /* * 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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)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 1347 1348 1349 1350 | 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) { break; } } } | > > > > > > > > > > > > < | | | > | | | < | | | > > > > | | > > > > > | 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 | 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) { break; } } } 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", TCL_INDEX_NONE)); } 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, (char *)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, | | | | 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | /* *---------------------------------------------------------------------- * * 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: |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | ParseSubcommandOptions( struct SubcommandOptions *optPtr, /* Information about the options specified and * the values given is returned here. */ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ int allowedOptions, /* Indicates which options are valid for the * current command. */ | | | | | | | | 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 | ParseSubcommandOptions( struct SubcommandOptions *optPtr, /* Information about the options specified and * the values given is returned here. */ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ int allowedOptions, /* Indicates which options are valid for the * current command. */ Tcl_Size *optIndexPtr, /* Points to a variable containing the current * index in objv; this variable is updated by * this function. */ Tcl_Size objc, /* Number of arguments in objv[]. */ Tcl_Obj *const objv[]) /* Arguments to be parsed. */ { static const char *const compositingRules[] = { "overlay", "set", /* Note that these must match the * TK_PHOTO_COMPOSITE_* constants. */ NULL }; Tcl_Size index, length, argIndex; int c, bit, currentBit; int values[4], numValues, maxValues; const char *option, *expandedOption, *needed; const char *const *listPtr; Tcl_Obj *msgObj; 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) { | > > > > > > > > > > > | 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 | */ 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) { |
︙ | ︙ | |||
1697 1698 1699 1700 1701 1702 1703 | /* * Exception generation. */ oneValueRequired: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the \"%s\" option requires a value", expandedOption)); | | | | | | | | | 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 | /* * Exception generation. */ oneValueRequired: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the \"%s\" option requires a value", expandedOption)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; manyValuesRequired: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the \"%s\" option requires one %s integer values", expandedOption, (maxValues == 2) ? "or two": "to four")); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; numberOutOfRange: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value(s) for the %s option must be %s", expandedOption, needed)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_VALUE", (char *)NULL); return TCL_ERROR; unknownOrAmbiguousOption: msgObj = Tcl_ObjPrintf("unrecognized option \"%s\": must be ", option); bit = 1; for (listPtr = optionNames; *listPtr != NULL; ++listPtr) { if (allowedOptions & bit) { if (allowedOptions & (bit - 1)) { if (allowedOptions & ~((bit << 1) - 1)) { Tcl_AppendToObj(msgObj, ", ", TCL_INDEX_NONE); } else { Tcl_AppendToObj(msgObj, ", or ", TCL_INDEX_NONE); } } Tcl_AppendToObj(msgObj, *listPtr, TCL_INDEX_NONE); } bit <<= 1; } Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * ImgPhotoConfigureModel -- |
︙ | ︙ | |||
1759 1760 1761 1762 1763 1764 1765 | */ static int ImgPhotoConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ | | | > | | | < | | | | | < < | | | | < < | | > > > > > > > > > > > | 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 | */ static int ImgPhotoConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ Tcl_Size 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; Tcl_Size i, length; int result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; Tk_PhotoImageFormatVersion3 *imageFormatVersion3; for (i = 0; i < objc; i++) { const char *arg = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && (arg[0] == '-')) { if ((arg[1] == 'd') && !strncmp(arg, "-data", length)) { if (++i < objc) { data = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-data\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; } } else if ((arg[1] == 'f') && !strncmp(arg, "-format", length)) { if (++i < objc) { format = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-format\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; } } else if ((arg[1] == 'm') && !strncmp(arg, "-metadata", length)) { if (++i < objc) { metadataInObj = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-metadata\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; } } } } /* |
︙ | ︙ | |||
1837 1838 1839 1840 1841 1842 1843 | oldGamma = modelPtr->gamma; /* * Process the configuration options specified. */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, | | < < | | | | 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 | oldGamma = modelPtr->gamma; /* * Process the configuration options specified. */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, objc, objv, modelPtr, flags) != TCL_OK) { goto errorExit; } /* * 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. */ Tcl_Size 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 1900 | 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) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > | | | | > | | > | > > > > > > > > > > > > > > > > | | | > | | | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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. */ Tcl_Size dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataInObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-metadata\" not a dict", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", (char *)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) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); goto errorExit; } /* * Read in the image from the file or string if the user has specified the * -file or -data option. */ if ((modelPtr->fileString != NULL) && ((modelPtr->fileString != oldFileString) || (modelPtr->format != oldFormat))) { /* * Prevent file system access in a safe interpreter. */ if (Tcl_IsSafe(interp)) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", -1)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); goto errorExit; } 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, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)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, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)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) { Tcl_Size dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "driver metadata not a dict", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", (char *)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 -- | > > > > > > | 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 | 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; | | > | 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 | 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; } } |
︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 | * Resources associated with the image get freed. * *---------------------------------------------------------------------- */ static void ImgPhotoDelete( | | | 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 | * Resources associated with the image get freed. * *---------------------------------------------------------------------- */ static void ImgPhotoDelete( void *modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { PhotoModel *modelPtr = (PhotoModel *)modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { if (instancePtr->refCount > 0) { |
︙ | ︙ | |||
2141 2142 2143 2144 2145 2146 2147 | } if (modelPtr->dataString != NULL) { Tcl_DecrRefCount(modelPtr->dataString); } if (modelPtr->format != NULL) { Tcl_DecrRefCount(modelPtr->format); } | > > > | | 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 | } 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, modelPtr, NULL, 0); ckfree(modelPtr); } /* *---------------------------------------------------------------------- * * ImgPhotoCmdDeletedProc -- |
︙ | ︙ | |||
2164 2165 2166 2167 2168 2169 2170 | * The image is deleted. * *---------------------------------------------------------------------- */ static void ImgPhotoCmdDeletedProc( | | | 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 | * The image is deleted. * *---------------------------------------------------------------------- */ static void ImgPhotoCmdDeletedProc( void *clientData) /* Pointer to PhotoModel structure for * image. */ { PhotoModel *modelPtr = (PhotoModel *)clientData; modelPtr->imageCmd = NULL; if (modelPtr->tkModel != NULL) { Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); |
︙ | ︙ | |||
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 | | | | > > | > > > > > > | 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 | * 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); } |
︙ | ︙ | |||
2430 2431 2432 2433 2434 2435 2436 | } matched = 1; if (formatPtr->fileMatchProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-file option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", | | | > > > > | > > | > > > | > > > > | > > > | | | > | | | | | | | | | | | | | | | > | > | | | | | | > > > > > > | > > > > | > > > > > > > > | | | < | | > > > > | | | | | | | | | | | | | | < < < < < < | | | > > | > > > > > > | 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 | } matched = 1; if (formatPtr->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", (char *)NULL); return TCL_ERROR; } } if (formatPtr->fileMatchProc != NULL) { (void) Tcl_Seek(chan, Tcl_LongAsWide(0L), SEEK_SET); if (formatPtr->fileMatchProc(chan, fileName, formatObj, widthPtr, heightPtr, interp)) { if (*widthPtr < 1) { *widthPtr = 1; } if (*heightPtr < 1) { *heightPtr = 1; } break; } } } /* * 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", (char *)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) { Tcl_Size 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, (char *)NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't recognize data in image file \"%s\"", fileName)); Tcl_SetErrorCode(interp, "TK", "PHOTO", "IMAGE", "UNRECOGNIZED_DATA", (char *)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); } |
︙ | ︙ | |||
2582 2583 2584 2585 2586 2587 2588 | } matched = 1; if (formatPtr->stringMatchProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-data option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", | | | 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 | } matched = 1; if (formatPtr->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", (char *)NULL); return TCL_ERROR; } } /* * If this is the default format, and it was not passed as -format * option, skip the stringMatchProc test. It'll be done later |
︙ | ︙ | |||
2604 2605 2606 2607 2608 2609 2610 | && (formatPtr->stringReadProc != NULL) && formatPtr->stringMatchProc(data, formatObj, widthPtr, heightPtr, interp)) { break; } } | < | > | | | > | | | | | < < | > | > > > > | > | > > > > > > | > > > > | | | | | | | | | | | | | > | 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 | && (formatPtr->stringReadProc != NULL) && formatPtr->stringMatchProc(data, formatObj, widthPtr, heightPtr, interp)) { break; } } 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", (char *)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) { Tcl_Size 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"); } if ( formatObj == NULL && defaultFormatPtr->stringMatchProc != NULL && defaultFormatPtr->stringReadProc != NULL && defaultFormatPtr->stringMatchProc(data, formatObj, widthPtr, heightPtr, interp) != 0) { useoldformat = 0; formatPtr = defaultFormatPtr; } else if ((formatObj != NULL) && !matched) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image format \"%s\" is not supported", formatString)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", formatString, (char *)NULL); return TCL_ERROR; } else { /* * Some lower level routine (stringMatchProc) may have already set * a specific error message, so just return this. Otherwise return * a generic image data error. */ if (Tcl_GetString(Tcl_GetObjResult(interp))[0] == '\0') { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't recognize image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", (char *)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); |
︙ | ︙ | |||
2714 2715 2716 2717 2718 2719 2720 | Tk_PhotoHandle Tk_FindPhoto( Tcl_Interp *interp, /* Interpreter (application) in which image * exists. */ const char *imageName) /* Name of the desired photo image. */ { const Tk_ImageType *typePtr; | | | 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 | Tk_PhotoHandle Tk_FindPhoto( Tcl_Interp *interp, /* Interpreter (application) in which image * exists. */ const char *imageName) /* Name of the desired photo image. */ { const Tk_ImageType *typePtr; void *clientData = Tk_GetImageModelData(interp, imageName, &typePtr); if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) { return NULL; } return clientData; } |
︙ | ︙ | |||
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; | | | | | | | | | 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 | * * 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 * * blockPtr->pixelPtr > (modelPtr->pix32 + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } memToFree = sourceBlock.pixelPtr; memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen); } xEnd = x + width; yEnd = y + height; if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } goto errorExit; } } if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) && (x < modelPtr->ditherX))) { |
︙ | ︙ | |||
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 | | | 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 | /* * 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; | | | | | | | | | 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 | * * 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 * * blockPtr->pixelPtr > (modelPtr->pix32 + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } memToFree = sourceBlock.pixelPtr; memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen); } xEnd = x + width; yEnd = y + height; if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } goto errorExit; } } if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) && (x < modelPtr->ditherX))) { |
︙ | ︙ | |||
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. */ | > | | > | 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 | 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. |
︙ | ︙ | |||
3689 3690 3691 3692 3693 3694 3695 | height = modelPtr->height; } if ((width != modelPtr->width) || (height != modelPtr->height)) { if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width), MAX(height, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 | height = modelPtr->height; } if ((width != modelPtr->width) || (height != modelPtr->height)) { if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width), MAX(height, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } return TCL_OK; |
︙ | ︙ | |||
3764 3765 3766 3767 3768 3769 3770 | modelPtr->userWidth = width; modelPtr->userHeight = height; if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width), ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 | modelPtr->userWidth = width; modelPtr->userHeight = height; if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width), ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); return TCL_OK; } |
︙ | ︙ | |||
4057 4058 4059 4060 4061 4062 4063 | * None. * *-------------------------------------------------------------- */ static int ImgPhotoPostscript( | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | * None. * *-------------------------------------------------------------- */ static int ImgPhotoPostscript( void *clientData, /* Handle for the photo image. */ Tcl_Interp *interp, /* Interpreter. */ TCL_UNUSED(Tk_Window), /* (unused) */ Tk_PostscriptInfo psInfo, /* Postscript info. */ int x, int y, /* First pixel to output. */ int width, int height, /* Width and height of area. */ TCL_UNUSED(int)) /* (unused) */ { Tk_PhotoImageBlock block; Tk_PhotoGetImage(clientData, &block); block.pixelPtr += y * block.pitch + x * block.pixelSize; return Tk_PostscriptPhoto(interp, &block, psInfo, width, height); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * tab-width: 8 * End: */ |
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. */ |
︙ | ︙ | |||
241 242 243 244 245 246 247 | /* * Declarations of functions shared between the different parts of the * photo image implementation. */ MODULE_SCOPE void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr); | | | | | | 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 | /* * Declarations of functions shared between the different parts of the * photo image implementation. */ MODULE_SCOPE void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr); MODULE_SCOPE void TkImgDisposeInstance(void *clientData); MODULE_SCOPE void TkImgPhotoInstanceSetSize(PhotoInstance *instancePtr); MODULE_SCOPE void *TkImgPhotoGet(Tk_Window tkwin, void *clientData); MODULE_SCOPE void TkImgDitherInstance(PhotoInstance *instancePtr, int x, int y, int width, int height); MODULE_SCOPE void TkImgPhotoDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); MODULE_SCOPE void TkImgPhotoFree(void *clientData, Display *display); MODULE_SCOPE void TkImgResetDither(PhotoInstance *instancePtr); /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 * |
︙ | ︙ | |||
42 43 44 45 46 47 48 | */ typedef struct { /* A poiner to remember if it is the same svn image (data) * It is a Tcl_Channel if image created by -file option * or a Tcl_Obj, if image is created with the -data option */ | | > > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | */ typedef struct { /* A poiner to remember if it is the same svn image (data) * It is a Tcl_Channel if image created by -file option * or a Tcl_Obj, if image is created with the -data option */ void *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); static int StringMatchSVG(Tcl_Obj *dataObj, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadSVG(Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static NSVGimage * ParseSVGWithOptions(Tcl_Interp *interp, const char *input, Tcl_Size length, Tcl_Obj *format, RastOpts *ropts); static int RasterizeSVG(Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, int srcX, int srcY, RastOpts *ropts); static double GetScaleFromParameters(NSVGimage *nsvgImage, RastOpts *ropts, int *widthPtr, int *heightPtr); static NSVGcache * GetCachePtr(Tcl_Interp *interp); static int CacheSVG(Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts); static NSVGimage * GetCachedSVG(Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts); static void CleanCache(Tcl_Interp *interp); static void FreeCache(void *clientData, Tcl_Interp *interp); /* * The format record for the SVG nano file format: */ Tk_PhotoImageFormat tkImgFmtSVGnano = { "svg", /* name */ FileMatchSVG, /* fileMatchProc */ StringMatchSVG, /* stringMatchProc */ FileReadSVG, /* fileReadProc */ StringReadSVG, /* stringReadProc */ NULL, /* fileWriteProc */ 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 |
︙ | ︙ | |||
115 116 117 118 119 120 121 | * *---------------------------------------------------------------------- */ static int FileMatchSVG( Tcl_Channel chan, | | | < | > > > > > > > > > > > > | | 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 | * *---------------------------------------------------------------------- */ static int FileMatchSVG( Tcl_Channel chan, TCL_UNUSED(const char *), Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { Tcl_Size length; Tcl_Obj *dataObj = Tcl_NewObj(); const char *data; RastOpts ropts; NSVGimage *nsvgImage; 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, TCL_INDEX_NONE, 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; |
︙ | ︙ | |||
173 174 175 176 177 178 179 | *---------------------------------------------------------------------- */ static int FileReadSVG( Tcl_Interp *interp, Tcl_Channel chan, | | | < | | | | 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 | *---------------------------------------------------------------------- */ static int FileReadSVG( Tcl_Interp *interp, Tcl_Channel chan, TCL_UNUSED(const char *), Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY) { Tcl_Size length; const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); if (nsvgImage == NULL) { Tcl_Obj *dataObj = Tcl_NewObj(); if (Tcl_ReadChars(chan, dataObj, TCL_INDEX_NONE, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", TCL_INDEX_NONE)); 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) { | | | > > > > > > | 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 | static int StringMatchSVG( Tcl_Obj *dataObj, Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { Tcl_Size 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; } |
︙ | ︙ | |||
283 284 285 286 287 288 289 | Tcl_Obj *dataObj, Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY) { | | | | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | Tcl_Obj *dataObj, Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY) { Tcl_Size 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, |
︙ | ︙ | |||
319 320 321 322 323 324 325 | *---------------------------------------------------------------------- */ static NSVGimage * ParseSVGWithOptions( Tcl_Interp *interp, const char *input, | | | | | 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 | *---------------------------------------------------------------------- */ static NSVGimage * ParseSVGWithOptions( Tcl_Interp *interp, const char *input, Tcl_Size length, Tcl_Obj *formatObj, RastOpts *ropts) { Tcl_Obj **objv = NULL; Tcl_Size objc = 0; double dpi = 96.0; char *inputCopy = NULL; NSVGimage *nsvgImage; int parameterScaleSeen = 0; static const char *const fmtOptions[] = { "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL }; enum fmtOptionsEnum { OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH }; /* * The parser destroys the original input string, * therefore first duplicate. */ inputCopy = (char *)attemptckalloc(length+1); if (inputCopy == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto error; } memcpy(inputCopy, input, length); inputCopy[length] = '\0'; /* |
︙ | ︙ | |||
396 397 398 399 400 401 402 | */ switch ((enum fmtOptionsEnum)optIndex) { case OPT_SCALE: case OPT_SCALE_TO_HEIGHT: case OPT_SCALE_TO_WIDTH: if ( parameterScaleSeen ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | | | | 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 | */ switch ((enum fmtOptionsEnum)optIndex) { case OPT_SCALE: case OPT_SCALE_TO_HEIGHT: case OPT_SCALE_TO_WIDTH: if ( parameterScaleSeen ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "only one of -scale, -scaletoheight, -scaletowidth may be given", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; } parameterScaleSeen = 1; break; default: break; } /* * Decode parameters */ switch ((enum fmtOptionsEnum) optIndex) { case OPT_DPI: if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) { goto error; } if (dpi < 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-dpi value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_DPI", NULL); goto error; } break; case OPT_SCALE: if (Tcl_GetDoubleFromObj(interp, objv[0], &ropts->scale) == TCL_ERROR) { goto error; } if (ropts->scale <= 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-scale value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; } break; case OPT_SCALE_TO_HEIGHT: if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToHeight) == TCL_ERROR) { goto error; } if (ropts->scaleToHeight <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-scaletoheight value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; } break; case OPT_SCALE_TO_WIDTH: if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToWidth) == TCL_ERROR) { goto error; } if (ropts->scaleToWidth <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-scaletowidth value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; } break; } } nsvgImage = nsvgParse(inputCopy, "px", (float) dpi); if (nsvgImage == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL); goto error; } ckfree(inputCopy); return nsvgImage; error: |
︙ | ︙ | |||
507 508 509 510 511 512 513 | static int RasterizeSVG( Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, | | > | < | > > > > > > > > > | | | 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 | static int RasterizeSVG( Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, TCL_UNUSED(int), TCL_UNUSED(int), RastOpts *ropts) { int w, h, c; NSVGrasterizer *rast; unsigned char *imgData; Tk_PhotoImageBlock svgblock; double scale; Tcl_WideUInt wh; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); rast = nsvgCreateRasterizer(); if (rast == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto cleanRAST; } nsvgRasterize(rast, nsvgImage, 0, 0, (float) scale, imgData, w, h, w * 4); /* transfer the data to a photo block */ svgblock.pixelPtr = imgData; |
︙ | ︙ | |||
678 679 680 681 682 683 684 | * *---------------------------------------------------------------------- */ static int CacheSVG( Tcl_Interp *interp, | | | | | 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 | * *---------------------------------------------------------------------- */ static int CacheSVG( Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts) { Tcl_Size 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; |
︙ | ︙ | |||
719 720 721 722 723 724 725 | * *---------------------------------------------------------------------- */ static NSVGimage * GetCachedSVG( Tcl_Interp *interp, | | | | | 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 | * *---------------------------------------------------------------------- */ static NSVGimage * GetCachedSVG( Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts) { Tcl_Size length; 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; |
︙ | ︙ | |||
792 793 794 795 796 797 798 | * Side effects: * Existing image data in the cache and the cache will be deleted. * *---------------------------------------------------------------------- */ static void | | < | 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | * Side effects: * Existing image data in the cache and the cache will be deleted. * *---------------------------------------------------------------------- */ static void FreeCache(void *clientData, TCL_UNUSED(Tcl_Interp *)) { NSVGcache *cachePtr = (NSVGcache *)clientData; Tcl_DStringFree(&cachePtr->formatString); if (cachePtr->nsvgImage != NULL) { nsvgDelete(cachePtr->nsvgImage); } ckfree(cachePtr); } |
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 14 15 16 17 18 19 20 21 22 23 | /* * 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" #ifdef _WIN32 # include "tkWinInt.h" #endif /* *---------------------------------------------------------------------- * * TkAlignImageData -- * * This function takes an image and copies the data into an aligned |
︙ | ︙ |
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 ############################################################################## |
︙ | ︙ | |||
63 64 65 66 67 68 69 | # declare 12 { TkCursor *TkCreateCursorFromData(Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg) } declare 13 { | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # declare 12 { TkCursor *TkCreateCursorFromData(Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg) } declare 13 { int TkCreateFrame(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type, const char *appName) } declare 14 { Tk_Window TkCreateMainWindow(Tcl_Interp *interp, const char *screenName, const char *baseName) } declare 15 { Time TkCurrentTime(TkDisplay *dispPtr) |
︙ | ︙ | |||
141 142 143 144 145 146 147 | const char *TkGetDefaultScreenName(Tcl_Interp *interp, const char *screenName) } declare 34 { TkDisplay *TkGetDisplay(Display *display) } declare 35 { | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | const char *TkGetDefaultScreenName(Tcl_Interp *interp, const char *screenName) } declare 34 { TkDisplay *TkGetDisplay(Display *display) } declare 35 { Tcl_Size TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr) } declare 36 { TkWindow *TkGetFocusWin(TkWindow *winPtr) } declare 37 { int TkGetInterpNames(Tcl_Interp *interp, Tk_Window tkwin) |
︙ | ︙ | |||
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 | } declare 58 { void TkpDisplayWarning(const char *msg, const char *title) } declare 59 { void TkpGetAppName(Tcl_Interp *interp, Tcl_DString *name) } declare 61 { TkWindow *TkpGetWrapperWindow(TkWindow *winPtr) } declare 62 { int TkpInit(Tcl_Interp *interp) } declare 63 { void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable) } declare 65 { void TkpMakeMenuWindow(Tk_Window tkwin, int transient) } declare 67 { void TkpMenuNotifyToplevelCreate(Tcl_Interp *interp, const char *menuName) } declare 68 { TkDisplay *TkpOpenDisplay(const char *display_name) } declare 69 { |
︙ | ︙ | |||
265 266 267 268 269 270 271 | } declare 72 { int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr) } declare 73 { void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr) } | < < < < < < < < < | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | } declare 72 { int TkPositionInTree(TkWindow *winPtr, TkWindow *treePtr) } declare 73 { void TkpRedirectKeyEvent(TkWindow *winPtr, XEvent *eventPtr) } declare 77 { void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr) } declare 78 { 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) |
︙ | ︙ | |||
298 299 300 301 302 303 304 | } declare 82 { void TkSelInit(Tk_Window tkwin) } declare 83 { void TkSelPropProc(XEvent *eventPtr) } | < < < < < < < < < < | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | } declare 82 { void TkSelInit(Tk_Window tkwin) } declare 83 { void TkSelPropProc(XEvent *eventPtr) } declare 86 { KeySym TkStringToKeysym(const char *name) } declare 87 { int TkThickPolyLineToArea(double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr) } |
︙ | ︙ | |||
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) } | < < < < | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | } declare 109 { const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) } declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) } declare 112 { void TkpMenuThreadInit(void) } declare 113 { int XClipBox(Region rgn, XRectangle *rect_return) } declare 114 { |
︙ | ︙ | |||
420 421 422 423 424 425 426 | declare 118 { int XSetRegion(Display *display, GC gc, Region rgn) } declare 119 { int XUnionRectWithRegion(XRectangle *rect, Region src, Region dr_return) } | | | | < < < < | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | declare 118 { int XSetRegion(Display *display, GC gc, Region rgn) } declare 119 { int XUnionRectWithRegion(XRectangle *rect, Region src, Region dr_return) } declare 121 { Pixmap TkpCreateNativeBitmap(Display *display, const void *source) } declare 122 { void TkpDefineNativeBitmaps(void) } declare 124 { Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height) } declare 136 { void TkSetFocusWin(TkWindow *winPtr, int force) } declare 137 { void TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym, XEvent *eventPtr) } |
︙ | ︙ | |||
494 495 496 497 498 499 500 | Tk_Canvas canvas, double *pointPtr, int numPoints) } declare 152 { void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) } declare 153 { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | Tk_Canvas canvas, double *pointPtr, int numPoints) } declare 152 { void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) } declare 153 { void TkCreateThreadExitHandler(Tcl_ExitProc *proc, void *clientData) } declare 154 { void TkDeleteThreadExitHandler(Tcl_ExitProc *proc, void *clientData) } # entries needed only by tktest: declare 156 { int TkpTestembedCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 157 { int TkpTesttextCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 158 { int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData) } declare 159 { int TkTextGetIndex(Tcl_Interp *interp, struct TkText *textPtr, const char *string, struct TkTextIndex *indexPtr) } declare 160 { int TkTextIndexBackBytes(const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr) } declare 161 { int TkTextIndexForwBytes(const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr) } declare 162 { struct TkTextIndex *TkTextMakeByteIndex(TkTextBTree tree, const struct TkText *textPtr, int lineIndex, Tcl_Size byteIndex, struct TkTextIndex *indexPtr) } declare 163 { Tcl_Size TkTextPrintIndex(const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string) } declare 164 { struct TkTextSegment *TkTextSetMark(struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr) } declare 165 { int TkTextXviewCmd(struct TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 166 { void TkTextChanged(struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr) } declare 167 { int TkBTreeNumLines(TkTextBTree tree, const struct TkText *textPtr) } declare 168 { void TkTextInsertDisplayProc(struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY) } # Next group of functions exposed due to [Bug 2768945]. declare 169 { int TkStateParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 170 { const char *TkStatePrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 171 { int TkCanvasDashParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 172 { const char *TkCanvasDashPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 173 { int TkOffsetParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 174 { const char *TkOffsetPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 175 { int TkPixelParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 176 { const char *TkPixelPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 177 { int TkOrientParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 178 { const char *TkOrientPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } declare 179 { int TkSmoothParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset) } declare 180 { const char *TkSmoothPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr) } # Angled text API, exposed for Emiliano Gavilán's RBC work. declare 181 { void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, Tcl_Size lastChar) } declare 182 { void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline) } declare 183 { int TkIntersectAngledTextLayout(Tk_TextLayout layout, int x, int y, int width, int height, double angle) } declare 184 { void TkDrawAngledChars(Display *display,Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size 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) |
︙ | ︙ | |||
662 663 664 665 666 667 668 | declare 0 x11 { void TkCreateXEventSource(void) } declare 2 x11 { void TkGenerateActivateEvents(TkWindow *winPtr, int active) } | < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | 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 | declare 0 x11 { void TkCreateXEventSource(void) } declare 2 x11 { void TkGenerateActivateEvents(TkWindow *winPtr, int active) } declare 6 x11 { int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr) } declare 9 x11 { int TkpWmSetState(TkWindow *winPtr, int state) } # only needed by tktest: declare 38 x11 { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } declare 39 x11 { void TkpSync(Display *display) } declare 40 x11 { Window TkUnixContainerId(TkWindow *winPtr) } declare 41 x11 { int TkUnixDoOneXEvent(Tcl_Time *timePtr) } declare 42 x11 { void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar) } declare 43 x11 { void TkWmCleanup(TkDisplay *dispPtr) } declare 44 x11 { void TkSendCleanup(TkDisplay *dispPtr) } # only needed by tktest: declare 45 x11 { int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } ################################ # Windows specific functions declare 0 win { void TkCreateXEventSource(void) } declare 2 win { void TkGenerateActivateEvents(TkWindow *winPtr, int active) } declare 3 win { unsigned long TkpGetMS(void) } |
︙ | ︙ | |||
809 810 811 812 813 814 815 | declare 26 win { void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos) } declare 27 win { void TkWinWmCleanup(HINSTANCE hInstance) } declare 28 win { | | | < < < < | 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 | declare 26 win { void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos) } declare 27 win { void TkWinWmCleanup(HINSTANCE hInstance) } declare 28 win { void TkWinXCleanup(void *clientData) } declare 29 win { void TkWinXInit(HINSTANCE hInstance) } # new for 8.1 declare 30 win { void TkWinSetForegroundWindow(TkWindow *winPtr) } declare 31 win { void TkWinDialogDebug(int debug) } declare 32 win { Tcl_Obj *TkWinGetMenuSystemDefault(Tk_Window tkwin, const char *dbName, const char *className) } declare 33 win { char *TkAlignImageData(XImage *image, int alignment, int bitOrder) } # new for 8.4.1 declare 34 win { void TkWinSetHINSTANCE(HINSTANCE hInstance) } declare 35 win { int TkWinGetPlatformTheme(void) } # Exported through stub table since Tk 8.4.20/8.5.9 declare 36 win { LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } declare 38 win { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } declare 39 win { void TkpSync(Display *display) } declare 40 win { |
︙ | ︙ | |||
874 875 876 877 878 879 880 | void TkWmCleanup(TkDisplay *dispPtr) } declare 44 win { void TkSendCleanup(TkDisplay *dispPtr) } # only needed by tktest: declare 45 win { | | | | | | | | | < | | < > < < < < < < < < < < < < < < < < < < < < < < < < | 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 | void TkWmCleanup(TkDisplay *dispPtr) } declare 44 win { void TkSendCleanup(TkDisplay *dispPtr) } # only needed by tktest: declare 45 win { int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 47 win { Tk_Window TkpGetCapture(void) } ################################ # Aqua specific functions declare 1 aqua { void TkAboutDlg(void) } declare 2 aqua { void TkGenerateActivateEvents(TkWindow *winPtr, int active) } declare 3 aqua { unsigned long TkpGetMS(void) } declare 4 aqua { void TkPointerDeadWindow(TkWindow *winPtr) } declare 5 aqua { void TkpSetCursor(TkpCursor cursor) } declare 6 aqua { int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr) } declare 7 aqua { int TkpWmSetState(TkWindow *winPtr, int state) } declare 8 aqua { unsigned int TkMacOSXButtonKeyState(void) } declare 9 aqua { void TkMacOSXClearMenubarActive(void) } declare 10 aqua { int TkMacOSXDispatchMenuEvent(int menuID, int index) } declare 11 aqua { void TkpSetCapture(TkWindow *winPtr) } declare 12 aqua { void TkMacOSXHandleTearoffMenu(void) } declare 14 aqua { int TkMacOSXDoHLEvent(void *theEvent) } declare 16 aqua { Window TkMacOSXGetXWindow(void *macWinPtr) } declare 17 aqua { int TkMacOSXGrowToplevel(void *whichWindow, XPoint start) } declare 18 aqua { void TkMacOSXHandleMenuSelect(short theMenu, unsigned short theItem, int optionKeyPressed) } declare 21 aqua { void TkMacOSXInvalidateWindow(MacDrawable *macWin, int flag) } declare 23 aqua { void TkMacOSXMakeRealWindowExist(TkWindow *winPtr) } declare 24 aqua { void *TkMacOSXMakeStippleMap(Drawable d1, Drawable d2) } declare 25 aqua { void TkMacOSXMenuClick(void) } declare 27 aqua { int TkMacOSXResizable(TkWindow *winPtr) } declare 28 aqua { void TkMacOSXSetHelpMenuItemCount(void) } declare 29 aqua { void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag) } declare 31 aqua { void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort) } declare 32 aqua { void TkMacOSXUpdateClipRgn(TkWindow *winPtr) } declare 34 aqua { int TkMacOSXUseMenuID(short macID) } declare 35 aqua { Region TkMacOSXVisableClipRgn(TkWindow *winPtr) } declare 36 aqua { |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 | } declare 51 aqua { void TkGenWMDestroyEvent(Tk_Window tkwin) } declare 52 aqua { void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag) } | | < < < | | < < < < > | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | } declare 51 aqua { void TkGenWMDestroyEvent(Tk_Window tkwin) } declare 52 aqua { void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag) } # Made public as Tk_MacOSXGetNSWindowForDrawable #declare 54 aqua { # void *TkMacOSXDrawable(Drawable drawable) #} ############################################################################## # Define the platform specific internal Xlib interfaces. These functions are # only available on the designated platform. interface tkIntXlib |
︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | KeySym *k, Status *s) } declare 80 win { int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) } | < | | | < | | 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | KeySym *k, Status *s) } declare 80 win { int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) } declare 81 win { int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering) } declare 82 win { Status XParseColor(Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr) } declare 83 win { GC XCreateGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values) |
︙ | ︙ | |||
1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 | declare 5 macosx { char *XKeysymToString(KeySym k) } declare 6 macosx { Colormap XCreateColormap(Display *d, Window w, Visual *v, int i) } declare 7 macosx { GContext XGContextFromGC(GC g) } # second parameter was of type KeyCode | > > > > > > > > > > > > | | | | | > > > > > > > > > | | | | > > > | | | | | | | > > > | | | | | | | > > > | > > > | | | > > > | > > > | | | > > > > | | | > > > > > > > > > | > > > > | | | | | > > > | | | | | | | | | > > > > | | | > > > > > > > > > > > > > | > > > > | | | | | | | | | | | | | | | | | | | | | | < < < < < < < | < < < < | < < | | | < < < < | < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < > > > > > > > > > > > > > > > > < < < < < < < < < < < < | 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 | declare 5 macosx { char *XKeysymToString(KeySym k) } declare 6 macosx { Colormap XCreateColormap(Display *d, Window w, Visual *v, int i) } declare 7 macosx { Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2) } declare 8 macosx { Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2) } declare 9 macosx { GContext XGContextFromGC(GC g) } declare 10 macosx { XHostAddress *XListHosts(Display *d, int *i, Bool *b) } # second parameter was of type KeyCode declare 11 macosx { KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i) } declare 12 macosx { KeySym XStringToKeysym(_Xconst char *c) } declare 13 macosx { Window XRootWindow(Display *d, int i) } declare 14 macosx { XErrorHandler XSetErrorHandler(XErrorHandler x) } declare 15 macosx { Status XIconifyWindow(Display *d, Window w, int i) } declare 16 macosx { Status XWithdrawWindow(Display *d, Window w, int i) } declare 17 macosx { Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip) } declare 18 macosx { Status XAllocColor(Display *d, Colormap c, XColor *xp) } declare 19 macosx { int XBell(Display *d, int i) } declare 20 macosx { int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3) } declare 21 macosx { int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x) } declare 22 macosx { int XClearWindow(Display *d, Window w) } declare 23 macosx { int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x) } declare 24 macosx { int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 25 macosx { int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul) } declare 26 macosx { Pixmap XCreateBitmapFromData(Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height) } declare 27 macosx { int XDefineCursor(Display *d, Window w, Cursor c) } declare 28 macosx { int XDeleteProperty(Display *d, Window w, Atom a) } declare 29 macosx { int XDestroyWindow(Display *d, Window w) } declare 30 macosx { int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 31 macosx { int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2) } declare 32 macosx { int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 33 macosx { int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 34 macosx { int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3) } declare 35 macosx { int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i) } declare 36 macosx { int XForceScreenSaver(Display *d, int i) } declare 37 macosx { int XFreeColormap(Display *d, Colormap c) } declare 38 macosx { int XFreeColors(Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul) } declare 39 macosx { int XFreeCursor(Display *d, Cursor c) } declare 40 macosx { int XFreeModifiermap(XModifierKeymap *x) } declare 41 macosx { Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4) } declare 42 macosx { int XGetInputFocus(Display *d, Window *w, int *i) } declare 43 macosx { int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp) } declare 44 macosx { Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x) } declare 45 macosx { int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t) } declare 46 macosx { int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t) } declare 47 macosx { KeyCode XKeysymToKeycode(Display *d, KeySym k) } declare 48 macosx { Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2) } declare 49 macosx { int XMapWindow(Display *d, Window w) } declare 50 macosx { int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 51 macosx { int XMoveWindow(Display *d, Window w, int i1, int i2) } declare 52 macosx { int XNextEvent(Display *d, XEvent *x) } declare 53 macosx { int XPutBackEvent(Display *d, XEvent *x) } declare 54 macosx { int XQueryColors(Display *d, Colormap c, XColor *x, int i) } declare 55 macosx { Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui) } declare 56 macosx { Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui) } declare 57 macosx { int XRaiseWindow(Display *d, Window w) } declare 58 macosx { int XRefreshKeyboardMapping(XMappingEvent *x) } declare 59 macosx { int XResizeWindow(Display *d, Window w, unsigned int ui1, unsigned int ui2) } declare 60 macosx { int XSelectInput(Display *d, Window w, long l) } declare 61 macosx { Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) } declare 62 macosx { int XSetCommand(Display *d, Window w, char **c, int i) } declare 63 macosx { int XSetIconName(Display *d, Window w, _Xconst char *c) } declare 64 macosx { int XSetInputFocus(Display *d, Window w, int i, Time t) } declare 65 macosx { int XSetSelectionOwner(Display *d, Atom a, Window w, Time t) } declare 66 macosx { int XSetWindowBackground(Display *d, Window w, unsigned long ul) } declare 67 macosx { int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p) } declare 68 macosx { int XSetWindowBorder(Display *d, Window w, unsigned long ul) } declare 69 macosx { int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p) } declare 70 macosx { int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui) } declare 71 macosx { int XSetWindowColormap(Display *d, Window w, Colormap c) } declare 72 macosx { Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3) } declare 73 macosx { int XUngrabKeyboard(Display *d, Time t) } declare 74 macosx { int XUngrabPointer(Display *d, Time t) } declare 75 macosx { int XUnmapWindow(Display *d, Window w) } declare 76 macosx { int XWindowEvent(Display *d, Window w, long l, XEvent *x) } declare 77 macosx { void XDestroyIC(XIC x) } declare 78 macosx { Bool XFilterEvent(XEvent *x, Window w) } declare 79 macosx { int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s) } declare 80 macosx { int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) } declare 81 macosx { int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering) } declare 82 macosx { Status XParseColor(Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr) } declare 83 macosx { GC XCreateGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values) } declare 84 macosx { int XFreeGC(Display *display, GC gc) } declare 85 macosx { Atom XInternAtom(Display *display, _Xconst char *atom_name, Bool only_if_exists) } declare 86 macosx { int XSetBackground(Display *display, GC gc, unsigned long foreground) } declare 87 macosx { int XSetForeground(Display *display, GC gc, unsigned long foreground) } declare 88 macosx { int XSetClipMask(Display *display, GC gc, Pixmap pixmap) } declare 89 macosx { int XSetClipOrigin(Display *display, GC gc, int clip_x_origin, int clip_y_origin) } declare 90 macosx { int XSetTSOrigin(Display *display, GC gc, int ts_x_origin, int ts_y_origin) } declare 91 macosx { int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values) } declare 92 macosx { int XSetFont(Display *display, GC gc, Font font) } declare 93 macosx { int XSetArcMode(Display *display, GC gc, int arc_mode) } declare 94 macosx { int XSetStipple(Display *display, GC gc, Pixmap stipple) } declare 95 macosx { int XSetFillRule(Display *display, GC gc, int fill_rule) } declare 96 macosx { int XSetFillStyle(Display *display, GC gc, int fill_style) } declare 97 macosx { int XSetFunction(Display *display, GC gc, int function) } declare 98 macosx { int XSetLineAttributes(Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style) } declare 99 macosx { int _XInitImageFuncPtrs(XImage *image) } declare 100 macosx { XIC XCreateIC(XIM xim, ...) } declare 101 macosx { XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return) } declare 102 macosx { void XSetWMClientMachine(Display *display, Window w, XTextProperty *text_prop) } declare 103 macosx { Status XStringListToTextProperty(char **list, int count, XTextProperty *text_prop_return) } declare 104 macosx { int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2) } declare 105 macosx { int XWarpPointer(Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy) } declare 106 macosx { int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height) } # New in Tk 8.6 declare 107 macosx { int XFlush(Display *display) } declare 108 macosx { int XGrabServer(Display *display) } declare 109 macosx { int XUngrabServer(Display *display) } declare 110 macosx { int XFree(void *data) } declare 111 macosx { int XNoOp(Display *display) } declare 112 macosx { XAfterFunction XSynchronize(Display *display, Bool onoff) } declare 113 macosx { int XSync(Display *display, Bool discard) } declare 114 macosx { VisualID XVisualIDFromVisual(Visual *visual) } # For tktreectrl declare 120 macosx { int XOffsetRegion(Region rgn, int dx, int dy) } declare 121 macosx { int XUnionRegion(Region srca, Region srcb, Region dr_return) } # For 3dcanvas declare 122 macosx { Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clazz, Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes) } # Various, e.g. for stub-enabled BLT declare 129 macosx { int XLowerWindow(Display *d, Window w) } declare 130 macosx { int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a, int n) } declare 131 macosx { int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n) } declare 132 macosx { int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n) } declare 133 macosx { int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n) } declare 134 macosx { int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y) } declare 135 macosx { int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m) } declare 136 macosx { int XReparentWindow(Display *d, Window w, Window p, int x, int y) } declare 137 macosx { int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h) } declare 138 macosx { Region XPolygonRegion(XPoint *pts, int n, int rule) } declare 139 macosx { int XPointInRegion(Region rgn, int x, int y) } # For XIM declare 140 macosx { XVaNestedList XVaCreateNestedList(int dummy, ...) } declare 141 macosx { char *XSetICValues(XIC xic, ...) } declare 142 macosx { char *XGetICValues(XIC xic, ...) } declare 143 macosx { void XSetICFocus(XIC xic) } declare 147 macosx { void XFreeFontSet(Display *display, XFontSet fontset) } declare 148 macosx { int XCloseIM(XIM im) } declare 149 macosx { |
︙ | ︙ |
Changes to generic/tkInt.h.
1 2 3 4 5 6 | /* * tkInt.h -- * * Declarations for things used internally by the Tk functions but not * exported outside the module. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * tkInt.h -- * * Declarations for things used internally by the Tk functions but not * exported outside the module. * * Copyright © 1990-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. */ #ifndef _TKINT #define _TKINT |
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif #ifdef BYTE_ORDER # ifdef BIG_ENDIAN # if BYTE_ORDER == BIG_ENDIAN # undef WORDS_BIGENDIAN # define WORDS_BIGENDIAN 1 # endif # endif | > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif #include <stdint.h> #include <stdlib.h> #ifdef BYTE_ORDER # ifdef BIG_ENDIAN # if BYTE_ORDER == BIG_ENDIAN # undef WORDS_BIGENDIAN # define WORDS_BIGENDIAN 1 # endif # endif |
︙ | ︙ | |||
69 70 71 72 73 74 75 | # elif defined(__GNUC__) && (__GNUC__ > 2) # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) # else # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) # endif #endif | < < < < < < < | < < < < < < | | < < < < | < | < | | | < | < | > > | > | > > > > | > | | > > > > > > > > > > > > | 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 | # elif defined(__GNUC__) && (__GNUC__ > 2) # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) # else # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) # endif #endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) # define TKFLEXARRAY #elif defined(__GNUC__) && (__GNUC__ > 2) # define TKFLEXARRAY 0 #else # define TKFLEXARRAY 1 #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 !defined(TCL_SIZE_MODIFIER) # define TCL_SIZE_MODIFIER "" #endif /* * Opaque type declarations: */ typedef struct TkColormap TkColormap; typedef struct TkFontAttributes TkFontAttributes; |
︙ | ︙ | |||
152 153 154 155 156 157 158 | * specific cursor files. */ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ | | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | * specific cursor files. */ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ Tcl_Size resourceRefCount; /* Number of active uses of this cursor (each * active use corresponds to a call to * Tk_AllocPreserveFromObj or Tk_Preserve). If * this count is 0, then this structure is no * longer valid and it isn't present in a hash * table: it is being kept around only because * there are objects referring to it. The * structure is freed when resourceRefCount * and objRefCount are both 0. */ Tcl_Size objRefCount; /* Number of Tcl objects that reference this * structure.. */ Tcl_HashTable *otherTable; /* Second table (other than idTable) used to * index this entry. */ Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure * (needed when deleting). */ Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed * when deleting). */ |
︙ | ︙ | |||
242 243 244 245 246 247 248 | * modifier, then this is zero. */ unsigned int altModMask; /* Has one bit set to indicate the modifier * corresponding to the "Meta" key. If no such * modifier, then this is zero. */ TkLockUsage lockUsage; /* Indicates how to interpret lock * modifier. */ | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | * modifier, then this is zero. */ unsigned int altModMask; /* Has one bit set to indicate the modifier * corresponding to the "Meta" key. If no such * modifier, then this is zero. */ TkLockUsage lockUsage; /* Indicates how to interpret lock * modifier. */ Tcl_Size numModKeyCodes; /* Number of entries in modKeyCodes array * below. */ KeyCode *modKeyCodes; /* Pointer to an array giving keycodes for all * of the keys that have modifiers associated * with them. Malloc'ed, but may be NULL. */ /* * Information used by tkBitmap.c only: |
︙ | ︙ | |||
313 314 315 316 317 318 319 | * Information used by tkError.c only: */ struct TkErrorHandler *errorPtr; /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ | | | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | * Information used by tkError.c only: */ struct TkErrorHandler *errorPtr; /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ Tcl_Size deleteCount; /* Counts # of handlers deleted since last * time inactive handlers were garbage- * collected. When this number gets big, * handlers get cleaned up. */ /* * Used by tkEvent.c only: */ |
︙ | ︙ | |||
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; | > > > > > > | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | 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. */ |
︙ | ︙ | |||
529 530 531 532 533 534 535 | #if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIM inputMethod; /* Input method for this display. */ XIMStyle inputStyle; /* Input style selected for this display. */ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ | | < < < < < < < < < < < < < < < | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | #if defined(TK_USE_INPUT_METHODS) || (TCL_MAJOR_VERSION > 8) XIM inputMethod; /* Input method for this display. */ XIMStyle inputStyle; /* Input style selected for this display. */ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ Tcl_Size refCount; /* Reference count of how many Tk applications * are using this display. Used to clean up * the display when we no longer have any Tk * applications using it. */ Tk_Window warpWindow; Tk_Window warpMainwin; /* For finding the root window for warping * purposes. */ int warpX; int warpY; /* |
︙ | ︙ | |||
611 612 613 614 615 616 617 | * request code (-1 means consider all major * codes). */ int minorCode; /* Consider only errors with this minor * request code (-1 means consider all minor * codes). */ Tk_ErrorProc *errorProc; /* Function to invoke when a matching error * occurs. NULL means just ignore errors. */ | | | | | 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 | * request code (-1 means consider all major * codes). */ int minorCode; /* Consider only errors with this minor * request code (-1 means consider all minor * codes). */ Tk_ErrorProc *errorProc; /* Function to invoke when a matching error * occurs. NULL means just ignore errors. */ void *clientData; /* Arbitrary value to pass to errorProc. */ struct TkErrorHandler *nextPtr; /* Pointer to next older handler for this * display, or NULL for end of list. */ } TkErrorHandler; /* * One of the following structures exists for each event handler created by * calling Tk_CreateEventHandler. This information is used by tkEvent.c only. */ typedef struct TkEventHandler { unsigned long mask; /* Events for which to invoke proc. */ Tk_EventProc *proc; /* Function to invoke when an event in mask * occurs. */ void *clientData; /* Argument to pass to proc. */ struct TkEventHandler *nextPtr; /* Next in list of handlers associated with * window (NULL means end of list). */ } TkEventHandler; /* * Tk keeps one of the following data structures for each main window (created * by a call to TkCreateMainWindow). It stores information that is shared by * all of the windows associated with a particular main window. */ typedef struct TkMainInfo { Tcl_Size refCount; /* Number of windows whose "mainPtr" fields * point here. When this becomes zero, can * free up the structure (the reference count * is zero because windows can get deleted in * almost any order; the main window isn't * necessarily the last one deleted). */ struct TkWindow *winPtr; /* Pointer to main window. */ Tcl_Interp *interp; /* Interpreter associated with application. */ |
︙ | ︙ | |||
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. */ | > > > > > > > > > > > > | 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 | 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 unsigned int ttkNbTabsStickBit; /* Information used by ttk::notebook. */ } 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. */ |
︙ | ︙ | |||
800 801 802 803 804 805 806 | #endif /* TK_USE_INPUT_METHODS */ /* * Information used for event bindings (see "bind" and "bindtags" commands * in tkCmds.c): */ | | | | | | 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 | #endif /* TK_USE_INPUT_METHODS */ /* * Information used for event bindings (see "bind" and "bindtags" commands * in tkCmds.c): */ void **tagPtr; /* Points to array of tags used for bindings * on this window. Each tag is a Tk_Uid. * Malloc'ed. NULL means no tags. */ Tcl_Size numTags; /* Number of tags at *tagPtr. */ /* * Information used by tkOption.c to manage options for the window. */ Tcl_Size 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. */ struct TkSelHandler *selHandlerList; /* First in list of handlers for returning the * selection in various forms. */ /* * Information used by tkGeometry.c for geometry management. */ const Tk_GeomMgr *geomMgrPtr; /* Information about geometry manager for this * window. */ void *geomData; /* Argument for geometry manager functions. */ int reqWidth, reqHeight; /* Arguments from last call to * Tk_GeometryRequest, or 0's if * Tk_GeometryRequest hasn't been called. */ int internalBorderLeft; /* Width of internal border of window (0 means * no internal border). Geometry managers * should not normally place children on top * of the border. Fields for the other three |
︙ | ︙ | |||
853 854 855 856 857 858 859 | * NULL. */ /* * Information used by widget classes. */ const Tk_ClassProcs *classProcsPtr; | | | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | * NULL. */ /* * Information used by widget classes. */ const Tk_ClassProcs *classProcsPtr; void *instanceData; /* * Platform specific information private to each port. */ struct TkWindowPrivate *privatePtr; |
︙ | ︙ | |||
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; | > > > > > > > > > > > > > | | < < < < < < < < < > > > > | | 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 | * 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(). */ Tcl_Size charValueLen; /* Length of string in charValuePtr when that * is non-NULL. */ KeySym keysym; /* Key symbol computed after input methods * have been invoked */ #endif } TkKeyEvent; /* * Flags passed to TkpMakeMenuWindow's 'transient' argument. */ #define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */ #define TK_MAKE_MENU_POPUP 1 #define TK_MAKE_MENU_DROPDOWN 2 /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. */ #if (TCL_MAJOR_VERSION < 9) && !defined(Tcl_ObjCmdProc2) #define Tcl_ObjCmdProc2 Tcl_ObjCmdProc #endif typedef struct TkEnsemble { const char *name; Tcl_ObjCmdProc2 *proc; const struct TkEnsemble *subensemble; } TkEnsemble; /* * The following structure is used as a two way map between integers and * strings, usually to map between an internal C representation and the * strings used in Tcl. |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: */ | > > > > > > > > > | | | | | | | | | | 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 | /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: */ typedef struct { Tcl_ObjType objType; size_t version; } TkObjType; #ifndef TCL_OBJTYPE_V0 # define TCL_OBJTYPE_V0 /* just empty */ #endif MODULE_SCOPE const TkObjType tkBorderObjType; MODULE_SCOPE const TkObjType tkBitmapObjType; MODULE_SCOPE const TkObjType tkColorObjType; MODULE_SCOPE const TkObjType tkCursorObjType; MODULE_SCOPE const TkObjType tkFontObjType; MODULE_SCOPE const TkObjType tkStateKeyObjType; MODULE_SCOPE const TkObjType tkTextIndexType; /* * 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 /* | | | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | #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 |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | #include "tkIntDecls.h" #ifdef __cplusplus extern "C" { #endif /* | | > | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < < < | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < < < < | < | | < < | < < | < < | < < | < < | < < | < < | < < | < < < < < | < | | < < | < < | < < < < < | < < | < < | < < | < < | < < | < < | < | < < < < < < < < < < | | | | | | | | | | | | > | | < < < | > > | | 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 | #include "tkIntDecls.h" #ifdef __cplusplus extern "C" { #endif /* * Themed widget set init function, and handler called when Tk is destroyed. */ MODULE_SCOPE int Ttk_Init(Tcl_Interp *interp); MODULE_SCOPE void Ttk_TkDestroyedHandler(Tcl_Interp *interp); /* * Internal functions shared among Tk modules but not exported to the outside * world: */ MODULE_SCOPE Tcl_ObjCmdProc Tk_BellObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_BindObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_BindtagsObjCmd; MODULE_SCOPE Tcl_ObjCmdProc2 Tk_BusyObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ButtonObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_CanvasObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_CheckbuttonObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ClipboardObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ChooseColorObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ChooseDirectoryObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_DestroyObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_EntryObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_EventObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_FrameObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_FocusObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_FontObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_GetOpenFileObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_GetSaveFileObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_GrabObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_GridObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ImageObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_LabelObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_LabelframeObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ListboxObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_LowerObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_MenuObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_MenubuttonObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_MessageBoxObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_MessageObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_PanedWindowObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_OptionObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_PackObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_PlaceObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_RadiobuttonObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_RaiseObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ScaleObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ScrollbarObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_SelectionObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_SendObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_SpinboxObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_TextObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_TkwaitObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_ToplevelObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_UpdateObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_WinfoObjCmd; MODULE_SCOPE Tcl_ObjCmdProc Tk_WmObjCmd; MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp, 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 Tcl_ObjCmdProc TkDeadAppObjCmd; 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); 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, void *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, unsigned pixelStride, unsigned lineStride); MODULE_SCOPE void TkAppendPadAmount(Tcl_Obj *bufferObj, const char *buffer, int pad1, int pad2); MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); MODULE_SCOPE void TkpDrawCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, int x, int y); MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, double x, double y, double angle); MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont, const char *source, Tcl_Size numBytes, Tcl_Size rangeStart, Tcl_Size rangeLength, int maxLength, int flags, int *lengthPtr); MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *string, Tcl_Size numBytes, int x, int y, Tcl_Size firstByte, Tcl_Size lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, int c, struct TkFontAttributes *faPtr); MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, Window parent); MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, Window *parentPtr, Tk_Window tkParent, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv, int flags); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, void *clientData, const TkEnsemble *map); MODULE_SCOPE double TkScalingLevel(Tk_Window tkwin); MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, void *clientData); MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, void *clientData); MODULE_SCOPE void TkInitEmbeddedConfigurationInformation( Tcl_Interp *interp); MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, Tcl_Size, int lastOK, Tcl_Size*); #define TkNewIndexObj(value) (((Tcl_Size)(value) == TCL_INDEX_NONE) ? Tcl_NewObj() : Tcl_NewWideIntObj((Tcl_WideInt)(value))) #define TK_OPTION_UNDERLINE_DEF(type, field) NULL, TCL_INDEX_NONE, offsetof(type, field), TK_OPTION_NULL_OK, NULL #ifdef _WIN32 #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, Colormap map, const char* spec, XColor * colorPtr); |
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 | #define TkSubtractRegion XSubtractRegion #define TkUnionRectWithRegion XUnionRectWithRegion #ifdef HAVE_XFT MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); #endif #if !defined(__cplusplus) && !defined(c_plusplus) # define c_class class #endif | > > | < < | < < < < < < < < | < < < < < | < < | < < < | 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 | #define TkSubtractRegion XSubtractRegion #define TkUnionRectWithRegion XUnionRectWithRegion #ifdef HAVE_XFT MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion); #endif MODULE_SCOPE void TkpCopyRegion(TkRegion dst, TkRegion src); #if !defined(__cplusplus) && !defined(c_plusplus) # define c_class class #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 Tcl_ObjCmdProc TkUnsupported1ObjCmd; /* * For Tktest. */ MODULE_SCOPE Tcl_ObjCmdProc SquareObjCmd; #if !(defined(_WIN32) || defined(MAC_OSX_TK)) #define TkplatformtestInit(x) TCL_OK #else MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); #endif #ifdef __cplusplus |
︙ | ︙ |
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 © 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 |
︙ | ︙ | |||
75 76 77 78 79 80 81 | /* Slot 11 is reserved */ /* 12 */ EXTERN TkCursor * TkCreateCursorFromData(Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 13 */ | | < | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /* Slot 11 is reserved */ /* 12 */ EXTERN TkCursor * TkCreateCursorFromData(Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 13 */ EXTERN int TkCreateFrame(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type, const char *appName); /* 14 */ EXTERN Tk_Window TkCreateMainWindow(Tcl_Interp *interp, const char *screenName, const char *baseName); /* 15 */ EXTERN Time TkCurrentTime(TkDisplay *dispPtr); /* 16 */ EXTERN void TkDeleteAllImages(TkMainInfo *mainPtr); |
︙ | ︙ | |||
137 138 139 140 141 142 143 | Tk_Window tkwin, Tk_Uid string); /* 33 */ EXTERN const char * TkGetDefaultScreenName(Tcl_Interp *interp, const char *screenName); /* 34 */ EXTERN TkDisplay * TkGetDisplay(Display *display); /* 35 */ | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | Tk_Window tkwin, Tk_Uid string); /* 33 */ EXTERN const char * TkGetDefaultScreenName(Tcl_Interp *interp, const char *screenName); /* 34 */ EXTERN TkDisplay * TkGetDisplay(Display *display); /* 35 */ EXTERN Tcl_Size TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 36 */ EXTERN TkWindow * TkGetFocusWin(TkWindow *winPtr); /* 37 */ EXTERN int TkGetInterpNames(Tcl_Interp *interp, Tk_Window tkwin); /* 38 */ EXTERN int TkGetMiterPoints(double p1[], double p2[], |
︙ | ︙ | |||
199 200 201 202 203 204 205 | EXTERN void TkpCloseDisplay(TkDisplay *dispPtr); /* 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); | | < | < | < | < < | < < | 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 | EXTERN void TkpCloseDisplay(TkDisplay *dispPtr); /* 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); /* Slot 60 is reserved */ /* 61 */ EXTERN TkWindow * TkpGetWrapperWindow(TkWindow *winPtr); /* 62 */ EXTERN int TkpInit(Tcl_Interp *interp); /* 63 */ EXTERN void TkpInitializeMenuBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable); /* Slot 64 is reserved */ /* 65 */ EXTERN void TkpMakeMenuWindow(Tk_Window tkwin, int transient); /* Slot 66 is reserved */ /* 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); /* Slot 74 is reserved */ /* Slot 75 is reserved */ /* Slot 76 is reserved */ /* 77 */ EXTERN void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr); /* 78 */ EXTERN int TkReadBitmapFile(Display *display, Drawable d, const char *filename, |
︙ | ︙ | |||
262 263 264 265 266 267 268 | /* 81 */ 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 */ | | < < < | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /* 81 */ 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 */ /* Slot 85 is reserved */ /* 86 */ EXTERN KeySym TkStringToKeysym(const char *name); /* 87 */ EXTERN int TkThickPolyLineToArea(double *coordPtr, int numPoints, double width, int capStyle, int joinStyle, double *rectPtr); /* 88 */ |
︙ | ︙ | |||
326 327 328 329 330 331 332 | Tk_Window tkwin, Tcl_Obj *objPtr, 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); | | < < < < < < < < | < < < | 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 | Tk_Window tkwin, Tcl_Obj *objPtr, 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); /* Slot 111 is reserved */ /* 112 */ EXTERN void TkpMenuThreadInit(void); /* 113 */ EXTERN int XClipBox(Region rgn, XRectangle *rect_return); /* 114 */ EXTERN Region XCreateRegion(void); /* 115 */ EXTERN int XDestroyRegion(Region rgn); /* 116 */ EXTERN int XIntersectRegion(Region sra, Region srcb, Region dr_return); /* 117 */ EXTERN int XRectInRegion(Region rgn, int x, int y, unsigned int width, unsigned int height); /* 118 */ EXTERN int XSetRegion(Display *display, GC gc, Region rgn); /* 119 */ EXTERN int XUnionRectWithRegion(XRectangle *rect, Region src, Region dr_return); /* Slot 120 is reserved */ /* 121 */ EXTERN Pixmap TkpCreateNativeBitmap(Display *display, const void *source); /* 122 */ EXTERN void TkpDefineNativeBitmaps(void); /* Slot 123 is reserved */ /* 124 */ EXTERN Pixmap TkpGetNativeAppBitmap(Display *display, const char *name, int *width, int *height); /* Slot 125 is reserved */ /* Slot 126 is reserved */ /* Slot 127 is reserved */ /* Slot 128 is reserved */ /* Slot 129 is reserved */ /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ /* Slot 135 is reserved */ /* 136 */ EXTERN void TkSetFocusWin(TkWindow *winPtr, int force); /* 137 */ EXTERN void TkpSetKeycodeAndState(Tk_Window tkwin, KeySym keySym, XEvent *eventPtr); /* 138 */ EXTERN KeySym TkpGetKeySym(TkDisplay *dispPtr, XEvent *eventPtr); |
︙ | ︙ | |||
424 425 426 427 428 429 430 | int numPoints); /* 152 */ EXTERN void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 153 */ EXTERN void TkCreateThreadExitHandler(Tcl_ExitProc *proc, | | | | < | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | < < < < | 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 | int numPoints); /* 152 */ EXTERN void TkpDrawFrame(Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 153 */ EXTERN void TkCreateThreadExitHandler(Tcl_ExitProc *proc, void *clientData); /* 154 */ EXTERN void TkDeleteThreadExitHandler(Tcl_ExitProc *proc, void *clientData); /* Slot 155 is reserved */ /* 156 */ EXTERN int TkpTestembedCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 157 */ EXTERN int TkpTesttextCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 158 */ EXTERN int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData); /* 159 */ EXTERN int TkTextGetIndex(Tcl_Interp *interp, struct TkText *textPtr, const char *string, struct TkTextIndex *indexPtr); /* 160 */ EXTERN int TkTextIndexBackBytes(const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr); /* 161 */ EXTERN int TkTextIndexForwBytes(const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr); /* 162 */ EXTERN struct TkTextIndex * TkTextMakeByteIndex(TkTextBTree tree, const struct TkText *textPtr, int lineIndex, Tcl_Size byteIndex, struct TkTextIndex *indexPtr); /* 163 */ EXTERN Tcl_Size TkTextPrintIndex(const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 164 */ EXTERN struct TkTextSegment * TkTextSetMark(struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 165 */ EXTERN int TkTextXviewCmd(struct TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 166 */ EXTERN void TkTextChanged(struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 167 */ EXTERN int TkBTreeNumLines(TkTextBTree tree, const struct TkText *textPtr); /* 168 */ EXTERN void TkTextInsertDisplayProc(struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 169 */ EXTERN int TkStateParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 170 */ EXTERN const char * TkStatePrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 171 */ EXTERN int TkCanvasDashParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 172 */ EXTERN const char * TkCanvasDashPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 173 */ EXTERN int TkOffsetParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 174 */ EXTERN const char * TkOffsetPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 175 */ EXTERN int TkPixelParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 176 */ EXTERN const char * TkPixelPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 177 */ EXTERN int TkOrientParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 178 */ EXTERN const char * TkOrientPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 179 */ EXTERN int TkSmoothParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 180 */ EXTERN const char * TkSmoothPrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 181 */ EXTERN void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, Tcl_Size lastChar); /* 182 */ EXTERN void TkUnderlineAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 183 */ EXTERN int TkIntersectAngledTextLayout(Tk_TextLayout layout, 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, Tcl_Size 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; |
︙ | ︙ | |||
584 585 586 587 588 589 590 | void (*tkBindInit) (TkMainInfo *mainPtr); /* 6 */ void (*tkChangeEventWindow) (XEvent *eventPtr, TkWindow *winPtr); /* 7 */ int (*tkClipInit) (Tcl_Interp *interp, TkDisplay *dispPtr); /* 8 */ void (*tkComputeAnchor) (Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int *xPtr, int *yPtr); /* 9 */ void (*reserved10)(void); void (*reserved11)(void); TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */ | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | void (*tkBindInit) (TkMainInfo *mainPtr); /* 6 */ void (*tkChangeEventWindow) (XEvent *eventPtr, TkWindow *winPtr); /* 7 */ int (*tkClipInit) (Tcl_Interp *interp, TkDisplay *dispPtr); /* 8 */ void (*tkComputeAnchor) (Tk_Anchor anchor, Tk_Window tkwin, int padX, int padY, int innerWidth, int innerHeight, int *xPtr, int *yPtr); /* 9 */ void (*reserved10)(void); void (*reserved11)(void); TkCursor * (*tkCreateCursorFromData) (Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, XColor fg, XColor bg); /* 12 */ int (*tkCreateFrame) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int type, const char *appName); /* 13 */ Tk_Window (*tkCreateMainWindow) (Tcl_Interp *interp, const char *screenName, const char *baseName); /* 14 */ Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */ void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */ void (*tkDoConfigureNotify) (TkWindow *winPtr); /* 17 */ void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */ void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */ void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */ |
︙ | ︙ | |||
606 607 608 609 610 611 612 | void (*tkFreeBindingTags) (TkWindow *winPtr); /* 28 */ void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */ char * (*tkGetBitmapData) (Tcl_Interp *interp, const char *string, const char *fileName, int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr); /* 30 */ void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */ TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */ const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */ TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */ | | | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | void (*tkFreeBindingTags) (TkWindow *winPtr); /* 28 */ void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */ char * (*tkGetBitmapData) (Tcl_Interp *interp, const char *string, const char *fileName, int *widthPtr, int *heightPtr, int *hotXPtr, int *hotYPtr); /* 30 */ void (*tkGetButtPoints) (double p1[], double p2[], double width, int project, double m1[], double m2[]); /* 31 */ TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */ const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */ TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */ Tcl_Size (*tkGetDisplayOf) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */ TkWindow * (*tkGetFocusWin) (TkWindow *winPtr); /* 36 */ int (*tkGetInterpNames) (Tcl_Interp *interp, Tk_Window tkwin); /* 37 */ int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */ void (*tkGetPointerCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 39 */ void (*tkGetServerInfo) (Tcl_Interp *interp, Tk_Window tkwin); /* 40 */ void (*tkGrabDeadWindow) (TkWindow *winPtr); /* 41 */ int (*tkGrabState) (TkWindow *winPtr); /* 42 */ |
︙ | ︙ | |||
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 */ | | | | | | | | 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 | 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 */ void (*reserved60)(void); TkWindow * (*tkpGetWrapperWindow) (TkWindow *winPtr); /* 61 */ int (*tkpInit) (Tcl_Interp *interp); /* 62 */ void (*tkpInitializeMenuBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable); /* 63 */ void (*reserved64)(void); void (*tkpMakeMenuWindow) (Tk_Window tkwin, int transient); /* 65 */ void (*reserved66)(void); 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 */ void (*reserved74)(void); void (*reserved75)(void); 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); void (*reserved85)(void); 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 */ | | < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < < < < < < < < < | 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 | 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 */ void (*reserved111)(void); 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 */ int (*xUnionRectWithRegion) (XRectangle *rect, Region src, Region dr_return); /* 119 */ void (*reserved120)(void); Pixmap (*tkpCreateNativeBitmap) (Display *display, const void *source); /* 121 */ void (*tkpDefineNativeBitmaps) (void); /* 122 */ void (*reserved123)(void); Pixmap (*tkpGetNativeAppBitmap) (Display *display, const char *name, int *width, int *height); /* 124 */ void (*reserved125)(void); void (*reserved126)(void); void (*reserved127)(void); void (*reserved128)(void); void (*reserved129)(void); void (*reserved130)(void); void (*reserved131)(void); void (*reserved132)(void); void (*reserved133)(void); void (*reserved134)(void); void (*reserved135)(void); 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 */ void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */ void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */ int (*xSubtractRegion) (Region sra, Region srcb, Region dr_return); /* 145 */ void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */ void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */ Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, const char *cmdName); /* 148 */ const Tk_OptionSpec * (*tkGetOptionSpec) (const char *name, Tk_OptionTable optionTable); /* 149 */ int (*tkMakeRawCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 150 */ void (*tkMakeRawCurvePostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 151 */ void (*tkpDrawFrame) (Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); /* 152 */ void (*tkCreateThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 153 */ void (*tkDeleteThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 154 */ void (*reserved155)(void); int (*tkpTestembedCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 156 */ int (*tkpTesttextCmd) (void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 157 */ int (*tkSelGetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData); /* 158 */ int (*tkTextGetIndex) (Tcl_Interp *interp, struct TkText *textPtr, const char *string, struct TkTextIndex *indexPtr); /* 159 */ int (*tkTextIndexBackBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr); /* 160 */ int (*tkTextIndexForwBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, Tcl_Size count, struct TkTextIndex *dstPtr); /* 161 */ struct TkTextIndex * (*tkTextMakeByteIndex) (TkTextBTree tree, const struct TkText *textPtr, int lineIndex, Tcl_Size byteIndex, struct TkTextIndex *indexPtr); /* 162 */ Tcl_Size (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */ struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */ int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 165 */ void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */ int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */ void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */ int (*tkStateParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 169 */ const char * (*tkStatePrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 170 */ int (*tkCanvasDashParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 171 */ const char * (*tkCanvasDashPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 172 */ int (*tkOffsetParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 173 */ const char * (*tkOffsetPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 174 */ int (*tkPixelParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 175 */ const char * (*tkPixelPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 176 */ int (*tkOrientParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 177 */ const char * (*tkOrientPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); /* 179 */ const char * (*tkSmoothPrintProc) (void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); /* 180 */ void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, Tcl_Size firstChar, Tcl_Size 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, Tcl_Size 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 } |
︙ | ︙ | |||
933 934 935 936 937 938 939 | (tkIntStubsPtr->tkpCloseDisplay) /* 56 */ #define TkpClaimFocus \ (tkIntStubsPtr->tkpClaimFocus) /* 57 */ #define TkpDisplayWarning \ (tkIntStubsPtr->tkpDisplayWarning) /* 58 */ #define TkpGetAppName \ (tkIntStubsPtr->tkpGetAppName) /* 59 */ | | < | < < < > | < < | | < | 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 | (tkIntStubsPtr->tkpCloseDisplay) /* 56 */ #define TkpClaimFocus \ (tkIntStubsPtr->tkpClaimFocus) /* 57 */ #define TkpDisplayWarning \ (tkIntStubsPtr->tkpDisplayWarning) /* 58 */ #define TkpGetAppName \ (tkIntStubsPtr->tkpGetAppName) /* 59 */ /* Slot 60 is reserved */ #define TkpGetWrapperWindow \ (tkIntStubsPtr->tkpGetWrapperWindow) /* 61 */ #define TkpInit \ (tkIntStubsPtr->tkpInit) /* 62 */ #define TkpInitializeMenuBindings \ (tkIntStubsPtr->tkpInitializeMenuBindings) /* 63 */ /* Slot 64 is reserved */ #define TkpMakeMenuWindow \ (tkIntStubsPtr->tkpMakeMenuWindow) /* 65 */ /* Slot 66 is reserved */ #define TkpMenuNotifyToplevelCreate \ (tkIntStubsPtr->tkpMenuNotifyToplevelCreate) /* 67 */ #define TkpOpenDisplay \ (tkIntStubsPtr->tkpOpenDisplay) /* 68 */ #define TkPointerEvent \ (tkIntStubsPtr->tkPointerEvent) /* 69 */ #define TkPolygonToArea \ (tkIntStubsPtr->tkPolygonToArea) /* 70 */ #define TkPolygonToPoint \ (tkIntStubsPtr->tkPolygonToPoint) /* 71 */ #define TkPositionInTree \ (tkIntStubsPtr->tkPositionInTree) /* 72 */ #define TkpRedirectKeyEvent \ (tkIntStubsPtr->tkpRedirectKeyEvent) /* 73 */ /* Slot 74 is reserved */ /* Slot 75 is reserved */ /* Slot 76 is reserved */ #define TkQueueEventForAllChildren \ (tkIntStubsPtr->tkQueueEventForAllChildren) /* 77 */ #define TkReadBitmapFile \ (tkIntStubsPtr->tkReadBitmapFile) /* 78 */ #define TkScrollWindow \ (tkIntStubsPtr->tkScrollWindow) /* 79 */ #define TkSelDeadWindow \ (tkIntStubsPtr->tkSelDeadWindow) /* 80 */ #define TkSelEventProc \ (tkIntStubsPtr->tkSelEventProc) /* 81 */ #define TkSelInit \ (tkIntStubsPtr->tkSelInit) /* 82 */ #define TkSelPropProc \ (tkIntStubsPtr->tkSelPropProc) /* 83 */ /* Slot 84 is reserved */ /* Slot 85 is reserved */ #define TkStringToKeysym \ (tkIntStubsPtr->tkStringToKeysym) /* 86 */ #define TkThickPolyLineToArea \ (tkIntStubsPtr->tkThickPolyLineToArea) /* 87 */ #define TkWmAddToColormapWindows \ (tkIntStubsPtr->tkWmAddToColormapWindows) /* 88 */ #define TkWmDeadWindow \ |
︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | (tkIntStubsPtr->tkGetMainInfoList) /* 107 */ #define TkGetWindowFromObj \ (tkIntStubsPtr->tkGetWindowFromObj) /* 108 */ #define TkpGetString \ (tkIntStubsPtr->tkpGetString) /* 109 */ #define TkpGetSubFonts \ (tkIntStubsPtr->tkpGetSubFonts) /* 110 */ | < | < < < < < < < | | 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 | (tkIntStubsPtr->tkGetMainInfoList) /* 107 */ #define TkGetWindowFromObj \ (tkIntStubsPtr->tkGetWindowFromObj) /* 108 */ #define TkpGetString \ (tkIntStubsPtr->tkpGetString) /* 109 */ #define TkpGetSubFonts \ (tkIntStubsPtr->tkpGetSubFonts) /* 110 */ /* Slot 111 is reserved */ #define TkpMenuThreadInit \ (tkIntStubsPtr->tkpMenuThreadInit) /* 112 */ #define XClipBox \ (tkIntStubsPtr->xClipBox) /* 113 */ #define XCreateRegion \ (tkIntStubsPtr->xCreateRegion) /* 114 */ #define XDestroyRegion \ (tkIntStubsPtr->xDestroyRegion) /* 115 */ #define XIntersectRegion \ (tkIntStubsPtr->xIntersectRegion) /* 116 */ #define XRectInRegion \ (tkIntStubsPtr->xRectInRegion) /* 117 */ #define XSetRegion \ (tkIntStubsPtr->xSetRegion) /* 118 */ #define XUnionRectWithRegion \ (tkIntStubsPtr->xUnionRectWithRegion) /* 119 */ /* Slot 120 is reserved */ #define TkpCreateNativeBitmap \ (tkIntStubsPtr->tkpCreateNativeBitmap) /* 121 */ #define TkpDefineNativeBitmaps \ (tkIntStubsPtr->tkpDefineNativeBitmaps) /* 122 */ /* Slot 123 is reserved */ #define TkpGetNativeAppBitmap \ (tkIntStubsPtr->tkpGetNativeAppBitmap) /* 124 */ /* Slot 125 is reserved */ /* Slot 126 is reserved */ /* Slot 127 is reserved */ /* Slot 128 is reserved */ /* Slot 129 is reserved */ /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ /* Slot 133 is reserved */ /* Slot 134 is reserved */ /* Slot 135 is reserved */ #define TkSetFocusWin \ (tkIntStubsPtr->tkSetFocusWin) /* 136 */ #define TkpSetKeycodeAndState \ (tkIntStubsPtr->tkpSetKeycodeAndState) /* 137 */ #define TkpGetKeySym \ (tkIntStubsPtr->tkpGetKeySym) /* 138 */ #define TkpInitKeymapInfo \ |
︙ | ︙ | |||
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 */ | < < < < < < < < < < < < < | > > > > > > | 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 | (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 #if !defined(MAC_OSX_TK) && !defined(USE_TK_STUBS) # undef TkpWillDrawWidget # undef TkpRedrawWidget # undef TkpDefineNativeBitmaps # undef TkpCreateNativeBitmap # undef TkpGetNativeAppBitmap # define TkpWillDrawWidget(w) 0 # define TkpRedrawWidget(w) # define TkpDefineNativeBitmaps() # define TkpCreateNativeBitmap(display, source) None # define TkpGetNativeAppBitmap(display, name, w, h) None #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 © 1998-1999 Scriptics Corporation. * All rights reserved. */ #ifndef _TKINTPLATDECLS #define _TKINTPLATDECLS #ifdef BUILD_tk |
︙ | ︙ | |||
32 33 34 35 36 37 38 | /* * Exported function declarations: */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ | | < | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* * Exported function declarations: */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN void TkCreateXEventSource(void); /* Slot 1 is reserved */ /* 2 */ EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, int active); /* 3 */ EXTERN unsigned long TkpGetMS(void); /* 4 */ |
︙ | ︙ | |||
99 100 101 102 103 104 105 | EXTERN void TkWinSetMenu(Tk_Window tkwin, HMENU hMenu); /* 26 */ EXTERN void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos); /* 27 */ EXTERN void TkWinWmCleanup(HINSTANCE hInstance); /* 28 */ | | | > | < | < | > | | < < | | | > | | | > | < < | < | 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 | EXTERN void TkWinSetMenu(Tk_Window tkwin, HMENU hMenu); /* 26 */ EXTERN void TkWinSetWindowPos(HWND hwnd, HWND siblingHwnd, int pos); /* 27 */ EXTERN void TkWinWmCleanup(HINSTANCE hInstance); /* 28 */ EXTERN void TkWinXCleanup(void *clientData); /* 29 */ EXTERN void TkWinXInit(HINSTANCE hInstance); /* 30 */ EXTERN void TkWinSetForegroundWindow(TkWindow *winPtr); /* 31 */ EXTERN void TkWinDialogDebug(int debug); /* 32 */ EXTERN Tcl_Obj * TkWinGetMenuSystemDefault(Tk_Window tkwin, const char *dbName, const char *className); /* 33 */ EXTERN char * TkAlignImageData(XImage *image, int alignment, int bitOrder); /* 34 */ EXTERN void TkWinSetHINSTANCE(HINSTANCE hInstance); /* 35 */ EXTERN int TkWinGetPlatformTheme(void); /* 36 */ EXTERN LRESULT __stdcall TkWinChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* Slot 37 is reserved */ /* 38 */ EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); /* 39 */ EXTERN void TkpSync(Display *display); /* 40 */ EXTERN Window TkUnixContainerId(TkWindow *winPtr); /* 41 */ EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); /* 42 */ EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); /* 43 */ EXTERN void TkWmCleanup(TkDisplay *dispPtr); /* 44 */ EXTERN void TkSendCleanup(TkDisplay *dispPtr); /* 45 */ EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* Slot 46 is reserved */ /* 47 */ EXTERN Tk_Window TkpGetCapture(void); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ /* 1 */ EXTERN void TkAboutDlg(void); /* 2 */ EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, int active); /* 3 */ EXTERN unsigned long TkpGetMS(void); /* 4 */ EXTERN void TkPointerDeadWindow(TkWindow *winPtr); /* 5 */ EXTERN void TkpSetCursor(TkpCursor cursor); /* 6 */ EXTERN int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr); /* 7 */ EXTERN int TkpWmSetState(TkWindow *winPtr, int state); /* 8 */ EXTERN unsigned int TkMacOSXButtonKeyState(void); /* 9 */ EXTERN void TkMacOSXClearMenubarActive(void); /* 10 */ EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index); /* 11 */ EXTERN void TkpSetCapture(TkWindow *winPtr); /* 12 */ EXTERN void TkMacOSXHandleTearoffMenu(void); /* Slot 13 is reserved */ /* 14 */ EXTERN int TkMacOSXDoHLEvent(void *theEvent); /* Slot 15 is reserved */ /* 16 */ EXTERN Window TkMacOSXGetXWindow(void *macWinPtr); /* 17 */ EXTERN int TkMacOSXGrowToplevel(void *whichWindow, XPoint start); /* 18 */ EXTERN void TkMacOSXHandleMenuSelect(short theMenu, unsigned short theItem, int optionKeyPressed); /* Slot 19 is reserved */ /* Slot 20 is reserved */ /* 21 */ EXTERN void TkMacOSXInvalidateWindow(MacDrawable *macWin, int flag); /* Slot 22 is reserved */ /* 23 */ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr); /* 24 */ EXTERN void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2); /* 25 */ EXTERN void TkMacOSXMenuClick(void); /* Slot 26 is reserved */ /* 27 */ EXTERN int TkMacOSXResizable(TkWindow *winPtr); /* 28 */ EXTERN void TkMacOSXSetHelpMenuItemCount(void); /* 29 */ EXTERN void TkMacOSXSetScrollbarGrow(TkWindow *winPtr, int flag); /* Slot 30 is reserved */ /* 31 */ EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort); /* 32 */ EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr); /* Slot 33 is reserved */ /* 34 */ EXTERN int TkMacOSXUseMenuID(short macID); |
︙ | ︙ | |||
248 249 250 251 252 253 254 | /* 50 */ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); /* 51 */ EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); /* 52 */ EXTERN void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag); | < < < < < < < | < | < | < < < < < > > | | < | < | < < < | 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 | /* 50 */ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); /* 51 */ EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); /* 52 */ EXTERN void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag); #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ /* 0 */ EXTERN void TkCreateXEventSource(void); /* Slot 1 is reserved */ /* 2 */ EXTERN void TkGenerateActivateEvents(TkWindow *winPtr, int active); /* Slot 3 is reserved */ /* Slot 4 is reserved */ /* Slot 5 is reserved */ /* 6 */ EXTERN int TkpScanWindowId(Tcl_Interp *interp, const char *string, Window *idPtr); /* Slot 7 is reserved */ /* Slot 8 is reserved */ /* 9 */ EXTERN int TkpWmSetState(TkWindow *winPtr, int state); /* Slot 10 is reserved */ /* Slot 11 is reserved */ /* Slot 12 is reserved */ /* Slot 13 is reserved */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ /* Slot 18 is reserved */ /* Slot 19 is reserved */ /* Slot 20 is reserved */ |
︙ | ︙ | |||
312 313 314 315 316 317 318 | /* Slot 32 is reserved */ /* Slot 33 is reserved */ /* Slot 34 is reserved */ /* Slot 35 is reserved */ /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* 38 */ | | | | | | | | | < | | | 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 | /* Slot 32 is reserved */ /* Slot 33 is reserved */ /* Slot 34 is reserved */ /* Slot 35 is reserved */ /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* 38 */ EXTERN int TkpCmapStressed(Tk_Window tkwin, Colormap colormap); /* 39 */ EXTERN void TkpSync(Display *display); /* 40 */ EXTERN Window TkUnixContainerId(TkWindow *winPtr); /* 41 */ EXTERN int TkUnixDoOneXEvent(Tcl_Time *timePtr); /* 42 */ EXTERN void TkUnixSetMenubar(Tk_Window tkwin, Tk_Window menubar); /* 43 */ EXTERN void TkWmCleanup(TkDisplay *dispPtr); /* 44 */ EXTERN void TkSendCleanup(TkDisplay *dispPtr); /* 45 */ EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); #endif /* X11 */ typedef struct TkIntPlatStubs { int magic; void *hooks; #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ unsigned long (*tkpGetMS) (void); /* 3 */ void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 4 */ void (*tkpPrintWindowId) (char *buf, Window window); /* 5 */ int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 6 */ void (*tkpSetCapture) (TkWindow *winPtr); /* 7 */ |
︙ | ︙ | |||
364 365 366 367 368 369 370 | int (*tkWinIndexOfColor) (XColor *colorPtr); /* 21 */ void (*tkWinReleaseDrawableDC) (Drawable d, HDC hdc, TkWinDCState *state); /* 22 */ LRESULT (*tkWinResendEvent) (WNDPROC wndproc, HWND hwnd, XEvent *eventPtr); /* 23 */ HPALETTE (*tkWinSelectPalette) (HDC dc, Colormap colormap); /* 24 */ void (*tkWinSetMenu) (Tk_Window tkwin, HMENU hMenu); /* 25 */ void (*tkWinSetWindowPos) (HWND hwnd, HWND siblingHwnd, int pos); /* 26 */ void (*tkWinWmCleanup) (HINSTANCE hInstance); /* 27 */ | | | | | < | > | > | < > | < | | | | 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 | int (*tkWinIndexOfColor) (XColor *colorPtr); /* 21 */ void (*tkWinReleaseDrawableDC) (Drawable d, HDC hdc, TkWinDCState *state); /* 22 */ LRESULT (*tkWinResendEvent) (WNDPROC wndproc, HWND hwnd, XEvent *eventPtr); /* 23 */ HPALETTE (*tkWinSelectPalette) (HDC dc, Colormap colormap); /* 24 */ void (*tkWinSetMenu) (Tk_Window tkwin, HMENU hMenu); /* 25 */ void (*tkWinSetWindowPos) (HWND hwnd, HWND siblingHwnd, int pos); /* 26 */ void (*tkWinWmCleanup) (HINSTANCE hInstance); /* 27 */ void (*tkWinXCleanup) (void *clientData); /* 28 */ void (*tkWinXInit) (HINSTANCE hInstance); /* 29 */ void (*tkWinSetForegroundWindow) (TkWindow *winPtr); /* 30 */ void (*tkWinDialogDebug) (int debug); /* 31 */ Tcl_Obj * (*tkWinGetMenuSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 32 */ char * (*tkAlignImageData) (XImage *image, int alignment, int bitOrder); /* 33 */ void (*tkWinSetHINSTANCE) (HINSTANCE hInstance); /* 34 */ int (*tkWinGetPlatformTheme) (void); /* 35 */ LRESULT (__stdcall *tkWinChildProc) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /* 36 */ void (*reserved37)(void); int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 38 */ void (*tkpSync) (Display *display); /* 39 */ Window (*tkUnixContainerId) (TkWindow *winPtr); /* 40 */ int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 41 */ void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 45 */ void (*reserved46)(void); Tk_Window (*tkpGetCapture) (void); /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*reserved0)(void); void (*tkAboutDlg) (void); /* 1 */ void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ unsigned long (*tkpGetMS) (void); /* 3 */ void (*tkPointerDeadWindow) (TkWindow *winPtr); /* 4 */ void (*tkpSetCursor) (TkpCursor cursor); /* 5 */ int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 6 */ int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 7 */ unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */ void (*tkMacOSXClearMenubarActive) (void); /* 9 */ int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */ void (*tkpSetCapture) (TkWindow *winPtr); /* 11 */ void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */ void (*reserved13)(void); int (*tkMacOSXDoHLEvent) (void *theEvent); /* 14 */ void (*reserved15)(void); Window (*tkMacOSXGetXWindow) (void *macWinPtr); /* 16 */ int (*tkMacOSXGrowToplevel) (void *whichWindow, XPoint start); /* 17 */ void (*tkMacOSXHandleMenuSelect) (short theMenu, unsigned short theItem, int optionKeyPressed); /* 18 */ void (*reserved19)(void); void (*reserved20)(void); void (*tkMacOSXInvalidateWindow) (MacDrawable *macWin, int flag); /* 21 */ void (*reserved22)(void); void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */ void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */ void (*tkMacOSXMenuClick) (void); /* 25 */ void (*reserved26)(void); int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */ void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */ void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */ void (*reserved30)(void); void (*tkMacOSXSetUpGraphicsPort) (GC gc, void *destPort); /* 31 */ void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */ void (*reserved33)(void); int (*tkMacOSXUseMenuID) (short macID); /* 34 */ Region (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */ void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */ void (*tkMacOSXWindowOffset) (void *wRef, int *xOffset, int *yOffset); /* 37 */ |
︙ | ︙ | |||
439 440 441 442 443 444 445 | int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkpGetCapture) (void); /* 47 */ void (*reserved48)(void); Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ | < < < | | < < | | | < | | > > > | | 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 | int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkpGetCapture) (void); /* 47 */ void (*reserved48)(void); Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) (void); /* 0 */ void (*reserved1)(void); void (*tkGenerateActivateEvents) (TkWindow *winPtr, int active); /* 2 */ void (*reserved3)(void); void (*reserved4)(void); void (*reserved5)(void); int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 6 */ void (*reserved7)(void); void (*reserved8)(void); int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 9 */ void (*reserved10)(void); void (*reserved11)(void); void (*reserved12)(void); void (*reserved13)(void); void (*reserved14)(void); void (*reserved15)(void); void (*reserved16)(void); void (*reserved17)(void); void (*reserved18)(void); void (*reserved19)(void); void (*reserved20)(void); |
︙ | ︙ | |||
482 483 484 485 486 487 488 | void (*reserved31)(void); void (*reserved32)(void); void (*reserved33)(void); void (*reserved34)(void); void (*reserved35)(void); void (*reserved36)(void); void (*reserved37)(void); | | | | | | | | | | | | 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 | void (*reserved31)(void); void (*reserved32)(void); void (*reserved33)(void); void (*reserved34)(void); void (*reserved35)(void); void (*reserved36)(void); void (*reserved37)(void); int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 38 */ void (*tkpSync) (Display *display); /* 39 */ Window (*tkUnixContainerId) (TkWindow *winPtr); /* 40 */ int (*tkUnixDoOneXEvent) (Tcl_Time *timePtr); /* 41 */ void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 45 */ #endif /* X11 */ } TkIntPlatStubs; extern const TkIntPlatStubs *tkIntPlatStubsPtr; #ifdef __cplusplus } #endif #if defined(USE_TK_STUBS) /* * Inline function declarations: */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ /* Slot 1 is reserved */ #define TkGenerateActivateEvents \ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ #define TkpGetMS \ (tkIntPlatStubsPtr->tkpGetMS) /* 3 */ #define TkPointerDeadWindow \ (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 4 */ |
︙ | ︙ | |||
571 572 573 574 575 576 577 | (tkIntPlatStubsPtr->tkWinXInit) /* 29 */ #define TkWinSetForegroundWindow \ (tkIntPlatStubsPtr->tkWinSetForegroundWindow) /* 30 */ #define TkWinDialogDebug \ (tkIntPlatStubsPtr->tkWinDialogDebug) /* 31 */ #define TkWinGetMenuSystemDefault \ (tkIntPlatStubsPtr->tkWinGetMenuSystemDefault) /* 32 */ | | | | < | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | (tkIntPlatStubsPtr->tkWinXInit) /* 29 */ #define TkWinSetForegroundWindow \ (tkIntPlatStubsPtr->tkWinSetForegroundWindow) /* 30 */ #define TkWinDialogDebug \ (tkIntPlatStubsPtr->tkWinDialogDebug) /* 31 */ #define TkWinGetMenuSystemDefault \ (tkIntPlatStubsPtr->tkWinGetMenuSystemDefault) /* 32 */ #define TkAlignImageData \ (tkIntPlatStubsPtr->tkAlignImageData) /* 33 */ #define TkWinSetHINSTANCE \ (tkIntPlatStubsPtr->tkWinSetHINSTANCE) /* 34 */ #define TkWinGetPlatformTheme \ (tkIntPlatStubsPtr->tkWinGetPlatformTheme) /* 35 */ #define TkWinChildProc \ (tkIntPlatStubsPtr->tkWinChildProc) /* 36 */ /* Slot 37 is reserved */ #define TkpCmapStressed \ (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ #define TkpSync \ (tkIntPlatStubsPtr->tkpSync) /* 39 */ #define TkUnixContainerId \ (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ #define TkUnixDoOneXEvent \ |
︙ | ︙ | |||
602 603 604 605 606 607 608 609 | #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ /* Slot 46 is reserved */ #define TkpGetCapture \ (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define TkGenerateActivateEvents \ | > > > | < | | | | | | | | < < | > | < | < | 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 | #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ /* Slot 46 is reserved */ #define TkpGetCapture \ (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ #define TkAboutDlg \ (tkIntPlatStubsPtr->tkAboutDlg) /* 1 */ #define TkGenerateActivateEvents \ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ #define TkpGetMS \ (tkIntPlatStubsPtr->tkpGetMS) /* 3 */ #define TkPointerDeadWindow \ (tkIntPlatStubsPtr->tkPointerDeadWindow) /* 4 */ #define TkpSetCursor \ (tkIntPlatStubsPtr->tkpSetCursor) /* 5 */ #define TkpScanWindowId \ (tkIntPlatStubsPtr->tkpScanWindowId) /* 6 */ #define TkpWmSetState \ (tkIntPlatStubsPtr->tkpWmSetState) /* 7 */ #define TkMacOSXButtonKeyState \ (tkIntPlatStubsPtr->tkMacOSXButtonKeyState) /* 8 */ #define TkMacOSXClearMenubarActive \ (tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */ #define TkMacOSXDispatchMenuEvent \ (tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */ #define TkpSetCapture \ (tkIntPlatStubsPtr->tkpSetCapture) /* 11 */ #define TkMacOSXHandleTearoffMenu \ (tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */ /* Slot 13 is reserved */ #define TkMacOSXDoHLEvent \ (tkIntPlatStubsPtr->tkMacOSXDoHLEvent) /* 14 */ /* Slot 15 is reserved */ #define TkMacOSXGetXWindow \ (tkIntPlatStubsPtr->tkMacOSXGetXWindow) /* 16 */ #define TkMacOSXGrowToplevel \ (tkIntPlatStubsPtr->tkMacOSXGrowToplevel) /* 17 */ #define TkMacOSXHandleMenuSelect \ (tkIntPlatStubsPtr->tkMacOSXHandleMenuSelect) /* 18 */ /* Slot 19 is reserved */ /* Slot 20 is reserved */ #define TkMacOSXInvalidateWindow \ (tkIntPlatStubsPtr->tkMacOSXInvalidateWindow) /* 21 */ /* Slot 22 is reserved */ #define TkMacOSXMakeRealWindowExist \ (tkIntPlatStubsPtr->tkMacOSXMakeRealWindowExist) /* 23 */ #define TkMacOSXMakeStippleMap \ (tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */ #define TkMacOSXMenuClick \ (tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */ /* Slot 26 is reserved */ #define TkMacOSXResizable \ (tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */ #define TkMacOSXSetHelpMenuItemCount \ (tkIntPlatStubsPtr->tkMacOSXSetHelpMenuItemCount) /* 28 */ #define TkMacOSXSetScrollbarGrow \ (tkIntPlatStubsPtr->tkMacOSXSetScrollbarGrow) /* 29 */ /* Slot 30 is reserved */ #define TkMacOSXSetUpGraphicsPort \ (tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */ #define TkMacOSXUpdateClipRgn \ (tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */ /* Slot 33 is reserved */ #define TkMacOSXUseMenuID \ (tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */ |
︙ | ︙ | |||
698 699 700 701 702 703 704 | (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */ #define TkGenerateButtonEvent \ (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */ #define TkGenWMDestroyEvent \ (tkIntPlatStubsPtr->tkGenWMDestroyEvent) /* 51 */ #define TkMacOSXSetDrawingEnabled \ (tkIntPlatStubsPtr->tkMacOSXSetDrawingEnabled) /* 52 */ | < < < < < < | | < | < < < < < < | < < < < | > | < < > > > > | 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 | (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */ #define TkGenerateButtonEvent \ (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */ #define TkGenWMDestroyEvent \ (tkIntPlatStubsPtr->tkGenWMDestroyEvent) /* 51 */ #define TkMacOSXSetDrawingEnabled \ (tkIntPlatStubsPtr->tkMacOSXSetDrawingEnabled) /* 52 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ /* Slot 1 is reserved */ #define TkGenerateActivateEvents \ (tkIntPlatStubsPtr->tkGenerateActivateEvents) /* 2 */ /* Slot 3 is reserved */ /* Slot 4 is reserved */ /* Slot 5 is reserved */ #define TkpScanWindowId \ (tkIntPlatStubsPtr->tkpScanWindowId) /* 6 */ /* Slot 7 is reserved */ /* Slot 8 is reserved */ #define TkpWmSetState \ (tkIntPlatStubsPtr->tkpWmSetState) /* 9 */ /* Slot 10 is reserved */ /* Slot 11 is reserved */ /* Slot 12 is reserved */ /* Slot 13 is reserved */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ /* Slot 17 is reserved */ /* Slot 18 is reserved */ /* Slot 19 is reserved */ /* Slot 20 is reserved */ |
︙ | ︙ | |||
756 757 758 759 760 761 762 | /* Slot 31 is reserved */ /* Slot 32 is reserved */ /* Slot 33 is reserved */ /* Slot 34 is reserved */ /* Slot 35 is reserved */ /* Slot 36 is reserved */ /* Slot 37 is reserved */ | | | | | | | | | | | | | | | | | | | < < < < | < < < < < < | 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 | /* Slot 31 is reserved */ /* Slot 32 is reserved */ /* Slot 33 is reserved */ /* Slot 34 is reserved */ /* Slot 35 is reserved */ /* Slot 36 is reserved */ /* Slot 37 is reserved */ #define TkpCmapStressed \ (tkIntPlatStubsPtr->tkpCmapStressed) /* 38 */ #define TkpSync \ (tkIntPlatStubsPtr->tkpSync) /* 39 */ #define TkUnixContainerId \ (tkIntPlatStubsPtr->tkUnixContainerId) /* 40 */ #define TkUnixDoOneXEvent \ (tkIntPlatStubsPtr->tkUnixDoOneXEvent) /* 41 */ #define TkUnixSetMenubar \ (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 42 */ #define TkWmCleanup \ (tkIntPlatStubsPtr->tkWmCleanup) /* 43 */ #define TkSendCleanup \ (tkIntPlatStubsPtr->tkSendCleanup) /* 44 */ #define TkpTestsendCmd \ (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ #endif /* X11 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #ifndef TK_NO_DEPRECATED # define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable #endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKINTPLATDECLS */ |
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 © 1998-1999 Scriptics Corporation. * All rights reserved. */ #ifndef _TKINTXLIBDECLS #define _TKINTXLIBDECLS /* |
︙ | ︙ | |||
277 278 279 280 281 282 283 | char *c, int i, KeySym *k, Status *s); /* 80 */ EXTERN int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); | | > > > | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | char *c, int i, KeySym *k, Status *s); /* 80 */ EXTERN int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 81 */ EXTERN int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 82 */ EXTERN Status XParseColor(Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 83 */ EXTERN GC XCreateGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 84 */ |
︙ | ︙ | |||
491 492 493 494 495 496 497 498 | EXTERN char * XGetAtomName(Display *d, Atom a); /* 5 */ EXTERN char * XKeysymToString(KeySym k); /* 6 */ EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v, int i); /* 7 */ EXTERN GContext XGContextFromGC(GC g); | > > > > > > > > | > > | | | | > > > > > > > | | | | > > | | | | | > > | | | | | | | > > | | > > | | > > | > > > | | | > > > | | | > > > > > > > | > > > | | | | | > > | | | | | | | | | > > > > | | | > > > > > > > > > | > > > > | | | | | | | | | | | | | | | | | | | | | | < < < < < | > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | 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 | EXTERN char * XGetAtomName(Display *d, Atom a); /* 5 */ EXTERN char * XKeysymToString(KeySym k); /* 6 */ EXTERN Colormap XCreateColormap(Display *d, Window w, Visual *v, int i); /* 7 */ EXTERN Cursor XCreatePixmapCursor(Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 8 */ EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 9 */ EXTERN GContext XGContextFromGC(GC g); /* 10 */ EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b); /* 11 */ EXTERN KeySym XKeycodeToKeysym(Display *d, unsigned int k, int i); /* 12 */ EXTERN KeySym XStringToKeysym(_Xconst char *c); /* 13 */ EXTERN Window XRootWindow(Display *d, int i); /* 14 */ EXTERN XErrorHandler XSetErrorHandler(XErrorHandler x); /* 15 */ EXTERN Status XIconifyWindow(Display *d, Window w, int i); /* 16 */ EXTERN Status XWithdrawWindow(Display *d, Window w, int i); /* 17 */ EXTERN Status XGetWMColormapWindows(Display *d, Window w, Window **wpp, int *ip); /* 18 */ EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp); /* 19 */ EXTERN int XBell(Display *d, int i); /* 20 */ EXTERN int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 21 */ EXTERN int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 22 */ EXTERN int XClearWindow(Display *d, Window w); /* 23 */ EXTERN int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x); /* 24 */ EXTERN int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ EXTERN int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 26 */ EXTERN Pixmap XCreateBitmapFromData(Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 27 */ EXTERN int XDefineCursor(Display *d, Window w, Cursor c); /* 28 */ EXTERN int XDeleteProperty(Display *d, Window w, Atom a); /* 29 */ EXTERN int XDestroyWindow(Display *d, Window w); /* 30 */ EXTERN int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 31 */ EXTERN int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 32 */ EXTERN int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 33 */ EXTERN int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 34 */ EXTERN int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 35 */ EXTERN int XFillRectangles(Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 36 */ EXTERN int XForceScreenSaver(Display *d, int i); /* 37 */ EXTERN int XFreeColormap(Display *d, Colormap c); /* 38 */ EXTERN int XFreeColors(Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 39 */ EXTERN int XFreeCursor(Display *d, Cursor c); /* 40 */ EXTERN int XFreeModifiermap(XModifierKeymap *x); /* 41 */ EXTERN Status XGetGeometry(Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 42 */ EXTERN int XGetInputFocus(Display *d, Window *w, int *i); /* 43 */ EXTERN int XGetWindowProperty(Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 44 */ EXTERN Status XGetWindowAttributes(Display *d, Window w, XWindowAttributes *x); /* 45 */ EXTERN int XGrabKeyboard(Display *d, Window w, Bool b, int i1, int i2, Time t); /* 46 */ EXTERN int XGrabPointer(Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 47 */ EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k); /* 48 */ EXTERN Status XLookupColor(Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 49 */ EXTERN int XMapWindow(Display *d, Window w); /* 50 */ EXTERN int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 51 */ EXTERN int XMoveWindow(Display *d, Window w, int i1, int i2); /* 52 */ EXTERN int XNextEvent(Display *d, XEvent *x); /* 53 */ EXTERN int XPutBackEvent(Display *d, XEvent *x); /* 54 */ EXTERN int XQueryColors(Display *d, Colormap c, XColor *x, int i); /* 55 */ EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 56 */ EXTERN Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 57 */ EXTERN int XRaiseWindow(Display *d, Window w); /* 58 */ EXTERN int XRefreshKeyboardMapping(XMappingEvent *x); /* 59 */ EXTERN int XResizeWindow(Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 60 */ EXTERN int XSelectInput(Display *d, Window w, long l); /* 61 */ EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x); /* 62 */ EXTERN int XSetCommand(Display *d, Window w, char **c, int i); /* 63 */ EXTERN int XSetIconName(Display *d, Window w, _Xconst char *c); /* 64 */ EXTERN int XSetInputFocus(Display *d, Window w, int i, Time t); /* 65 */ EXTERN int XSetSelectionOwner(Display *d, Atom a, Window w, Time t); /* 66 */ EXTERN int XSetWindowBackground(Display *d, Window w, unsigned long ul); /* 67 */ EXTERN int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p); /* 68 */ EXTERN int XSetWindowBorder(Display *d, Window w, unsigned long ul); /* 69 */ EXTERN int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p); /* 70 */ EXTERN int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui); /* 71 */ EXTERN int XSetWindowColormap(Display *d, Window w, Colormap c); /* 72 */ EXTERN Bool XTranslateCoordinates(Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 73 */ EXTERN int XUngrabKeyboard(Display *d, Time t); /* 74 */ EXTERN int XUngrabPointer(Display *d, Time t); /* 75 */ EXTERN int XUnmapWindow(Display *d, Window w); /* 76 */ EXTERN int XWindowEvent(Display *d, Window w, long l, XEvent *x); /* 77 */ EXTERN void XDestroyIC(XIC x); /* 78 */ EXTERN Bool XFilterEvent(XEvent *x, Window w); /* 79 */ EXTERN int XmbLookupString(XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 80 */ EXTERN int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 81 */ EXTERN int XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 82 */ EXTERN Status XParseColor(Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 83 */ EXTERN GC XCreateGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 84 */ EXTERN int XFreeGC(Display *display, GC gc); /* 85 */ EXTERN Atom XInternAtom(Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 86 */ EXTERN int XSetBackground(Display *display, GC gc, unsigned long foreground); /* 87 */ EXTERN int XSetForeground(Display *display, GC gc, unsigned long foreground); /* 88 */ EXTERN int XSetClipMask(Display *display, GC gc, Pixmap pixmap); /* 89 */ EXTERN int XSetClipOrigin(Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 90 */ EXTERN int XSetTSOrigin(Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 91 */ EXTERN int XChangeGC(Display *d, GC gc, unsigned long mask, XGCValues *values); /* 92 */ EXTERN int XSetFont(Display *display, GC gc, Font font); /* 93 */ EXTERN int XSetArcMode(Display *display, GC gc, int arc_mode); /* 94 */ EXTERN int XSetStipple(Display *display, GC gc, Pixmap stipple); /* 95 */ EXTERN int XSetFillRule(Display *display, GC gc, int fill_rule); /* 96 */ EXTERN int XSetFillStyle(Display *display, GC gc, int fill_style); /* 97 */ EXTERN int XSetFunction(Display *display, GC gc, int function); /* 98 */ EXTERN int XSetLineAttributes(Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 99 */ EXTERN int _XInitImageFuncPtrs(XImage *image); /* 100 */ EXTERN XIC XCreateIC(XIM xim, ...); /* 101 */ EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 102 */ EXTERN void XSetWMClientMachine(Display *display, Window w, XTextProperty *text_prop); /* 103 */ EXTERN Status XStringListToTextProperty(char **list, int count, XTextProperty *text_prop_return); /* 104 */ EXTERN int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 105 */ EXTERN int XWarpPointer(Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy); /* 106 */ EXTERN int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 107 */ EXTERN int XFlush(Display *display); /* 108 */ EXTERN int XGrabServer(Display *display); /* 109 */ EXTERN int XUngrabServer(Display *display); /* 110 */ EXTERN int XFree(void *data); /* 111 */ EXTERN int XNoOp(Display *display); /* 112 */ EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff); /* 113 */ EXTERN int XSync(Display *display, Bool discard); /* 114 */ EXTERN VisualID XVisualIDFromVisual(Visual *visual); /* Slot 115 is reserved */ /* Slot 116 is reserved */ /* Slot 117 is reserved */ /* Slot 118 is reserved */ /* Slot 119 is reserved */ |
︙ | ︙ | |||
821 822 823 824 825 826 827 | int n); /* 131 */ EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n); /* 132 */ EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n); | | > > | > > | > > | < | < < < | < < < | 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 | int n); /* 131 */ EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n); /* 132 */ EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 133 */ EXTERN int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 134 */ EXTERN int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y); /* 135 */ EXTERN int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 136 */ EXTERN int XReparentWindow(Display *d, Window w, Window p, int x, int y); /* 137 */ EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 138 */ EXTERN Region XPolygonRegion(XPoint *pts, int n, int rule); /* 139 */ EXTERN int XPointInRegion(Region rgn, int x, int y); /* 140 */ EXTERN XVaNestedList XVaCreateNestedList(int dummy, ...); /* 141 */ EXTERN char * XSetICValues(XIC xic, ...); /* 142 */ EXTERN char * XGetICValues(XIC xic, ...); /* 143 */ EXTERN void XSetICFocus(XIC xic); /* Slot 144 is reserved */ /* Slot 145 is reserved */ /* Slot 146 is reserved */ /* 147 */ EXTERN void XFreeFontSet(Display *display, XFontSet fontset); /* 148 */ EXTERN int XCloseIM(XIM im); /* 149 */ EXTERN Bool XRegisterIMInstantiateCallback(Display *dpy, struct _XrmHashBucketRec *rbd, |
︙ | ︙ | |||
979 980 981 982 983 984 985 | int (*xUngrabPointer) (Display *d, Time t); /* 74 */ int (*xUnmapWindow) (Display *d, Window w); /* 75 */ int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 76 */ void (*xDestroyIC) (XIC x); /* 77 */ Bool (*xFilterEvent) (XEvent *x, Window w); /* 78 */ int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 79 */ int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 80 */ | | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | int (*xUngrabPointer) (Display *d, Time t); /* 74 */ int (*xUnmapWindow) (Display *d, Window w); /* 75 */ int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 76 */ void (*xDestroyIC) (XIC x); /* 77 */ Bool (*xFilterEvent) (XEvent *x, Window w); /* 78 */ int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 79 */ int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 80 */ int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 81 */ Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 82 */ GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 83 */ int (*xFreeGC) (Display *display, GC gc); /* 84 */ Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 85 */ int (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 86 */ int (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 87 */ int (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 88 */ |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */ char * (*xKeysymToString) (KeySym k); /* 5 */ Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */ | > > | > | | | | > > > | | | | > | | | | | > | | | | | | | > | | > | | > | > | | | > | | | < | < < < | < | < < | | < < < < < | | | | | | | | | | | | | | | > | | | | | | > | | | | | < | | | | < | | | | | | | | < | | | | | | | | | | | | | | | | | | 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 | int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */ char * (*xKeysymToString) (KeySym k); /* 5 */ Colormap (*xCreateColormap) (Display *d, Window w, Visual *v, int i); /* 6 */ Cursor (*xCreatePixmapCursor) (Display *d, Pixmap p1, Pixmap p2, XColor *x1, XColor *x2, unsigned int ui1, unsigned int ui2); /* 7 */ Cursor (*xCreateGlyphCursor) (Display *d, Font f1, Font f2, unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2); /* 8 */ GContext (*xGContextFromGC) (GC g); /* 9 */ XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 10 */ KeySym (*xKeycodeToKeysym) (Display *d, unsigned int k, int i); /* 11 */ KeySym (*xStringToKeysym) (_Xconst char *c); /* 12 */ Window (*xRootWindow) (Display *d, int i); /* 13 */ XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 14 */ Status (*xIconifyWindow) (Display *d, Window w, int i); /* 15 */ Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 16 */ Status (*xGetWMColormapWindows) (Display *d, Window w, Window **wpp, int *ip); /* 17 */ Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 18 */ int (*xBell) (Display *d, int i); /* 19 */ int (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 20 */ int (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 21 */ int (*xClearWindow) (Display *d, Window w); /* 22 */ int (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 23 */ int (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 24 */ int (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 25 */ Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 26 */ int (*xDefineCursor) (Display *d, Window w, Cursor c); /* 27 */ int (*xDeleteProperty) (Display *d, Window w, Atom a); /* 28 */ int (*xDestroyWindow) (Display *d, Window w); /* 29 */ int (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 30 */ int (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 31 */ int (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 32 */ int (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 33 */ int (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 34 */ int (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 35 */ int (*xForceScreenSaver) (Display *d, int i); /* 36 */ int (*xFreeColormap) (Display *d, Colormap c); /* 37 */ int (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 38 */ int (*xFreeCursor) (Display *d, Cursor c); /* 39 */ int (*xFreeModifiermap) (XModifierKeymap *x); /* 40 */ Status (*xGetGeometry) (Display *d, Drawable dr, Window *w, int *i1, int *i2, unsigned int *ui1, unsigned int *ui2, unsigned int *ui3, unsigned int *ui4); /* 41 */ int (*xGetInputFocus) (Display *d, Window *w, int *i); /* 42 */ int (*xGetWindowProperty) (Display *d, Window w, Atom a1, long l1, long l2, Bool b, Atom a2, Atom *ap, int *ip, unsigned long *ulp1, unsigned long *ulp2, unsigned char **cpp); /* 43 */ Status (*xGetWindowAttributes) (Display *d, Window w, XWindowAttributes *x); /* 44 */ int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 45 */ int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 46 */ KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 47 */ Status (*xLookupColor) (Display *d, Colormap c1, _Xconst char *c2, XColor *x1, XColor *x2); /* 48 */ int (*xMapWindow) (Display *d, Window w); /* 49 */ int (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 50 */ int (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 51 */ int (*xNextEvent) (Display *d, XEvent *x); /* 52 */ int (*xPutBackEvent) (Display *d, XEvent *x); /* 53 */ int (*xQueryColors) (Display *d, Colormap c, XColor *x, int i); /* 54 */ Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 55 */ Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 56 */ int (*xRaiseWindow) (Display *d, Window w); /* 57 */ int (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 58 */ int (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 59 */ int (*xSelectInput) (Display *d, Window w, long l); /* 60 */ Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 61 */ int (*xSetCommand) (Display *d, Window w, char **c, int i); /* 62 */ int (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 63 */ int (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 64 */ int (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 65 */ int (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 66 */ int (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 67 */ int (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 68 */ int (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 69 */ int (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 70 */ int (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 71 */ Bool (*xTranslateCoordinates) (Display *d, Window w1, Window w2, int i1, int i2, int *i3, int *i4, Window *w3); /* 72 */ int (*xUngrabKeyboard) (Display *d, Time t); /* 73 */ int (*xUngrabPointer) (Display *d, Time t); /* 74 */ int (*xUnmapWindow) (Display *d, Window w); /* 75 */ int (*xWindowEvent) (Display *d, Window w, long l, XEvent *x); /* 76 */ void (*xDestroyIC) (XIC x); /* 77 */ Bool (*xFilterEvent) (XEvent *x, Window w); /* 78 */ int (*xmbLookupString) (XIC xi, XKeyPressedEvent *xk, char *c, int i, KeySym *k, Status *s); /* 79 */ int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 80 */ int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 81 */ Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 82 */ GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 83 */ int (*xFreeGC) (Display *display, GC gc); /* 84 */ Atom (*xInternAtom) (Display *display, _Xconst char *atom_name, Bool only_if_exists); /* 85 */ int (*xSetBackground) (Display *display, GC gc, unsigned long foreground); /* 86 */ int (*xSetForeground) (Display *display, GC gc, unsigned long foreground); /* 87 */ int (*xSetClipMask) (Display *display, GC gc, Pixmap pixmap); /* 88 */ int (*xSetClipOrigin) (Display *display, GC gc, int clip_x_origin, int clip_y_origin); /* 89 */ int (*xSetTSOrigin) (Display *display, GC gc, int ts_x_origin, int ts_y_origin); /* 90 */ int (*xChangeGC) (Display *d, GC gc, unsigned long mask, XGCValues *values); /* 91 */ int (*xSetFont) (Display *display, GC gc, Font font); /* 92 */ int (*xSetArcMode) (Display *display, GC gc, int arc_mode); /* 93 */ int (*xSetStipple) (Display *display, GC gc, Pixmap stipple); /* 94 */ int (*xSetFillRule) (Display *display, GC gc, int fill_rule); /* 95 */ int (*xSetFillStyle) (Display *display, GC gc, int fill_style); /* 96 */ int (*xSetFunction) (Display *display, GC gc, int function); /* 97 */ int (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 98 */ int (*_XInitImageFuncPtrs) (XImage *image); /* 99 */ XIC (*xCreateIC) (XIM xim, ...); /* 100 */ XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 101 */ void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 102 */ Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 103 */ int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 104 */ int (*xWarpPointer) (Display *d, Window s, Window dw, int sx, int sy, unsigned int sw, unsigned int sh, int dx, int dy); /* 105 */ int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 106 */ int (*xFlush) (Display *display); /* 107 */ int (*xGrabServer) (Display *display); /* 108 */ int (*xUngrabServer) (Display *display); /* 109 */ int (*xFree) (void *data); /* 110 */ int (*xNoOp) (Display *display); /* 111 */ XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */ int (*xSync) (Display *display, Bool discard); /* 113 */ VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */ void (*reserved115)(void); void (*reserved116)(void); void (*reserved117)(void); void (*reserved118)(void); void (*reserved119)(void); int (*xOffsetRegion) (Region rgn, int dx, int dy); /* 120 */ int (*xUnionRegion) (Region srca, Region srcb, Region dr_return); /* 121 */ Window (*xCreateWindow) (Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clazz, Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes); /* 122 */ void (*reserved123)(void); void (*reserved124)(void); void (*reserved125)(void); void (*reserved126)(void); void (*reserved127)(void); void (*reserved128)(void); int (*xLowerWindow) (Display *d, Window w); /* 129 */ int (*xFillArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 130 */ int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */ Region (*xPolygonRegion) (XPoint *pts, int n, int rule); /* 138 */ int (*xPointInRegion) (Region rgn, int x, int y); /* 139 */ XVaNestedList (*xVaCreateNestedList) (int dummy, ...); /* 140 */ char * (*xSetICValues) (XIC xic, ...); /* 141 */ char * (*xGetICValues) (XIC xic, ...); /* 142 */ void (*xSetICFocus) (XIC xic); /* 143 */ void (*reserved144)(void); void (*reserved145)(void); void (*reserved146)(void); void (*xFreeFontSet) (Display *display, XFontSet fontset); /* 147 */ int (*xCloseIM) (XIM im); /* 148 */ Bool (*xRegisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 149 */ Bool (*xUnregisterIMInstantiateCallback) (Display *dpy, struct _XrmHashBucketRec *rbd, char *res_name, char *res_class, XIDProc callback, XPointer client_data); /* 150 */ char * (*xSetLocaleModifiers) (const char *modifier_list); /* 151 */ XIM (*xOpenIM) (Display *dpy, struct _XrmHashBucketRec *rdb, char *res_name, char *res_class); /* 152 */ char * (*xGetIMValues) (XIM im, ...); /* 153 */ |
︙ | ︙ | |||
1396 1397 1398 1399 1400 1401 1402 | (tkIntXlibStubsPtr->xDestroyIC) /* 77 */ #define XFilterEvent \ (tkIntXlibStubsPtr->xFilterEvent) /* 78 */ #define XmbLookupString \ (tkIntXlibStubsPtr->xmbLookupString) /* 79 */ #define TkPutImage \ (tkIntXlibStubsPtr->tkPutImage) /* 80 */ | | > | 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 | (tkIntXlibStubsPtr->xDestroyIC) /* 77 */ #define XFilterEvent \ (tkIntXlibStubsPtr->xFilterEvent) /* 78 */ #define XmbLookupString \ (tkIntXlibStubsPtr->xmbLookupString) /* 79 */ #define TkPutImage \ (tkIntXlibStubsPtr->tkPutImage) /* 80 */ #define XSetClipRectangles \ (tkIntXlibStubsPtr->xSetClipRectangles) /* 81 */ #define XParseColor \ (tkIntXlibStubsPtr->xParseColor) /* 82 */ #define XCreateGC \ (tkIntXlibStubsPtr->xCreateGC) /* 83 */ #define XFreeGC \ (tkIntXlibStubsPtr->xFreeGC) /* 84 */ #define XInternAtom \ |
︙ | ︙ | |||
1553 1554 1555 1556 1557 1558 1559 1560 | (tkIntXlibStubsPtr->xGetImage) /* 3 */ #define XGetAtomName \ (tkIntXlibStubsPtr->xGetAtomName) /* 4 */ #define XKeysymToString \ (tkIntXlibStubsPtr->xKeysymToString) /* 5 */ #define XCreateColormap \ (tkIntXlibStubsPtr->xCreateColormap) /* 6 */ #define XGContextFromGC \ | > > > > | > > | | | | > > > > > > | | | | > > | | | | | > > | | | | | | | > > | | > > | | > > | > > | | | > > | | | > > > > > > | > > | | | | | > > | | | | | | | | | > > | | | > > > > > > > > | > > | | | | | | | | | | | | | | | | | | | | | | < < < < | < < < < < < < < | < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 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 | (tkIntXlibStubsPtr->xGetImage) /* 3 */ #define XGetAtomName \ (tkIntXlibStubsPtr->xGetAtomName) /* 4 */ #define XKeysymToString \ (tkIntXlibStubsPtr->xKeysymToString) /* 5 */ #define XCreateColormap \ (tkIntXlibStubsPtr->xCreateColormap) /* 6 */ #define XCreatePixmapCursor \ (tkIntXlibStubsPtr->xCreatePixmapCursor) /* 7 */ #define XCreateGlyphCursor \ (tkIntXlibStubsPtr->xCreateGlyphCursor) /* 8 */ #define XGContextFromGC \ (tkIntXlibStubsPtr->xGContextFromGC) /* 9 */ #define XListHosts \ (tkIntXlibStubsPtr->xListHosts) /* 10 */ #define XKeycodeToKeysym \ (tkIntXlibStubsPtr->xKeycodeToKeysym) /* 11 */ #define XStringToKeysym \ (tkIntXlibStubsPtr->xStringToKeysym) /* 12 */ #define XRootWindow \ (tkIntXlibStubsPtr->xRootWindow) /* 13 */ #define XSetErrorHandler \ (tkIntXlibStubsPtr->xSetErrorHandler) /* 14 */ #define XIconifyWindow \ (tkIntXlibStubsPtr->xIconifyWindow) /* 15 */ #define XWithdrawWindow \ (tkIntXlibStubsPtr->xWithdrawWindow) /* 16 */ #define XGetWMColormapWindows \ (tkIntXlibStubsPtr->xGetWMColormapWindows) /* 17 */ #define XAllocColor \ (tkIntXlibStubsPtr->xAllocColor) /* 18 */ #define XBell \ (tkIntXlibStubsPtr->xBell) /* 19 */ #define XChangeProperty \ (tkIntXlibStubsPtr->xChangeProperty) /* 20 */ #define XChangeWindowAttributes \ (tkIntXlibStubsPtr->xChangeWindowAttributes) /* 21 */ #define XClearWindow \ (tkIntXlibStubsPtr->xClearWindow) /* 22 */ #define XConfigureWindow \ (tkIntXlibStubsPtr->xConfigureWindow) /* 23 */ #define XCopyArea \ (tkIntXlibStubsPtr->xCopyArea) /* 24 */ #define XCopyPlane \ (tkIntXlibStubsPtr->xCopyPlane) /* 25 */ #define XCreateBitmapFromData \ (tkIntXlibStubsPtr->xCreateBitmapFromData) /* 26 */ #define XDefineCursor \ (tkIntXlibStubsPtr->xDefineCursor) /* 27 */ #define XDeleteProperty \ (tkIntXlibStubsPtr->xDeleteProperty) /* 28 */ #define XDestroyWindow \ (tkIntXlibStubsPtr->xDestroyWindow) /* 29 */ #define XDrawArc \ (tkIntXlibStubsPtr->xDrawArc) /* 30 */ #define XDrawLines \ (tkIntXlibStubsPtr->xDrawLines) /* 31 */ #define XDrawRectangle \ (tkIntXlibStubsPtr->xDrawRectangle) /* 32 */ #define XFillArc \ (tkIntXlibStubsPtr->xFillArc) /* 33 */ #define XFillPolygon \ (tkIntXlibStubsPtr->xFillPolygon) /* 34 */ #define XFillRectangles \ (tkIntXlibStubsPtr->xFillRectangles) /* 35 */ #define XForceScreenSaver \ (tkIntXlibStubsPtr->xForceScreenSaver) /* 36 */ #define XFreeColormap \ (tkIntXlibStubsPtr->xFreeColormap) /* 37 */ #define XFreeColors \ (tkIntXlibStubsPtr->xFreeColors) /* 38 */ #define XFreeCursor \ (tkIntXlibStubsPtr->xFreeCursor) /* 39 */ #define XFreeModifiermap \ (tkIntXlibStubsPtr->xFreeModifiermap) /* 40 */ #define XGetGeometry \ (tkIntXlibStubsPtr->xGetGeometry) /* 41 */ #define XGetInputFocus \ (tkIntXlibStubsPtr->xGetInputFocus) /* 42 */ #define XGetWindowProperty \ (tkIntXlibStubsPtr->xGetWindowProperty) /* 43 */ #define XGetWindowAttributes \ (tkIntXlibStubsPtr->xGetWindowAttributes) /* 44 */ #define XGrabKeyboard \ (tkIntXlibStubsPtr->xGrabKeyboard) /* 45 */ #define XGrabPointer \ (tkIntXlibStubsPtr->xGrabPointer) /* 46 */ #define XKeysymToKeycode \ (tkIntXlibStubsPtr->xKeysymToKeycode) /* 47 */ #define XLookupColor \ (tkIntXlibStubsPtr->xLookupColor) /* 48 */ #define XMapWindow \ (tkIntXlibStubsPtr->xMapWindow) /* 49 */ #define XMoveResizeWindow \ (tkIntXlibStubsPtr->xMoveResizeWindow) /* 50 */ #define XMoveWindow \ (tkIntXlibStubsPtr->xMoveWindow) /* 51 */ #define XNextEvent \ (tkIntXlibStubsPtr->xNextEvent) /* 52 */ #define XPutBackEvent \ (tkIntXlibStubsPtr->xPutBackEvent) /* 53 */ #define XQueryColors \ (tkIntXlibStubsPtr->xQueryColors) /* 54 */ #define XQueryPointer \ (tkIntXlibStubsPtr->xQueryPointer) /* 55 */ #define XQueryTree \ (tkIntXlibStubsPtr->xQueryTree) /* 56 */ #define XRaiseWindow \ (tkIntXlibStubsPtr->xRaiseWindow) /* 57 */ #define XRefreshKeyboardMapping \ (tkIntXlibStubsPtr->xRefreshKeyboardMapping) /* 58 */ #define XResizeWindow \ (tkIntXlibStubsPtr->xResizeWindow) /* 59 */ #define XSelectInput \ (tkIntXlibStubsPtr->xSelectInput) /* 60 */ #define XSendEvent \ (tkIntXlibStubsPtr->xSendEvent) /* 61 */ #define XSetCommand \ (tkIntXlibStubsPtr->xSetCommand) /* 62 */ #define XSetIconName \ (tkIntXlibStubsPtr->xSetIconName) /* 63 */ #define XSetInputFocus \ (tkIntXlibStubsPtr->xSetInputFocus) /* 64 */ #define XSetSelectionOwner \ (tkIntXlibStubsPtr->xSetSelectionOwner) /* 65 */ #define XSetWindowBackground \ (tkIntXlibStubsPtr->xSetWindowBackground) /* 66 */ #define XSetWindowBackgroundPixmap \ (tkIntXlibStubsPtr->xSetWindowBackgroundPixmap) /* 67 */ #define XSetWindowBorder \ (tkIntXlibStubsPtr->xSetWindowBorder) /* 68 */ #define XSetWindowBorderPixmap \ (tkIntXlibStubsPtr->xSetWindowBorderPixmap) /* 69 */ #define XSetWindowBorderWidth \ (tkIntXlibStubsPtr->xSetWindowBorderWidth) /* 70 */ #define XSetWindowColormap \ (tkIntXlibStubsPtr->xSetWindowColormap) /* 71 */ #define XTranslateCoordinates \ (tkIntXlibStubsPtr->xTranslateCoordinates) /* 72 */ #define XUngrabKeyboard \ (tkIntXlibStubsPtr->xUngrabKeyboard) /* 73 */ #define XUngrabPointer \ (tkIntXlibStubsPtr->xUngrabPointer) /* 74 */ #define XUnmapWindow \ (tkIntXlibStubsPtr->xUnmapWindow) /* 75 */ #define XWindowEvent \ (tkIntXlibStubsPtr->xWindowEvent) /* 76 */ #define XDestroyIC \ (tkIntXlibStubsPtr->xDestroyIC) /* 77 */ #define XFilterEvent \ (tkIntXlibStubsPtr->xFilterEvent) /* 78 */ #define XmbLookupString \ (tkIntXlibStubsPtr->xmbLookupString) /* 79 */ #define TkPutImage \ (tkIntXlibStubsPtr->tkPutImage) /* 80 */ #define XSetClipRectangles \ (tkIntXlibStubsPtr->xSetClipRectangles) /* 81 */ #define XParseColor \ (tkIntXlibStubsPtr->xParseColor) /* 82 */ #define XCreateGC \ (tkIntXlibStubsPtr->xCreateGC) /* 83 */ #define XFreeGC \ (tkIntXlibStubsPtr->xFreeGC) /* 84 */ #define XInternAtom \ (tkIntXlibStubsPtr->xInternAtom) /* 85 */ #define XSetBackground \ (tkIntXlibStubsPtr->xSetBackground) /* 86 */ #define XSetForeground \ (tkIntXlibStubsPtr->xSetForeground) /* 87 */ #define XSetClipMask \ (tkIntXlibStubsPtr->xSetClipMask) /* 88 */ #define XSetClipOrigin \ (tkIntXlibStubsPtr->xSetClipOrigin) /* 89 */ #define XSetTSOrigin \ (tkIntXlibStubsPtr->xSetTSOrigin) /* 90 */ #define XChangeGC \ (tkIntXlibStubsPtr->xChangeGC) /* 91 */ #define XSetFont \ (tkIntXlibStubsPtr->xSetFont) /* 92 */ #define XSetArcMode \ (tkIntXlibStubsPtr->xSetArcMode) /* 93 */ #define XSetStipple \ (tkIntXlibStubsPtr->xSetStipple) /* 94 */ #define XSetFillRule \ (tkIntXlibStubsPtr->xSetFillRule) /* 95 */ #define XSetFillStyle \ (tkIntXlibStubsPtr->xSetFillStyle) /* 96 */ #define XSetFunction \ (tkIntXlibStubsPtr->xSetFunction) /* 97 */ #define XSetLineAttributes \ (tkIntXlibStubsPtr->xSetLineAttributes) /* 98 */ #define _XInitImageFuncPtrs \ (tkIntXlibStubsPtr->_XInitImageFuncPtrs) /* 99 */ #define XCreateIC \ (tkIntXlibStubsPtr->xCreateIC) /* 100 */ #define XGetVisualInfo \ (tkIntXlibStubsPtr->xGetVisualInfo) /* 101 */ #define XSetWMClientMachine \ (tkIntXlibStubsPtr->xSetWMClientMachine) /* 102 */ #define XStringListToTextProperty \ (tkIntXlibStubsPtr->xStringListToTextProperty) /* 103 */ #define XDrawLine \ (tkIntXlibStubsPtr->xDrawLine) /* 104 */ #define XWarpPointer \ (tkIntXlibStubsPtr->xWarpPointer) /* 105 */ #define XFillRectangle \ (tkIntXlibStubsPtr->xFillRectangle) /* 106 */ #define XFlush \ (tkIntXlibStubsPtr->xFlush) /* 107 */ #define XGrabServer \ (tkIntXlibStubsPtr->xGrabServer) /* 108 */ #define XUngrabServer \ (tkIntXlibStubsPtr->xUngrabServer) /* 109 */ #define XFree \ (tkIntXlibStubsPtr->xFree) /* 110 */ #define XNoOp \ (tkIntXlibStubsPtr->xNoOp) /* 111 */ #define XSynchronize \ (tkIntXlibStubsPtr->xSynchronize) /* 112 */ #define XSync \ (tkIntXlibStubsPtr->xSync) /* 113 */ #define XVisualIDFromVisual \ (tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */ /* Slot 115 is reserved */ /* Slot 116 is reserved */ /* Slot 117 is reserved */ /* Slot 118 is reserved */ /* Slot 119 is reserved */ |
︙ | ︙ | |||
1794 1795 1796 1797 1798 1799 1800 | (tkIntXlibStubsPtr->xLowerWindow) /* 129 */ #define XFillArcs \ (tkIntXlibStubsPtr->xFillArcs) /* 130 */ #define XDrawArcs \ (tkIntXlibStubsPtr->xDrawArcs) /* 131 */ #define XDrawRectangles \ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */ | > | > | > | < | < | < | | 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 | (tkIntXlibStubsPtr->xLowerWindow) /* 129 */ #define XFillArcs \ (tkIntXlibStubsPtr->xFillArcs) /* 130 */ #define XDrawArcs \ (tkIntXlibStubsPtr->xDrawArcs) /* 131 */ #define XDrawRectangles \ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */ #define XDrawSegments \ (tkIntXlibStubsPtr->xDrawSegments) /* 133 */ #define XDrawPoint \ (tkIntXlibStubsPtr->xDrawPoint) /* 134 */ #define XDrawPoints \ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */ #define XReparentWindow \ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */ #define XPutImage \ (tkIntXlibStubsPtr->xPutImage) /* 137 */ #define XPolygonRegion \ (tkIntXlibStubsPtr->xPolygonRegion) /* 138 */ #define XPointInRegion \ (tkIntXlibStubsPtr->xPointInRegion) /* 139 */ #define XVaCreateNestedList \ (tkIntXlibStubsPtr->xVaCreateNestedList) /* 140 */ #define XSetICValues \ (tkIntXlibStubsPtr->xSetICValues) /* 141 */ #define XGetICValues \ (tkIntXlibStubsPtr->xGetICValues) /* 142 */ #define XSetICFocus \ (tkIntXlibStubsPtr->xSetICFocus) /* 143 */ /* Slot 144 is reserved */ /* Slot 145 is reserved */ /* Slot 146 is reserved */ #define XFreeFontSet \ (tkIntXlibStubsPtr->xFreeFontSet) /* 147 */ #define XCloseIM \ (tkIntXlibStubsPtr->xCloseIM) /* 148 */ #define XRegisterIMInstantiateCallback \ (tkIntXlibStubsPtr->xRegisterIMInstantiateCallback) /* 149 */ #define XUnregisterIMInstantiateCallback \ |
︙ | ︙ |
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" |
︙ | ︙ | |||
46 47 48 49 50 51 52 | Tk_OptionTable optionTable; /* Table that defines configuration options * available for this widget. */ Tk_OptionTable itemAttrOptionTable; /* Table that defines configuration options * available for listbox items. */ char *listVarName; /* List variable name */ Tcl_Obj *listObj; /* Pointer to the list object being used */ | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | Tk_OptionTable optionTable; /* Table that defines configuration options * available for this widget. */ Tk_OptionTable itemAttrOptionTable; /* Table that defines configuration options * available for listbox items. */ char *listVarName; /* List variable name */ Tcl_Obj *listObj; /* Pointer to the list object being used */ Tcl_Size nElements; /* Holds the current count of elements */ Tcl_HashTable *selection; /* Tracks selection */ Tcl_HashTable *itemAttrTable; /* Tracks item attributes */ /* * Information used when displaying widget: */ |
︙ | ︙ | |||
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 }; |
︙ | ︙ | |||
274 275 276 277 278 279 280 | {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_LISTBOX_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Listbox, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", | | | | 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 | {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_LISTBOX_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Listbox, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, TCL_INDEX_NONE, offsetof(Listbox, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_LISTBOX_JUSTIFY, TCL_INDEX_NONE, offsetof(Listbox, justify), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LISTBOX_RELIEF, TCL_INDEX_NONE, offsetof(Listbox, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_LISTBOX_SELECT_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selBorder), 0, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_LISTBOX_SELECT_BD, TCL_INDEX_NONE, offsetof(Listbox, selBorderWidth), 0, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_LISTBOX_SELECT_FG_COLOR, TCL_INDEX_NONE, offsetof(Listbox, selFgColorPtr), TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_FG_MONO, 0}, {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), |
︙ | ︙ | |||
317 318 319 320 321 322 323 | /* * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items. */ static const Tk_OptionSpec itemAttrOptionSpecs[] = { | | | < | | | | < | | < | | 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 | /* * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items. */ static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(ItemAttr, border), TK_OPTION_NULL_OK, NULL, 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", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(ItemAttr, fgColor), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BORDER, "-selectbackground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selBorder), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-selectforeground", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(ItemAttr, selFgColor), TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, NULL, 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 * dispatch the listbox widget command. */ |
︙ | ︙ | |||
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[] = { | | | | | | | | | | | | | | | | | | < < | | | | | | | 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 | "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 }; /* * Declarations for procedures defined later in this file. */ static void ChangeListboxOffset(Listbox *listPtr, int offset); static void ChangeListboxView(Listbox *listPtr, int index); static int ConfigureListbox(Tcl_Interp *interp, Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ConfigureListboxItem(Tcl_Interp *interp, Listbox *listPtr, ItemAttr *attrs, Tcl_Size objc, Tcl_Obj *const objv[], Tcl_Size index); static int ListboxDeleteSubCmd(Listbox *listPtr, int first, int last); static Tcl_FreeProc DestroyListbox; static void DestroyListboxOptionTables(void *clientData, Tcl_Interp *interp); static void DisplayListbox(void *clientData); static int GetListboxIndex(Tcl_Interp *interp, Listbox *listPtr, Tcl_Obj *index, int endIsSize, Tcl_Size *indexPtr); static int ListboxInsertSubCmd(Listbox *listPtr, Tcl_Size index, Tcl_Size objc, Tcl_Obj *const objv[]); static void ListboxCmdDeletedProc(void *clientData); static void ListboxComputeGeometry(Listbox *listPtr, int fontChanged, int maxIsStale, int updateGrid); static void ListboxEventProc(void *clientData, XEvent *eventPtr); static Tcl_Size ListboxFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static void ListboxLostSelection(void *clientData); static void GenerateListboxSelectEvent(Listbox *listPtr); static void EventuallyRedrawRange(Listbox *listPtr, Tcl_Size first, Tcl_Size last); static void ListboxScanTo(Listbox *listPtr, int x, int y); static int ListboxSelect(Listbox *listPtr, int first, int last, int select); static void ListboxUpdateHScrollbar(Listbox *listPtr); static void ListboxUpdateVScrollbar(Listbox *listPtr); static Tcl_ObjCmdProc ListboxWidgetObjCmd; static int ListboxBboxSubCmd(Tcl_Interp *interp, Listbox *listPtr, int index); static int ListboxSelectionSubCmd(Tcl_Interp *interp, Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ListboxXviewSubCmd(Tcl_Interp *interp, Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ListboxYviewSubCmd(Tcl_Interp *interp, Listbox *listPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static ItemAttr * ListboxGetItemAttributes(Tcl_Interp *interp, Listbox *listPtr, int index); static void ListboxWorldChanged(void *instanceData); static int NearestListboxElement(Listbox *listPtr, int y); static char * ListboxListVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void MigrateHashEntries(Tcl_HashTable *table, Tcl_Size first, Tcl_Size last, Tcl_Size offset); static int GetMaxOffset(Listbox *listPtr); /* * The structure below defines button class behavior by means of procedures * that can be invoked from generic window code. */ |
︙ | ︙ | |||
469 470 471 472 473 474 475 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_ListboxObjCmd( | | < | | 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 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_ListboxObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Listbox *listPtr; Tk_Window tkwin; ListboxOptionTables *optionTables; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), Tcl_GetString(objv[1]), NULL); if (tkwin == NULL) { return TCL_ERROR; } optionTables = (ListboxOptionTables *)Tcl_GetAssocData(interp, "ListboxOptionTables", NULL); if (optionTables == NULL) { /* * We haven't created the option tables for this widget class yet. Do * it now and save the a pointer to them as the void *for the * command, so future invocations will have access to it. */ optionTables = (ListboxOptionTables *)ckalloc(sizeof(ListboxOptionTables)); /* * Set up an exit handler to free the optionTables struct. |
︙ | ︙ | |||
599 600 601 602 603 604 605 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ListboxWidgetObjCmd( | | | > | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | * See the user documentation. * *---------------------------------------------------------------------- */ static int ListboxWidgetObjCmd( void *clientData, /* Information about listbox widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ { Listbox *listPtr = (Listbox *)clientData; int cmdIndex; Tcl_Size index; int result = TCL_OK; Tcl_Obj *objPtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
723 724 725 726 727 728 729 | * search functions (Tcl_FirstHashEntry, Tcl_NextHashEntry), but then * the result wouldn't be in sorted order. So instead we loop through * the indices in order, adding them to the result if they are * selected. */ objPtr = Tcl_NewObj(); | | | | | | | | | 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 | * search functions (Tcl_FirstHashEntry, Tcl_NextHashEntry), but then * the result wouldn't be in sorted order. So instead we loop through * the indices in order, adding them to the result if they are * selected. */ objPtr = Tcl_NewObj(); for (i = 0; i < (int)listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(i)); } } Tcl_SetObjResult(interp, objPtr); result = TCL_OK; break; } case COMMAND_DELETE: { Tcl_Size first, last; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 0, &first); if (result != TCL_OK) { break; } if (!(listPtr->state & STATE_NORMAL)) { break; } if (first < (int)listPtr->nElements) { /* * if a "last index" was given, get it now; otherwise, use the * first index as the last index. */ if (objc == 4) { result = GetListboxIndex(interp, listPtr, objv[3], 0, &last); if (result != TCL_OK) { break; } } else { last = first; } if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } result = ListboxDeleteSubCmd(listPtr, first, last); } else { result = TCL_OK; } break; } case COMMAND_GET: { Tcl_Size listLen, first, last; Tcl_Obj **elemPtrs; if (objc != 3 && objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 0, &first); if (result != TCL_OK) { break; } last = first; if (objc == 4) { result = GetListboxIndex(interp, listPtr, objv[3], 0, &last); if (result != TCL_OK) { break; } } if (first >= (int)listPtr->nElements) { result = TCL_OK; break; } if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } if (first < 0) { first = 0; } if (first > last) { result = TCL_OK; |
︙ | ︙ | |||
875 876 877 878 879 880 881 | } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } if (index < 0 || index >= (int)listPtr->nElements) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item number \"%s\" out of range", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL); result = TCL_ERROR; break; } |
︙ | ︙ | |||
912 913 914 915 916 917 918 | } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } | | | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } if (index < 0 || index >= (int)listPtr->nElements) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item number \"%s\" out of range", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL); result = TCL_ERROR; break; } |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } | | | 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 0, &index); if (result != TCL_OK) { break; } if (index >= (int)listPtr->nElements) { index = listPtr->nElements - 1; } if (index < 0) { index = 0; } diff = listPtr->topIndex - index; if (diff > 0) { |
︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | /* * Determine the index of the last visible item in the listbox. */ lastVisibleIndex = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine; | | | | | 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 | /* * Determine the index of the last visible item in the listbox. */ lastVisibleIndex = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine; if ((int)listPtr->nElements < lastVisibleIndex) { lastVisibleIndex = listPtr->nElements; } /* * Only allow bbox requests for indices that are visible. */ if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) { Tcl_Obj *el, *results[4]; const char *stringRep; int pixelWidth, x, y, result; Tcl_Size stringLen; Tk_FontMetrics fm; /* * Compute the pixel width of the requested element. */ 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) |
︙ | ︙ | |||
1157 1158 1159 1160 1161 1162 1163 | *---------------------------------------------------------------------- */ static int ListboxSelectionSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ | | | > | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | *---------------------------------------------------------------------- */ static int ListboxSelectionSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { int selCmdIndex; Tcl_Size first, last; int result = TCL_OK; if (objc != 4 && objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "option index ?index?"); return TCL_ERROR; } result = GetListboxIndex(interp, listPtr, objv[3], 0, &first); |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | switch (selCmdIndex) { case SELECTION_ANCHOR: if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "index"); return TCL_ERROR; } | | | 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | switch (selCmdIndex) { case SELECTION_ANCHOR: if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "index"); return TCL_ERROR; } if (first >= (int)listPtr->nElements) { first = listPtr->nElements - 1; } if (first < 0) { first = 0; } listPtr->selectAnchor = first; result = TCL_OK; |
︙ | ︙ | |||
1247 1248 1249 1250 1251 1252 1253 | *---------------------------------------------------------------------- */ static int ListboxXviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ | | | 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | *---------------------------------------------------------------------- */ static int ListboxXviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { int index, count, windowWidth, windowUnits; int offset = 0; /* Initialized to stop gcc warnings. */ double fraction; windowWidth = Tk_Width(listPtr->tkwin) |
︙ | ︙ | |||
1282 1283 1284 1285 1286 1287 1288 | } else if (objc == 3) { if (Tcl_GetIntFromObj(interp, objv[2], &index) != TCL_OK) { return TCL_ERROR; } ChangeListboxOffset(listPtr, index*listPtr->xScrollUnit); } else { switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { | < < > > | 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 | } else if (objc == 3) { if (Tcl_GetIntFromObj(interp, objv[2], &index) != TCL_OK) { return TCL_ERROR; } ChangeListboxOffset(listPtr, index*listPtr->xScrollUnit); } else { switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: offset = (int) (fraction*listPtr->maxWidth + 0.5); break; case TK_SCROLL_PAGES: windowUnits = windowWidth / listPtr->xScrollUnit; if (windowUnits > 2) { offset = listPtr->xOffset + count*listPtr->xScrollUnit*(windowUnits-2); } else { offset = listPtr->xOffset + count*listPtr->xScrollUnit; } break; case TK_SCROLL_UNITS: offset = listPtr->xOffset + count*listPtr->xScrollUnit; break; default: return TCL_ERROR; } ChangeListboxOffset(listPtr, offset); } return TCL_OK; } /* |
︙ | ︙ | |||
1325 1326 1327 1328 1329 1330 1331 | *---------------------------------------------------------------------- */ static int ListboxYviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ | | > | | 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 | *---------------------------------------------------------------------- */ static int ListboxYviewSubCmd( Tcl_Interp *interp, /* Pointer to the calling Tcl interpreter */ Listbox *listPtr, /* Information about the listbox */ Tcl_Size objc, /* Number of arguments in the objv array */ Tcl_Obj *const objv[]) /* Array of arguments to the procedure */ { Tcl_Size index; int count; double fraction; if (objc == 2) { Tcl_Obj *results[2]; if (listPtr->nElements == 0) { results[0] = Tcl_NewDoubleObj(0.0); |
︙ | ︙ | |||
1357 1358 1359 1360 1361 1362 1363 | if (GetListboxIndex(interp, listPtr, objv[2], 0, &index) != TCL_OK) { return TCL_ERROR; } ChangeListboxView(listPtr, index); } else { switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: | | < | 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 | if (GetListboxIndex(interp, listPtr, objv[2], 0, &index) != TCL_OK) { return TCL_ERROR; } ChangeListboxView(listPtr, index); } else { switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: index = (Tcl_Size)(listPtr->nElements*fraction + 0.5); break; case TK_SCROLL_PAGES: if (listPtr->fullLines > 2) { index = listPtr->topIndex + count*(listPtr->fullLines-2); } else { index = listPtr->topIndex + count; } break; case TK_SCROLL_UNITS: index = listPtr->topIndex + count; break; default: return TCL_ERROR; } ChangeListboxView(listPtr, index); } return TCL_OK; } |
︙ | ︙ | |||
1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | * Everything associated with the listbox is freed up. * *---------------------------------------------------------------------- */ static void DestroyListbox( void *memPtr) /* Info about listbox widget. */ { Listbox *listPtr = (Listbox *)memPtr; Tcl_HashEntry *entry; Tcl_HashSearch search; /* * If we have an internal list object, free it. | > > > > | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 | * Everything associated with the listbox is freed up. * *---------------------------------------------------------------------- */ static void DestroyListbox( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about listbox widget. */ #else char *memPtr) #endif { Listbox *listPtr = (Listbox *)memPtr; Tcl_HashEntry *entry; Tcl_HashSearch search; /* * If we have an internal list object, free it. |
︙ | ︙ | |||
1496 1497 1498 1499 1500 1501 1502 | if (listPtr->selTextGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } if (listPtr->gray != None) { Tk_FreeBitmap(Tk_Display(listPtr->tkwin), listPtr->gray); } | | | 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | if (listPtr->selTextGC != NULL) { Tk_FreeGC(listPtr->display, listPtr->selTextGC); } if (listPtr->gray != None) { Tk_FreeBitmap(Tk_Display(listPtr->tkwin), listPtr->gray); } Tk_FreeConfigOptions(listPtr, listPtr->optionTable, listPtr->tkwin); Tcl_Release(listPtr->tkwin); listPtr->tkwin = NULL; ckfree(listPtr); } /* |
︙ | ︙ | |||
1523 1524 1525 1526 1527 1528 1529 | * Frees memory. * *---------------------------------------------------------------------- */ static void DestroyListboxOptionTables( | | | < < | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | * Frees memory. * *---------------------------------------------------------------------- */ static void DestroyListboxOptionTables( void *clientData, /* Pointer to the OptionTables struct */ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { ckfree(clientData); return; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1557 1558 1559 1560 1561 1562 1563 | */ static int ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ | | | 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | */ static int ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; Tcl_Obj *oldListObj = NULL; Tcl_Obj *errorResult = NULL; int oldExport, error; |
︙ | ︙ | |||
1638 1639 1640 1641 1642 1643 1644 | * no listvar | no listvar | no special action */ oldListObj = listPtr->listObj; if (listPtr->listVarName != NULL) { Tcl_Obj *listVarObj = Tcl_GetVar2Ex(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY); | | | 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 | * no listvar | no listvar | no special action */ oldListObj = listPtr->listObj; if (listPtr->listVarName != NULL) { Tcl_Obj *listVarObj = Tcl_GetVar2Ex(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY); Tcl_Size dummy; if (listVarObj == NULL) { listVarObj = (oldListObj ? oldListObj : Tcl_NewObj()); if (Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL, listVarObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { continue; |
︙ | ︙ | |||
1718 1719 1720 1721 1722 1723 1724 | static int ConfigureListboxItem( Tcl_Interp *interp, /* Used for error reporting. */ Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ | | | | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | static int ConfigureListboxItem( Tcl_Interp *interp, /* Used for error reporting. */ Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ Tcl_Size index) /* Index of the listbox item being configure */ { Tk_SavedOptions savedOptions; if (Tk_SetOptions(interp, attrs, listPtr->itemAttrOptionTable, objc, objv, listPtr->tkwin, &savedOptions, NULL) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); |
︙ | ︙ | |||
1761 1762 1763 1764 1765 1766 1767 | * Listbox will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void ListboxWorldChanged( | | | 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 | * Listbox will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void ListboxWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc; unsigned long mask; Listbox *listPtr = (Listbox *)instanceData; if (listPtr->state & STATE_NORMAL) { |
︙ | ︙ | |||
1835 1836 1837 1838 1839 1840 1841 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayListbox( | | | | 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayListbox( void *clientData) /* Information about window. */ { Listbox *listPtr = (Listbox *)clientData; Tk_Window tkwin = listPtr->tkwin; GC gc; int i, limit, x, y, prevSelected, freeGC; Tcl_Size stringLen; Tk_FontMetrics fm; Tcl_Obj *curElement; Tcl_HashEntry *entry; const char *stringRep; ItemAttr *attrs; Tk_3DBorder selectedBg; XGCValues gcValues; |
︙ | ︙ | |||
1907 1908 1909 1910 1911 1912 1913 | Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); /* * Display each item in the listbox. */ limit = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine - 1; | | | 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 | Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); /* * Display each item in the listbox. */ limit = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine - 1; if (limit >= (int)listPtr->nElements) { limit = listPtr->nElements-1; } left = right = 0; if (listPtr->xOffset > 0) { left = listPtr->selBorderWidth+1; } if ((listPtr->maxWidth - listPtr->xOffset) > (Tk_Width(listPtr->tkwin) |
︙ | ︙ | |||
2023 2024 2025 2026 2027 2028 2029 | if (!prevSelected) { Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left, y, width+left+right, listPtr->selBorderWidth, 1, 1, 1, TK_RELIEF_RAISED); } /* Draw bottom bevel */ | | | 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | if (!prevSelected) { Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left, y, width+left+right, listPtr->selBorderWidth, 1, 1, 1, TK_RELIEF_RAISED); } /* Draw bottom bevel */ if (i + 1 == (int)listPtr->nElements || !Tcl_FindHashEntry(listPtr->selection, KEY(i + 1))) { Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left, y + listPtr->lineHeight - listPtr->selBorderWidth, width+left+right, listPtr->selBorderWidth, 0, 0, 0, TK_RELIEF_RAISED); } prevSelected = 1; |
︙ | ︙ | |||
2075 2076 2077 2078 2079 2080 2081 | } /* * Draw the actual text of this item. */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); | | | 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 | } /* * 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); | | | | 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 | 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); |
︙ | ︙ | |||
2238 2239 2240 2241 2242 2243 2244 | * recomputed. If fontChanged is 1 then this * must be 1. */ int updateGrid) /* Non-zero means call Tk_SetGrid or * Tk_UnsetGrid to update gridding for the * window. */ { int width, height, pixelWidth, pixelHeight, i, result; | | | | | 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 | * recomputed. If fontChanged is 1 then this * must be 1. */ int updateGrid) /* Non-zero means call Tk_SetGrid or * Tk_UnsetGrid to update gridding for the * window. */ { int width, height, pixelWidth, pixelHeight, i, result; Tcl_Size textLength; Tk_FontMetrics fm; Tcl_Obj *element; const char *text; if (fontChanged || maxIsStale) { listPtr->xScrollUnit = Tk_TextWidth(listPtr->tkfont, "0", 1); if (listPtr->xScrollUnit == 0) { listPtr->xScrollUnit = 1; } listPtr->maxWidth = 0; for (i = 0; i < (int)listPtr->nElements; i++) { /* * Compute the pixel width of the current element. */ 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; } } } |
︙ | ︙ | |||
2282 2283 2284 2285 2286 2287 2288 | width = 1; } } pixelWidth = width*listPtr->xScrollUnit + 2*listPtr->inset + 2*listPtr->selBorderWidth; height = listPtr->height; if (listPtr->height <= 0) { | | | 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | width = 1; } } pixelWidth = width*listPtr->xScrollUnit + 2*listPtr->inset + 2*listPtr->selBorderWidth; height = listPtr->height; if (listPtr->height <= 0) { height = (int)listPtr->nElements; if (height < 1) { height = 1; } } pixelHeight = height*listPtr->lineHeight + 2*listPtr->inset; Tk_GeometryRequest(listPtr->tkwin, pixelWidth, pixelHeight); Tk_SetInternalBorder(listPtr->tkwin, listPtr->inset); |
︙ | ︙ | |||
2320 2321 2322 2323 2324 2325 2326 | * *---------------------------------------------------------------------- */ static int ListboxInsertSubCmd( Listbox *listPtr, /* Listbox that is to get the new elements. */ | | | | | | | 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 | * *---------------------------------------------------------------------- */ static int ListboxInsertSubCmd( Listbox *listPtr, /* Listbox that is to get the new elements. */ Tcl_Size index, /* Add the new elements before this * element. */ Tcl_Size objc, /* Number of new elements to add. */ Tcl_Obj *const objv[]) /* New elements (one per entry). */ { int oldMaxWidth, pixelWidth, result; Tcl_Size i, length; Tcl_Obj *newListObj; const char *stringRep; 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; } } /* |
︙ | ︙ | |||
2403 2404 2405 2406 2407 2408 2409 | listPtr->selectAnchor += objc; } if (index < listPtr->topIndex) { listPtr->topIndex += objc; } if (index <= listPtr->active) { listPtr->active += objc; | | | | 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 | listPtr->selectAnchor += objc; } if (index < listPtr->topIndex) { listPtr->topIndex += objc; } if (index <= listPtr->active) { listPtr->active += objc; if ((listPtr->active >= (int)listPtr->nElements) && ((int)listPtr->nElements > 0)) { listPtr->active = listPtr->nElements-1; } } listPtr->flags |= UPDATE_V_SCROLLBAR; if (listPtr->maxWidth != oldMaxWidth) { listPtr->flags |= UPDATE_H_SCROLLBAR; } |
︙ | ︙ | |||
2441 2442 2443 2444 2445 2446 2447 | static int ListboxDeleteSubCmd( Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { int count, i, widthChanged, result, pixelWidth; | | | | 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 | static int ListboxDeleteSubCmd( Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { int count, i, widthChanged, result, pixelWidth; Tcl_Size length; Tcl_Obj *newListObj, *element; const char *stringRep; Tcl_HashEntry *entry; /* * Adjust the range to fit within the existing elements of the listbox, * and make sure there's something to delete. */ if (first < 0) { first = 0; } if (last >= (int)listPtr->nElements) { last = listPtr->nElements-1; } count = last + 1 - first; if (count <= 0) { return TCL_OK; } |
︙ | ︙ | |||
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); | | | 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | * 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; } } } |
︙ | ︙ | |||
2567 2568 2569 2570 2571 2572 2573 | } if (first <= listPtr->topIndex) { listPtr->topIndex -= count; if (listPtr->topIndex < first) { listPtr->topIndex = first; } } | | | | | 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 | } if (first <= listPtr->topIndex) { listPtr->topIndex -= count; if (listPtr->topIndex < first) { listPtr->topIndex = first; } } if (listPtr->topIndex > ((int)listPtr->nElements - listPtr->fullLines)) { listPtr->topIndex = listPtr->nElements - listPtr->fullLines; if (listPtr->topIndex < 0) { listPtr->topIndex = 0; } } if (listPtr->active > last) { listPtr->active -= count; } else if (listPtr->active >= first) { listPtr->active = first; if ((listPtr->active >= (int)listPtr->nElements) && ((int)listPtr->nElements > 0)) { listPtr->active = listPtr->nElements-1; } } listPtr->flags |= UPDATE_V_SCROLLBAR; ListboxComputeGeometry(listPtr, 0, widthChanged, 0); if (widthChanged) { listPtr->flags |= UPDATE_H_SCROLLBAR; |
︙ | ︙ | |||
2611 2612 2613 2614 2615 2616 2617 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ListboxEventProc( | | | | 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 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ListboxEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Listbox *listPtr = (Listbox *)clientData; if (eventPtr->type == Expose) { EventuallyRedrawRange(listPtr, NearestListboxElement(listPtr, eventPtr->xexpose.y), NearestListboxElement(listPtr, eventPtr->xexpose.y + eventPtr->xexpose.height)); } else if (eventPtr->type == DestroyNotify) { if (!(listPtr->flags & LISTBOX_DELETED)) { listPtr->flags |= LISTBOX_DELETED; Tcl_DeleteCommandFromToken(listPtr->interp, listPtr->widgetCmd); if (listPtr->setGrid) { Tk_UnsetGrid(listPtr->tkwin); } if (listPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(DisplayListbox, clientData); } Tcl_EventuallyFree(clientData, DestroyListbox); } } else if (eventPtr->type == ConfigureNotify) { int vertSpace; vertSpace = Tk_Height(listPtr->tkwin) - 2*listPtr->inset; listPtr->fullLines = vertSpace / listPtr->lineHeight; if ((listPtr->fullLines*listPtr->lineHeight) < vertSpace) { |
︙ | ︙ | |||
2687 2688 2689 2690 2691 2692 2693 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ListboxCmdDeletedProc( | | | 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ListboxCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { Listbox *listPtr = (Listbox *)clientData; /* * This procedure could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or * because the command was deleted, and then this procedure destroys the |
︙ | ︙ | |||
2730 2731 2732 2733 2734 2735 2736 | Tcl_Interp *interp, /* For error messages. */ Listbox *listPtr, /* Listbox for which the index is being * specified. */ Tcl_Obj *indexObj, /* Specifies an element in the listbox. */ int lastOK, /* If 1, "end" refers to the number of entries * in the listbox. If 0, "end" refers to 1 * less than the number of entries. */ | | | | | | | | 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 | Tcl_Interp *interp, /* For error messages. */ Listbox *listPtr, /* Listbox for which the index is being * specified. */ Tcl_Obj *indexObj, /* Specifies an element in the listbox. */ int lastOK, /* If 1, "end" refers to the number of entries * in the listbox. If 0, "end" refers to 1 * less than the number of entries. */ Tcl_Size *indexPtr) /* Where to store converted index. */ { int result; Tcl_Size idx, index; char *stringRep; result = TkGetIntForIndex(indexObj, listPtr->nElements - 1, lastOK, &idx); if (result == TCL_OK) { if ((idx != TCL_INDEX_NONE) && (idx > listPtr->nElements)) { idx = listPtr->nElements; } *indexPtr = idx; return TCL_OK; } /* * First see if the index is one of the named indices. */ |
︙ | ︙ | |||
2776 2777 2778 2779 2780 2781 2782 | if (stringRep[0] == '@') { /* * @x,y index */ int y; | | | | > > > > > | > | | < | | 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 | if (stringRep[0] == '@') { /* * @x,y index */ int y; char *start; char *rest; start = stringRep + 1; rest = strchr(start, ','); if (!rest) { goto badIndex; } *rest = '\0'; if (Tcl_GetInt(NULL, start, &y) != TCL_OK) { *rest = ','; goto badIndex; } *rest = ','; start = rest+1; if (Tcl_GetInt(NULL, start, &y) != TCL_OK) { goto badIndex; } *indexPtr = NearestListboxElement(listPtr, y); return TCL_OK; } /* * 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; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2830 2831 2832 2833 2834 2835 2836 | static void ChangeListboxView( Listbox *listPtr, /* Information about widget. */ int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { | | | 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 | static void ChangeListboxView( Listbox *listPtr, /* Information about widget. */ int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { if (index >= ((int)listPtr->nElements - listPtr->fullLines)) { index = listPtr->nElements - listPtr->fullLines; } if (index < 0) { index = 0; } if (listPtr->topIndex != index) { listPtr->topIndex = index; |
︙ | ︙ | |||
2989 2990 2991 2992 2993 2994 2995 | if (index >= (listPtr->fullLines + listPtr->partialLine)) { index = listPtr->fullLines + listPtr->partialLine - 1; } if (index < 0) { index = 0; } index += listPtr->topIndex; | | | 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 | if (index >= (listPtr->fullLines + listPtr->partialLine)) { index = listPtr->fullLines + listPtr->partialLine - 1; } if (index < 0) { index = 0; } index += listPtr->topIndex; if (index >= (int)listPtr->nElements) { index = listPtr->nElements-1; } return index; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3033 3034 3035 3036 3037 3038 3039 | Tcl_HashEntry *entry; if (last < first) { i = first; first = last; last = i; } | | | | 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 | Tcl_HashEntry *entry; if (last < first) { i = first; first = last; last = i; } if ((last < 0) || (first >= (int)listPtr->nElements)) { return TCL_OK; } if (first < 0) { first = 0; } if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } oldCount = listPtr->numSelected; firstRedisplay = -1; /* * For each index in the range, find it in our selection hash table. If |
︙ | ︙ | |||
3108 3109 3110 3111 3112 3113 3114 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | | | 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 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size ListboxFetchSelection( void *clientData, /* Information about listbox widget. */ Tcl_Size offset, /* Offset within selection of first byte to be * returned. */ char *buffer, /* Location in which to place selection. */ Tcl_Size maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { Listbox *listPtr = (Listbox *)clientData; Tcl_DString selection; int count, needNewline, i; Tcl_Size length, stringLen; Tcl_Obj *curElement; const char *stringRep; Tcl_HashEntry *entry; if ((!listPtr->exportSelection) || Tcl_IsSafe(listPtr->interp)) { return -1; } /* * Use a dynamic string to accumulate the contents of the selection. */ needNewline = 0; Tcl_DStringInit(&selection); for (i = 0; i < (int)listPtr->nElements; i++) { 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) { |
︙ | ︙ | |||
3193 3194 3195 3196 3197 3198 3199 | * not containing a selection. * *---------------------------------------------------------------------- */ static void ListboxLostSelection( | | | 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 | * not containing a selection. * *---------------------------------------------------------------------- */ static void ListboxLostSelection( void *clientData) /* Information about listbox widget. */ { Listbox *listPtr = (Listbox *)clientData; if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->nElements > 0)) { ListboxSelect(listPtr, 0, listPtr->nElements-1, 0); GenerateListboxSelectEvent(listPtr); |
︙ | ︙ | |||
3248 3249 3250 3251 3252 3253 3254 | * *---------------------------------------------------------------------- */ static void EventuallyRedrawRange( Listbox *listPtr, /* Information about widget. */ | | | < < < | 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 | * *---------------------------------------------------------------------- */ static void EventuallyRedrawRange( Listbox *listPtr, /* Information about widget. */ TCL_UNUSED(Tcl_Size), /* Index of first element in list that needs * to be redrawn. */ TCL_UNUSED(Tcl_Size)) /* Index of last element in list that needs to * be redrawn. May be less than first; these * just bracket a range. */ { /* * We don't have to register a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped. */ if ((listPtr->flags & REDRAW_PENDING) || (listPtr->flags & LISTBOX_DELETED) |
︙ | ︙ | |||
3326 3327 3328 3329 3330 3331 3332 | * We must hold onto the interpreter from the listPtr because the data at * listPtr might be freed as a result of the Tcl_EvalEx. */ interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); | | | | | | | | 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 | * We must hold onto the interpreter from the listPtr because the data at * listPtr might be freed as a result of the Tcl_EvalEx. */ interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, listPtr->yScrollCmd, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (vertical scrolling command executed by listbox)"); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); |
︙ | ︙ | |||
3398 3399 3400 3401 3402 3403 3404 | * We must hold onto the interpreter because the data referred to at * listPtr might be freed as a result of the call to Tcl_EvalEx. */ interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); | | | | | | | | 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 | * We must hold onto the interpreter because the data referred to at * listPtr might be freed as a result of the call to Tcl_EvalEx. */ interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, listPtr->xScrollCmd, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (horizontal scrolling command executed by listbox)"); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); |
︙ | ︙ | |||
3431 3432 3433 3434 3435 3436 3437 | * None. * *---------------------------------------------------------------------- */ static char * ListboxListVarProc( | | | | | < < | | | 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 | * None. * *---------------------------------------------------------------------- */ static char * ListboxListVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), TCL_UNUSED(const char *), int flags) /* Information about what happened. */ { Listbox *listPtr = (Listbox *)clientData; Tcl_Obj *oldListObj, *varListObj; Tcl_Size oldLength, i; Tcl_HashEntry *entry; /* * 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 |
︙ | ︙ | |||
3543 3544 3545 3546 3547 3548 3549 | Tcl_DeleteHashEntry(entry); } } } if (oldLength != listPtr->nElements) { listPtr->flags |= UPDATE_V_SCROLLBAR; | | | 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 | Tcl_DeleteHashEntry(entry); } } } if (oldLength != listPtr->nElements) { listPtr->flags |= UPDATE_V_SCROLLBAR; if (listPtr->topIndex > ((int)listPtr->nElements - listPtr->fullLines)) { listPtr->topIndex = listPtr->nElements - listPtr->fullLines; if (listPtr->topIndex < 0) { listPtr->topIndex = 0; } } } |
︙ | ︙ | |||
3587 3588 3589 3590 3591 3592 3593 | * *---------------------------------------------------------------------- */ static void MigrateHashEntries( Tcl_HashTable *table, | | | | > | | | 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 | * *---------------------------------------------------------------------- */ static void MigrateHashEntries( Tcl_HashTable *table, Tcl_Size first, Tcl_Size last, Tcl_Size offset) { Tcl_Size i; int isNew; Tcl_HashEntry *entry; void *clientData; if (offset == 0) { return; } /* * It's more efficient to do one if/else and nest the for loops inside, |
︙ | ︙ |
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" |
︙ | ︙ | |||
62 63 64 65 66 67 68 | * Now, we go through structure and process all of the commands. Since the * structure is changing, we stop after we do one command, and start over. * When we get through without doing any, we are done. */ do { finished = 1; | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | * Now, we go through structure and process all of the commands. Since the * structure is changing, we stop after we do one command, and start over. * When we get through without doing any, we are done. */ do { finished = 1; for (index = 0; index < menuPtr->numEntries; index++) { TkMenuEntry *entryPtr = menuPtr->entries[index]; if ((entryPtr->type == CASCADE_ENTRY) && (entryPtr->namePtr != NULL) && (entryPtr->childMenuRefPtr != NULL) && (entryPtr->childMenuRefPtr->menuPtr != NULL)) { TkMenu *cascadeMenuPtr = entryPtr->childMenuRefPtr->menuPtr; |
︙ | ︙ |
Changes to generic/tkMain.c.
1 2 3 4 5 6 7 8 9 | /* * tkMain.c -- * * This file contains a generic main program for Tk-based applications. * It can be used as-is for many applications, just by supplying a * different appInitProc function for each specific application. Or, it * can be used as a template for creating new main programs for Tk * applications. * | | | > | > > | | | | < | 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 | /* * tkMain.c -- * * This file contains a generic main program for Tk-based applications. * It can be used as-is for many applications, just by supplying a * different appInitProc function for each specific application. Or, it * can be used as a template for creating new main programs for Tk * applications. * * 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" #if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD) MODULE_SCOPE void TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); #endif /* * The default prompt used when the user has not overridden it. */ static const char DEFAULT_PRIMARY_PROMPT[] = "% "; static const char ENCODING_ERROR[] = "\n\t(encoding error in stderr)"; /* * 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 |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 | static inline Tcl_Obj * NewNativeObj( TCHAR *string) { Tcl_Obj *obj; Tcl_DString ds; | > | > | | | | | | | 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 | static inline Tcl_Obj * NewNativeObj( TCHAR *string) { Tcl_Obj *obj; Tcl_DString ds; const char *str; #if defined(_WIN32) && defined(UNICODE) Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(string, wcslen(string), &ds); str = Tcl_DStringValue(&ds); #else str = Tcl_ExternalToUtfDString(NULL, (char *)string, strlen(string), &ds); #endif obj = Tcl_NewStringObj(str, 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. */ Tcl_DString line; /* Used to read the next line from the * terminal input. */ int gotPartial; Tcl_Interp *interp; /* Interpreter that evaluates interactive * commands. */ } InteractiveState; /* * Forward declarations for functions defined later in this file. */ static void Prompt(Tcl_Interp *interp, InteractiveState *isPtr); static void StdinProc(void *clientData, int mask); /* *---------------------------------------------------------------------- * * Tk_MainEx -- * * Main program for Wish and most other Tk-based applications. |
︙ | ︙ | |||
157 158 159 160 161 162 163 | * interpreted. * *---------------------------------------------------------------------- */ void Tk_MainEx( | | > > > > > > | | | | < | < | | | | < | > | | | > | | | < < < < < < < < | | | 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 | * interpreted. * *---------------------------------------------------------------------- */ void Tk_MainEx( Tcl_Size argc, /* Number of arguments. */ 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.7-", 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 libtcl9tk9.?.dll, not this one. */ if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) { loadCygwinTk: TkCygwinMainEx(argc, argv, appInitProc, interp); /* Only returns when Tk_MainEx() was not found */ } else { Tcl_Size 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)) { /* * 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++; } } 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((Tcl_WideInt)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. */ |
︙ | ︙ | |||
398 399 400 401 402 403 404 | * Could be almost arbitrary, depending on the command that's typed. * *---------------------------------------------------------------------- */ static void StdinProc( | | | | | | > > > > > > < < > | | < | | | < | | > | | > > | | > > > | > > > > > > > > > | 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 | * Could be almost arbitrary, depending on the command that's typed. * *---------------------------------------------------------------------- */ static void StdinProc( void *clientData, /* The state of interactive cmd line */ TCL_UNUSED(int) /*mask*/) { char *cmd; int code; Tcl_Size 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), TCL_INDEX_NONE); cmd = Tcl_DStringAppend(&isPtr->command, "\n", TCL_INDEX_NONE); Tcl_DStringFree(&isPtr->line); if (!Tcl_CommandComplete(cmd)) { isPtr->gotPartial = 1; goto prompt; } isPtr->gotPartial = 0; /* * Disable the stdin channel handler while evaluating the command; * 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) { if (Tcl_WriteObj(chan, Tcl_GetObjResult(interp)) < 0) { Tcl_WriteChars(chan, ENCODING_ERROR, -1); } 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)) { if (Tcl_WriteObj(chan, resultPtr) < 0) { Tcl_WriteChars(chan, "\n\t(encoding error in stdout)", -1); } 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)"); | < | | | | | > | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | } } } 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) { if (Tcl_WriteObj(chan, Tcl_GetObjResult(interp)) < 0) { Tcl_WriteChars(chan, ENCODING_ERROR, -1); } 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 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 | }; 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, TCL_INDEX_NONE, offsetof(TkMenu, relief), 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. */ static const char *const menuOptions[] = { "activate", "add", "cget", "clone", "configure", "delete", "entrycget", "entryconfigure", "id", "index", "insert", "invoke", "post", "postcascade", "type", "unpost", "xposition", "yposition", NULL }; enum options { MENU_ACTIVATE, MENU_ADD, MENU_CGET, MENU_CLONE, MENU_CONFIGURE, MENU_DELETE, MENU_ENTRYCGET, MENU_ENTRYCONFIGURE, MENU_ID, MENU_INDEX, MENU_INSERT, MENU_INVOKE, MENU_POST, MENU_POSTCASCADE, MENU_TYPE, MENU_UNPOST, MENU_XPOSITION, MENU_YPOSITION }; /* * Prototypes for static functions in this file: */ static int CloneMenu(TkMenu *menuPtr, Tcl_Obj *newMenuName, Tcl_Obj *newMenuTypeString); static int ConfigureMenu(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int ConfigureMenuCloneEntries(TkMenu *menuPtr, int index, Tcl_Size objc, Tcl_Obj *const objv[]); static int ConfigureMenuEntry(TkMenuEntry *mePtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteMenuCloneEntries(TkMenu *menuPtr, int first, int last); static void DestroyMenuHashTable(void *clientData, Tcl_Interp *interp); static void DestroyMenuInstance(TkMenu *menuPtr); static Tcl_FreeProc DestroyMenuEntry; static Tcl_Size GetIndexFromCoords(Tcl_Interp *interp, TkMenu *menuPtr, const char *string, Tcl_Size *indexPtr); static int MenuDoYPosition(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr); static int MenuDoXPosition(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr); static int MenuAddOrInsert(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *indexPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void MenuCmdDeletedProc(void *clientData); static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, Tcl_Size index, int type); static char * MenuVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_ObjCmdProc MenuWidgetObjCmd; static void MenuWorldChanged(void *instanceData); static int PostProcessEntry(TkMenuEntry *mePtr); static void RecursivelyDeleteMenu(TkMenu *menuPtr); static void UnhookCascadeEntry(TkMenuEntry *mePtr); static void MenuCleanup(void *unused); static int GetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr, int lastOK, Tcl_Size *indexPtr); /* * The structure below is a list of procs that respond to certain window * manager events. One of these includes a font change, which forces the * geometry proc to be called. */ |
︙ | ︙ | |||
400 401 402 403 404 405 406 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MenuObjCmd( | | > | | 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 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MenuObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = (Tk_Window)clientData; Tk_Window newWin; TkMenu *menuPtr; TkMenuReferences *menuRefPtr; Tcl_Size i; int index, toplevel; const char *windowName; static const char *const typeStringList[] = {"-type", NULL}; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); |
︙ | ︙ | |||
459 460 461 462 463 464 465 466 467 468 469 470 471 472 | menuPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); menuPtr->active = TCL_INDEX_NONE; menuPtr->cursorPtr = NULL; menuPtr->mainMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; TkMenuInitializeDrawingFields(menuPtr); Tk_SetClass(menuPtr->tkwin, "Menu"); Tk_SetClassProcs(menuPtr->tkwin, &menuClass, menuPtr); Tk_CreateEventHandler(newWin, ExposureMask|StructureNotifyMask|ActivateMask, TkMenuEventProc, menuPtr); | > > | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | menuPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); menuPtr->active = TCL_INDEX_NONE; menuPtr->cursorPtr = NULL; menuPtr->mainMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; Tcl_InitHashTable(&menuPtr->items, TCL_STRING_KEYS); menuPtr->serial = 0; TkMenuInitializeDrawingFields(menuPtr); Tk_SetClass(menuPtr->tkwin, "Menu"); Tk_SetClassProcs(menuPtr->tkwin, &menuClass, menuPtr); Tk_CreateEventHandler(newWin, ExposureMask|StructureNotifyMask|ActivateMask, TkMenuEventProc, menuPtr); |
︙ | ︙ | |||
526 527 528 529 530 531 532 | * creating exists. */ if ((menuPtr->mainMenuPtr != menuPtr) || ((menuPtr->mainMenuPtr == menuPtr) && ((cascadeListPtr->menuPtr->mainMenuPtr == cascadeListPtr->menuPtr)))) { | | | | | | 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 | * creating exists. */ if ((menuPtr->mainMenuPtr != menuPtr) || ((menuPtr->mainMenuPtr == menuPtr) && ((cascadeListPtr->menuPtr->mainMenuPtr == cascadeListPtr->menuPtr)))) { newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1); Tcl_IncrRefCount(newObjv[0]); Tcl_IncrRefCount(newObjv[1]); ConfigureMenuEntry(cascadeListPtr, 2, newObjv); Tcl_DecrRefCount(newObjv[0]); Tcl_DecrRefCount(newObjv[1]); } else { Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); Tcl_Obj *windowNamePtr = Tcl_NewStringObj( Tk_PathName(cascadeListPtr->menuPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(normalPtr); Tcl_IncrRefCount(windowNamePtr); newMenuName = TkNewMenuName(menuPtr->interp, windowNamePtr, menuPtr); Tcl_IncrRefCount(newMenuName); CloneMenu(menuPtr, newMenuName, normalPtr); /* * Now we can set the new menu instance to be the cascade * entry of the parent's instance. */ newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = newMenuName; Tcl_IncrRefCount(newObjv[0]); ConfigureMenuEntry(cascadeListPtr, 2, newObjv); Tcl_DecrRefCount(normalPtr); Tcl_DecrRefCount(newObjv[0]); Tcl_DecrRefCount(newObjv[1]); Tcl_DecrRefCount(windowNamePtr); |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
613 614 615 616 617 618 619 | * See the user documentation. * *-------------------------------------------------------------- */ static int MenuWidgetObjCmd( | | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | * See the user documentation. * *-------------------------------------------------------------- */ static int MenuWidgetObjCmd( void *clientData, /* Information about menu widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; int result = TCL_OK; |
︙ | ︙ | |||
637 638 639 640 641 642 643 | sizeof(char *), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(menuPtr); switch ((enum options) option) { case MENU_ACTIVATE: { | | | | 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 | sizeof(char *), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(menuPtr); switch ((enum options) option) { case MENU_ACTIVATE: { Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (menuPtr->active == index) { goto done; } if ((index >= 0) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY) || (menuPtr->entries[index]->state == ENTRY_DISABLED))) { index = TCL_INDEX_NONE; } result = TkActivateMenuEntry(menuPtr, index); break; } case MENU_ADD: |
︙ | ︙ | |||
721 722 723 724 725 726 727 | } if (result != TCL_OK) { goto error; } break; } case MENU_DELETE: { | | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | } if (result != TCL_OK) { goto error; } break; } case MENU_DELETE: { Tcl_Size first, last; Tcl_WideInt w; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "first ?last?"); goto error; } |
︙ | ︙ | |||
757 758 759 760 761 762 763 | /* * Sorry, can't delete the tearoff entry; must reconfigure the * menu. */ first = 1; } | | | | | | | 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 | /* * Sorry, can't delete the tearoff entry; must reconfigure the * menu. */ first = 1; } if ((first < 0) || (last < first)) { goto done; } DeleteMenuCloneEntries(menuPtr, first, last); break; } case MENU_ENTRYCGET: { Tcl_Size index; Tcl_Obj *resultPtr; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index option"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index < 0) { goto done; } mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); resultPtr = Tk_GetOptionValue(interp, mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); Tcl_Release(mePtr); if (resultPtr == NULL) { goto error; } Tcl_SetObjResult(interp, resultPtr); break; } case MENU_ENTRYCONFIGURE: { Tcl_Size index; Tcl_Obj *resultPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index ?-option value ...?"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index < 0) { goto done; } mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); if (objc == 3) { resultPtr = Tk_GetOptionInfo(interp, mePtr, mePtr->optionTable, NULL, menuPtr->tkwin); |
︙ | ︙ | |||
823 824 825 826 827 828 829 | if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else { | | > > > > > > > > > > > > > > > > > > > > > > | | | | | > | | | | 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 | if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else { result = ConfigureMenuCloneEntries(menuPtr, index, objc-3, objv+3); } Tcl_Release(mePtr); break; } case MENU_ID: { Tcl_Size index; const char *idStr; Tcl_HashEntry *entryPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index < 0) { goto done; } entryPtr = menuPtr->entries[index]->entryPtr; if (entryPtr) { idStr = (const char *)Tcl_GetHashKey(&menuPtr->items, entryPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj(idStr, TCL_INDEX_NONE)); } break; } case MENU_INDEX: { Tcl_Size index; 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 < 0) { Tcl_SetObjResult(interp, Tcl_NewObj()); } else { Tcl_SetObjResult(interp, TkNewIndexObj(index)); } break; } case MENU_INSERT: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "index type ?-option value ...?"); goto error; } if (MenuAddOrInsert(interp,menuPtr,objv[2],objc-3,objv+3) != TCL_OK) { goto error; } break; case MENU_INVOKE: { Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index < 0) { goto done; } result = TkInvokeMenu(interp, menuPtr, index); break; } case MENU_POST: { int x, y; Tcl_Size index = TCL_INDEX_NONE; if (objc != 4 && objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "x y ?index?"); goto error; } if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { |
︙ | ︙ | |||
908 909 910 911 912 913 914 | result = TkpPostMenu(interp, menuPtr, x, y, index); } else { result = TkpPostTearoffMenu(interp, menuPtr, x, y, index); } break; } case MENU_POSTCASCADE: { | | | | | | | 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 | result = TkpPostMenu(interp, menuPtr, x, y, index); } else { result = TkpPostTearoffMenu(interp, menuPtr, x, y, index); } break; } case MENU_POSTCASCADE: { Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if ((index < 0) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) { result = TkPostSubmenu(interp, menuPtr, NULL); } else { result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]); } break; } case MENU_TYPE: { Tcl_Size index; const char *typeStr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index < 0) { goto done; } if (menuPtr->entries[index]->type == TEAROFF_ENTRY) { typeStr = "tearoff"; } else { typeStr = menuEntryTypeStrings[menuPtr->entries[index]->type]; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, TCL_INDEX_NONE)); break; } case MENU_UNPOST: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } |
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | *---------------------------------------------------------------------- */ int TkInvokeMenu( Tcl_Interp *interp, /* The interp that the menu lives in. */ TkMenu *menuPtr, /* The menu we are invoking. */ | | | | | | | 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 | *---------------------------------------------------------------------- */ int TkInvokeMenu( Tcl_Interp *interp, /* The interp that the menu lives in. */ TkMenu *menuPtr, /* The menu we are invoking. */ Tcl_Size index) /* The zero based index of the item we are * invoking. */ { int result = TCL_OK; TkMenuEntry *mePtr; if (index < 0) { goto done; } mePtr = menuPtr->entries[index]; if (mePtr->state == ENTRY_DISABLED) { goto done; } Tcl_Preserve(mePtr); if (mePtr->type == TEAROFF_ENTRY) { Tcl_DString ds; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "tk::TearOffMenu ", TCL_INDEX_NONE); Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&ds); } else if ((mePtr->type == CHECK_BUTTON_ENTRY) && (mePtr->namePtr != NULL)) { Tcl_Obj *valuePtr; if (mePtr->entryFlags & ENTRY_SELECTED) { valuePtr = mePtr->offValuePtr; |
︙ | ︙ | |||
1136 1137 1138 1139 1140 1141 1142 | menuPtr->menuRefPtr = NULL; } for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) { nextCascadePtr = cascadePtr->nextCascadePtr; if (menuPtr->mainMenuPtr != menuPtr) { | | | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | menuPtr->menuRefPtr = NULL; } for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) { nextCascadePtr = cascadePtr->nextCascadePtr; if (menuPtr->mainMenuPtr != menuPtr) { Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr; parentMainEntryPtr = parentMainMenuPtr->entries[cascadePtr->index]; newObjv[0] = menuNamePtr; newObjv[1] = parentMainEntryPtr->namePtr; |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | /* * Free up all the stuff that requires special handling, then let * Tk_FreeConfigOptions handle all the standard option-related stuff. */ for (i = menuPtr->numEntries; --i >= 0; ) { /* * As each menu entry is deleted from the end of the array of entries, * decrement menuPtr->numEntries. Otherwise, the act of deleting menu * entry i will dereference freed memory attempting to queue a redraw * for menu entries (i+1)...numEntries. */ | > > > > > > > > > > > > | > > > | < | | | | | 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 | /* * Free up all the stuff that requires special handling, then let * Tk_FreeConfigOptions handle all the standard option-related stuff. */ for (i = menuPtr->numEntries; --i >= 0; ) { /* * Clean up the hash entry for the menu item ID. * This cannot be postponed until the entry is eventually freed, * because the hash table may already have been deleted by then. */ if (menuPtr->entries[i]->entryPtr) { Tcl_DeleteHashEntry(menuPtr->entries[i]->entryPtr); menuPtr->entries[i]->entryPtr = NULL; } /* * As each menu entry is deleted from the end of the array of entries, * decrement menuPtr->numEntries. Otherwise, the act of deleting menu * entry i will dereference freed memory attempting to queue a redraw * for menu entries (i+1)...numEntries. */ Tcl_EventuallyFree(menuPtr->entries[i], DestroyMenuEntry); menuPtr->numEntries = i; } menuPtr->active = -1; if (menuPtr->entries != NULL) { ckfree(menuPtr->entries); menuPtr->entries = NULL; } Tcl_DeleteHashTable(&menuPtr->items); TkMenuFreeDrawOptions(menuPtr); Tk_FreeConfigOptions(menuPtr, tsdPtr->menuOptionTable, menuPtr->tkwin); if (menuPtr->tkwin != NULL) { Tk_Window tkwin = menuPtr->tkwin; menuPtr->tkwin = NULL; Tk_DestroyWindow(tkwin); } } /* *---------------------------------------------------------------------- * * TkDestroyMenu -- * * This function is invoked to clean up the internal structure of a menu * at a safe time (when no-one is using it anymore). If called on a main * instance, destroys all of the instances. If called on a non-main * instance, just destroys that instance. * * Results: * None. * * Side effects: * Everything associated with the menu is freed up. * |
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | * Everything associated with the menu entry is freed. * *---------------------------------------------------------------------- */ static void DestroyMenuEntry( void *memPtr) /* Pointer to entry to be freed. */ { TkMenuEntry *mePtr = (TkMenuEntry *)memPtr; TkMenu *menuPtr = mePtr->menuPtr; if (menuPtr->postedCascade == mePtr) { /* * Ignore errors while unposting the menu, since it's possible that | > > > > | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | * Everything associated with the menu entry is freed. * *---------------------------------------------------------------------- */ static void DestroyMenuEntry( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Pointer to entry to be freed. */ #else char *memPtr) #endif { TkMenuEntry *mePtr = (TkMenuEntry *)memPtr; TkMenu *menuPtr = mePtr->menuPtr; if (menuPtr->postedCascade == mePtr) { /* * Ignore errors while unposting the menu, since it's possible that |
︙ | ︙ | |||
1460 1461 1462 1463 1464 1465 1466 1467 1468 | && (mePtr->namePtr != NULL)) { const char *varName = Tcl_GetString(mePtr->namePtr); Tcl_UntraceVar2(menuPtr->interp, varName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, mePtr); } TkpDestroyMenuEntry(mePtr); TkMenuEntryFreeDrawOptions(mePtr); | > > > > | | 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 | && (mePtr->namePtr != NULL)) { const char *varName = Tcl_GetString(mePtr->namePtr); Tcl_UntraceVar2(menuPtr->interp, varName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, mePtr); } if (mePtr->entryPtr) { Tcl_DeleteHashEntry(mePtr->entryPtr); mePtr->entryPtr = NULL; } TkpDestroyMenuEntry(mePtr); TkMenuEntryFreeDrawOptions(mePtr); Tk_FreeConfigOptions(mePtr, mePtr->optionTable, menuPtr->tkwin); ckfree(mePtr); } /* *--------------------------------------------------------------------------- * * MenuWorldChanged -- |
︙ | ︙ | |||
1486 1487 1488 1489 1490 1491 1492 | * Menu will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void MenuWorldChanged( | | | | 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 | * Menu will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void MenuWorldChanged( void *instanceData) /* Information about widget. */ { TkMenu *menuPtr = (TkMenu *)instanceData; Tcl_Size i; TkMenuConfigureDrawOptions(menuPtr); for (i = 0; i < menuPtr->numEntries; i++) { TkMenuConfigureEntryDrawOptions(menuPtr->entries[i], menuPtr->entries[i]->index); TkpConfigureMenuEntry(menuPtr->entries[i]); } |
︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | */ static int ConfigureMenu( Tcl_Interp *interp, /* Used for error reporting. */ TkMenu *menuPtr, /* Information about widget; may or may not * already have values for some fields. */ | | | 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | */ static int ConfigureMenu( Tcl_Interp *interp, /* Used for error reporting. */ TkMenu *menuPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ { int i; TkMenu *menuListPtr, *cleanupPtr; int result; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
1627 1628 1629 1630 1631 1632 1633 | } return TCL_ERROR; } } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { | | | | | 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 | } return TCL_ERROR; } } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { Tcl_EventuallyFree(menuListPtr->entries[0], DestroyMenuEntry); for (i = 0; i < menuListPtr->numEntries - 1; i++) { menuListPtr->entries[i] = menuListPtr->entries[i + 1]; menuListPtr->entries[i]->index = i; } if (--menuListPtr->numEntries == 0) { ckfree(menuListPtr->entries); menuListPtr->entries = NULL; } } TkMenuConfigureDrawOptions(menuListPtr); /* * After reconfiguring a menu, we need to reconfigure all of the * entries in the menu, since some of the things in the children (such * as graphics contexts) may have to change to reflect changes in the * parent. */ for (i = 0; i < menuListPtr->numEntries; i++) { TkMenuEntry *mePtr; mePtr = menuListPtr->entries[i]; ConfigureMenuEntry(mePtr, 0, NULL); } TkEventuallyRecomputeMenu(menuListPtr); |
︙ | ︙ | |||
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 { | | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 | * 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. */ |
︙ | ︙ | |||
1905 1906 1907 1908 1909 1910 1911 | *---------------------------------------------------------------------- */ static int ConfigureMenuEntry( TkMenuEntry *mePtr,/* Information about menu entry; may or may * not already have values for some fields. */ | | | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 | *---------------------------------------------------------------------- */ static int ConfigureMenuEntry( TkMenuEntry *mePtr,/* Information about menu entry; may or may * not already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ { TkMenu *menuPtr = mePtr->menuPtr; Tk_SavedOptions errorStruct; int result; /* |
︙ | ︙ | |||
1955 1956 1957 1958 1959 1960 1961 | *---------------------------------------------------------------------- * * ConfigureMenuCloneEntries -- * * Calls ConfigureMenuEntry for each menu in the clone chain. * * Results: | | < < | < | 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 | *---------------------------------------------------------------------- * * ConfigureMenuCloneEntries -- * * Calls ConfigureMenuEntry for each menu in the clone chain. * * Results: * The return value is a standard Tcl result. * * Side effects: * Configuration information such as label and accelerator get set for * mePtr; old resources get freed, if there were any. * *---------------------------------------------------------------------- */ static int ConfigureMenuCloneEntries( TkMenu *menuPtr, /* Information about whole menu. */ int index, /* Index of mePtr within menuPtr's entries. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ { TkMenuEntry *mePtr; TkMenu *menuListPtr; int cascadeEntryChanged = 0; TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL; Tcl_Obj *oldCascadePtr = NULL; const char *newCascadeName; /* * Cascades are kind of tricky here. This is special case #3 in the * comment at the top of this file. Basically, if a menu is the main * menu of a clone chain, and has an entry with a cascade menu, the clones * of the menu will point to clones of the cascade menu. We have to * destroy the clones of the cascades, clone the new cascade menu, and |
︙ | ︙ | |||
2060 2061 2062 2063 2064 2065 2066 | } if (cascadeEntryChanged && (mePtr->namePtr != NULL)) { if (cascadeMenuRefPtr && cascadeMenuRefPtr->menuPtr != NULL) { Tcl_Obj *newObjv[2]; Tcl_Obj *newCloneNamePtr; Tcl_Obj *pathNamePtr = Tcl_NewStringObj( | | | | | 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 | } if (cascadeEntryChanged && (mePtr->namePtr != NULL)) { if (cascadeMenuRefPtr && cascadeMenuRefPtr->menuPtr != NULL) { Tcl_Obj *newObjv[2]; Tcl_Obj *newCloneNamePtr; Tcl_Obj *pathNamePtr = Tcl_NewStringObj( Tk_PathName(menuListPtr->tkwin), TCL_INDEX_NONE); Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); Tcl_Obj *menuObjPtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); Tcl_IncrRefCount(pathNamePtr); newCloneNamePtr = TkNewMenuName(menuPtr->interp, pathNamePtr, cascadeMenuRefPtr->menuPtr); Tcl_IncrRefCount(newCloneNamePtr); Tcl_IncrRefCount(normalPtr); |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | Tcl_Interp *interp, /* For error messages. */ TkMenu *menuPtr, /* Menu for which the index is being * specified. */ Tcl_Obj *objPtr, /* Specification of an entry in menu. See * manual entry for valid .*/ int lastOK, /* Non-zero means its OK to return index just * *after* last entry. */ | | | > | | | > > > > > < > > | < > > > > > > > > | | < < < | 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 | Tcl_Interp *interp, /* For error messages. */ TkMenu *menuPtr, /* Menu for which the index is being * specified. */ Tcl_Obj *objPtr, /* Specification of an entry in menu. See * manual entry for valid .*/ int lastOK, /* Non-zero means its OK to return index just * *after* last entry. */ Tcl_Size *indexPtr) /* Where to store converted index. */ { Tcl_Size i; const char *string; Tcl_HashEntry *entryPtr; 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 >= 0 || Tcl_GetString(objPtr)[0] != '-') { if (*indexPtr >= menuPtr->numEntries) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); } return TCL_OK; } } string = Tcl_GetString(objPtr); if ((string[0] == 'a') && (strcmp(string, "active") == 0)) { *indexPtr = menuPtr->active; return TCL_OK; } if ((string[0] == 'l') && (strcmp(string, "last") == 0)) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); return TCL_OK; } if (string[0] == 0) { *indexPtr = TCL_INDEX_NONE; return TCL_OK; } #if !defined(TK_NO_DEPRECATED) if ((string[0] == 'n') && (strcmp(string, "none") == 0)) { *indexPtr = TCL_INDEX_NONE; return TCL_OK; } #endif if (string[0] == '@') { if (GetIndexFromCoords(interp, menuPtr, string, indexPtr) == TCL_OK) { return TCL_OK; } } entryPtr = Tcl_FindHashEntry(&menuPtr->items, string); if (entryPtr) { TkMenuEntry *mePtr = (TkMenuEntry *)Tcl_GetHashValue(entryPtr); *indexPtr = mePtr->index; return TCL_OK; } for (i = 0; i < menuPtr->numEntries; i++) { Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr; const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr); if ((label != NULL) && (Tcl_StringCaseMatch(label, string, 0))) { *indexPtr = i; return TCL_OK; } } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad menu entry index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * MenuCmdDeletedProc -- * |
︙ | ︙ | |||
2194 2195 2196 2197 2198 2199 2200 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MenuCmdDeletedProc( | | | 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MenuCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkMenu *menuPtr = (TkMenu *)clientData; Tk_Window tkwin = menuPtr->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 |
︙ | ︙ | |||
2238 2239 2240 2241 2242 2243 2244 | * *---------------------------------------------------------------------- */ static TkMenuEntry * MenuNewEntry( TkMenu *menuPtr, /* Menu that will hold the new entry. */ | | | | 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 | * *---------------------------------------------------------------------- */ static TkMenuEntry * MenuNewEntry( TkMenu *menuPtr, /* Menu that will hold the new entry. */ Tcl_Size index, /* Where in the menu the new entry is to * go. */ int type) /* The type of the new entry. */ { TkMenuEntry *mePtr; TkMenuEntry **newEntries; Tcl_Size i; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Create a new array of entries with an empty slot for the new entry. */ |
︙ | ︙ | |||
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; | | | 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 | 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; |
︙ | ︙ | |||
2303 2304 2305 2306 2307 2308 2309 2310 2311 | mePtr->index = index; mePtr->nextCascadePtr = NULL; if (Tk_InitOptions(menuPtr->interp, mePtr, mePtr->optionTable, menuPtr->tkwin) != TCL_OK) { ckfree(mePtr); return NULL; } TkMenuInitializeEntryDrawingFields(mePtr); if (TkpMenuNewEntry(mePtr) != TCL_OK) { | > | | 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | mePtr->index = index; mePtr->nextCascadePtr = NULL; if (Tk_InitOptions(menuPtr->interp, mePtr, mePtr->optionTable, menuPtr->tkwin) != TCL_OK) { ckfree(mePtr); return NULL; } mePtr->entryPtr = NULL; TkMenuInitializeEntryDrawingFields(mePtr); if (TkpMenuNewEntry(mePtr) != TCL_OK) { Tk_FreeConfigOptions(mePtr, mePtr->optionTable, menuPtr->tkwin); ckfree(mePtr); return NULL; } return mePtr; } |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | static int MenuAddOrInsert( Tcl_Interp *interp, /* Used for error reporting. */ TkMenu *menuPtr, /* Widget in which to create new entry. */ Tcl_Obj *indexPtr, /* Object describing index at which to insert. * NULL means insert at end. */ | | | > > > > | > > > > > > > > > > > > > > > > < | | | > > > > > > > > > > > > > > > > > | | | | 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 | static int MenuAddOrInsert( Tcl_Interp *interp, /* Used for error reporting. */ TkMenu *menuPtr, /* Widget in which to create new entry. */ Tcl_Obj *indexPtr, /* Object describing index at which to insert. * NULL means insert at end. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of * entry, others are config options. */ { int type; Tcl_Size index; TkMenuEntry *mePtr; TkMenu *menuListPtr; Tcl_HashEntry *entryPtr; Tcl_Obj *idPtr = NULL; int isNew; int offs; if (indexPtr != NULL) { if (GetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) { return TCL_ERROR; } } else { index = menuPtr->numEntries; } if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad menu entry index \"%s\"", Tcl_GetString(indexPtr))); Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL); return TCL_ERROR; } if (menuPtr->tearoff && (index == 0)) { index = 1; } /* * Figure out the type of the new entry. */ if (Tcl_GetIndexFromObjStruct(interp, objv[0], menuEntryTypeStrings, sizeof(char *), "menu entry type", 0, &type) != TCL_OK) { return TCL_ERROR; } offs = 1; /* * Check for a user supplied id */ if (objc % 2 == 0) { idPtr = objv[offs]; if (Tcl_FindHashEntry(&menuPtr->items, Tcl_GetString(idPtr))) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "entry \"%s\" already exists", Tcl_GetString(idPtr))); Tcl_SetErrorCode(interp, "TK", "MENU", "ENTRY_EXISTS", NULL); return TCL_ERROR; } offs++; } /* * Now we have to add an entry for every instance related to this menu. */ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { mePtr = MenuNewEntry(menuListPtr, index, type); if (mePtr == NULL) { return TCL_ERROR; } if (ConfigureMenuEntry(mePtr, objc - offs, objv + offs) != TCL_OK) { TkMenu *errorMenuPtr; Tcl_Size i; for (errorMenuPtr = menuPtr->mainMenuPtr; errorMenuPtr != NULL; errorMenuPtr = errorMenuPtr->nextInstancePtr) { Tcl_EventuallyFree(errorMenuPtr->entries[index], DestroyMenuEntry); for (i = index; i < errorMenuPtr->numEntries - 1; i++) { errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1]; errorMenuPtr->entries[i]->index = i; } if (--errorMenuPtr->numEntries == 0) { ckfree(errorMenuPtr->entries); errorMenuPtr->entries = NULL; } if (errorMenuPtr == menuListPtr) { break; } } return TCL_ERROR; } if (idPtr == NULL) { char idbuf[16]; /* Generate an id for the new entry on the main menu */ do { snprintf(idbuf, sizeof(idbuf), "e%03X", ++menuPtr->serial); entryPtr = Tcl_CreateHashEntry( &menuListPtr->items, idbuf, &isNew); } while (!isNew); idPtr = Tcl_NewStringObj(idbuf, TCL_INDEX_NONE); } else { /* Reuse the specified or previously generated id on all clones */ entryPtr = Tcl_CreateHashEntry( &menuListPtr->items, Tcl_GetString(idPtr), &isNew); } Tcl_SetHashValue(entryPtr, mePtr); mePtr->entryPtr = entryPtr; /* * If a menu has cascades, then every instance of the menu has to have * its own parallel cascade structure. So adding an entry to a menu * with clones means that the menu that the entry points to has to be * cloned for every clone the main menu has. This is special case #2 * in the comment at the top of this file. */ if ((menuPtr != menuListPtr) && (type == CASCADE_ENTRY)) { if ((mePtr->namePtr != NULL) && (mePtr->childMenuRefPtr != NULL) && (mePtr->childMenuRefPtr->menuPtr != NULL)) { TkMenu *cascadeMenuPtr = mePtr->childMenuRefPtr->menuPtr->mainMenuPtr; Tcl_Obj *newCascadePtr, *newObjv[2]; Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(menuListPtr->tkwin), TCL_INDEX_NONE); Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); TkMenuReferences *menuRefPtr; Tcl_IncrRefCount(windowNamePtr); newCascadePtr = TkNewMenuName(menuListPtr->interp, windowNamePtr, cascadeMenuPtr); Tcl_IncrRefCount(newCascadePtr); Tcl_IncrRefCount(normalPtr); |
︙ | ︙ | |||
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 | Tcl_DecrRefCount(newCascadePtr); Tcl_DecrRefCount(menuNamePtr); Tcl_DecrRefCount(windowNamePtr); Tcl_DecrRefCount(normalPtr); } } } return TCL_OK; } /* *-------------------------------------------------------------- * * MenuVarProc -- | > > | 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 | Tcl_DecrRefCount(newCascadePtr); Tcl_DecrRefCount(menuNamePtr); Tcl_DecrRefCount(windowNamePtr); Tcl_DecrRefCount(normalPtr); } } } Tcl_SetObjResult(interp, idPtr); return TCL_OK; } /* *-------------------------------------------------------------- * * MenuVarProc -- |
︙ | ︙ | |||
2475 2476 2477 2478 2479 2480 2481 | * The menu entry may become selected or deselected. * *-------------------------------------------------------------- */ static char * MenuVarProc( | | | | < < | 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 | * The menu entry may become selected or deselected. * *-------------------------------------------------------------- */ static char * MenuVarProc( void *clientData, /* Information about menu entry. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), /* First part of variable's name. */ TCL_UNUSED(const char *), /* Second part of variable's name. */ int flags) /* Describes what just happened. */ { TkMenuEntry *mePtr = (TkMenuEntry *)clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) { /* * Do nothing if the interpreter is going away or we have * no variable name. */ |
︙ | ︙ | |||
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) { | | | | 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 | 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 |
︙ | ︙ | |||
2589 2590 2591 2592 2593 2594 2595 | * *---------------------------------------------------------------------- */ int TkActivateMenuEntry( TkMenu *menuPtr, /* Menu in which to activate. */ | | | | | 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 | * *---------------------------------------------------------------------- */ int TkActivateMenuEntry( TkMenu *menuPtr, /* Menu in which to activate. */ Tcl_Size index) /* Index of entry to activate, or * TCL_INDEX_NONE to deactivate all entries. */ { TkMenuEntry *mePtr; int result = TCL_OK; if (menuPtr->active >= 0) { mePtr = menuPtr->entries[menuPtr->active]; /* * Don't change the state unless it's currently active (state might * already have been changed to disabled). */ if (mePtr->state == ENTRY_ACTIVE) { mePtr->state = ENTRY_NORMAL; } TkEventuallyRedrawMenu(menuPtr, menuPtr->entries[menuPtr->active]); } menuPtr->active = index; if (index >= 0) { mePtr = menuPtr->entries[index]; mePtr->state = ENTRY_ACTIVE; TkEventuallyRedrawMenu(menuPtr, mePtr); } return result; } |
︙ | ︙ | |||
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; | | > | | | | 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 | 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; Tcl_Size i; TkMenuReferences *menuRefPtr; Tcl_Obj *menuDupCommandArray[4]; if (newMenuTypePtr == NULL) { menuType = MAIN_MENU; } else { if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr, menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) { return TCL_ERROR; } } menuDupCommandArray[0] = Tcl_NewStringObj("tk::MenuDup", TCL_INDEX_NONE); menuDupCommandArray[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); menuDupCommandArray[2] = newMenuNamePtr; if (newMenuTypePtr == NULL) { menuDupCommandArray[3] = Tcl_NewStringObj("normal", TCL_INDEX_NONE); } else { menuDupCommandArray[3] = newMenuTypePtr; } for (i = 0; i < 4; i++) { Tcl_IncrRefCount(menuDupCommandArray[i]); } Tcl_Preserve(menuPtr); |
︙ | ︙ | |||
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]; | | | 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 | if ((returnResult == TCL_OK) && ((menuRefPtr = TkFindMenuReferencesObj(menuPtr->interp, newMenuNamePtr)) != NULL) && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; Tcl_Size numElements; /* * Now put this newly created menu into the parent menu's instance * chain. */ if (menuPtr->nextInstancePtr == NULL) { |
︙ | ︙ | |||
2755 2756 2757 2758 2759 2760 2761 | /* * Add the main menu's window to the bind tags for this window after * this window's tag. This is so the user can bind to either this * clone (which may not be easy to do) or the entire menu clone * structure. */ | | | | | 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 | /* * Add the main menu's window to the bind tags for this window after * this window's tag. This is so the user can bind to either this * clone (which may not be easy to do) or the entire menu clone * structure. */ newObjv[0] = Tcl_NewStringObj("bindtags", TCL_INDEX_NONE); newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(newObjv[0]); Tcl_IncrRefCount(newObjv[1]); if (Tk_BindtagsObjCmd(newMenuPtr->tkwin, newMenuPtr->interp, 2, newObjv) == TCL_OK) { const char *windowName; Tcl_Obj *bindingsPtr = Tcl_DuplicateObj(Tcl_GetObjResult(newMenuPtr->interp)); Tcl_Obj *elementPtr; Tcl_IncrRefCount(bindingsPtr); Tcl_ListObjLength(newMenuPtr->interp, bindingsPtr, &numElements); for (i = 0; i < numElements; i++) { Tcl_ListObjIndex(newMenuPtr->interp, bindingsPtr, i, &elementPtr); windowName = Tcl_GetString(elementPtr); if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin)) == 0) { Tcl_Obj *newElementPtr = Tcl_NewStringObj( Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), TCL_INDEX_NONE); /* * The newElementPtr will have its refCount incremented * here, so we don't need to worry about it any more. */ Tcl_ListObjReplace(menuPtr->interp, bindingsPtr, |
︙ | ︙ | |||
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. */ | | | 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 | 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, |
︙ | ︙ | |||
2823 2824 2825 2826 2827 2828 2829 | Tcl_IncrRefCount(windowNamePtr); newCascadePtr = TkNewMenuName(menuPtr->interp, windowNamePtr, oldCascadePtr); Tcl_IncrRefCount(newCascadePtr); CloneMenu(oldCascadePtr, newCascadePtr, NULL); | | | 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 | Tcl_IncrRefCount(windowNamePtr); newCascadePtr = TkNewMenuName(menuPtr->interp, windowNamePtr, oldCascadePtr); Tcl_IncrRefCount(newCascadePtr); CloneMenu(oldCascadePtr, newCascadePtr, NULL); newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = newCascadePtr; Tcl_IncrRefCount(newObjv[0]); ConfigureMenuEntry(newMenuPtr->entries[i], 2, newObjv); Tcl_DecrRefCount(newObjv[0]); Tcl_DecrRefCount(newCascadePtr); Tcl_DecrRefCount(windowNamePtr); } |
︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | static int MenuDoXPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { | | | | 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 | static int MenuDoXPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { Tcl_Size index; TkRecomputeMenu(menuPtr); if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_ResetResult(interp); if (index < 0) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->x)); } return TCL_OK; } |
︙ | ︙ | |||
2901 2902 2903 2904 2905 2906 2907 | static int MenuDoYPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { | | | | 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 | static int MenuDoYPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { Tcl_Size index; TkRecomputeMenu(menuPtr); if (GetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) { goto error; } Tcl_ResetResult(interp); if (index < 0) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->y)); } return TCL_OK; |
︙ | ︙ | |||
2939 2940 2941 2942 2943 2944 2945 | * * Side effects: * If int is invalid, interp's result will be set to NULL. * *---------------------------------------------------------------------- */ | | | | > | < < < < | | > | | > | | | > > > > > | | 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 | * * Side effects: * If int is invalid, interp's result will be set to NULL. * *---------------------------------------------------------------------- */ static Tcl_Size GetIndexFromCoords( Tcl_Interp *interp, /* Interpreter of menu. */ TkMenu *menuPtr, /* The menu we are searching. */ const char *string, /* The @string we are parsing. */ Tcl_Size *indexPtr) /* The index of the item that matches. */ { int x, y; Tcl_Size i; const char *p; const char *rest; int x2, borderwidth, max; TkRecomputeMenu(menuPtr); p = string + 1; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderwidth); rest = strchr(p, ','); if (rest) { Tcl_DString ds; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, p, rest - p); if (Tcl_GetInt(NULL, Tcl_DStringValue(&ds), &x) != TCL_OK) { goto error; } } else { x = borderwidth; rest = string; } p = rest + 1; if (Tcl_GetInt(NULL, p, &y) != TCL_OK) { goto error; } *indexPtr = -1; /* set the width of the final column to the remainder of the window * being aware of windows that may not be mapped yet. */ max = Tk_IsMapped(menuPtr->tkwin) ? Tk_Width(menuPtr->tkwin) : Tk_ReqWidth(menuPtr->tkwin); max -= borderwidth; for (i = 0; i < menuPtr->numEntries; i++) { if (menuPtr->entries[i]->entryFlags & ENTRY_LAST_COLUMN) { x2 = max; } else { x2 = menuPtr->entries[i]->x + menuPtr->entries[i]->width; } if ((x >= menuPtr->entries[i]->x) && (y >= menuPtr->entries[i]->y) && (x < x2) |
︙ | ︙ | |||
3022 3023 3024 3025 3026 3027 3028 | *---------------------------------------------------------------------- */ static void RecursivelyDeleteMenu( TkMenu *menuPtr) /* The menubar instance we are deleting. */ { | | | 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 | *---------------------------------------------------------------------- */ static void RecursivelyDeleteMenu( TkMenu *menuPtr) /* The menubar instance we are deleting. */ { Tcl_Size i; TkMenuEntry *mePtr; /* * It is not 100% clear that this preserve/release pair is required, but * we have added them for safety in this very complex code. */ |
︙ | ︙ | |||
3085 3086 3087 3088 3089 3090 3091 | if (winPtr->mainPtr != NULL) { nameTablePtr = &(winPtr->mainPtr->nameTable); } doDot = parentName[strlen(parentName) - 1] != '.'; | | | | | | | 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 | if (winPtr->mainPtr != NULL) { nameTablePtr = &(winPtr->mainPtr->nameTable); } doDot = parentName[strlen(parentName) - 1] != '.'; childPtr = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); for (destString = Tcl_GetString(childPtr); *destString != '\0'; destString++) { if (*destString == '.') { *destString = '#'; } } for (i = 0; ; i++) { if (i == 0) { resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { Tcl_AppendToObj(resultPtr, ".", TCL_INDEX_NONE); } Tcl_AppendObjToObj(resultPtr, childPtr); } else { Tcl_Obj *intPtr; Tcl_DecrRefCount(resultPtr); resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { Tcl_AppendToObj(resultPtr, ".", TCL_INDEX_NONE); } Tcl_AppendObjToObj(resultPtr, childPtr); intPtr = Tcl_NewWideIntObj(i); Tcl_AppendObjToObj(resultPtr, intPtr); Tcl_DecrRefCount(intPtr); } destString = Tcl_GetString(resultPtr); if ((Tcl_FindCommand(interp, destString, NULL, 0) == NULL) && ((nameTablePtr == NULL) || (Tcl_FindHashEntry(nameTablePtr, destString) == NULL))) { break; } } 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 |
︙ | ︙ | |||
3234 3235 3236 3237 3238 3239 3240 | menuPtr = menuRefPtr->menuPtr; if (menuPtr != NULL) { Tcl_Obj *cloneMenuPtr; TkMenuReferences *cloneMenuRefPtr; Tcl_Obj *newObjv[4]; Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); | | | | 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 | menuPtr = menuRefPtr->menuPtr; if (menuPtr != NULL) { Tcl_Obj *cloneMenuPtr; TkMenuReferences *cloneMenuRefPtr; Tcl_Obj *newObjv[4]; Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); Tcl_Obj *menubarPtr = Tcl_NewStringObj("menubar", TCL_INDEX_NONE); /* * Clone the menu and all of the cascades underneath it. */ Tcl_IncrRefCount(windowNamePtr); cloneMenuPtr = TkNewMenuName(interp, windowNamePtr, menuPtr); Tcl_IncrRefCount(cloneMenuPtr); Tcl_IncrRefCount(menubarPtr); CloneMenu(menuPtr, cloneMenuPtr, menubarPtr); cloneMenuRefPtr = TkFindMenuReferencesObj(interp, cloneMenuPtr); if ((cloneMenuRefPtr != NULL) && (cloneMenuRefPtr->menuPtr != NULL)) { Tcl_Obj *cursorPtr = Tcl_NewStringObj("-cursor", TCL_INDEX_NONE); Tcl_Obj *nullPtr = Tcl_NewObj(); cloneMenuRefPtr->menuPtr->parentTopLevelPtr = tkwin; menuBarPtr = cloneMenuRefPtr->menuPtr; newObjv[0] = cursorPtr; newObjv[1] = nullPtr; Tcl_IncrRefCount(cursorPtr); |
︙ | ︙ | |||
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); } | | | 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 | 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 -- * |
︙ | ︙ | |||
3307 3308 3309 3310 3311 3312 3313 | * The hash table is destroyed. * *---------------------------------------------------------------------- */ static void DestroyMenuHashTable( | | | < < | 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 | * The hash table is destroyed. * *---------------------------------------------------------------------- */ static void DestroyMenuHashTable( void *clientData, /* The menu hash table we are destroying. */ TCL_UNUSED(Tcl_Interp *)) /* The interpreter we are destroying. */ { Tcl_DeleteHashTable((Tcl_HashTable *)clientData); ckfree(clientData); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3520 3521 3522 3523 3524 3525 3526 | DeleteMenuCloneEntries( TkMenu *menuPtr, /* The menu the command was issued with. */ int first, /* The zero-based first entry in the set of * entries to delete. */ int last) /* The zero-based last entry. */ { TkMenu *menuListPtr; | | | | | 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 | DeleteMenuCloneEntries( TkMenu *menuPtr, /* The menu the command was issued with. */ int first, /* The zero-based first entry in the set of * entries to delete. */ int last) /* The zero-based last entry. */ { TkMenu *menuListPtr; Tcl_Size numDeleted, i, j; numDeleted = last + 1 - first; for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { for (i = last; i >= first; i--) { Tcl_EventuallyFree(menuListPtr->entries[i], DestroyMenuEntry); } for (i = last + 1; i < menuListPtr->numEntries; i++) { j = i - numDeleted; menuListPtr->entries[j] = menuListPtr->entries[i]; menuListPtr->entries[j]->index = j; } menuListPtr->numEntries -= numDeleted; if (menuListPtr->numEntries == 0) { ckfree(menuListPtr->entries); |
︙ | ︙ | |||
3567 3568 3569 3570 3571 3572 3573 | * None. * *---------------------------------------------------------------------- */ static void MenuCleanup( | < < | | | 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 | * None. * *---------------------------------------------------------------------- */ static void MenuCleanup( TCL_UNUSED(void *)) { menusInitialized = 0; } /* *---------------------------------------------------------------------- * * TkMenuInit -- |
︙ | ︙ |
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 |
︙ | ︙ | |||
60 61 62 63 64 65 66 | int type; /* Type of menu entry; see below for valid * types. */ struct TkMenu *menuPtr; /* Menu with which this entry is * associated. */ Tk_OptionTable optionTable; /* Option table for this menu entry. */ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if * no label). */ | | | | 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 | int type; /* Type of menu entry; see below for valid * types. */ struct TkMenu *menuPtr; /* Menu with which this entry is * associated. */ Tk_OptionTable optionTable; /* Option table for this menu entry. */ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if * no label). */ Tcl_Size labelLength; /* Number of non-NULL characters in label. */ int state; /* State of button for display purposes: * normal, active, or disabled. */ int underline; /* Value of -underline option: specifies index * of character to underline (-1 means don't * underline anything). */ Tcl_Obj *underlinePtr; /* Index of character to underline. */ Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL. * If not NULL then label is ignored. */ Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not * NULL, bitmap, text, and textVarName are * ignored. */ Tk_Image image; /* Image to display in menu entry, or NULL if * none. */ Tcl_Obj *selectImagePtr; /* Name of image to display when selected, or * NULL. */ Tk_Image selectImage; /* Image to display in entry when selected, or * NULL if none. Ignored if image is NULL. */ Tcl_Obj *accelPtr; /* Accelerator string displayed at right of * menu entry. NULL means no such accelerator. * Malloc'ed. */ Tcl_Size accelLength; /* Number of non-NULL characters in * accelerator. */ int indicatorOn; /* True means draw indicator, false means * don't draw it. This field is ignored unless * the entry is a radio or check button. */ /* * Display attributes */ |
︙ | ︙ | |||
179 180 181 182 183 184 185 186 187 188 189 190 191 192 | */ int entryFlags; /* Various flags. See below for * definitions. */ int index; /* Need to know which index we are. This is * zero-based. This is the top-left entry of * the menu. */ /* * Bookeeping for main menus and cascade menus. */ struct TkMenuReferences *childMenuRefPtr; /* A pointer to the hash table entry for the | > | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | */ int entryFlags; /* Various flags. See below for * definitions. */ int index; /* Need to know which index we are. This is * zero-based. This is the top-left entry of * the menu. */ Tcl_HashEntry *entryPtr; /* Back-pointer to hash table entry */ /* * Bookeeping for main menus and cascade menus. */ struct TkMenuReferences *childMenuRefPtr; /* A pointer to the hash table entry for the |
︙ | ︙ | |||
240 241 242 243 244 245 246 | #define TEAROFF_ENTRY 5 /* * Menu states */ #define ENTRY_ACTIVE 0 | | | | | | | 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 | #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 * that the window has been destroyed but the * data structures haven't yet been cleaned * up. */ Display *display; /* Display containing widget. Needed, among * other things, so that resources can be * freed up even after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with menu. */ Tcl_Command widgetCmd; /* Token for menu's widget command. */ TkMenuEntry **entries; /* Array of pointers to all the entries in the * menu. NULL means no entries. */ Tcl_Size numEntries; /* Number of elements in entries. */ Tcl_Size active; /* Index of active entry. TCL_INDEX_NONE means * nothing active. */ int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See * below for definitions. */ Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a * toplevel or not. "normal", "menubar", or * "toplevel" */ /* * Information used when displaying widget: */ Tcl_Obj *borderPtr; /* Structure used to draw 3-D border and * background for menu. */ Tcl_Obj *borderWidthPtr; /* Width of border around whole menu. */ Tcl_Obj *activeBorderPtr; /* Used to draw background and border for * active element (if any). */ Tcl_Obj *activeBorderWidthPtr; /* Width of border around active element. */ int relief; /* 3-d effect: TK_RELIEF_RAISED, etc. */ Tcl_Obj *fontPtr; /* Text font for menu entries. */ Tcl_Obj *fgPtr; /* Foreground color for entries. */ Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL means * use normalFg with a 50% stipple instead. */ Tcl_Obj *activeFgPtr; /* Foreground color for active entry. */ Tcl_Obj *indicatorFgPtr; /* Color for indicators in radio and check * button entries. */ |
︙ | ︙ | |||
375 376 377 378 379 380 381 382 383 384 385 386 387 388 | Tk_OptionSpec *extensionPtr;/* Needed by the configuration package for * this widget to be extended. */ Tk_SavedOptions *errorStructPtr; /* We actually have to allocate these because * multiple menus get changed during one * ConfigureMenu call. */ Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */ } TkMenu; /* * When the toplevel configure -menu command is executed, the menu may not * exist yet. We need to keep a linked list of windows that reference a * particular menu. */ | > > | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | Tk_OptionSpec *extensionPtr;/* Needed by the configuration package for * this widget to be extended. */ Tk_SavedOptions *errorStructPtr; /* We actually have to allocate these because * multiple menus get changed during one * ConfigureMenu call. */ Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */ Tcl_HashTable items; /* Map: id -> entry */ int serial; /* Next item # for autogenerated ids */ } TkMenu; /* * When the toplevel configure -menu command is executed, the menu may not * exist yet. We need to keep a linked list of windows that reference a * particular menu. */ |
︙ | ︙ | |||
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 | > | | < | | | | | | | | 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 | * 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 #define DECORATION_BORDER_WIDTH 2 /* * Menu-related functions that are shared among Tk modules but not exported to * the outside world: */ MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, Tcl_Size index); MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu *menuPtr); MODULE_SCOPE TkMenuReferences*TkCreateMenuReferences(Tcl_Interp *interp, const char *name); MODULE_SCOPE void TkDestroyMenu(TkMenu *menuPtr); MODULE_SCOPE void TkEventuallyRecomputeMenu(TkMenu *menuPtr); MODULE_SCOPE void TkEventuallyRedrawMenu(TkMenu *menuPtr, TkMenuEntry *mePtr); MODULE_SCOPE TkMenuReferences*TkFindMenuReferences(Tcl_Interp *interp, const char *name); MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp, Tcl_Obj *namePtr); MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr); MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp); MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr); MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr); MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Size index); MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu *menuPtr); MODULE_SCOPE int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, Tcl_Size index); MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu *menuPtr); MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry *mePtr); MODULE_SCOPE void TkMenuEventProc(void *clientData, XEvent *eventPtr); MODULE_SCOPE void TkMenuImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); MODULE_SCOPE void TkMenuInit(void); MODULE_SCOPE void TkMenuSelectImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, 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. */ |
︙ | ︙ | |||
534 535 536 537 538 539 540 | const Tk_FontMetrics *menuMetricsPtr, int x, int y, int width, int height, int strictMotif, 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, | | | | 537 538 539 540 541 542 543 544 545 546 547 548 549 | const Tk_FontMetrics *menuMetricsPtr, int x, int y, int width, int height, int strictMotif, 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, Tcl_Size index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, Tcl_Size 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 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | /* * 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" /* * Forward declarations for functions defined later in this file: */ static void AdjustMenuCoords(TkMenu *menuPtr, TkMenuEntry *mePtr, int *xPtr, int *yPtr); static void ComputeMenuGeometry(void *clientData); static void DisplayMenu(void *clientData); /* *---------------------------------------------------------------------- * * TkMenuInitializeDrawingFields -- * * Fills in drawing fields of a new menu. Called when new menu is created |
︙ | ︙ | |||
294 295 296 297 298 299 300 | * *---------------------------------------------------------------------- */ int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, | | | | 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 | * *---------------------------------------------------------------------- */ int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, Tcl_Size index) { XGCValues gcValues; GC newGC, newActiveGC, newDisabledGC, newIndicatorGC; unsigned long mask; Tk_Font tkfont; TkMenu *menuPtr = mePtr->menuPtr; tkfont = Tk_GetFontFromObj(menuPtr->tkwin, (mePtr->fontPtr != NULL) ? mePtr->fontPtr : menuPtr->fontPtr); if (mePtr->state == ENTRY_ACTIVE) { if (index != menuPtr->active) { TkActivateMenuEntry(menuPtr, index); } } else { if (index == menuPtr->active) { TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); } } if ((mePtr->fontPtr != NULL) || (mePtr->borderPtr != NULL) || (mePtr->fgPtr != NULL) || (mePtr->activeBorderPtr != NULL) |
︙ | ︙ | |||
483 484 485 486 487 488 489 | void TkEventuallyRedrawMenu( TkMenu *menuPtr, /* Information about menu to redraw. */ TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | void TkEventuallyRedrawMenu( TkMenu *menuPtr, /* Information about menu to redraw. */ TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { Tcl_Size i; if (menuPtr->tkwin == NULL) { return; } if (mePtr != NULL) { mePtr->entryFlags |= ENTRY_NEEDS_REDISPLAY; } else { |
︙ | ︙ | |||
524 525 526 527 528 529 530 | * and the size of the menu window itself may be changed. * *-------------------------------------------------------------- */ static void ComputeMenuGeometry( | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | * and the size of the menu window itself may be changed. * *-------------------------------------------------------------- */ static void ComputeMenuGeometry( void *clientData) /* Structure describing menu. */ { TkMenu *menuPtr = (TkMenu *)clientData; if (menuPtr->tkwin == NULL) { return; } |
︙ | ︙ | |||
575 576 577 578 579 580 581 | * Arranges for the menu to get redisplayed. * *---------------------------------------------------------------------- */ void TkMenuSelectImageProc( | | | | | | > | < < < < < < | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | * Arranges for the menu to get redisplayed. * *---------------------------------------------------------------------- */ void TkMenuSelectImageProc( void *clientData, /* Pointer to widget record. */ TCL_UNUSED(int), /* Upper left pixel (within image) that must */ TCL_UNUSED(int), /* be redisplayed. */ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be */ TCL_UNUSED(int), /* <= 0). */ TCL_UNUSED(int), TCL_UNUSED(int))/* New dimensions of image. */ { TkMenuEntry *mePtr = (TkMenuEntry *)clientData; if ((mePtr->entryFlags & ENTRY_SELECTED) && !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) { mePtr->menuPtr->menuFlags |= REDRAW_PENDING; Tcl_DoWhenIdle(DisplayMenu, mePtr->menuPtr); } } |
︙ | ︙ | |||
615 616 617 618 619 620 621 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DisplayMenu( | | | < | 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 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DisplayMenu( void *clientData) /* Information about widget. */ { TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; Tk_Window tkwin = menuPtr->tkwin; Tcl_Size index; int strictMotif; Tk_Font tkfont; Tk_FontMetrics menuMetrics; int width; int borderWidth; Tk_3DBorder border; menuPtr->menuFlags &= ~REDRAW_PENDING; if ((menuPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } |
︙ | ︙ | |||
733 734 735 736 737 738 739 | * This has zero width except after menu resizing. */ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y, width, height, 0, TK_RELIEF_FLAT); } | < | | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | * This has zero width except after menu resizing. */ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, x, y, width, height, 0, TK_RELIEF_FLAT); } Tk_Draw3DRectangle(menuPtr->tkwin, Tk_WindowId(tkwin), border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), borderWidth, menuPtr->relief); } /* *-------------------------------------------------------------- * * TkMenuEventProc -- * |
︙ | ︙ | |||
759 760 761 762 763 764 765 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ void TkMenuEventProc( | | | | 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 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ void TkMenuEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkMenu *menuPtr = (TkMenu *)clientData; 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; |
︙ | ︙ | |||
820 821 822 823 824 825 826 | * Arranges for the menu to get redisplayed. * *---------------------------------------------------------------------- */ void TkMenuImageProc( | | | | | | | > < < < < < < | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | * Arranges for the menu to get redisplayed. * *---------------------------------------------------------------------- */ void TkMenuImageProc( void *clientData,/* Pointer to widget record. */ TCL_UNUSED(int), /* Upper left pixel (within image) that must */ TCL_UNUSED(int), /* * be redisplayed. */ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be */ TCL_UNUSED(int), /* <=0). */ TCL_UNUSED(int), /* New dimensions of image. */ TCL_UNUSED(int)) { TkMenu *menuPtr = (TkMenu *)((TkMenuEntry *) clientData)->menuPtr; if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) { menuPtr->menuFlags |= RESIZE_PENDING; Tcl_DoWhenIdle(ComputeMenuGeometry, menuPtr); } } |
︙ | ︙ | |||
920 921 922 923 924 925 926 | * posted, in which case the saved information is no longer * correct. * The simplest solution is just force a complete redisplay of the * parent. */ subary[0] = menuPtr->postedCascade->namePtr; | | | 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | * posted, in which case the saved information is no longer * correct. * The simplest solution is just force a complete redisplay of the * parent. */ subary[0] = menuPtr->postedCascade->namePtr; subary[1] = Tcl_NewStringObj("unpost", TCL_INDEX_NONE); Tcl_IncrRefCount(subary[1]); TkEventuallyRedrawMenu(menuPtr, NULL); result = Tcl_EvalObjv(interp, 2, subary, 0); Tcl_DecrRefCount(subary[1]); menuPtr->postedCascade = NULL; if (result != TCL_OK) { return result; |
︙ | ︙ | |||
949 950 951 952 953 954 955 | */ Tk_GetRootCoords(menuPtr->tkwin, &x, &y); AdjustMenuCoords(menuPtr, mePtr, &x, &y); menuPtr->postedCascade = mePtr; subary[0] = mePtr->namePtr; | | | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | */ Tk_GetRootCoords(menuPtr->tkwin, &x, &y); AdjustMenuCoords(menuPtr, mePtr, &x, &y); menuPtr->postedCascade = mePtr; subary[0] = mePtr->namePtr; subary[1] = Tcl_NewStringObj("post", TCL_INDEX_NONE); subary[2] = Tcl_NewWideIntObj(x); subary[3] = Tcl_NewWideIntObj(y); Tcl_IncrRefCount(subary[1]); Tcl_IncrRefCount(subary[2]); Tcl_IncrRefCount(subary[3]); result = Tcl_EvalObjv(interp, 4, subary, 0); Tcl_DecrRefCount(subary[1]); |
︙ | ︙ |
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), TK_OPTION_ENUM_VAR, 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}, |
︙ | ︙ | |||
113 114 115 116 117 118 119 | {TK_OPTION_STRING, "-image", "image", "Image", DEF_MENUBUTTON_IMAGE, TCL_INDEX_NONE, offsetof(TkMenuButton, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_MENUBUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkMenuButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", | | | | | | | < | 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 | {TK_OPTION_STRING, "-image", "image", "Image", DEF_MENUBUTTON_IMAGE, TCL_INDEX_NONE, offsetof(TkMenuButton, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_MENUBUTTON_INDICATOR, TCL_INDEX_NONE, offsetof(TkMenuButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_MENUBUTTON_JUSTIFY, TCL_INDEX_NONE, offsetof(TkMenuButton, justify), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", DEF_MENUBUTTON_MENU, TCL_INDEX_NONE, offsetof(TkMenuButton, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_MENUBUTTON_PADX, TCL_INDEX_NONE, offsetof(TkMenuButton, padX), 0, 0, 0}, {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} |
︙ | ︙ | |||
170 171 172 173 174 175 176 | COMMAND_CGET, COMMAND_CONFIGURE }; /* * Forward declarations for functions defined later in this file: */ | | | | | | < < | | 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 | COMMAND_CGET, COMMAND_CONFIGURE }; /* * Forward declarations for functions defined later in this file: */ static void MenuButtonCmdDeletedProc(void *clientData); static void MenuButtonEventProc(void *clientData, XEvent *eventPtr); static void MenuButtonImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static char * MenuButtonTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_ObjCmdProc MenuButtonWidgetObjCmd; static int ConfigureMenuButton(Tcl_Interp *interp, TkMenuButton *mbPtr, int objc, Tcl_Obj *const objv[]); static void DestroyMenuButton(void *memPtr); /* *-------------------------------------------------------------- * * Tk_MenubuttonObjCmd -- * * This function is invoked to process the "button", "label", |
︙ | ︙ | |||
207 208 209 210 211 212 213 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MenubuttonObjCmd( | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MenubuttonObjCmd( void *dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkMenuButton *mbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; |
︙ | ︙ | |||
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; | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | 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; |
︙ | ︙ | |||
338 339 340 341 342 343 344 | * See the user documentation. * *-------------------------------------------------------------- */ static int MenuButtonWidgetObjCmd( | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | * See the user documentation. * *-------------------------------------------------------------- */ static int MenuButtonWidgetObjCmd( void *clientData, /* Information about button widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; int result, index; Tcl_Obj *objPtr; |
︙ | ︙ | |||
416 417 418 419 420 421 422 | * Everything associated with the widget is freed up. * *---------------------------------------------------------------------- */ static void DestroyMenuButton( | | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | * Everything associated with the widget is freed up. * *---------------------------------------------------------------------- */ static void DestroyMenuButton( void *memPtr) /* Info about button widget. */ { TkMenuButton *mbPtr = (TkMenuButton *)memPtr; TkpDestroyMenuButton(mbPtr); if (mbPtr->flags & REDRAW_PENDING) { Tcl_CancelIdleCall(TkpDisplayMenuButton, mbPtr); } /* |
︙ | ︙ | |||
457 458 459 460 461 462 463 | } if (mbPtr->gray != None) { Tk_FreeBitmap(mbPtr->display, mbPtr->gray); } if (mbPtr->textLayout != NULL) { Tk_FreeTextLayout(mbPtr->textLayout); } | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | } if (mbPtr->gray != None) { Tk_FreeBitmap(mbPtr->display, mbPtr->gray); } if (mbPtr->textLayout != NULL) { Tk_FreeTextLayout(mbPtr->textLayout); } Tk_FreeConfigOptions(mbPtr, mbPtr->optionTable, mbPtr->tkwin); mbPtr->tkwin = NULL; Tcl_EventuallyFree(mbPtr, TCL_DYNAMIC); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
666 667 668 669 670 671 672 | * TkMenuButton will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ void TkMenuButtonWorldChanged( | | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | * TkMenuButton will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ void TkMenuButtonWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc; unsigned long mask; TkMenuButton *mbPtr = (TkMenuButton *)instanceData; gcValues.font = Tk_FontId(mbPtr->tkfont); |
︙ | ︙ | |||
769 770 771 772 773 774 775 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MenuButtonEventProc( | | | | 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 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MenuButtonEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { /* * Must redraw after size changes, since layout could have changed and * borders will need to be redrawn. */ goto redraw; } else if (eventPtr->type == DestroyNotify) { DestroyMenuButton(mbPtr); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { mbPtr->flags |= GOT_FOCUS; if (mbPtr->highlightWidth > 0) { goto redraw; } } |
︙ | ︙ | |||
829 830 831 832 833 834 835 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MenuButtonCmdDeletedProc( | | | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MenuButtonCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; Tk_Window tkwin = mbPtr->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 |
︙ | ︙ | |||
866 867 868 869 870 871 872 | * variable. * *-------------------------------------------------------------- */ static char * MenuButtonTextVarProc( | | | | | 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 | * variable. * *-------------------------------------------------------------- */ static char * MenuButtonTextVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; const char *value; size_t len; (void)name1; (void)name2; /* * 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 |
︙ | ︙ | |||
954 955 956 957 958 959 960 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void MenuButtonImageProc( | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void MenuButtonImageProc( void *clientData, /* Pointer to widget record. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (may be <= * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; |
︙ | ︙ |
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 |
︙ | ︙ | |||
157 158 159 160 161 162 163 | * Miscellaneous information: */ int compound; /* Value of -compound option; specifies * whether the menubutton should show both an * image and text, and, if so, how. */ enum direction direction; /* Direction for where to pop the menu. Valid | | < < | | > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | * Miscellaneous information: */ int compound; /* Value of -compound option; specifies * whether the menubutton should show both an * image and text, and, if so, how. */ enum direction direction; /* Direction for where to pop the menu. Valid * directions are "above", "below", "flush", * "left", and "right". "above" and "below" * will attempt to pop the menu completely * above or below the menu respectively. * "flush" means that the upper left corner * of the menubutton is where the menu pops up. * "left" and "right" will pop the menu left * or right, and the active item will be next * to the button. */ Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ |
︙ | ︙ | |||
205 206 207 208 209 210 211 | /* * Declaration of procedures used in the implementation of the button widget. */ MODULE_SCOPE void TkpComputeMenuButtonGeometry(TkMenuButton *mbPtr); MODULE_SCOPE TkMenuButton *TkpCreateMenuButton(Tk_Window tkwin); | | | | 205 206 207 208 209 210 211 212 213 214 215 216 | /* * Declaration of procedures used in the implementation of the button widget. */ MODULE_SCOPE void TkpComputeMenuButtonGeometry(TkMenuButton *mbPtr); MODULE_SCOPE TkMenuButton *TkpCreateMenuButton(Tk_Window tkwin); MODULE_SCOPE void TkpDisplayMenuButton(void *clientData); MODULE_SCOPE void TkpDestroyMenuButton(TkMenuButton *mbPtr); MODULE_SCOPE void TkMenuButtonWorldChanged(void *instanceData); #endif /* _TKMENUBUTTON */ |
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" |
︙ | ︙ | |||
35 36 37 38 39 40 41 | Tcl_Command widgetCmd; /* Token for message's widget command. */ /* * Information used when displaying widget: */ char *string; /* String displayed in message. */ | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | Tcl_Command widgetCmd; /* Token for message's widget command. */ /* * Information used when displaying widget: */ char *string; /* String displayed in message. */ Tcl_Size numChars; /* Number of characters in string, not * including terminating NULL. */ char *textVarName; /* Name of variable (malloc'ed) or NULL. * If non-NULL, message displays the contents * of this variable. */ Tk_3DBorder border; /* Structure used to draw 3-D border and * background. NULL means a border hasn't been * created yet. */ |
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | Tk_Cursor cursor; /* Current cursor for window, or None. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ int flags; /* Various flags; see below for * definitions. */ } Message; /* * Flag bits for messages: * * REDRAW_PENDING: Non-zero means a DoWhenIdle handler * has already been queued to redraw | > > > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | Tk_Cursor cursor; /* Current cursor for window, or None. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ int flags; /* Various flags; see below for * definitions. */ Tcl_Obj *borderWidthObj; /* Width of border. */ Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw * around widget when it has the focus. <= 0 means don't draw a highlight. */ Tcl_Obj *widthObj; /* User-requested width, in pixels. 0 means * compute width using aspect ratio. */ } Message; /* * Flag bits for messages: * * REDRAW_PENDING: Non-zero means a DoWhenIdle handler * has already been queued to redraw |
︙ | ︙ | |||
105 106 107 108 109 110 111 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, | | | | | | | | | | | | < < | | | 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 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, TCL_INDEX_NONE, offsetof(Message, anchor), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT, TCL_INDEX_NONE, offsetof(Message, aspect), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MESSAGE_BG_COLOR, TCL_INDEX_NONE, offsetof(Message, border), 0, DEF_MESSAGE_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_MESSAGE_BORDER_WIDTH, offsetof(Message, borderWidthObj), offsetof(Message, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MESSAGE_CURSOR, TCL_INDEX_NONE, offsetof(Message, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MESSAGE_FONT, TCL_INDEX_NONE, offsetof(Message, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MESSAGE_FG, TCL_INDEX_NONE, offsetof(Message, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, TCL_INDEX_NONE, offsetof(Message, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_MESSAGE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Message, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, offsetof(Message, highlightWidthObj), offsetof(Message, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_MESSAGE_JUSTIFY, TCL_INDEX_NONE, offsetof(Message, justify), TK_OPTION_ENUM_VAR, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_MESSAGE_PADX, offsetof(Message, padXPtr), offsetof(Message, padX), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_MESSAGE_PADY, offsetof(Message, padYPtr), offsetof(Message, padY), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MESSAGE_RELIEF, TCL_INDEX_NONE, offsetof(Message, relief), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MESSAGE_TAKE_FOCUS, TCL_INDEX_NONE, offsetof(Message, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_MESSAGE_TEXT, TCL_INDEX_NONE, offsetof(Message, string), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MESSAGE_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(Message, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_MESSAGE_WIDTH, offsetof(Message, widthObj), offsetof(Message, width), 0, 0 ,0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations for functions defined later in this file: */ static void MessageCmdDeletedProc(void *clientData); static void MessageEventProc(void *clientData, XEvent *eventPtr); static char * MessageTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_ObjCmdProc MessageWidgetObjCmd; static void MessageWorldChanged(void *instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, int objc, Tcl_Obj *const objv[], int flags); static void DestroyMessage(void *memPtr); static void DisplayMessage(void *clientData); /* * The structure below defines message class behavior by means of functions * that can be invoked from generic window code. */ static const Tk_ClassProcs messageClass = { |
︙ | ︙ | |||
210 211 212 213 214 215 216 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MessageObjCmd( | | < | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_MessageObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), |
︙ | ︙ | |||
298 299 300 301 302 303 304 | * See the user documentation. * *-------------------------------------------------------------- */ static int MessageWidgetObjCmd( | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | * See the user documentation. * *-------------------------------------------------------------- */ static int MessageWidgetObjCmd( void *clientData, /* Information about message widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Message *msgPtr = (Message *)clientData; static const char *const optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; |
︙ | ︙ | |||
406 407 408 409 410 411 412 | Tk_FreeTextLayout(msgPtr->textLayout); } if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(msgPtr->interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, msgPtr); } | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | Tk_FreeTextLayout(msgPtr->textLayout); } if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(msgPtr->interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, msgPtr); } Tk_FreeConfigOptions(msgPtr, msgPtr->optionTable, msgPtr->tkwin); msgPtr->tkwin = NULL; ckfree(msgPtr); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
438 439 440 441 442 443 444 | static int ConfigureMessage( Tcl_Interp *interp, /* Used for error reporting. */ Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ | | < | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | static int ConfigureMessage( Tcl_Interp *interp, /* Used for error reporting. */ Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ TCL_UNUSED(int)) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; /* * Eliminate any existing trace on a variable monitored by the message. */ if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(interp, msgPtr->textVarName, NULL, |
︙ | ︙ | |||
489 490 491 492 493 494 495 | /* * A few other options need special processing, such as setting the * background from a 3-D border or handling special defaults that couldn't * be specified to Tk_ConfigureWidget. */ | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | /* * A few other options need special processing, such as setting the * background from a 3-D border or handling special defaults that couldn't * be specified to Tk_ConfigureWidget. */ msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, TCL_INDEX_NONE); if (msgPtr->highlightWidth < 0) { msgPtr->highlightWidth = 0; } Tk_FreeSavedOptions(&savedOptions); MessageWorldChanged(msgPtr); |
︙ | ︙ | |||
520 521 522 523 524 525 526 | * Message will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void MessageWorldChanged( | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | * Message will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void MessageWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc = NULL; Tk_FontMetrics fm; Message *msgPtr = (Message *)instanceData; if (msgPtr->border != NULL) { |
︙ | ︙ | |||
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | Tk_FreeGC(msgPtr->display, msgPtr->textGC); } msgPtr->textGC = gc; Tk_GetFontMetrics(msgPtr->tkfont, &fm); if (msgPtr->padX < 0) { msgPtr->padX = fm.ascent / 2; } if (msgPtr->padY == -1) { msgPtr->padY = fm.ascent / 4; } /* * Recompute the desired geometry for the window, and arrange for the * window to be redisplayed. */ | > > > > > > > > | 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 | Tk_FreeGC(msgPtr->display, msgPtr->textGC); } msgPtr->textGC = gc; Tk_GetFontMetrics(msgPtr->tkfont, &fm); if (msgPtr->padX < 0) { msgPtr->padX = fm.ascent / 2; if (msgPtr->padXPtr) { Tcl_DecrRefCount(msgPtr->padXPtr); msgPtr->padXPtr = NULL; } } if (msgPtr->padY == -1) { msgPtr->padY = fm.ascent / 4; if (msgPtr->padYPtr) { Tcl_DecrRefCount(msgPtr->padYPtr); msgPtr->padYPtr = NULL; } } /* * Recompute the desired geometry for the window, and arrange for the * window to be redisplayed. */ |
︙ | ︙ | |||
662 663 664 665 666 667 668 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayMessage( | | | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void DisplayMessage( void *clientData) /* Information about window. */ { Message *msgPtr = (Message *)clientData; Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; msgPtr->flags &= ~REDRAW_PENDING; |
︙ | ︙ | |||
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)); | | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | } 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)); } } } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
737 738 739 740 741 742 743 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MessageEventProc( | | | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MessageEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Message *msgPtr = (Message *)clientData; if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) || (eventPtr->type == ConfigureNotify)) { goto redraw; |
︙ | ︙ | |||
791 792 793 794 795 796 797 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MessageCmdDeletedProc( | | | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void MessageCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { Message *msgPtr = (Message *)clientData; /* * This function could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or * because the command was deleted, and then this function destroys the |
︙ | ︙ | |||
826 827 828 829 830 831 832 | * The text displayed in the message will change to match the variable. * *-------------------------------------------------------------- */ static char * MessageTextVarProc( | | | | < < | | | 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 | * The text displayed in the message will change to match the variable. * *-------------------------------------------------------------- */ static char * MessageTextVarProc( void *clientData, /* Information about message. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), /* Name of variable. */ TCL_UNUSED(const char *), /* Second part of variable name. */ int flags) /* Information about what happened. */ { Message *msgPtr = (Message *)clientData; const char *value; /* * 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 |
︙ | ︙ | |||
880 881 882 883 884 885 886 | value = Tcl_GetVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY); if (value == NULL) { value = ""; } if (msgPtr->string != NULL) { ckfree(msgPtr->string); } | | | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | value = Tcl_GetVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY); if (value == NULL) { value = ""; } if (msgPtr->string != NULL) { ckfree(msgPtr->string); } msgPtr->numChars = Tcl_NumUtfChars(value, TCL_INDEX_NONE); msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin) && !(msgPtr->flags & REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayMessage, msgPtr); |
︙ | ︙ |
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" |
︙ | ︙ | |||
45 46 47 48 49 50 51 | * Tcl_ObjTypes that we can use as screen distances without conversion. The * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ typedef struct { const Tcl_ObjType *doubleTypePtr; | < < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | * Tcl_ObjTypes that we can use as screen distances without conversion. The * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ typedef struct { const Tcl_ObjType *doubleTypePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * The following structure is the internal representation for mm objects. */ |
︙ | ︙ | |||
94 95 96 97 98 99 100 | static void FreeWindowInternalRep(Tcl_Obj *objPtr); 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); | < < < < < < < < < < < < < < < < < < < < < < < | | | > > | | | > > | | | > > | 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 | static void FreeWindowInternalRep(Tcl_Obj *objPtr); 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); /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its * initial display-independent settings. */ static const TkObjType pixelObjType = { {"pixel", /* name */ FreePixelInternalRep, /* freeIntRepProc */ DupPixelInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its * initial display-independent settings. */ static const TkObjType mmObjType = { {"mm", /* name */ FreeMMInternalRep, /* freeIntRepProc */ DupMMInternalRep, /* dupIntRepProc */ UpdateStringOfMM, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* * The following structure defines the implementation of the "window" * Tcl object. */ static const TkObjType windowObjType = { {"window", /* name */ FreeWindowInternalRep, /* freeIntRepProc */ DupWindowInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *---------------------------------------------------------------------- * * GetTypeCache -- * |
︙ | ︙ | |||
177 178 179 180 181 182 183 | static ThreadSpecificData * GetTypeCache(void) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == 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 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 | static ThreadSpecificData * GetTypeCache(void) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { /* Smart initialization of doubleTypePtr without * hash-table lookup or creating complete Tcl_Obj's */ Tcl_Obj obj; obj.length = 3; obj.bytes = (char *)"0.0"; obj.typePtr = NULL; Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue); tsdPtr->doubleTypePtr = obj.typePtr; } return tsdPtr; } /* *---------------------------------------------------------------------- * * TkGetIntForIndex -- * * Almost the same as Tcl_GetIntForIndex, but it retrieves 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, Tcl_Size end, int lastOK, Tcl_Size *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) { /* empty string */ *indexPtr = (end == -1) ? -1 - TCL_SIZE_MAX : TCL_INDEX_NONE; return TCL_OK; } return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
286 287 288 289 290 291 292 | int result, fresh; double d; PixelRep *pixelPtr; static const double bias[] = { 1.0, 10.0, 25.4, 0.35278 /*25.4 / 72.0*/ }; | < < < < < < < | < < | < < < < < < | | 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 | int result, fresh; double d; PixelRep *pixelPtr; static const double bias[] = { 1.0, 10.0, 25.4, 0.35278 /*25.4 / 72.0*/ }; if (objPtr->typePtr != &pixelObjType.objType) { if (Tcl_GetDoubleFromObj(NULL, objPtr, &d) == TCL_OK) { if (dblPtr != NULL) { *dblPtr = d; } *intPtr = (int) (d<0 ? d-0.5 : d+0.5); return TCL_OK; } } retry: fresh = (objPtr->typePtr != &pixelObjType.objType); if (fresh) { result = SetPixelFromAny(interp, objPtr); if (result != TCL_OK) { return result; } } |
︙ | ︙ | |||
420 421 422 423 424 425 426 | double d; int result, val; result = GetPixelsFromObjEx(interp, tkwin, objPtr, &val, &d); if (result != TCL_OK) { return result; } | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | double d; int result, val; result = GetPixelsFromObjEx(interp, tkwin, objPtr, &val, &d); if (result != TCL_OK) { return result; } if (objPtr->typePtr == &pixelObjType.objType && !SIMPLE_PIXELREP(objPtr)) { PixelRep *pixelPtr = GET_COMPLEXPIXEL(objPtr); if (pixelPtr->units >= 0) { /* * Internally "shimmer" to pixel units. */ |
︙ | ︙ | |||
531 532 533 534 535 536 537 538 | */ static int SetPixelFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; | > | | | | | < | > | > | > | | < < > > > > | > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | > > > > > > > > | < < < < < < < < | 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 | */ static int SetPixelFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { ThreadSpecificData *typeCache = GetTypeCache(); const Tcl_ObjType *typePtr; char *string; char *rest; double d; int i, units; if (objPtr->typePtr != typeCache->doubleTypePtr && Tcl_GetIntFromObj(NULL, objPtr, &units) == TCL_OK) { d = (double) units; units = -1; /* * In the case of ints, we need to ensure that a valid string exists * in order for int-but-not-string objects to be converted back to * ints again from pixel obj types. */ (void) Tcl_GetString(objPtr); } else if (Tcl_GetDoubleFromObj(NULL, objPtr, &d) == TCL_OK) { units = -1; } else { char savechar; string = Tcl_GetString(objPtr); rest = string + strlen(string); while ((rest > string) && isspace(UCHAR(rest[-1]))) { --rest; /* skip all spaces at the end */ } if (rest > string) { --rest; /* point to the character just before the last space */ } if (rest == string) { error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance but got \"%.50s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); } return TCL_ERROR; } switch (*rest) { case 'm': units = 0; break; case 'c': units = 1; break; case 'i': units = 2; break; case 'p': units = 3; break; default: goto error; } savechar = *rest; *rest = '\0'; if (Tcl_GetDouble(NULL, string, &d) != TCL_OK) { *rest = savechar; goto error; } *rest = savechar; } /* * Free the old internalRep before setting the new one. */ typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &pixelObjType.objType; i = (int) d; if ((units < 0) && (i == d)) { SET_SIMPLEPIXEL(objPtr, i); } else { PixelRep *pixelPtr = (PixelRep *)ckalloc(sizeof(PixelRep)); pixelPtr->value = d; pixelPtr->units = units; pixelPtr->tkwin = NULL; pixelPtr->returnValue = i; SET_COMPLEXPIXEL(objPtr, pixelPtr); } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_GetMMFromObj -- * |
︙ | ︙ | |||
636 637 638 639 640 641 642 | int result; double d; MMRep *mmPtr; static const double bias[] = { 10.0, 25.4, 1.0, 0.35278 /*25.4 / 72.0*/ }; | | | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | int result; double d; MMRep *mmPtr; static const double bias[] = { 10.0, 25.4, 1.0, 0.35278 /*25.4 / 72.0*/ }; if (objPtr->typePtr != &mmObjType.objType) { result = SetMMFromAny(interp, objPtr); if (result != TCL_OK) { return result; } } mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; |
︙ | ︙ | |||
747 748 749 750 751 752 753 | static void UpdateStringOfMM( Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; | | | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | static void UpdateStringOfMM( Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; size_t len; mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); } |
︙ | ︙ | |||
789 790 791 792 793 794 795 | static int SetMMFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { ThreadSpecificData *typeCache = GetTypeCache(); const Tcl_ObjType *typePtr; | | | < < < | > > > > | > > > | < | < < | > | | < < < < < < < > > > > > > > | | 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 | static int SetMMFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { ThreadSpecificData *typeCache = GetTypeCache(); const Tcl_ObjType *typePtr; char *string; char *rest; double d; int units; MMRep *mmPtr; if (objPtr->typePtr != typeCache->doubleTypePtr && Tcl_GetIntFromObj(NULL, objPtr, &units) == TCL_OK) { d = (double) units; units = -1; /* * In the case of ints, we need to ensure that a valid string exists * in order for int-but-not-string objects to be converted back to * ints again from mm obj types. */ (void) Tcl_GetString(objPtr); } else if (Tcl_GetDoubleFromObj(NULL, objPtr, &d) == TCL_OK) { units = -1; } else { char savechar; /* * It wasn't a known int or double, so parse it. */ string = Tcl_GetString(objPtr); rest = string + strlen(string); while ((rest > string) && isspace(UCHAR(rest[-1]))) { --rest; /* skip all spaces at the end */ } if (rest > string) { --rest; /* point to the character just before the last space */ } if (rest == string) { error: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance but got \"%.50s\"", string)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); return TCL_ERROR; } switch (*rest) { case 'c': units = 0; break; case 'i': units = 1; break; case 'm': units = 2; break; case 'p': units = 3; break; default: goto error; } savechar = *rest; *rest = '\0'; if (Tcl_GetDouble(NULL, string, &d) != TCL_OK) { *rest = savechar; goto error; } *rest = savechar; } /* * Free the old internalRep before setting the new one. */ typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &mmObjType.objType; mmPtr = (MMRep *)ckalloc(sizeof(MMRep)); mmPtr->value = d; mmPtr->units = units; mmPtr->tkwin = NULL; mmPtr->returnValue = d; |
︙ | ︙ | |||
908 909 910 911 912 913 914 | Tk_Window tkwin, /* A token to get the main window from. */ Tcl_Obj *objPtr, /* The object from which to get window. */ Tk_Window *windowPtr) /* Place to store resulting window. */ { TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; WindowRep *winPtr; | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | Tk_Window tkwin, /* A token to get the main window from. */ Tcl_Obj *objPtr, /* The object from which to get window. */ Tk_Window *windowPtr) /* Place to store resulting window. */ { TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; WindowRep *winPtr; if (objPtr->typePtr != &windowObjType.objType) { int result = SetWindowFromAny(interp, objPtr); if (result != TCL_OK) { return result; } } winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; |
︙ | ︙ | |||
983 984 985 986 987 988 989 | winPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); winPtr->tkwin = NULL; winPtr->mainPtr = NULL; winPtr->epoch = 0; objPtr->internalRep.twoPtrValue.ptr1 = winPtr; | | | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | winPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); winPtr->tkwin = NULL; winPtr->mainPtr = NULL; winPtr->epoch = 0; objPtr->internalRep.twoPtrValue.ptr1 = winPtr; objPtr->typePtr = &windowObjType.objType; return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | } /* *---------------------------------------------------------------------- * * Tk_NewWindowObj -- * | | | | | 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 | } /* *---------------------------------------------------------------------- * * 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. * *---------------------------------------------------------------------- */ Tcl_Obj * Tk_NewWindowObj( Tk_Window tkwin) { Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE); TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; WindowRep *winPtr; SetWindowFromAny(NULL, objPtr); winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; |
︙ | ︙ | |||
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 */ | | | | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | 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 */ Tcl_Size 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. */ if (specObj->typePtr == &pixelObjType.objType) { if (Tk_GetPixelsFromObj(interp, tkwin, specObj, &firstInt) != TCL_OK){ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad pad value \"%s\": must be positive screen distance", Tcl_GetString(specObj))); Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | */ if (Tcl_ListObjGetElements(interp, specObj, &objc, &objv) != TCL_OK) { return TCL_ERROR; } if (objc != 1 && objc != 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | */ if (Tcl_ListObjGetElements(interp, specObj, &objc, &objv) != TCL_OK) { return TCL_ERROR; } if (objc != 1 && objc != 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong number of parts to pad specification", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "PARTS", NULL); return TCL_ERROR; } /* * Parse the first part. */ |
︙ | ︙ | |||
1211 1212 1213 1214 1215 1216 1217 | * *---------------------------------------------------------------------- */ void TkRegisterObjTypes(void) { | | | | | | | | | | | | 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 | * *---------------------------------------------------------------------- */ void TkRegisterObjTypes(void) { Tcl_RegisterObjType(&tkBorderObjType.objType); Tcl_RegisterObjType(&tkBitmapObjType.objType); Tcl_RegisterObjType(&tkColorObjType.objType); Tcl_RegisterObjType(&tkCursorObjType.objType); Tcl_RegisterObjType(&tkFontObjType.objType); Tcl_RegisterObjType(&mmObjType.objType); Tcl_RegisterObjType(&pixelObjType.objType); Tcl_RegisterObjType(&tkStateKeyObjType.objType); Tcl_RegisterObjType(&windowObjType.objType); Tcl_RegisterObjType(&tkTextIndexType.objType); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 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 | /* * 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 #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Forward declarations for functions defined later in this file: */ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, Tk_Uid value, int valueIsUid, void *widgRec); static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, Tk_ConfigSpec *specs, const char *argvName, int needFlags, int hateFlags); static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specPtr, void *widgRec); static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specPtr, void *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, const Tk_ConfigSpec *staticSpecs); static void DeleteSpecCacheTable(void *clientData, Tcl_Interp *interp); /* *-------------------------------------------------------------- * * Tk_ConfigureWidget -- * * Process command-line options and database options to fill in fields of * a widget record with resources and other parameters. * * Results: * A standard Tcl return value. In case of an error, the interp's result * will hold an error message. * * Side effects: * The fields of widgRec get filled in with information from objc/objv * and the option database. Old information in widgRec's fields gets * recycled. A copy of the spec-table is taken with (some of) the char* * fields converted into Tk_Uid fields; this copy will be released when * the interpreter terminates. * *-------------------------------------------------------------- */ int Tk_ConfigureWidget( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ const Tk_ConfigSpec *specs, /* Describes legal options. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const *objv, /* Command-line options. */ void *widgRec, /* Record whose fields are to be modified. * Values must be properly initialized. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be * considered. Also, may have * TK_CONFIG_ARGV_ONLY set. */ { Tk_ConfigSpec *specPtr, *staticSpecs; Tk_Uid value; /* Value of option from database. */ int needFlags; /* Specs must contain this set of flags or * else they are not considered. */ int hateFlags; /* If a spec contains any bits here, it's not * considered. */ if (tkwin == NULL) { /* * Either we're not really in Tk, or the main window was destroyed and * we're on our way out of the application */ Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", (char *)NULL); return TCL_ERROR; } needFlags = flags & ~(TK_CONFIG_USER_BIT - 1); if (Tk_Depth(tkwin) <= 1) { hateFlags = TK_CONFIG_COLOR_ONLY; } else { |
︙ | ︙ | |||
122 123 124 125 126 127 128 | } /* * Pass one: scan through all of the arguments, processing those that * match entries in the specs. */ | | < | < < < | | < | < < < | 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 | } /* * Pass one: scan through all of the arguments, processing those that * match entries in the specs. */ for ( ; objc > 0; objc -= 2, objv += 2) { const char *arg; arg = Tcl_GetString(*objv); specPtr = FindConfigSpec(interp, staticSpecs, arg, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } /* * Process the entry. */ if (objc < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", arg)); Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", (char *)NULL); return TCL_ERROR; } arg = Tcl_GetString(objv[1]); if (DoConfig(interp, tkwin, specPtr, arg, 0, widgRec) != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (processing \"%.40s\" option)",specPtr->argvName)); return TCL_ERROR; } if (!(flags & TK_CONFIG_ARGV_ONLY)) { specPtr->specFlags |= TK_CONFIG_OPTION_SPECIFIED; |
︙ | ︙ | |||
272 273 274 275 276 277 278 | if (specPtr->argvName[length] == 0) { matchPtr = specPtr; goto gotMatch; } if (matchPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "ambiguous option \"%s\"", argvName)); | | | | | 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 | if (specPtr->argvName[length] == 0) { matchPtr = specPtr; goto gotMatch; } if (matchPtr != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "ambiguous option \"%s\"", argvName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", argvName, (char *)NULL); return NULL; } matchPtr = specPtr; } if (matchPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\"", argvName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", argvName, (char *)NULL); return NULL; } /* * Found a matching entry. If it's a synonym, then find the entry that * it's a synonym for. */ gotMatch: specPtr = matchPtr; if (specPtr->type == TK_CONFIG_SYNONYM) { for (specPtr = specs; ; specPtr++) { if (specPtr->type == TK_CONFIG_END) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't find synonym for option \"%s\"", argvName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", argvName, (char *)NULL); return NULL; } if ((specPtr->dbName == matchPtr->dbName) && (specPtr->type != TK_CONFIG_SYNONYM) && ((specPtr->specFlags & needFlags) == needFlags) && !(specPtr->specFlags & hateFlags)) { break; |
︙ | ︙ | |||
348 349 350 351 352 353 354 | * Values must be properly initialized. */ { void *ptr; Tk_Uid uid; int nullValue; nullValue = 0; | | > > > | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | * 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 { if (specPtr->offset < 0) { break; } ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) { return TCL_ERROR; } break; |
︙ | ︙ | |||
553 554 555 556 557 558 559 | interp, tkwin, value, (char *)widgRec, specPtr->offset)!=TCL_OK) { return TCL_ERROR; } break; default: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad config table: unknown type %d", specPtr->type)); | | | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | interp, tkwin, value, (char *)widgRec, specPtr->offset)!=TCL_OK) { return TCL_ERROR; } break; default: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad config table: unknown type %d", specPtr->type)); Tcl_SetErrorCode(interp, "TK", "BAD_CONFIG", (char *)NULL); return TCL_ERROR; } specPtr++; } while ((specPtr->argvName == NULL) && (specPtr->type != TK_CONFIG_END)); return TCL_OK; } |
︙ | ︙ | |||
594 595 596 597 598 599 600 | */ int Tk_ConfigureInfo( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ | | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | */ int Tk_ConfigureInfo( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ void *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* If non-NULL, indicates a single option * whose info is to be returned. Otherwise * info is returned for all options. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be * considered. */ |
︙ | ︙ | |||
634 635 636 637 638 639 640 | if (argvName != NULL) { specPtr = FindConfigSpec(interp, staticSpecs, argvName, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); | | | | | 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 | if (argvName != NULL) { specPtr = FindConfigSpec(interp, staticSpecs, argvName, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); Tcl_SetObjResult(interp, Tcl_NewStringObj(list, TCL_INDEX_NONE)); ckfree(list); return TCL_OK; } /* * Loop through all the specs, creating a big list with all their * information. */ for (specPtr = staticSpecs; specPtr->type != TK_CONFIG_END; specPtr++) { if ((argvName != NULL) && (specPtr->argvName != argvName)) { continue; } if (((specPtr->specFlags & needFlags) != needFlags) || (specPtr->specFlags & hateFlags)) { continue; } if ((specPtr->argvName == NULL) || (specPtr->offset < 0)) { continue; } list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); Tcl_AppendResult(interp, leader, list, "}", (char *)NULL); ckfree(list); leader = " {"; } return TCL_OK; } /* |
︙ | ︙ | |||
720 721 722 723 724 725 726 | argv[3] = ""; } if (argv[4] == NULL) { argv[4] = ""; } result = Tcl_Merge(5, argv); if (freeProc != NULL) { | | | | | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | argv[3] = ""; } if (argv[4] == NULL) { argv[4] = ""; } result = Tcl_Merge(5, argv); if (freeProc != NULL) { if (freeProc == TCL_DYNAMIC) { ckfree((char *)argv[4]); } else { freeProc((char *)argv[4]); } } return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | * function to free the result, or NULL if * result is static. */ { void *ptr; const char *result; *freeProcPtr = NULL; ptr = (char *)widgRec + specPtr->offset; result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (*((int *)ptr) == 0) { result = "0"; } else { result = "1"; } break; case TK_CONFIG_INT: | > > > | | 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 | * function to free the result, or NULL if * result is static. */ { void *ptr; const char *result; *freeProcPtr = NULL; if (specPtr->offset < 0) { return NULL; } ptr = (char *)widgRec + specPtr->offset; result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (*((int *)ptr) == 0) { result = "0"; } else { result = "1"; } break; case TK_CONFIG_INT: snprintf(buffer, 200, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_DOUBLE: Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_STRING: |
︙ | ︙ | |||
856 857 858 859 860 861 862 | case TK_CONFIG_CAP_STYLE: result = Tk_NameOfCapStyle(*((int *)ptr)); break; case TK_CONFIG_JOIN_STYLE: result = Tk_NameOfJoinStyle(*((int *)ptr)); break; case TK_CONFIG_PIXELS: | | | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | case TK_CONFIG_CAP_STYLE: result = Tk_NameOfCapStyle(*((int *)ptr)); break; case TK_CONFIG_JOIN_STYLE: result = Tk_NameOfJoinStyle(*((int *)ptr)); break; case TK_CONFIG_PIXELS: snprintf(buffer, 200, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_MM: Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_WINDOW: { |
︙ | ︙ | |||
905 906 907 908 909 910 911 | */ int Tk_ConfigureValue( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ | | | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | */ int Tk_ConfigureValue( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ void *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* Gives the command-line name for the option * whose value is to be returned. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be * considered. */ { |
︙ | ︙ | |||
938 939 940 941 942 943 944 | specPtr = FindConfigSpec(interp, specPtr, argvName, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, &freeProc); | | | | | | 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | specPtr = FindConfigSpec(interp, specPtr, argvName, needFlags, hateFlags); if (specPtr == NULL) { return TCL_ERROR; } result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, &freeProc); Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_INDEX_NONE)); if (freeProc != NULL) { if (freeProc == TCL_DYNAMIC) { ckfree((char *)result); } else { freeProc((char *)result); } } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
973 974 975 976 977 978 979 | * *---------------------------------------------------------------------- */ void Tk_FreeOptions( const Tk_ConfigSpec *specs, /* Describes legal options. */ | | > > > | | 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 | * *---------------------------------------------------------------------- */ void Tk_FreeOptions( const Tk_ConfigSpec *specs, /* Describes legal options. */ void *widgRec, /* Record whose fields contain current values * for options. */ Display *display, /* X display; needed for freeing some * resources. */ int needFlags) /* Used to specify additional flags that must * be present in config specs for them to be * considered. */ { const Tk_ConfigSpec *specPtr; char *ptr; for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { if ((specPtr->specFlags & needFlags) != needFlags) { continue; } if (specPtr->offset < 0) { continue; } ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_STRING: if (*((char **) ptr) != NULL) { ckfree(*((char **) ptr)); *((char **) ptr) = NULL; } break; |
︙ | ︙ | |||
1154 1155 1156 1157 1158 1159 1160 | * None (does *not* use any Tk API). * *-------------------------------------------------------------- */ static void DeleteSpecCacheTable( | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | * None (does *not* use any Tk API). * *-------------------------------------------------------------- */ static void DeleteSpecCacheTable( void *clientData, TCL_UNUSED(Tcl_Interp *)) { Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; for (entryPtr = Tcl_FirstHashEntry(tablePtr,&search); entryPtr != NULL; |
︙ | ︙ |
Deleted generic/tkOldTest.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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" |
︙ | ︙ | |||
215 216 217 218 219 220 221 | char *string, int priority); static void ClearOptionTree(ElArray *arrayPtr); static ElArray * ExtendArray(ElArray *arrayPtr, Element *elPtr); static void ExtendStacks(ElArray *arrayPtr, int leaf); static int GetDefaultOptions(Tcl_Interp *interp, TkWindow *winPtr); static ElArray * NewArray(int numEls); | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | char *string, int priority); static void ClearOptionTree(ElArray *arrayPtr); static ElArray * ExtendArray(ElArray *arrayPtr, Element *elPtr); static void ExtendStacks(ElArray *arrayPtr, int leaf); static int GetDefaultOptions(Tcl_Interp *interp, TkWindow *winPtr); static ElArray * NewArray(int numEls); static void OptionThreadExitProc(void *clientData); static void OptionInit(TkMainInfo *mainPtr); static int ParsePriority(Tcl_Interp *interp, const char *string); static int ReadOptionFile(Tcl_Interp *interp, Tk_Window tkwin, const char *fileName, int priority); static void SetupStacks(TkWindow *winPtr, int leaf); /* |
︙ | ︙ | |||
517 518 519 520 521 522 523 | * option database is densely populated, or if the widget has many * masquerading options. */ if (masqName != NULL) { char *masqClass; Tk_Uid nodeId, winClassId, winNameId; | | | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | * option database is densely populated, or if the widget has many * masquerading options. */ if (masqName != NULL) { char *masqClass; Tk_Uid nodeId, winClassId, winNameId; Tcl_Size classNameLength; Element *nodePtr, *leafPtr; static const int searchOrder[] = { EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS, WILDCARD_NODE_CLASS, -1 }; const int *currentPtr; int currentStack, leafCount; |
︙ | ︙ | |||
606 607 608 609 610 611 612 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_OptionObjCmd( | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_OptionObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of Tcl_Obj arguments. */ Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */ { Tk_Window tkwin = (Tk_Window)clientData; int index, result; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) |
︙ | ︙ | |||
686 687 688 689 690 691 692 | window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); if (window == NULL) { return TCL_ERROR; } value = Tk_GetOption(window, Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); if (value != NULL) { | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | window = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); if (window == NULL) { return TCL_ERROR; } value = Tk_GetOption(window, Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); if (value != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(value, TCL_INDEX_NONE)); } break; } case OPTION_READFILE: { int priority; |
︙ | ︙ | |||
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 < 0) { 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]; |
︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | * file, such as TK_USER_DEFAULT_PRIO or * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { const char *realName; Tcl_Obj *buffer; int result; | | | | | 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 | * file, such as TK_USER_DEFAULT_PRIO or * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { const char *realName; Tcl_Obj *buffer; int result; Tcl_Size bufferSize; Tcl_Channel chan; Tcl_DString newName; /* * Prevent file system access in a safe interpreter. */ if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't read options from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "OPTION_FILE", NULL); return TCL_ERROR; } realName = Tcl_TranslateFileName(interp, fileName, &newName); if (realName == NULL) { return TCL_ERROR; } chan = Tcl_OpenFileChannel(interp, realName, "r", 0); Tcl_DStringFree(&newName); if (chan == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("couldn't open \"%s\": %s", fileName, Tcl_PosixError(interp))); return TCL_ERROR; } buffer = Tcl_NewObj(); Tcl_IncrRefCount(buffer); Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8"); bufferSize = Tcl_ReadChars(chan, buffer, TCL_INDEX_NONE, 0); if (bufferSize == TCL_IO_FAILURE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading file \"%s\": %s", fileName, Tcl_PosixError(interp))); Tcl_Close(NULL, chan); return TCL_ERROR; } |
︙ | ︙ | |||
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: */ |
︙ | ︙ | |||
99 100 101 102 103 104 105 | #define DONT_PROPAGATE 32 #define ALLOCED_CONTAINER 64 /* * The following structure is the official type record for the packer: */ | | | | | < < < < | | 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 | #define DONT_PROPAGATE 32 #define ALLOCED_CONTAINER 64 /* * The following structure is the official type record for the packer: */ static void PackReqProc(void *clientData, Tk_Window tkwin); static void PackLostContentProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr packerType = { "pack", /* name */ PackReqProc, /* requestProc */ PackLostContentProc, /* lostContentProc */ }; /* * Forward declarations for functions defined later in this file: */ static void ArrangePacking(void *clientData); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyPacker; static Packer * GetPacker(Tk_Window tkwin); static void PackStructureProc(void *clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); static int XExpansion(Packer *contentPtr, int cavityWidth); static int YExpansion(Packer *contentPtr, int cavityHeight); /* *------------------------------------------------------------------------ |
︙ | ︙ | |||
158 159 160 161 162 163 164 | * "ipady" */ int halfSpace, /* The left or top padding amount */ int allSpace) /* The total amount of padding */ { Tcl_Obj *padding[2]; if (halfSpace*2 == allSpace) { | | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | * "ipady" */ int halfSpace, /* The left or top padding amount */ int allSpace) /* The total amount of padding */ { Tcl_Obj *padding[2]; if (halfSpace*2 == allSpace) { Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, TCL_INDEX_NONE), Tcl_NewWideIntObj(halfSpace)); } else { padding[0] = Tcl_NewWideIntObj(halfSpace); padding[1] = Tcl_NewWideIntObj(allSpace - halfSpace); Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, TCL_INDEX_NONE), Tcl_NewListObj(2, padding)); } } /* *------------------------------------------------------------------------ * |
︙ | ︙ | |||
187 188 189 190 191 192 193 | * See the user documentation. * *------------------------------------------------------------------------ */ int Tk_PackObjCmd( | | < < < < < < | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | * See the user documentation. * *------------------------------------------------------------------------ */ int Tk_PackObjCmd( 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; const char *argv2; static const char *const optionStrings[] = { "configure", "content", "forget", "info", "propagate", "slaves", NULL }; static const char *const optionStringsNoDep[] = { "configure", "content", "forget", "info", "propagate", NULL }; enum options { PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; if (objc >= 2) { const char *string = Tcl_GetString(objv[1]); if (string[0] == '.') { return ConfigureContent(interp, tkwin, objc-1, objv+1); } } 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) { case PACK_CONFIGURE: if (argv2[0] != '.') { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be name of window", argv2)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
352 353 354 355 356 357 358 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); return TCL_ERROR; } infoObj = Tcl_NewObj(); | | | | | | | | | | | | | | | | 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 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); return TCL_ERROR; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", TCL_INDEX_NONE), Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", TCL_INDEX_NONE), Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), TCL_INDEX_NONE)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", TCL_INDEX_NONE), Tcl_NewBooleanObj(contentPtr->flags & EXPAND)); switch (contentPtr->flags & (FILLX|FILLY)) { case 0: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), Tcl_NewStringObj("none", TCL_INDEX_NONE)); break; case FILLX: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), Tcl_NewStringObj("x", TCL_INDEX_NONE)); break; case FILLY: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), Tcl_NewStringObj("y", TCL_INDEX_NONE)); break; case FILLX|FILLY: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), Tcl_NewStringObj("both", TCL_INDEX_NONE)); break; } TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX); TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", TCL_INDEX_NONE), Tcl_NewStringObj(sideNames[contentPtr->side], TCL_INDEX_NONE)); Tcl_SetObjResult(interp, infoObj); break; } case PACK_PROPAGATE: { Tk_Window container; Packer *containerPtr; int propagate; |
︙ | ︙ | |||
463 464 465 466 467 468 469 | contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; } | < < < < < < < < < < < < < < < < < < < < < < < < < | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; } } return TCL_OK; } /* *------------------------------------------------------------------------ |
︙ | ︙ | |||
513 514 515 516 517 518 519 | * the next idle point. * *------------------------------------------------------------------------ */ static void PackReqProc( | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | * the next idle point. * *------------------------------------------------------------------------ */ static void PackReqProc( void *clientData, /* Packer's information about window that got * new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { Packer *packPtr = (Packer *)clientData; packPtr = packPtr->containerPtr; |
︙ | ︙ | |||
580 581 582 583 584 585 586 | * The packed content of containerPtr may get resized or moved. * *------------------------------------------------------------------------ */ static void ArrangePacking( | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | * The packed content of containerPtr may get resized or moved. * *------------------------------------------------------------------------ */ static void ArrangePacking( void *clientData) /* Structure describing container whose content * are to be re-layed out. */ { Packer *containerPtr = (Packer *)clientData; Packer *contentPtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the |
︙ | ︙ | |||
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; | | < < | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | 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 |
︙ | ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | packPtr->flags = 0; Tcl_SetHashValue(hPtr, packPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, PackStructureProc, packPtr); return packPtr; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | packPtr->flags = 0; Tcl_SetHashValue(hPtr, packPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, PackStructureProc, packPtr); return packPtr; } /* *---------------------------------------------------------------------- * * Unlink -- * * Remove a packer from its container's list of content. * |
︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 | * Everything associated with the packer is freed up. * *---------------------------------------------------------------------- */ static void DestroyPacker( | > | > | > > > > | 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 | * Everything associated with the packer is freed up. * *---------------------------------------------------------------------- */ static void DestroyPacker( #if TCL_MAJOR_VERSION > 8 void *memPtr) /* Info about packed window that is now dead. */ #else char *memPtr) #endif { Packer *packPtr = (Packer *)memPtr; if (packPtr->flags & REQUESTED_REPACK) { Tcl_CancelIdleCall(ArrangePacking, packPtr); } ckfree(packPtr); } /* *---------------------------------------------------------------------- * * PackStructureProc -- |
︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 | * information. If it was just resized, repack its content, if any. * *---------------------------------------------------------------------- */ static void PackStructureProc( | | | 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | * information. If it was just resized, repack its content, if any. * *---------------------------------------------------------------------- */ static void PackStructureProc( void *clientData, /* Our information about window referred to by * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { if ((packPtr->contentPtr != NULL) |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { Tcl_CancelIdleCall(ArrangePacking, packPtr); } packPtr->tkwin = NULL; | | | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { Tcl_CancelIdleCall(ArrangePacking, packPtr); } packPtr->tkwin = NULL; Tcl_EventuallyFree(packPtr, DestroyPacker); } else if (eventPtr->type == MapNotify) { /* * When a container gets mapped, must redo the geometry computation so * that all of its content get remapped. */ if ((packPtr->contentPtr != NULL) |
︙ | ︙ | |||
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; } | | | | 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | 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: | | | | 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | 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 240 241 242 243 | #define PROXY_REDRAW_PENDING 0x0010 #define RESIZE_PENDING 0x0020 /* * Forward declarations for functions defined later in this file: */ 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, Tcl_Size internalOffset, char *oldInternalPtr, int flags); static Tcl_Obj * GetSticky(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size 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, Tcl_Size offset); static int PanedWindowIdentifyCoords(PanedWindow *pwPtr, Tcl_Interp *interp, int x, int y); /* * Sashes are between panes only, so there is one less sash than panes */ |
︙ | ︙ | |||
271 272 273 274 275 276 277 | RestoreSticky, /* restoreProc */ NULL, /* freeProc */ 0 }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | 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( | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | * 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 | | | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | 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( | | | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | * 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[] = { |
︙ | ︙ | |||
671 672 673 674 675 676 677 | pwPtr->panes[i], pwPtr->paneOpts, objv[3], tkwin); } } if (resultObj == NULL) { if (i == pwPtr->numPanes) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | pwPtr->panes[i], pwPtr->paneOpts, objv[3], tkwin); } } if (resultObj == NULL) { if (i == pwPtr->numPanes) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "not managed by this window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL); } result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObj); } |
︙ | ︙ | |||
887 888 889 890 891 892 893 | */ if (haveLoc && index == -1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" is not managed by %s", Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL); | | | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | */ if (haveLoc && index == -1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" is not managed by %s", Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL); Tk_FreeConfigOptions(&options, pwPtr->paneOpts, pwPtr->tkwin); return TCL_ERROR; } /* * Allocate an array to hold, in order, the pointers to the pane * structures corresponding to the windows specified. Some of those |
︙ | ︙ | |||
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. */ | > > > | | > | | | 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 | 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++; } |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | /* * Set the paned window's pane count to the new value. */ pwPtr->numPanes += numNewPanes; | | | 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | /* * Set the paned window's pane count to the new value. */ pwPtr->numPanes += numNewPanes; Tk_FreeConfigOptions(&options, pwPtr->paneOpts, pwPtr->tkwin); ComputeGeometry(pwPtr); return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1121 1122 1123 1124 1125 1126 1127 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } panePtr = pwPtr->panes[sash]; coords[0] = Tcl_NewWideIntObj(panePtr->sashx); coords[1] = Tcl_NewWideIntObj(panePtr->sashy); |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } if (objc == 6) { if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) { return TCL_ERROR; |
︙ | ︙ | |||
1180 1181 1182 1183 1184 1185 1186 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | if (Tcl_GetIntFromObj(interp, objv[3], &sash) != TCL_OK) { return TCL_ERROR; } if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[4], &x) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | * Paned window will be relayed out and redisplayed. * *---------------------------------------------------------------------- */ static void PanedWindowWorldChanged( | | | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | * 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( | | | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 | * 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( | | | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | * 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( | | | 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | * 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); |
︙ | ︙ | |||
1574 1575 1576 1577 1578 1579 1580 | * o Free memory for the pane */ for (i = 0; i < pwPtr->numPanes; i++) { Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask, PaneStructureProc, pwPtr->panes[i]); Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL); | | | | 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 | * o Free memory for the pane */ for (i = 0; i < pwPtr->numPanes; i++) { Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask, PaneStructureProc, pwPtr->panes[i]); Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL); Tk_FreeConfigOptions(pwPtr->panes[i], pwPtr->paneOpts, pwPtr->tkwin); ckfree(pwPtr->panes[i]); pwPtr->panes[i] = NULL; } if (pwPtr->panes) { ckfree(pwPtr->panes); } /* * Remove the widget command from the interpreter. */ Tcl_DeleteCommandFromToken(pwPtr->interp, pwPtr->widgetCmd); /* * Let Tk_FreeConfigOptions clean up the rest. */ Tk_FreeConfigOptions(pwPtr, pwPtr->optionTable, pwPtr->tkwin); Tcl_Release(pwPtr->tkwin); pwPtr->tkwin = NULL; Tcl_EventuallyFree(pwPtr, TCL_DYNAMIC); } /* |
︙ | ︙ | |||
1620 1621 1622 1623 1624 1625 1626 | * the next idle point. * *-------------------------------------------------------------- */ static void PanedWindowReqProc( | | | 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | * 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( | | | 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 | * 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( | | | 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 | * 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( | | | 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 | * 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( | | | 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 | * Frees memory. * *---------------------------------------------------------------------- */ static void DestroyOptionTables( void *clientData, /* Pointer to the OptionTables struct */ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { ckfree(clientData); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2392 2393 2394 2395 2396 2397 2398 | */ static Tcl_Obj * GetSticky( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ | | | | 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 | */ static Tcl_Obj * GetSticky( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ Tcl_Size internalOffset) /* Offset within *recordPtr containing the * sticky value. */ { int sticky = *(int *)(recordPtr + internalOffset); char buffer[5]; char *p = &buffer[0]; if (sticky & STICK_NORTH) { *p++ = 'n'; } if (sticky & STICK_EAST) { *p++ = 'e'; } if (sticky & STICK_SOUTH) { *p++ = 's'; } if (sticky & STICK_WEST) { *p++ = 'w'; } *p = '\0'; return Tcl_NewStringObj(buffer, TCL_INDEX_NONE); } /* *---------------------------------------------------------------------- * * SetSticky -- * |
︙ | ︙ | |||
2444 2445 2446 2447 2448 2449 2450 | TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ char *recordPtr, /* Pointer to storage for the widget record. */ | | | 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 | TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ char *recordPtr, /* Pointer to storage for the widget record. */ Tcl_Size internalOffset, /* Offset within *recordPtr at which the * internal value is to be stored. */ char *oldInternalPtr, /* Pointer to storage for the old value. */ int flags) /* Flags for the option, set Tk_SetOptions. */ { int sticky = 0; char c; void *internalPtr; |
︙ | ︙ | |||
2747 2748 2749 2750 2751 2752 2753 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ProxyWindowEventProc( | | | 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 | * 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( | | | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 | * 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; |
︙ | ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | * *---------------------------------------------------------------------- */ static void * ComputeSlotAddress( void *recordPtr, /* Pointer to the start of a record. */ | | | 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | * *---------------------------------------------------------------------- */ static void * ComputeSlotAddress( void *recordPtr, /* Pointer to the start of a record. */ Tcl_Size offset) /* Offset of a slot within that record; may be TCL_INDEX_NONE. */ { if (offset != TCL_INDEX_NONE) { return (char *)recordPtr + offset; } else { return NULL; } } |
︙ | ︙ | |||
3138 3139 3140 3141 3142 3143 3144 | * is called inside the implementation of a command). */ if (found != -1) { Tcl_Obj *list[2]; list[0] = Tcl_NewWideIntObj(found); | | | 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 | * is called inside the implementation of a command). */ if (found != -1) { Tcl_Obj *list[2]; list[0] = Tcl_NewWideIntObj(found); list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), TCL_INDEX_NONE); Tcl_SetObjResult(interp, Tcl_NewListObj(2, list)); } return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 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 | /* * 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: * * - _WIN32 || __CYGWIN__ The value for the fontsytem key will be * MAC_OSX_TK chosen based on these macros/defines. * HAVE_XFT declares that xft font support was requested. * * - CFG_RUNTIME_* Paths to various stuff at runtime. * - CFG_INSTALL_* Paths to various stuff at installation time. * * - TCL_CFGVAL_ENCODING string containing the encoding used for the * configuration values. */ #include "tkInt.h" #ifndef TCL_CFGVAL_ENCODING #define TCL_CFGVAL_ENCODING "utf-8" #endif /* * Use C preprocessor statements to define the various values for the embedded * configuration information. */ #if defined(_WIN32) # define CFG_FONTSYSTEM "gdi" #elif defined(MAC_OSX_TK) # define CFG_FONTSYSTEM "cocoa" #elif defined(HAVE_XFT) # define CFG_FONTSYSTEM "xft" #else # define CFG_FONTSYSTEM "x11" #endif static const Tcl_Config cfg[] = { {"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 | > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 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), TK_OPTION_ENUM_VAR, 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}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", offsetof(Content, relWidthPtr), offsetof(Content, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0.0", TCL_INDEX_NONE, offsetof(Content, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0.0", TCL_INDEX_NONE, offsetof(Content, relY), 0, 0, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr), offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0}, {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. */ |
︙ | ︙ | |||
149 150 151 152 153 154 155 | #define PARENT_RECONFIG_PENDING 1 /* * The following structure is the official type record for the placer: */ | | | | | | | 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 | #define PARENT_RECONFIG_PENDING 1 /* * The following structure is the official type record for the placer: */ static void PlaceRequestProc(void *clientData, Tk_Window tkwin); static void PlaceLostContentProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr placerType = { "place", /* name */ PlaceRequestProc, /* requestProc */ PlaceLostContentProc, /* lostContentProc */ }; /* * Forward declarations for functions defined later in this file: */ static void ContentStructureProc(void *clientData, XEvent *eventPtr); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, Tcl_Obj *const objv[]); static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin); static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table); static void FreeContent(Content *contentPtr); static Content * FindContent(Tk_Window tkwin); static Container * CreateContainer(Tk_Window tkwin); static Container * FindContainer(Tk_Window tkwin); static void PlaceStructureProc(void *clientData, XEvent *eventPtr); static void RecomputePlacement(void *clientData); static void UnlinkContent(Content *contentPtr); /* *-------------------------------------------------------------- * * Tk_PlaceObjCmd -- * |
︙ | ︙ | |||
199 200 201 202 203 204 205 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_PlaceObjCmd( | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_PlaceObjCmd( void *clientData, /* Interpreter main window. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; Content *contentPtr; |
︙ | ︙ | |||
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 | *---------------------------------------------------------------------- */ static void FreeContent( Content *contentPtr) { | > > > | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | *---------------------------------------------------------------------- */ static void FreeContent( Content *contentPtr) { if (contentPtr->containerPtr && (contentPtr->containerPtr->flags & PARENT_RECONFIG_PENDING)) { Tcl_CancelIdleCall(RecomputePlacement, contentPtr->containerPtr); } Tk_FreeConfigOptions(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; |
︙ | ︙ | |||
812 813 814 815 816 817 818 | contentPtr = FindContent(tkwin); if (contentPtr == NULL) { return TCL_OK; } infoObj = Tcl_NewObj(); if (contentPtr->containerPtr != NULL) { | | | | | | | | | | | | 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 | contentPtr = FindContent(tkwin); if (contentPtr == NULL) { return TCL_OK; } infoObj = Tcl_NewObj(); if (contentPtr->containerPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, infoObj, Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", TCL_INDEX_NONE); } 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 {}", TCL_INDEX_NONE); } if (contentPtr->relWidthPtr) { Tcl_AppendPrintfToObj(infoObj, " -relwidth %.4g", contentPtr->relWidth); } else { Tcl_AppendToObj(infoObj, " -relwidth {}", TCL_INDEX_NONE); } if (contentPtr->heightPtr) { Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { Tcl_AppendToObj(infoObj, " -height {}", TCL_INDEX_NONE); } if (contentPtr->relHeightPtr) { Tcl_AppendPrintfToObj(infoObj, " -relheight %.4g", contentPtr->relHeight); } else { Tcl_AppendToObj(infoObj, " -relheight {}", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", Tk_NameOfAnchor(contentPtr->anchor), borderModeStrings[contentPtr->borderMode]); Tcl_SetObjResult(interp, infoObj); return TCL_OK; |
︙ | ︙ | |||
869 870 871 872 873 874 875 | * Windows may change size or shape. * *---------------------------------------------------------------------- */ static void RecomputePlacement( | | | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | * Windows may change size or shape. * *---------------------------------------------------------------------- */ static void RecomputePlacement( void *clientData) /* Pointer to Container record. */ { Container *containerPtr = (Container *)clientData; Content *contentPtr; int x, y, width, height, tmp; int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; int abort; /* May get set to non-zero to abort this |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | * resized then content geometries get recomputed. * *---------------------------------------------------------------------- */ static void PlaceStructureProc( | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | * resized then content geometries get recomputed. * *---------------------------------------------------------------------- */ static void PlaceStructureProc( void *clientData, /* Pointer to Container structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { Container *containerPtr = (Container *)clientData; Content *contentPtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr; |
︙ | ︙ | |||
1167 1168 1169 1170 1171 1172 1173 | * Structures get cleaned up if the window was deleted. * *---------------------------------------------------------------------- */ static void ContentStructureProc( | | | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | * Structures get cleaned up if the window was deleted. * *---------------------------------------------------------------------- */ static void ContentStructureProc( void *clientData, /* Pointer to Content structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { Content *contentPtr = (Content *)clientData; TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | * do with its actual size. * *---------------------------------------------------------------------- */ static void PlaceRequestProc( | | | | | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | * do with its actual size. * *---------------------------------------------------------------------- */ static void PlaceRequestProc( void *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; |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | * Forgets all placer-related information about the content window. * *-------------------------------------------------------------- */ static void PlaceLostContentProc( | | | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | * Forgets all placer-related information about the content window. * *-------------------------------------------------------------- */ static void PlaceLostContentProc( void *clientData, /* Content structure for content window that was * stolen away. */ Tk_Window tkwin) /* Tk's handle for the content window. */ { Content *contentPtr = (Content *)clientData; TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { |
︙ | ︙ |
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 © 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 |
︙ | ︙ | |||
42 43 44 45 46 47 48 | EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd); /* 1 */ EXTERN HINSTANCE Tk_GetHINSTANCE(void); /* 2 */ EXTERN HWND Tk_GetHWND(Window window); /* 3 */ EXTERN Tk_Window Tk_HWNDToWindow(HWND hwnd); | < < < < < < | < < | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd); /* 1 */ EXTERN HINSTANCE Tk_GetHINSTANCE(void); /* 2 */ EXTERN HWND Tk_GetHWND(Window window); /* 3 */ EXTERN Tk_Window Tk_HWNDToWindow(HWND hwnd); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ /* Slot 1 is reserved */ /* Slot 2 is reserved */ /* Slot 3 is reserved */ /* 4 */ EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp); /* Slot 5 is reserved */ /* 6 */ EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin); /* Slot 7 is reserved */ /* 8 */ EXTERN void * TkMacOSXGetRootControl(Drawable drawable); /* 9 */ EXTERN void Tk_MacOSXSetupTkNotifier(void); |
︙ | ︙ | |||
90 91 92 93 94 95 96 | void *hooks; #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */ HWND (*tk_GetHWND) (Window window); /* 2 */ Tk_Window (*tk_HWNDToWindow) (HWND hwnd); /* 3 */ | < < | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | void *hooks; #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */ HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */ HWND (*tk_GetHWND) (Window window); /* 2 */ Tk_Window (*tk_HWNDToWindow) (HWND hwnd); /* 3 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ void (*reserved0)(void); void (*reserved1)(void); void (*reserved2)(void); void (*reserved3)(void); void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */ void (*reserved5)(void); void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */ void (*reserved7)(void); void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */ int (*tk_MacOSXIsAppInFront) (void); /* 10 */ Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */ void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */ |
︙ | ︙ | |||
135 136 137 138 139 140 141 | (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #define Tk_GetHINSTANCE \ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ #define Tk_GetHWND \ (tkPlatStubsPtr->tk_GetHWND) /* 2 */ #define Tk_HWNDToWindow \ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ | < < < < | < | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | (tkPlatStubsPtr->tk_AttachHWND) /* 0 */ #define Tk_GetHINSTANCE \ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */ #define Tk_GetHWND \ (tkPlatStubsPtr->tk_GetHWND) /* 2 */ #define Tk_HWNDToWindow \ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* Slot 0 is reserved */ /* Slot 1 is reserved */ /* Slot 2 is reserved */ /* Slot 3 is reserved */ #define TkMacOSXInitAppleEvents \ (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */ /* Slot 5 is reserved */ #define TkMacOSXInvalClipRgns \ (tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */ /* Slot 7 is reserved */ #define TkMacOSXGetRootControl \ (tkPlatStubsPtr->tkMacOSXGetRootControl) /* 8 */ #define Tk_MacOSXSetupTkNotifier \ (tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */ |
︙ | ︙ | |||
181 182 183 184 185 186 187 | #ifdef __cplusplus } #endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT | < | 166 167 168 169 170 171 172 173 174 175 | #ifdef __cplusplus } #endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl #endif /* _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" |
︙ | ︙ | |||
430 431 432 433 434 435 436 | (void)event_mask; (void)pointer_mode; (void)keyboard_mode; (void)confine_to; (void)cursor; (void)time; | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | (void)event_mask; (void)pointer_mode; (void)keyboard_mode; (void)confine_to; (void)cursor; (void)time; LastKnownRequestProcessed(display)++; tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window); tsdPtr->restrictWinPtr = NULL; TkpSetCapture(tsdPtr->grabWinPtr); if (TkPositionInTree(tsdPtr->lastWinPtr, tsdPtr->grabWinPtr) != TK_GRAB_IN_TREE) { UpdateCursor(tsdPtr->grabWinPtr); } |
︙ | ︙ | |||
466 467 468 469 470 471 472 | Display *display, Time time) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)time; | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | Display *display, Time time) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)time; LastKnownRequestProcessed(display)++; tsdPtr->grabWinPtr = NULL; tsdPtr->restrictWinPtr = NULL; TkpSetCapture(NULL); UpdateCursor(tsdPtr->lastWinPtr); return Success; } |
︙ | ︙ | |||
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; } |
︙ | ︙ | |||
594 595 596 597 598 599 600 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)cursor; if (tsdPtr->cursorWinPtr == winPtr) { UpdateCursor(winPtr); } | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)cursor; if (tsdPtr->cursorWinPtr == winPtr) { UpdateCursor(winPtr); } LastKnownRequestProcessed(display)++; return Success; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkPort.h.
1 2 3 4 5 6 7 | /* * tkPort.h -- * * This header file handles porting issues that occur because of * differences between systems. It reads in platform specific * portability files. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkPort.h -- * * This header file handles porting issues that occur because of * differences between systems. It reads in platform specific * portability files. * * 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 _TKPORT #define _TKPORT |
︙ | ︙ |
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" |
︙ | ︙ | |||
43 44 45 46 47 48 49 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * Information used for parsing configuration specs: */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, INT2PTR(2) }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_CustomOption dashOption = { TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; |
︙ | ︙ | |||
90 91 92 93 94 95 96 | NULL, offsetof(RectOvalItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | NULL, offsetof(RectOvalItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, "0.0", offsetof(RectOvalItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, NULL, offsetof(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(RectOvalItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, |
︙ | ︙ | |||
124 125 126 127 128 129 130 | /* * Prototypes for functions defined in this file: */ static void ComputeRectOvalBbox(Tk_Canvas canvas, RectOvalItem *rectOvalPtr); static int ConfigureRectOval(Tcl_Interp *interp, Tk_Canvas canvas, | | | | | 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 | /* * Prototypes for functions defined in this file: */ static void ComputeRectOvalBbox(Tk_Canvas canvas, RectOvalItem *rectOvalPtr); static int ConfigureRectOval(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static int CreateRectOval(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void DeleteRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static int OvalToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *areaPtr); static double OvalToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int RectOvalCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int RectOvalToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *areaPtr); static double RectToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static void RotateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, |
︙ | ︙ | |||
167 168 169 170 171 172 173 | sizeof(RectOvalItem), /* itemSize */ CreateRectOval, /* createProc */ configSpecs, /* configSpecs */ ConfigureRectOval, /* configureProc */ RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | sizeof(RectOvalItem), /* itemSize */ CreateRectOval, /* createProc */ configSpecs, /* configSpecs */ ConfigureRectOval, /* configureProc */ RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ 0, /* flags */ RectToPoint, /* pointProc */ RectToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ ScaleRectOval, /* scaleProc */ TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ |
︙ | ︙ | |||
192 193 194 195 196 197 198 | sizeof(RectOvalItem), /* itemSize */ CreateRectOval, /* createProc */ configSpecs, /* configSpecs */ ConfigureRectOval, /* configureProc */ RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | sizeof(RectOvalItem), /* itemSize */ CreateRectOval, /* createProc */ configSpecs, /* configSpecs */ ConfigureRectOval, /* configureProc */ RectOvalCoords, /* coordProc */ DeleteRectOval, /* deleteProc */ DisplayRectOval, /* displayProc */ 0, /* flags */ OvalToPoint, /* pointProc */ OvalToArea, /* areaProc */ RectOvalToPostscript, /* postscriptProc */ ScaleRectOval, /* scaleProc */ TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ |
︙ | ︙ | |||
234 235 236 237 238 239 240 | static int CreateRectOval( Tcl_Interp *interp, /* For error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ | | | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | static int CreateRectOval( Tcl_Interp *interp, /* For error reporting. */ Tk_Canvas canvas, /* Canvas to hold new item. */ Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ Tcl_Size objc, /* Number of arguments in objv. */ Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; Tcl_Size i; if (objc == 0) { Tcl_Panic("canvas did not pass any coords"); } /* * Carry out initialization that is needed in order to clean up after |
︙ | ︙ | |||
309 310 311 312 313 314 315 | static int RectOvalCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ | | | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | static int RectOvalCoords( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ Tcl_Size objc, /* Number of coordinates supplied in objv. */ Tcl_Obj *const objv[]) /* Array of coordinates: x1,y1,x2,y2,... */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; /* * If no coordinates, return the current coordinates (i.e. bounding box). */ |
︙ | ︙ | |||
346 347 348 349 350 351 352 | /* * Better have four coordinates now. Spit out an error message otherwise. */ if (objc != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | /* * Better have four coordinates now. Spit out an error message otherwise. */ if (objc != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 4, got %" TCL_SIZE_MODIFIER "d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", (rectOvalPtr->header.typePtr == &tkRectangleType ? "RECTANGLE" : "OVAL"), NULL); return TCL_ERROR; } /* |
︙ | ︙ | |||
395 396 397 398 399 400 401 | */ static int ConfigureRectOval( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ | | | | 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 | */ static int ConfigureRectOval( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ Tcl_Size objc, /* Number of elements in objv. */ Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; XGCValues gcValues; GC newGC; unsigned long mask; Tk_Window tkwin; Tk_TSOffset *tsoffset; XColor *color; Pixmap stipple; Tk_State state; tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, objv, rectOvalPtr, flags)) { return TCL_ERROR; } state = itemPtr->state; /* * A few of the options require additional processing, such as graphics * contexts. |
︙ | ︙ | |||
570 571 572 573 574 575 576 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteRectOval( | | < | 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | * Resources associated with itemPtr are released. * *-------------------------------------------------------------- */ static void DeleteRectOval( TCL_UNUSED(Tk_Canvas), /* Info about overall widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); if (rectOvalPtr->fillColor != NULL) { Tk_FreeColor(rectOvalPtr->fillColor); } if (rectOvalPtr->activeFillColor != NULL) { Tk_FreeColor(rectOvalPtr->activeFillColor); |
︙ | ︙ | |||
740 741 742 743 744 745 746 | static void DisplayRectOval( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ | < | | > > < < < < | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | static void DisplayRectOval( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ TCL_UNUSED(int),/* Describes region of canvas that must be */ TCL_UNUSED(int),/* redisplayed (not used). */ TCL_UNUSED(int), TCL_UNUSED(int)) { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; short x1, y1, x2, y2; Pixmap fillStipple; Tk_State state = itemPtr->state; /* * Compute the screen coordinates of the bounding box for the item. Make * sure that the bbox is at least one pixel large, since some X servers * will die if it isn't. */ |
︙ | ︙ | |||
1430 1431 1432 1433 1434 1435 1436 | */ static int RectOvalToPostscript( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ | | < | 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 | */ static int RectOvalToPostscript( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { Tcl_Obj *pathObj, *psObj; RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; double y1, y2; XColor *color; XColor *fillColor; Pixmap fillStipple; Tk_State state = itemPtr->state; Tcl_InterpState interpState; y1 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[1]); y2 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[3]); /* * Generate a string that creates a path for the rectangle or oval. This * is the only part of the function's code that is type-specific. |
︙ | ︙ | |||
1521 1522 1523 1524 1525 1526 1527 | Tcl_AppendObjToObj(psObj, pathObj); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, fillColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { | | | | | | 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 | Tcl_AppendObjToObj(psObj, pathObj); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, fillColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (color != NULL) { Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } /* * Now draw the outline, if there is one. */ if (color != NULL) { Tcl_AppendObjToObj(psObj, pathObj); Tcl_AppendToObj(psObj, "0 setlinejoin 2 setlinecap\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsOutline(canvas, itemPtr, &rectOvalPtr->outline); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } /* |
︙ | ︙ |
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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * 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" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The following table defines the legal values for the -orient option. It is * 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", |
︙ | ︙ | |||
160 161 162 163 164 165 166 | static void ComputeFormat(TkScale *scalePtr, int forTicks); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, int objc, Tcl_Obj *const objv[]); static void DestroyScale(void *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); | | | | | < < | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | static void ComputeFormat(TkScale *scalePtr, int forTicks); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, int objc, Tcl_Obj *const objv[]); static void DestroyScale(void *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); static void ScaleCmdDeletedProc(void *clientData); static void ScaleEventProc(void *clientData, XEvent *eventPtr); static char * ScaleVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static Tcl_ObjCmdProc ScaleWidgetObjCmd; static void ScaleWorldChanged(void *instanceData); static void ScaleSetVariable(TkScale *scalePtr); /* * The structure below defines scale class behavior by means of procedures * that can be invoked from generic window code. */ |
︙ | ︙ | |||
244 245 246 247 248 249 250 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_ScaleObjCmd( | | < | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_ScaleObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { TkScale *scalePtr; Tk_OptionTable optionTable; Tk_Window tkwin; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), |
︙ | ︙ | |||
377 378 379 380 381 382 383 | * See the user documentation. * *-------------------------------------------------------------- */ static int ScaleWidgetObjCmd( | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | * See the user documentation. * *-------------------------------------------------------------- */ static int ScaleWidgetObjCmd( void *clientData, /* Information about scale widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkScale *scalePtr = (TkScale *)clientData; Tcl_Obj *objPtr; int index, result; |
︙ | ︙ | |||
490 491 492 493 494 495 496 | goto error; } switch (TkpScaleElement(scalePtr, x, y)) { case TROUGH1: zone = "trough1"; break; case SLIDER: zone = "slider"; break; case TROUGH2: zone = "trough2"; break; } | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | goto error; } switch (TkpScaleElement(scalePtr, x, y)) { case TROUGH1: zone = "trough1"; break; case SLIDER: zone = "slider"; break; case TROUGH2: zone = "trough2"; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); break; } case COMMAND_SET: { double value; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "set value"); |
︙ | ︙ | |||
567 568 569 570 571 572 573 | } if (scalePtr->copyGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->copyGC); } if (scalePtr->textGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } | | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | } if (scalePtr->copyGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->copyGC); } if (scalePtr->textGC != NULL) { Tk_FreeGC(scalePtr->display, scalePtr->textGC); } Tk_FreeConfigOptions(scalePtr, scalePtr->optionTable, scalePtr->tkwin); scalePtr->tkwin = NULL; TkpDestroyScale(scalePtr); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
760 761 762 763 764 765 766 | * Scale will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void ScaleWorldChanged( | | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | * Scale will be relayed out and redisplayed. * *--------------------------------------------------------------------------- */ static void ScaleWorldChanged( void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc; TkScale *scalePtr = (TkScale *)instanceData; gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); |
︙ | ︙ | |||
980 981 982 983 984 985 986 | } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } if (forTicks) { if (fDigits <= eDigits) { | | | | | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } if (forTicks) { if (fDigits <= eDigits) { snprintf(scalePtr->tickFormat, sizeof(scalePtr->tickFormat), "%%.%df", afterDecimal); } else { snprintf(scalePtr->tickFormat, sizeof(scalePtr->tickFormat), "%%.%de", numDigits - 1); } } else { if (fDigits <= eDigits) { snprintf(scalePtr->valueFormat, sizeof(scalePtr->valueFormat), "%%.%df", afterDecimal); } else { snprintf(scalePtr->valueFormat, sizeof(scalePtr->valueFormat), "%%.%de", numDigits - 1); } } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1155 1156 1157 1158 1159 1160 1161 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ScaleEventProc( | | | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ScaleEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScale *scalePtr = (TkScale *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } else if (eventPtr->type == DestroyNotify) { |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ScaleCmdDeletedProc( | | | 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ScaleCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; /* * This procedure could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or |
︙ | ︙ | |||
1334 1335 1336 1337 1338 1339 1340 | * value of the scale. * *---------------------------------------------------------------------- */ static char * ScaleVarProc( | | | | < < | | | 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 | * value of the scale. * *---------------------------------------------------------------------- */ static char * ScaleVarProc( void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), /* Name of variable. */ TCL_UNUSED(const char *), /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkScale *scalePtr = (TkScale *)clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; /* * 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 |
︙ | ︙ | |||
1506 1507 1508 1509 1510 1511 1512 | if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, | | | 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, Tcl_NewStringObj(string, TCL_INDEX_NONE), TCL_GLOBAL_ONLY); scalePtr->flags &= ~SETTING_VAR; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
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 |
︙ | ︙ | |||
69 70 71 72 73 74 75 | * display any tick marks. */ double resolution; /* If > 0, all values are rounded to an even * multiple of this value. */ int digits; /* Number of significant digits to print in * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ | | | | | 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 | * display any tick marks. */ double resolution; /* If > 0, all values are rounded to an even * multiple of this value. */ int digits; /* Number of significant digits to print in * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ char valueFormat[16]; /* Snprintf conversion specifier computed from * digits and other information. */ char tickFormat[16]; /* Snprintf conversion specifier computed from * tick interval. */ double bigIncrement; /* Amount to use for large increments to scale * value. (0 means we pick a value). */ char *command; /* Command prefix to use when invoking Tcl * commands because the scale value changed. * NULL means don't invoke commands. */ int repeatDelay; /* How long to wait before auto-repeating on * scrolling actions (in ms). */ int repeatInterval; /* Interval between autorepeats (in ms). */ char *label; /* Label to display above or to right of * scale; NULL means don't display a label. */ Tcl_Size labelLength; /* Number of non-NULL chars. in label. */ enum state state; /* Values are active, normal, or disabled. * Value of scale cannot be changed when * disabled. */ /* * Information used when displaying widget: */ |
︙ | ︙ | |||
229 230 231 232 233 234 235 | */ MODULE_SCOPE void TkEventuallyRedrawScale(TkScale *scalePtr, int what); MODULE_SCOPE double TkRoundValueToResolution(TkScale *scalePtr, double value); MODULE_SCOPE double TkRoundIntervalToResolution(TkScale *scalePtr, double value); MODULE_SCOPE TkScale * TkpCreateScale(Tk_Window tkwin); MODULE_SCOPE void TkpDestroyScale(TkScale *scalePtr); | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | */ MODULE_SCOPE void TkEventuallyRedrawScale(TkScale *scalePtr, int what); MODULE_SCOPE double TkRoundValueToResolution(TkScale *scalePtr, double value); MODULE_SCOPE double TkRoundIntervalToResolution(TkScale *scalePtr, double value); MODULE_SCOPE TkScale * TkpCreateScale(Tk_Window tkwin); MODULE_SCOPE void TkpDestroyScale(TkScale *scalePtr); MODULE_SCOPE void TkpDisplayScale(void *clientData); MODULE_SCOPE int TkpScaleElement(TkScale *scalePtr, int x, int y); MODULE_SCOPE void TkScaleSetValue(TkScale *scalePtr, double value, int setVar, int invokeCommand); MODULE_SCOPE double TkScalePixelToValue(TkScale *scalePtr, int x, int y); MODULE_SCOPE int TkScaleValueToPixel(TkScale *scalePtr, double value); #endif /* _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" |
︙ | ︙ | |||
93 94 95 96 97 98 99 | }; /* * Forward declarations for functions defined later in this file: */ static int ConfigureScrollbar(Tcl_Interp *interp, | | | | < | | 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 | }; /* * Forward declarations for functions defined later in this file: */ static int ConfigureScrollbar(Tcl_Interp *interp, TkScrollbar *scrollPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); static void ScrollbarCmdDeletedProc(void *clientData); static Tcl_ObjCmdProc ScrollbarWidgetObjCmd; /* *-------------------------------------------------------------- * * Tk_ScrollbarObjCmd -- * * This function is invoked to process the "scrollbar" Tcl command. See * the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See the user documentation. * *-------------------------------------------------------------- */ int Tk_ScrollbarObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = (Tk_Window)clientData; TkScrollbar *scrollPtr; Tk_Window newWin; |
︙ | ︙ | |||
175 176 177 178 179 180 181 | scrollPtr->inset = 0; scrollPtr->elementBorderWidth = -1; scrollPtr->arrowLength = 0; scrollPtr->sliderFirst = 0; scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; | < < < < < < | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | scrollPtr->inset = 0; scrollPtr->elementBorderWidth = -1; scrollPtr->arrowLength = 0; scrollPtr->sliderFirst = 0; scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; if (ConfigureScrollbar(interp, scrollPtr, objc-2, objv+2, 0) != TCL_OK) { |
︙ | ︙ | |||
216 217 218 219 220 221 222 | * See the user documentation. * *-------------------------------------------------------------- */ static int ScrollbarWidgetObjCmd( | | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | * See the user documentation. * *-------------------------------------------------------------- */ static int ScrollbarWidgetObjCmd( void *clientData, /* Information about scrollbar widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; int result = TCL_OK, cmdIndex, length; Tcl_Size len; static const char *const commandNames[] = { "activate", "cget", "configure", "delta", "fraction", "get", "identify", "set", NULL }; enum command { COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET |
︙ | ︙ | |||
260 261 262 263 264 265 266 | const char *zone = ""; switch (scrollPtr->activeField) { case TOP_ARROW: zone = "arrow1"; break; case SLIDER: zone = "slider"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } | | | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | const char *zone = ""; switch (scrollPtr->activeField) { case TOP_ARROW: zone = "arrow1"; break; case SLIDER: zone = "slider"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); 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; |
︙ | ︙ | |||
289 290 291 292 293 294 295 | } case COMMAND_CGET: { if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } result = Tk_ConfigureValue(interp, scrollPtr->tkwin, | | | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | } case COMMAND_CGET: { if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } result = Tk_ConfigureValue(interp, scrollPtr->tkwin, configSpecs, scrollPtr, Tcl_GetString(objv[2]), 0); break; } case COMMAND_CONFIGURE: { if (objc == 2) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, configSpecs, scrollPtr, NULL, 0); } else if (objc == 3) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, configSpecs, scrollPtr, Tcl_GetString(objv[2]), 0); } else { result = ConfigureScrollbar(interp, scrollPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } break; } case COMMAND_DELTA: { |
︙ | ︙ | |||
375 376 377 378 379 380 381 | case COMMAND_GET: { Tcl_Obj *resObjs[4]; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } | < < < < < < < < < < | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | case COMMAND_GET: { Tcl_Obj *resObjs[4]; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction); resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction); Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs)); break; } case COMMAND_IDENTIFY: { int x, y; |
︙ | ︙ | |||
409 410 411 412 413 414 415 | switch (TkpScrollbarPosition(scrollPtr, x, y)) { case TOP_ARROW: zone = "arrow1"; break; case TOP_GAP: zone = "trough1"; break; case SLIDER: zone = "slider"; break; case BOTTOM_GAP: zone = "trough2"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | switch (TkpScrollbarPosition(scrollPtr, x, y)) { case TOP_ARROW: zone = "arrow1"; break; case TOP_GAP: zone = "trough1"; break; case SLIDER: zone = "slider"; break; case BOTTOM_GAP: zone = "trough2"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); break; } case COMMAND_SET: { if (objc == 4) { double first, last; if (Tcl_GetDoubleFromObj(interp, objv[2], &first) != TCL_OK) { |
︙ | ︙ | |||
436 437 438 439 440 441 442 | if (last < scrollPtr->firstFraction) { scrollPtr->lastFraction = scrollPtr->firstFraction; } else if (last > 1.0) { scrollPtr->lastFraction = 1.0; } else { scrollPtr->lastFraction = last; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | if (last < scrollPtr->firstFraction) { scrollPtr->lastFraction = scrollPtr->firstFraction; } else if (last > 1.0) { scrollPtr->lastFraction = 1.0; } else { scrollPtr->lastFraction = last; } } else { Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction"); goto error; } TkpComputeScrollbarGeometry(scrollPtr); TkScrollbarEventuallyRedraw(scrollPtr); break; |
︙ | ︙ | |||
523 524 525 526 527 528 529 | static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ | | | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc, objv, scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } /* * A few options need special processing, such as setting the background * from a 3-D border. */ |
︙ | ︙ | |||
580 581 582 583 584 585 586 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ void TkScrollbarEventProc( | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ void TkScrollbarEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); } else if (eventPtr->type == DestroyNotify) { |
︙ | ︙ | |||
602 603 604 605 606 607 608 | Tcl_CancelIdleCall(TkpDisplayScrollbar, scrollPtr); } /* * Free up all the stuff that requires special handling, then let * Tk_FreeOptions handle all the standard option-related stuff. */ | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | Tcl_CancelIdleCall(TkpDisplayScrollbar, scrollPtr); } /* * Free up all the stuff that requires special handling, then let * Tk_FreeOptions handle all the standard option-related stuff. */ Tk_FreeOptions(configSpecs, scrollPtr, scrollPtr->display, 0); Tcl_EventuallyFree(scrollPtr, TCL_DYNAMIC); } else if (eventPtr->type == ConfigureNotify) { TkpComputeScrollbarGeometry(scrollPtr); TkScrollbarEventuallyRedraw(scrollPtr); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { scrollPtr->flags |= GOT_FOCUS; |
︙ | ︙ | |||
646 647 648 649 650 651 652 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ScrollbarCmdDeletedProc( | | | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void ScrollbarCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->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 |
︙ | ︙ |
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 |
︙ | ︙ | |||
92 93 94 95 96 97 98 | * command. This information can now be provided in two ways: the "old" * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new" * form (firstFraction and lastFraction). FirstFraction and lastFraction * will always be valid, but the old-style information is only valid if * the OLD_STYLE_COMMANDS flag is 1. */ | < < < < < < < < < < < < < < < < | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | * command. This information can now be provided in two ways: the "old" * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new" * form (firstFraction and lastFraction). FirstFraction and lastFraction * will always be valid, but the old-style information is only valid if * the OLD_STYLE_COMMANDS flag is 1. */ double firstFraction; /* Position of first visible thing in window, * specified as a fraction between 0 and * 1.0. */ double lastFraction; /* Position of last visible thing in window, * specified as a fraction between 0 and * 1.0. */ |
︙ | ︙ | |||
153 154 155 156 157 158 159 | * ".t yview 40", instead of * ".t yview scroll 2 lines", for example. * GOT_FOCUS: Non-zero means this window has the input * focus. */ #define REDRAW_PENDING 1 | < < < | | | 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 | * ".t yview 40", instead of * ".t yview scroll 2 lines", for example. * GOT_FOCUS: Non-zero means this window has the input * focus. */ #define REDRAW_PENDING 1 #define GOT_FOCUS 4 /* * Declaration of scrollbar class functions structure * and default scrollbar width, for use in configSpec. */ MODULE_SCOPE const Tk_ClassProcs tkpScrollbarProcs; MODULE_SCOPE char tkDefScrollbarWidth[TCL_INTEGER_SPACE]; /* * Declaration of functions used in the implementation of the scrollbar * widget. */ MODULE_SCOPE void TkScrollbarEventProc(void *clientData, XEvent *eventPtr); MODULE_SCOPE void TkScrollbarEventuallyRedraw(TkScrollbar *scrollPtr); MODULE_SCOPE void TkpComputeScrollbarGeometry(TkScrollbar *scrollPtr); MODULE_SCOPE TkScrollbar *TkpCreateScrollbar(Tk_Window tkwin); MODULE_SCOPE void TkpDestroyScrollbar(TkScrollbar *scrollPtr); MODULE_SCOPE void TkpDisplayScrollbar(void *clientData); MODULE_SCOPE void TkpConfigureScrollbar(TkScrollbar *scrollPtr); MODULE_SCOPE int TkpScrollbarPosition(TkScrollbar *scrollPtr, int x, int y); #endif /* _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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * When a selection handler is set up by invoking "selection handle", one of * the following data structures is set up to hold information about the * command to invoke and its interpreter. */ typedef struct { Tcl_Interp *interp; /* Interpreter in which to invoke command. */ Tcl_Size cmdLength; /* # of non-NULL bytes in command. */ Tcl_Size charOffset; /* The offset of the next char to retrieve. */ Tcl_Size byteOffset; /* The expected byte offset of the next * chunk. */ char buffer[4]; /* A buffer to hold part of a UTF character * that is split across chunks. */ char command[TKFLEXARRAY]; /* Command to invoke. Actual space is * allocated as large as necessary. This must * be the last entry in the structure. */ } CommandInfo; |
︙ | ︙ | |||
55 56 57 58 59 60 61 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations for functions defined in this file: */ | | | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations for functions defined in this file: */ static Tcl_Size HandleTclCommand(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static void LostSelection(void *clientData); static int SelGetProc(void *clientData, Tcl_Interp *interp, const char *portion); /* *-------------------------------------------------------------- * * Tk_CreateSelHandler -- * |
︙ | ︙ | |||
84 85 86 87 88 89 90 | * invoked to provide part or all of the selection in the given form. If * there was already a handler declared for the given window, target and * selection type, then it is replaced. Proc should have the following * form: * * int * proc( | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | * invoked to provide part or all of the selection in the given form. If * there was already a handler declared for the given window, target and * selection type, then it is replaced. Proc should have the following * form: * * int * proc( * void *clientData, * int offset, * char *buffer, * int maxBytes) * { * } * * The clientData argument to proc will be the same as the clientData |
︙ | ︙ | |||
114 115 116 117 118 119 120 | Tk_Window tkwin, /* Token for window. */ Atom selection, /* Selection to be handled. */ Atom target, /* The kind of selection conversions that can * be handled by proc, e.g. TARGETS or * STRING. */ Tk_SelectionProc *proc, /* Function to invoke to convert selection to * type "target". */ | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | Tk_Window tkwin, /* Token for window. */ Atom selection, /* Selection to be handled. */ Atom target, /* The kind of selection conversions that can * be handled by proc, e.g. TARGETS or * STRING. */ Tk_SelectionProc *proc, /* Function to invoke to convert selection to * type "target". */ void *clientData, /* Value to pass to proc. */ Atom format) /* Format in which the selection information * should be returned to the requestor. * XA_STRING is best by far, but anything * listed in the ICCCM will be tolerated * (blech). */ { TkSelHandler *selPtr; |
︙ | ︙ | |||
346 347 348 349 350 351 352 | void Tk_OwnSelection( Tk_Window tkwin, /* Window to become new selection owner. */ Atom selection, /* Selection that window should own. */ Tk_LostSelProc *proc, /* Function to call when selection is taken * away from tkwin. */ | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | void Tk_OwnSelection( Tk_Window tkwin, /* Window to become new selection owner. */ Atom selection, /* Selection that window should own. */ Tk_LostSelProc *proc, /* Function to call when selection is taken * away from tkwin. */ void *clientData) /* Arbitrary one-word argument to pass to * proc. */ { TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; void *clearData = NULL;/* Initialization needed only to prevent |
︙ | ︙ | |||
516 517 518 519 520 521 522 | * The standard X11 protocols are used to retrieve the selection. When it * arrives, it is passed to proc. If the selection is very large, it will * be passed to proc in several pieces. Proc should have the following * structure: * * int * proc( | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | * The standard X11 protocols are used to retrieve the selection. When it * arrives, it is passed to proc. If the selection is very large, it will * be passed to proc in several pieces. Proc should have the following * structure: * * int * proc( * void *clientData, * Tcl_Interp *interp, * char *portion) * { * } * * The interp and clientData arguments to proc will be the same as the * corresponding arguments to Tk_GetSelection. The portion argument |
︙ | ︙ | |||
547 548 549 550 551 552 553 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Function to call to process the selection, * once it has been retrieved. */ | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Function to call to process the selection, * once it has been retrieved. */ void *clientData) /* Arbitrary value to pass to proc. */ { TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
574 575 576 577 578 579 580 | infoPtr = infoPtr->nextPtr) { if (infoPtr->selection == selection) { break; } } if (infoPtr != NULL) { TkSelHandler *selPtr; | > | < < < > > | 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 | infoPtr = infoPtr->nextPtr) { if (infoPtr->selection == selection) { break; } } if (infoPtr != NULL) { TkSelHandler *selPtr; Tcl_Size offset, count; int result; char buffer[TK_SEL_BYTES_AT_ONCE+1]; TkSelInProgress ip; for (selPtr = ((TkWindow *) infoPtr->owner)->selHandlerList; selPtr != NULL; selPtr = selPtr->nextPtr) { if (selPtr->target==target && selPtr->selection==selection) { break; } } if (selPtr == NULL) { Atom type; count = TkSelDefaultSelection(infoPtr, target, buffer, TK_SEL_BYTES_AT_ONCE, &type); if (count < 0) { goto cantget; } else if (count > TK_SEL_BYTES_AT_ONCE) { Tcl_Panic("selection handler returned too many bytes"); } buffer[count] = 0; result = proc(clientData, interp, buffer); } else { offset = 0; result = TCL_OK; ip.selPtr = selPtr; |
︙ | ︙ | |||
660 661 662 663 664 665 666 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SelectionObjCmd( | | | | 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 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SelectionObjCmd( 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; const char *path = NULL; Atom selection; const char *selName = NULL; const char *string; int count, index; Tcl_Obj *const *objs; static const char *const optionStrings[] = { "clear", "get", "handle", "own", NULL }; enum options { SELECTION_CLEAR, SELECTION_GET, SELECTION_HANDLE, SELECTION_OWN }; |
︙ | ︙ | |||
698 699 700 701 702 703 704 | case SELECTION_CLEAR: { static const char *const clearOptionStrings[] = { "-displayof", "-selection", NULL }; enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION }; int clearIndex; | | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | case SELECTION_CLEAR: { static const char *const clearOptionStrings[] = { "-displayof", "-selection", NULL }; enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION }; int clearIndex; for (count = objc-2, objs = objv+2; count > 0; count-=2, objs+=2) { string = Tcl_GetString(objs[0]); if (string[0] != '-') { break; } if (count < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
827 828 829 830 831 832 833 | } case SELECTION_HANDLE: { Atom target, format; const char *targetName = NULL; const char *formatName = NULL; CommandInfo *cmdInfoPtr; | | | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | } case SELECTION_HANDLE: { Atom target, format; const char *targetName = NULL; const char *formatName = NULL; CommandInfo *cmdInfoPtr; Tcl_Size cmdLength; static const char *const handleOptionStrings[] = { "-format", "-selection", "-type", NULL }; enum handleOptions { HANDLE_FORMAT, HANDLE_SELECTION, HANDLE_TYPE }; int handleIndex; |
︙ | ︙ | |||
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; } | | | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | 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: | | | 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | 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 |
︙ | ︙ | |||
1283 1284 1285 1286 1287 1288 1289 | * argument. * *-------------------------------------------------------------- */ static int SelGetProc( | | | | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 | * argument. * *-------------------------------------------------------------- */ static int SelGetProc( void *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_DStringAppend((Tcl_DString *)clientData, portion, TCL_INDEX_NONE); return TCL_OK; } /* *---------------------------------------------------------------------- * * HandleTclCommand -- |
︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 | * * Side effects: * None except for things done by the Tcl command. * *---------------------------------------------------------------------- */ | | | | | | > | | | | | | | | | | 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 | * * Side effects: * None except for things done by the Tcl command. * *---------------------------------------------------------------------- */ static Tcl_Size HandleTclCommand( void *clientData, /* Information about command to execute. */ Tcl_Size offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ Tcl_Size maxBytes) /* Maximum # of bytes to store at buffer. */ { CommandInfo *cmdInfoPtr = (CommandInfo *)clientData; Tcl_Size length; Tcl_Obj *command; const char *string; Tcl_Interp *interp = cmdInfoPtr->interp; Tcl_InterpState savedState; int code; Tcl_Size extraBytes, charOffset, numChars, count; const char *p; /* * We must also protect the interpreter and the command from being deleted * too soon. */ Tcl_Preserve(clientData); Tcl_Preserve(interp); /* * Compute the proper byte offset in the case where the last chunk split a * character. */ if (offset == cmdInfoPtr->byteOffset) { charOffset = cmdInfoPtr->charOffset; extraBytes = strlen(cmdInfoPtr->buffer); if (extraBytes > 0) { strcpy(buffer, cmdInfoPtr->buffer); maxBytes -= extraBytes; buffer += extraBytes; } } else { cmdInfoPtr->byteOffset = 0; cmdInfoPtr->charOffset = 0; extraBytes = 0; charOffset = 0; } /* * First, generate a command by taking the command string and appending * the offset and maximum # of bytes. */ command = Tcl_ObjPrintf("%s %" TCL_SIZE_MODIFIER "d %" TCL_SIZE_MODIFIER "d", cmdInfoPtr->command, charOffset, maxBytes); Tcl_IncrRefCount(command); /* * Execute the command. Be sure to restore the state of the interpreter * after executing the command. */ savedState = Tcl_SaveInterpState(interp, TCL_OK); code = Tcl_EvalObjEx(interp, command, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(command); if (code == TCL_OK) { /* * TODO: This assumes that bytes are characters; that's not true! */ string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length); count = (length > maxBytes) ? maxBytes : length; memcpy(buffer, string, count); buffer[count] = '\0'; /* * Update the partial character information for the next retrieval if * the command has not been deleted. */ if (cmdInfoPtr->interp != NULL) { if (length <= maxBytes) { cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, TCL_INDEX_NONE); 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); } |
︙ | ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | * drop everything else. */ if (code == TCL_ERROR) { Tcl_AddErrorInfo(interp, "\n (command handling selection)"); Tcl_BackgroundException(interp, code); } | | | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | * drop everything else. */ if (code == TCL_ERROR) { Tcl_AddErrorInfo(interp, "\n (command handling selection)"); Tcl_BackgroundException(interp, code); } count = TCL_INDEX_NONE; } (void) Tcl_RestoreInterpState(interp, savedState); Tcl_Release(clientData); Tcl_Release(interp); return count; } |
︙ | ︙ | |||
1448 1449 1450 1451 1452 1453 1454 | * Results: * If "target" is a standard target understood by this function, the * selection is converted to that form and stored as a character string * in buffer. The type of the selection (e.g. STRING or ATOM) is stored * in *typePtr, and the return value is a count of the # of non-NULL * bytes at buffer. If the target wasn't understood, or if there isn't * enough space at buffer to hold the entire selection (no INCR-mode | | | | | | | | | | | | | | | | 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 | * Results: * If "target" is a standard target understood by this function, the * selection is converted to that form and stored as a character string * in buffer. The type of the selection (e.g. STRING or ATOM) is stored * in *typePtr, and the return value is a count of the # of non-NULL * bytes at buffer. If the target wasn't understood, or if there isn't * enough space at buffer to hold the entire selection (no INCR-mode * transfers for this stuff!), then TCL_INDEX_NONE is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Size TkSelDefaultSelection( TkSelectionInfo *infoPtr, /* Info about selection being retrieved. */ Atom target, /* Desired form of selection. */ char *buffer, /* Place to put selection characters. */ Tcl_Size maxBytes, /* Maximum # of bytes to store at buffer. */ Atom *typePtr) /* Store here the type of the selection, for * use in converting to proper X format. */ { TkWindow *winPtr = (TkWindow *) infoPtr->owner; TkDisplay *dispPtr = winPtr->dispPtr; if (target == dispPtr->timestampAtom) { if (maxBytes < 20) { return TCL_INDEX_NONE; } snprintf(buffer, maxBytes, "0x%x", (unsigned int) infoPtr->time); *typePtr = XA_INTEGER; return strlen(buffer); } if (target == dispPtr->targetsAtom) { TkSelHandler *selPtr; Tcl_Size length; Tcl_DString ds; if (maxBytes < 50) { return TCL_INDEX_NONE; } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW", TCL_INDEX_NONE); for (selPtr = winPtr->selHandlerList; selPtr != NULL; selPtr = selPtr->nextPtr) { if ((selPtr->selection == infoPtr->selection) && (selPtr->target != dispPtr->applicationAtom) && (selPtr->target != dispPtr->windowAtom)) { const char *atomString = Tk_GetAtomName((Tk_Window) winPtr, selPtr->target); Tcl_DStringAppendElement(&ds, atomString); } } length = Tcl_DStringLength(&ds); if (length >= maxBytes) { Tcl_DStringFree(&ds); return TCL_INDEX_NONE; } memcpy(buffer, Tcl_DStringValue(&ds), length + 1); Tcl_DStringFree(&ds); *typePtr = XA_ATOM; return length; } if (target == dispPtr->applicationAtom) { Tcl_Size length; Tk_Uid name = winPtr->mainPtr->winPtr->nameUid; length = strlen(name); if (maxBytes <= length) { return TCL_INDEX_NONE; } strcpy(buffer, name); *typePtr = XA_STRING; return length; } if (target == dispPtr->windowAtom) { Tcl_Size length; char *name = winPtr->pathName; length = strlen(name); if (maxBytes <= length) { return TCL_INDEX_NONE; } strcpy(buffer, name); *typePtr = XA_STRING; return length; } return TCL_INDEX_NONE; } /* *---------------------------------------------------------------------- * * LostSelection -- * |
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 | * A Tcl script is executed; it can do almost anything. * *---------------------------------------------------------------------- */ static void LostSelection( | | | 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 | * A Tcl script is executed; it can do almost anything. * *---------------------------------------------------------------------- */ static void LostSelection( void *clientData) /* Pointer to LostCommand structure. */ { LostCommand *lostPtr = (LostCommand *)clientData; Tcl_Interp *interp = lostPtr->interp; Tcl_InterpState savedState; int code; Tcl_Preserve(interp); |
︙ | ︙ |
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 |
︙ | ︙ | |||
53 54 55 56 57 58 59 | Atom target; /* Target type for selection conversion, such * as TARGETS or STRING. */ Atom format; /* Format in which selection info will be * returned, such as STRING or ATOM. */ Tk_SelectionProc *proc; /* Procedure to generate selection in this * format. */ void *clientData; /* Argument to pass to proc. */ | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | Atom target; /* Target type for selection conversion, such * as TARGETS or STRING. */ Atom format; /* Format in which selection info will be * returned, such as STRING or ATOM. */ Tk_SelectionProc *proc; /* Procedure to generate selection in this * format. */ void *clientData; /* Argument to pass to proc. */ Tcl_Size size; /* Size of units returned by proc (8 for * STRING, 32 for almost anything else). */ struct TkSelHandler *nextPtr; /* Next selection handler associated with same * window (NULL for end of list). */ } TkSelHandler; /* |
︙ | ︙ | |||
77 78 79 80 81 82 83 | Tcl_Interp *interp; /* Interpreter for error reporting. */ TkWindow *winPtr; /* Window used as requestor for selection. */ Atom selection; /* Selection being requested. */ Atom property; /* Property where selection will appear. */ Atom target; /* Desired form for selection. */ Tk_GetSelProc *proc; /* Procedure to call to handle pieces of * selection. */ | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | Tcl_Interp *interp; /* Interpreter for error reporting. */ TkWindow *winPtr; /* Window used as requestor for selection. */ Atom selection; /* Selection being requested. */ Atom property; /* Property where selection will appear. */ Atom target; /* Desired form for selection. */ Tk_GetSelProc *proc; /* Procedure to call to handle pieces of * selection. */ void *clientData; /* Argument for proc. */ int result; /* Initially -1. Set to a Tcl return value * once the selection has been retrieved. */ Tcl_TimerToken timeout; /* Token for current timeout procedure. */ int idleTime; /* Number of seconds that have gone by without * hearing anything from the selection * owner. */ Tcl_EncodingState encState; /* Holds intermediate state during translations |
︙ | ︙ | |||
103 104 105 106 107 108 109 | * CLIPBOARD selection is retrieved. All buffers of a given type on the same * clipboard must have the same format. The TkClipboardTarget structure is * used to record the information about a chain of buffers of the same type. */ typedef struct TkClipboardBuffer { char *buffer; /* Null terminated data buffer. */ | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | * CLIPBOARD selection is retrieved. All buffers of a given type on the same * clipboard must have the same format. The TkClipboardTarget structure is * used to record the information about a chain of buffers of the same type. */ typedef struct TkClipboardBuffer { char *buffer; /* Null terminated data buffer. */ Tcl_Size length; /* Length of string in buffer. */ struct TkClipboardBuffer *nextPtr; /* Next in list of buffers. NULL means end of * list . */ } TkClipboardBuffer; typedef struct TkClipboardTarget { Atom type; /* Type conversion supported. */ |
︙ | ︙ | |||
156 157 158 159 160 161 162 | * Declarations for procedures that are used by the selection-related files * but shouldn't be used anywhere else in Tk (or by Tk clients): */ MODULE_SCOPE TkSelInProgress *TkSelGetInProgress(void); MODULE_SCOPE void TkSelSetInProgress(TkSelInProgress *pendingPtr); MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent *eventPtr); | | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | * Declarations for procedures that are used by the selection-related files * but shouldn't be used anywhere else in Tk (or by Tk clients): */ MODULE_SCOPE TkSelInProgress *TkSelGetInProgress(void); MODULE_SCOPE void TkSelSetInProgress(TkSelInProgress *pendingPtr); MODULE_SCOPE void TkSelClearSelection(Tk_Window tkwin, XEvent *eventPtr); MODULE_SCOPE Tcl_Size TkSelDefaultSelection(TkSelectionInfo *infoPtr, Atom target, char *buffer, Tcl_Size maxBytes, Atom *typePtr); #ifndef TkSelUpdateClipboard MODULE_SCOPE void TkSelUpdateClipboard(TkWindow *winPtr, TkClipboardTarget *targetPtr); #endif #endif /* _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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * 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 #endif #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #ifndef USE_TK_STUBS # define USE_TK_STUBS #endif #include "tkInt.h" #include <stdbool.h> /* * A data structure of the following type is kept for each square widget * managed by this file: */ typedef struct { |
︙ | ︙ | |||
49 50 51 52 53 54 55 | Tcl_Obj *borderWidthPtr; /* Width of 3-D border around whole widget. */ Tcl_Obj *bgBorderPtr; Tcl_Obj *fgBorderPtr; Tcl_Obj *reliefPtr; GC gc; /* Graphics context for copying from * off-screen pixmap onto screen. */ | | | | | | < | | | < | < | 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 | Tcl_Obj *borderWidthPtr; /* Width of 3-D border around whole widget. */ Tcl_Obj *bgBorderPtr; Tcl_Obj *fgBorderPtr; Tcl_Obj *reliefPtr; GC gc; /* Graphics context for copying from * off-screen pixmap onto screen. */ bool doubleBuffer; /* true means double-buffer redisplay with * pixmap; false means draw straight onto the * display. */ bool updatePending; /* true means a call to SquareDisplay has * already been scheduled. */ } Square; /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", "#d9d9d9", offsetof(Square, bgBorderPtr), TCL_INDEX_NONE, 0, "white", 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", "2", offsetof(Square, borderWidthPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer", "1", TCL_INDEX_NONE, offsetof(Square, doubleBuffer), TK_OPTION_VAR(bool) , NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-foreground", 0}, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", "#b03060", offsetof(Square, fgBorderPtr), TCL_INDEX_NONE, 0, "black", 0}, {TK_OPTION_PIXELS, "-posx", "posx", "PosX", "0", offsetof(Square, xPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_PIXELS, "-posy", "posy", "PosY", "0", offsetof(Square, yPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", offsetof(Square, reliefPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_PIXELS, "-size", "size", "Size", "20", offsetof(Square, sizeObjPtr), TCL_INDEX_NONE, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; /* * Forward declarations for procedures defined later in this file: */ static void SquareDeletedProc(void *clientData); static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr); static void SquareDisplay(void *clientData); static void KeepInWindow(Square *squarePtr); static void SquareObjEventProc(void *clientData, XEvent *eventPtr); static Tcl_ObjCmdProc SquareWidgetObjCmd; /* *-------------------------------------------------------------- * * SquareCmd -- * * This procedure is invoked to process the "square" Tcl command. It * creates a new "square" widget. * * Results: * A standard Tcl result. * * Side effects: * A new widget is created and configured. * *-------------------------------------------------------------- */ int SquareObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Square *squarePtr; Tk_Window tkwin; Tk_OptionTable optionTable; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), |
︙ | ︙ | |||
187 188 189 190 191 192 193 | goto error; } if (SquareConfigure(interp, squarePtr) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | goto error; } if (SquareConfigure(interp, squarePtr) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(squarePtr->tkwin), TCL_INDEX_NONE)); return TCL_OK; error: Tk_DestroyWindow(squarePtr->tkwin); return TCL_ERROR; } |
︙ | ︙ | |||
215 216 217 218 219 220 221 | * See the user documentation. * *-------------------------------------------------------------- */ static int SquareWidgetObjCmd( | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | * See the user documentation. * *-------------------------------------------------------------- */ static int SquareWidgetObjCmd( void *clientData, /* Information about square widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { Square *squarePtr = (Square *)clientData; int result = TCL_OK; static const char *const squareOptions[] = {"cget", "configure", NULL}; |
︙ | ︙ | |||
278 279 280 281 282 283 284 | squarePtr->optionTable, objc - 2, objv + 2, squarePtr->tkwin, NULL, NULL); if (result == TCL_OK) { result = SquareConfigure(interp, squarePtr); } if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | squarePtr->optionTable, objc - 2, objv + 2, squarePtr->tkwin, NULL, NULL); if (result == TCL_OK) { result = SquareConfigure(interp, squarePtr); } if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = true; } } if (resultObjPtr != NULL) { Tcl_SetObjResult(interp, resultObjPtr); } } Tcl_Release(squarePtr); |
︙ | ︙ | |||
315 316 317 318 319 320 321 | * for squarePtr; old resources get freed, if there were any. * *---------------------------------------------------------------------- */ static int SquareConfigure( | | < < < | | | 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 | * for squarePtr; old resources get freed, if there were any. * *---------------------------------------------------------------------- */ static int SquareConfigure( TCL_UNUSED(Tcl_Interp *), /* Used for error reporting. */ Square *squarePtr) /* Information about widget. */ { int borderWidth; Tk_3DBorder bgBorder; /* * Set the background for the window and create a graphics context for use * during redisplay. */ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin, squarePtr->bgBorderPtr); Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); if ((squarePtr->gc == NULL) && squarePtr->doubleBuffer) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; squarePtr->gc = Tk_GetGC(squarePtr->tkwin, GCFunction|GCGraphicsExposures, &gcValues); } /* * Register the desired geometry for the window. Then arrange for the * window to be redisplayed. */ Tk_GeometryRequest(squarePtr->tkwin, 200, 150); Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr, &borderWidth); Tk_SetInternalBorder(squarePtr->tkwin, borderWidth); if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = true; } KeepInWindow(squarePtr); return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
378 379 380 381 382 383 384 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void SquareObjEventProc( | | | | | | | 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 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void SquareObjEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Square *squarePtr = (Square *)clientData; if (eventPtr->type == Expose) { if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = true; } } else if (eventPtr->type == ConfigureNotify) { KeepInWindow(squarePtr); if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = true; } } else if (eventPtr->type == DestroyNotify) { if (squarePtr->tkwin != NULL) { Tk_FreeConfigOptions(squarePtr, squarePtr->optionTable, squarePtr->tkwin); if (squarePtr->gc != NULL) { Tk_FreeGC(squarePtr->display, squarePtr->gc); } squarePtr->tkwin = NULL; Tcl_DeleteCommandFromToken(squarePtr->interp, squarePtr->widgetCmd); } if (squarePtr->updatePending) { Tcl_CancelIdleCall(SquareDisplay, squarePtr); } Tcl_EventuallyFree(squarePtr, TCL_DYNAMIC); } } /* *---------------------------------------------------------------------- * * SquareDeletedProc -- |
︙ | ︙ | |||
432 433 434 435 436 437 438 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void SquareDeletedProc( | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void SquareDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; /* * This procedure could be invoked either because the window was destroyed * and the command was then deleted (in which case tkwin is NULL) or |
︙ | ︙ | |||
469 470 471 472 473 474 475 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void SquareDisplay( | | < | < | | 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 | * Information appears on the screen. * *-------------------------------------------------------------- */ static void SquareDisplay( void *clientData) /* Information about window. */ { Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; Pixmap pm = None; Drawable d; int borderWidth, size, relief; Tk_3DBorder bgBorder, fgBorder; squarePtr->updatePending = false; if (!Tk_IsMapped(tkwin)) { return; } /* * Create a pixmap for double-buffering, if necessary. */ if (squarePtr->doubleBuffer) { pm = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), DefaultDepthOfScreen(Tk_Screen(tkwin))); d = pm; } else { d = Tk_WindowId(tkwin); } |
︙ | ︙ | |||
524 525 526 527 528 529 530 | Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size, size, borderWidth, TK_RELIEF_RAISED); /* * If double-buffered, copy to the screen and release the pixmap. */ | | < < < < < < < < < < < < < < < < < < < < < < < < < < < | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size, size, borderWidth, TK_RELIEF_RAISED); /* * If double-buffered, copy to the screen and release the pixmap. */ if (squarePtr->doubleBuffer) { XCopyArea(Tk_Display(tkwin), pm, Tk_WindowId(tkwin), squarePtr->gc, 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(Tk_Display(tkwin), pm); } } /* *---------------------------------------------------------------------- * * KeepInWindow -- * * Adjust the position of the square if necessary to keep it in the |
︙ | ︙ |
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 35 36 37 38 39 | #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; /* * Remove macro that might interfere with the definition below. */ | > > < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | < | | > > > | 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 | #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; /* * Remove macro that might interfere with the definition below. */ #undef TkPutImage #undef XPutImage #if !defined(MAC_OSX_TK) static int doNothing(void) { /* dummy implementation, no need to do anything */ return 0; } # undef TkpWillDrawWidget # undef TkpRedrawWidget # undef TkpDefineNativeBitmaps # undef TkpCreateNativeBitmap # undef TkpGetNativeAppBitmap # define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing) # define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing) # define TkpDefineNativeBitmaps ((void (*)(void))(void *)doNothing) # define TkpCreateNativeBitmap ((Pixmap (*)(Display *, const void *))(void *)doNothing) # define TkpGetNativeAppBitmap ((Pixmap (*)(Display *, const char*, int *, int *))(void *)doNothing) #endif #ifdef _WIN32 int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { |
︙ | ︙ | |||
180 181 182 183 184 185 186 | void TkpPrintWindowId( char *buf, /* Pointer to string large enough to hold * the hex representation of a pointer. */ Window window) /* Window to be printed into buffer. */ { | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | void TkpPrintWindowId( char *buf, /* Pointer to string large enough to hold * the hex representation of a pointer. */ Window window) /* Window to be printed into buffer. */ { snprintf(buf, TCL_INTEGER_SPACE, "0x%" TCL_Z_MODIFIER "x", (size_t)window); } int TkPutImage( unsigned long *colors, /* Array of pixel values used by this image. * May be NULL. */ int ncolors, /* Number of colors used, or 0. */ |
︙ | ︙ | |||
345 346 347 348 349 350 351 | TkOvalToArea, /* 53 */ TkOvalToPoint, /* 54 */ TkpChangeFocus, /* 55 */ TkpCloseDisplay, /* 56 */ TkpClaimFocus, /* 57 */ TkpDisplayWarning, /* 58 */ TkpGetAppName, /* 59 */ | | | | | | | | 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 | TkOvalToArea, /* 53 */ TkOvalToPoint, /* 54 */ TkpChangeFocus, /* 55 */ TkpCloseDisplay, /* 56 */ TkpClaimFocus, /* 57 */ TkpDisplayWarning, /* 58 */ TkpGetAppName, /* 59 */ 0, /* 60 */ TkpGetWrapperWindow, /* 61 */ TkpInit, /* 62 */ TkpInitializeMenuBindings, /* 63 */ 0, /* 64 */ TkpMakeMenuWindow, /* 65 */ 0, /* 66 */ TkpMenuNotifyToplevelCreate, /* 67 */ TkpOpenDisplay, /* 68 */ TkPointerEvent, /* 69 */ TkPolygonToArea, /* 70 */ TkPolygonToPoint, /* 71 */ TkPositionInTree, /* 72 */ TkpRedirectKeyEvent, /* 73 */ 0, /* 74 */ 0, /* 75 */ 0, /* 76 */ TkQueueEventForAllChildren, /* 77 */ TkReadBitmapFile, /* 78 */ TkScrollWindow, /* 79 */ TkSelDeadWindow, /* 80 */ TkSelEventProc, /* 81 */ TkSelInit, /* 82 */ TkSelPropProc, /* 83 */ 0, /* 84 */ 0, /* 85 */ TkStringToKeysym, /* 86 */ TkThickPolyLineToArea, /* 87 */ TkWmAddToColormapWindows, /* 88 */ TkWmDeadWindow, /* 89 */ TkWmFocusToplevel, /* 90 */ TkWmMapWindow, /* 91 */ TkWmNewWindow, /* 92 */ |
︙ | ︙ | |||
396 397 398 399 400 401 402 | TkFindStateNumObj, /* 104 */ TkGetBitmapPredefTable, /* 105 */ TkGetDisplayList, /* 106 */ TkGetMainInfoList, /* 107 */ TkGetWindowFromObj, /* 108 */ TkpGetString, /* 109 */ TkpGetSubFonts, /* 110 */ | | < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 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 | TkFindStateNumObj, /* 104 */ TkGetBitmapPredefTable, /* 105 */ TkGetDisplayList, /* 106 */ TkGetMainInfoList, /* 107 */ TkGetWindowFromObj, /* 108 */ TkpGetString, /* 109 */ TkpGetSubFonts, /* 110 */ 0, /* 111 */ TkpMenuThreadInit, /* 112 */ XClipBox, /* 113 */ XCreateRegion, /* 114 */ XDestroyRegion, /* 115 */ XIntersectRegion, /* 116 */ XRectInRegion, /* 117 */ XSetRegion, /* 118 */ XUnionRectWithRegion, /* 119 */ 0, /* 120 */ TkpCreateNativeBitmap, /* 121 */ TkpDefineNativeBitmaps, /* 122 */ 0, /* 123 */ TkpGetNativeAppBitmap, /* 124 */ 0, /* 125 */ 0, /* 126 */ 0, /* 127 */ 0, /* 128 */ 0, /* 129 */ 0, /* 130 */ 0, /* 131 */ 0, /* 132 */ 0, /* 133 */ 0, /* 134 */ 0, /* 135 */ TkSetFocusWin, /* 136 */ TkpSetKeycodeAndState, /* 137 */ TkpGetKeySym, /* 138 */ TkpInitKeymapInfo, /* 139 */ TkPhotoGetValidRegion, /* 140 */ TkWmStackorderToplevel, /* 141 */ TkFocusFree, /* 142 */ |
︙ | ︙ | |||
497 498 499 500 501 502 503 | TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ TkDrawAngledTextLayout, /* 181 */ TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ | < < < < < < < < < < < < < < < < | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | 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 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ TkpGetMS, /* 3 */ TkPointerDeadWindow, /* 4 */ TkpPrintWindowId, /* 5 */ TkpScanWindowId, /* 6 */ TkpSetCapture, /* 7 */ |
︙ | ︙ | |||
555 556 557 558 559 560 561 | TkWinSetWindowPos, /* 26 */ TkWinWmCleanup, /* 27 */ TkWinXCleanup, /* 28 */ TkWinXInit, /* 29 */ TkWinSetForegroundWindow, /* 30 */ TkWinDialogDebug, /* 31 */ TkWinGetMenuSystemDefault, /* 32 */ | | | | | | > | < > | < | | | | 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 | TkWinSetWindowPos, /* 26 */ TkWinWmCleanup, /* 27 */ TkWinXCleanup, /* 28 */ TkWinXInit, /* 29 */ TkWinSetForegroundWindow, /* 30 */ TkWinDialogDebug, /* 31 */ TkWinGetMenuSystemDefault, /* 32 */ TkAlignImageData, /* 33 */ TkWinSetHINSTANCE, /* 34 */ TkWinGetPlatformTheme, /* 35 */ TkWinChildProc, /* 36 */ 0, /* 37 */ TkpCmapStressed, /* 38 */ TkpSync, /* 39 */ TkUnixContainerId, /* 40 */ TkUnixDoOneXEvent, /* 41 */ TkUnixSetMenubar, /* 42 */ TkWmCleanup, /* 43 */ TkSendCleanup, /* 44 */ TkpTestsendCmd, /* 45 */ 0, /* 46 */ TkpGetCapture, /* 47 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ 0, /* 0 */ TkAboutDlg, /* 1 */ TkGenerateActivateEvents, /* 2 */ TkpGetMS, /* 3 */ TkPointerDeadWindow, /* 4 */ TkpSetCursor, /* 5 */ TkpScanWindowId, /* 6 */ TkpWmSetState, /* 7 */ TkMacOSXButtonKeyState, /* 8 */ TkMacOSXClearMenubarActive, /* 9 */ TkMacOSXDispatchMenuEvent, /* 10 */ TkpSetCapture, /* 11 */ TkMacOSXHandleTearoffMenu, /* 12 */ 0, /* 13 */ TkMacOSXDoHLEvent, /* 14 */ 0, /* 15 */ TkMacOSXGetXWindow, /* 16 */ TkMacOSXGrowToplevel, /* 17 */ TkMacOSXHandleMenuSelect, /* 18 */ 0, /* 19 */ 0, /* 20 */ TkMacOSXInvalidateWindow, /* 21 */ 0, /* 22 */ TkMacOSXMakeRealWindowExist, /* 23 */ TkMacOSXMakeStippleMap, /* 24 */ TkMacOSXMenuClick, /* 25 */ 0, /* 26 */ TkMacOSXResizable, /* 27 */ TkMacOSXSetHelpMenuItemCount, /* 28 */ TkMacOSXSetScrollbarGrow, /* 29 */ 0, /* 30 */ TkMacOSXSetUpGraphicsPort, /* 31 */ TkMacOSXUpdateClipRgn, /* 32 */ 0, /* 33 */ TkMacOSXUseMenuID, /* 34 */ TkMacOSXVisableClipRgn, /* 35 */ TkMacOSXWinBounds, /* 36 */ TkMacOSXWindowOffset, /* 37 */ |
︙ | ︙ | |||
625 626 627 628 629 630 631 | TkpIsWindowFloating, /* 46 */ TkpGetCapture, /* 47 */ 0, /* 48 */ TkMacOSXGetContainer, /* 49 */ TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ TkMacOSXSetDrawingEnabled, /* 52 */ | < < < | | | | | | | | | | | 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 | TkpIsWindowFloating, /* 46 */ TkpGetCapture, /* 47 */ 0, /* 48 */ TkMacOSXGetContainer, /* 49 */ TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ TkMacOSXSetDrawingEnabled, /* 52 */ #endif /* AQUA */ #if !(defined(_WIN32) || defined(__CYGWIN__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ 0, /* 1 */ TkGenerateActivateEvents, /* 2 */ 0, /* 3 */ 0, /* 4 */ 0, /* 5 */ TkpScanWindowId, /* 6 */ 0, /* 7 */ 0, /* 8 */ TkpWmSetState, /* 9 */ 0, /* 10 */ 0, /* 11 */ 0, /* 12 */ 0, /* 13 */ 0, /* 14 */ 0, /* 15 */ 0, /* 16 */ 0, /* 17 */ 0, /* 18 */ 0, /* 19 */ 0, /* 20 */ |
︙ | ︙ | |||
668 669 670 671 672 673 674 | 0, /* 31 */ 0, /* 32 */ 0, /* 33 */ 0, /* 34 */ 0, /* 35 */ 0, /* 36 */ 0, /* 37 */ | | | | | | | | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | 0, /* 31 */ 0, /* 32 */ 0, /* 33 */ 0, /* 34 */ 0, /* 35 */ 0, /* 36 */ 0, /* 37 */ TkpCmapStressed, /* 38 */ TkpSync, /* 39 */ TkUnixContainerId, /* 40 */ TkUnixDoOneXEvent, /* 41 */ TkUnixSetMenubar, /* 42 */ TkWmCleanup, /* 43 */ TkSendCleanup, /* 44 */ TkpTestsendCmd, /* 45 */ #endif /* X11 */ }; static const TkIntXlibStubs tkIntXlibStubs = { TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ |
︙ | ︙ | |||
764 765 766 767 768 769 770 | XUngrabPointer, /* 74 */ XUnmapWindow, /* 75 */ XWindowEvent, /* 76 */ XDestroyIC, /* 77 */ XFilterEvent, /* 78 */ XmbLookupString, /* 79 */ TkPutImage, /* 80 */ | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | XUngrabPointer, /* 74 */ XUnmapWindow, /* 75 */ XWindowEvent, /* 76 */ XDestroyIC, /* 77 */ XFilterEvent, /* 78 */ XmbLookupString, /* 79 */ TkPutImage, /* 80 */ XSetClipRectangles, /* 81 */ XParseColor, /* 82 */ XCreateGC, /* 83 */ XFreeGC, /* 84 */ XInternAtom, /* 85 */ XSetBackground, /* 86 */ XSetForeground, /* 87 */ XSetClipMask, /* 88 */ |
︙ | ︙ | |||
851 852 853 854 855 856 857 | XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ XGetImage, /* 3 */ XGetAtomName, /* 4 */ XKeysymToString, /* 5 */ XCreateColormap, /* 6 */ | > > | > | | | | > > > | | | | > | | | | | > | | | | | | | > | | > | | > | > | | | > | | | > > > | > | | | | | > | | | | | | | | | > | | | | < > > > > > > | | | | | | | | | | | | | | | | | | | | | < < | < < < < | < < < < < < < < < < < < < < < < < < | | | | | | | | | 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 | XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ XGetImage, /* 3 */ XGetAtomName, /* 4 */ XKeysymToString, /* 5 */ XCreateColormap, /* 6 */ XCreatePixmapCursor, /* 7 */ XCreateGlyphCursor, /* 8 */ XGContextFromGC, /* 9 */ XListHosts, /* 10 */ XKeycodeToKeysym, /* 11 */ XStringToKeysym, /* 12 */ XRootWindow, /* 13 */ XSetErrorHandler, /* 14 */ XIconifyWindow, /* 15 */ XWithdrawWindow, /* 16 */ XGetWMColormapWindows, /* 17 */ XAllocColor, /* 18 */ XBell, /* 19 */ XChangeProperty, /* 20 */ XChangeWindowAttributes, /* 21 */ XClearWindow, /* 22 */ XConfigureWindow, /* 23 */ XCopyArea, /* 24 */ XCopyPlane, /* 25 */ XCreateBitmapFromData, /* 26 */ XDefineCursor, /* 27 */ XDeleteProperty, /* 28 */ XDestroyWindow, /* 29 */ XDrawArc, /* 30 */ XDrawLines, /* 31 */ XDrawRectangle, /* 32 */ XFillArc, /* 33 */ XFillPolygon, /* 34 */ XFillRectangles, /* 35 */ XForceScreenSaver, /* 36 */ XFreeColormap, /* 37 */ XFreeColors, /* 38 */ XFreeCursor, /* 39 */ XFreeModifiermap, /* 40 */ XGetGeometry, /* 41 */ XGetInputFocus, /* 42 */ XGetWindowProperty, /* 43 */ XGetWindowAttributes, /* 44 */ XGrabKeyboard, /* 45 */ XGrabPointer, /* 46 */ XKeysymToKeycode, /* 47 */ XLookupColor, /* 48 */ XMapWindow, /* 49 */ XMoveResizeWindow, /* 50 */ XMoveWindow, /* 51 */ XNextEvent, /* 52 */ XPutBackEvent, /* 53 */ XQueryColors, /* 54 */ XQueryPointer, /* 55 */ XQueryTree, /* 56 */ XRaiseWindow, /* 57 */ XRefreshKeyboardMapping, /* 58 */ XResizeWindow, /* 59 */ XSelectInput, /* 60 */ XSendEvent, /* 61 */ XSetCommand, /* 62 */ XSetIconName, /* 63 */ XSetInputFocus, /* 64 */ XSetSelectionOwner, /* 65 */ XSetWindowBackground, /* 66 */ XSetWindowBackgroundPixmap, /* 67 */ XSetWindowBorder, /* 68 */ XSetWindowBorderPixmap, /* 69 */ XSetWindowBorderWidth, /* 70 */ XSetWindowColormap, /* 71 */ XTranslateCoordinates, /* 72 */ XUngrabKeyboard, /* 73 */ XUngrabPointer, /* 74 */ XUnmapWindow, /* 75 */ XWindowEvent, /* 76 */ XDestroyIC, /* 77 */ XFilterEvent, /* 78 */ XmbLookupString, /* 79 */ TkPutImage, /* 80 */ XSetClipRectangles, /* 81 */ XParseColor, /* 82 */ XCreateGC, /* 83 */ XFreeGC, /* 84 */ XInternAtom, /* 85 */ XSetBackground, /* 86 */ XSetForeground, /* 87 */ XSetClipMask, /* 88 */ XSetClipOrigin, /* 89 */ XSetTSOrigin, /* 90 */ XChangeGC, /* 91 */ XSetFont, /* 92 */ XSetArcMode, /* 93 */ XSetStipple, /* 94 */ XSetFillRule, /* 95 */ XSetFillStyle, /* 96 */ XSetFunction, /* 97 */ XSetLineAttributes, /* 98 */ _XInitImageFuncPtrs, /* 99 */ XCreateIC, /* 100 */ XGetVisualInfo, /* 101 */ XSetWMClientMachine, /* 102 */ XStringListToTextProperty, /* 103 */ XDrawLine, /* 104 */ XWarpPointer, /* 105 */ XFillRectangle, /* 106 */ XFlush, /* 107 */ XGrabServer, /* 108 */ XUngrabServer, /* 109 */ XFree, /* 110 */ XNoOp, /* 111 */ XSynchronize, /* 112 */ XSync, /* 113 */ XVisualIDFromVisual, /* 114 */ 0, /* 115 */ 0, /* 116 */ 0, /* 117 */ 0, /* 118 */ 0, /* 119 */ XOffsetRegion, /* 120 */ XUnionRegion, /* 121 */ XCreateWindow, /* 122 */ 0, /* 123 */ 0, /* 124 */ 0, /* 125 */ 0, /* 126 */ 0, /* 127 */ 0, /* 128 */ XLowerWindow, /* 129 */ XFillArcs, /* 130 */ XDrawArcs, /* 131 */ XDrawRectangles, /* 132 */ XDrawSegments, /* 133 */ XDrawPoint, /* 134 */ XDrawPoints, /* 135 */ XReparentWindow, /* 136 */ XPutImage, /* 137 */ XPolygonRegion, /* 138 */ XPointInRegion, /* 139 */ XVaCreateNestedList, /* 140 */ XSetICValues, /* 141 */ XGetICValues, /* 142 */ XSetICFocus, /* 143 */ 0, /* 144 */ 0, /* 145 */ 0, /* 146 */ XFreeFontSet, /* 147 */ XCloseIM, /* 148 */ XRegisterIMInstantiateCallback, /* 149 */ XUnregisterIMInstantiateCallback, /* 150 */ XSetLocaleModifiers, /* 151 */ XOpenIM, /* 152 */ XGetIMValues, /* 153 */ |
︙ | ︙ | |||
1014 1015 1016 1017 1018 1019 1020 | TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ Tk_HWNDToWindow, /* 3 */ | < < | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Tk_AttachHWND, /* 0 */ Tk_GetHINSTANCE, /* 1 */ Tk_GetHWND, /* 2 */ Tk_HWNDToWindow, /* 3 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ 0, /* 0 */ 0, /* 1 */ 0, /* 2 */ 0, /* 3 */ TkMacOSXInitAppleEvents, /* 4 */ 0, /* 5 */ TkMacOSXInvalClipRgns, /* 6 */ 0, /* 7 */ TkMacOSXGetRootControl, /* 8 */ Tk_MacOSXSetupTkNotifier, /* 9 */ Tk_MacOSXIsAppInFront, /* 10 */ Tk_MacOSXGetTkWindow, /* 11 */ Tk_MacOSXGetCGContextForDrawable, /* 12 */ |
︙ | ︙ | |||
1125 1126 1127 1128 1129 1130 1131 | Tk_FreeCursor, /* 70 */ Tk_FreeFont, /* 71 */ Tk_FreeGC, /* 72 */ Tk_FreeImage, /* 73 */ Tk_FreeOptions, /* 74 */ Tk_FreePixmap, /* 75 */ Tk_FreeTextLayout, /* 76 */ | | | 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | Tk_FreeCursor, /* 70 */ Tk_FreeFont, /* 71 */ Tk_FreeGC, /* 72 */ Tk_FreeImage, /* 73 */ Tk_FreeOptions, /* 74 */ Tk_FreePixmap, /* 75 */ Tk_FreeTextLayout, /* 76 */ 0, /* 77 */ Tk_GCForColor, /* 78 */ Tk_GeometryRequest, /* 79 */ Tk_Get3DBorder, /* 80 */ Tk_GetAllBindings, /* 81 */ Tk_GetAnchor, /* 82 */ Tk_GetAtomName, /* 83 */ Tk_GetBinding, /* 84 */ |
︙ | ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | Tk_GetUid, /* 111 */ Tk_GetVisual, /* 112 */ Tk_GetVRootGeometry, /* 113 */ Tk_Grab, /* 114 */ Tk_HandleEvent, /* 115 */ Tk_IdToWindow, /* 116 */ Tk_ImageChanged, /* 117 */ | | | 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | Tk_GetUid, /* 111 */ Tk_GetVisual, /* 112 */ Tk_GetVRootGeometry, /* 113 */ Tk_Grab, /* 114 */ Tk_HandleEvent, /* 115 */ Tk_IdToWindow, /* 116 */ Tk_ImageChanged, /* 117 */ 0, /* 118 */ Tk_InternAtom, /* 119 */ Tk_IntersectTextLayout, /* 120 */ Tk_MaintainGeometry, /* 121 */ Tk_MainWindow, /* 122 */ Tk_MakeWindowExist, /* 123 */ Tk_ManageGeometry, /* 124 */ Tk_MapWindow, /* 125 */ |
︙ | ︙ | |||
1192 1193 1194 1195 1196 1197 1198 | Tk_NameOfImage, /* 137 */ Tk_NameOfJoinStyle, /* 138 */ Tk_NameOfJustify, /* 139 */ Tk_NameOfRelief, /* 140 */ Tk_NameToWindow, /* 141 */ Tk_OwnSelection, /* 142 */ Tk_ParseArgv, /* 143 */ | | | | | | | 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 | Tk_NameOfImage, /* 137 */ Tk_NameOfJoinStyle, /* 138 */ Tk_NameOfJustify, /* 139 */ Tk_NameOfRelief, /* 140 */ Tk_NameToWindow, /* 141 */ Tk_OwnSelection, /* 142 */ Tk_ParseArgv, /* 143 */ 0, /* 144 */ 0, /* 145 */ Tk_PhotoGetImage, /* 146 */ Tk_PhotoBlank, /* 147 */ 0, /* 148 */ Tk_PhotoGetSize, /* 149 */ 0, /* 150 */ Tk_PointToChar, /* 151 */ Tk_PostscriptFontName, /* 152 */ Tk_PreserveColormap, /* 153 */ Tk_QueueWindowEvent, /* 154 */ Tk_RedrawImage, /* 155 */ Tk_ResizeWindow, /* 156 */ Tk_RestackWindow, /* 157 */ Tk_RestrictEvents, /* 158 */ 0, /* 159 */ Tk_SetAppName, /* 160 */ Tk_SetBackgroundFromBorder, /* 161 */ Tk_SetClass, /* 162 */ Tk_SetGrid, /* 163 */ Tk_SetInternalBorder, /* 164 */ Tk_SetWindowBackground, /* 165 */ Tk_SetWindowBackgroundPixmap, /* 166 */ |
︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 | Tk_GetOptionValue, /* 205 */ Tk_GetJustifyFromObj, /* 206 */ Tk_GetMMFromObj, /* 207 */ Tk_GetPixelsFromObj, /* 208 */ Tk_GetReliefFromObj, /* 209 */ Tk_GetScrollInfoObj, /* 210 */ Tk_InitOptions, /* 211 */ | | | | 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | Tk_GetOptionValue, /* 205 */ Tk_GetJustifyFromObj, /* 206 */ Tk_GetMMFromObj, /* 207 */ Tk_GetPixelsFromObj, /* 208 */ Tk_GetReliefFromObj, /* 209 */ Tk_GetScrollInfoObj, /* 210 */ Tk_InitOptions, /* 211 */ 0, /* 212 */ Tk_RestoreSavedOptions, /* 213 */ Tk_SetOptions, /* 214 */ Tk_InitConsoleChannels, /* 215 */ 0, /* 216 */ Tk_CreateSmoothMethod, /* 217 */ 0, /* 218 */ 0, /* 219 */ Tk_GetDash, /* 220 */ Tk_CreateOutline, /* 221 */ Tk_DeleteOutline, /* 222 */ Tk_ConfigOutlineGC, /* 223 */ |
︙ | ︙ | |||
1294 1295 1296 1297 1298 1299 1300 | Tk_CreateClientMessageHandler, /* 239 */ Tk_DeleteClientMessageHandler, /* 240 */ Tk_CreateAnonymousWindow, /* 241 */ Tk_SetClassProcs, /* 242 */ Tk_SetInternalBorderEx, /* 243 */ Tk_SetMinimumRequestSize, /* 244 */ Tk_SetCaretPos, /* 245 */ | | | | | | | > > > > > > > > > > > | 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 | Tk_CreateClientMessageHandler, /* 239 */ Tk_DeleteClientMessageHandler, /* 240 */ Tk_CreateAnonymousWindow, /* 241 */ Tk_SetClassProcs, /* 242 */ Tk_SetInternalBorderEx, /* 243 */ Tk_SetMinimumRequestSize, /* 244 */ Tk_SetCaretPos, /* 245 */ 0, /* 246 */ 0, /* 247 */ Tk_CollapseMotionEvents, /* 248 */ Tk_RegisterStyleEngine, /* 249 */ Tk_GetStyleEngine, /* 250 */ Tk_RegisterStyledElement, /* 251 */ Tk_GetElementId, /* 252 */ Tk_CreateStyle, /* 253 */ Tk_GetStyle, /* 254 */ Tk_FreeStyle, /* 255 */ Tk_NameOfStyle, /* 256 */ Tk_AllocStyleFromObj, /* 257 */ 0, /* 258 */ 0, /* 259 */ Tk_GetStyledElement, /* 260 */ Tk_GetElementSize, /* 261 */ Tk_GetElementBox, /* 262 */ Tk_GetElementBorderWidth, /* 263 */ Tk_DrawElement, /* 264 */ Tk_PhotoExpand, /* 265 */ Tk_PhotoPutBlock, /* 266 */ Tk_PhotoPutZoomedBlock, /* 267 */ Tk_PhotoSetSize, /* 268 */ Tk_GetUserInactiveTime, /* 269 */ Tk_ResetUserInactiveTime, /* 270 */ Tk_Interp, /* 271 */ 0, /* 272 */ 0, /* 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" |
︙ | ︙ | |||
95 96 97 98 99 100 101 | } Element; /* * Thread-local data. */ typedef struct { | | | | | | | > > | 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 | } Element; /* * Thread-local data. */ typedef struct { size_t nbInit; /* Number of calls to the init proc. */ Tcl_HashTable engineTable; /* Map a name to a style engine. Keys are * strings, values are Tk_StyleEngine * pointers. */ StyleEngine *defaultEnginePtr; /* Default, core-defined style engine. Global * fallback for all engines. */ Tcl_HashTable styleTable; /* Map a name to a style. Keys are strings, * values are Tk_Style pointers.*/ Tcl_Size nbElements; /* Size of the below tables. */ Tcl_HashTable elementTable; /* Map a name to an element Id. Keys are * strings, values are integer element IDs. */ Element *elements; /* Array of Elements. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations for functions defined later in this file: */ static int CreateElement(const char *name, int create); static void DupStyleObjProc(Tcl_Obj *srcObjPtr, Tcl_Obj *dupObjPtr); static void FreeElement(Element *elementPtr); static void FreeStyledElement(StyledElement *elementPtr); static void FreeStyleEngine(StyleEngine *enginePtr); static void FreeStyleObjProc(Tcl_Obj *objPtr); static void FreeWidgetSpec(StyledWidgetSpec *widgetSpecPtr); static StyledElement * GetStyledElement(StyleEngine *enginePtr, Tcl_Size elementId); static StyledWidgetSpec*GetWidgetSpec(StyledElement *elementPtr, Tk_OptionTable optionTable); static void InitElement(Element *elementPtr, const char *name, int id, int genericId, int created); static void InitStyle(Style *stylePtr, const char *name, StyleEngine *enginePtr, ClientData clientData); static void InitStyledElement(StyledElement *elementPtr); static void InitStyleEngine(StyleEngine *enginePtr, const char *name, StyleEngine *parentPtr); static void InitWidgetSpec(StyledWidgetSpec *widgetSpecPtr, StyledElement *elementPtr, Tk_OptionTable optionTable); static int SetStyleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The following structure defines the implementation of the "style" Tcl * object, used for drawing. The internalRep.twoPtrValue.ptr1 field of each * style object points to the Style structure for the stylefont, or NULL. */ static const TkObjType styleObjType = { {"style", /* name */ FreeStyleObjProc, /* freeIntRepProc */ DupStyleObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *--------------------------------------------------------------------------- * * TkStylePkgInit -- * |
︙ | ︙ | |||
236 237 238 239 240 241 242 | TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; StyleEngine *enginePtr; | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; StyleEngine *enginePtr; Tcl_Size i; tsdPtr->nbInit--; if (tsdPtr->nbInit != 0) { return; } /* |
︙ | ︙ | |||
362 363 364 365 366 367 368 | * means the default system engine. Usually * points to the hash key. */ StyleEngine *parentPtr) /* The engine's parent. NULL means the default * system engine. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | * means the default system engine. Usually * points to the hash key. */ StyleEngine *parentPtr) /* The engine's parent. NULL means the default * system engine. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Size elementId; if (name == NULL || *name == '\0') { /* * This is the default style engine. */ enginePtr->parentPtr = NULL; |
︙ | ︙ | |||
417 418 419 420 421 422 423 | static void FreeStyleEngine( StyleEngine *enginePtr) /* The style engine to free. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | static void FreeStyleEngine( StyleEngine *enginePtr) /* The style engine to free. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Size elementId; /* * Free allocated elements. */ for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) { FreeStyledElement(enginePtr->elements+elementId); |
︙ | ︙ | |||
837 838 839 840 841 842 843 | *--------------------------------------------------------------------------- */ static StyledElement * GetStyledElement( StyleEngine *enginePtr, /* Style engine providing the implementation. * NULL means the default system engine. */ | | | | 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 | *--------------------------------------------------------------------------- */ static StyledElement * GetStyledElement( StyleEngine *enginePtr, /* Style engine providing the implementation. * NULL means the default system engine. */ Tcl_Size elementId) /* Unique element ID */ { StyledElement *elementPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); StyleEngine *enginePtr2; if (enginePtr == NULL) { enginePtr = tsdPtr->defaultEnginePtr; } while (elementId != TCL_INDEX_NONE && elementId < tsdPtr->nbElements) { /* * Look for an implemented element through the engine chain. */ enginePtr2 = enginePtr; do { elementPtr = enginePtr2->elements+elementId; |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | * *--------------------------------------------------------------------------- */ Tk_StyledElement Tk_GetStyledElement( Tk_Style style, /* The widget style. */ | | | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | * *--------------------------------------------------------------------------- */ Tk_StyledElement Tk_GetStyledElement( Tk_Style style, /* The widget style. */ Tcl_Size elementId, /* Unique element ID. */ Tk_OptionTable optionTable) /* Option table for the widget. */ { Style *stylePtr = (Style *) style; StyledElement *elementPtr; /* * Get an element implementation and call corresponding hook. |
︙ | ︙ | |||
1398 1399 1400 1401 1402 1403 1404 | Tk_Style Tk_AllocStyleFromObj( Tcl_Interp *interp, /* Interp for error return. */ Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { | | | 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 | Tk_Style Tk_AllocStyleFromObj( Tcl_Interp *interp, /* Interp for error return. */ Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { if (objPtr->typePtr != &styleObjType.objType) { if (SetStyleFromAny(interp, objPtr) != TCL_OK) { return NULL; } } return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } |
︙ | ︙ | |||
1447 1448 1449 1450 1451 1452 1453 | typePtr->freeIntRepProc(objPtr); } style = Tk_GetStyle(interp, name); if (style == NULL) { return TCL_ERROR; } | | | 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | typePtr->freeIntRepProc(objPtr); } style = Tk_GetStyle(interp, name); if (style == NULL) { return TCL_ERROR; } objPtr->typePtr = &styleObjType.objType; objPtr->internalRep.twoPtrValue.ptr1 = style; return TCL_OK; } /* *--------------------------------------------------------------------------- |
︙ | ︙ |
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 |
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | extern "C" { #endif EXTERN int Tktest_Init(Tcl_Interp *interp); #ifdef __cplusplus } #endif /* * The following data structure represents the model for a test image: */ typedef struct TImageModel { Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ | > > > > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | extern "C" { #endif EXTERN int Tktest_Init(Tcl_Interp *interp); #ifdef __cplusplus } #endif #if TCL_MAJOR_VERSION < 9 # undef Tcl_CreateObjCommand2 # define Tcl_CreateObjCommand2 Tcl_CreateObjCommand #endif /* * The following data structure represents the model for a test image: */ typedef struct TImageModel { Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ |
︙ | ︙ | |||
83 84 85 86 87 88 89 | } TImageInstance; /* * The type record for test images: */ static int ImageCreate(Tcl_Interp *interp, | | | | | | | | 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 | } TImageInstance; /* * The type record for test images: */ static int ImageCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); static void *ImageGet(Tk_Window tkwin, void *clientData); static void ImageDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); static void ImageFree(void *clientData, Display *display); static void ImageDelete(void *clientData); static Tk_ImageType imageType = { "test", /* name */ ImageCreate, /* createProc */ ImageGet, /* getProc */ ImageDisplay, /* displayProc */ ImageFree, /* freeProc */ |
︙ | ︙ | |||
147 148 149 150 151 152 153 | * this widget. */ } TrivialCommandHeader; /* * Forward declarations for functions defined later in this file: */ | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | | < < | | < < | 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 | * this widget. */ } TrivialCommandHeader; /* * Forward declarations for functions defined later in this file: */ static Tcl_ObjCmdProc ImageObjCmd; static Tcl_ObjCmdProc TestbitmapObjCmd; static Tcl_ObjCmdProc TestborderObjCmd; static Tcl_ObjCmdProc TestcolorObjCmd; static Tcl_ObjCmdProc TestcursorObjCmd; static Tcl_ObjCmdProc TestdeleteappsObjCmd; static Tcl_ObjCmdProc TestfontObjCmd; static Tcl_ObjCmdProc TestmakeexistObjCmd; #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static Tcl_ObjCmdProc TestmenubarObjCmd; #endif #if defined(_WIN32) static Tcl_ObjCmdProc TestmetricsObjCmd; #endif static Tcl_ObjCmdProc TestobjconfigObjCmd; static Tk_CustomOptionSetProc CustomOptionSet; static Tk_CustomOptionGetProc CustomOptionGet; static Tk_CustomOptionRestoreProc CustomOptionRestore; static Tk_CustomOptionFreeProc CustomOptionFree; static Tcl_ObjCmdProc TestpropObjCmd; static Tcl_ObjCmdProc TestprintfObjCmd; #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static Tcl_ObjCmdProc TestwrapperObjCmd; #endif static void TrivialCmdDeletedProc(void *clientData); static Tcl_ObjCmdProc TrivialConfigObjCmd; static void TrivialEventProc(void *clientData, XEvent *eventPtr); static Tcl_ObjCmdProc TestPhotoStringMatchCmd; /* *---------------------------------------------------------------------- * * Tktest_Init -- * * This function performs initialization for the Tk test suite extensions. |
︙ | ︙ | |||
232 233 234 235 236 237 238 | int Tktest_Init( Tcl_Interp *interp) /* Interpreter for application. */ { static int initialized = 0; | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < | 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 | int Tktest_Init( Tcl_Interp *interp) /* Interpreter for application. */ { static int initialized = 0; if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return TCL_ERROR; } if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { 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_CreateObjCommand2(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_CreateObjCommand2(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_CreateObjCommand2(interp, "testsend", TkpTestsendCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperObjCmd, Tk_MainWindow(interp), NULL); #endif /* _WIN32 */ /* * Create test image type. */ if (!initialized) { initialized = 1; Tk_CreateImageType(&imageType); } /* * And finally add any platform specific test commands. */ return TkplatformtestInit(interp); } |
︙ | ︙ | |||
363 364 365 366 367 368 369 | * None. * *---------------------------------------------------------------------- */ static int TestborderObjCmd( | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | * 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; |
︙ | ︙ | |||
499 500 501 502 503 504 505 | * None. * *---------------------------------------------------------------------- */ static int TestobjconfigObjCmd( | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | * None. * *---------------------------------------------------------------------- */ static int TestobjconfigObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const options[] = { "alltypes", "chain1", "chain2", "chain3", "configerror", "delete", "info", "internal", "new", "notenoughparams", "twowindows", NULL |
︙ | ︙ | |||
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[] = { | > > > > | | > > > > | | | 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 | 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, | > | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | 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, | | | | | 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 | 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; |
︙ | ︙ | |||
765 766 767 768 769 770 771 | recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; recordPtr->extension5ObjPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { | | | | | | 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 | recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; recordPtr->extension5ObjPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); 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 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; |
︙ | ︙ | |||
836 837 838 839 840 841 842 | * This command is similar to the "alltypes" command except that it * stores all the configuration options as internal forms instead of * objects. */ typedef struct { TrivialCommandHeader header; | | | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | * This command is similar to the "alltypes" command except that it * stores all the configuration options as internal forms instead of * objects. */ typedef struct { TrivialCommandHeader header; int boolValue; int integer; double doubleValue; char *string; int index; XColor *colorPtr; Tk_Font tkfont; Pixmap bitmap; |
︙ | ︙ | |||
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", | | | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | } 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, boolValue), 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}, | | | | | | 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 | 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|TK_OPTION_ENUM_VAR, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", TCL_INDEX_NONE, offsetof(InternalRecord, anchor), TK_CONFIG_NULL_OK|TK_OPTION_ENUM_VAR, 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), TK_CONFIG_NULL_OK, 0, 0}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "", |
︙ | ︙ | |||
924 925 926 927 928 929 930 | } Tk_SetClass(tkwin, "Test"); recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; | | | | 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 | } Tk_SetClass(tkwin, "Test"); recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; recordPtr->boolValue = 0; recordPtr->integer = 0; recordPtr->doubleValue = 0.0; recordPtr->string = NULL; recordPtr->index = 0; 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, | | | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | 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); |
︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | } NotEnoughRecord; NotEnoughRecord record; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-foo", "foo", "Foo", "0", offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; | | | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | } NotEnoughRecord; NotEnoughRecord record; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-foo", "foo", "Foo", "0", offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", TCL_INDEX_NONE); Tk_OptionTable optionTable; record.fooObjPtr = NULL; tkwin = Tk_CreateWindowFromPath(interp, mainWin, ".config", NULL); Tk_SetClass(tkwin, "Config"); optionTable = Tk_CreateOptionTable(interp, errorSpecs); |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | * None. * *---------------------------------------------------------------------- */ static int TrivialConfigObjCmd( | | | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | * None. * *---------------------------------------------------------------------- */ static int TrivialConfigObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int result = TCL_OK; static const char *const options[] = { "cget", "configure", "csave", NULL |
︙ | ︙ | |||
1234 1235 1236 1237 1238 1239 1240 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void TrivialCmdDeletedProc( | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void TrivialCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { Tk_DestroyWindow(tkwin); } else if (headerPtr->optionTable != NULL) { |
︙ | ︙ | |||
1272 1273 1274 1275 1276 1277 1278 | * When the window gets deleted, internal structures get cleaned up. * *-------------------------------------------------------------- */ static void TrivialEventProc( | | | 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | * When the window gets deleted, internal structures get cleaned up. * *-------------------------------------------------------------- */ static void TrivialEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { Tk_FreeConfigOptions(clientData, |
︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 | * None. * *---------------------------------------------------------------------- */ static int TestfontObjCmd( | | | 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 | * None. * *---------------------------------------------------------------------- */ static int TestfontObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const options[] = {"counts", "subfonts", NULL}; enum option {COUNTS, SUBFONTS}; int index; |
︙ | ︙ | |||
1371 1372 1373 1374 1375 1376 1377 | */ static int ImageCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ | | | | | | | 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 | */ static int ImageCreate( Tcl_Interp *interp, /* Interpreter for application containing * image. */ const char *name, /* Name to use for image. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { TImageModel *timPtr; const char *varName; Tcl_Size i; varName = "log"; for (i = 0; i < objc; i += 2) { if (strcmp(Tcl_GetString(objv[i]), "-variable") != 0) { Tcl_AppendResult(interp, "bad option name \"", Tcl_GetString(objv[i]), "\"", (char *)NULL); return TCL_ERROR; } if ((i+1) == objc) { Tcl_AppendResult(interp, "no value given for \"", Tcl_GetString(objv[i]), "\" option", (char *)NULL); return TCL_ERROR; } varName = Tcl_GetString(objv[i+1]); } timPtr = (TImageModel *)ckalloc(sizeof(TImageModel)); timPtr->model = model; |
︙ | ︙ | |||
1433 1434 1435 1436 1437 1438 1439 | * Forces windows to be created. * *---------------------------------------------------------------------- */ static int ImageObjCmd( | | | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | * Forces windows to be created. * *---------------------------------------------------------------------- */ static int ImageObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TImageModel *timPtr = (TImageModel *)clientData; int x, y, width, height; |
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | 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 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static void * ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ void *clientData) /* Pointer to TImageModel for image. */ { TImageModel *timPtr = (TImageModel *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; snprintf(buffer, sizeof(buffer), "%s get", timPtr->imageName); Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; |
︙ | ︙ | |||
1531 1532 1533 1534 1535 1536 1537 | * redraw area. * *---------------------------------------------------------------------- */ static void ImageDisplay( | | | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | * redraw area. * *---------------------------------------------------------------------- */ static void ImageDisplay( void *clientData, /* Pointer to TImageInstance for image. */ Display *display, /* Display to use for drawing. */ Drawable drawable, /* Where to 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 |
︙ | ︙ | |||
1567 1568 1569 1570 1571 1572 1573 | if (instPtr->displayFailed == False) { /* * Drawing is possible on the first call to DisplayImage. * Log the message. */ | | | | 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 | if (instPtr->displayFailed == False) { /* * Drawing is possible on the first call to DisplayImage. * Log the message. */ snprintf(instPtr->buffer, sizeof(instPtr->buffer), "%s display %d %d %d %d", instPtr->modelPtr->imageName, imageX, imageY, width, height); } Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, instPtr->buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr->displayFailed = False; } else { /* * Drawing is not possible on the first call to DisplayImage. * Save the message, but do not log it until the actual display. */ if (instPtr->displayFailed == False) { snprintf(instPtr->buffer, sizeof(instPtr->buffer), "%s display %d %d %d %d", instPtr->modelPtr->imageName, imageX, imageY, width, height); } instPtr->displayFailed = True; } if (width > (instPtr->modelPtr->width - imageX)) { width = instPtr->modelPtr->width - imageX; } |
︙ | ︙ | |||
1622 1623 1624 1625 1626 1627 1628 | * Information related to the instance is freed. * *---------------------------------------------------------------------- */ static void ImageFree( | | | | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | * Information related to the instance is freed. * *---------------------------------------------------------------------- */ static void ImageFree( void *clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; snprintf(buffer, sizeof(buffer), "%s free", instPtr->modelPtr->imageName); Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); ckfree(instPtr); } |
︙ | ︙ | |||
1655 1656 1657 1658 1659 1660 1661 | * Information about the image is deleted. * *---------------------------------------------------------------------- */ static void ImageDelete( | | | | 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 | * Information about the image is deleted. * *---------------------------------------------------------------------- */ static void ImageDelete( void *clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { TImageModel *timPtr = (TImageModel *)clientData; char buffer[100]; snprintf(buffer, sizeof(buffer), "%s delete", timPtr->imageName); Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tcl_DeleteCommand(timPtr->interp, timPtr->imageName); ckfree(timPtr->imageName); ckfree(timPtr->varName); ckfree(timPtr); |
︙ | ︙ | |||
1692 1693 1694 1695 1696 1697 1698 | * Forces windows to be created. * *---------------------------------------------------------------------- */ static int TestmakeexistObjCmd( | | | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 | * Forces windows to be created. * *---------------------------------------------------------------------- */ static int TestmakeexistObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window mainWin = (Tk_Window)clientData; int i; Tk_Window tkwin; |
︙ | ︙ | |||
1733 1734 1735 1736 1737 1738 1739 | * *---------------------------------------------------------------------- */ #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarObjCmd( | | | 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | * *---------------------------------------------------------------------- */ #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin, menubar; |
︙ | ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | } else if (strcmp(Tcl_GetString(objv[1]), "cxhscroll") == 0) { val = GetSystemMetrics(SM_CXHSCROLL); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), "\": must be cxhscroll or cyvscroll", NULL); return TCL_ERROR; } | | | 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | } else if (strcmp(Tcl_GetString(objv[1]), "cxhscroll") == 0) { val = GetSystemMetrics(SM_CXHSCROLL); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), "\": must be cxhscroll or cyvscroll", NULL); return TCL_ERROR; } snprintf(buf, sizeof(buf), "%d", val); Tcl_AppendResult(interp, buf, NULL); return TCL_OK; } #endif /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1846 1847 1848 1849 1850 1851 1852 | * None. * *---------------------------------------------------------------------- */ static int TestpropObjCmd( | | | 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | * None. * *---------------------------------------------------------------------- */ static int TestpropObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window mainWin = (Tk_Window)clientData; int result, actualFormat; unsigned long bytesAfter, length, value; |
︙ | ︙ | |||
1879 1880 1881 1882 1883 1884 1885 | if ((result == Success) && (actualType != None)) { if ((actualFormat == 8) && (actualType == XA_STRING)) { for (p = property; ((unsigned long)(p-property)) < length; p++) { if (*p == 0) { *p = '\n'; } } | | | | 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 | if ((result == Success) && (actualType != None)) { if ((actualFormat == 8) && (actualType == XA_STRING)) { for (p = property; ((unsigned long)(p-property)) < length; p++) { if (*p == 0) { *p = '\n'; } } Tcl_SetObjResult(interp, Tcl_NewStringObj((/*!unsigned*/char*)property, TCL_INDEX_NONE)); } else { for (p = property; length > 0; length--) { if (actualFormat == 32) { value = *((long *) p); p += sizeof(long); } else if (actualFormat == 16) { value = 0xffff & (*((short *) p)); p += sizeof(short); } else { value = 0xff & *p; p += 1; } snprintf(buffer, sizeof(buffer), "0x%lx", value); Tcl_AppendElement(interp, buffer); } } } if (property != NULL) { XFree(property); } |
︙ | ︙ | |||
1922 1923 1924 1925 1926 1927 1928 | * None. * *---------------------------------------------------------------------- */ static int TestprintfObjCmd( | | < < < < < | | | | 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 | * None. * *---------------------------------------------------------------------- */ static int TestprintfObjCmd( TCL_UNUSED(void *), /* 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; 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 snprintf. 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. */ snprintf(buffer, sizeof(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__)) /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 | * None. * *---------------------------------------------------------------------- */ static int TestwrapperObjCmd( | | | 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 | * None. * *---------------------------------------------------------------------- */ static int TestwrapperObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkWindow *winPtr, *wrapperPtr; Tk_Window tkwin; |
︙ | ︙ | |||
2002 2003 2004 2005 2006 2007 2008 | } wrapperPtr = TkpGetWrapperWindow(winPtr); if (wrapperPtr != NULL) { char buf[TCL_INTEGER_SPACE]; TkpPrintWindowId(buf, Tk_WindowId(wrapperPtr)); | | | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | } wrapperPtr = TkpGetWrapperWindow(winPtr); if (wrapperPtr != NULL) { char buf[TCL_INTEGER_SPACE]; TkpPrintWindowId(buf, Tk_WindowId(wrapperPtr)); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); } return TCL_OK; } #endif /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2040 2041 2042 2043 2044 2045 2046 | static int CustomOptionSet( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(Tk_Window), Tcl_Obj **value, char *recordPtr, | | | 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 | static int CustomOptionSet( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(Tk_Window), Tcl_Obj **value, char *recordPtr, Tcl_Size internalOffset, char *saveInternalPtr, int flags) { int objEmpty; char *newStr, *string, *internalPtr; objEmpty = 0; |
︙ | ︙ | |||
2075 2076 2077 2078 2079 2080 2081 | if ((flags & TK_OPTION_NULL_OK) && objEmpty) { *value = NULL; } else { string = Tcl_GetString(*value); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { | | | 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | if ((flags & TK_OPTION_NULL_OK) && objEmpty) { *value = NULL; } else { string = Tcl_GetString(*value); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", TCL_INDEX_NONE)); return TCL_ERROR; } } if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); newStr = (char *)ckalloc((*value)->length + 1); |
︙ | ︙ | |||
2099 2100 2101 2102 2103 2104 2105 | } static Tcl_Obj * CustomOptionGet( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, | | | | | < < < | | < < < | 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 | } static Tcl_Obj * CustomOptionGet( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, Tcl_Size internalOffset) { return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), TCL_INDEX_NONE)); } static void CustomOptionRestore( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *internalPtr, char *saveInternalPtr) { *(char **)internalPtr = *(char **)saveInternalPtr; return; } static void CustomOptionFree( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *internalPtr) { if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2154 2155 2156 2157 2158 2159 2160 | * None. * *---------------------------------------------------------------------- */ static int TestPhotoStringMatchCmd( | | < | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 | * None. * *---------------------------------------------------------------------- */ static int TestPhotoStringMatchCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tcl_Obj *dummy = NULL; Tcl_Obj *resultObj[2]; int width, height; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "imageData"); return TCL_ERROR; } if (TkDebugPhotoStringMatchDef(interp, objv[1], dummy, &width, &height)) { resultObj[0] = Tcl_NewWideIntObj(width); |
︙ | ︙ |
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 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 | /* * 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" #include "default.h" #if defined(MAC_OSX_TK) #define Style TkStyle #define DInfo TkDInfo #endif #ifdef _WIN32 #include "tkWinInt.h" #endif #include "tkText.h" /* * 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. |
︙ | ︙ | |||
89 90 91 92 93 94 95 | * * We do not need a 'freeProc' because all changes to these two options are * handled through the TK_TEXT_LINE_RANGE flag in the optionSpecs list, and * the internal storage is just a pointer, which therefore doesn't need * freeing. */ | | | | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | * * We do not need a 'freeProc' because all changes to these two options are * handled through the TK_TEXT_LINE_RANGE flag in the optionSpecs list, and * the internal storage is just a pointer, which therefore doesn't need * freeing. */ static int SetLineStartEnd(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *recordPtr, Tcl_Size internalOffset, char *oldInternalPtr, int flags); static Tcl_Obj * GetLineStartEnd(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size internalOffset); static void RestoreLineStartEnd(void *clientData, Tk_Window tkwin, char *internalPtr, char *oldInternalPtr); static int ObjectIsEmpty(Tcl_Obj *objPtr); static const Tk_ObjCustomOption lineOption = { "line", /* name */ SetLineStartEnd, /* setProc */ |
︙ | ︙ | |||
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, | | | | 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 | {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), | | | | | | | | | | | | | | | 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 | 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), TK_OPTION_ENUM_VAR, &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), TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_TEXT_TAKE_FOCUS, offsetof(TkText, takeFocusObj), TCL_INDEX_NONE, 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, offsetof(TkText, xScrollCmdObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", DEF_TEXT_YSCROLL_COMMAND, offsetof(TkText, yScrollCmdObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0} }; /* * These three typedefs, the structure and the SearchPerform, SearchCore * functions below are used for line-based searches of the text widget, and, * in particular, to handle multi-line matching even though the text widget is * a single-line based data structure. They are completely abstracted away * from the Text widget internals, however, so could easily be re-used with * any line-based entity to provide multi-line matching. * * We have abstracted this code away from the text widget to try to keep Tk as * modular as possible. */ struct SearchSpec; /* Forward declaration. */ typedef void *SearchAddLineProc(int lineNum, struct SearchSpec *searchSpecPtr, Tcl_Obj *theLine, int *lenPtr, int *extraLinesPtr); typedef int SearchMatchProc(int lineNum, struct SearchSpec *searchSpecPtr, void *clientData, Tcl_Obj *theLine, Tcl_Size matchOffset, Tcl_Size matchLength); typedef int SearchLineIndexProc(Tcl_Interp *interp, Tcl_Obj *objPtr, struct SearchSpec *searchSpecPtr, int *linePosPtr, Tcl_Size *offsetPosPtr); typedef struct SearchSpec { int exact; /* Whether search is exact or regexp. */ int noCase; /* Case-insenstivive? */ int noLineStop; /* If not set, a regexp search will use the * TCL_REG_NLSTOP flag. */ int overlap; /* If set, results from multiple searches * (-all) are allowed to overlap each * other. */ int strictLimits; /* If set, matches must be completely inside * the from,to range. Otherwise the limits * only apply to the start of each match. */ int all; /* Whether all or the first match should be * reported. */ int startLine; /* First line to examine. */ Tcl_Size startOffset; /* Index in first line to start at. */ int stopLine; /* Last line to examine, or -1 when we search * all available text. */ Tcl_Size stopOffset; /* Index to stop at, provided stopLine is not * -1. */ int numLines; /* Total lines which are available. */ int backwards; /* Searching forwards or backwards. */ Tcl_Obj *varPtr; /* If non-NULL, store length(s) of match(es) * in this variable. */ Tcl_Obj *countPtr; /* Keeps track of currently found lengths. */ Tcl_Obj *resPtr; /* Keeps track of currently found locations */ int searchElide; /* Search in hidden text as well. */ SearchAddLineProc *addLineProc; /* Function to call when we need to add * another line to the search string so far */ SearchMatchProc *foundMatchProc; /* Function to call when we have found a * match. */ SearchLineIndexProc *lineIndexProc; /* Function to call when we have found a * match. */ void *clientData; /* Information about structure being searched, * in this case a text widget. */ } SearchSpec; /* * The text-widget-independent functions which actually perform the search, * handling both regexp and exact searches. */ |
︙ | ︙ | |||
342 343 344 345 346 347 348 | int tkTextDebug = 0; /* * Forward declarations for functions defined later in this file: */ static int ConfigureText(Tcl_Interp *interp, | | | | | | | | | | | | | < < | < < | | | | | | 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 | int tkTextDebug = 0; /* * Forward declarations for functions defined later in this file: */ static int ConfigureText(Tcl_Interp *interp, TkText *textPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int DeleteIndexRange(TkSharedText *sharedPtr, TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2, int viewUpdate); static int CountIndices(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2, TkTextCountType type); static void DestroyText(TkText *textPtr); static int InsertChars(TkSharedText *sharedTextPtr, TkText *textPtr, TkTextIndex *indexPtr, Tcl_Obj *stringPtr, int viewUpdate); static void TextBlinkProc(void *clientData); static Tcl_CmdDeleteProc TextCmdDeletedProc; static int CreateWidget(TkSharedText *sharedPtr, Tk_Window tkwin, Tcl_Interp *interp, const TkText *parent, Tcl_Size objc, Tcl_Obj *const objv[]); static void TextEventProc(void *clientData, XEvent *eventPtr); static Tcl_Size TextFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); static int TextIndexSortProc(const void *first, const void *second); static int TextInsertCmd(TkSharedText *sharedTextPtr, TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], const TkTextIndex *indexPtr, int viewUpdate); static int TextReplaceCmd(TkText *textPtr, Tcl_Interp *interp, const TkTextIndex *indexFromPtr, const TkTextIndex *indexToPtr, Tcl_Size objc, Tcl_Obj *const objv[], int viewUpdate); static int TextSearchCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int TextEditCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static Tcl_ObjCmdProc TextWidgetObjCmd; static Tcl_ObjCmdProc2 SharedTextObjCmd; static void TextWorldChangedCallback(void *instanceData); static void TextWorldChanged(TkText *textPtr, int mask); static int TextDumpCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int DumpLine(Tcl_Interp *interp, TkText *textPtr, int what, TkTextLine *linePtr, int start, int end, int lineno, Tcl_Obj *command); static int DumpSegment(TkText *textPtr, Tcl_Interp *interp, const char *key, const char *value, Tcl_Obj *command, const TkTextIndex *index, int what); static int TextEditUndo(TkText *textPtr); static int TextEditRedo(TkText *textPtr); static Tcl_Obj * TextGetText(const TkText *textPtr, const TkTextIndex *index1, const TkTextIndex *index2, int visibleOnly); static void GenerateModifiedEvent(TkText *textPtr); static void GenerateUndoStackEvent(TkText *textPtr); static void UpdateDirtyFlag(TkSharedText *sharedPtr); static void TextPushUndoAction(TkText *textPtr, Tcl_Obj *undoString, int insert, const TkTextIndex *index1Ptr, const TkTextIndex *index2Ptr); static Tcl_Size TextSearchIndexInLine(const SearchSpec *searchSpecPtr, TkTextLine *linePtr, Tcl_Size byteIndex); static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static TkUndoProc TextUndoRedoCallback; /* * Declarations of the three search procs required by the multi-line search * routines. */ |
︙ | ︙ | |||
452 453 454 455 456 457 458 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_TextObjCmd( | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_TextObjCmd( 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; if (objc < 2) { |
︙ | ︙ | |||
495 496 497 498 499 500 501 | static int CreateWidget( TkSharedText *sharedPtr, /* Shared widget info, or NULL. */ Tk_Window tkwin, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ const TkText *parent, /* If non-NULL then take default start, end * from this parent. */ | | | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | static int CreateWidget( TkSharedText *sharedPtr, /* Shared widget info, or NULL. */ Tk_Window tkwin, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ const TkText *parent, /* If non-NULL then take default start, end * from this parent. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkText *textPtr; Tk_OptionTable optionTable; TkTextIndex startIndex; Tk_Window newWin; |
︙ | ︙ | |||
548 549 550 551 552 553 554 555 556 557 558 559 560 561 | sharedPtr->undoStack = TkUndoInitStack(interp,0); sharedPtr->undo = 0; sharedPtr->isDirty = 0; sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; sharedPtr->autoSeparators = 1; sharedPtr->lastEditMode = TK_TEXT_EDIT_OTHER; sharedPtr->stateEpoch = 0; } /* * Add the new widget to the shared list. */ textPtr->sharedTextPtr = sharedPtr; | > | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | sharedPtr->undoStack = TkUndoInitStack(interp,0); sharedPtr->undo = 0; sharedPtr->isDirty = 0; sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; sharedPtr->autoSeparators = 1; sharedPtr->lastEditMode = TK_TEXT_EDIT_OTHER; sharedPtr->stateEpoch = 0; sharedPtr->imageCount = 0; } /* * Add the new widget to the shared list. */ textPtr->sharedTextPtr = sharedPtr; |
︙ | ︙ | |||
628 629 630 631 632 633 634 | /* * Note: it is important that textPtr->selTagPtr is NULL before this * initial call. */ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL); | < < < | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | /* * Note: it is important that textPtr->selTagPtr is NULL before this * initial call. */ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL); Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief); textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex); textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex); /* * Create the option table for this widget class. If it has already been * created, the cached pointer will be returned. |
︙ | ︙ | |||
690 691 692 693 694 695 696 | * See the user documentation. * *-------------------------------------------------------------- */ static int TextWidgetObjCmd( | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | * See the user documentation. * *-------------------------------------------------------------- */ static int TextWidgetObjCmd( void *clientData, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkText *textPtr = (TkText *)clientData; int result = TCL_OK; int idx; |
︙ | ︙ | |||
816 817 818 819 820 821 822 | Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value)); break; compareError: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad comparison operator \"%s\": must be" " <, <=, ==, >=, >, or !=", Tcl_GetString(objv[3]))); | | > | | 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 | Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value)); break; compareError: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad comparison operator \"%s\": must be" " <, <=, ==, >=, >, or !=", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "COMPARISON", (char *)NULL); result = TCL_ERROR; goto done; } case TEXT_CONFIGURE: if (objc <= 3) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, textPtr, textPtr->optionTable, ((objc == 3) ? objv[2] : NULL), textPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; } Tcl_SetObjResult(interp, objPtr); } else { result = ConfigureText(interp, textPtr, objc-2, objv+2); } break; case TEXT_COUNT: { const TkTextIndex *indexFromPtr, *indexToPtr; Tcl_Size i; int found = 0, update = 0; Tcl_Obj *objPtr = NULL; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...? index1 index2"); result = TCL_ERROR; goto done; |
︙ | ︙ | |||
860 861 862 863 864 865 866 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; | | | | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; Tcl_Size 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)) { |
︙ | ︙ | |||
1050 1051 1052 1053 1054 1055 1056 | break; badOption: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be -chars, -displaychars, " "-displayindices, -displaylines, -indices, -lines, -update, " "-xpixels, or -ypixels", Tcl_GetString(objv[i]))); | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | break; badOption: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be -chars, -displaychars, " "-displayindices, -displaylines, -indices, -lines, -update, " "-xpixels, or -ypixels", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_OPTION", (char *)NULL); result = TCL_ERROR; goto done; } case TEXT_DEBUG: if (objc > 3) { Tcl_WrongNumArgs(interp, 2, objv, "boolean"); result = TCL_ERROR; |
︙ | ︙ | |||
1077 1078 1079 1080 1081 1082 1083 | break; case TEXT_DELETE: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index1 ?index2 ...?"); result = TCL_ERROR; goto done; } | | | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | break; case TEXT_DELETE: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index1 ?index2 ...?"); result = TCL_ERROR; goto done; } if (textPtr->state != TK_TEXT_STATE_DISABLED) { if (objc < 5) { /* * Simple case requires no predetermination of indices. */ const TkTextIndex *indexPtr1, *indexPtr2; |
︙ | ︙ | |||
1117 1118 1119 1120 1121 1122 1123 | * in the exact (unshifted) text. It also needs to handle * partial and fully overlapping ranges. We have to do this * with multiple passes. */ TkTextIndex *indices, *ixStart, *ixEnd, *lastStart; char *useIdx; | | | 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | * in the exact (unshifted) text. It also needs to handle * partial and fully overlapping ranges. We have to do this * with multiple passes. */ TkTextIndex *indices, *ixStart, *ixEnd, *lastStart; char *useIdx; Tcl_Size i; objc -= 2; objv += 2; indices = (TkTextIndex *)ckalloc((objc + 1) * sizeof(TkTextIndex)); /* * First pass verifies that all indices are valid. |
︙ | ︙ | |||
1253 1254 1255 1256 1257 1258 1259 | result = TextDumpCmd(textPtr, interp, objc, objv); break; case TEXT_EDIT: result = TextEditCmd(textPtr, interp, objc, objv); break; case TEXT_GET: { Tcl_Obj *objPtr = NULL; | > | | | | | 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 | result = TextDumpCmd(textPtr, interp, objc, objv); break; case TEXT_EDIT: result = TextEditCmd(textPtr, interp, objc, objv); break; case TEXT_GET: { Tcl_Obj *objPtr = NULL; Tcl_Size i; int found = 0, visible = 0; const char *name; Tcl_Size length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "?-displaychars? ?--? index1 ?index2 ...?"); result = TCL_ERROR; goto done; } /* * 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++; } } } |
︙ | ︙ | |||
1379 1380 1381 1382 1383 1384 1385 | goto done; } indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]); if (indexPtr == NULL) { result = TCL_ERROR; goto done; } | | | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | goto done; } indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[2]); if (indexPtr == NULL) { result = TCL_ERROR; goto done; } if (textPtr->state != TK_TEXT_STATE_DISABLED) { result = TextInsertCmd(NULL, textPtr, interp, objc-3, objv+3, indexPtr, 1); } break; } case TEXT_MARK: result = TkTextMarkCmd(textPtr, interp, objc, objv); |
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | result = TCL_ERROR; goto done; } if (TkTextIndexCmp(indexFromPtr, indexToPtr) > 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" before \"%s\" in the text", Tcl_GetString(objv[3]), Tcl_GetString(objv[2]))); | | | | > | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | result = TCL_ERROR; goto done; } if (TkTextIndexCmp(indexFromPtr, indexToPtr) > 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" before \"%s\" in the text", Tcl_GetString(objv[3]), Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_ORDER", (char *)NULL); result = TCL_ERROR; goto done; } if (textPtr->state != TK_TEXT_STATE_DISABLED) { int lineNum; Tcl_Size byteIndex; TkTextIndex index; /* * The 'replace' operation is quite complex to do correctly, * because we want a number of criteria to hold: * * 1. The insertion point shouldn't move, unless it is within the |
︙ | ︙ | |||
1458 1459 1460 1461 1462 1463 1464 | && (TkTextIndexCmp(indexToPtr, &index) > 0)) { /* * The insertion point is inside the range to be replaced, so * we have to do some calculations to ensure it doesn't move * unnecessarily. */ | | > | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | && (TkTextIndexCmp(indexToPtr, &index) > 0)) { /* * The insertion point is inside the range to be replaced, so * we have to do some calculations to ensure it doesn't move * unnecessarily. */ int deleteInsertOffset, insertLength, indexFromLine, indexFromByteOffset; Tcl_Size j; insertLength = 0; for (j = 4; j < objc; j += 2) { insertLength += Tcl_GetCharLength(objv[j]); } /* |
︙ | ︙ | |||
1527 1528 1529 1530 1531 1532 1533 | result = TkTextSeeCmd(textPtr, interp, objc, objv); break; case TEXT_SYNC: { if (objc == 4) { Tcl_Obj *cmd = objv[3]; const char *option = Tcl_GetString(objv[2]); if (strncmp(option, "-command", objv[2]->length)) { | | | | 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 | result = TkTextSeeCmd(textPtr, interp, objc, objv); break; case TEXT_SYNC: { if (objc == 4) { Tcl_Obj *cmd = objv[3]; const char *option = Tcl_GetString(objv[2]); if (strncmp(option, "-command", objv[2]->length)) { Tcl_AppendResult(interp, "wrong option \"", option, "\": should be \"-command\"", (char *)NULL); result = TCL_ERROR; goto done; } Tcl_IncrRefCount(cmd); 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; } |
︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | * See the user documentation for "text". * *-------------------------------------------------------------- */ static int SharedTextObjCmd( | | | | 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | * See the user documentation for "text". * *-------------------------------------------------------------- */ static int SharedTextObjCmd( void *clientData, /* Information about shared test B-tree. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkSharedText *sharedPtr = (TkSharedText *)clientData; int result = TCL_OK; int index; static const char *const optionStrings[] = { |
︙ | ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | *-------------------------------------------------------------- */ static int TextPeerCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 | *-------------------------------------------------------------- */ static int TextPeerCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = textPtr->tkwin; int index; static const char *const peerOptionStrings[] = { "create", "names", NULL |
︙ | ︙ | |||
1789 1790 1791 1792 1793 1794 1795 | TextReplaceCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ const TkTextIndex *indexFromPtr, /* Index from which to replace. */ const TkTextIndex *indexToPtr, /* Index to which to replace. */ | | | 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 | TextReplaceCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ const TkTextIndex *indexFromPtr, /* Index from which to replace. */ const TkTextIndex *indexToPtr, /* Index to which to replace. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ int viewUpdate) /* Update vertical view if set. */ { /* * Perform the deletion and insertion, but ensure no undo-separator is * placed between the two operations. Since we are using the helper * functions 'DeleteIndexRange' and 'TextInsertCmd' we have to pretend |
︙ | ︙ | |||
2073 2074 2075 2076 2077 2078 2079 | */ static int ConfigureText( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ | | | 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 | */ static int ConfigureText( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; int oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp)); int mask = 0; if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable, |
︙ | ︙ | |||
2126 2127 2128 2129 2130 2131 2132 | if (textPtr->end != NULL) { end = TkBTreeLinesTo(NULL, textPtr->end); } else { end = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL); } if (start > end) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 | if (textPtr->end != NULL) { end = TkBTreeLinesTo(NULL, textPtr->end); } else { end = TkBTreeNumLines(textPtr->sharedTextPtr->tree, NULL); } if (start > end) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-startline must be less than or equal to -endline", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_ORDER", (char *)NULL); Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } current = TkBTreeLinesTo(NULL, textPtr->topIndex.linePtr); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, start, 0, &index1); TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, NULL, end, 0, |
︙ | ︙ | |||
2237 2238 2239 2240 2241 2242 2243 | */ if (textPtr->tabArrayPtr != NULL) { ckfree(textPtr->tabArrayPtr); textPtr->tabArrayPtr = NULL; } if (textPtr->tabOptionPtr != NULL) { | | | 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 | */ if (textPtr->tabArrayPtr != NULL) { ckfree(textPtr->tabArrayPtr); textPtr->tabArrayPtr = NULL; } if (textPtr->tabOptionPtr != NULL) { textPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr->tkwin, textPtr->tabOptionPtr); if (textPtr->tabArrayPtr == NULL) { Tcl_AddErrorInfo(interp,"\n (while processing -tabs option)"); Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } } |
︙ | ︙ | |||
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; | | | | | | | | | | > > | | | | 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 | 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->justify != TK_JUSTIFY_NULL) || (textPtr->selTagPtr->lMargin1 != INT_MIN) || (textPtr->selTagPtr->lMargin2 != INT_MIN) || (textPtr->selTagPtr->offset != INT_MIN) || (textPtr->selTagPtr->rMargin != INT_MIN) || (textPtr->selTagPtr->spacing1 != INT_MIN) || (textPtr->selTagPtr->spacing2 != INT_MIN) || (textPtr->selTagPtr->spacing3 != INT_MIN) || (textPtr->selTagPtr->tabStringPtr != NULL) || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) || (textPtr->selTagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { textPtr->selTagPtr->affectsDisplay = 1; textPtr->selTagPtr->affectsDisplayGeometry = 1; } if ((textPtr->selTagPtr->border != NULL) || (textPtr->selTagPtr->selBorder != NULL) || (textPtr->selTagPtr->relief != TK_RELIEF_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); |
︙ | ︙ | |||
2372 2373 2374 2375 2376 2377 2378 | * redisplayed. * *--------------------------------------------------------------------------- */ static void TextWorldChangedCallback( | | | 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 | * redisplayed. * *--------------------------------------------------------------------------- */ static void TextWorldChangedCallback( void *instanceData) /* Information about widget. */ { TkText *textPtr = (TkText *)instanceData; TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY); } /* |
︙ | ︙ | |||
2462 2463 2464 2465 2466 2467 2468 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void TextEventProc( | | | 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void TextEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkText *textPtr = (TkText *)clientData; TkTextIndex index, index2; if (eventPtr->type == Expose) { TkTextRedrawRegion(textPtr, eventPtr->xexpose.x, |
︙ | ︙ | |||
2502 2503 2504 2505 2506 2507 2508 | textPtr->selBorderWidth = 0; textPtr->selFgColorPtr = NULL; if (textPtr->setGrid) { Tk_UnsetGrid(textPtr->tkwin); textPtr->setGrid = 0; } if (!(textPtr->flags & OPTIONS_FREED)) { | | | 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 | textPtr->selBorderWidth = 0; textPtr->selFgColorPtr = NULL; if (textPtr->setGrid) { Tk_UnsetGrid(textPtr->tkwin); textPtr->setGrid = 0; } if (!(textPtr->flags & OPTIONS_FREED)) { Tk_FreeConfigOptions(textPtr, textPtr->optionTable, textPtr->tkwin); textPtr->flags |= OPTIONS_FREED; } textPtr->flags |= DESTROYED; /* * Call 'DestroyTest' to handle the deletion for us. The actual |
︙ | ︙ | |||
2572 2573 2574 2575 2576 2577 2578 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void TextCmdDeletedProc( | | | 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 | * The widget is destroyed. * *---------------------------------------------------------------------- */ static void TextCmdDeletedProc( void *clientData) /* Pointer to widget record for widget. */ { TkText *textPtr = (TkText *)clientData; Tk_Window tkwin = textPtr->tkwin; /* * This function could be invoked either because the window was destroyed * and the command was then deleted (in which this flag is already set) or |
︙ | ︙ | |||
2627 2628 2629 2630 2631 2632 2633 | * modified if the index is not valid for * insertion (e.g. if at "end"). */ Tcl_Obj *stringPtr, /* Null-terminated string containing new * information to add to text. */ int viewUpdate) /* Update the view if set. */ { int lineIndex; | | | | 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 | * modified if the index is not valid for * insertion (e.g. if at "end"). */ Tcl_Obj *stringPtr, /* Null-terminated string containing new * information to add to text. */ int viewUpdate) /* Update the view if set. */ { int lineIndex; Tcl_Size 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 |
︙ | ︙ | |||
2774 2775 2776 2777 2778 2779 2780 | const TkTextIndex *index1Ptr, /* Index describing first location. */ const TkTextIndex *index2Ptr) /* Index describing second location. */ { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; | | | | | 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 | const TkTextIndex *index1Ptr, /* Index describing first location. */ const TkTextIndex *index2Ptr) /* Index describing second location. */ { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; char lMarkName[16 + TCL_INTEGER_SPACE] = "tk::undoMarkL"; char rMarkName[16 + TCL_INTEGER_SPACE] = "tk::undoMarkR"; char stringUndoMarkId[TCL_INTEGER_SPACE] = ""; /* * Create the helpers. */ Tcl_Obj *seeInsertObj = Tcl_NewObj(); Tcl_Obj *markSet1InsertObj = Tcl_NewObj(); |
︙ | ︙ | |||
2808 2809 2810 2811 2812 2813 2814 | */ Tcl_IncrRefCount(seeInsertObj); Tcl_IncrRefCount(index1Obj); Tcl_IncrRefCount(index2Obj); Tcl_ListObjAppendElement(NULL, seeInsertObj, | | | | 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 | */ Tcl_IncrRefCount(seeInsertObj); Tcl_IncrRefCount(index1Obj); Tcl_IncrRefCount(index2Obj); Tcl_ListObjAppendElement(NULL, seeInsertObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, seeInsertObj, Tcl_NewStringObj("see", 3)); Tcl_ListObjAppendElement(NULL, seeInsertObj, Tcl_NewStringObj("insert", 6)); Tcl_ListObjAppendElement(NULL, markSet1InsertObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markSet1InsertObj, Tcl_NewStringObj("mark", 4)); Tcl_ListObjAppendElement(NULL, markSet1InsertObj, Tcl_NewStringObj("set", 3)); Tcl_ListObjAppendElement(NULL, markSet1InsertObj, Tcl_NewStringObj("insert", 6)); markSet2InsertObj = Tcl_DuplicateObj(markSet1InsertObj); |
︙ | ︙ | |||
2841 2842 2843 2844 2845 2846 2847 | Tcl_ListObjAppendElement(NULL, deleteCmdObj, Tcl_NewStringObj("delete", 6)); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, | | | | | | | | | 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 | Tcl_ListObjAppendElement(NULL, deleteCmdObj, Tcl_NewStringObj("delete", 6)); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj("mark", 4)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj("set", 3)); markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj); textPtr->sharedTextPtr->undoMarkId++; snprintf(stringUndoMarkId, TCL_INTEGER_SPACE, "%" TCL_SIZE_MODIFIER "d", textPtr->sharedTextPtr->undoMarkId); strcat(lMarkName, stringUndoMarkId); strcat(rMarkName, stringUndoMarkId); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj(lMarkName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, Tcl_NewStringObj(rMarkName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, index2Obj); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("mark", 4)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("gravity", 7)); markGravityRUndoMarkCmdObj = Tcl_DuplicateObj(markGravityLUndoMarkCmdObj); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj(lMarkName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, Tcl_NewStringObj(rMarkName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("left", 4)); Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, Tcl_NewStringObj("right", 5)); /* * Note: we don't wish to use textPtr->widgetCmd in these callbacks |
︙ | ︙ | |||
2952 2953 2954 2955 2956 2957 2958 | * *---------------------------------------------------------------------- */ int TextUndoRedoCallback( Tcl_Interp *interp, /* Current interpreter. */ | | | > | 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 | * *---------------------------------------------------------------------- */ int TextUndoRedoCallback( Tcl_Interp *interp, /* Current interpreter. */ void *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; Tcl_Size objc; Tcl_Obj **objv; TkText *textPtr; res = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv); if (res != TCL_OK) { return res; } |
︙ | ︙ | |||
3006 3007 3008 3009 3010 3011 3012 | * * While such interception is not explicitly documented as * supported, it does occur, and so until we can provide some * alternative mechanism for such code to do what it needs, we * allow it to take place here. */ | | | 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 | * * While such interception is not explicitly documented as * supported, it does occur, and so until we can provide some * alternative mechanism for such code to do what it needs, we * allow it to take place here. */ cmdNameObj = Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, evalObj, cmdNameObj); Tcl_ListObjAppendList(NULL, evalObj, objPtr); res = Tcl_EvalObjEx(interp, evalObj, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(evalObj); return res; } textPtr = textPtr->next; |
︙ | ︙ | |||
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; | | | 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 | TkTextIndex index1, index2; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; Tcl_HashSearch search; Tcl_HashEntry *hPtr; Tcl_Size 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; | | | 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 | * deleted but tags might be removed. */ line1 = TkBTreeLinesTo(textPtr, index1.linePtr); line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; Tcl_Size 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); |
︙ | ︙ | |||
3236 3237 3238 3239 3240 3241 3242 | if (sharedTextPtr->refCount > PIXEL_CLIENTS) { lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { int line = 0; | | | 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 | if (sharedTextPtr->refCount > PIXEL_CLIENTS) { lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { int line = 0; Tcl_Size byteIndex = 0; int resetView = 0; if (TkTextIndexCmp(&index2, &tPtr->topIndex) >= 0) { if (TkTextIndexCmp(&index1, &tPtr->topIndex) <= 0) { /* * Deletion range straddles topIndex: use the beginning of the * range as the new topIndex. |
︙ | ︙ | |||
3321 3322 3323 3324 3325 3326 3327 | TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2); UpdateDirtyFlag(sharedTextPtr); } resetViewCount = 0; for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { | | | | | > < < < | < < < < < | < | 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 | TkBTreeDeleteIndexRange(sharedTextPtr->tree, &index1, &index2); UpdateDirtyFlag(sharedTextPtr); } resetViewCount = 0; for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) { Tcl_Size line = lineAndByteIndex[resetViewCount]; if (line != -1) { Tcl_Size byteIndex = lineAndByteIndex[resetViewCount+1]; TkTextIndex indexTmp; if (tPtr == textPtr) { if (viewUpdate) { /* * line cannot be before -startline of textPtr because * this line corresponds to an index which is necessarily * between "1.0" and "end" relative to textPtr. * Therefore no need to clamp line to the -start/-end * range. */ 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); |
︙ | ︙ | |||
3409 3410 3411 3412 3413 3414 3415 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | < | | 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 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static Tcl_Size TextFetchSelection( void *clientData, /* Information about text widget. */ Tcl_Size offset, /* Offset within selection of first character * to be returned. */ char *buffer, /* Location in which to place selection. */ Tcl_Size maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { TkText *textPtr = (TkText *)clientData; TkTextIndex eof; Tcl_Size count, offsetInSeg, chunkSize; TkTextSearch search; TkTextSegment *segPtr; if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { return -1; } |
︙ | ︙ | |||
3490 3491 3492 3493 3494 3495 3496 | } segPtr = TkTextIndexToSeg(&textPtr->selIndex, &offsetInSeg); chunkSize = segPtr->size - offsetInSeg; if (chunkSize > (int)maxBytes) { chunkSize = (int)maxBytes; } if (textPtr->selIndex.linePtr == search.curIndex.linePtr) { | | | 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 | } segPtr = TkTextIndexToSeg(&textPtr->selIndex, &offsetInSeg); chunkSize = segPtr->size - offsetInSeg; if (chunkSize > (int)maxBytes) { chunkSize = (int)maxBytes; } if (textPtr->selIndex.linePtr == search.curIndex.linePtr) { Tcl_Size leftInRange; leftInRange = search.curIndex.byteIndex - textPtr->selIndex.byteIndex; if (leftInRange < chunkSize) { chunkSize = leftInRange; if (chunkSize <= 0) { break; |
︙ | ︙ | |||
3549 3550 3551 3552 3553 3554 3555 | * The "sel" tag is cleared from the window. * *---------------------------------------------------------------------- */ void TkTextLostSelection( | | | 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 | * The "sel" tag is cleared from the window. * *---------------------------------------------------------------------- */ void TkTextLostSelection( void *clientData) /* Information about text widget. */ { TkText *textPtr = (TkText *)clientData; if (Tk_AlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { |
︙ | ︙ | |||
3634 3635 3636 3637 3638 3639 3640 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void TextBlinkProc( | | | 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 | * function reschedules itself. * *---------------------------------------------------------------------- */ static void TextBlinkProc( void *clientData) /* Pointer to record describing text. */ { TkText *textPtr = (TkText *)clientData; TkTextIndex index; int x, y, w, h, charWidth; if ((textPtr->state == TK_TEXT_STATE_DISABLED) || !(textPtr->flags & GOT_FOCUS) || (textPtr->insertOffTime == 0)) { |
︙ | ︙ | |||
3712 3713 3714 3715 3716 3717 3718 | */ static int TextInsertCmd( TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */ TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | | | 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 | */ static int TextInsertCmd( TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */ TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ const TkTextIndex *indexPtr,/* Index at which to insert. */ int viewUpdate) /* Update the view if set. */ { TkTextIndex index1, index2; Tcl_Size j; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } index1 = *indexPtr; for (j = 0; j < objc; j += 2) { /* * Here we rely on this call to modify index1 if it is outside the * acceptable range. In particular, if index1 is "end", it must be set * to the last allowable index for insertion, otherwise subsequent tag * insertions will fail. */ Tcl_Size length = InsertChars(sharedTextPtr, textPtr, &index1, objv[j], viewUpdate); if (objc > (j+1)) { Tcl_Obj **tagNamePtrs; TkTextTag **oldTagArrayPtr; Tcl_Size numTags; TkTextIndexForwBytes(textPtr, &index1, length, &index2); oldTagArrayPtr = TkBTreeGetTags(&index1, NULL, &numTags); if (oldTagArrayPtr != NULL) { Tcl_Size 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 { Tcl_Size i; for (i = 0; i < numTags; i++) { const char *strTag = Tcl_GetString(tagNamePtrs[i]); TkBTreeTag(&index1, &index2, TkTextCreateTag(textPtr, strTag, NULL), 1); } |
︙ | ︙ | |||
3791 3792 3793 3794 3795 3796 3797 | *---------------------------------------------------------------------- */ static int TextSearchCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | > | 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 | *---------------------------------------------------------------------- */ static int TextSearchCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Size i, argsLeft; int code; SearchSpec searchSpec; static const char *const switchStrings[] = { "-hidden", "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards", "-nocase", "-nolinestop", "-overlap", "-regexp", "-strictlimits", NULL }; |
︙ | ︙ | |||
3866 3867 3868 3869 3870 3871 3872 | case TK_TEXT_SEARCH_ALL: searchSpec.all = 1; break; case TK_TEXT_SEARCH_BACK: searchSpec.backwards = 1; break; case TK_TEXT_SEARCH_COUNT: | | | | | 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 | case TK_TEXT_SEARCH_ALL: searchSpec.all = 1; break; case TK_TEXT_SEARCH_BACK: searchSpec.backwards = 1; break; case TK_TEXT_SEARCH_COUNT: if (i + 1 >= objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no value given for \"-count\" option", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "TEXT", "VALUE", (char *)NULL); return TCL_ERROR; } i++; /* * Assumption objv[i] isn't going to disappear on us during this * function, which is fair. |
︙ | ︙ | |||
3922 3923 3924 3925 3926 3927 3928 | "?switches? pattern index ?stopIndex?"); return TCL_ERROR; } if (searchSpec.noLineStop && searchSpec.exact) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "the \"-nolinestop\" option requires the \"-regexp\" option" | | | | | | 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 | "?switches? pattern index ?stopIndex?"); return TCL_ERROR; } if (searchSpec.noLineStop && searchSpec.exact) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "the \"-nolinestop\" option requires the \"-regexp\" option" " to be present", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "TEXT", "SEARCH_USAGE", (char *)NULL); return TCL_ERROR; } if (searchSpec.overlap && !searchSpec.all) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "the \"-overlap\" option requires the \"-all\" option" " to be present", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "TEXT", "SEARCH_USAGE", (char *)NULL); return TCL_ERROR; } /* * Scan through all of the lines of the text circularly, starting at the * given index. 'objv[i]' is the pattern which may be an exact string or a * regexp pattern depending on the flags set above. |
︙ | ︙ | |||
3986 3987 3988 3989 3990 3991 3992 | /* *---------------------------------------------------------------------- * * TextSearchGetLineIndex -- * * Extract a row, text offset index position from an objPtr * | | | 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 | /* *---------------------------------------------------------------------- * * 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 |
︙ | ︙ | |||
4011 4012 4013 4014 4015 4016 4017 | static int TextSearchGetLineIndex( Tcl_Interp *interp, /* For error messages. */ Tcl_Obj *objPtr, /* Contains a textual index like "1.2" */ SearchSpec *searchSpecPtr, /* Contains other search parameters. */ int *linePosPtr, /* For returning the line number. */ | | | 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 | static int TextSearchGetLineIndex( Tcl_Interp *interp, /* For error messages. */ Tcl_Obj *objPtr, /* Contains a textual index like "1.2" */ SearchSpec *searchSpecPtr, /* Contains other search parameters. */ int *linePosPtr, /* For returning the line number. */ Tcl_Size *offsetPosPtr) /* For returning the text offset in the * line. */ { const TkTextIndex *indexPtr; int line; TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr); |
︙ | ︙ | |||
4058 4059 4060 4061 4062 4063 4064 | *---------------------------------------------------------------------- * * TextSearchIndexInLine -- * * Find textual index of 'byteIndex' in the searchable characters of * 'linePtr'. * | | | | | | | | 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 | *---------------------------------------------------------------------- * * 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: * None. * *---------------------------------------------------------------------- */ static Tcl_Size TextSearchIndexInLine( const SearchSpec *searchSpecPtr, /* Search parameters. */ TkTextLine *linePtr, /* The line we're looking at. */ Tcl_Size byteIndex) /* Index into the line. */ { TkTextSegment *segPtr; TkTextIndex curIndex; Tcl_Size index; int leftToScan; TkText *textPtr = (TkText *)searchSpecPtr->clientData; index = 0; curIndex.tree = textPtr->sharedTextPtr->tree; curIndex.linePtr = linePtr; curIndex.byteIndex = 0; for (segPtr = linePtr->segPtr, leftToScan = byteIndex; leftToScan > 0; curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) { if ((segPtr->typePtr == &tkTextCharType) && (searchSpecPtr->searchElide || !TkTextIsElided(textPtr, &curIndex, NULL))) { if (leftToScan < segPtr->size) { if (searchSpecPtr->exact) { index += leftToScan; } else { index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan); } } else if (searchSpecPtr->exact) { index += segPtr->size; |
︙ | ︙ | |||
4138 4139 4140 4141 4142 4143 4144 | * Side effects: * Memory may be allocated or re-allocated for theLine's string * representation. * *---------------------------------------------------------------------- */ | | | 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 | * Side effects: * Memory may be allocated or re-allocated for theLine's string * representation. * *---------------------------------------------------------------------- */ static void * TextSearchAddNextLine( int lineNum, /* Line we must add. */ SearchSpec *searchSpecPtr, /* Search parameters. */ Tcl_Obj *theLine, /* Object to append to. */ int *lenPtr, /* For returning the total length. */ int *extraLinesPtr) /* If non-NULL, will have its value * incremented by the number of additional |
︙ | ︙ | |||
4257 4258 4259 4260 4261 4262 4263 | *---------------------------------------------------------------------- */ static int TextSearchFoundMatch( int lineNum, /* Line on which match was found. */ SearchSpec *searchSpecPtr, /* Search parameters. */ | | | | | | | | | 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 | *---------------------------------------------------------------------- */ static int TextSearchFoundMatch( int lineNum, /* Line on which match was found. */ SearchSpec *searchSpecPtr, /* Search parameters. */ void *clientData, /* Token returned by the 'addNextLineProc', * TextSearchAddNextLine. May be NULL, in * which we case we must generate it (from * lineNum). */ Tcl_Obj *theLine, /* Text from current line, only accessed for * exact searches, and is allowed to be NULL * for regexp searches. */ Tcl_Size matchOffset, /* Offset of found item in utf-8 bytes for * exact search, Unicode chars for regexp. */ Tcl_Size matchLength) /* Length also in bytes/chars as per search * type. */ { Tcl_Size numChars; int leftToScan; TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; TkText *textPtr = (TkText *)searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { /* * If the current index is on the wrong side of the stopIndex, then * the item we just found is actually outside the acceptable range, * and the search is over. */ if (searchSpecPtr->backwards ^ (matchOffset >= searchSpecPtr->stopOffset)) { 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 { numChars = matchLength; } /* * If we're using strict limits checking, ensure that the match with its * full length fits inside the given range. */ if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) { if (searchSpecPtr->backwards ^ ((matchOffset + numChars) > searchSpecPtr->stopOffset)) { return 0; } } /* * The index information returned by the regular expression parser only * considers textual information: it doesn't account for embedded windows, |
︙ | ︙ | |||
4497 4498 4499 4500 4501 4502 4503 | * *---------------------------------------------------------------------- */ TkTextTabArray * TkTextGetTabs( Tcl_Interp *interp, /* Used for error reporting. */ | | | | 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 | * *---------------------------------------------------------------------- */ TkTextTabArray * TkTextGetTabs( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Information about the window. */ Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { Tcl_Size objc, i, count; Tcl_Obj **objv; TkTextTabArray *tabArrayPtr; TkTextTab *tabPtr; int ch; double prevStop, lastStop; /* * Map these strings to TkTextTabAlign values. |
︙ | ︙ | |||
4548 4549 4550 4551 4552 4553 4554 | int index; /* * This will round fractional pixels above 0.5 upwards, and otherwise * downwards, to find the right integer pixel position. */ | | | | < < < < < < < < < < < < < < | < | | 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 | int index; /* * This will round fractional pixels above 0.5 upwards, and otherwise * downwards, to find the right integer pixel position. */ if (Tk_GetPixelsFromObj(interp, tkwin, objv[i], &tabPtr->location) != TCL_OK) { goto error; } if (tabPtr->location <= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "tab stop \"%s\" is not at a positive distance", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "TAB_STOP", (char *)NULL); goto error; } prevStop = lastStop; if (Tk_GetDoublePixelsFromObj(interp, tkwin, objv[i], &lastStop) != TCL_OK) { goto error; } if (i > 0 && (tabPtr->location <= (tabPtr-1)->location)) { /* * This tab is actually to the left of the previous one, which is * illegal. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "tabs must be monotonically increasing, but \"%s\" is " "smaller than or equal to the previous tab", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "TAB_STOP", (char *)NULL); goto error; } tabArrayPtr->numTabs++; /* * See if there is an explicit alignment in the next list element. * Otherwise just use "left". */ tabPtr->alignment = LEFT; if ((i+1) == objc) { continue; } /* * There may be a more efficient way of getting this. */ Tcl_UtfToUniChar(Tcl_GetString(objv[i+1]), &ch); if (!Tcl_UniCharIsAlpha(ch)) { continue; } i += 1; if (Tcl_GetIndexFromObjStruct(interp, objv[i], tabOptionStrings, sizeof(char *), "tab alignment", 0, &index) != TCL_OK) { |
︙ | ︙ | |||
4664 4665 4666 4667 4668 4669 4670 | *---------------------------------------------------------------------- */ static int TextDumpCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 | *---------------------------------------------------------------------- */ static int TextDumpCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "dump". */ { TkTextIndex index1, index2; Tcl_Size arg; int lineno; /* Current line number. */ int what = 0; /* bitfield to select segment types. */ int atEnd; /* True if dumping up to logical end. */ TkTextLine *linePtr; Tcl_Obj *command = NULL; /* Script callback to apply to segments. */ #define TK_DUMP_TEXT 0x1 #define TK_DUMP_MARK 0x2 |
︙ | ︙ | |||
4735 4736 4737 4738 4739 4740 4741 | } } if (arg >= objc || arg+2 < objc) { wrongArgs: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Usage: %s dump ?-all -image -text -mark -tag -window? " "?-command script? index ?index2?", Tcl_GetString(objv[0]))); | | | | | 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 | } } if (arg >= objc || arg+2 < objc) { wrongArgs: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Usage: %s dump ?-all -image -text -mark -tag -window? " "?-command script? index ?index2?", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", (char *)NULL); return TCL_ERROR; } if (what == 0) { what = TK_DUMP_ALL; } if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index1) != TCL_OK) { return TCL_ERROR; } arg++; atEnd = 0; if (objc == arg) { TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES); } else { Tcl_Size 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; } |
︙ | ︙ | |||
5071 5072 5073 5074 5075 5076 5077 | values[2] = Tcl_NewStringObj(buffer, -1); tuple = Tcl_NewListObj(3, values); if (command == NULL) { Tcl_ListObjAppendList(NULL, Tcl_GetObjResult(interp), tuple); Tcl_DecrRefCount(tuple); return 0; } else { | | | | | | | 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 | values[2] = Tcl_NewStringObj(buffer, -1); tuple = Tcl_NewListObj(3, values); if (command == NULL) { Tcl_ListObjAppendList(NULL, Tcl_GetObjResult(interp), tuple); Tcl_DecrRefCount(tuple); return 0; } else { Tcl_Size oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); Tcl_DString buf; int code; Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Tcl_GetString(command), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, Tcl_GetString(tuple), TCL_INDEX_NONE); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (segment dumping command executed by text)"); Tcl_BackgroundException(interp, code); } Tcl_DecrRefCount(tuple); |
︙ | ︙ | |||
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 | int status; Tcl_Obj *cmdObj; int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } /* * Turn off the undo feature while we revert a compound action, setting * the dirty handling mode to undo for the duration (unless it is * 'fixed'). */ textPtr->sharedTextPtr->undo = 0; if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_UNDO; } status = TkUndoRevert(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; /* * Convert undo/redo temporary marks set by TkUndoRevert() into * indices left in the interp result. */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", | > > > > > > > > | 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 | int status; Tcl_Obj *cmdObj; int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } if (textPtr->sharedTextPtr->autoSeparators) { TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack); } /* * Turn off the undo feature while we revert a compound action, setting * the dirty handling mode to undo for the duration (unless it is * 'fixed'). */ textPtr->sharedTextPtr->undo = 0; if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_UNDO; } status = TkUndoRevert(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; if (textPtr->sharedTextPtr->autoSeparators) { TkUndoInsertUndoSeparator(textPtr->sharedTextPtr->undoStack); } /* * Convert undo/redo temporary marks set by TkUndoRevert() into * indices left in the interp result. */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", |
︙ | ︙ | |||
5245 5246 5247 5248 5249 5250 5251 | *---------------------------------------------------------------------- */ static int TextEditCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 | *---------------------------------------------------------------------- */ static int TextEditCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int index, setModified, oldModified; int canRedo = 0; int canUndo = 0; static const char *const editOptionStrings[] = { |
︙ | ︙ | |||
5336 5337 5338 5339 5340 5341 5342 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } canUndo = TkUndoCanUndo(textPtr->sharedTextPtr->undoStack); if (TextEditRedo(textPtr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("nothing to redo", -1)); | | | 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } canUndo = TkUndoCanUndo(textPtr->sharedTextPtr->undoStack); if (TextEditRedo(textPtr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("nothing to redo", -1)); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_REDO", (char *)NULL); return TCL_ERROR; } canRedo = TkUndoCanRedo(textPtr->sharedTextPtr->undoStack); if (!canUndo || !canRedo) { GenerateUndoStackEvent(textPtr); } break; |
︙ | ︙ | |||
5371 5372 5373 5374 5375 5376 5377 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } canRedo = TkUndoCanRedo(textPtr->sharedTextPtr->undoStack); if (TextEditUndo(textPtr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("nothing to undo", -1)); | | | 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } canRedo = TkUndoCanRedo(textPtr->sharedTextPtr->undoStack); if (TextEditUndo(textPtr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("nothing to undo", -1)); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_UNDO", (char *)NULL); return TCL_ERROR; } canUndo = TkUndoCanUndo(textPtr->sharedTextPtr->undoStack); if (!canRedo || !canUndo) { GenerateUndoStackEvent(textPtr); } break; |
︙ | ︙ | |||
5430 5431 5432 5433 5434 5435 5436 | TkTextMakeByteIndex(indexPtr1->tree, textPtr, TkBTreeLinesTo(textPtr, indexPtr1->linePtr), indexPtr1->byteIndex, &tmpIndex); if (TkTextIndexCmp(indexPtr1, indexPtr2) < 0) { while (1) { | | | 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 | TkTextMakeByteIndex(indexPtr1->tree, textPtr, TkBTreeLinesTo(textPtr, indexPtr1->linePtr), indexPtr1->byteIndex, &tmpIndex); if (TkTextIndexCmp(indexPtr1, indexPtr2) < 0) { while (1) { Tcl_Size offset; TkTextSegment *segPtr = TkTextIndexToSeg(&tmpIndex, &offset); int last = segPtr->size, last2; if (tmpIndex.linePtr == indexPtr2->linePtr) { /* * The last line that was requested must be handled carefully, * because we may need to break out of this loop in the middle |
︙ | ︙ | |||
5593 5594 5595 5596 5597 5598 5599 | * Anything may happen, depending on $cmd contents. * *---------------------------------------------------------------------- */ void TkTextRunAfterSyncCmd( | | | | | | 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 | * Anything may happen, depending on $cmd contents. * *---------------------------------------------------------------------- */ void TkTextRunAfterSyncCmd( void *clientData) /* Information about text widget. */ { TkText *textPtr = (TkText *)clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * The widget has been deleted. Don't do anything. */ if (textPtr->refCount-- <= 1) { ckfree(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; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5751 5752 5753 5754 5755 5756 5757 | { /* * For exact searches these are utf-8 char* offsets, for regexp searches * they are Unicode char offsets. */ int firstOffset, lastOffset; | | | | | | 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 | { /* * For exact searches these are utf-8 char* offsets, for regexp searches * they are Unicode char offsets. */ int firstOffset, lastOffset; Tcl_Size matchOffset, matchLength; int passes; int lineNum = searchSpecPtr->startLine; int code = TCL_OK; Tcl_Obj *theLine; int alreadySearchOffset = -1; const char *pattern = NULL; /* For exact searches only. */ int firstNewLine = -1; /* For exact searches only. */ Tcl_RegExp regexp = NULL; /* For regexp searches only. */ /* * These items are for backward regexp searches only. They are for two * purposes: to allow us to report backwards matches in the correct order, * even though the implementation uses repeated forward searches; and to * provide for overlap checking between backwards matches on different * text lines. */ #define LOTS_OF_MATCHES 20 int matchNum = LOTS_OF_MATCHES; Tcl_Size smArray[2 * LOTS_OF_MATCHES]; Tcl_Size *storeMatch = smArray; Tcl_Size *storeLength = smArray + LOTS_OF_MATCHES; int lastBackwardsLineMatch = -1; int lastBackwardsMatchOffset = -1; if (searchSpecPtr->exact) { /* * Convert the pattern to lower-case if we're supposed to ignore case. */ |
︙ | ︙ | |||
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. */ | | | 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 | /* * 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. */ |
︙ | ︙ | |||
5856 5857 5858 5859 5860 5861 5862 | * For building up the current line being checked. */ theLine = Tcl_NewObj(); Tcl_IncrRefCount(theLine); for (passes = 0; passes < 2; ) { | | | 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 | * For building up the current line being checked. */ theLine = Tcl_NewObj(); Tcl_IncrRefCount(theLine); for (passes = 0; passes < 2; ) { void *lineInfo; int linesSearched = 1; int extraLinesSearched = 0; if (lineNum >= searchSpecPtr->numLines) { /* * Don't search the dummy last line of the text. */ |
︙ | ︙ | |||
5923 5924 5925 5926 5927 5928 5929 | /* * Forward search and first pass, or backward search and * second pass. * * Only use the last part of the line. */ | | | | 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 | /* * Forward search and first pass, or backward search and * second pass. * * Only use the last part of the line. */ if (searchSpecPtr->startOffset > firstOffset) { firstOffset = searchSpecPtr->startOffset; } if ((firstOffset >= lastOffset) && ((lastOffset != 0) || searchSpecPtr->exact)) { goto nextLine; } } else { /* * Use only the first part of the line. */ if (searchSpecPtr->startOffset < lastOffset) { lastOffset = searchSpecPtr->startOffset; } } } /* * Check for matches within the current line 'lineNum'. If so, and if |
︙ | ︙ | |||
5959 5960 5961 5962 5963 5964 5965 | int maxExtraLines = 0; const char *startOfLine = Tcl_GetString(theLine); CLANG_ASSERT(pattern); do { int ch; const char *p; | | | | 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 | int maxExtraLines = 0; const char *startOfLine = Tcl_GetString(theLine); CLANG_ASSERT(pattern); do { int ch; const char *p; Tcl_Size lastFullLine = lastOffset; if (firstNewLine == -1) { if (searchSpecPtr->strictLimits && (firstOffset + matchLength > lastOffset)) { /* * Not enough characters to match. */ break; } |
︙ | ︙ | |||
6081 6082 6083 6084 6085 6086 6087 | p = startOfLine + skipFirst; /* * Use the fact that 'matchLength = patLength' for * exact searches. */ | | | 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 | p = startOfLine + skipFirst; /* * Use the fact that 'matchLength = patLength' for * exact searches. */ if ((Tcl_Size)lastTotal - skipFirst >= matchLength) { /* * We now have enough text to match, so we * make a final test and break whatever the * result. */ if (strncmp(p, pattern, matchLength)) { |
︙ | ︙ | |||
6163 6164 6165 6166 6167 6168 6169 | alreadySearchOffset -= (matchLength ? matchLength : 1); if (alreadySearchOffset < 0) { break; } } } else { firstOffset = matchLength ? p - startOfLine + matchLength | | | 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 | alreadySearchOffset -= (matchLength ? matchLength : 1); if (alreadySearchOffset < 0) { break; } } } else { firstOffset = matchLength ? p - startOfLine + matchLength : p - startOfLine + (Tcl_Size)1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find * overlapping matches either on the same or * following lines. Assume that if we did find * something, it goes until the last extra line we * added. |
︙ | ︙ | |||
6191 6192 6193 6194 6195 6196 6197 | if (searchSpecPtr->backwards) { alreadySearchOffset = p - startOfLine - 1; if (alreadySearchOffset < 0) { break; } } else { firstOffset = p - startOfLine + | | | | | | | 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 | if (searchSpecPtr->backwards) { alreadySearchOffset = p - startOfLine - 1; if (alreadySearchOffset < 0) { break; } } else { firstOffset = p - startOfLine + Tcl_UtfToUniChar(startOfLine+matchOffset,&ch); } } } while (searchSpecPtr->all); } else { int maxExtraLines = 0; int matches = 0; int lastNonOverlap = -1; do { Tcl_RegExpInfo info; int match; Tcl_Size lastFullLine = lastOffset; match = Tcl_RegExpExecObj(interp, regexp, theLine, firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0)); if (match < 0) { code = TCL_ERROR; goto searchDone; } Tcl_RegExpGetInfo(regexp, &info); /* * If we don't have a match, or if we do, but it extends to * the end of the line, we must try to add more lines to get a * full greedy match. */ if (!match || ((info.extendStart == info.matches[0].start) && (info.matches[0].end == (Tcl_Size) (lastOffset - firstOffset)))) { int extraLines = 0; Tcl_Size prevFullLine; /* * If we find a match that overlaps more than one line, we * will use this value to determine the first allowed * starting offset for the following search (to avoid * overlapping results). */ int lastTotal = lastOffset; if ((lastBackwardsLineMatch != -1) && (lastBackwardsLineMatch == (lineNum + 1))) { lastNonOverlap = lastTotal; } if (info.extendStart < 0) { /* * No multi-line match is possible. */ break; } |
︙ | ︙ | |||
6336 6337 6338 6339 6340 6341 6342 | * This means we often add and search one more line * than might be necessary if Tcl were able to give us * a correct value of info.extendStart under all * circumstances. */ if ((match && | | | | | | 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 | * This means we often add and search one more line * than might be necessary if Tcl were able to give us * a correct value of info.extendStart under all * circumstances. */ if ((match && firstOffset + info.matches[0].end != (Tcl_Size) lastTotal && firstOffset + info.matches[0].end < prevFullLine) || info.extendStart < 0) { break; } /* * If there is a match, but that match starts after * the end of the first line, then we'll handle that * next time around, when we're actually looking at * that line. */ if (match && (info.matches[0].start >= lastOffset)) { break; } if (match && ((firstOffset + info.matches[0].end) >= prevFullLine)) { if (extraLines > 0) { extraLinesSearched = extraLines - 1; } |
︙ | ︙ | |||
6406 6407 6408 6409 6410 6411 6412 | - info.matches[0].start; if (lastNonOverlap != -1) { /* * Possible overlap or enclosure. */ | | | 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 | - info.matches[0].start; if (lastNonOverlap != -1) { /* * Possible overlap or enclosure. */ if ((Tcl_Size)thisOffset - lastNonOverlap >= lastBackwardsMatchOffset + matchLength + 1){ /* * Totally encloses previous match, so * forget the previous match. */ lastBackwardsLineMatch = -1; |
︙ | ︙ | |||
6488 6489 6490 6491 6492 6493 6494 | /* * Update our local variables with the match, if we haven't * yet found anything, or if we're doing '-all' or * '-backwards' _and_ this match isn't fully enclosed in the * previous match. */ | | | | | | | | 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 | /* * Update our local variables with the match, if we haven't * yet found anything, or if we're doing '-all' or * '-backwards' _and_ this match isn't fully enclosed in the * previous match. */ if (matchOffset == -1 || ((searchSpecPtr->all || searchSpecPtr->backwards) && ((firstOffset < matchOffset) || ((firstOffset + info.matches[0].end - info.matches[0].start) > matchOffset + matchLength)))) { matchOffset = firstOffset; matchLength = info.matches[0].end - info.matches[0].start; if (searchSpecPtr->backwards) { /* * To get backwards searches in the correct order, we * must store them away here. */ if (matches == matchNum) { /* * We've run out of space in our normal store, so * we must allocate space for these backwards * matches on the heap. */ Tcl_Size *newArray = (Tcl_Size *) ckalloc(4 * matchNum * sizeof(Tcl_Size)); memcpy(newArray, storeMatch, matchNum*sizeof(Tcl_Size)); memcpy(newArray + 2*matchNum, storeLength, matchNum * sizeof(Tcl_Size)); if (storeMatch != smArray) { ckfree(storeMatch); } matchNum *= 2; storeMatch = newArray; storeLength = newArray + matchNum; } |
︙ | ︙ | |||
6550 6551 6552 6553 6554 6555 6556 | /* * For forward matches, unless we allow overlaps, we move * this on by the length of the current match so that we * explicitly disallow overlapping matches. */ | | | 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 | /* * For forward matches, unless we allow overlaps, we move * this on by the length of the current match so that we * explicitly disallow overlapping matches. */ if (matchLength > 0 && !searchSpecPtr->overlap && !searchSpecPtr->backwards) { firstOffset += matchLength; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find * overlapping matches either on the same or * following lines. Assume that if we did find |
︙ | ︙ | |||
6607 6608 6609 6610 6611 6612 6613 | * if (storeMatch[matches]<searchSpecPtr->stopOffset) * break; * * might be needed here, but no test case has been * found which would exercise such a problem. */ } | | | | 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 | * if (storeMatch[matches]<searchSpecPtr->stopOffset) * break; * * might be needed here, but no test case has been * found which would exercise such a problem. */ } if (storeMatch[matches] + storeLength[matches] >= matchOffset + matchLength) { /* * The new match totally encloses the previous one, so * we overwrite the previous one. */ matchOffset = storeMatch[matches]; matchLength = storeLength[matches]; |
︙ | ︙ | |||
6775 6776 6777 6778 6779 6780 6781 | */ static Tcl_Obj * GetLineStartEnd( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ | | | 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 | */ static Tcl_Obj * GetLineStartEnd( TCL_UNUSED(void *), TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ Tcl_Size internalOffset) /* Offset within *recordPtr containing the * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); if (linePtr == NULL) { return Tcl_NewObj(); } |
︙ | ︙ | |||
6814 6815 6816 6817 6818 6819 6820 | TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ char *recordPtr, /* Pointer to storage for the widget record. */ | | | 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 | TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ char *recordPtr, /* Pointer to storage for the widget record. */ Tcl_Size internalOffset, /* Offset within *recordPtr at which the * internal value is to be stored. */ char *oldInternalPtr, /* Pointer to storage for the old value. */ int flags) /* Flags for the option, set Tk_SetOptions. */ { TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; |
︙ | ︙ | |||
6927 6928 6929 6930 6931 6932 6933 | *---------------------------------------------------------------------- */ int TkpTesttextCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | > | > > > | | > > | > > | > > | | 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 | *---------------------------------------------------------------------- */ int TkpTesttextCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; Tcl_Size len; Tcl_WideInt lineIndex, byteIndex; Tcl_WideInt byteOffset; TkTextIndex index; char buf[TK_POS_CHARS]; Tcl_CmdInfo info; if (objc < 3) { return TCL_ERROR; } if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) == 0) { return TCL_ERROR; } textPtr = (TkText *)info.objClientData; len = strlen(Tcl_GetString(objv[2])); if (strncmp(Tcl_GetString(objv[2]), "byteindex", len) == 0) { if (objc != 5) { return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[3], &lineIndex)) { return TCL_ERROR; } lineIndex--; if (Tcl_GetWideIntFromObj(interp, objv[4], &byteIndex)) { return TCL_ERROR; } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, lineIndex, byteIndex, &index); } else if (strncmp(Tcl_GetString(objv[2]), "forwbytes", len) == 0) { if (objc != 5) { return TCL_ERROR; } if (TkTextGetIndex(interp, textPtr, Tcl_GetString(objv[3]), &index) != TCL_OK) { return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[4], &byteOffset)) { return TCL_ERROR; } TkTextIndexForwBytes(textPtr, &index, byteOffset, &index); } else if (strncmp(Tcl_GetString(objv[2]), "backbytes", len) == 0) { if (objc != 5) { return TCL_ERROR; } if (TkTextGetIndex(interp, textPtr, Tcl_GetString(objv[3]), &index) != TCL_OK) { return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[4], &byteOffset)) { return TCL_ERROR; } TkTextIndexBackBytes(textPtr, &index, byteOffset, &index); } else { return TCL_ERROR; } TkTextSetMark(textPtr, "insert", &index); TkTextPrintIndex(textPtr, &index, buf); Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s %" TCL_SIZE_MODIFIER "d", buf, index.byteIndex)); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkText.h.
1 2 3 4 5 | /* * tkText.h -- * * Declarations shared among the files that implement text widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkText.h -- * * Declarations shared among the files that implement text widgets. * * 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. */ #ifndef _TKTEXT #define _TKTEXT |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | int chunkCount; /* Number of display chunks that refer to this * window. */ int displayed; /* Non-zero means that the window has been * displayed on the screen recently. */ struct TkTextSegment *parent; struct TkTextEmbWindowClient *next; } TkTextEmbWindowClient; typedef struct TkTextEmbWindow { struct TkSharedText *sharedTextPtr; /* Information about the shared portion of the * text widget. */ Tk_Window tkwin; /* Window for this segment. This is just a * temporary value, copied from 'clients', to * make option table updating easier. NULL * means that the window hasn't been created * yet. */ TkTextLine *linePtr; /* Line structure that contains this * window. */ char *create; /* Script to create window on-demand. NULL * means no such script. Malloc-ed. */ | > > > > | | 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 | int chunkCount; /* Number of display chunks that refer to this * window. */ int displayed; /* Non-zero means that the window has been * displayed on the screen recently. */ struct TkTextSegment *parent; struct TkTextEmbWindowClient *next; } TkTextEmbWindowClient; typedef enum { TK_ALIGN_BASELINE, TK_ALIGN_BOTTOM, TK_ALIGN_CENTER, TK_ALIGN_TOP } TkAlignMode; typedef struct TkTextEmbWindow { struct TkSharedText *sharedTextPtr; /* Information about the shared portion of the * text widget. */ Tk_Window tkwin; /* Window for this segment. This is just a * temporary value, copied from 'clients', to * make option table updating easier. NULL * means that the window hasn't been created * yet. */ TkTextLine *linePtr; /* Line structure that contains this * window. */ char *create; /* Script to create window on-demand. NULL * means no such script. Malloc-ed. */ TkAlignMode align; /* How to align window in vertical space. See * definitions in tkTextWind.c. */ int padX, padY; /* Padding to leave around each side of * window, in pixels. */ int stretch; /* Should window stretch to fill vertical * space of line (except for pady)? 0 or 1. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ |
︙ | ︙ | |||
140 141 142 143 144 145 146 | char *imageName; /* Name used by text widget to identify this * image. May be unique-ified. */ char *name; /* Name used in the hash table. Used by * "image names" to identify this instance of * the image. */ Tk_Image image; /* Image for this segment. NULL means that the * image hasn't been created yet. */ | | | | | 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 | char *imageName; /* Name used by text widget to identify this * image. May be unique-ified. */ char *name; /* Name used in the hash table. Used by * "image names" to identify this instance of * the image. */ Tk_Image image; /* Image for this segment. NULL means that the * image hasn't been created yet. */ TkAlignMode align; /* How to align image in vertical space. See * definitions in tkTextImage.c. */ int padX, padY; /* Padding to leave around each side of image, * in pixels. */ int chunkCount; /* Number of display chunks that refer to this * image. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ } TkTextEmbImage; /* * The data structure below defines line segments. */ typedef struct TkTextSegment { const struct Tk_SegType *typePtr; /* Pointer to record describing segment's * type. */ struct TkTextSegment *nextPtr; /* Next in list of segments for this line, or * NULL for end of list. */ Tcl_Size size; /* Size of this segment (# of bytes of index * space it occupies). */ union { char chars[4]; /* Characters that make up character info. * Actual length varies to hold as many * characters as needed.*/ TkTextToggle toggle; /* Information about tag toggle. */ TkTextMark mark; /* Information about mark. */ TkTextEmbWindow ew; /* Information about embedded window. */ TkTextEmbImage ei; /* Information about embedded image. */ } body; |
︙ | ︙ | |||
186 187 188 189 190 191 192 | * However, mods to marks or tags don't invalidate indices. */ typedef struct TkTextIndex { TkTextBTree tree; /* Tree containing desired position. */ TkTextLine *linePtr; /* Pointer to line containing position of * interest. */ | | | | | 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 | * However, mods to marks or tags don't invalidate indices. */ typedef struct TkTextIndex { TkTextBTree tree; /* Tree containing desired position. */ TkTextLine *linePtr; /* Pointer to line containing position of * interest. */ Tcl_Size byteIndex; /* Index within line of desired character (0 * means first one). */ struct TkText *textPtr; /* May be NULL, but otherwise the text widget * with which this index is associated. If not * NULL, then we have a refCount on the * widget. */ } TkTextIndex; /* * Types for procedure pointers stored in TkTextDispChunk strutures: */ typedef struct TkTextDispChunk TkTextDispChunk; typedef void Tk_ChunkDisplayProc(struct TkText *textPtr, TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); typedef void Tk_ChunkUndisplayProc(struct TkText *textPtr, TkTextDispChunk *chunkPtr); typedef Tcl_Size Tk_ChunkMeasureProc(TkTextDispChunk *chunkPtr, int x); typedef void Tk_ChunkBboxProc(struct TkText *textPtr, TkTextDispChunk *chunkPtr, Tcl_Size index, int y, int lineHeight, int baseline, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* * The structure below represents a chunk of stuff that is displayed together * on the screen. This structure is allocated and freed by generic display * code but most of its fields are filled in by segment-type-specific code. |
︙ | ︙ | |||
251 252 253 254 255 256 257 | /* Procedure to invoke when segment ceases to * be displayed on screen anymore. */ Tk_ChunkMeasureProc *measureProc; /* Procedure to find character under a given * x-location. */ Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box of character * in chunk. */ | | | | > | | > > > > > > > > > > > > > > > > > | | > > > > | | > > | > > | > | > > > | | < > > > > | < > > | | < > > > > > | < > > > > > | > > | > > | > | > > | > | < > > > > > | | < | | < | > > | | | 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 | /* Procedure to invoke when segment ceases to * be displayed on screen anymore. */ Tk_ChunkMeasureProc *measureProc; /* Procedure to find character under a given * x-location. */ Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box of character * in chunk. */ Tcl_Size numBytes; /* Number of bytes that will be displayed in * the chunk. */ int minAscent; /* Minimum space above the baseline needed by * this chunk. */ int minDescent; /* Minimum space below the baseline needed by * this chunk. */ int minHeight; /* Minimum total line height needed by this * chunk. */ int width; /* Width of this chunk, in pixels. Initially * set by chunk-specific code, but may be * increased to include tab or extra space at * end of line. */ Tcl_Size breakIndex; /* Index within chunk of last acceptable * position for a line (break just before this * byte index). <= 0 means don't break during * or immediately after this chunk. */ void *clientData; /* Additional information for use of * displayProc and undisplayProc. */ }; /* * 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; /* * 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[]; 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 * freed. */ const struct TkText *textPtr; /* If non-NULL, then this tag only applies to * the given text widget (when there are peer * widgets). */ Tcl_Size priority; /* Priority of this tag within widget. 0 means * lowest priority. Exactly one tag has each * integer value between 0 and numTags-1. */ struct Node *tagRootPtr; /* Pointer into the B-Tree at the lowest node * that completely dominates the ranges of * text occupied by the tag. At this node * there is no information about the tag. One * or more children of the node do contain * information about the tag. */ Tcl_Size toggleCount; /* Total number of tag toggles. */ /* * Information for displaying text with this tag. The information belows * acts as an override on information specified by lower-priority tags. * If no value is specified, then the next-lower-priority tag on the text * determins the value. The text widget itself provides defaults if no tag * specifies an override. */ Tk_3DBorder border; /* Used for drawing background. NULL means no * value specified here. */ int borderWidth; /* Width of 3-D border for background. */ Tcl_Obj *borderWidthPtr; /* Width of 3-D border for background. */ #if TK_MAJOR_VERSION < 9 char *reliefString; /* -relief option string (malloc-ed). NULL * means option not specified. */ #endif int relief; /* 3-D relief for background. */ Pixmap bgStipple; /* Stipple bitmap for background. None means * no value specified here. */ XColor *fgColor; /* Foreground color for text. NULL means no * value specified here. */ Tk_Font tkfont; /* Font for displaying text. NULL means no * value specified here. */ Pixmap fgStipple; /* Stipple bitmap for text and other * foreground stuff. None means no value * specified here.*/ #if TK_MAJOR_VERSION < 9 char *justifyString; /* -justify option string (malloc-ed). NULL * means option not specified. */ #endif Tk_Justify justify; /* How to justify text: TK_JUSTIFY_CENTER, * TK_JUSTIFY_LEFT, or TK_JUSTIFY_RIGHT. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *lMargin1Obj; /* -lmargin1 option object. NULL * means option not specified. */ #else char *lMargin1String; /* -lmargin1 option string (malloc-ed). NULL * means option not specified. */ #endif int lMargin1; /* Left margin for first display line of each * text line, in pixels. INT_MIN means option not specified. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *lMargin2Obj; /* -lmargin2 option object. NULL * means option not specified. */ #else char *lMargin2String; /* -lmargin2 option string (malloc-ed). NULL * means option not specified. */ #endif int lMargin2; /* Left margin for second and later display lines * of each text line, in pixels. INT_MIN means option not specified. */ Tk_3DBorder lMarginColor; /* Used for drawing background in left margins. * This is used for both lmargin1 and lmargin2. * NULL means no value specified here. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *offsetObj; /* -offset option. NULL means option not specified. */ #else char *offsetString; /* -offset option string (malloc-ed). NULL * means option not specified. */ #endif int offset; /* Vertical offset of text's baseline from * baseline of line. Used for superscripts and * subscripts. INT_MIN means option not specified. */ #if TK_MAJOR_VERSION < 9 char *overstrikeString; /* -overstrike option string (malloc-ed). NULL * means option not specified. */ #endif 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. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *rMarginObj; /* -rmargin option object. NULL * means option not specified. */ #else char *rMarginString; /* -rmargin option string (malloc-ed). NULL * means option not specified. */ #endif int rMargin; /* Right margin for text, in pixels. INT_MIN means option not specified. */ Tk_3DBorder rMarginColor; /* Used for drawing background in right margin. * NULL means no value specified here. */ Tk_3DBorder selBorder; /* Used for drawing background for selected text. * NULL means no value specified here. */ XColor *selFgColor; /* Foreground color for selected text. NULL means * no value specified here. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *spacing1Obj; /* -spacing1 option object. NULL * means option not specified. */ #else char *spacing1String; /* -spacing1 option string (malloc-ed). NULL * means option not specified. */ #endif int spacing1; /* Extra spacing above first display line for * text line. INT_MIN means option not specified. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *spacing2Obj; /* -spacing2 option object. NULL * means option not specified. */ #else char *spacing2String; /* -spacing2 option string (malloc-ed). NULL * means option not specified. */ #endif int spacing2; /* Extra spacing between display lines for the * same text line. INT_MIN means option not specified. */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *spacing3Obj; /* -spacing3 option object. NULL * means option not specified. */ #else char *spacing3String; /* -spacing3 option string (malloc-ed). NULL * means option not specified. */ #endif int spacing3; /* Extra spacing below last display line for * text line. INT_MIN means option not specified. */ 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. */ #if TK_MAJOR_VERSION > 8 TkTextTabStyle tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR * or TK_TEXT_TABSTYLE_NULL (if not specified). */ #else int tabStyle; /* One of TABULAR or WORDPROCESSOR or NONE (if * not specified). */ char *underlineString; /* -underline option string (malloc-ed). NULL * means option not specified. */ #endif 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_WORD, * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_NULL to * use wrapmode for whole widget. */ #if TK_MAJOR_VERSION < 9 char *elideString; /* -elide option string (malloc-ed). NULL * means option not specified. */ #endif 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 |
︙ | ︙ | |||
460 461 462 463 464 465 466 | /* * The following data structure describes a single tab stop. It must be kept * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs' */ typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign; | < < < < < < < < < < < | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | /* * The following data structure describes a single tab stop. It must be kept * in sync with the 'tabOptionStrings' array in the function 'TkTextGetTabs' */ typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign; 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; |
︙ | ︙ | |||
528 529 530 531 532 533 534 | } TkTextState; /* * A data structure of the following type is shared between each text widget * that are peers. */ | < < < < < < < < | | | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | } TkTextState; /* * A data structure of the following type is shared between each text widget * that are peers. */ typedef struct TkSharedText { Tcl_Size refCount; /* Reference count this shared object. */ TkTextBTree tree; /* B-tree representation of text and tags for * widget. */ Tcl_HashTable tagTable; /* Hash table that maps from tag names to * pointers to TkTextTag structures. The "sel" * tag does not feature in this table, since * there's one of those for each text peer. */ Tcl_Size numTags; /* Number of tags currently defined for * widget; needed to keep track of * priorities. */ Tcl_HashTable markTable; /* Hash table that maps from mark names to * pointers to mark segments. The special * "insert" and "current" marks are not stored * in this table, but directly accessed as * fields of textPtr. */ |
︙ | ︙ | |||
566 567 568 569 570 571 572 | * image, there is no entry for it here. */ Tk_BindingTable bindingTable; /* Table of all bindings currently defined for * this widget. NULL means that no bindings * exist, so the table hasn't been created. * Each "object" used for this table is the * name of a tag. */ | | > < < > > > | 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 | * image, there is no entry for it here. */ Tk_BindingTable bindingTable; /* Table of all bindings currently defined for * this widget. NULL means that no bindings * exist, so the table hasn't been created. * Each "object" used for this table is the * name of a tag. */ Tcl_Size stateEpoch; /* This is incremented each time the B-tree's * contents change structurally, or when the * start/end limits change, and means that any * cached TkTextIndex objects are no longer * valid. */ int imageCount; /* Used for creating unique image names. */ /* * Information related to the undo/redo functionality. */ TkUndoRedoStack *undoStack; /* The undo/redo stack. */ int undo; /* Non-zero means the undo/redo behaviour is * enabled. */ int maxUndo; /* The maximum depth of the undo stack * expressed as the maximum number of compound * statements. */ int autoSeparators; /* Non-zero means the separators will be * inserted automatically. */ int isDirty; /* Flag indicating the 'dirtyness' of the * text widget. If the flag is not zero, * unsaved modifications have been applied to * the text widget. */ TkTextDirtyMode dirtyMode; /* The nature of the dirtyness characterized * by the isDirty flag. */ TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode * was. */ /* * Keep track of all the peers */ struct TkText *peers; Tcl_Size undoMarkId; /* Counts undo marks temporarily used during undo and redo operations. */ } TkSharedText; /* * The following enum is used to define a type for the -insertunfocussed * option of the Text widget. */ |
︙ | ︙ | |||
651 652 653 654 655 656 657 | * up.*/ Display *display; /* Display for widget. Needed, among other * things, to allow resources to be freed even * after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with widget. Used to * delete widget command. */ Tcl_Command widgetCmd; /* Token for text's widget command. */ | | | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | * up.*/ Display *display; /* Display for widget. Needed, among other * things, to allow resources to be freed even * after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with widget. Used to * delete widget command. */ Tcl_Command widgetCmd; /* Token for text's widget command. */ TkTextState state; /* Either TK_TEXT_STATE_DISABLED or TK_TEXT_STATE_NORMAL. A * text widget is read-only when disabled. */ /* * Default information for displaying (may be overridden by tags applied * to ranges of characters). */ |
︙ | ︙ | |||
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. */ | | | > | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | 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. */ TkTextTabStyle 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 * TEXT_WRAPMODE_WORD, or TEXT_WRAPMODE_NULL to * use wrapmode for whole widget. */ int width, height; /* Desired dimensions for window, measured in * characters. */ int setGrid; /* Non-zero means pass gridding information to * window manager. */ int prevWidth, prevHeight; /* Last known dimensions of window; used to * detect changes in size. */ TkTextIndex topIndex; /* Identifies first character in top display |
︙ | ︙ | |||
776 777 778 779 780 781 782 | TkTextTag **curTagArrayPtr; /* Pointer to array of tags for current mark, * or NULL if none. */ /* * Miscellaneous additional information: */ | > | | | > > > > > | | 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 | TkTextTag **curTagArrayPtr; /* Pointer to array of tags for current mark, * or NULL if none. */ /* * Miscellaneous additional information: */ #if TK_MAJOR_VERSION > 8 Tcl_Obj *takeFocusObj; /* Value of -takeFocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ Tcl_Obj *xScrollCmdObj; /* Prefix of command to issue to update * horizontal scrollbar when view changes. */ Tcl_Obj *yScrollCmdObj; /* Prefix of command to issue to update * vertical scrollbar when view changes. */ #else char *takeFocus; char *xScrollCmd; char *yScrollCmd; #endif int flags; /* Miscellaneous flags; see below for * definitions. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ Tcl_Size refCount; /* Number of cached TkTextIndex objects * refering to us. */ int insertCursorType; /* 0 = standard insertion cursor, 1 = block * cursor. */ /* * Copies of information from the shared section relating to the undo/redo * functonality |
︙ | ︙ | |||
843 844 845 846 847 848 849 | /* * Records of the following type define segment types in terms of a collection * of procedures that may be called to manipulate segments of that type. */ typedef TkTextSegment * Tk_SegSplitProc(struct TkTextSegment *segPtr, | | | | | 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 | /* * Records of the following type define segment types in terms of a collection * of procedures that may be called to manipulate segments of that type. */ typedef TkTextSegment * Tk_SegSplitProc(struct TkTextSegment *segPtr, Tcl_Size index); typedef int Tk_SegDeleteProc(struct TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); typedef TkTextSegment * Tk_SegCleanupProc(struct TkTextSegment *segPtr, TkTextLine *linePtr); typedef void Tk_SegLineChangeProc(struct TkTextSegment *segPtr, TkTextLine *linePtr); typedef int Tk_SegLayoutProc(struct TkText *textPtr, struct TkTextIndex *indexPtr, TkTextSegment *segPtr, Tcl_Size offset, int maxX, Tcl_Size maxChars, int noCharsYet, TkWrapMode wrapMode, struct TkTextDispChunk *chunkPtr); typedef void Tk_SegCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); typedef struct Tk_SegType { const char *name; /* Name of this kind of segment. */ int leftGravity; /* If a segment has zero size (e.g. a mark or |
︙ | ︙ | |||
911 912 913 914 915 916 917 | * of different tag priorities, it is need for quick calculations of whether a * single index is elided, and to start at a given index and maintain a * correct elide state as we move or count forwards or backwards. */ #define LOTSA_TAGS 1000 typedef struct TkTextElideInfo { | | | | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | * of different tag priorities, it is need for quick calculations of whether a * single index is elided, and to start at a given index and maintain a * correct elide state as we move or count forwards or backwards. */ #define LOTSA_TAGS 1000 typedef struct TkTextElideInfo { Tcl_Size numTags; /* Total tags in widget. */ int elide; /* Is the state currently elided. */ Tcl_Size elidePriority; /* Tag priority controlling elide state. */ TkTextSegment *segPtr; /* Segment to look at next. */ int segOffset; /* Offset of segment within line. */ int deftagCnts[LOTSA_TAGS]; TkTextTag *deftagPtrs[LOTSA_TAGS]; int *tagCnts; /* 0 or 1 depending if the tag with that * priority is on or off. */ TkTextTag **tagPtrs; /* Only filled with a tagPtr if the |
︙ | ︙ | |||
943 944 945 946 947 948 949 | #define TK_POS_CHARS 30 /* * Mask used for those options which may impact the pixel height calculations * of individual lines displayed in the widget. */ | | | | | > | | | > | 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 | #define TK_POS_CHARS 30 /* * Mask used for those options which may impact the pixel height calculations * of individual lines displayed in the widget. */ #define TK_TEXT_LINE_GEOMETRY (1 << 0) /* * Mask used for those options which may impact the start and end lines * used in the widget. */ #define TK_TEXT_LINE_RANGE (1 << 1) /* * Used as 'action' values in calls to TkTextInvalidateLineMetrics */ typedef enum { TK_TEXT_INVALIDATE_ONLY, TK_TEXT_INVALIDATE_INSERT, TK_TEXT_INVALIDATE_DELETE } TkTextInvalidateAction; /* * Used as special 'pickPlace' values in calls to TkTextSetYView. Zero or * positive values indicate a number of pixels. */ #define TK_TEXT_PICKPLACE -1 |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | MODULE_SCOPE void TkBTreeClientRangeChanged(TkText *textPtr, int defaultHeight); MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, TkText *textPtr); MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr); | | | | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | MODULE_SCOPE void TkBTreeClientRangeChanged(TkText *textPtr, int defaultHeight); MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, TkText *textPtr); MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr); MODULE_SCOPE Tcl_Size 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, Tcl_Size *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, |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | TkTextIndex *index2Ptr, TkTextTag *tagPtr, TkTextSearch *searchPtr); MODULE_SCOPE int TkBTreeTag(TkTextIndex *index1Ptr, TkTextIndex *index2Ptr, TkTextTag *tagPtr, int add); MODULE_SCOPE void TkBTreeUnlinkSegment(TkTextSegment *segPtr, TkTextLine *linePtr); | | | | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | TkTextIndex *index2Ptr, TkTextTag *tagPtr, TkTextSearch *searchPtr); MODULE_SCOPE int TkBTreeTag(TkTextIndex *index1Ptr, TkTextIndex *index2Ptr, TkTextTag *tagPtr, int add); MODULE_SCOPE void TkBTreeUnlinkSegment(TkTextSegment *segPtr, TkTextLine *linePtr); MODULE_SCOPE void TkTextBindProc(void *clientData, XEvent *eventPtr); MODULE_SCOPE void TkTextSelectionEvent(TkText *textPtr); MODULE_SCOPE int TkTextIndexBbox(TkText *textPtr, const TkTextIndex *indexPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr, int *charWidthPtr); MODULE_SCOPE int TkTextCharLayoutProc(TkText *textPtr, TkTextIndex *indexPtr, TkTextSegment *segPtr, Tcl_Size offset, int maxX, Tcl_Size maxChars, int noBreakYet, TkWrapMode wrapMode, TkTextDispChunk *chunkPtr); MODULE_SCOPE void TkTextCreateDInfo(TkText *textPtr); MODULE_SCOPE int TkTextDLineInfo(TkText *textPtr, const TkTextIndex *indexPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr, int *basePtr); MODULE_SCOPE void TkTextEmbWinDisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr, int x, int y, |
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | Tcl_Obj *idxPtr, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp, TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr, TkTextIndex *indexPtr); MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *objPtr); MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp, | | | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | Tcl_Obj *idxPtr, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextSharedGetObjIndex(Tcl_Interp *interp, TkSharedText *sharedTextPtr, Tcl_Obj *idxPtr, TkTextIndex *indexPtr); MODULE_SCOPE const TkTextIndex *TkTextGetIndexFromObj(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *objPtr); MODULE_SCOPE TkTextTabArray *TkTextGetTabs(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *stringPtr); MODULE_SCOPE void TkTextFindDisplayLineEnd(TkText *textPtr, TkTextIndex *indexPtr, int end, int *xOffset); MODULE_SCOPE void TkTextIndexBackChars(const TkText *textPtr, const TkTextIndex *srcPtr, int count, TkTextIndex *dstPtr, TkTextCountType type); MODULE_SCOPE int TkTextIndexCmp(const TkTextIndex *index1Ptr, const TkTextIndex *index2Ptr); |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 | const TkTextIndex *srcPtr, int count, TkTextIndex *dstPtr, TkTextCountType type); MODULE_SCOPE void TkTextIndexOfX(TkText *textPtr, int x, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextIndexYPixels(TkText *textPtr, const TkTextIndex *indexPtr); MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr, | | | | | | | | | | | | | > > | 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 | const TkTextIndex *srcPtr, int count, TkTextIndex *dstPtr, TkTextCountType type); MODULE_SCOPE void TkTextIndexOfX(TkText *textPtr, int x, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextIndexYPixels(TkText *textPtr, const TkTextIndex *indexPtr); MODULE_SCOPE TkTextSegment *TkTextIndexToSeg(const TkTextIndex *indexPtr, Tcl_Size *offsetPtr); MODULE_SCOPE void TkTextLostSelection(void *clientData); MODULE_SCOPE TkTextIndex *TkTextMakeCharIndex(TkTextBTree tree, TkText *textPtr, int lineIndex, int charIndex, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextMeasureDown(TkText *textPtr, TkTextIndex *srcPtr, int distance); MODULE_SCOPE void TkTextFreeElideInfo(TkTextElideInfo *infoPtr); MODULE_SCOPE int TkTextIsElided(const TkText *textPtr, const TkTextIndex *indexPtr, TkTextElideInfo *infoPtr); MODULE_SCOPE int TkTextMakePixelIndex(TkText *textPtr, int pixelIndex, TkTextIndex *indexPtr); MODULE_SCOPE void TkTextInvalidateLineMetrics( TkSharedText *sharedTextPtr, TkText *textPtr, TkTextLine *linePtr, int lineCount, TkTextInvalidateAction action); MODULE_SCOPE int TkTextUpdateLineMetrics(TkText *textPtr, int lineNum, int endLine, int doThisMuch); MODULE_SCOPE int TkTextUpdateOneLine(TkText *textPtr, TkTextLine *linePtr, int pixelHeight, TkTextIndex *indexPtr, int partialCalc); MODULE_SCOPE int TkTextMarkCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextMarkNameToIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE void TkTextMarkSegToIndex(TkText *textPtr, TkTextSegment *markPtr, TkTextIndex *indexPtr); MODULE_SCOPE void TkTextEventuallyRepick(TkText *textPtr); MODULE_SCOPE Bool TkTextPendingsync(TkText *textPtr); MODULE_SCOPE void TkTextPickCurrent(TkText *textPtr, XEvent *eventPtr); MODULE_SCOPE void TkTextPixelIndex(TkText *textPtr, int x, int y, TkTextIndex *indexPtr, int *nearest); MODULE_SCOPE Tcl_Obj * TkTextNewIndexObj(TkText *textPtr, const TkTextIndex *indexPtr); MODULE_SCOPE void TkTextRedrawRegion(TkText *textPtr, int x, int y, int width, int height); MODULE_SCOPE void TkTextRedrawTag(TkSharedText *sharedTextPtr, TkText *textPtr, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr, TkTextTag *tagPtr, int withTag); MODULE_SCOPE void TkTextRelayoutWindow(TkText *textPtr, int mask); MODULE_SCOPE int TkTextScanCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextSeeCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Size TkTextSegToOffset(const TkTextSegment *segPtr, const TkTextLine *linePtr); MODULE_SCOPE void TkTextSetYView(TkText *textPtr, TkTextIndex *indexPtr, int pickPlace); MODULE_SCOPE int TkTextTagCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextImageCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextImageIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextWindowCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(void *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" |
︙ | ︙ | |||
40 41 42 43 44 45 46 | /* * The data structure below keeps summary information about one tag as part of * the tag information in a node. */ typedef struct Summary { TkTextTag *tagPtr; /* Handle for tag. */ | | | | 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 | /* * The data structure below keeps summary information about one tag as part of * the tag information in a node. */ typedef struct Summary { TkTextTag *tagPtr; /* Handle for tag. */ Tcl_Size toggleCount; /* Number of transitions into or out of this * tag that occur in the subtree rooted at * this node. */ struct Summary *nextPtr; /* Next in list of all tags for same node, or * NULL if at end of list. */ } Summary; /* * The data structure below defines a node in the B-tree. */ typedef struct Node { struct Node *parentPtr; /* Pointer to parent node, or NULL if this is * the root. */ struct Node *nextPtr; /* Next in list of siblings with the same * parent node, or NULL for end of list. */ Summary *summaryPtr; /* First in malloc-ed list of info about tags * in this subtree (NULL if no tag info in the * subtree). */ Tcl_Size level; /* Level of this node in the B-tree. 0 refers * to the bottom of the tree (children are * lines, not nodes). */ union { /* First in linked list of children. */ struct Node *nodePtr; /* Used if level > 0. */ TkTextLine *linePtr; /* Used if level == 0. */ } children; int numChildren; /* Number of children of this node. */ |
︙ | ︙ | |||
101 102 103 104 105 106 107 | */ typedef struct BTree { Node *rootPtr; /* Pointer to root of B-tree. */ int clients; /* Number of clients of this B-tree. */ int pixelReferences; /* Number of clients of this B-tree which care * about pixel heights. */ | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | */ typedef struct BTree { Node *rootPtr; /* Pointer to root of B-tree. */ int clients; /* Number of clients of this B-tree. */ int pixelReferences; /* Number of clients of this B-tree which care * about pixel heights. */ Tcl_Size stateEpoch; /* Updated each time any aspect of the B-tree * changes. */ TkSharedText *sharedTextPtr;/* Used to find tagTable in consistency * checking code, and to access list of all * B-tree clients. */ int startEndCount; TkTextLine **startEnd; TkText **startEndRef; |
︙ | ︙ | |||
150 151 152 153 154 155 156 | */ static int AdjustPixelClient(BTree *treePtr, int defaultHeight, Node *nodePtr, TkTextLine *start, TkTextLine *end, int useReference, int newPixelReferences, int *counting); static void ChangeNodeToggleCount(Node *nodePtr, | | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | */ static int AdjustPixelClient(BTree *treePtr, int defaultHeight, Node *nodePtr, TkTextLine *start, TkTextLine *end, int useReference, int newPixelReferences, int *counting); static void ChangeNodeToggleCount(Node *nodePtr, TkTextTag *tagPtr, Tcl_Size delta); static void CharCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static int CharDeleteProc(TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); static TkTextSegment * CharCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, Tcl_Size index); static void CheckNodeConsistency(Node *nodePtr, int references); static void CleanupLine(TkTextLine *linePtr); static void DeleteSummaries(Summary *tagPtr); static void DestroyNode(Node *nodePtr); static TkTextSegment * FindTagEnd(TkTextBTree tree, TkTextTag *tagPtr, TkTextIndex *indexPtr); static void IncCount(TkTextTag *tagPtr, int inc, |
︙ | ︙ | |||
497 498 499 500 501 502 503 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_Size TkBTreeEpoch( TkTextBTree tree) /* Tree to get epoch for. */ { BTree *treePtr = (BTree *) tree; return treePtr->stateEpoch; } |
︙ | ︙ | |||
610 611 612 613 614 615 616 | *---------------------------------------------------------------------- */ static void AdjustStartEndRefs( BTree *treePtr, /* The entire B-tree. */ TkText *textPtr, /* The text widget for which we want to adjust | | > | | | | > > > > > > > | 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 | *---------------------------------------------------------------------- */ static void AdjustStartEndRefs( BTree *treePtr, /* The entire B-tree. */ TkText *textPtr, /* The text widget for which we want to adjust * its start and end cache. */ int action) /* Action to perform. */ { if (action & TEXT_REMOVE_REFS) { int i = 0; int count = 0; while (i < treePtr->startEndCount) { if (i != count) { treePtr->startEnd[count] = treePtr->startEnd[i]; treePtr->startEndRef[count] = treePtr->startEndRef[i]; } if (treePtr->startEndRef[i] != textPtr) { count++; } i++; } treePtr->startEndCount = count; if (count > 0) { treePtr->startEnd = (TkTextLine**)ckrealloc(treePtr->startEnd, sizeof(TkTextLine*) * count); treePtr->startEndRef = (TkText**)ckrealloc(treePtr->startEndRef, sizeof(TkText*) * count); } else { ckfree(treePtr->startEndRef); treePtr->startEndRef = NULL; ckfree(treePtr->startEnd); treePtr->startEnd = NULL; } } if ((action & TEXT_ADD_REFS) && (textPtr->start != NULL || textPtr->end != NULL)) { int count; if (textPtr->start != NULL) { treePtr->startEndCount++; |
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | static TkTextSegment * SplitSeg( TkTextIndex *indexPtr) /* Index identifying position at which to * split a segment. */ { TkTextSegment *prevPtr, *segPtr; TkTextLine *linePtr; | | | | 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | static TkTextSegment * SplitSeg( TkTextIndex *indexPtr) /* Index identifying position at which to * split a segment. */ { TkTextSegment *prevPtr, *segPtr; TkTextLine *linePtr; Tcl_Size count = indexPtr->byteIndex; linePtr = indexPtr->linePtr; prevPtr = NULL; segPtr = linePtr->segPtr; while (segPtr != NULL) { if (segPtr->size > count) { if (count == 0) { return prevPtr; } segPtr = segPtr->typePtr->splitProc(segPtr, count); if (prevPtr == NULL) { indexPtr->linePtr->segPtr = segPtr; } else { |
︙ | ︙ | |||
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; } /* | > > > > > > > > > > > > > > > > > > > > | 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 | 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 | | | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 | * 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. |
︙ | ︙ | |||
2282 2283 2284 2285 2286 2287 2288 | */ static void ChangeNodeToggleCount( Node *nodePtr, /* Node whose toggle count for a tag must be * changed. */ TkTextTag *tagPtr, /* Information about tag. */ | | | | 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 | */ static void ChangeNodeToggleCount( Node *nodePtr, /* Node whose toggle count for a tag must be * changed. */ TkTextTag *tagPtr, /* Information about tag. */ Tcl_Size delta) /* Amount to add to current toggle count for * tag (may be negative). */ { Summary *summaryPtr, *prevPtr; Node *node2Ptr; Tcl_Size rootLevel; /* Level of original tag root. */ tagPtr->toggleCount += delta; if (tagPtr->tagRootPtr == NULL) { tagPtr->tagRootPtr = nodePtr; return; } |
︙ | ︙ | |||
2334 2335 2336 2337 2338 2339 2340 | if (summaryPtr->toggleCount != 0) { /* * Should never find a node with max toggle count at this * point (there shouldn't have been a summary entry in the * first place). */ | | | 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 | if (summaryPtr->toggleCount != 0) { /* * Should never find a node with max toggle count at this * point (there shouldn't have been a summary entry in the * first place). */ Tcl_Panic("ChangeNodeToggleCount: bad toggle count (%" TCL_SIZE_MODIFIER "d) max (%" TCL_SIZE_MODIFIER "d)", summaryPtr->toggleCount, tagPtr->toggleCount); } /* * Zero toggle count; must remove this tag from the list. */ |
︙ | ︙ | |||
2650 2651 2652 2653 2654 2655 2656 | * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { | | | 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 | * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { Tcl_Size offset; TkTextIndex index0; /* First index of the tag. */ TkTextSegment *seg0Ptr; /* First segment of the tag. */ /* * Find the segment that contains the first toggle for the tag. This may * become the starting point in the search. */ |
︙ | ︙ | |||
2746 2747 2748 2749 2750 2751 2752 | * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { | | | 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 | * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { Tcl_Size offset; TkTextIndex index0; /* Last index of the tag. */ TkTextIndex backOne; /* One character before starting index. */ TkTextSegment *seg0Ptr; /* Last segment of the tag. */ /* * Find the segment that contains the last toggle for the tag. This may * become the starting point in the search. |
︙ | ︙ | |||
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). */ | | | 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 | 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). */ Tcl_Size *numTagsPtr) /* Store number of tags found at this * location. */ { Node *nodePtr; TkTextLine *siblingLinePtr; TkTextSegment *segPtr; TkTextLine *linePtr; int src, dst, index; |
︙ | ︙ | |||
3488 3489 3490 3491 3492 3493 3494 | * indexPtr's elide state will be stored and * returned. */ { Node *nodePtr; TkTextLine *siblingLinePtr; TkTextSegment *segPtr; TkTextTag *tagPtr = NULL; | | | | 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 | * indexPtr's elide state will be stored and * returned. */ { Node *nodePtr; TkTextLine *siblingLinePtr; TkTextSegment *segPtr; TkTextTag *tagPtr = NULL; Tcl_Size i; TkTextElideInfo *infoPtr; TkTextLine *linePtr; int elide, index; if (elideInfo == NULL) { infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); } else { infoPtr = elideInfo; } |
︙ | ︙ | |||
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; | | | 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 | 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; | | | 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 | 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; | | | | 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 | 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; |
︙ | ︙ | |||
3758 3759 3760 3761 3762 3763 3764 | Summary *summaryPtr; Node *nodePtr; TkTextLine *linePtr; TkTextSegment *segPtr; TkTextTag *tagPtr; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; | | | | | 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 | Summary *summaryPtr; Node *nodePtr; TkTextLine *linePtr; TkTextSegment *segPtr; TkTextTag *tagPtr; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Tcl_Size count; /* * Make sure that the tag toggle counts and the tag root pointers are OK. */ for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search); entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) { tagPtr = (TkTextTag *)Tcl_GetHashValue(entryPtr); nodePtr = tagPtr->tagRootPtr; if (nodePtr == NULL) { if (tagPtr->toggleCount != 0) { Tcl_Panic("TkBTreeCheck found \"%s\" with toggles (%" TCL_SIZE_MODIFIER "d) but no root", tagPtr->name, tagPtr->toggleCount); } continue; /* No ranges for the tag. */ } else if (tagPtr->toggleCount == 0) { Tcl_Panic("TkBTreeCheck found root for \"%s\" with no toggles", tagPtr->name); } else if (tagPtr->toggleCount & 1) { Tcl_Panic("TkBTreeCheck found odd toggle count for \"%s\" (%" TCL_SIZE_MODIFIER "d)", tagPtr->name, tagPtr->toggleCount); } for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr->tagPtr == tagPtr) { Tcl_Panic("TkBTreeCheck found root node with summary info"); } |
︙ | ︙ | |||
3812 3813 3814 3815 3816 3817 3818 | segPtr->body.toggle.tagPtr == tagPtr) { count++; } } } } if (count != tagPtr->toggleCount) { | | | 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 | segPtr->body.toggle.tagPtr == tagPtr) { count++; } } } } if (count != tagPtr->toggleCount) { Tcl_Panic("TkBTreeCheck toggleCount (%" TCL_SIZE_MODIFIER "d) wrong for \"%s\" should be (%" TCL_SIZE_MODIFIER "d)", tagPtr->toggleCount, tagPtr->name, count); } } /* * Call a recursive function to do the main body of checks. */ |
︙ | ︙ | |||
3898 3899 3900 3901 3902 3903 3904 | int references) /* Number of referring widgets which have * pixel counts. */ { Node *childNodePtr; Summary *summaryPtr, *summaryPtr2; TkTextLine *linePtr; TkTextSegment *segPtr; | | > | 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 | int references) /* Number of referring widgets which have * pixel counts. */ { Node *childNodePtr; Summary *summaryPtr, *summaryPtr2; TkTextLine *linePtr; TkTextSegment *segPtr; int numChildren, numLines, minChildren, i; int *numPixels; Tcl_Size toggleCount; int pixels[PIXEL_CLIENTS]; if (nodePtr->parentPtr != NULL) { minChildren = MIN_CHILDREN; } else if (nodePtr->level > 0) { minChildren = 2; } else { |
︙ | ︙ | |||
3964 3965 3966 3967 3968 3969 3970 | } else { for (childNodePtr = nodePtr->children.nodePtr; childNodePtr != NULL; childNodePtr = childNodePtr->nextPtr) { if (childNodePtr->parentPtr != nodePtr) { Tcl_Panic("CheckNodeConsistency: node doesn't point to parent"); } if (childNodePtr->level != (nodePtr->level-1)) { | | | 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 | } else { for (childNodePtr = nodePtr->children.nodePtr; childNodePtr != NULL; childNodePtr = childNodePtr->nextPtr) { if (childNodePtr->parentPtr != nodePtr) { Tcl_Panic("CheckNodeConsistency: node doesn't point to parent"); } if (childNodePtr->level != (nodePtr->level-1)) { Tcl_Panic("CheckNodeConsistency: level mismatch (%" TCL_SIZE_MODIFIER "d %" TCL_SIZE_MODIFIER "d)", nodePtr->level, childNodePtr->level); } CheckNodeConsistency(childNodePtr, references); for (summaryPtr = childNodePtr->summaryPtr; summaryPtr != NULL; summaryPtr = summaryPtr->nextPtr) { for (summaryPtr2 = nodePtr->summaryPtr; ; summaryPtr2 = summaryPtr2->nextPtr) { |
︙ | ︙ | |||
4045 4046 4047 4048 4049 4050 4051 | if (summaryPtr2->tagPtr == summaryPtr->tagPtr) { toggleCount += summaryPtr2->toggleCount; } } } } if (toggleCount != summaryPtr->toggleCount) { | | | 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 | if (summaryPtr2->tagPtr == summaryPtr->tagPtr) { toggleCount += summaryPtr2->toggleCount; } } } } if (toggleCount != summaryPtr->toggleCount) { Tcl_Panic("CheckNodeConsistency: mismatch in toggleCount (%" TCL_SIZE_MODIFIER "d %" TCL_SIZE_MODIFIER "d)", toggleCount, summaryPtr->toggleCount); } for (summaryPtr2 = summaryPtr->nextPtr; summaryPtr2 != NULL; summaryPtr2 = summaryPtr2->nextPtr) { if (summaryPtr2->tagPtr == summaryPtr->tagPtr) { Tcl_Panic("CheckNodeConsistency: duplicated node tag: %s", summaryPtr->tagPtr->name); |
︙ | ︙ | |||
4541 4542 4543 4544 4545 4546 4547 | * *-------------------------------------------------------------- */ static TkTextSegment * CharSplitProc( TkTextSegment *segPtr, /* Pointer to segment to split. */ | | | 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 | * *-------------------------------------------------------------- */ static TkTextSegment * CharSplitProc( TkTextSegment *segPtr, /* Pointer to segment to split. */ Tcl_Size index) /* Position within segment at which to * split. */ { TkTextSegment *newPtr1, *newPtr2; newPtr1 = (TkTextSegment *)ckalloc(CSEG_SIZE(index)); newPtr2 = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size - index)); newPtr1->typePtr = &tkTextCharType; |
︙ | ︙ |
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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | 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). */ TkTextTabStyle 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, * TEXT_WRAPMODE_NONE or TEXT_WRAPMODE_WORD.*/ } StyleValues; /* * The following structure extends the StyleValues structure above with * graphics contexts used to actually draw the characters. The entries in * dInfoPtr->styleTable point to structures of this type. */ typedef struct TextStyle { Tcl_Size refCount; /* Number of times this structure is * referenced in Chunks. */ GC bgGC; /* Graphics context for background. None means * use widget background. */ GC fgGC; /* Graphics context for foreground. */ GC ulGC; /* Graphics context for underline. */ GC ovGC; /* Graphics context for overstrike. */ StyleValues *sValuePtr; /* Raw information from which GCs were |
︙ | ︙ | |||
287 288 289 290 291 292 293 | * neighboring lines (see DisplayLineBackground). * NEW_LAYOUT - Non-zero means that the line has been * re-layed out since the last time the display * was updated. * TOP_LINE - Non-zero means that this was the top line in * in the window the last time that the window * was laid out. This is important because a line | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | * neighboring lines (see DisplayLineBackground). * NEW_LAYOUT - Non-zero means that the line has been * re-layed out since the last time the display * was updated. * TOP_LINE - Non-zero means that this was the top line in * in the window the last time that the window * was laid out. This is important because a line * may be displayed differently if it's at the top * or bottom than if it's in the middle * (e.g. beveled edges aren't displayed for * middle lines if the adjacent line has a * similar background). * BOTTOM_LINE - Non-zero means that this was the bottom line * in the window the last time that the window * was laid out. |
︙ | ︙ | |||
414 415 416 417 418 419 420 | * calculations, if they are out of date. */ TkTextIndex metricIndex; /* If the current metric update line wraps * into very many display lines, then this is * used to keep track of what index we've got * to so far... */ int metricPixelHeight; /* ...and this is for the height calculation * so far...*/ | | | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | * calculations, if they are out of date. */ TkTextIndex metricIndex; /* If the current metric update line wraps * into very many display lines, then this is * used to keep track of what index we've got * to so far... */ int metricPixelHeight; /* ...and this is for the height calculation * so far...*/ Tcl_Size metricEpoch; /* ...and this for the epoch of the partial * calculation so it can be cancelled if * things change once more. This field will be * -1 if there is no long-line calculation in * progress, and take a non-negative value if * there is such a calculation in progress. */ int lastMetricUpdateLine; /* When the current update line reaches this * line, we are done and should stop the |
︙ | ︙ | |||
436 437 438 439 440 441 442 | } TextDInfo; /* * In TkTextDispChunk structures for character segments, the clientData field * points to one of the following structures: */ | | | | | 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 | } 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 { Tcl_Size 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; #else /* TK_LAYOUT_WITH_BASE_CHUNKS */ typedef struct CharInfo { TkTextDispChunk *baseChunkPtr; int baseOffset; /* Starting offset in base chunk * baseChars. */ Tcl_Size numBytes; /* Number of bytes that belong to this * chunk. */ const char *chars; /* UTF characters to display. Actually points * into the baseChars of the base chunk. Only * valid after FinalizeBaseChunk(). */ } CharInfo; /* |
︙ | ︙ | |||
534 535 536 537 538 539 540 | * Forward declarations for functions defined later in this file: */ static void AdjustForTab(TkText *textPtr, TkTextTabArray *tabArrayPtr, int index, TkTextDispChunk *chunkPtr); static void CharBboxProc(TkText *textPtr, | | | | | | | | | | | | | | | | | 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 | * Forward declarations for functions defined later in this file: */ static void AdjustForTab(TkText *textPtr, TkTextTabArray *tabArrayPtr, int index, TkTextDispChunk *chunkPtr); static void CharBboxProc(TkText *textPtr, TkTextDispChunk *chunkPtr, Tcl_Size index, int y, int lineHeight, int baseline, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static Tcl_Size CharChunkMeasureChars(TkTextDispChunk *chunkPtr, const char *chars, int charsLen, int start, int end, int startX, int maxX, int flags, int *nextX); static void CharDisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); static Tcl_Size CharMeasureProc(TkTextDispChunk *chunkPtr, int x); static void CharUndisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr); #ifdef TK_LAYOUT_WITH_BASE_CHUNKS static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr); static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr); static int IsSameFGStyle(TextStyle *style1, TextStyle *style2); static void RemoveFromBaseChunk(TkTextDispChunk *chunkPtr); #endif /* * Definitions of elided procs. Compiler can't inline these since we use * pointers to these functions. ElideDisplayProc and ElideUndisplayProc are * special-cased for speed, as potentially many elided DLine chunks if large, * tag toggle-filled elided region. */ static void ElideBboxProc(TkText *textPtr, TkTextDispChunk *chunkPtr, Tcl_Size index, int y, int lineHeight, int baseline, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static Tcl_Size ElideMeasureProc(TkTextDispChunk *chunkPtr, int x); static void DisplayDLine(TkText *textPtr, DLine *dlPtr, DLine *prevPtr, Pixmap pixmap); static void DisplayLineBackground(TkText *textPtr, DLine *dlPtr, DLine *prevPtr, Pixmap pixmap); static void DisplayText(void *clientData); static DLine * FindDLine(TkText *textPtr, DLine *dlPtr, const TkTextIndex *indexPtr); static void FreeDLines(TkText *textPtr, DLine *firstPtr, DLine *lastPtr, int action); static void FreeStyle(TkText *textPtr, TextStyle *stylePtr); static TextStyle * GetStyle(const TkText *textPtr, const TkTextIndex *indexPtr); static void GetXView(Tcl_Interp *interp, const TkText *textPtr, int report); static void GetYView(Tcl_Interp *interp, TkText *textPtr, int report); static int GetYPixelCount(TkText *textPtr, DLine *dlPtr); static DLine * LayoutDLine(TkText *textPtr, const TkTextIndex *indexPtr); static Tcl_Size MeasureChars(Tk_Font tkfont, const char *source, int maxBytes, int rangeStart, int rangeLength, int startX, int maxX, int flags, int *nextXPtr); static void MeasureUp(TkText *textPtr, const TkTextIndex *srcPtr, int distance, TkTextIndex *dstPtr, int *overlap); static int NextTabStop(Tk_Font tkfont, int x, int tabOrigin); static void UpdateDisplayInfo(TkText *textPtr); static void YScrollByLines(TkText *textPtr, int offset); static void YScrollByPixels(TkText *textPtr, int offset); static int SizeOfTab(TkText *textPtr, TkTextTabStyle tabStyle, TkTextTabArray *tabArrayPtr, int *indexPtr, int x, int maxX); static void TextChanged(TkText *textPtr, const TkTextIndex *index1Ptr, const TkTextIndex *index2Ptr); static void TextInvalidateRegion(TkText *textPtr, TkRegion region); static void TextRedrawTag(TkText *textPtr, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr, TkTextTag *tagPtr, int withTag); static void TextInvalidateLineMetrics(TkText *textPtr, TkTextLine *linePtr, int lineCount, TkTextInvalidateAction action); static int CalculateDisplayLineHeight(TkText *textPtr, const TkTextIndex *indexPtr, int *byteCountPtr, int *mergedLinePtr); static void DlineIndexOfX(TkText *textPtr, DLine *dlPtr, int x, TkTextIndex *indexPtr); static int DlineXOfIndex(TkText *textPtr, DLine *dlPtr, int byteIndex); static int TextGetScrollInfoObj(Tcl_Interp *interp, TkText *textPtr, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); static void AsyncUpdateLineMetrics(void *clientData); static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync); static void AsyncUpdateYScrollbar(void *clientData); static int IsStartOfNotMergedLine(const TkText *textPtr, const TkTextIndex *indexPtr); /* * Result values returned by TextGetScrollInfoObj: */ #define TKTEXT_SCROLL_MOVETO 1 |
︙ | ︙ | |||
764 765 766 767 768 769 770 | * A new entry may be created in the style table for the widget. * *---------------------------------------------------------------------- */ static TextStyle * GetStyle( | | | > | | | | | | | | 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 | * A new entry may be created in the style table for the widget. * *---------------------------------------------------------------------- */ static TextStyle * GetStyle( const TkText *textPtr, /* Overall information about text widget. */ const TkTextIndex *indexPtr)/* The character in the text for which display * information is wanted. */ { TkTextTag **tagPtrs; TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; Tcl_Size 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. */ Tcl_Size borderPrio, borderWidthPrio, reliefPrio, bgStipplePrio; Tcl_Size fgPrio, fontPrio, fgStipplePrio; Tcl_Size underlinePrio, elidePrio, justifyPrio, offsetPrio; Tcl_Size lMargin1Prio, lMargin2Prio, rMarginPrio; Tcl_Size lMarginColorPrio, rMarginColorPrio; Tcl_Size spacing1Prio, spacing2Prio, spacing3Prio; Tcl_Size overstrikePrio, tabPrio, tabStylePrio, wrapPrio; /* * Find out what tags are present for the character, then compute a * StyleValues structure corresponding to those tags (scan through all of * the tags, saving information for the highest-priority tag). */ |
︙ | ︙ | |||
870 871 872 873 874 875 876 | } if ((tagPtr->borderWidthPtr != NULL) && (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0') && (tagPtr->priority > borderWidthPrio)) { styleValues.borderWidth = tagPtr->borderWidth; borderWidthPrio = tagPtr->priority; } | | | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | } if ((tagPtr->borderWidthPtr != NULL) && (Tcl_GetString(tagPtr->borderWidthPtr)[0] != '\0') && (tagPtr->priority > borderWidthPrio)) { styleValues.borderWidth = tagPtr->borderWidth; borderWidthPrio = tagPtr->priority; } if ((tagPtr->relief != TK_RELIEF_NULL) && (tagPtr->priority > reliefPrio)) { if (styleValues.border == NULL) { styleValues.border = textPtr->border; } styleValues.relief = tagPtr->relief; reliefPrio = tagPtr->priority; } |
︙ | ︙ | |||
896 897 898 899 900 901 902 | fontPrio = tagPtr->priority; } if ((tagPtr->fgStipple != None) && (tagPtr->priority > fgStipplePrio)) { styleValues.fgStipple = tagPtr->fgStipple; fgStipplePrio = tagPtr->priority; } | | | | | | | | | | | > | | | | | | 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 | fontPrio = tagPtr->priority; } if ((tagPtr->fgStipple != None) && (tagPtr->priority > fgStipplePrio)) { styleValues.fgStipple = tagPtr->fgStipple; fgStipplePrio = tagPtr->priority; } if ((tagPtr->justify != TK_JUSTIFY_NULL) && (tagPtr->priority > justifyPrio)) { styleValues.justify = tagPtr->justify; justifyPrio = tagPtr->priority; } if ((tagPtr->lMargin1 != INT_MIN) && (tagPtr->priority > lMargin1Prio)) { styleValues.lMargin1 = tagPtr->lMargin1; lMargin1Prio = tagPtr->priority; } if ((tagPtr->lMargin2 != INT_MIN) && (tagPtr->priority > lMargin2Prio)) { styleValues.lMargin2 = tagPtr->lMargin2; lMargin2Prio = tagPtr->priority; } if ((tagPtr->lMarginColor != NULL) && (tagPtr->priority > lMarginColorPrio)) { styleValues.lMarginColor = tagPtr->lMarginColor; lMarginColorPrio = tagPtr->priority; } if ((tagPtr->offset != INT_MIN) && (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; } } if ((tagPtr->rMargin != INT_MIN) && (tagPtr->priority > rMarginPrio)) { styleValues.rMargin = tagPtr->rMargin; rMarginPrio = tagPtr->priority; } if ((tagPtr->rMarginColor != NULL) && (tagPtr->priority > rMarginColorPrio)) { styleValues.rMarginColor = tagPtr->rMarginColor; rMarginColorPrio = tagPtr->priority; } if ((tagPtr->spacing1 != INT_MIN) && (tagPtr->priority > spacing1Prio)) { styleValues.spacing1 = tagPtr->spacing1; spacing1Prio = tagPtr->priority; } if ((tagPtr->spacing2 != INT_MIN) && (tagPtr->priority > spacing2Prio)) { styleValues.spacing2 = tagPtr->spacing2; spacing2Prio = tagPtr->priority; } if ((tagPtr->spacing3 != INT_MIN) && (tagPtr->priority > spacing3Prio)) { styleValues.spacing3 = tagPtr->spacing3; 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_NULL) && (tagPtr->priority > wrapPrio)) { styleValues.wrapMode = tagPtr->wrapMode; wrapPrio = tagPtr->priority; } |
︙ | ︙ | |||
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. */ | > | | | 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | 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. */ TkTextTabStyle 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. */ Tcl_Size byteOffset; int ascent, descent, code, elide, elidesize; StyleValues *sValuePtr; TkTextElideInfo info; /* Keep track of elide state. */ /* * Create and initialize a new DLine structure. */ |
︙ | ︙ | |||
1214 1215 1216 1217 1218 1219 1220 | * Special case entirely elide line as there may be 1000s or more. */ elide = TkTextIsElided(textPtr, indexPtr, &info); if (elide && indexPtr->byteIndex == 0) { maxBytes = 0; for (segPtr = info.segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { | | | 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | * Special case entirely elide line as there may be 1000s or more. */ elide = TkTextIsElided(textPtr, indexPtr, &info); if (elide && indexPtr->byteIndex == 0) { maxBytes = 0; for (segPtr = info.segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->size > 0) { if (elide == 0) { /* * We toggled a tag and the elide state changed to * visible, and we have something of non-zero size. * Therefore we must bail out. */ |
︙ | ︙ | |||
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; } } } } } |
︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | * TkTextIndexToSeg for this because it won't return a segment with zero * size (such as the insertion cursor's mark). */ connectNextLogicalLine: byteOffset = curIndex.byteIndex; segPtr = curIndex.linePtr->segPtr; | | | 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | * TkTextIndexToSeg for this because it won't return a segment with zero * size (such as the insertion cursor's mark). */ connectNextLogicalLine: byteOffset = curIndex.byteIndex; segPtr = curIndex.linePtr->segPtr; while ((byteOffset > 0) && (byteOffset >= segPtr->size)) { byteOffset -= segPtr->size; segPtr = segPtr->nextPtr; if (segPtr == NULL) { /* * Two logical lines merged into one display line through eliding * of a newline. |
︙ | ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | * may wish to redesign the code to remove these zero height DLines in * the future. */ if (elide && (lastChunkPtr != NULL) && (lastChunkPtr->displayProc == NULL /*ElideDisplayProc*/)) { elidesize = segPtr->size - byteOffset; | | | | | 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 | * may wish to redesign the code to remove these zero height DLines in * the future. */ if (elide && (lastChunkPtr != NULL) && (lastChunkPtr->displayProc == NULL /*ElideDisplayProc*/)) { elidesize = segPtr->size - byteOffset; if (segPtr->size > byteOffset) { curIndex.byteIndex += elidesize; lastChunkPtr->numBytes += elidesize; breakByteOffset = lastChunkPtr->breakIndex = lastChunkPtr->numBytes; /* * 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. */ |
︙ | ︙ | |||
2500 2501 2502 2503 2504 2505 2506 | /* * Make another pass through all of the chunks to redraw the insertion * cursor, if it is visible on this line. Must do it here rather than in * the foreground pass below because otherwise a wide insertion cursor * will obscure the character to its left. */ | | | 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 | /* * Make another pass through all of the chunks to redraw the insertion * cursor, if it is visible on this line. Must do it here rather than in * the foreground pass below because otherwise a wide insertion cursor * will obscure the character to its left. */ if (textPtr->state != TK_TEXT_STATE_DISABLED) { for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { if (chunkPtr->displayProc == TkTextInsertDisplayProc) { int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset; chunkPtr->displayProc(textPtr, chunkPtr, x, y + dlPtr->spaceAbove, |
︙ | ︙ | |||
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++; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
3001 3002 3003 3004 3005 3006 3007 | * Line heights may be recalculated. * *---------------------------------------------------------------------- */ static void AsyncUpdateLineMetrics( | | | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 | * Line heights may be recalculated. * *---------------------------------------------------------------------- */ static void AsyncUpdateLineMetrics( void *clientData) /* Information about widget. */ { TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; dInfoPtr->lineUpdateTimer = NULL; |
︙ | ︙ | |||
3051 3052 3053 3054 3055 3056 3057 | dInfoPtr->lastMetricUpdateLine, 256); dInfoPtr->currentMetricUpdateLine = lineNum; if (tkTextDebug) { char buffer[2 * TCL_INTEGER_SPACE + 1]; | | | | | | 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 | dInfoPtr->lastMetricUpdateLine, 256); dInfoPtr->currentMetricUpdateLine = lineNum; if (tkTextDebug) { char buffer[2 * TCL_INTEGER_SPACE + 1]; snprintf(buffer, sizeof(buffer), "%d %d", lineNum, dInfoPtr->lastMetricUpdateLine); LOG("tk_textInvalidateLine", buffer); } /* * If we're not in the middle of a long-line calculation (metricEpoch==-1) * and we've reached the last line, then we're done. */ if (dInfoPtr->metricEpoch == -1 && lineNum == dInfoPtr->lastMetricUpdateLine) { /* * We have looped over all lines, so we're done. We must release our * refCount on the widget (the timer token was already set to NULL * above). If there is a registered aftersync command, run that first. * 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 |
︙ | ︙ | |||
3244 3245 3246 3247 3248 3249 3250 | } /* * If we're in the middle of a partial-line height calculation, * then we can't be done. */ | | | | 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 | } /* * If we're in the middle of a partial-line height calculation, * then we can't be done. */ if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) { /* * We have looped over all lines, so we're done. */ break; } } if (lineNum < totalLines) { if (tkTextDebug) { char buffer[4 * TCL_INTEGER_SPACE + 3]; snprintf(buffer, sizeof(buffer), "%d %d %d %d", lineNum, endLine, totalLines, count); LOG("tk_textInvalidateLine", buffer); } /* * Now update the line's metrics if necessary. */ |
︙ | ︙ | |||
3416 3417 3418 3419 3420 3421 3422 | * May schedule an asychronous callback. * *---------------------------------------------------------------------- */ void TkTextInvalidateLineMetrics( | | | | | | | | | | | | | | 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 | * May schedule an asychronous callback. * *---------------------------------------------------------------------- */ void TkTextInvalidateLineMetrics( TkSharedText *sharedTextPtr, /* Shared widget section for all peers, or * NULL. */ TkText *textPtr, /* Widget record for text widget. */ TkTextLine *linePtr, /* Invalidation starts from this line. */ int lineCount, /* And includes this many following lines. */ TkTextInvalidateAction action) /* Indicates what type of invalidation * occurred, TK_TEXT_INVALIDATE_(ONLY|INSERT|DELETE). */ { if (sharedTextPtr == NULL) { TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action); } else { textPtr = sharedTextPtr->peers; while (textPtr != NULL) { TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action); textPtr = textPtr->next; } } } static void TextInvalidateLineMetrics( TkText *textPtr, /* Widget record for text widget. */ TkTextLine *linePtr, /* Invalidation starts from this line. */ int lineCount, /* And includes this many following lines. */ TkTextInvalidateAction action) /* Indicates what type of invalidation * occurred, TK_TEXT_INVALIDATE_(ONLY|INSERT|DELETE). */ { int fromLine; TextDInfo *dInfoPtr = textPtr->dInfoPtr; if (linePtr != NULL) { int counter = lineCount; |
︙ | ︙ | |||
3659 3660 3661 3662 3663 3664 3665 | index = endOfLastLine; index.byteIndex = 0; } while (1) { DLine *dlPtr; | | | 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 | index = endOfLastLine; index.byteIndex = 0; } while (1) { DLine *dlPtr; Tcl_Size byteCount; TkTextIndex nextLineStart; dlPtr = LayoutDLine(textPtr, &index); byteCount = dlPtr->byteCount; TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart); |
︙ | ︙ | |||
4129 4130 4131 4132 4133 4134 4135 | if (tkTextDebug) { char buffer[2 * TCL_INTEGER_SPACE + 1]; if (TkBTreeNextLine(textPtr, linePtr) == NULL) { Tcl_Panic("Mustn't ever update line height of last artificial line"); } | | | 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 | if (tkTextDebug) { char buffer[2 * TCL_INTEGER_SPACE + 1]; if (TkBTreeNextLine(textPtr, linePtr) == NULL) { Tcl_Panic("Mustn't ever update line height of last artificial line"); } snprintf(buffer, sizeof(buffer), "%d %d", TkBTreeLinesTo(textPtr,linePtr), pixelHeight); LOG("tk_textNumPixels", buffer); } if (textPtr->dInfoPtr->scrollbarTimer == NULL) { textPtr->refCount++; textPtr->dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200, AsyncUpdateYScrollbar, textPtr); } |
︙ | ︙ | |||
4159 4160 4161 4162 4163 4164 4165 | * Information is redrawn on the screen. * *---------------------------------------------------------------------- */ static void DisplayText( | | | 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 | * Information is redrawn on the screen. * *---------------------------------------------------------------------- */ static void DisplayText( void *clientData) /* Information about widget. */ { TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; DLine *prevPtr; Pixmap pixmap; int maxHeight, borders; |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
4630 4631 4632 4633 4634 4635 4636 | * clear REDRAW_PENDING here, just in case the scroll function does * something that requires redisplay. */ doScrollbars: if (textPtr->flags & UPDATE_SCROLLBARS) { textPtr->flags &= ~UPDATE_SCROLLBARS; | | | | 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 | * clear REDRAW_PENDING here, just in case the scroll function does * something that requires redisplay. */ doScrollbars: if (textPtr->flags & UPDATE_SCROLLBARS) { textPtr->flags &= ~UPDATE_SCROLLBARS; if (textPtr->yScrollCmdObj != NULL) { GetYView(textPtr->interp, textPtr, 1); } if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * The widget has been deleted. Don't do anything. */ goto end; } /* * Update the horizontal scrollbar, if any. */ if (textPtr->xScrollCmdObj != NULL) { GetXView(textPtr->interp, textPtr, 1); } } end: Tcl_Release(interp); } |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
5713 5714 5715 5716 5717 5718 5719 | *-------------------------------------------------------------- */ int TkTextSeeCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 | *-------------------------------------------------------------- */ int TkTextSeeCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "see". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; TkTextIndex index; int x, y, width, height, lineWidth, byteCount, oneThird, delta; |
︙ | ︙ | |||
5849 5850 5851 5852 5853 5854 5855 | *-------------------------------------------------------------- */ int TkTextXviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 | *-------------------------------------------------------------- */ int TkTextXviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "xview". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; int type, count; double fraction; |
︙ | ︙ | |||
6150 6151 6152 6153 6154 6155 6156 | *-------------------------------------------------------------- */ int TkTextYviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | *-------------------------------------------------------------- */ int TkTextYviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "yview". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; int pickPlace, type; int pixels, count; Tcl_Size switchLength; double fraction; TkTextIndex index; if (dInfoPtr->flags & DINFO_OUT_OF_DATE) { UpdateDisplayInfo(textPtr); } if (objc == 2) { GetYView(interp, textPtr, 0); return TCL_OK; } /* * 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; |
︙ | ︙ | |||
6357 6358 6359 6360 6361 6362 6363 | *-------------------------------------------------------------- */ int TkTextScanCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | < | 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 | *-------------------------------------------------------------- */ int TkTextScanCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "scan". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; TkTextIndex index; int c, x, y, totalScroll, gain=10; Tcl_Size length; if ((objc != 5) && (objc != 6)) { Tcl_WrongNumArgs(interp, 2, objv, "mark x y"); Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]), " scan dragto x y ?gain?\"", (char *)NULL); /* * Ought to be: * Tcl_WrongNumArgs(interp, 2, objc, "dragto x y ?gain?"); */ return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) { return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) { return TCL_ERROR; } if ((objc == 6) && (Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) { return TCL_ERROR; } c = Tcl_GetStringFromObj(objv[2], &length)[0]; if (c=='d' && strncmp(Tcl_GetString(objv[2]), "dragto", length)==0) { int newX, maxX; /* * Amplify the difference between the current position and the mark * position to compute how much the view should shift, then update the * mark position to correspond to the new view. If we run off the edge |
︙ | ︙ | |||
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( | | | | 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 | } 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]), (char *)NULL); return TCL_ERROR; } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
6477 6478 6479 6480 6481 6482 6483 | */ static void GetXView( Tcl_Interp *interp, /* If "report" is FALSE, string describing * visible range gets stored in the interp's * result. */ | | | 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 | */ static void GetXView( Tcl_Interp *interp, /* If "report" is FALSE, string describing * visible range gets stored in the interp's * result. */ const TkText *textPtr, /* Information about text widget. */ int report) /* Non-zero means report info to scrollbar if * it has changed. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; double first, last; int code; Tcl_Obj *listObj; |
︙ | ︙ | |||
6511 6512 6513 6514 6515 6516 6517 | } if (FP_EQUAL_SCALE(first, dInfoPtr->xScrollFirst, dInfoPtr->maxLength) && FP_EQUAL_SCALE(last, dInfoPtr->xScrollLast, dInfoPtr->maxLength)) { return; } dInfoPtr->xScrollFirst = first; dInfoPtr->xScrollLast = last; | | | | | | | 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 | } if (FP_EQUAL_SCALE(first, dInfoPtr->xScrollFirst, dInfoPtr->maxLength) && FP_EQUAL_SCALE(last, dInfoPtr->xScrollLast, dInfoPtr->maxLength)) { return; } dInfoPtr->xScrollFirst = first; dInfoPtr->xScrollLast = last; if (textPtr->xScrollCmdObj != NULL) { char buf1[TCL_DOUBLE_SPACE+1]; char buf2[TCL_DOUBLE_SPACE+1]; Tcl_DString buf; buf1[0] = ' '; buf2[0] = ' '; Tcl_PrintDouble(NULL, first, buf1+1); Tcl_PrintDouble(NULL, last, buf2+1); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Tcl_GetString(textPtr->xScrollCmdObj), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf1, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf2, TCL_INDEX_NONE); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (horizontal scrolling command executed by text)"); Tcl_BackgroundException(interp, code); } } |
︙ | ︙ | |||
6796 6797 6798 6799 6800 6801 6802 | if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalPixels) && FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalPixels)) { return; } dInfoPtr->yScrollFirst = first; dInfoPtr->yScrollLast = last; | | | | | | | 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 | if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalPixels) && FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalPixels)) { return; } dInfoPtr->yScrollFirst = first; dInfoPtr->yScrollLast = last; if (textPtr->yScrollCmdObj != NULL) { char buf1[TCL_DOUBLE_SPACE+1]; char buf2[TCL_DOUBLE_SPACE+1]; Tcl_DString buf; buf1[0] = ' '; buf2[0] = ' '; Tcl_PrintDouble(NULL, first, buf1+1); Tcl_PrintDouble(NULL, last, buf2+1); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Tcl_GetString(textPtr->yScrollCmdObj), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf1, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, buf2, TCL_INDEX_NONE); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (vertical scrolling command executed by text)"); Tcl_BackgroundException(interp, code); } } |
︙ | ︙ | |||
6839 6840 6841 6842 6843 6844 6845 | * changed. * *---------------------------------------------------------------------- */ static void AsyncUpdateYScrollbar( | | | 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 | * changed. * *---------------------------------------------------------------------- */ static void AsyncUpdateYScrollbar( void *clientData) /* Information about widget. */ { TkText *textPtr = (TkText *)clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; if (!(textPtr->flags & DESTROYED)) { GetYView(textPtr->interp, textPtr, 1); |
︙ | ︙ | |||
6986 6987 6988 6989 6990 6991 6992 | * None. * *---------------------------------------------------------------------- */ static int IsStartOfNotMergedLine( | | | 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 | * None. * *---------------------------------------------------------------------- */ static int IsStartOfNotMergedLine( const TkText *textPtr, /* Widget record for text widget. */ const TkTextIndex *indexPtr) /* Index to check. */ { TkTextIndex indexPtr2; if (indexPtr->byteIndex != 0) { /* * Not the start of a logical line. |
︙ | ︙ | |||
7347 7348 7349 7350 7351 7352 7353 | * line and therefore takes up a very large * width, this is used to return the smaller * width actually desired by the index. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; TkTextDispChunk *chunkPtr; | | | 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 | * line and therefore takes up a very large * width, this is used to return the smaller * width actually desired by the index. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; TkTextDispChunk *chunkPtr; Tcl_Size byteCount; /* * Make sure that all of the screen layout information is up to date. */ if (dInfoPtr->flags & DINFO_OUT_OF_DATE) { UpdateDisplayInfo(textPtr); |
︙ | ︙ | |||
7540 7541 7542 7543 7544 7545 7546 | * Get bounding-box information about an elided chunk. */ static void ElideBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ | | | 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 | * Get bounding-box information about an elided chunk. */ static void ElideBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ TCL_UNUSED(Tcl_Size), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ TCL_UNUSED(int), /* Height of line, in pixels. */ TCL_UNUSED(int), /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's |
︙ | ︙ | |||
7565 7566 7567 7568 7569 7570 7571 | *widthPtr = *heightPtr = 0; } /* * Measure an elided chunk. */ | | | 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 | *widthPtr = *heightPtr = 0; } /* * Measure an elided chunk. */ static Tcl_Size ElideMeasureProc( TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */ TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { return 0 /*chunkPtr->numBytes - 1*/; } |
︙ | ︙ | |||
7601 7602 7603 7604 7605 7606 7607 | int TkTextCharLayoutProc( TCL_UNUSED(TkText *), /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out * (corresponds to segPtr and offset). */ TkTextSegment *segPtr, /* Segment being layed out. */ | | | | | 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 | int TkTextCharLayoutProc( TCL_UNUSED(TkText *), /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out * (corresponds to segPtr and offset). */ TkTextSegment *segPtr, /* Segment being layed out. */ Tcl_Size byteOffset, /* Byte offset within segment of first * character to consider. */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ Tcl_Size maxBytes, /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this display line yet. */ TkWrapMode wrapMode, /* How to handle line wrapping: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { Tk_Font tkfont; int nextX, count; Tcl_Size bytesThatFit; CharInfo *ciPtr; char *p; TkTextSegment *nextPtr; Tk_FontMetrics fm; #ifdef TK_LAYOUT_WITH_BASE_CHUNKS const char *line; int lineOffset; |
︙ | ︙ | |||
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; | | | | | 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 | 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; |
︙ | ︙ | |||
7684 7685 7686 7687 7688 7689 7690 | bytesThatFit = CharChunkMeasureChars(chunkPtr, p, maxBytes, 0, -1, chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (bytesThatFit + 1 <= maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { int ch; | | | 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 | bytesThatFit = CharChunkMeasureChars(chunkPtr, p, maxBytes, 0, -1, chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (bytesThatFit + 1 <= maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { int ch; int chLen = Tcl_UtfToUniChar(p, &ch); #ifdef TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars(chunkPtr, line, lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0, &nextX); #else /* !TK_LAYOUT_WITH_BASE_CHUNKS */ bytesThatFit = CharChunkMeasureChars(chunkPtr, p, chLen, 0, -1, |
︙ | ︙ | |||
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; | | | 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 | 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') { |
︙ | ︙ | |||
7857 7858 7859 7860 7861 7862 7863 | * didn't fit would be drawn, if it were to be drawn. * * Side effects: * None. *-------------------------------------------------------------- */ | | | 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 | * didn't fit would be drawn, if it were to be drawn. * * Side effects: * None. *-------------------------------------------------------------- */ static Tcl_Size CharChunkMeasureChars( TkTextDispChunk *chunkPtr, /* Chunk from which to measure. */ const char *chars, /* Chars to use, instead of the chunk's own. * Used by the layoutproc during chunk setup. * All other callers use NULL. Not * NUL-terminated. */ int charsLen, /* Length of the "chars" parameter. */ |
︙ | ︙ | |||
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; | | | 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 | 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; } |
︙ | ︙ | |||
7970 7971 7972 7973 7974 7975 7976 | TCL_UNUSED(int)) /* Y-coordinate in text window that * corresponds to y. */ { CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; | | > | | 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 | TCL_UNUSED(int)) /* Y-coordinate in text window that * corresponds to y. */ { CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; Tcl_Size numBytes, offsetBytes; int offsetX; #ifdef TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ if ((x + chunkPtr->width) <= 0) { /* * 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. |
︙ | ︙ | |||
8167 8168 8169 8170 8171 8172 8173 | * * Side effects: * None. * *-------------------------------------------------------------- */ | | | 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 | * * Side effects: * None. * *-------------------------------------------------------------- */ static Tcl_Size CharMeasureProc( TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */ int x) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { int endX; |
︙ | ︙ | |||
8205 8206 8207 8208 8209 8210 8211 | *-------------------------------------------------------------- */ static void CharBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ | | | 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 | *-------------------------------------------------------------- */ static void CharBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ Tcl_Size byteIndex, /* Byte offset of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ TCL_UNUSED(int), /* Height of line, in pixels. */ int baseline, /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's |
︙ | ︙ | |||
8469 8470 8471 8472 8473 8474 8475 | *---------------------------------------------------------------------- */ static int SizeOfTab( TkText *textPtr, /* Information about the text widget as a * whole. */ | | | 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 | *---------------------------------------------------------------------- */ static int SizeOfTab( TkText *textPtr, /* Information about the text widget as a * whole. */ TkTextTabStyle tabStyle, /* One of TK_TEXT_TABSTYLE_TABULAR * or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply * to this line. NULL means use default * tabbing (every 8 chars.) */ int *indexPtr, /* Contains index of previous tab stop, will * be updated to reflect the number of stops * used. */ |
︙ | ︙ | |||
8655 8656 8657 8658 8659 8660 8661 | * * Side effects: * None. * *-------------------------------------------------------------- */ | | | 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 | * * Side effects: * None. * *-------------------------------------------------------------- */ static Tcl_Size MeasureChars( Tk_Font tkfont, /* Font in which to draw characters. */ const char *source, /* Characters to be displayed. Need not be * NULL-terminated. */ int maxBytes, /* Maximum # of bytes to consider from * source. */ int rangeStart, int rangeLength, |
︙ | ︙ | |||
8763 8764 8765 8766 8767 8768 8769 | *---------------------------------------------------------------------- */ static int TextGetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about the text widget. */ | | | 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 | *---------------------------------------------------------------------- */ static int TextGetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about the text widget. */ Tcl_Size objc, /* # arguments for command. */ 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 or * pixels to scroll, if any. */ { static const char *const subcommands[] = { |
︙ | ︙ | |||
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 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 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Macro that determines the size of an embedded image segment: */ #define EI_SEG_SIZE \ (offsetof(TkTextSegment, body) + sizeof(TkTextEmbImage)) /* * Prototypes for functions defined in this file: */ static TkTextSegment * EmbImageCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbImageCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbImageBboxProc(TkText *textPtr, TkTextDispChunk *chunkPtr, Tcl_Size index, int y, int lineHeight, int baseline, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int EmbImageConfigure(TkText *textPtr, TkTextSegment *eiPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int EmbImageDeleteProc(TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); static void EmbImageDisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr, int x, int y, int lineHeight, int baseline, Display *display, Drawable dst, int screenY); static int EmbImageLayoutProc(TkText *textPtr, TkTextIndex *indexPtr, TkTextSegment *segPtr, Tcl_Size offset, int maxX, Tcl_Size maxChars, int noCharsYet, TkWrapMode wrapMode, TkTextDispChunk *chunkPtr); static void EmbImageProc(void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); /* * The following structure declares the "embedded image" segment type. */ |
︙ | ︙ | |||
69 70 71 72 73 74 75 | * Definitions for alignment values: */ static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; | < < < < | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | * Definitions for alignment values: */ static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; /* * Information used for parsing image configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", TCL_INDEX_NONE, offsetof(TkTextEmbImage, align), TK_OPTION_ENUM_VAR, alignStrings, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padY), 0, 0, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageString), TK_OPTION_NULL_OK, 0, 0}, |
︙ | ︙ | |||
115 116 117 118 119 120 121 | *-------------------------------------------------------------- */ int TkTextImageCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | *-------------------------------------------------------------- */ int TkTextImageCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "image". */ { int idx; TkTextSegment *eiPtr; TkTextIndex index; |
︙ | ︙ | |||
154 155 156 157 158 159 160 | return TCL_ERROR; } eiPtr = TkTextIndexToSeg(&index, NULL); if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | return TCL_ERROR; } eiPtr = TkTextIndexToSeg(&index, NULL); if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", (char *)NULL); return TCL_ERROR; } objPtr = Tk_GetOptionValue(interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } else { |
︙ | ︙ | |||
179 180 181 182 183 184 185 | return TCL_ERROR; } eiPtr = TkTextIndexToSeg(&index, NULL); if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | return TCL_ERROR; } eiPtr = TkTextIndexToSeg(&index, NULL); if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", (char *)NULL); return TCL_ERROR; } if (objc <= 5) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); |
︙ | ︙ | |||
247 248 249 250 251 252 253 | eiPtr->size = 1; eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr; eiPtr->body.ei.linePtr = NULL; eiPtr->body.ei.imageName = NULL; eiPtr->body.ei.imageString = NULL; eiPtr->body.ei.name = NULL; eiPtr->body.ei.image = NULL; | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | eiPtr->size = 1; eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr; eiPtr->body.ei.linePtr = NULL; eiPtr->body.ei.imageName = NULL; eiPtr->body.ei.imageString = NULL; eiPtr->body.ei.name = NULL; eiPtr->body.ei.image = NULL; eiPtr->body.ei.align = TK_ALIGN_CENTER; eiPtr->body.ei.padX = eiPtr->body.ei.padY = 0; eiPtr->body.ei.chunkCount = 0; eiPtr->body.ei.optionTable = Tk_CreateOptionTable(interp, optionSpecs); /* * Link the segment into the text widget, then configure it (delete it * again if the configuration fails). |
︙ | ︙ | |||
323 324 325 326 327 328 329 | */ static int EmbImageConfigure( TkText *textPtr, /* Information about text widget that contains * embedded image. */ TkTextSegment *eiPtr, /* Embedded image to be configured. */ | | < | < < < | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | */ static int EmbImageConfigure( TkText *textPtr, /* Information about text widget that contains * embedded image. */ TkTextSegment *eiPtr, /* Embedded image to be configured. */ Tcl_Size objc, /* Number of strings in objv. */ Tcl_Obj *const objv[]) /* Array of strings describing configuration * options. */ { Tk_Image image; Tcl_DString newName; Tcl_HashEntry *hPtr; char *name; int dummy, length; if (Tk_SetOptions(textPtr->interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
381 382 383 384 385 386 387 | name = eiPtr->body.ei.imageName; if (name == NULL) { name = eiPtr->body.ei.imageString; } if (name == NULL) { Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj( "Either a \"-name\" or a \"-image\" argument must be" | | | < < < < < < < < < < < < < < < < < < < | < | | | | > > > | < | | > | 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 | name = eiPtr->body.ei.imageName; if (name == NULL) { name = eiPtr->body.ei.imageString; } if (name == NULL) { Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj( "Either a \"-name\" or a \"-image\" argument must be" " provided to the \"image create\" subcommand", TCL_INDEX_NONE)); Tcl_SetErrorCode(textPtr->interp, "TK", "TEXT", "IMAGE_CREATE_USAGE", (char *)NULL); return TCL_ERROR; } Tcl_DStringInit(&newName); while (Tcl_FindHashEntry(&textPtr->sharedTextPtr->imageTable, name)) { char buf[4 + TCL_INTEGER_SPACE]; snprintf(buf, sizeof(buf), "#%d", ++textPtr->sharedTextPtr->imageCount); Tcl_DStringSetLength(&newName, 0); Tcl_DStringAppend(&newName, name, TCL_INDEX_NONE); Tcl_DStringAppend(&newName, buf, TCL_INDEX_NONE); name = Tcl_DStringValue(&newName); } length = strlen(name); hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->imageTable, name, &dummy); Tcl_SetHashValue(hPtr, eiPtr); eiPtr->body.ei.name = (char *)ckalloc(length + 1); memcpy(eiPtr->body.ei.name, name, length + 1); Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, TCL_INDEX_NONE)); Tcl_DStringFree(&newName); return TCL_OK; } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
474 475 476 477 478 479 480 | } /* * No need to supply a tkwin argument, since we have no window-specific * options. */ | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | } /* * No need to supply a tkwin argument, since we have no window-specific * options. */ Tk_FreeConfigOptions(&eiPtr->body.ei, eiPtr->body.ei.optionTable, NULL); if (eiPtr->body.ei.name) { ckfree(eiPtr->body.ei.name); } ckfree(eiPtr); return 0; } |
︙ | ︙ | |||
531 532 533 534 535 536 537 | */ static int EmbImageLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */ | | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | */ static int EmbImageLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */ Tcl_Size offset, /* Offset within segPtr corresponding to * indexPtr (always 0). */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ TCL_UNUSED(Tcl_Size), /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ TkTextDispChunk *chunkPtr) |
︙ | ︙ | |||
579 580 581 582 583 584 585 | */ chunkPtr->displayProc = EmbImageDisplayProc; chunkPtr->undisplayProc = NULL; chunkPtr->measureProc = NULL; chunkPtr->bboxProc = EmbImageBboxProc; chunkPtr->numBytes = 1; | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | */ chunkPtr->displayProc = EmbImageDisplayProc; chunkPtr->undisplayProc = NULL; chunkPtr->measureProc = NULL; chunkPtr->bboxProc = EmbImageBboxProc; chunkPtr->numBytes = 1; if (eiPtr->body.ei.align == TK_ALIGN_BASELINE) { chunkPtr->minAscent = height - eiPtr->body.ei.padY; chunkPtr->minDescent = eiPtr->body.ei.padY; chunkPtr->minHeight = 0; } else { chunkPtr->minAscent = 0; chunkPtr->minDescent = 0; chunkPtr->minHeight = height; |
︙ | ︙ | |||
713 714 715 716 717 718 719 | *-------------------------------------------------------------- */ static void EmbImageBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ | | | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | *-------------------------------------------------------------- */ static void EmbImageBboxProc( TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ TCL_UNUSED(Tcl_Size), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ int lineHeight, /* Total height of line. */ int baseline, /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's |
︙ | ︙ | |||
741 742 743 744 745 746 747 | *widthPtr = 0; *heightPtr = 0; } *xPtr = chunkPtr->x + eiPtr->body.ei.padX; switch (eiPtr->body.ei.align) { | | | | | | | | | | > > > > > > > > > > > | | 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 | *widthPtr = 0; *heightPtr = 0; } *xPtr = chunkPtr->x + eiPtr->body.ei.padX; switch (eiPtr->body.ei.align) { case TK_ALIGN_BOTTOM: *yPtr = y + (lineHeight - *heightPtr - eiPtr->body.ei.padY); break; case TK_ALIGN_CENTER: *yPtr = y + (lineHeight - *heightPtr)/2; break; case TK_ALIGN_TOP: *yPtr = y + eiPtr->body.ei.padY; break; case TK_ALIGN_BASELINE: *yPtr = y + (baseline - *heightPtr); break; } } /* *-------------------------------------------------------------- * * 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 -- * |
︙ | ︙ | |||
818 819 820 821 822 823 824 | * The image will be redisplayed. * *-------------------------------------------------------------- */ static void EmbImageProc( | | | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | * The image will be redisplayed. * *-------------------------------------------------------------- */ static void EmbImageProc( void *clientData, /* Pointer to widget record. */ TCL_UNUSED(int), /* Upper left pixel (within image) that must * be redisplayed. */ TCL_UNUSED(int), TCL_UNUSED(int), /* Dimensions of area to redisplay (may be * <= 0). */ TCL_UNUSED(int), TCL_UNUSED(int),/* New dimensions of image. */ |
︙ | ︙ |
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 16 17 18 19 20 21 22 23 24 25 26 27 | /* * 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" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Index to use to select last character in line (very large integer): */ #define LAST_CHAR 1000000 |
︙ | ︙ | |||
67 68 69 70 71 72 73 | ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch)) /* * Define the 'textindex' object type, which Tk uses to represent indices in * text widgets internally. */ | | | | > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch)) /* * Define the 'textindex' object type, which Tk uses to represent indices in * text widgets internally. */ const TkObjType tkTextIndexType = { {"textindex", /* name */ FreeTextIndexInternalRep, /* freeIntRepProc */ DupTextIndexInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; static void FreeTextIndexInternalRep( Tcl_Obj *indexObjPtr) /* TextIndex object with internal rep to * free. */ { |
︙ | ︙ | |||
100 101 102 103 104 105 106 | } static void DupTextIndexInternalRep( Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */ { | | | | 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 | } static void DupTextIndexInternalRep( Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */ { Tcl_Size epoch; TkTextIndex *dupIndexPtr, *indexPtr; dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr = GET_TEXTINDEX(srcPtr); epoch = GET_INDEXEPOCH(srcPtr); dupIndexPtr->tree = indexPtr->tree; dupIndexPtr->linePtr = indexPtr->linePtr; dupIndexPtr->byteIndex = indexPtr->byteIndex; dupIndexPtr->textPtr = indexPtr->textPtr; if (dupIndexPtr->textPtr != NULL) { dupIndexPtr->textPtr->refCount++; } SET_TEXTINDEX(copyPtr, dupIndexPtr); SET_INDEXEPOCH(copyPtr, epoch); copyPtr->typePtr = &tkTextIndexType.objType; } /* * This will not be called except by TkTextNewIndexObj below. This is because * if a TkTextIndex is no longer valid, it is not possible to regenerate the * string representation. */ |
︙ | ︙ | |||
178 179 180 181 182 183 184 | { TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr->tree = origPtr->tree; indexPtr->linePtr = origPtr->linePtr; indexPtr->byteIndex = origPtr->byteIndex; SET_TEXTINDEX(objPtr, indexPtr); | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | { TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr->tree = origPtr->tree; indexPtr->linePtr = origPtr->linePtr; indexPtr->byteIndex = origPtr->byteIndex; SET_TEXTINDEX(objPtr, indexPtr); objPtr->typePtr = &tkTextIndexType.objType; indexPtr->textPtr = textPtr; if (textPtr != NULL) { textPtr->refCount++; SET_INDEXEPOCH(objPtr, textPtr->sharedTextPtr->stateEpoch); } else { SET_INDEXEPOCH(objPtr, 0); |
︙ | ︙ | |||
201 202 203 204 205 206 207 | Tcl_Obj *objPtr) /* Object containing description of * position. */ { TkTextIndex index; TkTextIndex *indexPtr = NULL; int cache; | | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | Tcl_Obj *objPtr) /* Object containing description of * position. */ { TkTextIndex index; TkTextIndex *indexPtr = NULL; int cache; if (objPtr->typePtr == &tkTextIndexType.objType) { Tcl_Size epoch; indexPtr = GET_TEXTINDEX(objPtr); epoch = GET_INDEXEPOCH(objPtr); if (epoch == textPtr->sharedTextPtr->stateEpoch) { if (indexPtr->textPtr == textPtr) { return indexPtr; |
︙ | ︙ | |||
377 378 379 380 381 382 383 | TkTextIndex * TkTextMakeByteIndex( TkTextBTree tree, /* Tree that lineIndex and byteIndex refer * to. */ const TkText *textPtr, int lineIndex, /* Index of desired line (0 means first line * of text). */ | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | TkTextIndex * TkTextMakeByteIndex( TkTextBTree tree, /* Tree that lineIndex and byteIndex refer * to. */ const TkText *textPtr, int lineIndex, /* Index of desired line (0 means first line * of text). */ Tcl_Size byteIndex, /* Byte index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { TkTextSegment *segPtr; int index; const char *p, *start; int ch; |
︙ | ︙ | |||
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); | | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | * 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 += Tcl_UtfToUniChar(p, &ch); indexPtr->byteIndex += p - start; } break; } index += segPtr->size; } return indexPtr; |
︙ | ︙ | |||
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; | | | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | * 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--; | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | 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; } |
︙ | ︙ | |||
561 562 563 564 565 566 567 | * *--------------------------------------------------------------------------- */ TkTextSegment * TkTextIndexToSeg( const TkTextIndex *indexPtr,/* Text index. */ | | | | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | * *--------------------------------------------------------------------------- */ TkTextSegment * TkTextIndexToSeg( const TkTextIndex *indexPtr,/* Text index. */ Tcl_Size *offsetPtr) /* Where to store offset within segment, or * NULL if offset isn't wanted. */ { TkTextSegment *segPtr; Tcl_Size offset; for (offset = indexPtr->byteIndex, segPtr = indexPtr->linePtr->segPtr; offset >= segPtr->size; offset -= segPtr->size, segPtr = segPtr->nextPtr) { /* Empty loop body. */ } if (offsetPtr != NULL) { |
︙ | ︙ | |||
596 597 598 599 600 601 602 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ | | | | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ Tcl_Size TkTextSegToOffset( const TkTextSegment *segPtr,/* Segment whose offset is desired. */ const TkTextLine *linePtr) /* Line containing segPtr. */ { const TkTextSegment *segPtr2; Tcl_Size offset = 0; for (segPtr2 = linePtr->segPtr; segPtr2 != segPtr; segPtr2 = segPtr2->nextPtr) { offset += segPtr2->size; } return offset; } |
︙ | ︙ | |||
757 758 759 760 761 762 763 | *--------------------------------------------------------------------- */ if (TkTextMarkNameToIndex(textPtr, string, indexPtr) == TCL_OK) { goto done; } | | | | | 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 | *--------------------------------------------------------------------- */ 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. *------------------------------------------------ */ indexPtr->tree = sharedPtr->tree; /* * First look for the form "tag.first" or "tag.last" where "tag" is the * name of a valid tag. Try to use up as much as possible of the string in * this check (strrchr instead of strchr below). Doing the check now, and * in this way, allows tag names to include funny characters like "@" or * "+1c". */ Tcl_DStringInit(©); p = strrchr(Tcl_DStringAppend(©, string, TCL_INDEX_NONE), '.'); if (p != NULL) { TkTextSearch search; TkTextTag *tagPtr; Tcl_HashEntry *hPtr = NULL; const char *tagName; if ((p[1] == 'f') && (strncmp(p+1, "first", 5) == 0)) { |
︙ | ︙ | |||
834 835 836 837 838 839 840 | } else if (hPtr != NULL) { tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "text doesn't contain any characters tagged with \"%s\"", tagName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TEXT_INDEX", tagName, | | | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | } else if (hPtr != NULL) { tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "text doesn't contain any characters tagged with \"%s\"", tagName)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TEXT_INDEX", tagName, (char *)NULL); Tcl_DStringFree(©); return TCL_ERROR; } *indexPtr = search.curIndex; if (wantLast) { while (TkBTreeNextTag(&search)) { *indexPtr = search.curIndex; |
︙ | ︙ | |||
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; | | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | * 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; | | | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | * 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 | 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)); | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | 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 | 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", (char *)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 * reading in again later. * * Results: * The characters pointed to by string are modified. Returns the number * of characters in the string. * * Side effects: * None. * *--------------------------------------------------------------------------- */ Tcl_Size TkTextPrintIndex( const TkText *textPtr, const TkTextIndex *indexPtr,/* Pointer to index. */ char *string) /* Place to store the position. Must have at * least TK_POS_CHARS characters. */ { TkTextSegment *segPtr; TkTextLine *linePtr; Tcl_Size numBytes, charIndex; numBytes = indexPtr->byteIndex; charIndex = 0; linePtr = indexPtr->linePtr; for (segPtr = linePtr->segPtr; ; segPtr = segPtr->nextPtr) { if (segPtr == NULL) { /* * Two logical lines merged into one display line through eliding * of a newline. */ linePtr = TkBTreeNextLine(NULL, linePtr); segPtr = linePtr->segPtr; } if (numBytes <= segPtr->size) { break; } if (segPtr->typePtr == &tkTextCharType) { charIndex += Tcl_NumUtfChars(segPtr->body.chars, segPtr->size); } else { charIndex += segPtr->size; } numBytes -= segPtr->size; } if (segPtr->typePtr == &tkTextCharType) { charIndex += Tcl_NumUtfChars(segPtr->body.chars, numBytes); } else { charIndex += numBytes; } return snprintf(string, TK_POS_CHARS, "%d.%" TCL_SIZE_MODIFIER "d", TkBTreeLinesTo(textPtr, indexPtr->linePtr) + 1, charIndex); } /* *--------------------------------------------------------------------------- * * TkTextIndexCmp -- |
︙ | ︙ | |||
1404 1405 1406 1407 1408 1409 1410 | *--------------------------------------------------------------------------- */ int TkTextIndexForwBytes( const TkText *textPtr, const TkTextIndex *srcPtr, /* Source index. */ | | | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 | *--------------------------------------------------------------------------- */ int TkTextIndexForwBytes( const TkText *textPtr, const TkTextIndex *srcPtr, /* Source index. */ Tcl_Size byteCount, /* How many bytes forward to move. May be * negative. */ TkTextIndex *dstPtr) /* Destination index: gets modified. */ { TkTextLine *linePtr; TkTextSegment *segPtr; int lineLength; |
︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 | * be negative. */ TkTextIndex *dstPtr, /* Destination index: gets modified. */ TkTextCountType type) /* The type of item to count */ { TkTextLine *linePtr; TkTextSegment *segPtr; TkTextElideInfo *infoPtr = NULL; | | | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | * be negative. */ TkTextIndex *dstPtr, /* Destination index: gets modified. */ TkTextCountType type) /* The type of item to count */ { TkTextLine *linePtr; TkTextSegment *segPtr; TkTextElideInfo *infoPtr = NULL; Tcl_Size byteOffset; char *start, *end, *p; int ch; int elide = 0; int checkElided = (type & COUNT_DISPLAY); if (charCount < 0) { TkTextIndexBackChars(textPtr, srcPtr, -charCount, dstPtr, type); |
︙ | ︙ | |||
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. */ | | | 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 | /* * 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 | | | | | 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 | */ 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 + byteOffset; end = segPtr->body.chars + segPtr->size; for (p = start; p < end; p += Tcl_UtfToUniChar(p, &ch)) { if (charCount == 0) { dstPtr->byteIndex += (p - start); goto forwardCharDone; } charCount--; } } else if (type & COUNT_INDICES) { |
︙ | ︙ | |||
1672 1673 1674 1675 1676 1677 1678 | const TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ const TkTextIndex *indexPtr2) /* Index describing location of last character * at which to stop the count. */ { | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | const TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ const TkTextIndex *indexPtr2) /* Index describing location of last character * at which to stop the count. */ { Tcl_Size byteCount, offset; TkTextSegment *segPtr, *segPtr1; TkTextLine *linePtr; if (indexPtr1->linePtr == indexPtr2->linePtr) { return indexPtr2->byteIndex - indexPtr1->byteIndex; } |
︙ | ︙ | |||
1749 1750 1751 1752 1753 1754 1755 | /* Index describing location of last character * at which to stop the count. */ TkTextCountType type) /* The kind of indices to count. */ { TkTextLine *linePtr1; TkTextSegment *segPtr, *seg2Ptr = NULL; TkTextElideInfo *infoPtr = NULL; | | | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | /* Index describing location of last character * at which to stop the count. */ TkTextCountType type) /* The kind of indices to count. */ { TkTextLine *linePtr1; TkTextSegment *segPtr, *seg2Ptr = NULL; TkTextElideInfo *infoPtr = NULL; Tcl_Size byteOffset, maxBytes, count = 0; int elide = 0; int checkElided = (type & COUNT_DISPLAY); /* * Find seg that contains src index, and remember how many bytes not to * count in the given segment. */ |
︙ | ︙ | |||
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. */ | | | 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | /* * 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[ | | | | | | 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 | */ 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) { goto countDone; } byteOffset = 0; continue; } } if (segPtr->typePtr == &tkTextCharType) { Tcl_Size byteLen = segPtr->size - byteOffset; unsigned char *str = (unsigned char *) segPtr->body.chars + byteOffset; Tcl_Size i; if (segPtr == seg2Ptr) { if (byteLen + byteOffset > maxBytes) { byteLen = maxBytes - byteOffset; } } i = byteLen; |
︙ | ︙ | |||
1873 1874 1875 1876 1877 1878 1879 | count += byteLen - i; if (i) { count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset + (byteLen - i), i); } } else { if (type & COUNT_INDICES) { | | | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | count += byteLen - i; if (i) { count += Tcl_NumUtfChars(segPtr->body.chars + byteOffset + (byteLen - i), i); } } else { if (type & COUNT_INDICES) { Tcl_Size byteLen = segPtr->size - byteOffset; if (segPtr == seg2Ptr) { if (byteLen + byteOffset > maxBytes) { byteLen = maxBytes - byteOffset; } } count += byteLen; |
︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 | *--------------------------------------------------------------------------- */ int TkTextIndexBackBytes( const TkText *textPtr, const TkTextIndex *srcPtr, /* Source index. */ | | | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | *--------------------------------------------------------------------------- */ int TkTextIndexBackBytes( const TkText *textPtr, const TkTextIndex *srcPtr, /* Source index. */ Tcl_Size byteCount, /* How many bytes backward to move. May be * negative. */ TkTextIndex *dstPtr) /* Destination index: gets modified. */ { TkTextSegment *segPtr; int lineIndex; if (byteCount < 0) { |
︙ | ︙ | |||
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. */ | | | 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 | /* * 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[ | | | | > > > > | > | 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 | * 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; } |
︙ | ︙ | |||
2293 2294 2295 2296 2297 2298 2299 | TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL); } else { indexPtr->byteIndex = 0; } } else if ((*string == 'w') && (strncmp(string, "wordend", length) == 0) && (length >= 5)) { int firstChar = 1; | | | | 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 | TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL); } else { indexPtr->byteIndex = 0; } } else if ((*string == 'w') && (strncmp(string, "wordend", length) == 0) && (length >= 5)) { int firstChar = 1; Tcl_Size offset; /* * If the current character isn't part of a word then just move * forward one character. Otherwise move forward until finding a * character that isn't part of a word and stop there. */ if (modifier == TKINDEX_DISPLAY) { TkTextIndexForwChars(textPtr, indexPtr, 0, indexPtr, COUNT_DISPLAY_INDICES); } segPtr = TkTextIndexToSeg(indexPtr, &offset); while (1) { int chSize = 1; if (segPtr->typePtr == &tkTextCharType) { int ch; chSize = Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch); if (!Tcl_UniCharIsWordChar(ch)) { break; } firstChar = 0; } offset += chSize; indexPtr->byteIndex += chSize; |
︙ | ︙ | |||
2336 2337 2338 2339 2340 2341 2342 | TkTextIndexForwChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES); } } } else if ((*string == 'w') && (strncmp(string, "wordstart", length) == 0) && (length >= 5)) { int firstChar = 1; | | | | | > > > | | | | | | | | | | | | < < < | 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 | TkTextIndexForwChars(NULL, indexPtr, 1, indexPtr, COUNT_INDICES); } } } else if ((*string == 'w') && (strncmp(string, "wordstart", length) == 0) && (length >= 5)) { int firstChar = 1; Tcl_Size offset; if (modifier == TKINDEX_DISPLAY) { TkTextIndexForwChars(textPtr, indexPtr, 0, indexPtr, COUNT_DISPLAY_INDICES); } /* * Starting with the current character, look for one that's not part * of a word and keep moving backward until you find one. Then if the * character found wasn't the first one, move forward again one * position. */ segPtr = TkTextIndexToSeg(indexPtr, &offset); while (1) { int chSize = 1; if (segPtr->typePtr == &tkTextCharType) { int ch; Tcl_UtfToUniChar(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 (indexPtr->byteIndex == 0) { goto done; } 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 (offset < 0) { segPtr = TkTextIndexToSeg(indexPtr, &offset); } } if (!firstChar) { if (modifier == TKINDEX_DISPLAY) { TkTextIndexForwChars(textPtr, indexPtr, 1, indexPtr, |
︙ | ︙ |
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" |
︙ | ︙ | |||
32 33 34 35 36 37 38 | static int MarkDeleteProc(TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); static TkTextSegment * MarkCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void MarkCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static int MarkLayoutProc(TkText *textPtr, TkTextIndex *indexPtr, | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | static int MarkDeleteProc(TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); static TkTextSegment * MarkCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void MarkCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static int MarkLayoutProc(TkText *textPtr, TkTextIndex *indexPtr, TkTextSegment *segPtr, Tcl_Size offset, int maxX, Tcl_Size maxChars, int noCharsYet, TkWrapMode wrapMode, TkTextDispChunk *chunkPtr); static int MarkFindNext(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *markName); static int MarkFindPrev(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *markName); |
︙ | ︙ | |||
91 92 93 94 95 96 97 | *-------------------------------------------------------------- */ int TkTextMarkCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | | | | | | | 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 | *-------------------------------------------------------------- */ int TkTextMarkCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "mark". */ { Tcl_HashEntry *hPtr; TkTextSegment *markPtr; Tcl_HashSearch search; TkTextIndex index; const Tk_SegType *newTypePtr; int optionIndex; static const char *const markOptionStrings[] = { "gravity", "names", "next", "previous", "set", "unset", NULL }; enum markOptions { MARK_GRAVITY, MARK_NAMES, MARK_NEXT, MARK_PREVIOUS, MARK_SET, MARK_UNSET }; if (objc + 1 < 4) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[2], markOptionStrings, sizeof(char *), "mark option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum markOptions) optionIndex) { case MARK_GRAVITY: { char c; Tcl_Size 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) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "there is no mark named \"%s\"", str)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "TEXT_MARK", str, (char *)NULL); return TCL_ERROR; } markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } if (objc == 4) { const char *typeStr; if (markPtr->typePtr == &tkTextRightMarkType) { typeStr = "right"; } else { typeStr = "left"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, TCL_INDEX_NONE)); 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 { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad mark gravity \"%s\": must be left or right", str)); Tcl_SetErrorCode(interp, "TK", "VALUE", "MARK_GRAVITY", (char *)NULL); return TCL_ERROR; } TkTextMarkSegToIndex(textPtr, markPtr, &index); TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr); markPtr->typePtr = newTypePtr; TkBTreeLinkSegment(markPtr, &index); break; } case MARK_NAMES: { Tcl_Obj *resultObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( "insert", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( "current", TCL_INDEX_NONE)); for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); |
︙ | ︙ | |||
219 220 221 222 223 224 225 | } if (TkTextGetObjIndex(interp, textPtr, objv[4], &index) != TCL_OK) { return TCL_ERROR; } TkTextSetMark(textPtr, Tcl_GetString(objv[3]), &index); return TCL_OK; case MARK_UNSET: { | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | } if (TkTextGetObjIndex(interp, textPtr, objv[4], &index) != TCL_OK) { return TCL_ERROR; } TkTextSetMark(textPtr, Tcl_GetString(objv[3]), &index); return TCL_OK; case MARK_UNSET: { Tcl_Size i; for (i = 3; i < objc; i++) { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, Tcl_GetString(objv[i])); if (hPtr != NULL) { markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); |
︙ | ︙ | |||
407 408 409 410 411 412 413 | * TkTextMarkNameToIndex -- * * Given the name of a mark, return an index corresponding to the mark * name. * * Results: * The return value is TCL_OK if "name" exists as a mark in the text | | | < < > | < < < < | | | | < < < < < < < < | 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 | * TkTextMarkNameToIndex -- * * Given the name of a mark, return an index corresponding to the mark * name. * * Results: * The return value is TCL_OK if "name" exists as a mark in the text * widget and is located within its -startline/-endline range. In this * case *indexPtr is filled in with the next segment who is after the * mark whose size is non-zero. TCL_ERROR is returned if the mark * doesn't exist in the text widget, or if it is out of its -startline/ * -endline range. In this latter case *indexPtr still contains valid * information, in particular TkTextMarkNameToIndex called with the * "insert" or "current" mark name may return TCL_ERROR, but *indexPtr * contains the correct index of this mark before -startline or after * -endline. * * Side effects: * None. * *-------------------------------------------------------------- */ 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 -- |
︙ | ︙ | |||
556 557 558 559 560 561 562 | */ static int MarkLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */ | | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | */ static int MarkLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */ TCL_UNUSED(Tcl_Size), /* Offset within segPtr corresponding to * indexPtr (always 0). */ TCL_UNUSED(int), /* Chunk must not occupy pixels at this * position or higher. */ TCL_UNUSED(Tcl_Size), /* Chunk must not include more than this many * characters. */ TCL_UNUSED(int), /* Non-zero means no characters have been * assigned to this line yet. */ TCL_UNUSED(TkWrapMode), /* Not used. */ TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been |
︙ | ︙ |
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, TCL_INDEX_NONE, 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_JUSTIFY, "-justify", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, justify), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL, NULL, offsetof(TkTextTag, lMargin1Obj), offsetof(TkTextTag, lMargin1), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL, NULL, offsetof(TkTextTag, lMargin2Obj), offsetof(TkTextTag, lMargin2), 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_PIXELS, "-offset", NULL, NULL, NULL, offsetof(TkTextTag, offsetObj), offsetof(TkTextTag, offset), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL, NULL, TCL_INDEX_NONE, 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_RELIEF, "-relief", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextTag, relief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-rmargin", NULL, NULL, NULL, offsetof(TkTextTag, rMarginObj), offsetof(TkTextTag, rMargin), 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_PIXELS, "-spacing1", NULL, NULL, NULL, offsetof(TkTextTag, spacing1Obj), offsetof(TkTextTag, spacing1), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_PIXELS, "-spacing2", NULL, NULL, NULL, offsetof(TkTextTag, spacing2Obj), offsetof(TkTextTag, spacing2), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_PIXELS, "-spacing3", NULL, NULL, NULL, offsetof(TkTextTag, spacing3Obj), offsetof(TkTextTag, spacing3), 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|TK_OPTION_ENUM_VAR, tkTextTabStyleStrings, 0}, {TK_OPTION_BOOLEAN, "-underline", NULL, NULL, NULL, TCL_INDEX_NONE, 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: */ |
︙ | ︙ | |||
135 136 137 138 139 140 141 | *-------------------------------------------------------------- */ int TkTextTagCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | > | 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 | *-------------------------------------------------------------- */ int TkTextTagCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "tag". */ { static const char *const tagOptionStrings[] = { "add", "bind", "cget", "configure", "delete", "lower", "names", "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; Tcl_Size 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 < (Tcl_Size)objc; i += 2) { if (TkTextGetObjIndex(interp, textPtr, objv[i], &index1) != TCL_OK) { return TCL_ERROR; } if ((Tcl_Size)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", TCL_INDEX_NONE)); 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, TCL_INDEX_NONE)); } } 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 { |
︙ | ︙ | |||
368 369 370 371 372 373 374 | if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } else { | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < < < < | < < < < | < < < < < < | < < < < < | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | 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 | if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } else { if (Tk_SetOptions(interp, tagPtr, tagPtr->optionTable, objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } /* * Some of the configuration options, like -underline and * -justify, require additional translation (this is needed * because we need to distinguish a particular value of an option * from "unspecified"). */ if (tagPtr->borderWidth < 0) { tagPtr->borderWidth = 0; } if (tagPtr->spacing1 != INT_MIN) { if (tagPtr->spacing1 < 0) { tagPtr->spacing1 = 0; } } if (tagPtr->spacing2 != INT_MIN) { if (tagPtr->spacing2 < 0) { tagPtr->spacing2 = 0; } } if (tagPtr->spacing3 != INT_MIN) { if (tagPtr->spacing3 < 0) { tagPtr->spacing3 = 0; } } if (tagPtr->tabArrayPtr != NULL) { ckfree(tagPtr->tabArrayPtr); tagPtr->tabArrayPtr = NULL; } if (tagPtr->tabStringPtr != NULL) { tagPtr->tabArrayPtr = TkTextGetTabs(interp, textPtr->tkwin, 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++; } /* * If the "sel" tag was changed, be sure to mirror information * from the tag back into the text widget record. NOTE: we don't * have to free up information in the widget record before * overwriting it, because it was mirrored in the tag and hence * freed when the tag field was overwritten. */ if (tagPtr == textPtr->selTagPtr) { if (tagPtr->selBorder == NULL) { textPtr->selBorder = tagPtr->border; } else { textPtr->selBorder = tagPtr->selBorder; } textPtr->selBorderWidth = tagPtr->borderWidth; textPtr->selBorderWidthPtr = tagPtr->borderWidthPtr; if (tagPtr->selFgColor == NULL) { textPtr->selFgColorPtr = tagPtr->fgColor; } else { textPtr->selFgColorPtr = tagPtr->selFgColor; } } tagPtr->affectsDisplay = 0; tagPtr->affectsDisplayGeometry = 0; if ((tagPtr->elide >= 0) || (tagPtr->tkfont != NULL) || (tagPtr->justify != TK_JUSTIFY_NULL) || (tagPtr->lMargin1 != INT_MIN) || (tagPtr->lMargin2 != INT_MIN) || (tagPtr->offset != INT_MIN) || (tagPtr->rMargin != INT_MIN) || (tagPtr->spacing1 != INT_MIN) || (tagPtr->spacing2 != INT_MIN) || (tagPtr->spacing3 != INT_MIN) || (tagPtr->tabStringPtr != NULL) || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) || (tagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { tagPtr->affectsDisplay = 1; tagPtr->affectsDisplayGeometry = 1; } if ((tagPtr->border != NULL) || (tagPtr->selBorder != NULL) || (tagPtr->relief != TK_RELIEF_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) { /* * This line is not necessary if this is a new tag, since it * can't possibly have been applied to anything yet. */ /* * VMD: If this is the 'sel' tag, then we don't need to call * this for all peers, unless we actually want to synchronize * sel-style changes across the peers. */ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1); } return TCL_OK; } break; } case TAG_DELETE: { Tcl_HashEntry *hPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?"); return TCL_ERROR; } for (i = 3; i < (Tcl_Size)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; | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | */ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL, NULL, tagPtr, 1); break; } case TAG_NAMES: { TkTextTag **arrayPtr; Tcl_Size arraySize; Tcl_Obj *listObj; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 3, objv, "?index?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
754 755 756 757 758 759 760 | gotStart: if (TkTextIndexCmp(&tSearch.curIndex, &index2) >= 0) { return TCL_OK; } resultObj = Tcl_NewObj(); TkTextPrintIndex(textPtr, &tSearch.curIndex, position); Tcl_ListObjAppendElement(NULL, resultObj, | | | | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | gotStart: if (TkTextIndexCmp(&tSearch.curIndex, &index2) >= 0) { return TCL_OK; } resultObj = Tcl_NewObj(); TkTextPrintIndex(textPtr, &tSearch.curIndex, position); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(position, TCL_INDEX_NONE)); TkBTreeNextTag(&tSearch); TkTextPrintIndex(textPtr, &tSearch.curIndex, position); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(position, TCL_INDEX_NONE)); Tcl_SetObjResult(interp, resultObj); break; } case TAG_PREVRANGE: { TkTextIndex last; TkTextSearch tSearch; char position1[TK_POS_CHARS]; |
︙ | ︙ | |||
869 870 871 872 873 874 875 | } } } gotPrevIndexPair: resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, | | | | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | } } } gotPrevIndexPair: resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(position1, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(position2, TCL_INDEX_NONE)); Tcl_SetObjResult(interp, resultObj); break; } case TAG_RAISE: { TkTextTag *tagPtr2; int prio; |
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | tagPtr->textPtr = NULL; tagPtr->toggleCount = 0; tagPtr->tagRootPtr = NULL; tagPtr->priority = textPtr->sharedTextPtr->numTags; tagPtr->border = NULL; tagPtr->borderWidth = 0; tagPtr->borderWidthPtr = NULL; | < | < | | | | | | | | < | | | | | | | | | | < < | | 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 | tagPtr->textPtr = NULL; tagPtr->toggleCount = 0; tagPtr->tagRootPtr = NULL; tagPtr->priority = textPtr->sharedTextPtr->numTags; tagPtr->border = NULL; tagPtr->borderWidth = 0; tagPtr->borderWidthPtr = NULL; tagPtr->relief = TK_RELIEF_NULL; tagPtr->bgStipple = None; tagPtr->fgColor = NULL; tagPtr->tkfont = NULL; tagPtr->fgStipple = None; tagPtr->justify = TK_JUSTIFY_NULL; tagPtr->lMargin1Obj = NULL; tagPtr->lMargin1 = INT_MIN; tagPtr->lMargin2Obj = NULL; tagPtr->lMargin2 = INT_MIN; tagPtr->lMarginColor = NULL; tagPtr->offsetObj = NULL; tagPtr->offset = INT_MIN; tagPtr->overstrike = -1; tagPtr->overstrikeColor = NULL; tagPtr->rMarginObj = NULL; tagPtr->rMargin = INT_MIN; tagPtr->rMarginColor = NULL; tagPtr->selBorder = NULL; tagPtr->selFgColor = NULL; tagPtr->spacing1Obj = NULL; tagPtr->spacing1 = INT_MIN; tagPtr->spacing2Obj = NULL; tagPtr->spacing2 = INT_MIN; tagPtr->spacing3Obj = NULL; tagPtr->spacing3 = INT_MIN; tagPtr->tabStringPtr = NULL; tagPtr->tabArrayPtr = NULL; tagPtr->tabStyle = TK_TEXT_TABSTYLE_NULL; tagPtr->underline = -1; tagPtr->underlineColor = 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++; |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | Tcl_Interp *interp, /* Interpreter to use for error message; if * NULL, then don't record an error * message. */ TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; | | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | Tcl_Interp *interp, /* Interpreter to use for error message; if * NULL, then don't record an error * message. */ TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; Tcl_Size 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, | | | 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | * 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. */ |
︙ | ︙ | |||
1220 1221 1222 1223 1224 1225 1226 | { int i; /* * Let Tk do most of the hard work for us. */ | | | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | { int i; /* * Let Tk do most of the hard work for us. */ Tk_FreeConfigOptions(tagPtr, tagPtr->optionTable, textPtr->tkwin); /* * This associated information is managed by us. */ if (tagPtr->tabArrayPtr != NULL) { |
︙ | ︙ | |||
1436 1437 1438 1439 1440 1441 1442 | * any). * *-------------------------------------------------------------- */ void TkTextBindProc( | | | 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | * any). * *-------------------------------------------------------------- */ void TkTextBindProc( void *clientData, /* Pointer to text widget structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkText *textPtr = (TkText *)clientData; int repick = 0; textPtr->refCount++; |
︙ | ︙ | |||
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); } | | | > > > > > | > > > > > > > > > > > > > > > | 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 | 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; Tcl_Size 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. */ | | > | 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | * ButtonRelease, or MotionNotify. */ { TkTextIndex index; TkTextTag **oldArrayPtr, **newArrayPtr; TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ int numOldTags, i, nearby; Tcl_Size 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. |
︙ | ︙ | |||
1663 1664 1665 1666 1667 1668 1669 | if ((textPtr->sharedTextPtr->bindingTable != NULL) && (textPtr->tkwin != NULL) && !(textPtr->flags & DESTROYED)) { event = textPtr->pickEvent; event.type = LeaveNotify; /* | > | | | > > > > > > > | 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 | if ((textPtr->sharedTextPtr->bindingTable != NULL) && (textPtr->tkwin != NULL) && !(textPtr->flags & DESTROYED)) { event = textPtr->pickEvent; event.type = LeaveNotify; /* * Behaviour before ticket #47d4f29159: * Always use a detail of NotifyAncestor. Besides being * consistent, this avoids problems where the binding code will * discard NotifyInferior events. * * Behaviour after ticket #47d4f29159: * The binding mechanism doesn't discard events with detail field * NotifyInferior anymore. It would be best to base the detail * field on the ancestry relationship between the old and new * tags. For the time being, retain the choice from before * ticket #47d4f29159, which doesn't harm. */ event.xcrossing.detail = NotifyAncestor; TagBindEvent(textPtr, &event, numOldTags, oldArrayPtr); } ckfree(oldArrayPtr); } |
︙ | ︙ | |||
1760 1761 1762 1763 1764 1765 1766 | * being thrown at it. */ nameArrPtr[i] = NULL; } } Tk_BindEvent(textPtr->sharedTextPtr->bindingTable, eventPtr, | | | 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | * being thrown at it. */ nameArrPtr[i] = NULL; } } Tk_BindEvent(textPtr->sharedTextPtr->bindingTable, eventPtr, textPtr->tkwin, numTags, (void **) nameArrPtr); if (numTags > NUM_BIND_TAGS) { ckfree(nameArrPtr); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * 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" /* * The following structure is the official type record for the embedded window * geometry manager: */ static void EmbWinRequestProc(void *clientData, Tk_Window tkwin); static void EmbWinLostContentProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr textGeomType = { "text", /* name */ EmbWinRequestProc, /* requestProc */ EmbWinLostContentProc, /* lostContentProc */ }; |
︙ | ︙ | |||
43 44 45 46 47 48 49 | */ static TkTextSegment * EmbWinCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbWinCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbWinBboxProc(TkText *textPtr, | | | | | | | 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 | */ static TkTextSegment * EmbWinCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbWinCheckProc(TkTextSegment *segPtr, TkTextLine *linePtr); static void EmbWinBboxProc(TkText *textPtr, TkTextDispChunk *chunkPtr, Tcl_Size index, int y, int lineHeight, int baseline, int *xPtr,int *yPtr, int *widthPtr, int *heightPtr); static int EmbWinConfigure(TkText *textPtr, TkTextSegment *ewPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void EmbWinDelayedUnmap(void *clientData); static int EmbWinDeleteProc(TkTextSegment *segPtr, TkTextLine *linePtr, int treeGone); static int EmbWinLayoutProc(TkText *textPtr, TkTextIndex *indexPtr, TkTextSegment *segPtr, Tcl_Size offset, int maxX, Tcl_Size maxChars,int noCharsYet, TkWrapMode wrapMode, TkTextDispChunk *chunkPtr); static void EmbWinStructureProc(void *clientData, XEvent *eventPtr); static void EmbWinUndisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr); static TkTextEmbWindowClient *EmbWinGetClient(const TkText *textPtr, TkTextSegment *ewPtr); /* |
︙ | ︙ | |||
85 86 87 88 89 90 91 | * Definitions for alignment values: */ static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; | < < < < | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | * Definitions for alignment values: */ static const char *const alignStrings[] = { "baseline", "bottom", "center", "top", NULL }; /* * Information used for parsing window configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align), TK_OPTION_ENUM_VAR, alignStrings, 0}, {TK_OPTION_STRING, "-create", NULL, NULL, NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, "0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, padY), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL, |
︙ | ︙ | |||
131 132 133 134 135 136 137 | *-------------------------------------------------------------- */ int TkTextWindowCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | *-------------------------------------------------------------- */ int TkTextWindowCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "window". */ { int optionIndex; static const char *const windOptionStrings[] = { "cget", "configure", "create", "names", NULL |
︙ | ︙ | |||
291 292 293 294 295 296 297 | ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE); ewPtr->typePtr = &tkTextEmbWindowType; ewPtr->size = 1; ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr; ewPtr->body.ew.linePtr = NULL; ewPtr->body.ew.tkwin = NULL; ewPtr->body.ew.create = NULL; | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE); ewPtr->typePtr = &tkTextEmbWindowType; ewPtr->size = 1; ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr; ewPtr->body.ew.linePtr = NULL; ewPtr->body.ew.tkwin = NULL; ewPtr->body.ew.create = NULL; ewPtr->body.ew.align = TK_ALIGN_CENTER; ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0; ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = NULL; client->textPtr = textPtr; |
︙ | ︙ | |||
378 379 380 381 382 383 384 | */ static int EmbWinConfigure( TkText *textPtr, /* Information about text widget that contains * embedded window. */ TkTextSegment *ewPtr, /* Embedded window to be configured. */ | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | */ static int EmbWinConfigure( TkText *textPtr, /* Information about text widget that contains * embedded window. */ TkTextSegment *ewPtr, /* Embedded window to be configured. */ Tcl_Size objc, /* Number of strings in objv. */ Tcl_Obj *const objv[]) /* Array of objects describing configuration * options. */ { Tk_Window oldWindow; TkTextEmbWindowClient *client; /* |
︙ | ︙ | |||
517 518 519 520 521 522 523 | * of the text is redisplayed. * *-------------------------------------------------------------- */ static void EmbWinStructureProc( | | < < < < < | < | 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 | * of the text is redisplayed. * *-------------------------------------------------------------- */ static void EmbWinStructureProc( void *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 -- * |
︙ | ︙ | |||
569 570 571 572 573 574 575 | * depending on the options specified for the window item. * *-------------------------------------------------------------- */ static void EmbWinRequestProc( | | | > > > > > > > > | | 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 | * depending on the options specified for the window item. * *-------------------------------------------------------------- */ static void EmbWinRequestProc( void *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); } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
605 606 607 608 609 610 611 | * of the text is redisplayed. * *-------------------------------------------------------------- */ static void EmbWinLostContentProc( | | | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | * of the text is redisplayed. * *-------------------------------------------------------------- */ static void EmbWinLostContentProc( void *clientData, /* Pointer to record describing window item. */ Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; |
︙ | ︙ | |||
754 755 756 757 758 759 760 | Tk_PathName(client->tkwin)); } TkTextWinFreeClient(hPtr, client); client = next; } ewPtr->body.ew.clients = NULL; | | | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | Tk_PathName(client->tkwin)); } TkTextWinFreeClient(hPtr, client); client = next; } ewPtr->body.ew.clients = NULL; Tk_FreeConfigOptions(&ewPtr->body.ew, ewPtr->body.ew.optionTable, NULL); /* * Free up all memory allocated. */ ckfree(ewPtr); |
︙ | ︙ | |||
813 814 815 816 817 818 819 | */ static int EmbWinLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */ | | | | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | */ static int EmbWinLayoutProc( TkText *textPtr, /* Text widget being layed out. */ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */ Tcl_Size offset, /* Offset within segPtr corresponding to * indexPtr (always 0). */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ TCL_UNUSED(Tcl_Size), /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ TkTextDispChunk *chunkPtr) |
︙ | ︙ | |||
866 867 868 869 870 871 872 | while (*string != 0) { if ((*string == '%') && (string[1] == '%' || string[1] == 'W')) { if (dsPtr == NULL) { Tcl_DStringInit(&buf); dsPtr = &buf; } if (string != before) { | | | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | while (*string != 0) { if ((*string == '%') && (string[1] == '%' || string[1] == 'W')) { if (dsPtr == NULL) { Tcl_DStringInit(&buf); dsPtr = &buf; } if (string != before) { Tcl_DStringAppend(dsPtr, before, string-before); before = string; } if (string[1] == '%') { Tcl_DStringAppend(dsPtr, "%", 1); } else { /* * Substitute string as proper Tcl list element. |
︙ | ︙ | |||
901 902 903 904 905 906 907 | * The window doesn't currently exist. Create it by evaluating the * creation script. The script must return the window's path name: * look up that name to get back to the window token. Then register * ourselves as the geometry manager for the window. */ if (dsPtr != NULL) { | | | | | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | * The window doesn't currently exist. Create it by evaluating the * creation script. The script must return the window's path name: * look up that name to get back to the window token. Then register * ourselves as the geometry manager for the window. */ if (dsPtr != NULL) { Tcl_DStringAppend(dsPtr, before, string-before); code = Tcl_EvalEx(textPtr->interp, Tcl_DStringValue(dsPtr), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(dsPtr); } else { code = Tcl_EvalEx(textPtr->interp, ewPtr->body.ew.create, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (code != TCL_OK) { Tcl_BackgroundException(textPtr->interp, code); goto gotWindow; } nameObj = Tcl_GetObjResult(textPtr->interp); Tcl_IncrRefCount(nameObj); |
︙ | ︙ | |||
1003 1004 1005 1006 1007 1008 1009 | */ chunkPtr->displayProc = TkTextEmbWinDisplayProc; chunkPtr->undisplayProc = EmbWinUndisplayProc; chunkPtr->measureProc = NULL; chunkPtr->bboxProc = EmbWinBboxProc; chunkPtr->numBytes = 1; | | | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | */ chunkPtr->displayProc = TkTextEmbWinDisplayProc; chunkPtr->undisplayProc = EmbWinUndisplayProc; chunkPtr->measureProc = NULL; chunkPtr->bboxProc = EmbWinBboxProc; chunkPtr->numBytes = 1; if (ewPtr->body.ew.align == TK_ALIGN_BASELINE) { chunkPtr->minAscent = height - ewPtr->body.ew.padY; chunkPtr->minDescent = ewPtr->body.ew.padY; chunkPtr->minHeight = 0; } else { chunkPtr->minAscent = 0; chunkPtr->minDescent = 0; chunkPtr->minHeight = height; |
︙ | ︙ | |||
1049 1050 1051 1052 1053 1054 1055 | TkTextSegment *ewPtr, /* Segment to check. */ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); } if (ewPtr->size != 1) { | | | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | TkTextSegment *ewPtr, /* Segment to check. */ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); } if (ewPtr->size != 1) { Tcl_Panic("EmbWinCheckProc: embedded window has size %" TCL_SIZE_MODIFIER "d", ewPtr->size); } } /* *-------------------------------------------------------------- * * TkTextEmbWinDisplayProc -- |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 | *-------------------------------------------------------------- */ static void EmbWinBboxProc( TkText *textPtr, /* Information about text widget. */ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ | | | 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | *-------------------------------------------------------------- */ static void EmbWinBboxProc( TkText *textPtr, /* Information about text widget. */ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ TCL_UNUSED(Tcl_Size), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ int lineHeight, /* Total height of line. */ int baseline, /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's |
︙ | ︙ | |||
1251 1252 1253 1254 1255 1256 1257 | *heightPtr = Tk_ReqHeight(tkwin); } else { *widthPtr = 0; *heightPtr = 0; } *xPtr = chunkPtr->x + ewPtr->body.ew.padX; if (ewPtr->body.ew.stretch) { | | | | | | | 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 | *heightPtr = Tk_ReqHeight(tkwin); } else { *widthPtr = 0; *heightPtr = 0; } *xPtr = chunkPtr->x + ewPtr->body.ew.padX; if (ewPtr->body.ew.stretch) { if (ewPtr->body.ew.align == TK_ALIGN_BASELINE) { *heightPtr = baseline - ewPtr->body.ew.padY; } else { *heightPtr = lineHeight - 2*ewPtr->body.ew.padY; } } switch (ewPtr->body.ew.align) { case TK_ALIGN_BOTTOM: *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY); break; case TK_ALIGN_CENTER: *yPtr = y + (lineHeight - *heightPtr)/2; break; case TK_ALIGN_TOP: *yPtr = y + ewPtr->body.ew.padY; break; case TK_ALIGN_BASELINE: *yPtr = y + (baseline - *heightPtr); break; } } /* *-------------------------------------------------------------- |
︙ | ︙ | |||
1294 1295 1296 1297 1298 1299 1300 | * non-zero again. * *-------------------------------------------------------------- */ static void EmbWinDelayedUnmap( | | | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | * non-zero again. * *-------------------------------------------------------------- */ static void EmbWinDelayedUnmap( void *clientData) /* Token for the window to be unmapped. */ { TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; if (!client->displayed && (client->tkwin != NULL)) { if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) { Tk_UnmaintainGeometry(client->tkwin, client->textPtr->tkwin); } else { |
︙ | ︙ | |||
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: | | | | | | > > > > > > > > > > > | | 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 | * * 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 |
︙ | ︙ | |||
26 27 28 29 30 31 32 | } TkUndoAtomType; /* * Callback proc type to carry out an undo or redo action via C code. (Actions * can also be defined by Tcl scripts). */ | | | | 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 | } TkUndoAtomType; /* * Callback proc type to carry out an undo or redo action via C code. (Actions * can also be defined by Tcl scripts). */ typedef int (TkUndoProc)(Tcl_Interp *interp, void *clientData, Tcl_Obj *objPtr); /* * Struct defining a single action, one or more of which may be defined (and * stored in a linked list) separately for each undo and redo action of an * undo atom. */ typedef struct TkUndoSubAtom { Tcl_Command command; /* Tcl token used to get the current Tcl * command name which will be used to execute * apply/revert scripts. If NULL then it is * assumed the apply/revert scripts already * contain everything. */ TkUndoProc *funcPtr; /* Function pointer for callback to perform * undo/redo actions. */ void *clientData; /* Data for 'funcPtr'. */ Tcl_Obj *action; /* Command to apply the action that was * taken. */ struct TkUndoSubAtom *next; /* Pointer to the next element in the linked * list. */ } TkUndoSubAtom; /* |
︙ | ︙ | |||
101 102 103 104 105 106 107 | MODULE_SCOPE void TkUndoFreeStack(TkUndoRedoStack *stack); MODULE_SCOPE int TkUndoCanRedo(TkUndoRedoStack *stack); MODULE_SCOPE int TkUndoCanUndo(TkUndoRedoStack *stack); MODULE_SCOPE void TkUndoInsertUndoSeparator(TkUndoRedoStack *stack); MODULE_SCOPE TkUndoSubAtom *TkUndoMakeCmdSubAtom(Tcl_Command command, Tcl_Obj *actionScript, TkUndoSubAtom *subAtomList); MODULE_SCOPE TkUndoSubAtom *TkUndoMakeSubAtom(TkUndoProc *funcPtr, | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | MODULE_SCOPE void TkUndoFreeStack(TkUndoRedoStack *stack); MODULE_SCOPE int TkUndoCanRedo(TkUndoRedoStack *stack); MODULE_SCOPE int TkUndoCanUndo(TkUndoRedoStack *stack); MODULE_SCOPE void TkUndoInsertUndoSeparator(TkUndoRedoStack *stack); MODULE_SCOPE TkUndoSubAtom *TkUndoMakeCmdSubAtom(Tcl_Command command, Tcl_Obj *actionScript, TkUndoSubAtom *subAtomList); MODULE_SCOPE TkUndoSubAtom *TkUndoMakeSubAtom(TkUndoProc *funcPtr, void *clientData, Tcl_Obj *actionScript, TkUndoSubAtom *subAtomList); MODULE_SCOPE void TkUndoPushAction(TkUndoRedoStack *stack, TkUndoSubAtom *apply, TkUndoSubAtom *revert); MODULE_SCOPE int TkUndoRevert(TkUndoRedoStack *stack); MODULE_SCOPE int TkUndoApply(TkUndoRedoStack *stack); #endif /* _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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * The structure below defines the implementation of the "statekey" Tcl * object, used for quickly finding a mapping in a TkStateMap. */ const TkObjType tkStateKeyObjType = { {"statekey", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL, /* setFromAnyProc */ TCL_OBJTYPE_V0}, 0 }; /* *-------------------------------------------------------------- * * TkStateParseProc -- * |
︙ | ︙ | |||
42 43 44 45 46 47 48 | * value argument. * *-------------------------------------------------------------- */ int TkStateParseProc( | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | * value argument. * *-------------------------------------------------------------- */ int TkStateParseProc( void *clientData, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { int c; int flags = PTR2INT(clientData); size_t length; Tcl_Obj *msgObj; Tk_State *statePtr = (Tk_State *) (widgRec + offset); |
︙ | ︙ | |||
83 84 85 86 87 88 89 | *statePtr = TK_STATE_HIDDEN; return TCL_OK; } msgObj = Tcl_ObjPrintf("bad %s value \"%s\": must be normal", ((flags & 4) ? "-default" : "state"), value); if (flags & 1) { | | | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | *statePtr = TK_STATE_HIDDEN; return TCL_OK; } msgObj = Tcl_ObjPrintf("bad %s value \"%s\": must be normal", ((flags & 4) ? "-default" : "state"), value); if (flags & 1) { Tcl_AppendToObj(msgObj, ", active", TCL_INDEX_NONE); } if (flags & 2) { Tcl_AppendToObj(msgObj, ", hidden", TCL_INDEX_NONE); } if (flags & 3) { Tcl_AppendToObj(msgObj, ",", TCL_INDEX_NONE); } Tcl_AppendToObj(msgObj, " or disabled", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "VALUE", "STATE", NULL); *statePtr = TK_STATE_NORMAL; return TCL_ERROR; } /* |
︙ | ︙ | |||
124 125 126 127 128 129 130 | */ const char * TkStatePrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | */ const char * TkStatePrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Tk_State *statePtr = (Tk_State *) (widgRec + offset); switch (*statePtr) { |
︙ | ︙ | |||
170 171 172 173 174 175 176 | int TkOrientParseProc( TCL_UNUSED(void *), /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | int TkOrientParseProc( TCL_UNUSED(void *), /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { int c; size_t length; int *orientPtr = (int *) (widgRec + offset); if (value == NULL || *value == 0) { *orientPtr = 0; |
︙ | ︙ | |||
226 227 228 229 230 231 232 | */ const char * TkOrientPrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | */ const char * TkOrientPrintProc( TCL_UNUSED(void *), /* Ignored. */ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { int *statePtr = (int *) (widgRec + offset); if (*statePtr) { |
︙ | ︙ | |||
253 254 255 256 257 258 259 | * structure. * *---------------------------------------------------------------------- */ int TkOffsetParseProc( | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | * structure. * *---------------------------------------------------------------------- */ int TkOffsetParseProc( void *clientData, /* not used */ Tcl_Interp *interp, /* Interpreter to send results back to */ Tk_Window tkwin, /* Window on same display as tile */ const char *value, /* Name of image */ char *widgRec, /* Widget structure record */ Tcl_Size offset) /* Offset of tile in record */ { Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset); Tk_TSOffset tsoffset; const char *q, *p; int result; Tcl_Obj *msgObj; |
︙ | ︙ | |||
379 380 381 382 383 384 385 | goodTSOffset: memcpy(offsetPtr, &tsoffset, sizeof(Tk_TSOffset)); return TCL_OK; badTSOffset: msgObj = Tcl_ObjPrintf("bad offset \"%s\": expected \"x,y\"", value); if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) { | | | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | goodTSOffset: memcpy(offsetPtr, &tsoffset, sizeof(Tk_TSOffset)); return TCL_OK; badTSOffset: msgObj = Tcl_ObjPrintf("bad offset \"%s\": expected \"x,y\"", value); if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) { Tcl_AppendToObj(msgObj, ", \"#x,y\"", TCL_INDEX_NONE); } if (PTR2INT(clientData) & TK_OFFSET_INDEX) { Tcl_AppendToObj(msgObj, ", <index>", TCL_INDEX_NONE); } Tcl_AppendToObj(msgObj, ", n, ne, e, se, s, sw, w, nw, or center", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "VALUE", "OFFSET", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
408 409 410 411 412 413 414 | */ const char * TkOffsetPrintProc( TCL_UNUSED(void *), /* not used */ TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ | | | | 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 | */ const char * TkOffsetPrintProc( TCL_UNUSED(void *), /* not used */ TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ Tcl_Size offset, /* Offset of tile in record */ Tcl_FreeProc **freeProcPtr) /* not used */ { Tk_TSOffset *offsetPtr = (Tk_TSOffset *) (widgRec + offset); char *p, *q; if (offsetPtr->flags & TK_OFFSET_INDEX) { if (offsetPtr->flags >= INT_MAX) { return "end"; } p = (char *)ckalloc(32); snprintf(p, 32, "%d", offsetPtr->flags & ~TK_OFFSET_INDEX); *freeProcPtr = TCL_DYNAMIC; return p; } if (offsetPtr->flags & TK_OFFSET_TOP) { if (offsetPtr->flags & TK_OFFSET_LEFT) { return "nw"; } else if (offsetPtr->flags & TK_OFFSET_CENTER) { |
︙ | ︙ | |||
452 453 454 455 456 457 458 | return "se"; } } q = p = (char *)ckalloc(32); if (offsetPtr->flags & TK_OFFSET_RELATIVE) { *q++ = '#'; } | | | | | | 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 | return "se"; } } q = p = (char *)ckalloc(32); if (offsetPtr->flags & TK_OFFSET_RELATIVE) { *q++ = '#'; } snprintf(q, 32, "%d,%d", offsetPtr->xoffset, offsetPtr->yoffset); *freeProcPtr = TCL_DYNAMIC; return p; } /* *---------------------------------------------------------------------- * * TkPixelParseProc -- * * Converts the name of an image into a tile. * *---------------------------------------------------------------------- */ int TkPixelParseProc( void *clientData, /* If non-NULL, negative values are allowed as * well. */ Tcl_Interp *interp, /* Interpreter to send results back to */ Tk_Window tkwin, /* Window on same display as tile */ const char *value, /* Name of image */ char *widgRec, /* Widget structure record */ Tcl_Size offset) /* Offset of tile in record */ { double *doublePtr = (double *) (widgRec + offset); int result; result = TkGetDoublePixels(interp, tkwin, value, doublePtr); if ((result == TCL_OK) && (clientData == NULL) && (*doublePtr < 0.0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected screen distance but got \"%.50s\"", value)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL); return TCL_ERROR; } return result; } /* |
︙ | ︙ | |||
509 510 511 512 513 514 515 | */ const char * TkPixelPrintProc( TCL_UNUSED(void *), /* not used */ TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ | | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | */ const char * TkPixelPrintProc( TCL_UNUSED(void *), /* not used */ TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ Tcl_Size offset, /* Offset of tile in record */ Tcl_FreeProc **freeProcPtr) /* not used */ { double *doublePtr = (double *) (widgRec + offset); char *p = (char *)ckalloc(24); Tcl_PrintDouble(NULL, *doublePtr, p); *freeProcPtr = TCL_DYNAMIC; |
︙ | ︙ | |||
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. * | | | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | *---------------------------------------------------------------------- * * 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. |
︙ | ︙ | |||
636 637 638 639 640 641 642 | * *---------------------------------------------------------------------- */ int Tk_GetScrollInfo( Tcl_Interp *interp, /* Used for error reporting. */ | | | 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | * *---------------------------------------------------------------------- */ int Tk_GetScrollInfo( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Size argc, /* # arguments for command. */ const char **argv, /* 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. */ { int c = argv[2][0]; |
︙ | ︙ | |||
719 720 721 722 723 724 725 | * *---------------------------------------------------------------------- */ int Tk_GetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ | | | | > > > > > | 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 | * *---------------------------------------------------------------------- */ int Tk_GetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Size objc, /* # arguments for command. */ 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. */ { Tcl_Size length; const char *arg; if (objc + 1 < 5) { Tcl_WrongNumArgs(interp, 2, objv, "moveto|scroll args"); return TK_SCROLL_ERROR; } 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"); return TK_SCROLL_ERROR; |
︙ | ︙ | |||
755 756 757 758 759 760 761 | return TK_SCROLL_ERROR; } *intPtr = (d >= 0) ? ceil(d) : floor(d); if (dblPtr) { *dblPtr = d; } | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | 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; | | | | < | | > | | | | | < | | > | | | 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 | 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; } } /* *--------------------------------------------------------------------------- * |
︙ | ︙ | |||
963 964 965 966 967 968 969 | const char *key; const Tcl_ObjType *typePtr; /* * See if the value is in the object cache. */ | | | | 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 | const char *key; const Tcl_ObjType *typePtr; /* * See if the value is in the object cache. */ if ((keyPtr->typePtr == &tkStateKeyObjType.objType) && (keyPtr->internalRep.twoPtrValue.ptr1 == mapPtr)) { return PTR2INT(keyPtr->internalRep.twoPtrValue.ptr2); } /* * Not there. Look in the state map. */ key = Tcl_GetString(keyPtr); for (mPtr = mapPtr; mPtr->strKey != NULL; mPtr++) { if (strcmp(key, mPtr->strKey) == 0) { typePtr = keyPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(keyPtr); } keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr; keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey); keyPtr->typePtr = &tkStateKeyObjType.objType; return mPtr->numKey; } } /* * Not there either. Generate an error message (if we can) and return the * default. |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | * * ---------------------------------------------------------------------- */ int TkBackgroundEvalObjv( Tcl_Interp *interp, | | | > | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | * * ---------------------------------------------------------------------- */ int TkBackgroundEvalObjv( Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const *objv, int flags) { Tcl_InterpState state; int r = TCL_OK; Tcl_Size n; /* * Record the state of the interpreter. */ Tcl_Preserve(interp); state = Tcl_SaveInterpState(interp, TCL_OK); |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 | */ Tcl_Command TkMakeEnsemble( Tcl_Interp *interp, const char *namesp, const char *name, | | | 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | */ Tcl_Command TkMakeEnsemble( Tcl_Interp *interp, const char *namesp, const char *name, void *clientData, const TkEnsemble map[]) { Tcl_Namespace *namespacePtr = NULL; Tcl_Command ensemble = NULL; Tcl_Obj *dictObj = NULL, *nameObj; Tcl_DString ds; int i; |
︙ | ︙ | |||
1113 1114 1115 1116 1117 1118 1119 | if (namespacePtr == NULL) { namespacePtr = Tcl_CreateNamespace(interp, namesp, NULL, NULL); if (namespacePtr == NULL) { Tcl_Panic("failed to create namespace \"%s\"", namesp); } } | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | if (namespacePtr == NULL) { namespacePtr = Tcl_CreateNamespace(interp, namesp, NULL, NULL); if (namespacePtr == NULL) { Tcl_Panic("failed to create namespace \"%s\"", namesp); } } nameObj = Tcl_NewStringObj(name, TCL_INDEX_NONE); ensemble = Tcl_FindEnsemble(interp, nameObj, 0); Tcl_DecrRefCount(nameObj); if (ensemble == NULL) { ensemble = Tcl_CreateEnsemble(interp, name, namespacePtr, TCL_ENSEMBLE_PREFIX); if (ensemble == NULL) { Tcl_Panic("failed to create ensemble \"%s\"", name); } } Tcl_DStringSetLength(&ds, 0); Tcl_DStringAppend(&ds, namesp, TCL_INDEX_NONE); if (!(strlen(namesp) == 2 && namesp[1] == ':')) { Tcl_DStringAppend(&ds, "::", TCL_INDEX_NONE); } Tcl_DStringAppend(&ds, name, TCL_INDEX_NONE); dictObj = Tcl_NewObj(); for (i = 0; map[i].name != NULL ; ++i) { Tcl_Obj *fqdnObj; nameObj = Tcl_NewStringObj(map[i].name, TCL_INDEX_NONE); fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_AppendStringsToObj(fqdnObj, "::", map[i].name, NULL); Tcl_DictObjPut(NULL, dictObj, nameObj, fqdnObj); if (map[i].proc) { #if TCL_MAJOR_VERSION > 8 Tcl_CreateObjCommand2(interp, Tcl_GetString(fqdnObj), map[i].proc, clientData, NULL); #else Tcl_CreateObjCommand(interp, Tcl_GetString(fqdnObj), map[i].proc, clientData, NULL); #endif } else if (map[i].subensemble) { TkMakeEnsemble(interp, Tcl_DStringValue(&ds), map[i].name, clientData, map[i].subensemble); } } if (ensemble) { Tcl_SetEnsembleMappingDict(interp, ensemble, dictObj); } Tcl_DStringFree(&ds); return ensemble; } /* *---------------------------------------------------------------------- * * TkScalingLevel -- * * Returns the display's DPI scaling level as 1.0, 1.25, 1.5, .... * * Results: * The scaling level. * * Side effects: * None. * *---------------------------------------------------------------------- */ double TkScalingLevel( Tk_Window tkwin) { Tcl_Interp *interp = Tk_Interp(tkwin); Tcl_Obj *scalingPctPtr = Tcl_GetVar2Ex(interp, "::tk::scalingPct", NULL, TCL_GLOBAL_ONLY); if (scalingPctPtr == NULL) { return 1.0; } else { int scalingPct; Tcl_GetIntFromObj(interp, scalingPctPtr, &scalingPct); return scalingPct / 100.0; } } /* *---------------------------------------------------------------------- * * Tk_SendVirtualEvent -- * * Send a virtual event notification to the specified target window. |
︙ | ︙ | |||
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); } | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | 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); } /* * 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" |
︙ | ︙ | |||
204 205 206 207 208 209 210 | Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) { Tcl_AppendPrintfToObj(msgObj, "%s, ", dictPtr->name); } | | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) { Tcl_AppendPrintfToObj(msgObj, "%s, ", dictPtr->name); } Tcl_AppendToObj(msgObj, "or default", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "VISUAL", string, NULL); return NULL; } while (isspace(UCHAR(*p))) { p++; } |
︙ | ︙ | |||
235 236 237 238 239 240 241 | templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't find an appropriate visual", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VISUAL", "INAPPROPRIATE", NULL); return NULL; } /* * Search through the visuals that were returned to find the best one. * The choice is based on the following criteria, in decreasing order of |
︙ | ︙ | |||
302 303 304 305 306 307 308 | newBest: bestPtr = &visInfoList[i]; bestPrio = prio; } CLANG_ASSERT(bestPtr); *depthPtr = bestPtr->depth; visual = bestPtr->visual; | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | newBest: bestPtr = &visInfoList[i]; bestPrio = prio; } CLANG_ASSERT(bestPtr); *depthPtr = bestPtr->depth; visual = bestPtr->visual; XFree(visInfoList); /* * If we need to find a colormap for this visual, do it now. If the visual * is the default visual for the screen, then use the default colormap. * Otherwise search for an existing colormap that's shareable. If all else * fails, create a new colormap. */ |
︙ | ︙ |
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); |
︙ | ︙ | |||
429 430 431 432 433 434 435 | * ScreenName is assumed to have the syntax <display>.<screen> with the * dot and the screen being optional. */ screenName = TkGetDefaultScreenName(interp, screenName); if (screenName == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | 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 | * ScreenName is assumed to have the syntax <display>.<screen> with the * dot and the screen being optional. */ screenName = TkGetDefaultScreenName(interp, screenName); if (screenName == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no display name and no $DISPLAY environment variable", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_DISPLAY", NULL); return NULL; } length = strlen(screenName); screenId = 0; p = screenName+length-1; while (isdigit(UCHAR(*p)) && (p != screenName)) { p--; } if ((*p == '.') && (p[1] != '\0')) { length = (size_t)(p - screenName); screenId = (int)strtoul(p+1, NULL, 10); } /* * See if we already have a connection to this display. If not, then open * a new connection. */ |
︙ | ︙ | |||
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 | TkStylePkgInit(mainPtr); mainPtr->tlFocusPtr = NULL; mainPtr->displayFocusPtr = NULL; mainPtr->optionRootPtr = NULL; Tcl_InitHashTable(&mainPtr->imageTable, TCL_STRING_KEYS); mainPtr->strictMotif = 0; mainPtr->alwaysShowSelection = 0; | > > > > | | | 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 | 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", &mainPtr->strictMotif, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_CreateNamespace(interp, "::tk", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::AlwaysShowSelection", &mainPtr->alwaysShowSelection, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } mainPtr->nextPtr = tsdPtr->mainWindowList; tsdPtr->mainWindowList = mainPtr; winPtr->mainPtr = mainPtr; hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy); |
︙ | ︙ | |||
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 | /* * 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 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); |
︙ | ︙ | |||
993 994 995 996 997 998 999 | * window. */ { TkWindow *parentPtr = (TkWindow *) parent; if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | * window. */ { TkWindow *parentPtr = (TkWindow *) parent; if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (parentPtr->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: its parent has -container = yes", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } else if (screenName == NULL) { TkWindow *winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum, parentPtr); if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) { |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | * window. */ { TkWindow *parentPtr = (TkWindow *) parent; if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | * window. */ { TkWindow *parentPtr = (TkWindow *) parent; if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (parentPtr->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: its parent has -container = yes", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } else if (screenName == NULL) { TkWindow *winPtr = TkAllocWindow(parentPtr->dispPtr, parentPtr->screenNum, parentPtr); /* * Add the anonymous window flag now, so that NameWindow will |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | p = (char *)strrchr(pathName, '.'); if (p == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad window path name \"%s\"", pathName)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } | | | 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | p = (char *)strrchr(pathName, '.'); if (p == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad window path name \"%s\"", pathName)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } numChars = (size_t)(p - pathName); if (numChars > FIXED_SPACE) { p = (char *)ckalloc(numChars + 1); } else { p = fixedSpace; } if (numChars == 0) { *p = '.'; |
︙ | ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | ckfree(p); } if (parent == NULL) { return NULL; } if (((TkWindow *) parent)->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | ckfree(p); } if (parent == NULL) { return NULL; } if (((TkWindow *) parent)->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (((TkWindow *) parent)->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: its parent has -container = yes", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } /* * Create the window. */ |
︙ | ︙ | |||
1228 1229 1230 1231 1232 1233 1234 | *-------------------------------------------------------------- */ void Tk_DestroyWindow( Tk_Window tkwin) /* Window to destroy. */ { | | | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | *-------------------------------------------------------------- */ 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 | | | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 | 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 | | | | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | /* * 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) && | | > > > > > > > > > > > | > > | > > > > > > > | 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 | * * 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"); } Tcl_DeleteHashTable(&winPtr->mainPtr->busyTable); Tcl_DeleteHashTable(&winPtr->mainPtr->nameTable); TkBindFree(winPtr->mainPtr); TkDeleteAllImages(winPtr->mainPtr); TkFontPkgFree(winPtr->mainPtr); TkFocusFree(winPtr->mainPtr); TkStylePkgFree(winPtr->mainPtr); Ttk_TkDestroyedHandler(winPtr->mainPtr->interp); /* * When embedding Tk into other applications, make sure that all * destroy events reach the server. Otherwise the embedding * application may also attempt to destroy the windows, resulting * in an X error */ |
︙ | ︙ | |||
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; | | | 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | 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 { | | | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 | 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; | | | 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | 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 |
︙ | ︙ | |||
1867 1868 1869 1870 1871 1872 1873 | void Tk_ResizeWindow( Tk_Window tkwin, /* Window to resize. */ int width, int height) /* New dimensions for window. */ { TkWindow *winPtr = (TkWindow *) tkwin; | | | | | | 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 | void Tk_ResizeWindow( Tk_Window tkwin, /* Window to resize. */ int width, int height) /* New dimensions for window. */ { TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.width = width; winPtr->changes.height = height; if (winPtr->window != None) { XResizeWindow(winPtr->display, winPtr->window, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); } else { winPtr->dirtyChanges |= CWWidth|CWHeight; winPtr->flags |= TK_NEED_CONFIG_NOTIFY; } } void Tk_MoveResizeWindow( Tk_Window tkwin, /* Window to move and resize. */ int x, int y, /* New location for window (within parent). */ int width, int height) /* New dimensions for window. */ { TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; winPtr->changes.width = width; winPtr->changes.height = height; if (winPtr->window != None) { XMoveResizeWindow(winPtr->display, winPtr->window, x, y, (unsigned) width, (unsigned) height); TkDoConfigureNotify(winPtr); } else { winPtr->dirtyChanges |= CWX|CWY|CWWidth|CWHeight; winPtr->flags |= TK_NEED_CONFIG_NOTIFY; |
︙ | ︙ | |||
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. */ | | | 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 | *---------------------------------------------------------------------- */ 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; } |
︙ | ︙ | |||
2289 2290 2291 2292 2293 2294 2295 | if (tkwin == NULL) { /* * Either we're not really in Tk, or the main window was destroyed and * we're on our way out of the application. */ if (interp != NULL) { | | | 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 | if (tkwin == NULL) { /* * Either we're not really in Tk, or the main window was destroyed and * we're on our way out of the application. */ if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window",TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", NULL); } return NULL; } hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->nameTable, pathName); |
︙ | ︙ | |||
2619 2620 2621 2622 2623 2624 2625 | for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { if (mainPtr->interp == interp) { return (Tk_Window) mainPtr->winPtr; } } Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 | for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { if (mainPtr->interp == interp) { return (Tk_Window) mainPtr->winPtr; } } Tcl_SetObjResult(interp, Tcl_NewStringObj( "this isn't a Tk application", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", NULL); return NULL; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2734 2735 2736 2737 2738 2739 2740 | * None. * *---------------------------------------------------------------------- */ static void DeleteWindowsExitProc( | | | 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 | * 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; |
︙ | ︙ | |||
2813 2814 2815 2816 2817 2818 2819 | } tsdPtr->numMainWindows = 0; tsdPtr->mainWindowList = NULL; tsdPtr->initialized = 0; } | | | | | | | | | > > > | > | < < < | | | < < | < > > | 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 | } tsdPtr->numMainWindows = 0; tsdPtr->mainWindowList = NULL; tsdPtr->initialized = 0; } #if defined(_WIN32) && !defined(STATIC_BUILD) static HMODULE tkcygwindll = NULL; /* * Run Tk_MainEx from libtcl9tk9.?.dll * * This function is only ever called from wish9.?.exe, the cygwin port of Tcl. * This means that the system encoding is utf-8, so we don't have to do any * encoding conversions. */ MODULE_SCOPE void TkCygwinMainEx( Tcl_Size argc, /* Number of arguments. */ char **argv, /* Array of argument strings. */ Tcl_AppInitProc *appInitProc, /* Application-specific initialization * procedure to call after most initialization * but before starting to execute commands. */ Tcl_Interp *interp) { WCHAR name[MAX_PATH]; size_t len; void (*tkmainex)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); /* construct "<path>/libtcl9tk9.?.dll", from "<path>/tcl9tk9?.dll" */ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH); name[len-2] = '.'; name[len-1] = name[len-5]; wcscpy(name+len, L".dll"); #if TCL_MAJOR_VERSION > 8 memcpy(name+len-12, L"libtcl9tk9", 10 * sizeof(WCHAR)); #else memcpy(name+len-8, L"libtk9", 6 * sizeof(WCHAR)); #endif tkcygwindll = LoadLibraryW(name); if (tkcygwindll) { tkmainex = (void (*)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *)) (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); if (tkmainex) { tkmainex(argc, argv, appInitProc, interp); } } } #endif /* _WIN32 */ /* *---------------------------------------------------------------------- * * Tk_Init -- |
︙ | ︙ | |||
2888 2889 2890 2891 2892 2893 2894 | *---------------------------------------------------------------------- */ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { | | | 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 | *---------------------------------------------------------------------- */ int Tk_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { #if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tkinit)(Tcl_Interp *); tkinit = (int(*)(Tcl_Interp *))(void *)GetProcAddress(tkcygwindll,"Tk_Init"); if (tkinit) { return tkinit(interp); } |
︙ | ︙ | |||
2961 2962 2963 2964 2965 2966 2967 | * - No CPU time limit, no memory allocation limits, no color limits. * CPU time limits can be imposed by an unsafe parent interpreter. * * The actual code called is the same as Tk_Init but Tcl_IsSafe() is * checked at several places to differentiate the two initialisations. */ | | | 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 | * - No CPU time limit, no memory allocation limits, no color limits. * CPU time limits can be imposed by an unsafe parent interpreter. * * The actual code called is the same as Tk_Init but Tcl_IsSafe() is * checked at several places to differentiate the two initialisations. */ #if defined(_WIN32) && !defined(STATIC_BUILD) if (tkcygwindll) { int (*tksafeinit)(Tcl_Interp *); tksafeinit = (int (*)(Tcl_Interp *)) (void *)GetProcAddress(tkcygwindll, "Tk_SafeInit"); if (tksafeinit) { return tksafeinit(interp); |
︙ | ︙ | |||
2997 2998 2999 3000 3001 3002 3003 | * Depends on the initialization scripts that are invoked. * *---------------------------------------------------------------------- */ static int CopyValue( | | < < > | 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 | * 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. */ { int code = TCL_OK; ThreadSpecificData *tsdPtr; Tcl_Obj *value = NULL; Tcl_Obj *cmd; Tcl_Obj *nameObj = NULL; Tcl_Obj* appNameObj = NULL; Tcl_Obj *classObj = NULL; Tcl_Obj *displayObj = NULL; Tcl_Obj *colorMapObj = NULL; Tcl_Obj *useObj = NULL; Tcl_Obj *visualObj = NULL; Tcl_Obj *geometryObj = NULL; |
︙ | ︙ | |||
3048 3049 3050 3051 3052 3053 3054 | TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; /* * Ensure that we are getting a compatible version of Tcl. */ | | | 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 | TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { return TCL_ERROR; } /* * TIP #59: Make embedded configuration information available. */ |
︙ | ︙ | |||
3091 3092 3093 3094 3095 3096 3097 | Tcl_Interp *parent = interp; while (Tcl_IsSafe(parent)) { parent = Tcl_GetParent(parent); if (parent == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 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 | Tcl_Interp *parent = interp; while (Tcl_IsSafe(parent)) { parent = Tcl_GetParent(parent); if (parent == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no controlling parent interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL); return TCL_ERROR; } } /* * Construct the name (rewalk...) */ code = Tcl_GetInterpPath(parent, interp); if (code != TCL_OK) { Tcl_Panic("Tcl_GetInterpPath broken!"); } /* * Build the command to eval in trusted parent. */ cmd = Tcl_NewListObj(2, NULL); Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("::safe::TkInit", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent)); /* * Step 2 : Eval in the parent. The argument is the *reversed* interp * path of the child. */ |
︙ | ︙ | |||
3146 3147 3148 3149 3150 3151 3152 | * that we used. */ value = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY); } if (value) { | | | 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 | * that we used. */ value = Tcl_GetVar2Ex(interp, "argv", NULL, TCL_GLOBAL_ONLY); } if (value) { Tcl_Size 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) || |
︙ | ︙ | |||
3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 | if (nameObj == NULL) { Tcl_DString nameDS; Tcl_DStringInit(&nameDS); TkpGetAppName(interp, &nameDS); nameObj = Tcl_NewStringObj(Tcl_DStringValue(&nameDS), Tcl_DStringLength(&nameDS)); Tcl_DStringFree(&nameDS); } /* * The -class argument is always the ToTitle of the -name */ { | > > | | | | | | | > > > > > > | > | | > | | > > > | 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 | if (nameObj == NULL) { Tcl_DString nameDS; Tcl_DStringInit(&nameDS); TkpGetAppName(interp, &nameDS); nameObj = Tcl_NewStringObj(Tcl_DStringValue(&nameDS), Tcl_DStringLength(&nameDS)); appNameObj = nameObj; Tcl_IncrRefCount(appNameObj); Tcl_DStringFree(&nameDS); } /* * The -class argument is always the ToTitle of the -name */ { Tcl_Size numBytes; const char *bytes = Tcl_GetStringFromObj(nameObj, &numBytes); classObj = Tcl_NewStringObj(bytes, numBytes); numBytes = Tcl_UtfToTitle(Tcl_GetString(classObj)); Tcl_SetObjLength(classObj, numBytes); } /* * Create an argument list for creating the top-level window, using the * information parsed from argv, if any. */ cmd = Tcl_NewStringObj("toplevel . -class", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, cmd, classObj); classObj = NULL; if (displayObj) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-screen", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, displayObj); /* * If this is the first application for this process, save the display * name in the DISPLAY environment variable so that it will be * available to subprocesses created by us. */ if (tsdPtr->numMainWindows == 0) { Tcl_SetVar2Ex(interp, "env", "DISPLAY", displayObj, TCL_GLOBAL_ONLY); } displayObj = NULL; } if (colorMapObj) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-colormap", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, colorMapObj); colorMapObj = NULL; } if (useObj) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-use", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, useObj); useObj = NULL; } if (visualObj) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-visual", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, visualObj); visualObj = NULL; } Tcl_Size objc; Tcl_Obj **objv; if (TCL_OK != Tcl_ListObjGetElements(interp, cmd, &objc, &objv)) { return TCL_ERROR; } code = TkCreateFrame(NULL, interp, objc, objv, 1, nameObj ? Tcl_GetString(nameObj) : NULL); Tcl_DecrRefCount(cmd); if (code != TCL_OK) { goto done; } Tcl_ResetResult(interp); if (sync) { (void)XSynchronize(Tk_Display(Tk_MainWindow(interp)), True); } /* * Set the geometry of the main window, if requested. Put the requested * geometry into the "geometry" variable. */ if (geometryObj) { Tcl_SetVar2Ex(interp, "geometry", NULL, geometryObj, TCL_GLOBAL_ONLY); cmd = Tcl_NewStringObj("wm geometry .", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, cmd, geometryObj); Tcl_IncrRefCount(cmd); code = Tcl_EvalObjEx(interp, cmd, 0); Tcl_DecrRefCount(cmd); 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 |
︙ | ︙ | |||
3333 3334 3335 3336 3337 3338 3339 | "if {[namespace which -command tkInit] eq \"\"} {\n\ proc tkInit {} {\n\ global tk_library tk_version tk_patchLevel\n\ rename tkInit {}\n\ tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\ }\n\ }\n\ | | > > > > | 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 | "if {[namespace which -command tkInit] eq \"\"} {\n\ proc tkInit {} {\n\ global tk_library tk_version tk_patchLevel\n\ rename tkInit {}\n\ tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\ }\n\ }\n\ tkInit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (code == TCL_OK) { /* * Create exit handlers to delete all windows when the application or * thread exits. The handler need to be invoked before other platform * specific cleanups take place to avoid panics in finalization. */ TkCreateThreadExitHandler(DeleteWindowsExitProc, tsdPtr); } done: if (value) { Tcl_DecrRefCount(value); value = NULL; } if (appNameObj) { Tcl_DecrRefCount(appNameObj); appNameObj = NULL; } return code; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3377 3378 3379 3380 3381 3382 3383 | const char * Tk_PkgInitStubsCheck( Tcl_Interp *interp, const char * version, int exact) { | | | | | 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 | 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/ttk.decls.
︙ | ︙ | |||
139 140 141 142 143 144 145 | declare 35 { Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box) } # # Utilities. # | | | | 139 140 141 142 143 144 145 146 147 148 149 150 | declare 35 { Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box) } # # Utilities. # declare 40 { int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient) } |
Changes to generic/ttk/ttkBlink.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * Copyright 2004, Joe English. * * Usage: * TtkBlinkCursor(corePtr), usually called in a widget's Init hook, * arranges to periodically toggle the corePtr->flags CURSOR_ON bit * on and off (and schedule a redisplay) whenever the widget has focus. * * Note: Widgets may have additional logic to decide whether * to display the cursor or not (e.g., readonly or disabled states); * TtkBlinkCursor() does not account for this. * | < < | | > > < > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | /* * Copyright 2004, Joe English. * * Usage: * TtkBlinkCursor(corePtr), usually called in a widget's Init hook, * arranges to periodically toggle the corePtr->flags CURSOR_ON bit * on and off (and schedule a redisplay) whenever the widget has focus. * * Note: Widgets may have additional logic to decide whether * to display the cursor or not (e.g., readonly or disabled states); * TtkBlinkCursor() does not account for this. * */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" #define DEF_CURSOR_ON_TIME 600 /* milliseconds */ #define DEF_CURSOR_OFF_TIME 300 /* milliseconds */ /* Interp-specific data for tracking cursors: */ typedef struct { WidgetCore *owner; /* Widget that currently has cursor */ Tcl_TimerToken timer; /* Blink timer */ int onTime; /* #milliseconds to blink cursor on */ int offTime; /* #milliseconds to blink cursor off */ } CursorManager; /* CursorManagerDeleteProc -- * InterpDeleteProc for cursor manager. */ static void CursorManagerDeleteProc( void *clientData, TCL_UNUSED(Tcl_Interp *)) { CursorManager *cm = (CursorManager*)clientData; if (cm->timer) { Tcl_DeleteTimerHandler(cm->timer); } ckfree(clientData); } /* GetCursorManager -- * Look up and create if necessary the interp's cursor manager. */ static CursorManager *GetCursorManager(Tcl_Interp *interp) { static const char *cm_key = "ttk::CursorManager"; CursorManager *cm = (CursorManager *)Tcl_GetAssocData(interp, cm_key,0); Tk_Window window; Tk_Uid value; int intValue; if (!cm) { cm = (CursorManager *)ckalloc(sizeof(*cm)); cm->timer = 0; cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; cm->offTime = DEF_CURSOR_OFF_TIME; /* Override on and off default times with values obtained from * the option database (if such values are specified). */ window = Tk_MainWindow(interp); if (window) { value = Tk_GetOption(window, "insertOnTime", "OnTime"); if (value) { if (Tcl_GetInt(interp, value, &intValue) == TCL_OK) { cm->onTime = intValue; } } value = Tk_GetOption(window, "insertOffTime", "OffTime"); if (value) { if (Tcl_GetInt(interp, value, &intValue) == TCL_OK) { cm->offTime = intValue; } } } Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm); } return cm; } /* CursorBlinkProc -- * Timer handler to blink the insert cursor on and off. */ static void CursorBlinkProc(void *clientData) { CursorManager *cm = (CursorManager *)clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { cm->owner->flags &= ~CURSOR_ON; blinkTime = cm->offTime; |
︙ | ︙ | |||
127 128 129 130 131 132 133 | */ #define CursorEventMask (FocusChangeMask|StructureNotifyMask) #define RealFocusEvent(d) \ (d == NotifyInferior || d == NotifyAncestor || d == NotifyNonlinear) static void | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | */ #define CursorEventMask (FocusChangeMask|StructureNotifyMask) #define RealFocusEvent(d) \ (d == NotifyInferior || d == NotifyAncestor || d == NotifyNonlinear) static void CursorEventProc(void *clientData, XEvent *eventPtr) { WidgetCore *corePtr = (WidgetCore *)clientData; CursorManager *cm = GetCursorManager(corePtr->interp); switch (eventPtr->type) { case DestroyNotify: if (cm->owner == corePtr) |
︙ | ︙ | |||
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | case FocusOut: if (RealFocusEvent(eventPtr->xfocus.detail)) LoseCursor(cm, corePtr); break; } } /* * TtkBlinkCursor (main routine) -- * Arrange to blink the cursor on and off whenever the * widget has focus. */ void TtkBlinkCursor(WidgetCore *corePtr) { Tk_CreateEventHandler( corePtr->tkwin, CursorEventMask, CursorEventProc, corePtr); } /*EOF*/ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | case FocusOut: if (RealFocusEvent(eventPtr->xfocus.detail)) LoseCursor(cm, corePtr); break; } } void TtkSetBlinkCursorOnTime(Tcl_Interp* interp, int onTime) { CursorManager* cm = GetCursorManager(interp); if (onTime >= 0) cm->onTime = onTime; } void TtkSetBlinkCursorOffTime(Tcl_Interp* interp, int offTime) { CursorManager* cm = GetCursorManager(interp); if (offTime >= 0) cm->offTime = offTime; } /* * TtkSetBlinkCursorTimes -- * Set cursor blink on and off times from the "." style defaults * -insertontime and -insertofftime - For instance to set cursor * blinking off: * ttk::style configure . -insertofftime 0 */ void TtkSetBlinkCursorTimes(Tcl_Interp* interp) { Ttk_Theme theme; Ttk_Style style = NULL; Tcl_Obj* result; int timeInterval; theme = Ttk_GetCurrentTheme(interp); style = Ttk_GetStyle(theme, "."); result = Ttk_StyleDefault(style, "-insertontime"); if (result) { Tcl_GetIntFromObj(interp, result, &timeInterval); TtkSetBlinkCursorOnTime(interp, timeInterval); } result = Ttk_StyleDefault(style, "-insertofftime"); if (result) { Tcl_GetIntFromObj(interp, result, &timeInterval); TtkSetBlinkCursorOffTime(interp, timeInterval); } } /* * TtkBlinkCursor (main routine) -- * Arrange to blink the cursor on and off whenever the * widget has focus. */ void TtkBlinkCursor(WidgetCore *corePtr) { Tk_CreateEventHandler( corePtr->tkwin, CursorEventMask, CursorEventProc, corePtr); } /*EOF*/ |
Changes to generic/ttk/ttkButton.c.
1 | /* | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * Copyright © 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" /* Bit fields for OptionSpec mask field: */ #define STATE_CHANGED (0x100) /* -state option changed */ #define DEFAULTSTATE_CHANGED (0x200) /* -default option changed */ |
︙ | ︙ | |||
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 | 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", TTK_OPTION_UNDERLINE_DEF(Base, base.underlineObj), 0}, {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: */ |
︙ | ︙ | |||
119 120 121 122 123 124 125 | Tcl_DecrRefCount(basePtr->base.textObj); basePtr->base.textObj = newText; TtkResizeWidget(&basePtr->core); } static void | | > > < | | > > > > > < < < < < < | 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 | Tcl_DecrRefCount(basePtr->base.textObj); basePtr->base.textObj = newText; TtkResizeWidget(&basePtr->core); } static void BaseInitialize( TCL_UNUSED(Tcl_Interp *), void *recordPtr) { Base *basePtr = (Base *)recordPtr; basePtr->base.textVariableTrace = 0; basePtr->base.imageSpec = NULL; } static void BaseCleanup(void *recordPtr) { Base *basePtr = (Base *)recordPtr; if (basePtr->base.textVariableTrace) Ttk_UntraceVariable(basePtr->base.textVariableTrace); if (basePtr->base.imageSpec) TtkFreeImageSpec(basePtr->base.imageSpec); } static void BaseImageChanged( void *clientData, TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { Base *basePtr = (Base *)clientData; TtkResizeWidget(&basePtr->core); } static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Base *basePtr = (Base *)recordPtr; |
︙ | ︙ | |||
199 200 201 202 203 204 205 | TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj); } return TCL_OK; } static int | | > > > < < | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj); } return TCL_OK; } static int BasePostConfigure( TCL_UNUSED(Tcl_Interp *), void *recordPtr, TCL_UNUSED(int)) { Base *basePtr = (Base *)recordPtr; int status = TCL_OK; if (basePtr->base.textVariableTrace) { status = Ttk_FireTrace(basePtr->base.textVariableTrace); } return status; } |
︙ | ︙ | |||
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) { |
︙ | ︙ | |||
360 361 362 363 364 365 366 | } /* $button invoke -- * Evaluate the button's -command. */ static int ButtonInvokeCommand( | | > | < > | | 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 | } /* $button invoke -- * Evaluate the button's -command. */ static int ButtonInvokeCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Button *buttonPtr = (Button *)recordPtr; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; } 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 */ |
︙ | ︙ | |||
543 544 545 546 547 548 549 | /* * Checkbutton 'invoke' subcommand: * Toggles the checkbutton state. */ static int CheckbuttonInvokeCommand( | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | /* * Checkbutton 'invoke' subcommand: * Toggles the checkbutton state. */ static int CheckbuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Checkbutton *checkPtr = (Checkbutton *)recordPtr; WidgetCore *corePtr = &checkPtr->core; Tcl_Obj *newValue; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); |
︙ | ︙ | |||
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 */ |
︙ | ︙ | |||
730 731 732 733 734 735 736 | /* * Radiobutton 'invoke' subcommand: * Sets the radiobutton -variable to the -value, evaluates the -command. */ static int RadiobuttonInvokeCommand( | | | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | /* * Radiobutton 'invoke' subcommand: * Sets the radiobutton -variable to the -value, evaluates the -command. */ static int RadiobuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Radiobutton *radioPtr = (Radiobutton *)recordPtr; WidgetCore *corePtr = &radioPtr->core; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; |
︙ | ︙ | |||
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 */ |
︙ | ︙ | |||
811 812 813 814 815 816 817 | MenubuttonPart menubutton; } Menubutton; /* * Option specifications: */ static const char *const directionStrings[] = { | | | > | 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 | MenubuttonPart menubutton; } Menubutton; /* * Option specifications: */ static const char *const directionStrings[] = { "above", "below", "flush", "left", "right", NULL }; 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 */ |
︙ | ︙ | |||
862 863 864 865 866 867 868 | TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ MODULE_SCOPE void TtkButton_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TLabel", LabelLayout); Ttk_RegisterLayout(theme, "TButton", ButtonLayout); Ttk_RegisterLayout(theme, "TCheckbutton", CheckbuttonLayout); Ttk_RegisterLayout(theme, "TRadiobutton", RadiobuttonLayout); |
︙ | ︙ |
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. |
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | * * @@@ Colormap flashing on PseudoColor visuals is still possible, * but this will be a transient effect. */ #include "tkInt.h" #include "ttkTheme.h" struct Ttk_ResourceCache_ { Tcl_Interp *interp; /* Interpreter for error reporting */ Tk_Window tkwin; /* Cache window. */ Tcl_HashTable fontTable; /* Entries: Tcl_Obj* holding FontObjs */ Tcl_HashTable colorTable; /* Entries: Tcl_Obj* holding ColorObjs */ Tcl_HashTable borderTable; /* Entries: Tcl_Obj* holding BorderObjs */ | > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * * @@@ Colormap flashing on PseudoColor visuals is still possible, * but this will be a transient effect. */ #include "tkInt.h" #include "ttkTheme.h" #ifdef _WIN32 #include "tkWinInt.h" #endif struct Ttk_ResourceCache_ { Tcl_Interp *interp; /* Interpreter for error reporting */ Tk_Window tkwin; /* Cache window. */ Tcl_HashTable fontTable; /* Entries: Tcl_Obj* holding FontObjs */ Tcl_HashTable colorTable; /* Entries: Tcl_Obj* holding ColorObjs */ Tcl_HashTable borderTable; /* Entries: Tcl_Obj* holding BorderObjs */ |
︙ | ︙ | |||
162 163 164 165 166 167 168 | ckfree(cache); } /* * CacheWinEventHandler -- * Detect when the cache window is destroyed, clear cache. */ | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | ckfree(cache); } /* * CacheWinEventHandler -- * Detect when the cache window is destroyed, clear cache. */ static void CacheWinEventHandler(void *clientData, XEvent *eventPtr) { Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData; if (eventPtr->type != DestroyNotify) { return; } Tk_DeleteEventHandler(cache->tkwin, StructureNotifyMask, |
︙ | ︙ | |||
205 206 207 208 209 210 211 | XColor *colorPtr) { int newEntry; Tcl_HashEntry *entryPtr; char nameBuf[14]; Tcl_Obj *colorNameObj; | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | XColor *colorPtr) { int newEntry; Tcl_HashEntry *entryPtr; char nameBuf[14]; Tcl_Obj *colorNameObj; snprintf(nameBuf, sizeof(nameBuf), "#%04X%04X%04X", colorPtr->red, colorPtr->green, colorPtr->blue); colorNameObj = Tcl_NewStringObj(nameBuf, -1); Tcl_IncrRefCount(colorNameObj); entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry); if (!newEntry) { Tcl_Obj *oldColor = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); |
︙ | ︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | return objPtr; } /* * Template for allocation routines: */ typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *); static Tcl_Obj *Ttk_Use( Tcl_Interp *interp, Tcl_HashTable *table, Allocator allocate, Tk_Window tkwin, Tcl_Obj *objPtr) | > > > > > > > > > > | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | return objPtr; } /* * Template for allocation routines: */ typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *); static void *AllocFont(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) { return Tk_AllocFontFromObj(interp, tkwin, objPtr); } static void *AllocColor(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) { return Tk_AllocColorFromObj(interp, tkwin, objPtr); } static void *AllocBorder(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) { return Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr); } static Tcl_Obj *Ttk_Use( Tcl_Interp *interp, Tcl_HashTable *table, Allocator allocate, Tk_Window tkwin, Tcl_Obj *objPtr) |
︙ | ︙ | |||
278 279 280 281 282 283 284 | * Ttk_UseFont -- * Acquire a font from the cache. */ Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, | | | | | | > > > > > > < < < < < < < | 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 | * Ttk_UseFont -- * Acquire a font from the cache. */ Tcl_Obj *Ttk_UseFont(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->fontTable, AllocFont, tkwin, objPtr); } /* * Ttk_UseColor -- * Acquire a color from the cache. */ Tcl_Obj *Ttk_UseColor(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { objPtr = CheckNamedColor(cache, objPtr); InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->colorTable, AllocColor, tkwin, objPtr); } /* * Ttk_UseBorder -- * Acquire a Tk_3DBorder from the cache. */ Tcl_Obj *Ttk_UseBorder( Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) { objPtr = CheckNamedColor(cache, objPtr); InitCacheWindow(cache, tkwin); return Ttk_Use(cache->interp, &cache->borderTable, AllocBorder, tkwin, objPtr); } /* NullImageChanged -- * Tk_ImageChangedProc for Ttk_UseImage */ static void NullImageChanged( TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { /* No-op */ } /* * Ttk_UseImage -- * Acquire a Tk_Image from the cache. */ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) |
︙ | ︙ |
Changes to generic/ttk/ttkClamTheme.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 | /* * Copyright © 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ #include "tkInt.h" #include "ttkTheme.h" /* * Under windows, the Tk-provided XDrawLine and XDrawArc have an * off-by-one error in the end point. This is especially apparent with this * theme. Defining this macro as true handles this case. */ #if defined(_WIN32) && !defined(WIN32_XDRAWLINE_HACK) #define WIN32_XDRAWLINE_HACK 1 #else #define WIN32_XDRAWLINE_HACK 0 #endif #define STR(x) StR(x) #define StR(x) #x #define SCROLLBAR_THICKNESS 14 |
︙ | ︙ | |||
63 64 65 66 67 68 69 | int y1 = b.y, y2 = b.y + b.height - 1; const int w = WIN32_XDRAWLINE_HACK; GC gc; if ( outerColorObj && (gc=Ttk_GCForColor(tkwin,outerColorObj,d))) { | | | | | | | | | | 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 | int y1 = b.y, y2 = b.y + b.height - 1; const int w = WIN32_XDRAWLINE_HACK; GC gc; if ( outerColorObj && (gc=Ttk_GCForColor(tkwin,outerColorObj,d))) { XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1); /* N */ XDrawLine(display,d,gc, x1+1,y2, x2-1+w,y2); /* S */ XDrawLine(display,d,gc, x1,y1+1, x1,y2-1+w); /* W */ XDrawLine(display,d,gc, x2,y1+1, x2,y2-1+w); /* E */ } if ( upperColorObj && (gc=Ttk_GCForColor(tkwin,upperColorObj,d))) { XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1); /* N */ XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1); /* W */ } if ( lowerColorObj && (gc=Ttk_GCForColor(tkwin,lowerColorObj,d))) { XDrawLine(display,d,gc, x2-1,y2-1, x1+1-w,y2-1); /* S */ XDrawLine(display,d,gc, x2-1,y2-1, x2-1,y1+1-w); /* E */ } } static GC BackgroundGC(Tk_Window tkwin, Tcl_Obj *backgroundObj) { Tk_3DBorder bd = Tk_Get3DBorderFromObj(tkwin, backgroundObj); return Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC); |
︙ | ︙ | |||
125 126 127 128 129 130 131 | * in this theme, borders are always exactly 2 pixels thick. * With -borderwidth 0, border is not drawn at all; * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ static void BorderElementSize( | > | > > > | < < < > | > | > > < < | 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 | * in this theme, borders are always exactly 2 pixels thick. * With -borderwidth 0, border is not drawn at all; * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ static void BorderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { BorderElement *border = (BorderElement*)elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 1) ++borderWidth; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { BorderElement *border = (BorderElement *)elementRecord; int relief = TK_RELIEF_FLAT; int borderWidth = 2; Tcl_Obj *outer = 0, *upper = 0, *lower = 0; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 0) return; switch (relief) { |
︙ | ︙ | |||
194 195 196 197 198 199 200 | /*------------------------------------------------------------------------ * +++ Field element. */ typedef struct { Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; | < < < < < < | | | | | > | > | > | > > < < | | 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 | /*------------------------------------------------------------------------ * +++ Field element. */ typedef struct { Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *backgroundObj; } FieldElement; static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(FieldElement,lightColorObj), LIGHT_COLOR }, { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2)); Tcl_Obj *outer = field->borderColorObj, *inner = field->lightColorObj; DrawSmoothBorder(tkwin, d, b, outer, inner, inner); Tk_Fill3DRectangle( tkwin, d, bg, f.x, f.y, f.width, f.height, 0, TK_RELIEF_SUNKEN); } static const Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /* * Modified field element for comboboxes: * Right edge is expanded to overlap the dropdown button. */ static void ComboboxFieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FieldElement *field = (FieldElement *)elementRecord; GC gc = Ttk_GCForColor(tkwin,field->borderColorObj,d); ++b.width; FieldElementDraw(clientData, elementRecord, tkwin, d, b, state); |
︙ | ︙ | |||
279 280 281 282 283 284 285 286 | ComboboxFieldElementDraw }; /*------------------------------------------------------------------------ * +++ Indicator elements for check and radio buttons. */ typedef struct { | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < | | > > < < | < | | | < < > > > > | < < < < < < > > > > > > > > | < < | | < < > > > | < > | > | > | < < < < | | | | | > | < | | | | < < < | > > | > > > | | | | | < | < < | | < | < < < < | < < < < | > > > > > > > > > > > > > | < > > | < | | < | < < | | | < < > > > > < > > | > | < | | | | | > | < < < > | > | | | | | | < > > > < | > | > > > | < < > > > > | > > > | < | < < < > > > > | < > > | > | < < < < < < < < < < < < | < > > | < > | < | | | | | | | | > | < < | | | | > | < | | | | | | | | | | 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 | ComboboxFieldElementDraw }; /*------------------------------------------------------------------------ * +++ Indicator elements for check and radio buttons. */ /* * Indicator image descriptor: */ typedef struct { int width; /* unscaled width */ int height; /* unscaled height */ const char *const offDataPtr; const char *const onDataPtr; } IndicatorSpec; static const char checkbtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v16h1v-15h15v-1z' fill='#9e9a91'/>\n\ <path d='m15 1v14h-14v1h15v-15z' fill='#cfcdc8'/>\n\ <rect x='1' y='1' width='14' height='14' fill='#ffffff'/>\n\ </svg>"; static const char checkbtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v16h1v-15h15v-1z' fill='#9e9a91'/>\n\ <path d='m15 1v14h-14v1h15v-15z' fill='#cfcdc8'/>\n\ <rect x='1' y='1' width='14' height='14' fill='#ffffff'/>\n\ <path d='m5 5 6 6m0-6-6 6' fill='none' stroke='#000000' stroke-linecap='round' stroke-width='2'/>\n\ </svg>"; static const IndicatorSpec checkbutton_spec = { 16, 16, checkbtnOffData, checkbtnOnData }; static const char radiobtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradient' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#9e9a91' offset='0'/>\n\ <stop stop-color='#cfcdc8' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradient)'/>\n\ <circle cx='8' cy='8' r='7' fill='#ffffff'/>\n\ </svg>"; static const char radiobtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradient' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#9e9a91' offset='0'/>\n\ <stop stop-color='#cfcdc8' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradient)'/>\n\ <circle cx='8' cy='8' r='7' fill='#ffffff'/>\n\ <circle cx='8' cy='8' r='4' fill='#000000'/>\n\ </svg>"; static const IndicatorSpec radiobutton_spec = { 16, 16, radiobtnOffData, radiobtnOnData }; typedef struct { Tcl_Obj *marginObj; Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *upperColorObj; Tcl_Obj *lowerColorObj; } IndicatorElement; static const Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "1" }, { "-indicatorbackground", TK_OPTION_COLOR, offsetof(IndicatorElement,backgroundObj), "white" }, { "-indicatorforeground", TK_OPTION_COLOR, offsetof(IndicatorElement,foregroundObj), "black" }, { "-upperbordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,upperColorObj), DARKEST_COLOR }, { "-lowerbordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,lowerColorObj), DARK_COLOR }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { const IndicatorSpec *spec = (const IndicatorSpec *)clientData; IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; double scalingLevel = TkScalingLevel(tkwin); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = spec->width * scalingLevel + Ttk_PaddingWidth(margins); *heightPtr = spec->height * scalingLevel + Ttk_PaddingHeight(margins); } static void ColorToStr( const XColor *colorPtr, char *colorStr) /* in the format "RRGGBB" */ { snprintf(colorStr, 7, "%02x%02x%02x", colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8); } static void ImageChanged( /* to be passed to Tk_GetImage() */ TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { } static void IndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding padding; const IndicatorSpec *spec = (const IndicatorSpec *)clientData; double scalingLevel = TkScalingLevel(tkwin); int width = spec->width * scalingLevel; int height = spec->height * scalingLevel; char upperBdColorStr[7], lowerBdColorStr[7], bgColorStr[7], fgColorStr[7]; unsigned int selected = (state & TTK_STATE_SELECTED); Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[60]; Tk_Image img; const char *svgDataPtr; size_t svgDataLen; char *svgDataCopy; char *upperBdColorPtr, *lowerBdColorPtr, *bgColorPtr, *fgColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); /* * Sanity check */ if ( b.x < 0 || b.y < 0 || Tk_Width(tkwin) < b.x + width || Tk_Height(tkwin) < b.y + height) { /* Oops! Not enough room to display the image. * Don't draw anything. */ return; } /* * Construct the color strings upperBdColorStr, lowerBdColorStr, * bgColorStr, and fgColorStr */ ColorToStr(Tk_GetColorFromObj(tkwin, indicator->upperColorObj), upperBdColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->lowerColorObj), lowerBdColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->backgroundObj), bgColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->foregroundObj), fgColorStr); /* * Check whether there is an SVG image of this size for the indicator's * type (0 = checkbtn, 1 = radiobtn) and these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::indicator_clam%d_%d_%s_%s_%s_%s", width, spec->offDataPtr == radiobtnOffData, upperBdColorStr, lowerBdColorStr, bgColorStr, selected ? fgColorStr : "XXXXXX"); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Determine the SVG data to use for the photo image */ svgDataPtr = (selected ? spec->onDataPtr : spec->offDataPtr); /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ upperBdColorPtr = strstr(svgDataCopy, "9e9a91"); lowerBdColorPtr = strstr(svgDataCopy, "cfcdc8"); bgColorPtr = strstr(svgDataCopy, "ffffff"); fgColorPtr = strstr(svgDataCopy, "000000"); assert(upperBdColorPtr); assert(lowerBdColorPtr); assert(bgColorPtr); memcpy(upperBdColorPtr, upperBdColorStr, 6); memcpy(lowerBdColorPtr, lowerBdColorStr, 6); memcpy(bgColorPtr, bgColorStr, 6); if (fgColorPtr != NULL) { memcpy(fgColorPtr, fgColorStr, 6); } /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Display the image */ Tk_RedrawImage(img, 0, 0, width, height, d, b.x, b.y); Tk_FreeImage(img); } static const Ttk_ElementSpec IndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, IndicatorElementDraw }; /*------------------------------------------------------------------------ * +++ Grips. * * TODO: factor this with ThumbElementDraw */ typedef struct { Tcl_Obj *lightColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *gripSizeObj; } GripElement; static const Ttk_ElementOptionSpec GripElementOptions[] = { { "-lightcolor", TK_OPTION_COLOR, offsetof(GripElement,lightColorObj), LIGHT_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(GripElement,borderColorObj), DARKEST_COLOR }, { "-gripsize", TK_OPTION_PIXELS, offsetof(GripElement,gripSizeObj), "7.5p" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void GripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData); GripElement *grip = (GripElement *)elementRecord; int gripSize = 0; Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = gripSize; } else { *heightPtr = gripSize; } } static void GripElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { const int w = WIN32_XDRAWLINE_HACK; Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData); GripElement *grip = (GripElement *)elementRecord; GC lightGC = Ttk_GCForColor(tkwin,grip->lightColorObj,d); GC darkGC = Ttk_GCForColor(tkwin,grip->borderColorObj,d); int gripPad = 1, gripSize = 0; int i; Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); if (orient == TTK_ORIENT_HORIZONTAL) { int x = b.x + (b.width - gripSize) / 2; int y1 = b.y + gripPad, y2 = b.y + b.height - gripPad - 1 + w; for (i=0; i<gripSize; ++i) { XDrawLine(Tk_Display(tkwin), d, (i&1)?lightGC:darkGC, x,y1, x,y2); ++x; } } else { int y = b.y + (b.height - gripSize) / 2; int x1 = b.x + gripPad, x2 = b.x + b.width - gripPad - 1 + w; for (i=0; i<gripSize; ++i) { XDrawLine(Tk_Display(tkwin), d, (i&1)?lightGC:darkGC, x1,y, x2,y); ++y; } } } static const Ttk_ElementSpec GripElementSpec = { TK_STYLE_VERSION_2, sizeof(GripElement), |
︙ | ︙ | |||
570 571 572 573 574 575 576 | Tcl_Obj *backgroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *troughColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *arrowColorObj; Tcl_Obj *arrowSizeObj; | | | | | > | > | > > < < > | > | > > < < < | > | > | > > | < < | | | | | | | < > | > | > > < < | | < | 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 | Tcl_Obj *backgroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *troughColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *arrowColorObj; Tcl_Obj *arrowSizeObj; Tcl_Obj *gripSizeObj; Tcl_Obj *sliderlengthObj; } ScrollbarElement; static const Ttk_ElementOptionSpec ScrollbarElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ScrollbarElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(ScrollbarElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,borderColorObj), DARKEST_COLOR }, { "-troughcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,troughColorObj), DARKER_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,darkColorObj), DARK_COLOR }, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,arrowColorObj), "#000000" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) }, { "-gripsize", TK_OPTION_PIXELS, offsetof(ScrollbarElement,gripSizeObj), "7.5p" }, { "-sliderlength", TK_OPTION_PIXELS, offsetof(ScrollbarElement,sliderlengthObj), "30" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TroughElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; GC gcb = Ttk_GCForColor(tkwin,sb->borderColorObj,d); GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d); XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1); XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1); } static const Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, TtkNullElementSize, TroughElementDraw }; static void ThumbElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; int size = SCROLLBAR_THICKNESS; Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &size); *widthPtr = *heightPtr = size; } static void ThumbElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; int gripSize = 0; Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; GC lightGC, darkGC; int x1, y1, x2, y2, dx, dy, i; const int w = WIN32_XDRAWLINE_HACK; DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle( Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, sb->gripSizeObj, &gripSize); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + (b.width - gripSize) / 2; y1 = b.y + 2; y2 = b.y + b.height - 3 + w; } else { dx = 0; dy = 1; y1 = y2 = b.y + (b.height - gripSize) / 2; x1 = b.x + 2; x2 = b.x + b.width - 3 + w; } for (i=0; i<gripSize; ++i) { XDrawLine(Tk_Display(tkwin), d, (i&1)?lightGC:darkGC, x1,y1, x2,y2); x1 += dx; x2 += dx; y1 += dy; y2 += dy; } } static const Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ThumbElementSize, ThumbElementDraw }; /*------------------------------------------------------------------------ * +++ Slider element. */ static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; int length, thickness; Ttk_Orient orient; length = thickness = SCROLLBAR_THICKNESS; Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length); if (orient == TTK_ORIENT_VERTICAL) { *heightPtr = length; *widthPtr = thickness; } else { *heightPtr = thickness; *widthPtr = length; } } static const Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, SliderElementSize, |
︙ | ︙ | |||
739 740 741 742 743 744 745 | widthPtr, heightPtr, paddingPtr); *paddingPtr = Ttk_UniformPadding(2); *widthPtr += 4; *heightPtr += 4; } static void PbarElementDraw( | > | > | > > < < < | | > > > > < < < | > > > > > | > > > | > < > > > > | < < | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | widthPtr, heightPtr, paddingPtr); *paddingPtr = Ttk_UniformPadding(2); *widthPtr += 4; *heightPtr += 4; } static void PbarElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } } static const Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, PbarElementSize, PbarElementDraw }; /*------------------------------------------------------------------------ * +++ Scrollbar arrows. */ static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding = Ttk_UniformPadding(round(3 * scalingLevel)); int size = SCROLLBAR_THICKNESS; Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); if (*widthPtr < *heightPtr) { *widthPtr = *heightPtr; } else { *heightPtr = *widthPtr; } } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding = Ttk_UniformPadding(round(3 * scalingLevel)); int cx, cy; GC gc = Ttk_GCForColor(tkwin, sb->arrowColorObj, d); DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle( Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); b = Ttk_PadBox(b, padding); switch (direction) { case ARROW_UP: case ARROW_DOWN: TtkArrowSize(b.width/2, direction, &cx, &cy); if ((b.height - cy) % 2 == 1) { ++cy; } break; case ARROW_LEFT: case ARROW_RIGHT: TtkArrowSize(b.height/2, direction, &cx, &cy); if ((b.width - cx) % 2 == 1) { ++cx; } break; } b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, direction); } static const Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ArrowElementSize, ArrowElementDraw }; /* * Modified arrow element for spinboxes: * The width and height are different. */ static void SpinboxArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *sb = (ScrollbarElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding = Ttk_UniformPadding(round(3 * scalingLevel)); int size = 10; Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); } static const Ttk_ElementSpec SpinboxArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, SpinboxArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. * * Note: Tabs, except for the rightmost, overlap the neighbor to * their right by one pixel. */ |
︙ | ︙ | |||
843 844 845 846 847 848 849 | offsetof(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(NotebookElement,darkColorObj), DARK_COLOR }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TabElementSize( | > > | > > | > > | < < | < > | > > > > > > > > | > > | > > > > | | > > | > | > > > > > < | | > > | > | > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > | > > > > > > > > > > > > > | | > > > > > > > | | | | | | | > > > | > > > | < < < < < > | > | > > < < | 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 | offsetof(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(NotebookElement,darkColorObj), DARK_COLOR }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TabElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; int borderWidth = 2; if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); switch (nbTabsStickBit) { default: case TTK_STICK_S: paddingPtr->bottom = 0; break; case TTK_STICK_N: paddingPtr->top = 0; break; case TTK_STICK_E: paddingPtr->right = 0; break; case TTK_STICK_W: paddingPtr->left = 0; break; } } static void TabElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; int borderWidth = 2, delta = 0; NotebookElement *tab = (NotebookElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); Display *display = Tk_Display(tkwin); int x1, y1, x2, y2; GC gc; const int w = WIN32_XDRAWLINE_HACK; if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } if (state & TTK_STATE_SELECTED) { delta = borderWidth; } switch (nbTabsStickBit) { default: case TTK_STICK_S: if (state & TTK_STATE_USER2) { /* rightmost tab */ --b.width; } Tk_Fill3DRectangle(tkwin, d, border, b.x+2, b.y+2, b.width-1, b.height-2+delta, borderWidth, TK_RELIEF_FLAT); x1 = b.x; y1 = b.y; /* top left */ x2 = b.x + b.width; y2 = b.y + b.height-1; /* bottom right */ gc = Ttk_GCForColor(tkwin, tab->borderColorObj, d); XDrawLine(display, d, gc, x1, y1+1, x1, y2+1+w); XDrawLine(display, d, gc, x2, y1+1, x2, y2+1+w); XDrawLine(display, d, gc, x1+1, y1, x2-1+w, y1); gc = Ttk_GCForColor(tkwin, tab->lightColorObj, d); XDrawLine(display, d, gc, x1+1, y1+1, x1+1, y2+delta+w); XDrawLine(display, d, gc, x1+1, y1+1, x2-1+w, y1+1); break; case TTK_STICK_N: if (state & TTK_STATE_USER2) { /* rightmost tab */ --b.width; } Tk_Fill3DRectangle(tkwin, d, border, b.x+2, b.y-delta, b.width-1, b.height-2+delta, borderWidth, TK_RELIEF_FLAT); x1 = b.x; y1 = b.y + b.height-1; /* bottom left */ x2 = b.x + b.width; y2 = b.y; /* top right */ gc = Ttk_GCForColor(tkwin, tab->borderColorObj, d); XDrawLine(display, d, gc, x1, y1-1, x1, y2-1-w); XDrawLine(display, d, gc, x2, y1-1, x2, y2-1-w); XDrawLine(display, d, gc, x1+1, y1, x2-1+w, y1); gc = Ttk_GCForColor(tkwin, tab->lightColorObj, d); XDrawLine(display, d, gc, x1+1, y1-1, x1+1, y2-delta-w); XDrawLine(display, d, gc, x1+1, y1-1, x2-1+w, y1-1); break; case TTK_STICK_E: if (state & TTK_STATE_USER2) { /* bottommost tab */ --b.height; } Tk_Fill3DRectangle(tkwin, d, border, b.x+2, b.y+2, b.width-2+delta, b.height-1, borderWidth, TK_RELIEF_FLAT); x1 = b.x; y1 = b.y; /* top left */ x2 = b.x + b.width-1; y2 = b.y + b.height; /* bottom right */ gc = Ttk_GCForColor(tkwin, tab->borderColorObj, d); XDrawLine(display, d, gc, x1, y1+1, x1, y2-1+w); XDrawLine(display, d, gc, x1+1, y1, x2+1+w, y1); XDrawLine(display, d, gc, x1+1, y2, x2+1+w, y2); gc = Ttk_GCForColor(tkwin, tab->lightColorObj, d); XDrawLine(display, d, gc, x1+1, y1+1, x1+1, y2-1+w); XDrawLine(display, d, gc, x1+1, y1+1, x2+delta+w, y1+1); break; case TTK_STICK_W: if (state & TTK_STATE_USER2) { /* bottommost tab */ --b.height; } Tk_Fill3DRectangle(tkwin, d, border, b.x-delta, b.y+2, b.width-2+delta, b.height-1, borderWidth, TK_RELIEF_FLAT); x1 = b.x + b.width-1; y1 = b.y; /* top right */ x2 = b.x; y2 = b.y + b.height; /* bottom left */ gc = Ttk_GCForColor(tkwin, tab->borderColorObj, d); XDrawLine(display, d, gc, x1, y1+1, x1, y2-1+w); XDrawLine(display, d, gc, x1-1, y1, x2-1-w, y1); XDrawLine(display, d, gc, x1-1, y2, x2-1-w, y2); gc = Ttk_GCForColor(tkwin, tab->lightColorObj, d); XDrawLine(display, d, gc, x1-1, y1+1, x1-1, y2-1+w); XDrawLine(display, d, gc, x1-1, y1+1, x2-delta-w, y1+1); break; } } static const Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NotebookElement), NotebookElementOptions, TabElementSize, TabElementDraw }; static void ClientElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { int borderWidth = 2; *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void ClientElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { NotebookElement *ce = (NotebookElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 2; Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_FLAT); DrawSmoothBorder(tkwin, d, b, ce->borderColorObj, ce->lightColorObj, ce->darkColorObj); } |
︙ | ︙ | |||
978 979 980 981 982 983 984 | { Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0); if (!theme) { return TCL_ERROR; } | | | | | | | | | | | | | | > > | | > > | | | < | > | | | | | | 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 | { Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0); if (!theme) { return TCL_ERROR; } Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Combobox.field", &ComboboxFieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL); Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "Spinbox.uparrow", &SpinboxArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "Spinbox.downarrow", &SpinboxArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, INT2PTR(ARROW_LEFT)); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, INT2PTR(ARROW_RIGHT)); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &IndicatorElementSpec, (void *)&checkbutton_spec); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &IndicatorElementSpec, (void *)&radiobutton_spec); Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL); Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "bar", &PbarElementSpec, NULL); Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL); |
︙ | ︙ |
Changes to generic/ttk/ttkClassicTheme.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 | /* * Copyright © 2004, Joe English * * "classic" theme; implements the classic Motif-like Tk look. * */ #include "tkInt.h" #include "ttkTheme.h" #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" /*---------------------------------------------------------------------- * +++ Highlight element implementation. * Draw a solid highlight border to indicate focus. */ typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; Tcl_Obj *defaultStateObj; } HighlightElement; static const Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, offsetof(HighlightElement,highlightThicknessObj), "0" }, { "-default", TK_OPTION_ANY, offsetof(HighlightElement,defaultStateObj), "disabled" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void HighlightElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, &highlightThickness); *paddingPtr = Ttk_UniformPadding((short)highlightThickness); } static void HighlightElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), TCL_UNUSED(Ttk_State)) { HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; Tk_GetPixelsFromObj(NULL, tkwin, hl->highlightThicknessObj, &highlightThickness); if (highlightColor && highlightThickness > 0) { Ttk_GetButtonDefaultStateFromObj(NULL, hl->defaultStateObj, &defaultState); GC gc = Tk_GCForColor(highlightColor, d); if (defaultState == TTK_BUTTON_DEFAULT_NORMAL) { TkDrawInsetFocusHighlight(tkwin, gc, highlightThickness, d, 5); } else { Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d); } } } static const Ttk_ElementSpec HighlightElementSpec = { TK_STYLE_VERSION_2, sizeof(HighlightElement), |
︙ | ︙ | |||
98 99 100 101 102 103 104 | offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ButtonBorderElementSize( | > | > > > | < < < < | > | > | > > < < | | 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 | offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ButtonBorderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; int borderWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: * padding for default ring is drawn in the wrong color * when the button is active.) */ static void ButtonBorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; int inset = 0; /* * Get option values. */ border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); /* * Default ring: */ switch (defaultState) |
︙ | ︙ | |||
187 188 189 190 191 192 193 194 195 196 197 198 199 200 | { TK_STYLE_VERSION_2, sizeof(ButtonBorderElement), ButtonBorderElementOptions, ButtonBorderElementSize, ButtonBorderElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a 3-D shaded triangle. * clientData is an enum ArrowDirection pointer. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | { TK_STYLE_VERSION_2, sizeof(ButtonBorderElement), ButtonBorderElementOptions, ButtonBorderElementSize, ButtonBorderElementDraw }; /*---------------------------------------------------------------------- * +++ Indicator element. * * Draws the on/off indicator for checkbuttons and radiobuttons. * * Draws a 3-D square (or diamond), raised if off, sunken if on. * * This is actually a regression from Tk 8.5 back to the ugly old Motif * style; use the "alt", "clam", or "default" theme" for newer, nicer * versions. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *reliefObj; Tcl_Obj *colorObj; Tcl_Obj *sizeObj; Tcl_Obj *marginObj; Tcl_Obj *borderWidthObj; } IndicatorElement; static const Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, offsetof(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, { "-indicatorrelief", TK_OPTION_RELIEF, offsetof(IndicatorElement,reliefObj), "raised" }, { "-indicatorsize", TK_OPTION_PIXELS, offsetof(IndicatorElement,sizeObj), "9p" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* * Checkbutton indicators: 3-D square. */ static void SquareIndicatorElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; int diameter = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &diameter); *widthPtr = diameter + Ttk_PaddingWidth(margins); *heightPtr = diameter + Ttk_PaddingHeight(margins); } static void SquareIndicatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Tk_3DBorder border = 0, interior = 0; int relief = TK_RELIEF_RAISED; Ttk_Padding padding; int borderWidth = 2; int diameter; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); Tk_GetPixelsFromObj(NULL, tkwin, indicator->borderWidthObj,&borderWidth); Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief); Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); diameter = b.width < b.height ? b.width : b.height; Tk_Fill3DRectangle(tkwin, d, interior, b.x, b.y, diameter, diameter,borderWidth, TK_RELIEF_FLAT); Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, diameter, diameter, borderWidth, relief); } /* * Radiobutton indicators: 3-D diamond. */ static void DiamondIndicatorElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; int diameter = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &diameter); *widthPtr = diameter + 3 + Ttk_PaddingWidth(margins); *heightPtr = diameter + 3 + Ttk_PaddingHeight(margins); } static void DiamondIndicatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Tk_3DBorder border = 0, interior = 0; int borderWidth = 2; int relief = TK_RELIEF_RAISED; int diameter, radius; XPoint points[4]; Ttk_Padding padding; interior = Tk_Get3DBorderFromObj(tkwin, indicator->colorObj); border = Tk_Get3DBorderFromObj(tkwin, indicator->backgroundObj); Tk_GetPixelsFromObj(NULL, tkwin, indicator->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL,indicator->reliefObj,&relief); Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); diameter = b.width < b.height ? b.width : b.height; radius = diameter / 2; points[0].x = b.x; points[0].y = b.y + radius; points[1].x = b.x + radius; points[1].y = b.y + 2*radius; points[2].x = b.x + 2*radius; points[2].y = b.y + radius; points[3].x = b.x + radius; points[3].y = b.y; Tk_Fill3DPolygon(tkwin,d,interior,points,4,borderWidth,TK_RELIEF_FLAT); Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief); } static const Ttk_ElementSpec CheckbuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, SquareIndicatorElementSize, SquareIndicatorElementDraw }; static const Ttk_ElementSpec RadiobuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, DiamondIndicatorElementSize, DiamondIndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Menubutton indicators. * * These aren't functional like radio/check indicators, * they're just affordability indicators. * * Standard Tk sets the indicator size to 4.0 mm by 1.7 mm. * I have no idea where these numbers came from. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *marginObj; } MenuIndicatorElement; static const Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorwidth", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,widthObj), "4.0m" }, { "-indicatorheight", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,heightObj), "1.7m" }, { "-indicatorborderwidth", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-indicatorrelief", TK_OPTION_RELIEF, offsetof(MenuIndicatorElement,reliefObj), "raised" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(MenuIndicatorElement,marginObj), "5 0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void MenuIndicatorElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord; Ttk_Padding margins; Tk_GetPixelsFromObj(NULL, tkwin, mi->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, mi->heightObj, heightPtr); Ttk_GetPaddingFromObj(NULL, tkwin, mi->marginObj, &margins); *widthPtr += Ttk_PaddingWidth(margins); *heightPtr += Ttk_PaddingHeight(margins); } static void MenuIndicatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { MenuIndicatorElement *mi = (MenuIndicatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, mi->backgroundObj); Ttk_Padding margins; int borderWidth = 2; Ttk_GetPaddingFromObj(NULL,tkwin,mi->marginObj,&margins); b = Ttk_PadBox(b, margins); Tk_GetPixelsFromObj(NULL, tkwin, mi->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_RAISED); } static const Ttk_ElementSpec MenuIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(MenuIndicatorElement), MenuIndicatorElementOptions, MenuIndicatorElementSize, MenuIndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a 3-D shaded triangle. * clientData is an enum ArrowDirection pointer. */ |
︙ | ︙ | |||
216 217 218 219 220 221 222 | { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ArrowElementSize( | > | > | > > < < | > | < < | 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 | { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ArrowElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ArrowElement *arrow = (ArrowElement *)elementRecord; int size = 12; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); *widthPtr = *heightPtr = size; } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); ArrowElement *arrow = (ArrowElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); int borderWidth = 2; int relief = TK_RELIEF_RAISED; int size = b.width < b.height ? b.width : b.height; XPoint points[3]; Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); /* * @@@ There are off-by-one pixel errors in the way these are drawn; * @@@ need to take a look at Tk_Fill3DPolygon and X11 to find the * @@@ exact rules. */ switch (direction) |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 | TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Slider element. * * This is the moving part of the scale widget. Drawn as a raised box. */ typedef struct { Tcl_Obj *orientObj; /* orientation of overall slider */ Tcl_Obj *lengthObj; /* slider length */ Tcl_Obj *thicknessObj; /* slider thickness */ Tcl_Obj *reliefObj; /* the relief for this object */ Tcl_Obj *borderObj; /* the background color */ Tcl_Obj *borderWidthObj; /* the size of the border */ } SliderElement; static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj), "30" }, { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, { "-sliderborderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SliderElement *slider = (SliderElement *)elementRecord; Ttk_Orient orient; int length, thickness; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); switch (orient) { case TTK_ORIENT_VERTICAL: *widthPtr = thickness; *heightPtr = length; break; case TTK_ORIENT_HORIZONTAL: *widthPtr = length; *heightPtr = thickness; break; } } static void SliderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = NULL; int relief = TK_RELIEF_RAISED, borderWidth = 2; Ttk_Orient orient; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); if (relief != TK_RELIEF_FLAT) { if (orient == TTK_ORIENT_HORIZONTAL) { if (b.width > 4) { b.x += b.width/2; XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), b.x-1, b.y+borderWidth, b.x-1, b.y+b.height-borderWidth); XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), b.x, b.y+borderWidth, b.x, b.y+b.height-borderWidth); } } else { if (b.height > 4) { b.y += b.height/2; XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), b.x+borderWidth, b.y-1, b.x+b.width-borderWidth, b.y-1); XDrawLine(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), b.x+borderWidth, b.y, b.x+b.width-borderWidth, b.y); } } } } static const Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, SliderElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. |
︙ | ︙ | |||
328 329 330 331 332 333 334 | { "-handlepad", TK_OPTION_PIXELS, offsetof(SashElement,handlePadObj), "8" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, | | > < < | > < | 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 | { "-handlepad", TK_OPTION_PIXELS, offsetof(SashElement,handlePadObj), "8" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SashElement *sash = (SashElement *)elementRecord; int sashPad = 2, sashThickness = 6, handleSize = 8; Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData); Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness); Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, tkwin, sash->sashPadObj, &sashPad); if (sashThickness < handleSize + 2*sashPad) sashThickness = handleSize + 2*sashPad; if (orient == TTK_ORIENT_HORIZONTAL) *heightPtr = sashThickness; else *widthPtr = sashThickness; } static void SashElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SashElement *sash = (SashElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, sash->borderObj); GC gc1,gc2; int relief = TK_RELIEF_RAISED; int handleSize = 8, handlePad = 8; Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData); Ttk_Box hb; Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, tkwin, sash->handlePadObj, &handlePad); Tk_GetReliefFromObj(NULL, sash->sashReliefObj, &relief); switch (relief) { case TK_RELIEF_RAISED: case TK_RELIEF_RIDGE: |
︙ | ︙ | |||
459 460 461 462 463 464 465 | /* "classic" entry, includes highlight border */ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.highlight", TTK_FILL_BOTH, TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) | > > > > > > > | > | | > > > > | | > | > > > > > > > | > > > > > > | > > | > > > > > > > > > > | 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 | /* "classic" entry, includes highlight border */ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.highlight", TTK_FILL_BOTH, TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) /* "classic" combobox, includes highlight border */ TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.highlight", TTK_FILL_BOTH, TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) /* "classic" spinbox, includes highlight border */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.highlight", TTK_FILL_BOTH, TTK_GROUP("Spinbox.field", TTK_FILL_BOTH|TTK_FILL_X, TTK_GROUP("null", 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.padding", TTK_FILL_BOTH, TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))))) /* "classic" scale, includes highlight border */ TTK_LAYOUT("Vertical.TScale", TTK_GROUP("Vertical.Scale.highlight", TTK_FILL_BOTH, TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP)))) TTK_LAYOUT("Horizontal.TScale", TTK_GROUP("Horizontal.Scale.highlight", TTK_FILL_BOTH, TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT)))) /* put highlight border around treeview */ TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.highlight", TTK_FILL_BOTH, TTK_GROUP("Treeview.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Treeview.padding", TTK_FILL_BOTH, TTK_NODE("Treeview.treearea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * TtkClassicTheme_Init -- * Install classic theme. */ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "classic", NULL); if (!theme) { return TCL_ERROR; } /* * Register elements: */ Ttk_RegisterElement(interp, theme, "highlight", &HighlightElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Button.border", &ButtonBorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &CheckbuttonIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &RadiobuttonIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, INT2PTR(ARROW_LEFT)); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, INT2PTR(ARROW_RIGHT)); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "hsash", &SashElementSpec, INT2PTR(TTK_ORIENT_HORIZONTAL)); Ttk_RegisterElement(interp, theme, "vsash", &SashElementSpec, INT2PTR(TTK_ORIENT_VERTICAL)); /* |
︙ | ︙ |
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 | 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 #define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) #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 |
︙ | ︙ | |||
135 136 137 138 139 140 141 | /* 35 */ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* Slot 38 is reserved */ /* Slot 39 is reserved */ /* 40 */ | < | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /* 35 */ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); /* Slot 36 is reserved */ /* Slot 37 is reserved */ /* Slot 38 is reserved */ /* Slot 39 is reserved */ /* 40 */ TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient); typedef struct TtkStubs { int magic; int epoch; int revision; void *hooks; |
︙ | ︙ | |||
185 186 187 188 189 190 191 | Ttk_Box (*ttk_ExpandBox) (Ttk_Box b, Ttk_Padding p); /* 33 */ Ttk_Box (*ttk_PlaceBox) (Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 34 */ Tcl_Obj * (*ttk_NewBoxObj) (Ttk_Box box); /* 35 */ void (*reserved36)(void); void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | Ttk_Box (*ttk_ExpandBox) (Ttk_Box b, Ttk_Padding p); /* 33 */ Ttk_Box (*ttk_PlaceBox) (Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 34 */ Tcl_Obj * (*ttk_NewBoxObj) (Ttk_Box box); /* 35 */ void (*reserved36)(void); void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient); /* 40 */ } TtkStubs; extern const TtkStubs *ttkStubsPtr; #ifdef __cplusplus } #endif |
︙ | ︙ |
Changes to generic/ttk/ttkDefaultTheme.c.
1 | /* | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * Copyright © 2003 Joe English * * Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme */ #include "tkInt.h" #include "ttkThemeInt.h" #if defined(_WIN32) #define WIN32_XDRAWLINE_HACK 1 #else #define WIN32_XDRAWLINE_HACK 0 #endif #if defined(MAC_OSX_TK) #define IGNORES_VISUAL #endif #define BORDERWIDTH 2 |
︙ | ︙ | |||
104 105 106 107 108 109 110 | DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 1, thinShadowColors[relief][1]); break; case 0: /* no border -- do nothing */ break; default: /* Fall back to Motif-style borders: */ Tk_Draw3DRectangle(tkwin, d, border, | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | DrawCorner(tkwin, d, border, borderGC, b.x, b.y, b.width, b.height, 1, thinShadowColors[relief][1]); break; case 0: /* no border -- do nothing */ break; default: /* Fall back to Motif-style borders: */ Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); break; } } /* Alternate shadow colors for entry fields: * NOTE: FLAT color is normally white, and the LITE color is a darker shade. */ |
︙ | ︙ | |||
249 250 251 252 253 254 255 | offsetof(BorderElement,borderColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(BorderElement,defaultStateObj), "disabled" }, { "-borderwidth",TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, | | > | > > > | < < < < | > | | > > > < < | | 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 | offsetof(BorderElement,borderColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(BorderElement,defaultStateObj), "disabled" }, { "-borderwidth",TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void BorderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { BorderElement *bd = (BorderElement *)elementRecord; int borderWidth = 0; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { ++borderWidth; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { BorderElement *bd = (BorderElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj); int borderWidth = 2; int relief = TK_RELIEF_FLAT; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; /* * Get option values. */ Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); |
︙ | ︙ | |||
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | /*---------------------------------------------------------------------- * +++ Field element: * Used for editable fields. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ } FieldElement; static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), "black" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( | > > > > > > < < < | | | | | > | > | | > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > | > | > < < < | | | < | | < < | | > > | | | | | | | | | | < > | > > | < < < < | > > < < < < < < < < < < < < < < < < | | > > > | | < > > > > > > > > > | < < < < < < > | | < < < < < < > > > > > > | < < < < < > > > > > | < | | | | | 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 | /*---------------------------------------------------------------------- * +++ Field element: * Used for editable fields. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ Tcl_Obj *focusWidthObj; Tcl_Obj *focusColorObj; } FieldElement; static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), "black" }, { "-focuswidth", TK_OPTION_PIXELS, offsetof(FieldElement,focusWidthObj), "2" }, { "-focuscolor", TK_OPTION_COLOR, offsetof(FieldElement,focusColorObj), "#4a6984" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(2); } static void FieldElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, field->borderColorObj); int focusWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); if (focusWidth > 0 && (state & TTK_STATE_FOCUS)) { Display *disp = Tk_Display(tkwin); XColor *focusColor = Tk_GetColorFromObj(tkwin, field->focusColorObj); GC focusGC = Tk_GCForColor(focusColor, d); if (focusWidth > 1) { int x1 = b.x, x2 = b.x + b.width - 1; int y1 = b.y, y2 = b.y + b.height - 1; int w = WIN32_XDRAWLINE_HACK; /* * Draw the outer rounded rectangle */ XDrawLine(disp, d, focusGC, x1+1, y1, x2-1+w, y1); /* N */ XDrawLine(disp, d, focusGC, x1+1, y2, x2-1+w, y2); /* S */ XDrawLine(disp, d, focusGC, x1, y1+1, x1, y2-1+w); /* W */ XDrawLine(disp, d, focusGC, x2, y1+1, x2, y2-1+w); /* E */ /* * Draw the inner rectangle */ b.x += 1; b.y += 1; b.width -= 2; b.height -= 2; XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); /* * Fill the inner rectangle */ GC bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); XFillRectangle(disp, d, bgGC, b.x+1, b.y+1, b.width-2, b.height-2); } else { /* * Draw the field element as usual */ Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN); DrawFieldBorder(tkwin, d, border, borderColor, b); /* * Change the color of the border's outermost pixels */ XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); } } else { Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_SUNKEN); DrawFieldBorder(tkwin, d, border, borderColor, b); } } static const Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, FieldElementDraw }; /*------------------------------------------------------------------------ * Indicators -- */ /* * Indicator image descriptor: */ typedef struct { int width; /* unscaled width */ int height; /* unscaled height */ const char *const offDataPtr; const char *const onDataPtr; } IndicatorSpec; static const char checkbtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v15h1v-14h14v-1z' fill='#888888'/>\n\ <path d='m1 1v13h1v-12h12v-1z' fill='#414141'/>\n\ <path d='m14 1v13h-13v1h14v-14z' fill='#d9d9d9'/>\n\ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\ </svg>"; static const char checkbtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v15h1v-14h14v-1z' fill='#888888'/>\n\ <path d='m1 1v13h1v-12h12v-1z' fill='#414141'/>\n\ <path d='m14 1v13h-13v1h14v-14z' fill='#d9d9d9'/>\n\ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\ <path d='m4.5 8 3 3 4-6' fill='none' stroke='#000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/>\n\ </svg>"; static const IndicatorSpec checkbutton_spec = { 16, 16, checkbtnOffData, checkbtnOnData }; static const char radiobtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#888888' offset='0'/>\n\ <stop stop-color='#eeeeee' offset='1'/>\n\ </linearGradient>\n\ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#414141' offset='0'/>\n\ <stop stop-color='#d9d9d9' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\ </svg>"; static const char radiobtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#888888' offset='0'/>\n\ <stop stop-color='#eeeeee' offset='1'/>\n\ </linearGradient>\n\ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#414141' offset='0'/>\n\ <stop stop-color='#d9d9d9' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\ <circle cx='8' cy='8' r='3' fill='#000000'/>\n\ </svg>"; static const IndicatorSpec radiobutton_spec = { 16, 16, radiobtnOffData, radiobtnOnData }; typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *colorObj; Tcl_Obj *lightColorObj; |
︙ | ︙ | |||
488 489 490 491 492 493 494 | offsetof(IndicatorElement,lightColorObj), "#DDDDDD" }, { "-shadecolor", TK_OPTION_COLOR, offsetof(IndicatorElement,shadeColorObj), "#888888" }, { "-bordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,borderColorObj), "black" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, | | | > | | | | > > > > > > > > > > > > > > > > > > | < < | > > > > > > > > | | > > | > | > > | > > > > | | | | < | < > > | > | > | > | | | | < > > > | > | < | < | > | < > | | < | | | < | > > > > | < < < | > | < | | < < < < < < < < < | | | | | | | | > > > | < < < | | | | | | > | < | | | > > > > > > | < > | < > | > > > | < < < > | < | < < | < < < < < | > < > > | < < | > | > > | | > > > > | | | | | > > > > | | > | > < > > > > > | < < | | > | > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | > | > > < | > > > > > > > | | > | > | > > | | > > > > > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | offsetof(IndicatorElement,lightColorObj), "#DDDDDD" }, { "-shadecolor", TK_OPTION_COLOR, offsetof(IndicatorElement,shadeColorObj), "#888888" }, { "-bordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,borderColorObj), "black" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { const IndicatorSpec *spec = (const IndicatorSpec *)clientData; IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; double scalingLevel = TkScalingLevel(tkwin); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = spec->width * scalingLevel + Ttk_PaddingWidth(margins); *heightPtr = spec->height * scalingLevel + Ttk_PaddingHeight(margins); } static void ColorToStr( const XColor *colorPtr, char *colorStr) /* in the format "RRGGBB" */ { snprintf(colorStr, 7, "%02x%02x%02x", colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8); } static void ImageChanged( /* to be passed to Tk_GetImage() */ TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { } static void IndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding padding; const IndicatorSpec *spec = (const IndicatorSpec *)clientData; double scalingLevel = TkScalingLevel(tkwin); int width = spec->width * scalingLevel; int height = spec->height * scalingLevel; char bgColorStr[7], fgColorStr[7], indicatorColorStr[7], shadeColorStr[7], borderColorStr[7]; unsigned int selected = (state & TTK_STATE_SELECTED); Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[70]; Tk_Image img; const char *svgDataPtr; size_t svgDataLen; char *svgDataCopy; char *shadeColorPtr, *highlightColorPtr, *borderColorPtr, *bgColorPtr, *indicatorColorPtr, *fgColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); /* * Sanity check */ if ( b.x < 0 || b.y < 0 || Tk_Width(tkwin) < b.x + width || Tk_Height(tkwin) < b.y + height) { /* Oops! Not enough room to display the image. * Don't draw anything. */ return; } /* * Construct the color strings bgColorStr, fgColorStr, * indicatorColorStr, shadeColorStr, and borderColorStr */ ColorToStr(Tk_GetColorFromObj(tkwin, indicator->backgroundObj), bgColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->foregroundObj), fgColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->colorObj), indicatorColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->shadeColorObj), shadeColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->borderColorObj), borderColorStr); /* * Check whether there is an SVG image of this size for the indicator's * type (0 = checkbtn, 1 = radiobtn) and these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::indicator_alt%d_%d_%s_%s_%s_%s_%s", width, spec->offDataPtr == radiobtnOffData, shadeColorStr, indicatorColorStr, borderColorStr, bgColorStr, selected ? fgColorStr : "XXXXXX"); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Determine the SVG data to use for the photo image */ svgDataPtr = (selected ? spec->onDataPtr : spec->offDataPtr); /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ shadeColorPtr = strstr(svgDataCopy, "888888"); highlightColorPtr = strstr(svgDataCopy, "eeeeee"); borderColorPtr = strstr(svgDataCopy, "414141"); bgColorPtr = strstr(svgDataCopy, "d9d9d9"); indicatorColorPtr = strstr(svgDataCopy, "ffffff"); fgColorPtr = strstr(svgDataCopy, "000000"); assert(shadeColorPtr); assert(highlightColorPtr); assert(borderColorPtr); assert(bgColorPtr); assert(indicatorColorPtr); memcpy(shadeColorPtr, shadeColorStr, 6); memcpy(highlightColorPtr, indicatorColorStr, 6); memcpy(borderColorPtr, borderColorStr, 6); memcpy(bgColorPtr, bgColorStr, 6); memcpy(indicatorColorPtr, indicatorColorStr, 6); if (fgColorPtr != NULL) { memcpy(fgColorPtr, fgColorStr, 6); } /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Display the image */ Tk_RedrawImage(img, 0, 0, width, height, d, b.x, b.y); Tk_FreeImage(img); } static const Ttk_ElementSpec IndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, IndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a solid triangle, inside a box. * clientData is an enum ArrowDirection pointer. */ typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *colorObj; /* Arrow color */ Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra color for borders */ Tcl_Obj *reliefObj; } ArrowElement; static const Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ArrowElement,colorObj), "black"}, { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ArrowElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj), "raised"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* * Note asymmetric padding: * top/left padding is 1 less than bottom/right, * since in this theme 2-pixel borders are asymmetric. */ static const Ttk_Padding ArrowPadding = { 3,3,4,4 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding; int size = SCROLLBAR_WIDTH; padding.left = round(ArrowPadding.left * scalingLevel); padding.right = padding.left + 1; padding.top = round(ArrowPadding.top * scalingLevel); padding.bottom = padding.top + 1; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); if (*widthPtr < *heightPtr) { *widthPtr = *heightPtr; } else { *heightPtr = *widthPtr; } } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj); int borderWidth = 2, relief = TK_RELIEF_RAISED; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); int cx = 0, cy = 0; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC gc = Tk_GCForColor(arrowColor, d); Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); padding.left = round(ArrowPadding.left * scalingLevel); padding.right = padding.left + 1; padding.top = round(ArrowPadding.top * scalingLevel); padding.bottom = padding.top + 1; b = Ttk_PadBox(b, padding); switch (direction) { case ARROW_UP: case ARROW_DOWN: TtkArrowSize(b.width/2, direction, &cx, &cy); if ((b.height - cy) % 2 == 1) { ++cy; } break; case ARROW_LEFT: case ARROW_RIGHT: TtkArrowSize(b.height/2, direction, &cx, &cy); if ((b.width - cx) % 2 == 1) { ++cx; } break; } b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, direction); } static const Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /* * Modified arrow element for comboboxes and spinboxes: * The width and height are different, and the left edge is drawn in the * same color as the inner part of the right one. */ static void BoxArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding; int size = 14; padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); } static void BoxArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, arrow->borderColorObj); int borderWidth = 2, relief = TK_RELIEF_RAISED; Display *disp = Tk_Display(tkwin); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); int w = WIN32_XDRAWLINE_HACK; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); int cx = 0, cy = 0; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC arrowGC = Tk_GCForColor(arrowColor, d); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); XDrawLine(disp, d, darkGC, b.x, b.y+1, b.x, b.y+b.height-2+w); padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); b = Ttk_PadBox(b, padding); TtkArrowSize(b.width/2, direction, &cx, &cy); if ((b.height - cy) % 2 == 1) { ++cy; } b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(disp, d, arrowGC, b, direction); } static const Ttk_ElementSpec BoxArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, BoxArrowElementSize, BoxArrowElementDraw }; /*---------------------------------------------------------------------- * +++ Menubutton indicator: * Draw an arrow in the direction where the menu will be posted. */ #define MENUBUTTON_ARROW_SIZE 5 typedef struct { Tcl_Obj *directionObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } MenubuttonArrowElement; static const char *const directionStrings[] = { /* See also: button.c */ "above", "below", "flush", "left", "right", NULL }; enum { POST_ABOVE, POST_BELOW, POST_FLUSH, POST_LEFT, POST_RIGHT }; static const Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = { { "-direction", TK_OPTION_STRING, offsetof(MenubuttonArrowElement,directionObj), "below" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor", TK_OPTION_COLOR, offsetof(MenubuttonArrowElement,colorObj), "black"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static const Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 }; static void MenubuttonArrowElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord; int size = MENUBUTTON_ARROW_SIZE; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); padding.left = round(MenubuttonArrowPadding.left * scalingLevel); padding.top = round(MenubuttonArrowPadding.top * scalingLevel); padding.right = round(MenubuttonArrowPadding.right * scalingLevel); padding.bottom = round(MenubuttonArrowPadding.bottom * scalingLevel); *widthPtr = *heightPtr = 2 * size + 1; *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); } static void MenubuttonArrowElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { MenubuttonArrowElement *arrow = (MenubuttonArrowElement *)elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int postDirection = POST_BELOW; ArrowDirection arrowDirection = ARROW_DOWN; int width = 0, height = 0; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); Tcl_GetIndexFromObjStruct(NULL, arrow->directionObj, directionStrings, sizeof(char *), ""/*message*/, 0/*flags*/, &postDirection); /* ... this might not be such a great idea ... */ switch (postDirection) { case POST_ABOVE: arrowDirection = ARROW_UP; break; case POST_BELOW: arrowDirection = ARROW_DOWN; break; case POST_LEFT: arrowDirection = ARROW_LEFT; break; case POST_RIGHT: arrowDirection = ARROW_RIGHT; break; case POST_FLUSH: arrowDirection = ARROW_DOWN; break; } TtkArrowSize(size, arrowDirection, &width, &height); padding.left = round(MenubuttonArrowPadding.left * scalingLevel); padding.top = round(MenubuttonArrowPadding.top * scalingLevel); padding.right = round(MenubuttonArrowPadding.right * scalingLevel); padding.bottom = round(MenubuttonArrowPadding.bottom * scalingLevel); b = Ttk_PadBox(b, padding); b = Ttk_AnchorBox(b, width, height, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, arrowDirection); } static const Ttk_ElementSpec MenubuttonArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(MenubuttonArrowElement), MenubuttonArrowElementOptions, MenubuttonArrowElementSize, MenubuttonArrowElementDraw }; /* *---------------------------------------------------------------------- * +++ Thumb element. */ typedef struct { Tcl_Obj *sizeObj; |
︙ | ︙ | |||
935 936 937 938 939 940 941 | "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" }, { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( | > | > | > > < < | > | > | > > < < | 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 | "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" }, { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ThumbElement *thumb = (ThumbElement *)elementRecord; Ttk_Orient orient; int size; Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = size; *heightPtr = MIN_THUMB_SIZE; } else { *widthPtr = MIN_THUMB_SIZE; *heightPtr = size; } } static void ThumbElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ThumbElement *thumb = (ThumbElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, thumb->borderColorObj); int relief = TK_RELIEF_RAISED; int borderWidth = 2; /* * Don't draw the thumb if we are disabled. * This makes it behave like Windows ... if that's what we want. if (state & TTK_STATE_DISABLED) return; */ |
︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 | * * The slider element is the thumb in the scale widget. This is drawn * as an arrow-type element that can point up, down, left or right. * */ typedef struct { | < < < < < | > > > | > | > > | < < | < | | < > | > | > > < < | 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 | * * The slider element is the thumb in the scale widget. This is drawn * as an arrow-type element that can point up, down, left or right. * */ typedef struct { Tcl_Obj *thicknessObj; /* Short axis dimension */ Tcl_Obj *reliefObj; /* Relief for this object */ Tcl_Obj *borderObj; /* Border / background color */ Tcl_Obj *borderColorObj; /* Additional border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *orientObj; /* Orientation of overall slider */ } SliderElement; static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, offsetof(SliderElement,borderColorObj), "black" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SliderElement *slider = (SliderElement *)elementRecord; Ttk_Orient orient; int thickness, borderWidth; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); switch (orient) { case TTK_ORIENT_VERTICAL: *widthPtr = thickness + (borderWidth *2); *heightPtr = *widthPtr/2; break; case TTK_ORIENT_HORIZONTAL: *heightPtr = thickness + (borderWidth *2); *widthPtr = *heightPtr/2; break; } } static void SliderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj); int relief = TK_RELIEF_RAISED, borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_FLAT); |
︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 | #define TTK_STATE_OPEN TTK_STATE_USER1 /* XREF: treeview.c */ #define TTK_STATE_LEAF TTK_STATE_USER2 typedef struct { Tcl_Obj *colorObj; Tcl_Obj *marginObj; | | | | > | > | > > | < < > < | | > | < | 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 | #define TTK_STATE_OPEN TTK_STATE_USER1 /* XREF: treeview.c */ #define TTK_STATE_LEAF TTK_STATE_USER2 typedef struct { Tcl_Obj *colorObj; Tcl_Obj *marginObj; Tcl_Obj *sizeObj; } TreeitemIndicator; static const Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-size", TK_OPTION_PIXELS, offsetof(TreeitemIndicator,sizeObj), "6.75p" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginObj), "2 2 4 2" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; int size = 0; Ttk_Padding margins; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = size + Ttk_PaddingWidth(margins); *heightPtr = size + Ttk_PaddingHeight(margins); } static void TreeitemIndicatorDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(color, d); Ttk_Padding padding = Ttk_UniformPadding(0); int w = WIN32_XDRAWLINE_HACK; int cx, cy; if (state & TTK_STATE_LEAF) { /* don't draw anything ... */ return; } Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); |
︙ | ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | TreeitemIndicatorDraw }; /*------------------------------------------------------------------------ * TtkAltTheme_Init -- * Install alternate theme. */ | > > | | | < > > > > > > | | 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 | TreeitemIndicatorDraw }; /*------------------------------------------------------------------------ * TtkAltTheme_Init -- * Install alternate theme. */ MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_CreateTheme(interp, "alt", NULL); if (!theme) { return TCL_ERROR; } Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &IndicatorElementSpec, (void *)&checkbutton_spec); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &IndicatorElementSpec, (void *)&radiobutton_spec); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenubuttonArrowElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "Spinbox.uparrow", &BoxArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "Spinbox.downarrow", &BoxArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "Combobox.downarrow", &BoxArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, INT2PTR(ARROW_LEFT)); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, INT2PTR(ARROW_RIGHT)); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "Treeitem.indicator", &TreeitemIndicatorElementSpec, NULL); Tcl_PkgProvide(interp, "ttk::theme::alt", TTK_VERSION); return TCL_OK; } /*EOF*/ |
Changes to generic/ttk/ttkElements.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 | /* * Copyright © 2003 Joe English * * Default implementation for themed elements. * */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" #if defined(_WIN32) #define WIN32_XDRAWLINE_HACK 1 #else #define WIN32_XDRAWLINE_HACK 0 #endif #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" #define MIN_THUMB_SIZE 10 /*---------------------------------------------------------------------- * +++ Null element. Does nothing; used as a stub. * Null element methods, option table and element spec are public, * and may be used in other engines. */ /* public */ const Ttk_ElementOptionSpec TtkNullElementOptions[] = { { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* public */ void TtkNullElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ TCL_UNUSED(Ttk_Padding *)) { } /* public */ void TtkNullElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(Drawable), TCL_UNUSED(Ttk_Box), TCL_UNUSED(Ttk_State)) { } /* public */ Ttk_ElementSpec ttkNullElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, |
︙ | ︙ | |||
71 72 73 74 75 76 77 | static const Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FillElementDraw( | > | > | > > < < | > > < < | 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 | static const Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FillElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { BackgroundElement *bg = (BackgroundElement *)elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,bg->backgroundObj); XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); } static void BackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), Ttk_State state) { FillElementDraw( clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); } static const Ttk_ElementSpec FillElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
132 133 134 135 136 137 138 | offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void BorderElementSize( | > | > > > | < < < < | > | > | > > < < | | > > > > > > > > | > > > | | < < < > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > | > > > > | > > | | | > | 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 | offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void BorderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { BorderElement *bd = (BorderElement *)elementRecord; int borderWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void BorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { BorderElement *bd = (BorderElement *)elementRecord; Tk_3DBorder border = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); Tk_GetPixelsFromObj(NULL, tkwin, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); if (border && borderWidth > 0 && relief != TK_RELIEF_FLAT) { Tk_Draw3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } } static const Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, BorderElementSize, BorderElementDraw }; /*---------------------------------------------------------------------- * +++ Field element. * Used for editable fields. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *focusWidthObj; Tcl_Obj *focusColorObj; } FieldElement; static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(FieldElement,borderWidthObj), "2" }, { "-focuswidth", TK_OPTION_PIXELS, offsetof(FieldElement,focusWidthObj), "2" }, { "-focuscolor", TK_OPTION_COLOR, offsetof(FieldElement,focusColorObj), "#4a6984" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { FieldElement *field = (FieldElement *)elementRecord; int borderWidth = 2, focusWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); if (focusWidth > 0 && borderWidth < 2) { borderWidth += (focusWidth - borderWidth); } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void FieldElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, field->borderObj); int focusWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->focusWidthObj, &focusWidth); if (focusWidth > 0 && (state & TTK_STATE_FOCUS)) { Display *disp = Tk_Display(tkwin); XColor *focusColor = Tk_GetColorFromObj(tkwin, field->focusColorObj); GC focusGC = Tk_GCForColor(focusColor, d); if (focusWidth > 1) { int x1 = b.x, x2 = b.x + b.width - 1; int y1 = b.y, y2 = b.y + b.height - 1; int w = WIN32_XDRAWLINE_HACK; /* * Draw the outer rounded rectangle */ XDrawLine(disp, d, focusGC, x1+1, y1, x2-1+w, y1); /* N */ XDrawLine(disp, d, focusGC, x1+1, y2, x2-1+w, y2); /* S */ XDrawLine(disp, d, focusGC, x1, y1+1, x1, y2-1+w); /* W */ XDrawLine(disp, d, focusGC, x2, y1+1, x2, y2-1+w); /* E */ /* * Draw the inner rectangle */ b.x += 1; b.y += 1; b.width -= 2; b.height -= 2; XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); /* * Fill the inner rectangle */ GC bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); XFillRectangle(disp, d, bgGC, b.x+1, b.y+1, b.width-2, b.height-2); } else { /* * Draw the field element as usual */ int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN); /* * Change the color of the border's outermost pixels */ XDrawRectangle(disp, d, focusGC, b.x, b.y, b.width-1, b.height-1); } } else { int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN); } } static const Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, FieldElementSize, |
︙ | ︙ | |||
250 251 252 253 254 255 256 | } PaddingElement; static const Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, offsetof(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, offsetof(PaddingElement,reliefObj), "flat" }, | | > | > > > | < < < | > | > > > | > > | | | | > > > > | > > > | < < < < | > | > | > > | | > | > | 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 | } PaddingElement; static const Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, offsetof(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, offsetof(PaddingElement,reliefObj), "flat" }, { "-shiftrelief", TK_OPTION_PIXELS, offsetof(PaddingElement,shiftreliefObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void PaddingElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { PaddingElement *padding = (PaddingElement *)elementRecord; int shiftRelief = 0; int relief = TK_RELIEF_FLAT; Ttk_Padding pad; Tk_GetReliefFromObj(NULL, padding->reliefObj, &relief); Tk_GetPixelsFromObj(NULL, tkwin, padding->shiftreliefObj, &shiftRelief); Ttk_GetPaddingFromObj(NULL,tkwin,padding->paddingObj,&pad); *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief); } static const Ttk_ElementSpec PaddingElementSpec = { TK_STYLE_VERSION_2, sizeof(PaddingElement), PaddingElementOptions, PaddingElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Focus ring element. * Draws a dashed focus ring, if the widget has keyboard focus. */ typedef struct { Tcl_Obj *focusColorObj; Tcl_Obj *focusThicknessObj; Tcl_Obj *focusSolidObj; } FocusElement; /* * DrawFocusRing -- * Draw a dotted rectangle to indicate focus. */ static void DrawFocusRing( Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, int thickness, int solid, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, colorObj); unsigned long mask = 0UL; XGCValues gcvalues; GC gc; gcvalues.foreground = color->pixel; gcvalues.line_width = thickness < 1 ? 1 : thickness; if (solid) { gcvalues.line_style = LineSolid; mask = GCForeground | GCLineStyle | GCLineWidth; } else { gcvalues.line_style = LineOnOffDash; gcvalues.dashes = 1; gcvalues.dash_offset = 1; mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; } gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } static const Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, offsetof(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, offsetof(FocusElement,focusThicknessObj), "1" }, { "-focussolid",TK_OPTION_BOOLEAN, offsetof(FocusElement,focusSolidObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FocusElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; Tk_GetPixelsFromObj(NULL, tkwin, focus->focusThicknessObj, &focusThickness); *paddingPtr = Ttk_UniformPadding((short)focusThickness); } static void FocusElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; int focusSolid = 0; if (state & TTK_STATE_FOCUS) { Tk_GetPixelsFromObj(NULL, tkwin, focus->focusThicknessObj, &focusThickness); Tcl_GetBooleanFromObj(NULL, focus->focusSolidObj, &focusSolid); DrawFocusRing(tkwin, d, focus->focusColorObj, focusThickness, focusSolid, b); } } static const Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(FocusElement), FocusElementOptions, |
︙ | ︙ | |||
380 381 382 383 384 385 386 | offsetof(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SeparatorElementSize( | > | > | < < < | | | > | > | > > < < > | > | > > < < | | | 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 | offsetof(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SeparatorElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { *widthPtr = *heightPtr = 2; } static void HorizontalSeparatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SeparatorElement *separator = (SeparatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x + b.width, b.y); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x, b.y+1, b.x + b.width, b.y+1); } static void VerticalSeparatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SeparatorElement *separator = (SeparatorElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, separator->borderObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); XDrawLine(Tk_Display(tkwin), d, darkGC, b.x, b.y, b.x, b.y + b.height); XDrawLine(Tk_Display(tkwin), d, lightGC, b.x+1, b.y, b.x+1, b.y+b.height); } static void GeneralSeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { SeparatorElement *separator = (SeparatorElement *)elementRecord; Ttk_Orient orient; Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: HorizontalSeparatorElementDraw( clientData, elementRecord, tkwin, d, b, state); break; case TTK_ORIENT_VERTICAL: VerticalSeparatorElementDraw( |
︙ | ︙ | |||
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | /*---------------------------------------------------------------------- * +++ Sizegrip: lower-right corner grip handle for resizing window. */ typedef struct { Tcl_Obj *backgroundObj; } SizegripElement; static const Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, {0,TK_OPTION_BOOLEAN,0,0} }; static void SizegripSize( | > > > > | > | > > < < | | < > | > | > | > > > | < < > > > > | < > | | < | > | < < > > | | | < < < | | > > > | | | | | | | | | | > > | | | < > > > > > > > | | > > > > | < < < | < < < > > > > | < < | < < > > > > | > > > > > | < < | > | > | | > | < | < < | | | > | | | > > > > > | | < > > > | < < < | > > > | | < < | < < > < < | < < > | < < < < | > > > > > > > > | > > | | | < < < < < > > > | < < | < < < > > > > > > > > > > > > > > > < < | < | > | | | | < < | < < > > > > | < < < < < < < > > > | | < | | | | < | < > | > | > | | > > > > > > > > > | > > | < > > > | | < < < < < < < < > > > | < < | | | < > | < > | | | | | > | > > | > > < < | > | < < < | > | < < < < < | > > > > > > > > > | < < < < < | | | | > > | | < < | > | > > > | > | | | | | | > > < < | | | | | | | | | | | | > > > | | > > > > | | | | | > > > > > | > < > > > > > | < < > | > > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > | | > > > > | | > | > > > | | < < < > > > | | | > > > > | | > | | < < > | > > | > > > > > > > > > > > > > > | 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 | /*---------------------------------------------------------------------- * +++ Sizegrip: lower-right corner grip handle for resizing window. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *gripSizeObj; } SizegripElement; static const Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, { "-gripsize", TK_OPTION_PIXELS, offsetof(SizegripElement,gripSizeObj), "11.25p" }, {0,TK_OPTION_BOOLEAN,0,0} }; static void SizegripSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SizegripElement *grip = (SizegripElement *)elementRecord; int gripSize = 0; Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); *widthPtr = *heightPtr = gripSize; } static void SizegripDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SizegripElement *grip = (SizegripElement *)elementRecord; int gripSize = 0; int gripCount = 3, gripSpace, gripThickness; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, grip->backgroundObj); GC lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); int x1 = b.x + b.width-1, y1 = b.y + b.height-1, x2 = x1, y2 = y1; Tk_GetPixelsFromObj(NULL, tkwin, grip->gripSizeObj, &gripSize); gripThickness = gripSize * 3 / (gripCount * 5); gripSpace = gripSize / 3 - gripThickness; while (gripCount--) { x1 -= gripSpace; y2 -= gripSpace; for (int i = 1; i < gripThickness; i++) { XDrawLine(Tk_Display(tkwin), d, darkGC, x1,y1, x2,y2); --x1; --y2; } XDrawLine(Tk_Display(tkwin), d, lightGC, x1,y1, x2,y2); --x1; --y2; } } static const Ttk_ElementSpec SizegripElementSpec = { TK_STYLE_VERSION_2, sizeof(SizegripElement), SizegripOptions, SizegripSize, SizegripDraw }; /*---------------------------------------------------------------------- * +++ Indicator element. * * Draws the on/off indicator for checkbuttons and radiobuttons. */ /* * Indicator image descriptor: */ typedef struct { int width; /* unscaled width */ int height; /* unscaled height */ const char *const offDataPtr; const char *const onDataPtr; const char *const triDataPtr; } IndicatorSpec; static const char checkbtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <rect x='.5' y='.5' width='15' height='15' rx='1.5' fill='#ffffff' stroke='#888888'/>\n\ </svg>"; static const char checkbtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <rect x='0' y='0' width='16' height='16' fill='#4a6984' rx='2'/>\n\ <path d='m4.5 8 3 3 4-6' fill='none' stroke='#ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/>\n\ </svg>"; static const char checkbtnTriData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <rect x='0' y='0' width='16' height='16' fill='#4a6984' rx='2'/>\n\ <path d='m4 8h8' fill='none' stroke='#ffffff' stroke-width='2'/>\n\ </svg>"; static const IndicatorSpec checkbutton_spec = { 16, 16, checkbtnOffData, checkbtnOnData, checkbtnTriData }; static const char radiobtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <circle cx='8' cy='8' r='7.5' fill='#ffffff' stroke='#888888'/>\n\ </svg>"; static const char radiobtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <circle cx='8' cy='8' r='8' fill='#4a6984'/>\n\ <circle cx='8' cy='8' r='3' fill='#ffffff'/>\n\ </svg>"; static const char radiobtnTriData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <circle cx='8' cy='8' r='8' fill='#4a6984'/>\n\ <path d='m4 8h8' fill='none' stroke='#ffffff' stroke-width='2'/>\n\ </svg>"; static const IndicatorSpec radiobutton_spec = { 16, 16, radiobtnOffData, radiobtnOnData, radiobtnTriData }; typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *foregroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *marginObj; } IndicatorElement; /* * Note that the -indicatorbackground and -indicatorforeground options below * have the same default value "#ffffff", but the -indicatorforeground option * will only be used for the alternate and selected states, in which the * -indicatorbackground option will have a different value (e.g., "#4a6984"). */ static const Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatorbackground", TK_OPTION_COLOR, offsetof(IndicatorElement,backgroundObj), "#ffffff" }, { "-indicatorforeground", TK_OPTION_COLOR, offsetof(IndicatorElement,foregroundObj), "#ffffff" }, { "-bordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,borderColorObj), "#888888" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { const IndicatorSpec *spec = (const IndicatorSpec *)clientData; IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding margins; double scalingLevel = TkScalingLevel(tkwin); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &margins); *widthPtr = spec->width * scalingLevel + Ttk_PaddingWidth(margins); *heightPtr = spec->height * scalingLevel + Ttk_PaddingHeight(margins); } static void ColorToStr( const XColor *colorPtr, char *colorStr) /* in the format "RRGGBB" */ { snprintf(colorStr, 7, "%02x%02x%02x", colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8); } static void ImageChanged( /* to be passed to Tk_GetImage() */ TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { } static void IndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { IndicatorElement *indicator = (IndicatorElement *)elementRecord; Ttk_Padding padding; const IndicatorSpec *spec = (const IndicatorSpec *)clientData; double scalingLevel = TkScalingLevel(tkwin); int width = spec->width * scalingLevel; int height = spec->height * scalingLevel; char bgColorStr[7], fgColorStr[7], borderColorStr[7]; unsigned int selected = (state & TTK_STATE_SELECTED); unsigned int tristate = (state & TTK_STATE_ALTERNATE); Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[60]; Tk_Image img; const char *svgDataPtr; size_t svgDataLen; char *svgDataCopy; char *bgColorPtr, *fgColorPtr, *borderColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); /* * Sanity check */ if ( b.x < 0 || b.y < 0 || Tk_Width(tkwin) < b.x + width || Tk_Height(tkwin) < b.y + height) { /* Oops! Not enough room to display the image. * Don't draw anything. */ return; } /* * Construct the color strings bgColorStr, fgColorStr, and borderColorStr */ ColorToStr(Tk_GetColorFromObj(tkwin, indicator->backgroundObj), bgColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->foregroundObj), fgColorStr); ColorToStr(Tk_GetColorFromObj(tkwin, indicator->borderColorObj), borderColorStr); /* * Check whether there is an SVG image of this size for the * indicator's type (0 = checkbtn, 1 = radiobtn), "state" * (0 = off, 1 = on, 2 = tristate), and these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::indicator_default%d_%d,%d_%s_%s_%s", width, spec->offDataPtr == radiobtnOffData, tristate ? 2 : (selected ? 1 : 0), bgColorStr, selected || tristate ? fgColorStr : "XXXXXX", selected || tristate ? "XXXXXX" : borderColorStr); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Determine the SVG data to use for the photo image */ svgDataPtr = (tristate ? spec->triDataPtr : (selected ? spec->onDataPtr : spec->offDataPtr)); /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ if (selected || tristate) { bgColorPtr = strstr(svgDataCopy, "4a6984"); fgColorPtr = strstr(svgDataCopy, "ffffff"); assert(bgColorPtr); assert(fgColorPtr); memcpy(bgColorPtr, bgColorStr, 6); memcpy(fgColorPtr, fgColorStr, 6); } else { bgColorPtr = strstr(svgDataCopy, "ffffff"); borderColorPtr = strstr(svgDataCopy, "888888"); assert(bgColorPtr); assert(borderColorPtr); memcpy(bgColorPtr, bgColorStr, 6); memcpy(borderColorPtr, borderColorStr, 6); } /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Display the image */ Tk_RedrawImage(img, 0, 0, width, height, d, b.x, b.y); Tk_FreeImage(img); } static const Ttk_ElementSpec IndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, IndicatorElementSize, IndicatorElementDraw }; /*---------------------------------------------------------------------- * +++ Arrow element(s). * * Draws a solid triangle inside a box. * clientData is an enum ArrowDirection pointer. */ typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *colorObj; Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } ArrowElement; static const Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), "14" }, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ArrowElement,colorObj), "black"}, { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), "1" }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj), "raised"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static const Ttk_Padding ArrowPadding = { 3,3,3,3 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding; int size = 14; padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); if (*widthPtr < *heightPtr) { *widthPtr = *heightPtr; } else { *heightPtr = *widthPtr; } } static void ArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); int borderWidth = 1, relief = TK_RELIEF_RAISED; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); int cx = 0, cy = 0; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC gc = Tk_GCForColor(arrowColor, d); Tk_GetPixelsFromObj(NULL, tkwin, arrow->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); b = Ttk_PadBox(b, padding); switch (direction) { case ARROW_UP: case ARROW_DOWN: TtkArrowSize(b.width/2, direction, &cx, &cy); if ((b.height - cy) % 2 == 1) { ++cy; } break; case ARROW_LEFT: case ARROW_RIGHT: TtkArrowSize(b.height/2, direction, &cx, &cy); if ((b.width - cx) % 2 == 1) { ++cx; } break; } b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(Tk_Display(tkwin), d, gc, b, direction); } static const Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, ArrowElementSize, ArrowElementDraw }; /* * Modified arrow element for comboboxes and spinboxes: * The width and height are different, and the left edge is drawn in the * same color as the right one. */ static void BoxArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); double scalingLevel = TkScalingLevel(tkwin); Ttk_Padding padding; int size = 14; padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); } static void BoxArrowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj); int borderWidth = 1, relief = TK_RELIEF_RAISED; Display *disp = Tk_Display(tkwin); GC darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); int w = WIN32_XDRAWLINE_HACK; Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); int cx = 0, cy = 0; XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj); GC arrowGC = Tk_GCForColor(arrowColor, d); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); XDrawLine(disp, d, darkGC, b.x, b.y+1, b.x, b.y+b.height-1+w); padding.left = round(ArrowPadding.left * scalingLevel); padding.top = round(ArrowPadding.top * scalingLevel); padding.right = round(ArrowPadding.right * scalingLevel); padding.bottom = round(ArrowPadding.bottom * scalingLevel); b = Ttk_PadBox(b, padding); TtkArrowSize(b.width/2, direction, &cx, &cy); if ((b.height - cy) % 2 == 1) { ++cy; } b = Ttk_AnchorBox(b, cx, cy, TK_ANCHOR_CENTER); TtkFillArrow(disp, d, arrowGC, b, direction); } static const Ttk_ElementSpec BoxArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, BoxArrowElementSize, BoxArrowElementDraw }; /* *---------------------------------------------------------------------- * +++ Menubutton indicators. * * These aren't functional like radio/check indicators, * they're just affordability indicators. */ #define MENUBUTTON_ARROW_SIZE 5 typedef struct { Tcl_Obj *sizeObj; Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static const Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor", TK_OPTION_COLOR, offsetof(MenuIndicatorElement,colorObj), "black" }, { "-arrowpadding", TK_OPTION_STRING, offsetof(MenuIndicatorElement,paddingObj), "3" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void MenuIndicatorElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord; Ttk_Padding margins; int size = MENUBUTTON_ARROW_SIZE; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); Ttk_GetPaddingFromObj(NULL, tkwin, indicator->paddingObj, &margins); TtkArrowSize(size, ARROW_DOWN, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(margins); *heightPtr += Ttk_PaddingHeight(margins); } static void MenuIndicatorElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { MenuIndicatorElement *indicator = (MenuIndicatorElement *)elementRecord; XColor *arrowColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(arrowColor, d); int size = MENUBUTTON_ARROW_SIZE; int width, height; Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); TtkArrowSize(size, ARROW_DOWN, &width, &height); b = Ttk_StickBox(b, width, height, 0); TtkFillArrow(Tk_Display(tkwin), d, gc, b, ARROW_DOWN); } static const Ttk_ElementSpec MenuIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(MenuIndicatorElement), MenuIndicatorElementOptions, MenuIndicatorElementSize, MenuIndicatorElementDraw }; /* *---------------------------------------------------------------------- * +++ Trough element. * * Used in scrollbars and scales in place of "border". * * The -groovewidth option can be used to set the size of the short axis * for the drawn area. This will not affect the geometry, but can be used * to draw a thin centered trough inside the packet alloted. Use -1 or a * large number to use the full area (default). */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *colorObj; Tcl_Obj *grooveWidthObj; Tcl_Obj *orientObj; } TroughElement; static const Ttk_ElementOptionSpec TroughElementOptions[] = { { "-troughborderwidth", TK_OPTION_PIXELS, offsetof(TroughElement,borderWidthObj), "1" }, { "-troughrelief",TK_OPTION_RELIEF, offsetof(TroughElement,reliefObj), "sunken" }, { "-troughcolor", TK_OPTION_BORDER, offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-groovewidth", TK_OPTION_PIXELS, offsetof(TroughElement,grooveWidthObj), "-1" }, { "-orient", TK_OPTION_ANY, offsetof(TroughElement, orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TroughElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { TroughElement *troughPtr = (TroughElement *)elementRecord; int borderWidth = 1, grooveWidth = -1; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); if (grooveWidth <= 0) { *paddingPtr = Ttk_UniformPadding((short)borderWidth); } } static Ttk_Box troughInnerBox; static void TroughElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { TroughElement *troughPtr = (TroughElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, troughPtr->colorObj); int borderWidth = 1, grooveWidth = -1, relief = TK_RELIEF_SUNKEN; Ttk_Orient orient; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient); if (grooveWidth > 0 && grooveWidth < b.height && grooveWidth < b.width) { if (orient == TTK_ORIENT_HORIZONTAL) { b.y += (b.height - grooveWidth) / 2; b.height = grooveWidth; } else { b.x += (b.width - grooveWidth) / 2; b.width = grooveWidth; } troughInnerBox.x = b.x + borderWidth; troughInnerBox.y = b.y + borderWidth; troughInnerBox.width = b.width - 2*borderWidth; troughInnerBox.height = b.height - 2*borderWidth; } Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static const Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
923 924 925 926 927 928 929 | offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( | > | | > < < | > | | > < < | > > > > > > > > < | | < | | | | | | | | < < < < > > | | < < < < < < | < < < | < < < < < | < | < < | | < > | | > > > > < < > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > | > > > > | < < > > > > > > > > > | | > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < | | < > | | | | > > | < < | | | | | | | | > | | > > > > > | 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 | offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ThumbElement *thumb = (ThumbElement *)elementRecord; Ttk_Orient orient; int thickness; Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness); Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = thickness; *heightPtr = MIN_THUMB_SIZE; } else { *widthPtr = MIN_THUMB_SIZE; *heightPtr = thickness; } } static void ThumbElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ThumbElement *thumb = (ThumbElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, thumb->borderObj); int borderWidth = 2, relief = TK_RELIEF_RAISED; Tk_GetPixelsFromObj(NULL, tkwin, thumb->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, thumb->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); } static const Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ThumbElement), ThumbElementOptions, ThumbElementSize, ThumbElementDraw }; /* *---------------------------------------------------------------------- * +++ Slider element. * * This is the moving part of the scale widget. Drawn as a filled circle. */ #define SLIDER_DIM 16 static const char sliderData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <circle cx='8' cy='8' r='7.5' fill='#ffffff' stroke='#c3c3c3'/>\n\ <circle cx='8' cy='8' r='4' fill='#4a6984'/>\n\ </svg>"; typedef struct { Tcl_Obj *innerColorObj; Tcl_Obj *outerColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *orientObj; /* Orientation of overall slider */ } SliderElement; static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-innercolor", TK_OPTION_COLOR, offsetof(SliderElement,innerColorObj), "#4a6984" }, { "-outercolor", TK_OPTION_COLOR, offsetof(SliderElement,outerColorObj), "#ffffff" }, { "-bordercolor", TK_OPTION_COLOR, offsetof(SliderElement,borderColorObj), "#c3c3c3" }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { double scalingLevel = TkScalingLevel(tkwin); *widthPtr = *heightPtr = SLIDER_DIM * scalingLevel; } static void SliderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { double scalingLevel = TkScalingLevel(tkwin); int dim = SLIDER_DIM * scalingLevel; SliderElement *slider = (SliderElement *)elementRecord; Ttk_Orient orient; Display *disp = Tk_Display(tkwin); XColor *innerColor = Tk_GetColorFromObj(tkwin, slider->innerColorObj); XColor *outerColor = Tk_GetColorFromObj(tkwin, slider->outerColorObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, slider->borderColorObj); GC gc = Tk_GCForColor(innerColor, d); char innerColorStr[7], outerColorStr[7], borderColorStr[7]; Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[50]; Tk_Image img; const char *svgDataPtr = sliderData; size_t svgDataLen; char *svgDataCopy; char *innerColorPtr, *outerColorPtr, *borderColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; /* * Sanity check */ if ( b.x < 0 || b.y < 0 || Tk_Width(tkwin) < b.x + dim || Tk_Height(tkwin) < b.y + dim) { /* Oops! Not enough room to display the image. * Don't draw anything. */ return; } /* * Fill the thin trough area preceding the * slider's center with the inner color */ Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: XFillRectangle(disp, d, gc, troughInnerBox.x, troughInnerBox.y, b.x + dim/2 - 1, troughInnerBox.height); break; case TTK_ORIENT_VERTICAL: XFillRectangle(disp, d, gc, troughInnerBox.x, troughInnerBox.y, troughInnerBox.width, b.y + dim/2 - 1); break; } /* * Construct the color strings innerColorStr, * outerColorStr, and borderColorStr */ ColorToStr(innerColor, innerColorStr); ColorToStr(outerColor, outerColorStr); ColorToStr(borderColor, borderColorStr); /* * Check whether there is an SVG image of this size for these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::slider_default%d_%s_%s_%s", dim, innerColorStr, outerColorStr, borderColorStr); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ innerColorPtr = strstr(svgDataCopy, "4a6984"); outerColorPtr = strstr(svgDataCopy, "ffffff"); borderColorPtr = strstr(svgDataCopy, "c3c3c3"); assert(innerColorPtr); assert(outerColorPtr); assert(borderColorPtr); memcpy(innerColorPtr, innerColorStr, 6); memcpy(outerColorPtr, outerColorStr, 6); memcpy(borderColorPtr, borderColorStr, 6); /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Display the image */ Tk_RedrawImage(img, 0, 0, dim, dim, d, b.x, b.y); Tk_FreeImage(img); } static const Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, |
︙ | ︙ | |||
1118 1119 1120 1121 1122 1123 1124 | DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void PbarElementSize( | > | | > < < | > | | > < < | 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 | DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj), DEFAULT_BACKGROUND }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void PbarElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { PbarElement *pbar = (PbarElement *)elementRecord; Ttk_Orient orient; int thickness = 15, length = 30, borderWidth = 2; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); switch (orient) { case TTK_ORIENT_HORIZONTAL: *widthPtr = length + 2 * borderWidth; *heightPtr = thickness + 2 * borderWidth; break; case TTK_ORIENT_VERTICAL: *widthPtr = thickness + 2 * borderWidth; *heightPtr = length + 2 * borderWidth; break; } } static void PbarElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { PbarElement *pbar = (PbarElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, pbar->borderObj); int relief = TK_RELIEF_RAISED, borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, pbar->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); |
︙ | ︙ | |||
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | /*------------------------------------------------------------------------ * +++ Notebook tabs and client area. */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; } TabElement; static const Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, | > > | > > > > > | > > | | | < > > > > > > > > > > > > | > > | > > > > | | > > | | > > | | > > > | | > > | < > > > | > > > > > > > > > > | > > > > > > > > > | | | | > > > > > > > > > | > > | > > > > > > > > > > > > > > | | | | > > > | | < > | < | | > > > > > > | > > < | < | | > > > > | > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > < < | < < < < < < < < < < < < < < | | | | | > > > > > > | 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 | /*------------------------------------------------------------------------ * +++ Notebook tabs and client area. */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; Tcl_Obj *highlightObj; Tcl_Obj *highlightColorObj; } TabElement; static const Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, offsetof(TabElement,borderWidthObj), "1" }, { "-background", TK_OPTION_BORDER, offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND }, { "-highlight", TK_OPTION_BOOLEAN, offsetof(TabElement,highlightObj), "0" }, { "-highlightcolor", TK_OPTION_COLOR, offsetof(TabElement,highlightColorObj), "#4a6984" }, {0,TK_OPTION_BOOLEAN,0,0} }; static void TabElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { TabElement *tab = (TabElement *)elementRecord; int borderWidth = 1; Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } switch (nbTabsStickBit) { default: case TTK_STICK_S: paddingPtr->bottom = 0; break; case TTK_STICK_N: paddingPtr->top = 0; break; case TTK_STICK_E: paddingPtr->right = 0; break; case TTK_STICK_W: paddingPtr->left = 0; break; } } static void TabElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; TabElement *tab = (TabElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); int highlight = 0; XColor *hlColor = NULL; XPoint pts[6]; double scalingLevel = TkScalingLevel(tkwin); int cut = round(2 * scalingLevel); Display *disp = Tk_Display(tkwin); int borderWidth = 1; if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } if (state & TTK_STATE_SELECTED) { /* * Draw slightly outside of the allocated parcel, * to overwrite the client area border. */ switch (nbTabsStickBit) { default: case TTK_STICK_S: b.height += 1; break; case TTK_STICK_N: b.height += 1; b.y -= 1; break; case TTK_STICK_E: b.width += 1; break; case TTK_STICK_W: b.width += 1; b.x -= 1; break; } Tcl_GetBooleanFromObj(NULL, tab->highlightObj, &highlight); if (highlight) { hlColor = Tk_GetColorFromObj(tkwin, tab->highlightColorObj); } } switch (nbTabsStickBit) { default: case TTK_STICK_S: pts[0].x = b.x; pts[0].y = b.y + b.height-1; pts[1].x = b.x; pts[1].y = b.y + cut; pts[2].x = b.x + cut; pts[2].y = b.y; pts[3].x = b.x + b.width-1 - cut; pts[3].y = b.y; pts[4].x = b.x + b.width-1; pts[4].y = b.y + cut; pts[5].x = b.x + b.width-1; pts[5].y = b.y + b.height; break; case TTK_STICK_N: pts[0].x = b.x; pts[0].y = b.y; pts[1].x = b.x; pts[1].y = b.y + b.height-1 - cut; pts[2].x = b.x + cut; pts[2].y = b.y + b.height-1; pts[3].x = b.x + b.width-1 - cut; pts[3].y = b.y + b.height-1; pts[4].x = b.x + b.width-1; pts[4].y = b.y + b.height-1 - cut; pts[5].x = b.x + b.width-1; pts[5].y = b.y-1; break; case TTK_STICK_E: pts[0].x = b.x + b.width-1; pts[0].y = b.y; pts[1].x = b.x + cut; pts[1].y = b.y; pts[2].x = b.x; pts[2].y = b.y + cut; pts[3].x = b.x; pts[3].y = b.y + b.height-1 - cut; pts[4].x = b.x + cut; pts[4].y = b.y + b.height-1; pts[5].x = b.x + b.width; pts[5].y = b.y + b.height-1; break; case TTK_STICK_W: pts[0].x = b.x; pts[0].y = b.y; pts[1].x = b.x + b.width-1 - cut; pts[1].y = b.y; pts[2].x = b.x + b.width-1; pts[2].y = b.y + cut; pts[3].x = b.x + b.width-1; pts[3].y = b.y + b.height-1 - cut; pts[4].x = b.x + b.width-1 - cut; pts[4].y = b.y + b.height-1; pts[5].x = b.x-1; pts[5].y = b.y + b.height-1; break; } XFillPolygon(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC), pts, 6, Convex, CoordModeOrigin); switch (nbTabsStickBit) { default: case TTK_STICK_S: pts[5].y -= 1 - WIN32_XDRAWLINE_HACK; break; case TTK_STICK_N: pts[5].y += 1 - WIN32_XDRAWLINE_HACK; break; case TTK_STICK_E: pts[5].x -= 1 - WIN32_XDRAWLINE_HACK; break; case TTK_STICK_W: pts[5].x += 1 - WIN32_XDRAWLINE_HACK; break; } Tk_GetPixelsFromObj(NULL, tkwin, tab->borderWidthObj, &borderWidth); while (borderWidth--) { XDrawLines(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), pts, 4, CoordModeOrigin); XDrawLines(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), pts+3, 3, CoordModeOrigin); switch (nbTabsStickBit) { default: case TTK_STICK_S: ++pts[0].x; ++pts[1].x; ++pts[2].y; ++pts[3].y; --pts[4].x; --pts[5].x; break; case TTK_STICK_N: ++pts[0].x; ++pts[1].x; --pts[2].y; --pts[3].y; --pts[4].x; --pts[5].x; break; case TTK_STICK_E: ++pts[0].y; ++pts[1].y; ++pts[2].x; ++pts[3].x; --pts[4].y; --pts[5].y; break; case TTK_STICK_W: ++pts[0].y; ++pts[1].y; --pts[2].x; --pts[3].x; --pts[4].y; --pts[5].y; break; } } if (highlight) { switch (nbTabsStickBit) { default: case TTK_STICK_S: XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), b.x + cut, b.y, b.width - 2*cut, cut); break; case TTK_STICK_N: XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), b.x + cut, b.y + b.height - cut, b.width - 2*cut, cut); break; case TTK_STICK_E: XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), b.x, b.y + cut, cut, b.height - 2*cut); break; case TTK_STICK_W: XFillRectangle(disp, d, Tk_GCForColor(hlColor, d), b.x + b.width - cut, b.y + cut, cut, b.height - 2*cut); break; } } } static const Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(TabElement), TabElementOptions, TabElementSize, TabElementDraw }; /* * Client area element: * Uses same resources as tab element. */ typedef TabElement ClientElement; #define ClientElementOptions TabElementOptions static void ClientElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { ClientElement *ce = (ClientElement *)elementRecord; int borderWidth = 1; Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); } static void ClientElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { ClientElement *ce = (ClientElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, ce->backgroundObj); int borderWidth = 1; Tk_GetPixelsFromObj(NULL, tkwin, ce->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth,TK_RELIEF_RAISED); } static const Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(ClientElement), ClientElementOptions, ClientElementSize, ClientElementDraw }; /*---------------------------------------------------------------------- * TtkElements_Init -- * Register default element implementations. */ MODULE_SCOPE void TtkElements_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* * Elements: */ Ttk_RegisterElement(interp, theme, "background", &BackgroundElementSpec,NULL); Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL); Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL); Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL); Ttk_RegisterElement(interp, theme, "Checkbutton.indicator", &IndicatorElementSpec, (void *)&checkbutton_spec); Ttk_RegisterElement(interp, theme, "Radiobutton.indicator", &IndicatorElementSpec, (void *)&radiobutton_spec); Ttk_RegisterElement(interp, theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL); Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec, NULL); Ttk_RegisterElement(interp, theme, "uparrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "Spinbox.uparrow", &BoxArrowElementSpec, INT2PTR(ARROW_UP)); Ttk_RegisterElement(interp, theme, "downarrow", &ArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "Spinbox.downarrow", &BoxArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "Combobox.downarrow", &BoxArrowElementSpec, INT2PTR(ARROW_DOWN)); Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, INT2PTR(ARROW_LEFT)); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, INT2PTR(ARROW_RIGHT)); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, INT2PTR(ARROW_UP)); |
︙ | ︙ |
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 16 17 18 19 20 21 22 23 24 | /* * 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Extra bits for core.flags: */ #define GOT_SELECTION (WIDGET_USER_FLAG<<1) #define SYNCING_VARIABLE (WIDGET_USER_FLAG<<2) #define VALIDATING (WIDGET_USER_FLAG<<3) |
︙ | ︙ | |||
80 81 82 83 84 85 86 | } EntryStyleData; typedef struct { /* * Internal state: */ char *string; /* Storage for string (malloced) */ | | | | | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | } EntryStyleData; typedef struct { /* * Internal state: */ char *string; /* Storage for string (malloced) */ Tcl_Size numBytes; /* Length of string in bytes. */ Tcl_Size numChars; /* Length of string in characters. */ Tcl_Size insertPos; /* Insert index */ Tcl_Size selectFirst; /* Index of start of selection, or TCL_INDEX_NONE */ Tcl_Size selectLast; /* Index of end of selection, or TCL_INDEX_NONE */ Scrollable xscroll; /* Current scroll position */ ScrollHandle xscrollHandle; /* * Options managed by Tk_SetOptions: */ |
︙ | ︙ | |||
162 163 164 165 166 167 168 | DEF_ENTRY_FONT, offsetof(Entry, entry.fontObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", NULL, TCL_INDEX_NONE, offsetof(Entry, entry.invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", TCL_INDEX_NONE, offsetof(Entry, entry.justify), | | | | 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 | DEF_ENTRY_FONT, offsetof(Entry, entry.fontObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", NULL, TCL_INDEX_NONE, offsetof(Entry, entry.invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", TCL_INDEX_NONE, offsetof(Entry, entry.justify), TK_OPTION_ENUM_VAR, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", NULL, offsetof(Entry, entry.placeholderObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-show", "show", "Show", NULL, TCL_INDEX_NONE, offsetof(Entry, entry.showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-state", "state", "State", "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", |
︙ | ︙ | |||
292 293 294 295 296 297 298 | static char *EntryDisplayString(const char *showChar, int numChars) { char *displayString, *p; int size; int ch; char buf[6]; | | | | | | 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 | static char *EntryDisplayString(const char *showChar, int numChars) { char *displayString, *p; int size; int ch; char buf[6]; Tcl_UtfToUniChar(showChar, &ch); size = Tcl_UniCharToUtf(ch, buf); p = displayString = (char *)ckalloc(numChars * size + 1); while (numChars--) { memcpy(p, buf, size); p += size; } *p = '\0'; return displayString; } /* EntryUpdateTextLayout -- * Recompute textLayout, layoutWidth, and layoutHeight * from displayString and fontObj. */ static void EntryUpdateTextLayout(Entry *entryPtr) { Tcl_Size length; char *text; Tk_FreeTextLayout(entryPtr->entry.textLayout); 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); } } |
︙ | ︙ | |||
346 347 348 349 350 351 352 | /*------------------------------------------------------------------------ * +++ Selection management. */ /* EntryFetchSelection -- * Selection handler for entry widgets. */ | | | | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | /*------------------------------------------------------------------------ * +++ Selection management. */ /* EntryFetchSelection -- * Selection handler for entry widgets. */ static Tcl_Size EntryFetchSelection( void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes) { Entry *entryPtr = (Entry *)clientData; Tcl_Size byteCount; const char *string; const char *selStart, *selEnd; if (entryPtr->entry.selectFirst < 0 || (!entryPtr->entry.exportSelection) || Tcl_IsSafe(entryPtr->core.interp)) { return TCL_INDEX_NONE; } string = entryPtr->entry.displayString; selStart = Tcl_UtfAtIndex(string, entryPtr->entry.selectFirst); selEnd = Tcl_UtfAtIndex(selStart, |
︙ | ︙ | |||
381 382 383 384 385 386 387 | return byteCount; } /* EntryLostSelection -- * Tk_LostSelProc for Entry widgets; called when an entry * loses ownership of the selection. */ | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | return byteCount; } /* EntryLostSelection -- * Tk_LostSelProc for Entry widgets; called when an entry * loses ownership of the selection. */ static void EntryLostSelection(void *clientData) { Entry *entryPtr = (Entry *)clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE; TtkRedisplayWidget(&entryPtr->core); } |
︙ | ︙ | |||
417 418 419 420 421 422 423 | * or -invalidcommand). */ static void ExpandPercents( Entry *entryPtr, /* Entry that needs validation. */ const char *templ, /* Script template */ const char *newValue, /* Potential new value of entry string */ | | | | | | | 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 | * or -invalidcommand). */ static void ExpandPercents( Entry *entryPtr, /* Entry that needs validation. */ const char *templ, /* Script template */ const char *newValue, /* Potential new value of entry string */ Tcl_Size index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason, /* Reason for change */ Tcl_DString *dsPtr) /* Result of %-substitutions */ { int spaceNeeded, cvtFlags; int number, length; const char *string; int stringLength; int ch; char numStorage[2*TCL_INTEGER_SPACE]; while (*templ) { /* Find everything up to the next % character and append it * to the result string. */ string = Tcl_UtfFindFirst(templ, '%'); if (string == NULL) { /* No more %-sequences to expand. * Copy the rest of the template. */ Tcl_DStringAppend(dsPtr, templ, TCL_INDEX_NONE); return; } if (string != templ) { Tcl_DStringAppend(dsPtr, templ, string - templ); templ = string; } /* There's a percent sequence here. Process it. */ ++templ; /* skip over % */ if (*templ != '\0') { templ += Tcl_UtfToUniChar(templ, &ch); } else { ch = '%'; } stringLength = -1; switch (ch) { case 'd': /* Type of call that caused validation */ if (reason == VALIDATE_INSERT) { number = 1; } else if (reason == VALIDATE_DELETE) { number = 0; } else { number = -1; } snprintf(numStorage, sizeof(numStorage), "%d", number); string = numStorage; break; case 'i': /* index of insert/delete */ snprintf(numStorage, sizeof(numStorage), "%" TCL_SIZE_MODIFIER "d", index); string = numStorage; break; case 'P': /* 'Peeked' new value of the string */ string = newValue; break; case 's': /* Current string value */ string = entryPtr->entry.string; |
︙ | ︙ | |||
500 501 502 503 504 505 506 | case 'V': /* type of validation in effect */ string = validateReasonStrings[reason]; break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->core.tkwin); break; default: | | | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | case 'V': /* type of validation in effect */ string = validateReasonStrings[reason]; break; case 'W': /* widget name */ string = Tk_PathName(entryPtr->core.tkwin); break; default: length = Tcl_UniCharToUtf(ch, numStorage); numStorage[length] = '\0'; string = numStorage; break; } spaceNeeded = Tcl_ScanCountedElement(string, stringLength, &cvtFlags); length = Tcl_DStringLength(dsPtr); |
︙ | ︙ | |||
527 528 529 530 531 532 533 | */ static int RunValidationScript( Tcl_Interp *interp, /* Interpreter to use */ Entry *entryPtr, /* Entry being validated */ const char *templ, /* Script template */ const char *optionName, /* "-validatecommand", "-invalidcommand" */ const char *newValue, /* Potential new value of entry string */ | | | | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | */ static int RunValidationScript( Tcl_Interp *interp, /* Interpreter to use */ Entry *entryPtr, /* Entry being validated */ const char *templ, /* Script template */ const char *optionName, /* "-validatecommand", "-invalidcommand" */ const char *newValue, /* Potential new value of entry string */ Tcl_Size index, /* index of insert/delete */ Tcl_Size count, /* #changed characters */ VREASON reason) /* Reason for change */ { Tcl_DString script; int code; Tcl_DStringInit(&script); ExpandPercents(entryPtr, templ, newValue, index, count, reason, &script); |
︙ | ︙ | |||
579 580 581 582 583 584 585 | /* EntryValidateChange -- * Validate a proposed change to the entry widget's value if required. * Call the -invalidcommand if validation fails. * * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected | | | | | 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 | /* EntryValidateChange -- * Validate a proposed change to the entry widget's value if required. * Call the -invalidcommand if validation fails. * * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected * TCL_ERROR if any errors occurred * * The change will be rejected if -validatecommand returns 0, * or if -validatecommand or -invalidcommand modifies the value. */ static int EntryValidateChange( Entry *entryPtr, /* Entry that needs validation. */ const char *newValue, /* Potential new value of entry string */ Tcl_Size index, /* index of insert/delete, TCL_INDEX_NONE otherwise */ Tcl_Size count, /* #changed characters */ VREASON reason) /* Reason for change */ { Tcl_Interp *interp = entryPtr->core.interp; VMODE vmode = entryPtr->entry.validate; int code, change_ok; if ((entryPtr->entry.validateCmd == NULL) |
︙ | ︙ | |||
652 653 654 655 656 657 658 | /* EntryRevalidate -- * Revalidate the current value of an entry widget, * update the TTK_STATE_INVALID bit. * * Returns: * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error. */ | | > > > < | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | /* EntryRevalidate -- * Revalidate the current value of an entry widget, * update the TTK_STATE_INVALID bit. * * Returns: * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error. */ static int EntryRevalidate( TCL_UNUSED(Tcl_Interp *), Entry *entryPtr, VREASON reason) { int code = EntryValidateChange( entryPtr, entryPtr->entry.string, -1,0, reason); if (code == TCL_BREAK) { TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); } else if (code == TCL_OK) { TtkWidgetChangeState(&entryPtr->core, 0, TTK_STATE_INVALID); } |
︙ | ︙ | |||
716 717 718 719 720 721 722 | int g = nChars > 0; /* left gravity adjustment */ e->insertPos = AdjustIndex(e->insertPos, index, nChars); e->selectFirst = AdjustIndex(e->selectFirst, index, nChars); e->selectLast = AdjustIndex(e->selectLast, index+g, nChars); e->xscroll.first= AdjustIndex(e->xscroll.first, index+g, nChars); | | | | 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 | int g = nChars > 0; /* left gravity adjustment */ e->insertPos = AdjustIndex(e->insertPos, index, nChars); e->selectFirst = AdjustIndex(e->selectFirst, index, nChars); e->selectLast = AdjustIndex(e->selectLast, index+g, nChars); e->xscroll.first= AdjustIndex(e->xscroll.first, index+g, nChars); if (e->selectLast <= e->selectFirst) e->selectFirst = e->selectLast = TCL_INDEX_NONE; } /* EntryStoreValue -- * Replace the contents of a text entry with a given value, * recompute dependent resources, and schedule a redisplay. * * See also: EntrySetValue(). */ static void EntryStoreValue(Entry *entryPtr, const char *value) { size_t numBytes = strlen(value); Tcl_Size numChars = Tcl_NumUtfChars(value, numBytes); if (entryPtr->core.flags & VALIDATING) entryPtr->core.flags |= VALIDATION_SET_VALUE; /* Make sure all indices remain in bounds: */ if (numChars < entryPtr->entry.numChars) |
︙ | ︙ | |||
831 832 833 834 835 836 837 | /* InsertChars -- * Add new characters to an entry widget. */ static int InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ | | | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | /* InsertChars -- * Add new characters to an entry widget. */ static int InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ Tcl_Size index, /* Insert before this index */ const char *value) /* New characters to add */ { char *string = entryPtr->entry.string; size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; size_t byteCount = strlen(value); int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; |
︙ | ︙ | |||
871 872 873 874 875 876 877 | /* DeleteChars -- * Remove one or more characters from an entry widget. */ static int DeleteChars( Entry *entryPtr, /* Entry widget to modify. */ | | | | | | | 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 | /* DeleteChars -- * Remove one or more characters from an entry widget. */ static int DeleteChars( Entry *entryPtr, /* Entry widget to modify. */ Tcl_Size index, /* Index of first character to delete. */ Tcl_Size count) /* How many characters to delete. */ { char *string = entryPtr->entry.string; size_t byteIndex, byteCount, newByteCount; char *newBytes; int code; if (index < 0) { index = 0; } if (count + index > entryPtr->entry.numChars) { count = entryPtr->entry.numChars - index; } if (count <= 0) { return TCL_OK; } byteIndex = Tcl_UtfAtIndex(string, index) - string; byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; |
︙ | ︙ | |||
921 922 923 924 925 926 927 | /* EntryEventProc -- * Extra event handling for entry widgets: * Triggers validation on FocusIn and FocusOut events. */ #define EntryEventMask (FocusChangeMask) static void | | | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | /* EntryEventProc -- * Extra event handling for entry widgets: * Triggers validation on FocusIn and FocusOut events. */ #define EntryEventMask (FocusChangeMask) static void EntryEventProc(void *clientData, XEvent *eventPtr) { Entry *entryPtr = (Entry *)clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { case DestroyNotify: Tk_DeleteEventHandler(entryPtr->core.tkwin, |
︙ | ︙ | |||
946 947 948 949 950 951 952 | } /*------------------------------------------------------------------------ * +++ Initialization and cleanup. */ static void | | > > < | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | } /*------------------------------------------------------------------------ * +++ Initialization and cleanup. */ static void EntryInitialize( TCL_UNUSED(Tcl_Interp *), void *recordPtr) { Entry *entryPtr = (Entry *)recordPtr; Tk_CreateEventHandler( entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); TtkBlinkCursor(&entryPtr->core); |
︙ | ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); entryPtr->entry.textVariableTrace = vt; } /* Claim the selection, in case we've suddenly started exporting it. */ | | | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); entryPtr->entry.textVariableTrace = vt; } /* Claim the selection, in case we've suddenly started exporting it. */ if (entryPtr->entry.exportSelection && (entryPtr->entry.selectFirst >= 0) && (!Tcl_IsSafe(entryPtr->core.interp))) { EntryOwnSelection(entryPtr); } /* Handle -state compatibility option: */ if (mask & STATE_CHANGED) { |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | EntryUpdateTextLayout(entryPtr); return TCL_OK; } /* EntryPostConfigure -- * Post-configuration hook for entry widgets. */ | | > > > < | | 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 | EntryUpdateTextLayout(entryPtr); return TCL_OK; } /* EntryPostConfigure -- * Post-configuration hook for entry widgets. */ static int EntryPostConfigure( TCL_UNUSED(Tcl_Interp *), void *recordPtr, int mask) { Entry *entryPtr = (Entry *)recordPtr; int status = TCL_OK; if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) { status = Ttk_FireTrace(entryPtr->entry.textVariableTrace); } return status; } /*------------------------------------------------------------------------ * +++ Layout and display. */ /* EntryCharPosition -- * Return the X coordinate of the specified character index. * Precondition: textLayout and layoutX up-to-date. */ static int EntryCharPosition(Entry *entryPtr, Tcl_Size index) { int xPos; Tk_CharBbox(entryPtr->entry.textLayout, index, &xPos, NULL, NULL, NULL); return xPos + entryPtr->entry.layoutX; } /* EntryDoLayout -- |
︙ | ︙ | |||
1193 1194 1195 1196 1197 1198 1199 | /* EntryDisplay -- * Redraws the contents of an entry window. */ static void EntryDisplay(void *clientData, Drawable d) { Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->core.tkwin; | | | | | | | | | | | | 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 | /* EntryDisplay -- * Redraws the contents of an entry window. */ static void EntryDisplay(void *clientData, Drawable d) { Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->core.tkwin; Tcl_Size leftIndex = entryPtr->entry.xscroll.first, rightIndex = entryPtr->entry.xscroll.last + 1, selFirst = entryPtr->entry.selectFirst, selLast = entryPtr->entry.selectLast; EntryStyleData es; GC gc; int showSelection, showCursor; Ttk_Box textarea; TkRegion clipRegion; XRectangle rect; Tcl_Obj *foregroundObj; EntryInitStyleData(entryPtr, &es); textarea = Ttk_ClientRegion(entryPtr->core.layout, "textarea"); showCursor = (entryPtr->core.flags & CURSOR_ON) && EntryEditable(entryPtr) && entryPtr->entry.insertPos >= leftIndex && entryPtr->entry.insertPos <= rightIndex ; showSelection = !(entryPtr->core.state & TTK_STATE_DISABLED) && selFirst >= 0 && selLast > leftIndex && selFirst <= rightIndex; /* Adjust selection range to keep in display bounds. */ if (showSelection) { if (selFirst < leftIndex) selFirst = leftIndex; if (selLast > rightIndex) selLast = rightIndex; } /* Draw widget background & border */ Ttk_DrawLayout(entryPtr->core.layout, entryPtr->core.state, d); /* Draw selection background */ if (showSelection && es.selBorderObj) { Tk_3DBorder selBorder = Tk_Get3DBorderFromObj(tkwin, es.selBorderObj); int selStartX = EntryCharPosition(entryPtr, selFirst); int selEndX = EntryCharPosition(entryPtr, selLast); int borderWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, es.selBorderWidthObj, &borderWidth); if (selBorder) { Tk_Fill3DRectangle(tkwin, d, selBorder, selStartX - borderWidth, entryPtr->entry.layoutY - borderWidth, selEndX - selStartX + 2*borderWidth, entryPtr->entry.layoutHeight + 2*borderWidth, borderWidth, TK_RELIEF_RAISED); |
︙ | ︙ | |||
1275 1276 1277 1278 1279 1280 1281 | if (showCursor) { Ttk_Box field = Ttk_ClientRegion(entryPtr->core.layout, "field"); int cursorX = EntryCharPosition(entryPtr, entryPtr->entry.insertPos), cursorY = entryPtr->entry.layoutY, cursorHeight = entryPtr->entry.layoutHeight, cursorWidth = 1; | | | 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | if (showCursor) { Ttk_Box field = Ttk_ClientRegion(entryPtr->core.layout, "field"); int cursorX = EntryCharPosition(entryPtr, entryPtr->entry.insertPos), cursorY = entryPtr->entry.layoutY, cursorHeight = entryPtr->entry.layoutHeight, cursorWidth = 1; Tk_GetPixelsFromObj(NULL, tkwin, es.insertWidthObj, &cursorWidth); if (cursorWidth <= 0) { cursorWidth = 1; } /* @@@ should: maybe: SetCaretPos even when blinked off */ Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight); |
︙ | ︙ | |||
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 { | | | | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | */ 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. |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | * error occurs then an error message is left in the interp's result. */ static int EntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ | | | > > | | | | | | | | 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 | * error occurs then an error message is left in the interp's result. */ static int EntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ Tcl_Size *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ Tcl_Size length, idx; const char *string; if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) { if (idx < 0) { 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; } else if (strncmp(string, "sel.", 4) == 0) { if (entryPtr->entry.selectFirst < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "selection isn't in widget %s", Tk_PathName(entryPtr->core.tkwin))); Tcl_SetErrorCode(interp, "TTK", "ENTRY", "NO_SELECTION", NULL); return TCL_ERROR; } if (strncmp(string, "sel.first", length) == 0) { |
︙ | ︙ | |||
1435 1436 1437 1438 1439 1440 1441 | x = maxWidth; roundUp = 1; } *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout, x - entryPtr->entry.layoutX, 0); TtkUpdateScrollInfo(entryPtr->entry.xscrollHandle); | | | | | | | | | | | | | | | | | | | | | | 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 | x = maxWidth; roundUp = 1; } *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout, x - entryPtr->entry.layoutX, 0); TtkUpdateScrollInfo(entryPtr->entry.xscrollHandle); if (*indexPtr < entryPtr->entry.xscroll.first) { *indexPtr = entryPtr->entry.xscroll.first; } /* * Special trick: if the x-position was off-screen to the right, * round the index up to refer to the character just after the * last visible one on the screen. This is needed to enable the * last character to be selected, for example. */ if (roundUp && (*indexPtr < entryPtr->entry.numChars)) { *indexPtr += 1; } } else { goto badIndex; } return TCL_OK; badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad entry index \"%s\"", string)); Tcl_SetErrorCode(interp, "TTK", "ENTRY", "INDEX", NULL); return TCL_ERROR; } /* $entry bbox $index -- * Return the bounding box of the character at the specified index. */ static int EntryBBoxCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; Ttk_Box b; Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } if ((index == entryPtr->entry.numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->entry.textLayout, index, &b.x, &b.y, &b.width, &b.height); b.x += entryPtr->entry.layoutX; b.y += entryPtr->entry.layoutY; Tcl_SetObjResult(interp, Ttk_NewBoxObj(b)); return TCL_OK; } /* $entry delete $from ?$to? -- * Delete the characters in the range [$from,$to). * $to defaults to $from+1 if not specified. */ static int EntryDeleteCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; Tcl_Size first, last; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "firstIndex ?lastIndex?"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &first) != TCL_OK) { return TCL_ERROR; } if (objc == 3) { last = first + 1; } else if (EntryIndex(interp, entryPtr, objv[3], &last) != TCL_OK) { return TCL_ERROR; } if (last >= first && EntryEditable(entryPtr)) { return DeleteChars(entryPtr, first, last - first); } return TCL_OK; } /* $entry get -- * Return the current value of the entry widget. */ static int EntryGetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->entry.string, -1)); return TCL_OK; } /* $entry icursor $index -- * Set the insert cursor position. */ static int EntryICursorCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &entryPtr->entry.insertPos) != TCL_OK) { return TCL_ERROR; } TtkRedisplayWidget(&entryPtr->core); return TCL_OK; } /* $entry index $index -- * Return numeric value (0..numChars) of the specified index. */ static int EntryIndexCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, TkNewIndexObj(index)); return TCL_OK; } /* $entry insert $index $text -- * Insert $text after position $index. * Silent no-op if the entry is disabled or read-only. */ static int EntryInsertCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; Tcl_Size index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index text"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } if (EntryEditable(entryPtr)) { return InsertChars(entryPtr, index, Tcl_GetString(objv[3])); } return TCL_OK; } /* $entry selection clear -- * Clear selection. */ static int EntrySelectionClearCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE; TtkRedisplayWidget(&entryPtr->core); return TCL_OK; } /* $entry selection present -- * Returns 1 if any characters are selected, 0 otherwise. */ static int EntrySelectionPresentCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr->entry.selectFirst >= 0)); return TCL_OK; } /* $entry selection range $start $end -- * Explicitly set the selection range. */ static int EntrySelectionRangeCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; Tcl_Size start, end; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "start end"); return TCL_ERROR; } if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK || EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) { return TCL_ERROR; } if (entryPtr->core.state & TTK_STATE_DISABLED) { return TCL_OK; } if (start >= end) { entryPtr->entry.selectFirst = entryPtr->entry.selectLast = TCL_INDEX_NONE; } else { entryPtr->entry.selectFirst = start; entryPtr->entry.selectLast = end; EntryOwnSelection(entryPtr); } TtkRedisplayWidget(&entryPtr->core); |
︙ | ︙ | |||
1676 1677 1678 1679 1680 1681 1682 | { 0,0,0 } }; /* $entry set $value * Sets the value of an entry widget. */ static int EntrySetCommand( | | | | 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 | { 0,0,0 } }; /* $entry set $value * Sets the value of an entry widget. */ static int EntrySetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "value"); return TCL_ERROR; } EntrySetValue(entryPtr, Tcl_GetString(objv[2])); return TCL_OK; } /* $entry validate -- * Trigger forced validation. Returns 1/0 if validation succeeds/fails * or error status from -validatecommand / -invalidcommand. */ static int EntryValidateCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; int code; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; |
︙ | ︙ | |||
1714 1715 1716 1717 1718 1719 1720 | Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); return TCL_OK; } /* $entry xview -- horizontal scrolling interface */ static int EntryXViewCommand( | | | | 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 | Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK)); return TCL_OK; } /* $entry xview -- horizontal scrolling interface */ static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Entry *entryPtr = (Entry *)recordPtr; if (objc == 3) { Tcl_Size newFirst; if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { return TCL_ERROR; } TtkScrollTo(entryPtr->entry.xscrollHandle, newFirst, 1); return TCL_OK; } return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); |
︙ | ︙ | |||
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. | > | 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 | { "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. |
︙ | ︙ | |||
1773 1774 1775 1776 1777 1778 1779 | * +++ Combobox widget record. */ typedef struct { Tcl_Obj *postCommandObj; Tcl_Obj *valuesObj; Tcl_Obj *heightObj; | | | 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 | * +++ Combobox widget record. */ typedef struct { Tcl_Obj *postCommandObj; Tcl_Obj *valuesObj; Tcl_Obj *heightObj; Tcl_Size currentIndex; } ComboboxPart; typedef struct { WidgetCore core; EntryPart entry; ComboboxPart combobox; } Combobox; |
︙ | ︙ | |||
1815 1816 1817 1818 1819 1820 1821 | /* ComboboxConfigure -- * Configuration hook for combobox widgets. */ static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Combobox *cbPtr = (Combobox *)recordPtr; | | | | | | | | | | | | | 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 | /* ComboboxConfigure -- * Configuration hook for combobox widgets. */ static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Combobox *cbPtr = (Combobox *)recordPtr; Tcl_Size unused; /* Make sure -values is a valid list: */ if (Tcl_ListObjLength(interp,cbPtr->combobox.valuesObj,&unused) != TCL_OK) return TCL_ERROR; return EntryConfigure(interp, recordPtr, mask); } /* $cb current ?newIndex? -- get or set current index. * Setting the current index updates the combobox value, * but the value and -values may be changed independently * of the index. Instead of trying to keep currentIndex * in sync at all times, [$cb current] double-checks */ static int ComboboxCurrentCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Combobox *cbPtr = (Combobox *)recordPtr; Tcl_Size currentIndex = cbPtr->combobox.currentIndex; const char *currentValue = cbPtr->entry.string; Tcl_Size nValues; Tcl_Obj **values; Tcl_ListObjGetElements(interp, cbPtr->combobox.valuesObj, &nValues, &values); if (objc == 2) { /* Check if currentIndex still valid: */ if (currentIndex < 0 || currentIndex >= nValues || strcmp(currentValue,Tcl_GetString(values[currentIndex])) ) { /* Not valid. Check current value against each element in -values: */ for (currentIndex = 0; currentIndex < nValues; ++currentIndex) { if (!strcmp(currentValue,Tcl_GetString(values[currentIndex]))) { break; } } if (currentIndex >= nValues) { /* Not found */ currentIndex = TCL_INDEX_NONE; } } cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex)); return TCL_OK; } else if (objc == 3) { Tcl_Size idx; if (TCL_OK == TkGetIntForIndex(objv[2], nValues - 1, 0, &idx)) { if (idx < 0 || idx >= 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 }, | > | | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 | { "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 */ |
︙ | ︙ | |||
1959 1960 1961 1962 1963 1964 1965 | static const Tk_OptionSpec SpinboxOptionSpecs[] = { {TK_OPTION_STRING, "-values", "values", "Values", "", offsetof(Spinbox, spinbox.valuesObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_DOUBLE, "-from", "from", "From", | | | | | 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | static const Tk_OptionSpec SpinboxOptionSpecs[] = { {TK_OPTION_STRING, "-values", "values", "Values", "", offsetof(Spinbox, spinbox.valuesObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0.0", offsetof(Spinbox,spinbox.fromObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_DOUBLE, "-to", "to", "To", "0.0", offsetof(Spinbox,spinbox.toObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", "1.0", offsetof(Spinbox,spinbox.incrementObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_STRING, "-format", "format", "Format", "", offsetof(Spinbox, spinbox.formatObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Spinbox, spinbox.commandObj), TCL_INDEX_NONE, |
︙ | ︙ | |||
1999 2000 2001 2002 2003 2004 2005 | /* SpinboxConfigure -- * Configuration hook for spinbox widgets. */ static int SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Spinbox *sb = (Spinbox *)recordPtr; | | | 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | /* SpinboxConfigure -- * Configuration hook for spinbox widgets. */ static int SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Spinbox *sb = (Spinbox *)recordPtr; Tcl_Size unused; /* Make sure -values is a valid list: */ if (Tcl_ListObjLength(interp,sb->spinbox.valuesObj,&unused) != TCL_OK) return TCL_ERROR; return EntryConfigure(interp, recordPtr, mask); |
︙ | ︙ | |||
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 }, | > | | 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 | { "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 */ |
︙ | ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, offsetof(TextareaElement,widthObj), "20" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TextareaElementSize( | > | > | > > < < | 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 | offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, offsetof(TextareaElement,widthObj), "20" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TextareaElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { TextareaElement *textarea = (TextareaElement *)elementRecord; Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj); int avgWidth = Tk_TextWidth(font, "0", 1); Tk_FontMetrics fm; int prefWidth = 1; Tk_GetFontMetrics(font, &fm); Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth); if (prefWidth <= 0) prefWidth = 1; *heightPtr = fm.linespace; |
︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(SpinboxLayout) | | | | | | | > | | | 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 | TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(SpinboxLayout) TTK_GROUP("Spinbox.field", TTK_PACK_TOP|TTK_FILL_X, TTK_GROUP("null", 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.padding", TTK_FILL_BOTH, TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ MODULE_SCOPE void TtkEntry_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterElement(interp, themePtr, "textarea", &TextareaElementSpec, 0); Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout); Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout); |
︙ | ︙ |
Changes to generic/ttk/ttkFrame.c.
1 | /* | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * Copyright © 2004 Joe English * * ttk::frame and ttk::labelframe widgets. */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" #include "ttkManager.h" /* ====================================================================== * +++ Frame widget: */ |
︙ | ︙ | |||
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. |
︙ | ︙ | |||
86 87 88 89 90 91 92 | /* FrameSize procedure -- * The frame doesn't request a size of its own by default, * but it does have an internal border. See also <<NOTE-SIZE>> */ static int FrameSize( void *recordPtr, | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /* FrameSize procedure -- * The frame doesn't request a size of its own by default, * but it does have an internal border. See also <<NOTE-SIZE>> */ static int FrameSize( void *recordPtr, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *)) /* heightPtr */ { Frame *framePtr = (Frame *)recordPtr; Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } /* |
︙ | ︙ | |||
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; Tcl_Obj *underlineObj; 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", TTK_OPTION_UNDERLINE_DEF(Labelframe, label.underlineObj), 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) }; |
︙ | ︙ | |||
294 295 296 297 298 299 300 | if ((objPtr = Ttk_QueryOption(layout, "-padding", 0)) != NULL) { Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, &style->padding); } if ((objPtr = Ttk_QueryOption(layout,"-labelanchor", 0)) != NULL) { TtkGetLabelAnchorFromObj(NULL, objPtr, &style->labelAnchor); } if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) { | > | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | if ((objPtr = Ttk_QueryOption(layout, "-padding", 0)) != NULL) { Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, &style->padding); } if ((objPtr = Ttk_QueryOption(layout,"-labelanchor", 0)) != NULL) { TtkGetLabelAnchorFromObj(NULL, objPtr, &style->labelAnchor); } if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) { Ttk_GetPaddingFromObj(NULL, lf->core.tkwin, objPtr, &style->labelMargins); } else { if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) { style->labelMargins = Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0); } else { style->labelMargins = Ttk_MakePadding(0,DEFAULT_LABELINSET,0,DEFAULT_LABELINSET); |
︙ | ︙ | |||
338 339 340 341 342 343 344 | /* * LabelframeSize -- * Like the frame, this doesn't request a size of its own * but it does have internal padding and a minimum size. */ static int LabelframeSize( void *recordPtr, | | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | /* * LabelframeSize -- * Like the frame, this doesn't request a size of its own * but it does have internal padding and a minimum size. */ static int LabelframeSize( void *recordPtr, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *)) /* heightPtr */ { Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; int labelWidth, labelHeight; |
︙ | ︙ | |||
490 491 492 493 494 495 496 | b = lframe->label.labelParcel; /* ASSERT: content #0 is lframe->label.labelWidget */ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); } } static int LabelRequest( | | | | | | | | 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 | b = lframe->label.labelParcel; /* ASSERT: content #0 is lframe->label.labelWidget */ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); } } static int LabelRequest( TCL_UNUSED(void *), /* managerData */ TCL_UNUSED(Tcl_Size), /* index */ TCL_UNUSED(int), /* width */ TCL_UNUSED(int)) /* height */ { return 1; } /* LabelRemoved -- * Unset the -labelwidget option. * * <<NOTE-LABELREMOVED>>: * This routine is also called when the widget voluntarily forgets * the window in LabelframeConfigure. */ static void LabelRemoved( void *managerData, TCL_UNUSED(Tcl_Size)) /* index */ { Labelframe *lframe = (Labelframe *)managerData; lframe->label.labelWidget = 0; } static const Ttk_ManagerSpec LabelframeManagerSpec = { { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc }, LabelframeSize, LabelframePlaceContent, LabelRequest, LabelRemoved }; |
︙ | ︙ | |||
650 651 652 653 654 655 656 | TTK_NODE("Label.text", TTK_FILL_BOTH)) TTK_END_LAYOUT /* ====================================================================== * +++ Initialization. */ | | | | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | TTK_NODE("Label.text", TTK_FILL_BOTH)) TTK_END_LAYOUT /* ====================================================================== * +++ Initialization. */ MODULE_SCOPE void TtkFrame_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TFrame", FrameLayout); Ttk_RegisterLayout(theme, "TLabelframe", LabelframeLayout); Ttk_RegisterLayout(theme, "Label", LabelSublayout); RegisterWidget(interp, "ttk::frame", &FrameWidgetSpec); RegisterWidget(interp, "ttk::labelframe", &LabelframeWidgetSpec); } |
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]. */ |
︙ | ︙ | |||
21 22 23 24 25 26 27 | struct TtkImageSpec { Tk_Image baseImage; /* Base image to use */ int mapCount; /* #state-specific overrides */ Ttk_StateSpec *states; /* array[mapCount] of states ... */ Tk_Image *images; /* ... per-state images to use */ Tk_ImageChangedProc *imageChanged; | | | | > > > > > > > | < < < < < < < | | 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 | struct TtkImageSpec { Tk_Image baseImage; /* Base image to use */ int mapCount; /* #state-specific overrides */ Ttk_StateSpec *states; /* array[mapCount] of states ... */ Tk_Image *images; /* ... per-state images to use */ Tk_ImageChangedProc *imageChanged; void *imageChangedClientData; }; /* NullImageChanged -- * Do-nothing Tk_ImageChangedProc. */ static void NullImageChanged( TCL_UNUSED(void *), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int)) { /* No-op */ } /* ImageSpecImageChanged -- * Image changes should trigger a repaint. */ static void ImageSpecImageChanged(void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { Ttk_ImageSpec *imageSpec = (Ttk_ImageSpec *)clientData; if (imageSpec->imageChanged != NULL) { imageSpec->imageChanged(imageSpec->imageChangedClientData, x, y, width, height, imageWidth, imageHeight); |
︙ | ︙ | |||
72 73 74 75 76 77 78 | * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. * Result must be released using TtkFreeImageSpec. * imageChangedProc will be called when not NULL when * the image changes to allow widgets to repaint. */ Ttk_ImageSpec * TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, | | | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. * Result must be released using TtkFreeImageSpec. * imageChangedProc will be called when not NULL when * the image changes to allow widgets to repaint. */ Ttk_ImageSpec * TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_ImageChangedProc *imageChangedProc, void *imageChangedClientData) { Ttk_ImageSpec *imageSpec = 0; int i = 0, n = 0; Tcl_Size objc; Tcl_Obj **objv; imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec)); imageSpec->baseImage = 0; imageSpec->mapCount = 0; imageSpec->states = 0; imageSpec->images = 0; |
︙ | ︙ | |||
160 161 162 163 164 165 166 | ckfree(imageSpec); } /* TtkSelectImage -- * Return a state-specific image from an ImageSpec */ | | > > > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | ckfree(imageSpec); } /* TtkSelectImage -- * Return a state-specific image from an ImageSpec */ Tk_Image TtkSelectImage( Ttk_ImageSpec *imageSpec, TCL_UNUSED(Tk_Window), Ttk_State state) { int i; for (i = 0; i < imageSpec->mapCount; ++i) { if (Ttk_StateMatches(state, imageSpec->states+i)) { return imageSpec->images[i]; } } |
︙ | ︙ | |||
204 205 206 207 208 209 210 | { return Ttk_MakeBox(b.x, b.y+b.height-p.bottom, b.width, p.bottom); } /* Ttk_Fill -- * Fill the destination area of the drawable by replicating * the source area of the image. */ static void Ttk_Fill( | > > | > > < | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | { return Ttk_MakeBox(b.x, b.y+b.height-p.bottom, b.width, p.bottom); } /* Ttk_Fill -- * Fill the destination area of the drawable by replicating * the source area of the image. */ static void Ttk_Fill( TCL_UNUSED(Tk_Window), Drawable d, Tk_Image image, Ttk_Box src, Ttk_Box dst) { int dr = dst.x + dst.width; int db = dst.y + dst.height; int x,y; if (!(src.width && src.height && dst.width && dst.height)) return; for (x = dst.x; x < dr; x += src.width) { int cw = MIN(src.width, dr - x); for (y = dst.y; y <= db; y += src.height) { |
︙ | ︙ | |||
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 */ | | | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | /*------------------------------------------------------------------------ * +++ 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 */ |
︙ | ︙ | |||
276 277 278 279 280 281 282 | #ifdef TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } #endif ckfree(clientData); } static void ImageElementSize( | | > > | > > < < | > > | > > < | | | 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 | #ifdef TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } #endif ckfree(clientData); } static void ImageElementSize( void *clientData, TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ImageData *imageData = (ImageData *)clientData; Tk_Image image = imageData->imageSpec->baseImage; if (image) { Tk_SizeOfImage(image, widthPtr, heightPtr); } if (imageData->minWidth >= 0) { *widthPtr = imageData->minWidth; } if (imageData->minHeight >= 0) { *heightPtr = imageData->minHeight; } *paddingPtr = imageData->padding; } static void ImageElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ImageData *imageData = (ImageData *)clientData; Tk_Image image = 0; int imgWidth, imgHeight; Ttk_Box src, dst; #ifdef TILE_07_COMPAT if (imageData->imageMap) { Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state); if (imageObj) { image = Ttk_UseImage(imageData->cache, tkwin, imageObj); } } if (!image) { image = TtkSelectImage(imageData->imageSpec, tkwin, state); } #else image = TtkSelectImage(imageData->imageSpec, tkwin, state); #endif if (!image) { return; } Tk_SizeOfImage(image, &imgWidth, &imgHeight); |
︙ | ︙ | |||
347 348 349 350 351 352 353 | /*------------------------------------------------------------------------ * +++ Image element factory. */ static int Ttk_CreateImageElement( Tcl_Interp *interp, | | | | < | | 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 | /*------------------------------------------------------------------------ * +++ Image element factory. */ static int Ttk_CreateImageElement( Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, Tcl_Size objc, Tcl_Obj *const objv[]) { static const char *const optionStrings[] = { "-border","-height","-padding","-sticky","-width",NULL }; enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH }; Ttk_ImageSpec *imageSpec = 0; ImageData *imageData = 0; int padding_specified = 0; Tcl_Size i; if (objc + 1 < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Must supply a base image", -1)); Tcl_SetErrorCode(interp, "TTK", "IMAGE", "BASE", NULL); return TCL_ERROR; } imageSpec = TtkGetImageSpec(interp, Tk_MainWindow(interp), objv[0]); |
︙ | ︙ | |||
451 452 453 454 455 456 457 | return TCL_OK; error: FreeImageData(imageData); return TCL_ERROR; } | | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | return TCL_OK; error: FreeImageData(imageData); return TCL_ERROR; } MODULE_SCOPE void TtkImage_Init(Tcl_Interp *interp) { Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL); } /*EOF*/ |
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 | /* * 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 }; int Ttk_GetOrientFromObj( 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); |
︙ | ︙ | |||
183 184 185 186 187 188 189 | {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /*------------------------------------------------------------------------ * +++ Initialization: elements and element factories. */ | | | | | | | | | | | | | | | | 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 | {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /*------------------------------------------------------------------------ * +++ Initialization: elements and element factories. */ MODULE_SCOPE void TtkElements_Init(Tcl_Interp *); MODULE_SCOPE void TtkLabel_Init(Tcl_Interp *); MODULE_SCOPE void TtkImage_Init(Tcl_Interp *); static void RegisterElements(Tcl_Interp *interp) { TtkElements_Init(interp); TtkLabel_Init(interp); TtkImage_Init(interp); } /*------------------------------------------------------------------------ * +++ Initialization: Widget definitions. */ MODULE_SCOPE void TtkButton_Init(Tcl_Interp *); MODULE_SCOPE void TtkEntry_Init(Tcl_Interp *); MODULE_SCOPE void TtkFrame_Init(Tcl_Interp *); MODULE_SCOPE void TtkNotebook_Init(Tcl_Interp *); MODULE_SCOPE void TtkPanedwindow_Init(Tcl_Interp *); MODULE_SCOPE void TtkProgressbar_Init(Tcl_Interp *); MODULE_SCOPE void TtkScale_Init(Tcl_Interp *); MODULE_SCOPE void TtkScrollbar_Init(Tcl_Interp *); MODULE_SCOPE void TtkSeparator_Init(Tcl_Interp *); MODULE_SCOPE void TtkTreeview_Init(Tcl_Interp *); #ifdef TTK_SQUARE_WIDGET MODULE_SCOPE int TtkSquareWidget_Init(Tcl_Interp *); #endif static void RegisterWidgets(Tcl_Interp *interp) { TtkButton_Init(interp); TtkEntry_Init(interp); TtkFrame_Init(interp); |
︙ | ︙ | |||
234 235 236 237 238 239 240 | #endif } /*------------------------------------------------------------------------ * +++ Initialization: Built-in themes. */ | | | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | #endif } /*------------------------------------------------------------------------ * +++ Initialization: Built-in themes. */ MODULE_SCOPE int TtkAltTheme_Init(Tcl_Interp *); MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *); MODULE_SCOPE int TtkClamTheme_Init(Tcl_Interp *); static void RegisterThemes(Tcl_Interp *interp) { TtkAltTheme_Init(interp); TtkClassicTheme_Init(interp); TtkClamTheme_Init(interp); |
︙ | ︙ | |||
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*/ | > > > | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | 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 | 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, offsetof(TextElement,underlineObj), NULL}, { "-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); | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | * 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); Tcl_Size underline = INT_MIN; 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*/); | | > | > > > > > | | | | | | > > | > | > > < < > | > | > > < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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_NONE, 0, &underline); if (underline < INT_MIN) { underline = INT_MIN; } else if (underline > INT_MAX) { underline = INT_MAX; } if (underline != INT_MIN) { 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); XSetClipMask(Tk_Display(tkwin), gc2, None); TkDestroyRegion(clipRegion); } Tk_FreeGC(Tk_Display(tkwin), gc1); Tk_FreeGC(Tk_Display(tkwin), gc2); } static void TextElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { TextElement *text = (TextElement *)elementRecord; if (!TextSetup(text, tkwin)) return; *heightPtr = text->height; *widthPtr = TextReqWidth(text); TextCleanup(text); return; } static void TextElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { TextElement *text = (TextElement *)elementRecord; if (TextSetup(text, tkwin)) { TextDraw(text, tkwin, d, b); TextCleanup(text); } } static const Ttk_ElementSpec TextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), TextElementOptions, TextElementSize, TextElementDraw }; /*---------------------------------------------------------------------- * +++ cText (collapsing text) element. * * This element is the same as the Text element, except its dimensions * are 0,0 when the text to display is "". */ static int cTextSetup(TextElement *text, Tk_Window tkwin) { if (*Tcl_GetString(text->textObj) == '\0') { return 0; } else { return TextSetup(text, tkwin); } } static void cTextElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { TextElement *text = (TextElement *)elementRecord; if (!cTextSetup(text, tkwin)) return; *heightPtr = text->height; *widthPtr = TextReqWidth(text); TextCleanup(text); return; } static const Ttk_ElementSpec cTextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), TextElementOptions, cTextElementSize, TextElementDraw }; /*---------------------------------------------------------------------- * +++ Image element. * Draws an image. */ typedef struct { |
︙ | ︙ | |||
278 279 280 281 282 283 284 | if (!image->imageObj) { return 0; } image->imageSpec = TtkGetImageSpec(NULL, tkwin, image->imageObj); if (!image->imageSpec) { return 0; } | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | if (!image->imageObj) { return 0; } image->imageSpec = TtkGetImageSpec(NULL, tkwin, image->imageObj); if (!image->imageSpec) { return 0; } image->tkimg = TtkSelectImage(image->imageSpec, tkwin, state); if (!image->tkimg) { TtkFreeImageSpec(image->imageSpec); return 0; } Tk_SizeOfImage(image->tkimg, &image->width, &image->height); return 1; |
︙ | ︙ | |||
352 353 354 355 356 357 358 | * @@@ it's ugly and out of fashion. * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ if (state & TTK_STATE_DISABLED) { | | > | > | > > < < > | > | > > < | 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 | * @@@ it's ugly and out of fashion. * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, tkwin, 0ul) == image->tkimg) { #ifndef MAC_OSX_TK StippleOver(image, tkwin, d, b.x,b.y); #endif } } } static void ImageElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ImageElement *image = (ImageElement *)elementRecord; if (ImageSetup(image, tkwin, 0)) { *widthPtr = image->width; *heightPtr = image->height; ImageCleanup(image); } } static void ImageElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ImageElement *image = (ImageElement *)elementRecord; if (ImageSetup(image, tkwin, state)) { ImageDraw(image, tkwin, d, b, state); ImageCleanup(image); } } |
︙ | ︙ | |||
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" }, | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | */ { "-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, offsetof(LabelElement,text.underlineObj), "-1"}, { "-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" }, |
︙ | ︙ | |||
492 493 494 495 496 497 498 | * LabelSetup -- * Fills in computed fields of the label element. * * Calculate the text, image, and total width and height. */ #undef MAX | | | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | * LabelSetup -- * Fills in computed fields of the label element. * * Calculate the text, image, and total width and height. */ #undef MAX #define MAX(a,b) ((a) > (b) ? (a) : (b)); static void LabelSetup( LabelElement *c, Tk_Window tkwin, Ttk_State state) { Ttk_Compound *compoundPtr = &c->compound; Tk_GetPixelsFromObj(NULL, tkwin, c->spaceObj, &c->space); Ttk_GetCompoundFromObj(NULL, c->compoundObj, compoundPtr); |
︙ | ︙ | |||
565 566 567 568 569 570 571 | if (c->compound != TTK_COMPOUND_TEXT) ImageCleanup(&c->image); if (c->compound != TTK_COMPOUND_IMAGE) TextCleanup(&c->text); } static void LabelElementSize( | | | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | if (c->compound != TTK_COMPOUND_TEXT) ImageCleanup(&c->image); if (c->compound != TTK_COMPOUND_IMAGE) TextCleanup(&c->text); } static void LabelElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { LabelElement *label = (LabelElement *)elementRecord; |
︙ | ︙ | |||
626 627 628 629 630 631 632 | Ttk_Box textBox = Ttk_PlaceBox(&b, l->text.width, l->text.height, textSide, 0); ImageDraw(&l->image,tkwin,d,imageBox,state); TextDraw(&l->text,tkwin,d,textBox); } static void LabelElementDraw( | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | Ttk_Box textBox = Ttk_PlaceBox(&b, l->text.width, l->text.height, textSide, 0); ImageDraw(&l->image,tkwin,d,imageBox,state); TextDraw(&l->text,tkwin,d,textBox); } static void LabelElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { LabelElement *l = (LabelElement *)elementRecord; |
︙ | ︙ | |||
697 698 699 700 701 702 703 | LabelElementDraw }; /*------------------------------------------------------------------------ * +++ Initialization. */ | | | > | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | LabelElementDraw }; /*------------------------------------------------------------------------ * +++ Initialization. */ MODULE_SCOPE void TtkLabel_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL); Ttk_RegisterElement(interp, theme, "ctext", &cTextElementSpec, NULL); Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, NULL); Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, NULL); } |
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 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 | /* * 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)) /*------------------------------------------------------------------------ * +++ Ttk_Box and Ttk_Padding utilities: */ Ttk_Box Ttk_MakeBox(int x, int y, int width, int height) { Ttk_Box b; b.x = x; b.y = y; b.width = width; b.height = height; return b; } int Ttk_BoxContains(Ttk_Box box, int x, int y) { return box.x <= x && x < box.x + box.width && box.y <= y && y < box.y + box.height; } int TtkBoxEqual(Ttk_Box box1, Ttk_Box box2) { return box1.x == box2.x && box1.y == box2.y && box1.width == box2.width && box1.height == box2.height; } Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box) { Tcl_Obj *result[4]; result[0] = Tcl_NewWideIntObj(box.x); |
︙ | ︙ | |||
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; | | < | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | 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. |
︙ | ︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 | Ttk_PackBox(cavity, width, height, side), width, height, sticky); } /* * Ttk_PositionBox -- * Pack and stick a box according to PositionSpec flags. */ MODULE_SCOPE Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int width, int height, Ttk_PositionSpec flags) { Ttk_Box parcel; if (flags & TTK_EXPAND) parcel = *cavity; else if (flags & TTK_PACK_TOP) parcel = packTop(cavity, height); | > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | Ttk_PackBox(cavity, width, height, side), width, height, sticky); } /* * Ttk_PositionBox -- * Pack and stick a box according to PositionSpec flags. */ MODULE_SCOPE Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int width, int height, Ttk_PositionSpec flags) { Ttk_Box parcel; if (flags & TTK_EXPAND) parcel = *cavity; else if (flags & TTK_PACK_TOP) parcel = packTop(cavity, height); |
︙ | ︙ | |||
313 314 315 316 317 318 319 | int Ttk_GetPaddingFromObj( Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; | > | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | int Ttk_GetPaddingFromObj( Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; Tcl_Size i, padc; int pixels[4]; if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) { goto error; } if (padc > 4) { if (interp) { |
︙ | ︙ | |||
351 352 353 354 355 356 357 | * instead of Tk_Pixel specifications. Does not require a Tk_Window * parameter. * */ int Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; | > | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | * instead of Tk_Pixel specifications. Does not require a Tk_Window * parameter. * */ int Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad) { Tcl_Obj **padv; Tcl_Size i, padc; int pixels[4]; if (TCL_OK != Tcl_ListObjGetElements(interp, objPtr, &padc, &padv)) { goto error; } if (padc > 4) { if (interp) { |
︙ | ︙ | |||
608 609 610 611 612 613 614 | Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) { enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN }; static const char *const optStrings[] = { "-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 }; | | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) { enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN }; static const char *const optStrings[] = { "-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 }; Tcl_Size i = 0, objc; Tcl_Obj **objv; Ttk_TemplateNode *head = 0, *tail = 0; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) return 0; while (i < objc) { |
︙ | ︙ | |||
908 909 910 911 912 913 914 | { Tcl_DString buf; const char *styleName; Ttk_Style style; Ttk_LayoutTemplate layoutTemplate; Tcl_DStringInit(&buf); | | | | 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | { Tcl_DString buf; const char *styleName; Ttk_Style style; Ttk_LayoutTemplate layoutTemplate; Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Ttk_StyleName(parentLayout->style), TCL_INDEX_NONE); Tcl_DStringAppend(&buf, baseName, TCL_INDEX_NONE); styleName = Tcl_DStringValue(&buf); style = Ttk_GetStyle(themePtr, styleName); layoutTemplate = Ttk_FindLayoutTemplate(themePtr, styleName); if (!layoutTemplate) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
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*/ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | { 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.
︙ | ︙ | |||
53 54 55 56 57 58 59 | /* content->flags bits: */ #define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ struct TtkManager_ { | | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /* content->flags bits: */ #define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ struct TtkManager_ { const Ttk_ManagerSpec *managerSpec; void *managerData; Tk_Window window; unsigned flags; Tcl_Size nContent; Ttk_Content **content; }; /* manager->flags bits: */ #define MGR_UPDATE_PENDING 0x1 #define MGR_RESIZE_REQUIRED 0x2 |
︙ | ︙ | |||
109 110 111 112 113 114 115 | mgr->managerSpec->PlaceContent(mgr->managerData); mgr->flags &= ~MGR_RELAYOUT_REQUIRED; } /* ++ ManagerIdleProc -- * DoWhenIdle procedure for deferred updates. */ | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | mgr->managerSpec->PlaceContent(mgr->managerData); mgr->flags &= ~MGR_RELAYOUT_REQUIRED; } /* ++ ManagerIdleProc -- * DoWhenIdle procedure for deferred updates. */ static void ManagerIdleProc(void *clientData) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; mgr->flags &= ~MGR_UPDATE_PENDING; if (mgr->flags & MGR_RESIZE_REQUIRED) { RecomputeSize(mgr); } |
︙ | ︙ | |||
135 136 137 138 139 140 141 | */ /* ++ ManagerEventHandler -- * Recompute content layout when container widget is resized. * Keep the content's map state in sync with the container's. */ static const int ManagerEventMask = StructureNotifyMask; | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | */ /* ++ ManagerEventHandler -- * Recompute content layout when container widget is resized. * Keep the content's map state in sync with the container's. */ static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(void *clientData, XEvent *eventPtr) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; Tcl_Size i; switch (eventPtr->type) { case ConfigureNotify: RecomputeLayout(mgr); break; case MapNotify: |
︙ | ︙ | |||
202 203 204 205 206 207 208 | } /*------------------------------------------------------------------------ * +++ Manager initialization and cleanup. */ Ttk_Manager *Ttk_CreateManager( | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | } /*------------------------------------------------------------------------ * +++ Manager initialization and cleanup. */ Ttk_Manager *Ttk_CreateManager( const Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; mgr->window = window; mgr->nContent = 0; |
︙ | ︙ | |||
243 244 245 246 247 248 249 | /*------------------------------------------------------------------------ * +++ Content window management. */ /* ++ InsertContent -- * Adds content to the list of managed windows. */ | | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | /*------------------------------------------------------------------------ * +++ Content window management. */ /* ++ InsertContent -- * Adds content to the list of managed windows. */ static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, Tcl_Size index) { Tcl_Size endIndex = mgr->nContent++; mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *)); while (endIndex > index) { mgr->content[endIndex] = mgr->content[endIndex - 1]; --endIndex; } |
︙ | ︙ | |||
272 273 274 275 276 277 278 | * Unmanage and delete the content window. * * NOTES/ASSUMPTIONS: * * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this * routine is called from the content window's DestroyNotify event handler. */ | | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | * Unmanage and delete the content window. * * NOTES/ASSUMPTIONS: * * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this * routine is called from the content window's DestroyNotify event handler. */ static void RemoveContent(Ttk_Manager *mgr, Tcl_Size index) { Ttk_Content *content = mgr->content[index]; Tcl_Size i; /* Notify manager: */ mgr->managerSpec->ContentRemoved(mgr->managerData, index); /* Remove from array: */ |
︙ | ︙ | |||
306 307 308 309 310 311 312 | ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /*------------------------------------------------------------------------ * +++ Tk_GeomMgr hooks. */ | | | > > | | < | | < | | | | > | | | | | | | 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 | ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /*------------------------------------------------------------------------ * +++ Tk_GeomMgr hooks. */ void Ttk_GeometryRequestProc(void *clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; Tcl_Size index = Ttk_ContentIndex(mgr, window); if (index >= 0) { 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(void *clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; Tcl_Size index = Ttk_ContentIndex(mgr, window); /* ASSERT: index >= 0 */ RemoveContent(mgr, index); } /*------------------------------------------------------------------------ * +++ Public API. */ /* ++ Ttk_InsertContent -- * Add a new content window at the specified index. */ void Ttk_InsertContent( Ttk_Manager *mgr, Tcl_Size index, Tk_Window tkwin, void *data) { Ttk_Content *content = NewContent(mgr, tkwin, data); InsertContent(mgr, content, index); } /* ++ Ttk_ForgetContent -- * Unmanage the specified content window. */ void Ttk_ForgetContent(Ttk_Manager *mgr, Tcl_Size index) { Tk_Window window = mgr->content[index]->window; RemoveContent(mgr, index); Tk_ManageGeometry(window, NULL, 0); } /* ++ Ttk_PlaceContent -- * Set the position and size of the specified content window. * * NOTES: * Contrary to documentation, Tk_MaintainGeometry doesn't always * map the content window. */ void Ttk_PlaceContent( Ttk_Manager *mgr, Tcl_Size index, int x, int y, int width, int height) { Ttk_Content *content = mgr->content[index]; Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height); content->flags |= CONTENT_MAPPED; if (Tk_IsMapped(mgr->window)) { Tk_MapWindow(content->window); } } /* ++ Ttk_UnmapContent -- * Unmap the specified content window, but leave it managed. */ void Ttk_UnmapContent(Ttk_Manager *mgr, Tcl_Size index) { Ttk_Content *content = mgr->content[index]; Tk_UnmaintainGeometry(content->window, mgr->window); content->flags &= ~CONTENT_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always * unmap the content window: */ |
︙ | ︙ | |||
400 401 402 403 404 405 406 | void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /* +++ Accessors. */ | | | | | | | | | | | | | | 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 | void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } /* +++ Accessors. */ Tcl_Size Ttk_NumberContent(Ttk_Manager *mgr) { return mgr->nContent; } void *Ttk_ContentData(Ttk_Manager *mgr, Tcl_Size index) { return mgr->content[index]->data; } Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, Tcl_Size index) { return mgr->content[index]->window; } /*------------------------------------------------------------------------ * +++ Utility routines. */ /* ++ Ttk_ContentIndex -- * Returns the index of specified content window, TCL_INDEX_NONE if not found. */ Tcl_Size Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window) { Tcl_Size index; for (index = 0; index < mgr->nContent; ++index) if (mgr->content[index]->window == window) return index; return -1; } /* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) -- * Return the index of the content window specified by objPtr. * Content windows may be specified as an integer index or * as the name of the managed window. * * Returns: * Standard Tcl completion code. Leaves an error message in case of error. */ int Ttk_GetContentIndexFromObj( Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, Tcl_Size *indexPtr) { const char *string = Tcl_GetString(objPtr); Tcl_Size index = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) { if (index < 0 || 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; } /* Try interpreting as a window name; */ if ((*string == '.') && (tkwin = Tk_NameToWindow(interp, string, mgr->window))) { index = Ttk_ContentIndex(mgr, tkwin); if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, Tk_PathName(mgr->window))); Tcl_SetErrorCode(interp, "TTK", "MANAGED", "MANAGER", NULL); return TCL_ERROR; } *indexPtr = index; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Invalid managed window specification %s", string)); Tcl_SetErrorCode(interp, "TTK", "MANAGED", "SPEC", NULL); return TCL_ERROR; } /* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) -- * Change content window order. */ void Ttk_ReorderContent(Ttk_Manager *mgr, Tcl_Size fromIndex, Tcl_Size toIndex) { Ttk_Content *moved = mgr->content[fromIndex]; /* Shuffle down: */ while (fromIndex > toIndex) { mgr->content[fromIndex] = mgr->content[fromIndex - 1]; --fromIndex; |
︙ | ︙ |
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 |
︙ | ︙ | |||
27 28 29 30 31 32 33 | * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); void (*PlaceContent)(void *managerData); | | | | | | | | | | | | | | | | | 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 | * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); void (*PlaceContent)(void *managerData); int (*ContentRequest)(void *managerData, Tcl_Size index, int width, int height); void (*ContentRemoved)(void *managerData, Tcl_Size index); } Ttk_ManagerSpec; /* * Default implementations for Tk_GeomMgr hooks: */ #define Ttk_LostSlaveProc Ttk_LostContentProc MODULE_SCOPE void Ttk_GeometryRequestProc(void *, Tk_Window window); MODULE_SCOPE void Ttk_LostContentProc(void *, Tk_Window window); /* * Public API: */ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager( const Ttk_ManagerSpec *, void *managerData, Tk_Window window); MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *); #define Ttk_InsertSlave Ttk_InsertContent MODULE_SCOPE void Ttk_InsertContent( Ttk_Manager *, Tcl_Size position, Tk_Window, void *clientData); #define Ttk_ForgetSlave Ttk_ForgetContent MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, Tcl_Size index); #define Ttk_ReorderSlave Ttk_ReorderContent MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, Tcl_Size fromIndex, Tcl_Size toIndex); /* Rearrange content window positions */ #define Ttk_PlaceSlave Ttk_PlaceContent MODULE_SCOPE void Ttk_PlaceContent( Ttk_Manager *, Tcl_Size index, int x, int y, int width, int height); /* Position and map the content window */ #define Ttk_UnmapSlave Ttk_UnmapContent MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, Tcl_Size index); /* Unmap the content window */ MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *); MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Notify manager that size (resp. layout) needs to be recomputed */ /* Utilities: */ #define Ttk_SlaveIndex Ttk_ContentIndex MODULE_SCOPE Tcl_Size Ttk_ContentIndex(Ttk_Manager *, Tk_Window); /* Returns: index in content array of specified window, TCL_INDEX_NONE if not found */ #define Ttk_GetSlaveIndexFromObj Ttk_GetContentIndexFromObj MODULE_SCOPE int Ttk_GetContentIndexFromObj( Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, Tcl_Size *indexPtr); /* Accessor functions: */ #define Ttk_NumberSlaves Ttk_NumberContent MODULE_SCOPE Tcl_Size Ttk_NumberContent(Ttk_Manager *); /* Returns: number of managed content windows */ #define Ttk_SlaveData Ttk_ContentData MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, Tcl_Size index); /* Returns: client data associated with content window */ #define Ttk_SlaveWindow Ttk_ContentWindow MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, Tcl_Size index); /* Returns: content window */ MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container); /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */ #endif /* _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 "ttkThemeInt.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 */ |
︙ | ︙ | |||
55 56 57 58 59 60 61 | * 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), | | | | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | * 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", TTK_OPTION_UNDERLINE_DEF(Tab, underlineObj), 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 }, |
︙ | ︙ | |||
90 91 92 93 94 95 96 | Tcl_Obj *widthObj; /* Default width */ Tcl_Obj *heightObj; /* Default height */ Tcl_Obj *paddingObj; /* Padding around notebook */ Ttk_Manager *mgr; /* Geometry manager */ Tk_OptionTable tabOptionTable; /* Tab options */ Tk_OptionTable paneOptionTable; /* Tab+pane options */ | | | | | | 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 | Tcl_Obj *widthObj; /* Default width */ Tcl_Obj *heightObj; /* Default height */ Tcl_Obj *paddingObj; /* Padding around notebook */ Ttk_Manager *mgr; /* Geometry manager */ Tk_OptionTable tabOptionTable; /* Tab options */ Tk_OptionTable paneOptionTable; /* Tab+pane options */ Tcl_Size currentIndex; /* index of currently selected tab */ Tcl_Size activeIndex; /* index of currently active tab */ Ttk_Layout tabLayout; /* Sublayout for tabs */ Ttk_Box clientArea; /* Where to pack content windows */ } NotebookPart; typedef struct { WidgetCore core; NotebookPart notebook; } Notebook; static const Tk_OptionSpec NotebookOptionSpecs[] = { {TK_OPTION_PIXELS, "-width", "width", "Width", "0", offsetof(Notebook,notebook.widthObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-height", "height", "Height", "0", offsetof(Notebook,notebook.heightObj),TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Padding", NULL, offsetof(Notebook,notebook.paddingObj),TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_TRUE, |
︙ | ︙ | |||
131 132 133 134 135 136 137 | Ttk_Padding tabMargins; /* Margins around tab row */ Ttk_PositionSpec tabPlacement; /* How to pack tabs within tab row */ Ttk_Orient tabOrient; /* ... */ int minTabWidth; /* Minimum tab width */ Ttk_Padding padding; /* External padding */ } NotebookStyle; | | > > > > > > > > > | | | | 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 | Ttk_Padding tabMargins; /* Margins around tab row */ Ttk_PositionSpec tabPlacement; /* How to pack tabs within tab row */ Ttk_Orient tabOrient; /* ... */ int minTabWidth; /* Minimum tab width */ Ttk_Padding padding; /* External padding */ } NotebookStyle; static void NotebookStyleOptions( Notebook *nb, NotebookStyle *nbstyle, Tk_Window tkwin) { Tcl_Obj *objPtr; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; nbstyle->tabPosition = TTK_PACK_TOP | TTK_STICK_W; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabposition", 0)) != 0) { TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPosition); } /* Guess default tabPlacement as function of tabPosition: */ if (nbstyle->tabPosition & TTK_PACK_LEFT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_E; } else if (nbstyle->tabPosition & TTK_PACK_RIGHT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_W; } else if (nbstyle->tabPosition & TTK_PACK_BOTTOM) { nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_N; } else { /* Assume TTK_PACK_TOP */ nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_S; } if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabplacement", 0)) != 0) { TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPlacement); } /* Save the stick bit for later. One of the values * TTK_STICK_S, TTK_STICK_N, TTK_STICK_E, or TTK_STICK_W: */ if (mainInfoPtr != NULL) { mainInfoPtr->ttkNbTabsStickBit = (nbstyle->tabPlacement & 0x0f); } /* Compute tabOrient as function of tabPlacement: */ if (nbstyle->tabPlacement & (TTK_PACK_LEFT|TTK_PACK_RIGHT)) { nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL; } else { nbstyle->tabOrient = TTK_ORIENT_VERTICAL; } nbstyle->tabMargins = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabmargins", 0)) != 0) { Ttk_GetPaddingFromObj(NULL, tkwin, objPtr, &nbstyle->tabMargins); } nbstyle->padding = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-padding", 0)) != 0) { Ttk_GetPaddingFromObj(NULL, tkwin, objPtr, &nbstyle->padding); } nbstyle->minTabWidth = DEFAULT_MIN_TAB_WIDTH; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-mintabwidth", 0)) != 0) { Tk_GetPixelsFromObj(NULL, tkwin, objPtr, &nbstyle->minTabWidth); } } /*------------------------------------------------------------------------ * +++ Tab management. */ |
︙ | ︙ | |||
206 207 208 209 210 211 212 | void *record = tab; Tk_FreeConfigOptions(record, nb->notebook.paneOptionTable, nb->core.tkwin); ckfree(record); } static int ConfigureTab( Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window, | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | void *record = tab; Tk_FreeConfigOptions(record, nb->notebook.paneOptionTable, nb->core.tkwin); ckfree(record); } static int ConfigureTab( Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window, Tcl_Size objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; Ttk_Padding padding = tab->padding; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable, |
︙ | ︙ | |||
250 251 252 253 254 255 256 | } /* * IdentifyTab -- * Return the index of the tab at point x,y, * or -1 if no tab at that point. */ | | | | | | | | 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 | } /* * IdentifyTab -- * Return the index of the tab at point x,y, * or -1 if no tab at that point. */ static Tcl_Size IdentifyTab(Notebook *nb, int x, int y) { Tcl_Size index; for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { return index; } } return TCL_INDEX_NONE; } /* * ActivateTab -- * Set the active tab index, redisplay if necessary. */ static void ActivateTab(Notebook *nb, Tcl_Size index) { if (index != nb->notebook.activeIndex) { nb->notebook.activeIndex = index; TtkRedisplayWidget(&nb->core); } } /* * TabState -- * Return the state of the specified tab, based on * notebook state, currentIndex, activeIndex, and user-specified tab state. * The USER1 bit is set for the leftmost visible tab, and USER2 * is set for the rightmost visible tab. */ static Ttk_State TabState(Notebook *nb, Tcl_Size index) { Ttk_State state = nb->core.state; Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); Tcl_Size i = 0; if (index == nb->notebook.currentIndex) { state |= TTK_STATE_SELECTED; } else { state &= ~TTK_STATE_FOCUS; } if (index == nb->notebook.activeIndex) { state |= TTK_STATE_ACTIVE; } for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } if (index == i) { state |= TTK_STATE_USER1; } break; } for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i >= 0; --i) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } if (index == i) { state |= TTK_STATE_USER2; } |
︙ | ︙ | |||
347 348 349 350 351 352 353 | * (max height/width) but not parallel (total width/height). */ static void TabrowSize( Notebook *nb, Ttk_Orient orient, int minTabWidth, int *widthPtr, int *heightPtr) { Ttk_Layout tabLayout = nb->notebook.tabLayout; int tabrowWidth = 0, tabrowHeight = 0; | | | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | * (max height/width) but not parallel (total width/height). */ static void TabrowSize( Notebook *nb, Ttk_Orient orient, int minTabWidth, int *widthPtr, int *heightPtr) { Ttk_Layout tabLayout = nb->notebook.tabLayout; int tabrowWidth = 0, tabrowHeight = 0; Tcl_Size i; for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); Ttk_LayoutSize(tabLayout,tabState,&tab->width,&tab->height); |
︙ | ︙ | |||
381 382 383 384 385 386 387 388 389 390 391 392 393 | * Client area size determined by max size of content windows, * overridden by -width and/or -height if nonzero. */ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { Notebook *nb = (Notebook *)clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); int clientWidth = 0, clientHeight = 0, reqWidth = 0, reqHeight = 0, tabrowWidth = 0, tabrowHeight = 0; | > | | | | | 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 | * Client area size determined by max size of content windows, * overridden by -width and/or -height if nonzero. */ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { Notebook *nb = (Notebook *)clientData; Tk_Window nbwin = nb->core.tkwin; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); int clientWidth = 0, clientHeight = 0, reqWidth = 0, reqHeight = 0, tabrowWidth = 0, tabrowHeight = 0; Tcl_Size i; NotebookStyleOptions(nb, &nbstyle, nbwin); /* Compute max requested size of all content windows: */ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i); Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); int width = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding); int height = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding); clientWidth = MAX(clientWidth, width); clientHeight = MAX(clientHeight, height); } /* Client width/height overridable by widget options: */ Tk_GetPixelsFromObj(NULL, nbwin, nb->notebook.widthObj, &reqWidth); Tk_GetPixelsFromObj(NULL, nbwin, nb->notebook.heightObj, &reqHeight); if (reqWidth > 0) clientWidth = reqWidth; if (reqHeight > 0) clientHeight = reqHeight; /* Tab row: */ |
︙ | ︙ | |||
493 494 495 496 497 498 499 | Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { Ttk_Padding expand = Ttk_UniformPadding(0); Tcl_Obj *expandObj = Ttk_QueryOption(tabLayout,"-expand",tabState); if (expandObj) { | | > > > > > > > > > > > > > > > > > > | | 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 | Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { Ttk_Padding expand = Ttk_UniformPadding(0); Tcl_Obj *expandObj = Ttk_QueryOption(tabLayout,"-expand",tabState); if (expandObj) { Ttk_GetPaddingFromObj(NULL, nb->core.tkwin, expandObj, &expand); } tab->parcel = Ttk_ExpandBox( Ttk_PositionBox(&tabrowBox, tab->width, tab->height, tabPlacement), expand); } } } /* * NotebookPlaceContent -- * Set the position and size of a child widget * based on the current client area and content window options: */ static void NotebookPlaceContent(Notebook* nb, Tcl_Size index) { Tab* tab = (Tab*)Ttk_ContentData(nb->notebook.mgr, index); Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index); Ttk_Box box = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), Tk_ReqWidth(window), Tk_ReqHeight(window), tab->sticky); Ttk_PlaceContent(nb->notebook.mgr, index, box.x, box.y, box.width, box.height); } /* NotebookDoLayout -- * Computes notebook layout and places tabs. * * Side effects: * Sets clientArea, used to place panes. */ static void NotebookDoLayout(void *recordPtr) { Notebook *nb = (Notebook *)recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); Ttk_Box tabrowBox; NotebookStyle nbstyle; Tcl_Size currentIndex = nb->notebook.currentIndex; NotebookStyleOptions(nb, &nbstyle, nbwin); /* Notebook internal padding: */ cavity = Ttk_PadBox(cavity, nbstyle.padding); /* Layout for notebook background (base layout): */ |
︙ | ︙ | |||
559 560 561 562 563 564 565 | Ttk_PlaceElement(nb->core.layout, clientNode, cavity); cavity = Ttk_LayoutNodeInternalParcel(nb->core.layout, clientNode); } if (cavity.height <= 0) cavity.height = 1; if (cavity.width <= 0) cavity.width = 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 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | Ttk_PlaceElement(nb->core.layout, clientNode, cavity); cavity = Ttk_LayoutNodeInternalParcel(nb->core.layout, clientNode); } if (cavity.height <= 0) cavity.height = 1; if (cavity.width <= 0) cavity.width = 1; if (!TtkBoxEqual(nb->notebook.clientArea, cavity)) { nb->notebook.clientArea = cavity; if (currentIndex >= 0) { NotebookPlaceContent(nb, currentIndex); } } } /* NotebookPlaceContents -- * Geometry manager hook. */ static void NotebookPlaceContents(void *recordPtr) { Notebook *nb = (Notebook *)recordPtr; Tcl_Size currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); NotebookPlaceContent(nb, currentIndex); } } /* * SelectTab(nb, index) -- * Change the currently-selected tab. */ static void SelectTab(Notebook *nb, Tcl_Size index) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); Tcl_Size currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { return; } if (TabState(nb, index) & TTK_STATE_DISABLED) { return; } /* Unhide the tab if it is currently hidden and being selected. */ if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } if (currentIndex >= 0) { Ttk_UnmapContent(nb->notebook.mgr, currentIndex); } /* Must be set before calling NotebookPlaceContent(), otherwise it may * happen that NotebookPlaceContents(), triggered by an interveaning * geometry request, will swap to old index. */ nb->notebook.currentIndex = index; |
︙ | ︙ | |||
637 638 639 640 641 642 643 | /* NextTab -- * Returns the index of the next tab after the specified tab * in the normal state (e.g., not hidden or disabled), * or -1 if all tabs are disabled or hidden. */ static int NextTab(Notebook *nb, int index) { | | | | | | | | | | | | | | | | | | 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 | /* NextTab -- * Returns the index of the next tab after the specified tab * in the normal state (e.g., not hidden or disabled), * or -1 if all tabs are disabled or hidden. */ static int NextTab(Notebook *nb, int index) { Tcl_Size nTabs = Ttk_NumberContent(nb->notebook.mgr); Tcl_Size nextIndex; /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } } /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } } /* Still nothing. Give up. */ return -1; } /* SelectNearestTab -- * Handles the case where the current tab is forgotten, hidden, * or destroyed. * * Unmap the current tab and schedule the next available one * to be mapped at the next GM update. */ static void SelectNearestTab(Notebook *nb) { Tcl_Size currentIndex = nb->notebook.currentIndex; Tcl_Size nextIndex = NextTab(nb, currentIndex); if (currentIndex >= 0) { Ttk_UnmapContent(nb->notebook.mgr, currentIndex); } if (currentIndex != nextIndex) { Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL); } nb->notebook.currentIndex = nextIndex; Ttk_ManagerLayoutChanged(nb->notebook.mgr); TtkRedisplayWidget(&nb->core); } /* TabRemoved -- GM TabRemoved hook. * Select the next tab if the current one is being removed. * Adjust currentIndex to account for removed content window. */ static void TabRemoved(void *managerData, Tcl_Size index) { Notebook *nb = (Notebook *)managerData; Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); } if (index < nb->notebook.currentIndex) { --nb->notebook.currentIndex; } DestroyTab(nb, tab); TtkRedisplayWidget(&nb->core); } static int TabRequest( TCL_UNUSED(void *), /* managerData */ TCL_UNUSED(Tcl_Size), /* index */ TCL_UNUSED(int), /* width */ TCL_UNUSED(int)) /* height */ { return 1; } /* AddTab -- * Add new tab at specified index. */ static int AddTab( Tcl_Interp *interp, Notebook *nb, Tcl_Size destIndex, Tk_Window window, Tcl_Size objc, Tcl_Obj *const objv[]) { Tab *tab; if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) { return TCL_ERROR; } #if 0 /* can't happen */ if (Ttk_ContentIndex(nb->notebook.mgr, window) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); return TCL_ERROR; } #endif |
︙ | ︙ | |||
754 755 756 757 758 759 760 | return TCL_ERROR; } Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab); /* Adjust indices and/or autoselect first tab: */ | | | | | | | 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 | return TCL_ERROR; } Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab); /* Adjust indices and/or autoselect first tab: */ if (nb->notebook.currentIndex < 0) { SelectTab(nb, destIndex); } else if (nb->notebook.currentIndex >= destIndex) { ++nb->notebook.currentIndex; } return TCL_OK; } static const Ttk_ManagerSpec NotebookManagerSpec = { { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc }, NotebookSize, NotebookPlaceContents, TabRequest, TabRemoved }; /*------------------------------------------------------------------------ * +++ Event handlers. */ /* NotebookEventHandler -- * Tracks the active tab. */ static const int NotebookEventMask = StructureNotifyMask | PointerMotionMask | LeaveWindowMask ; static void NotebookEventHandler(void *clientData, XEvent *eventPtr) { Notebook *nb = (Notebook *)clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, NotebookEventMask, NotebookEventHandler, clientData); } else if (eventPtr->type == MotionNotify) { Tcl_Size index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y); ActivateTab(nb, index); } else if (eventPtr->type == LeaveNotify) { ActivateTab(nb, -1); } } /*------------------------------------------------------------------------ |
︙ | ︙ | |||
819 820 821 822 823 824 825 | * * Returns TCL_ERROR and leaves an error message in interp->result * if the tab identifier was incorrect. * * See also: GetTabIndex. */ static int FindTabIndex( | | | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | * * Returns TCL_ERROR and leaves an error message in interp->result * if the tab identifier was incorrect. * * See also: GetTabIndex. */ static int FindTabIndex( Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, Tcl_Size *index_rtn) { const char *string = Tcl_GetString(objPtr); int x, y; *index_rtn = TCL_INDEX_NONE; /* Check for @x,y ... |
︙ | ︙ | |||
865 866 867 868 869 870 871 | /* GetTabIndex -- * Get the index of an existing tab. * Tab identifiers are as per FindTabIndex. * Returns TCL_ERROR if the tab does not exist. */ static int GetTabIndex( | | | | | | | 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 | /* GetTabIndex -- * Get the index of an existing tab. * Tab identifiers are as per FindTabIndex. * Returns TCL_ERROR if the tab does not exist. */ static int GetTabIndex( Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, Tcl_Size *index_rtn) { int status = FindTabIndex(interp, nb, objPtr, index_rtn); if (status == TCL_OK && *index_rtn >= Ttk_NumberContent(nb->notebook.mgr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "tab index %s out of bounds", Tcl_GetString(objPtr))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL); return TCL_ERROR; } if (status == TCL_OK && *index_rtn < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "tab '%s' not found", Tcl_GetString(objPtr))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "TAB", NULL); status = TCL_ERROR; } return status; } /*------------------------------------------------------------------------ * +++ Widget command routines. */ /* $nb add window ?options ... ? */ static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tk_Window window; Tcl_Size index; Tab *tab; if (objc <= 2 || objc % 2 != 1) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
930 931 932 933 934 935 936 | return TCL_OK; } /* $nb insert $index $tab ?-option value ...? * Insert new tab, or move existing one. */ static int NotebookInsertCommand( | | | | | | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 | return TCL_OK; } /* $nb insert $index $tab ?-option value ...? * Insert new tab, or move existing one. */ static int NotebookInsertCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tcl_Size current = nb->notebook.currentIndex; Tcl_Size nContent = Ttk_NumberContent(nb->notebook.mgr); Tcl_Size srcIndex, destIndex; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?"); return TCL_ERROR; } if (TCL_OK != Ttk_GetContentIndexFromObj( |
︙ | ︙ | |||
958 959 960 961 962 963 964 | Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin); if (!window) { return TCL_ERROR; } srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window); | | | | | | | | | | < | | | > | | | | | > | | | | > | | | | | | | | 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 | Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin); if (!window) { return TCL_ERROR; } srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window); if (srcIndex < 0) { /* New content window */ return AddTab(interp, nb, destIndex, window, objc-4,objv+4); } } else if (Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) { return TCL_ERROR; } else if (srcIndex >= Ttk_NumberContent(nb->notebook.mgr)) { srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1; } /* Move existing content window: */ if (ConfigureTab(interp, nb, (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex), Ttk_ContentWindow(nb->notebook.mgr, srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; } if (destIndex >= nContent) { destIndex = nContent - 1; } Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex); /* Adjust internal indexes: */ nb->notebook.activeIndex = TCL_INDEX_NONE; if (current == srcIndex) { nb->notebook.currentIndex = destIndex; } else if (destIndex <= current && current < srcIndex) { ++nb->notebook.currentIndex; } else if (srcIndex < current && current <= destIndex) { --nb->notebook.currentIndex; } TtkRedisplayWidget(&nb->core); return TCL_OK; } /* $nb forget $tab -- * Removes the specified tab. */ static int NotebookForgetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tcl_Size index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) { return TCL_ERROR; } Ttk_ForgetContent(nb->notebook.mgr, index); TtkRedisplayWidget(&nb->core); return TCL_OK; } /* $nb hide $tab -- * Hides the specified tab. */ static int NotebookHideCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tcl_Size index; Tab *tab; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); return TCL_ERROR; } if (GetTabIndex(interp, nb, objv[2], &index) != TCL_OK) { 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( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { static const char *const whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; Notebook *nb = (Notebook *)recordPtr; Ttk_Element element = NULL; int x, y; Tcl_Size tabIndex; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2,objv, "?what? x y"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) ) { return TCL_ERROR; } tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; Ttk_RebindSublayout(tabLayout, tab); Ttk_PlaceLayout(tabLayout, state, tab->parcel); element = Ttk_IdentifyElement(tabLayout, x, y); } switch (what) { case IDENTIFY_ELEMENT: if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); } break; case IDENTIFY_TAB: if (tabIndex >= 0) { Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); } break; } return TCL_OK; } /* $nb index $item -- * Returns the integer index of the tab specified by $item, * the empty string if $item does not identify a tab. * See above for valid item formats. */ static int NotebookIndexCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Tcl_Size index; int status; 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 >= 0) { Tcl_SetObjResult(interp, TkNewIndexObj(index)); } } return status; } /* $nb select ?$item? -- * Select the specified tab, or return the widget path of * the currently-selected pane. */ static int NotebookSelectCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { Tk_Window pane = Ttk_ContentWindow( nb->notebook.mgr, nb->notebook.currentIndex); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1)); } return TCL_OK; } else if (objc == 3) { Tcl_Size index; int status = GetTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { SelectTab(nb, index); } return status; } /*else*/ Tcl_WrongNumArgs(interp, 2, objv, "?tab?"); return TCL_ERROR; } /* $nb tabs -- * Return list of tabs. */ static int NotebookTabsCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; Tcl_Size i; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } result = Tcl_NewListObj(0, NULL); for (i = 0; i < Ttk_NumberContent(mgr); ++i) { const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i)); Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(pathName,-1)); } Tcl_SetObjResult(interp, result); return TCL_OK; } /* $nb tab $tab ?-option ?value -option value...?? */ static int NotebookTabCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Size index; Tk_Window window; Tab *tab; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab ?-option ?value??..."); return TCL_ERROR; } |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | return TCL_OK; } /* Subcommand table: */ static const Ttk_Ensemble NotebookCommands[] = { { "add", NotebookAddCommand,0 }, | < > > | 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 | 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. |
︙ | ︙ | |||
1353 1354 1355 1356 1357 1358 1359 | Ttk_DrawLayout(tabLayout, state, d); } } static void NotebookDisplay(void *clientData, Drawable d) { Notebook *nb = (Notebook *)clientData; | | | | | 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 | Ttk_DrawLayout(tabLayout, state, d); } } static void NotebookDisplay(void *clientData, Drawable d) { Notebook *nb = (Notebook *)clientData; Tcl_Size nContent = Ttk_NumberContent(nb->notebook.mgr); Tcl_Size index; /* Draw notebook background (base layout): */ Ttk_DrawLayout(nb->core.layout, nb->core.state, d); /* Draw tabs from left to right, but draw the current tab last * so it will overwrite its neighbors. */ for (index = 0; index < nContent; ++index) { if (index != nb->notebook.currentIndex) { DisplayTab(nb, index, d); } } if (nb->notebook.currentIndex >= 0) { DisplayTab(nb, nb->notebook.currentIndex, d); } } /*------------------------------------------------------------------------ * +++ Widget specification and layout definitions. */ |
︙ | ︙ | |||
1408 1409 1410 1411 1412 1413 1414 | TTK_NODE("Notebook.label", TTK_PACK_TOP)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ | | | | 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 | TTK_NODE("Notebook.label", TTK_PACK_TOP)))) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ MODULE_SCOPE void TtkNotebook_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(themePtr, "Tab", TabLayout); Ttk_RegisterLayout(themePtr, "TNotebook", NotebookLayout); RegisterWidget(interp, "ttk::notebook", &NotebookWidgetSpec); } /*EOF*/ |
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 }, |
︙ | ︙ | |||
137 138 139 140 141 142 143 | } /* ConfigurePane -- * Set pane options. */ static int ConfigurePane( Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window, | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | } /* ConfigurePane -- * Set pane options. */ static int ConfigurePane( Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window, Tcl_Size objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable, objc, objv, window, &savedOptions, &mask) != TCL_OK) |
︙ | ︙ | |||
202 203 204 205 206 207 208 | return pane->sashPos = pos; } /* ShoveDown -- * Same as ShoveUp, but going in the opposite direction * and stopping at the sentinel sash. */ | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | return pane->sashPos = pos; } /* ShoveDown -- * Same as ShoveUp, but going in the opposite direction * and stopping at the sentinel sash. */ static int ShoveDown(Paned *pw, Tcl_Size i, int pos) { Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberContent(pw->paned.mgr) - 1) { pos = pane->sashPos; /* Sentinel value == container window size */ } else { |
︙ | ︙ | |||
271 272 273 274 275 276 277 | * will leave the sashes in the same place, as long as available size * remains contant. */ static void AdjustPanes(Paned *pw) { int sashThickness = pw->paned.sashThickness; int pos = 0; | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | * will leave the sashes in the same place, as long as available size * remains contant. */ static void AdjustPanes(Paned *pw) { int sashThickness = pw->paned.sashThickness; int pos = 0; Tcl_Size index; for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; } |
︙ | ︙ | |||
368 369 370 371 372 373 374 | */ static void PlacePanes(Paned *pw) { int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin); int sashThickness = pw->paned.sashThickness; int pos = 0; | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | */ static void PlacePanes(Paned *pw) { int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; int width = Tk_Width(pw->core.tkwin), height = Tk_Height(pw->core.tkwin); int sashThickness = pw->paned.sashThickness; int pos = 0; Tcl_Size index; for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { if (horizontal) { |
︙ | ︙ | |||
399 400 401 402 403 404 405 | static void PanedPlaceContent(void *managerData) { Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } | | | | | 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 | static void PanedPlaceContent(void *managerData) { Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, Tcl_Size index) { Paned *pw = (Paned *)managerData; Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); DestroyPane(pw, pane); } static int AddPane( Tcl_Interp *interp, Paned *pw, int destIndex, Tk_Window window, Tcl_Size objc, Tcl_Obj *const objv[]) { Pane *pane; if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) { return TCL_ERROR; } if (Ttk_ContentIndex(pw->paned.mgr, window) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s already added", Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL); return TCL_ERROR; } pane = CreatePane(interp, pw, window); |
︙ | ︙ | |||
441 442 443 444 445 446 447 | /* PaneRequest -- * Only update pane request size if pane is currently unmapped. * Geometry requests from mapped panes are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). */ | | | < < < < < < > > > > > > > > | | 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 | /* PaneRequest -- * Only update pane request size if pane is currently unmapped. * Geometry requests from mapped panes are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). */ static int PaneRequest(void *managerData, Tcl_Size index, int width, int height) { Paned *pw = (Paned *)managerData; Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; if (!Tk_IsMapped(window)) { pane->reqSize = horizontal ? width : height; } return 1; } static const Ttk_ManagerSpec PanedManagerSpec = { { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc }, PanedSize, PanedPlaceContent, PaneRequest, PaneRemoved }; /*------------------------------------------------------------------------ * +++ Event handler. * * This event handler generates an <<EnteredChild>> virtual event * on LeaveNotify/NotifyInferior. * This was originally introduced because Tk used to discard events with * detail field NotifyInferior. The <<EnteredChild>> event was then used * to reset the cursor when the pointer crosses from a parent to a child. * Since ticket #47d4f29159, LeaveNotify/NotifyInferior are no longer * discarded: the <Leave> event will trigger even with NotifyInferior * detail field. The generated <<EnteredChild>> is nevertheless kept for * backwards compatibility purpose since it is publicly documented, * meaning that someone could bind to it. */ static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(void *clientData, XEvent *eventPtr) { WidgetCore *corePtr = (WidgetCore *)clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { Tk_SendVirtualEvent(corePtr->tkwin, "EnteredChild", NULL); } |
︙ | ︙ | |||
602 603 604 605 606 607 608 | { Ttk_DrawLayout(SashLayout(pw, index), pw->core.state, d); } static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = (Paned *)recordPtr; | | | | 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 | { Ttk_DrawLayout(SashLayout(pw, index), pw->core.state, d); } static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = (Paned *)recordPtr; Tcl_Size i, nContent = Ttk_NumberContent(pw->paned.mgr); TtkWidgetDisplay(recordPtr, d); for (i = 1; i < nContent; ++i) { DrawSash(pw, i - 1, d); } } /*------------------------------------------------------------------------ * +++ Widget commands. */ /* $pw add window [ options ... ] */ static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Tk_Window window; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; |
︙ | ︙ | |||
642 643 644 645 646 647 648 | objc - 3, objv + 3); } /* $pw insert $index $window ?-option value ...? * Insert new content window, or move existing one. */ static int PanedInsertCommand( | | | | | | | | | | | | | | < | 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 | objc - 3, objv + 3); } /* $pw insert $index $window ?-option value ...? * Insert new content window, or move existing one. */ static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Tcl_Size nContent = Ttk_NumberContent(pw->paned.mgr); Tcl_Size srcIndex, destIndex; Tk_Window window; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?"); return TCL_ERROR; } window = Tk_NameToWindow( interp, Tcl_GetString(objv[3]), pw->core.tkwin); if (!window) { return TCL_ERROR; } if (TCL_OK != Ttk_GetContentIndexFromObj( interp,pw->paned.mgr, objv[2], &destIndex)) { return TCL_ERROR; } srcIndex = Ttk_ContentIndex(pw->paned.mgr, window); if (srcIndex < 0) { /* New content: */ return AddPane(interp, pw, destIndex, window, objc-4, objv+4); } /* else -- move existing content: */ if (destIndex >= nContent) destIndex = nContent - 1; Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex); return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex), Ttk_ContentWindow(pw->paned.mgr, destIndex), objc-4, objv+4); } /* $pw forget $pane */ static int PanedForgetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Tcl_Size paneIndex; if (objc != 3) { Tcl_WrongNumArgs(interp, 2,objv, "pane"); return TCL_ERROR; } if (TCL_OK != Ttk_GetContentIndexFromObj( interp, pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } else if (paneIndex >= Ttk_NumberContent(pw->paned.mgr)) { paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1; } Ttk_ForgetContent(pw->paned.mgr, paneIndex); return TCL_OK; } /* $pw identify ?what? $x $y -- * Return index of sash at $x,$y */ static int PanedIdentifyCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { static const char *const whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; Paned *pw = (Paned *)recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; int x, y, pos; int index; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2,objv, "?what? x y"); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK)) { return TCL_ERROR; } pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { |
︙ | ︙ | |||
765 766 767 768 769 770 771 | return TCL_OK; /* nothing found - return empty string */ } /* $pw pane $pane ?-option ?value -option value ...?? * Query/modify pane options. */ static int PanedPaneCommand( | | | | | 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 | return TCL_OK; /* nothing found - return empty string */ } /* $pw pane $pane ?-option ?value -option value ...?? * Query/modify pane options. */ static int PanedPaneCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Tcl_Size paneIndex; Tk_Window window; Pane *pane; if (objc < 3) { Tcl_WrongNumArgs(interp, 2,objv, "pane ?-option value ...?"); return TCL_ERROR; } if (TCL_OK != Ttk_GetContentIndexFromObj( interp,pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } else if (paneIndex >= Ttk_NumberContent(pw->paned.mgr)) { paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1; } pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex); window = Ttk_ContentWindow(pw->paned.mgr, paneIndex); switch (objc) { |
︙ | ︙ | |||
804 805 806 807 808 809 810 | } } /* $pw panes -- * Return list of managed panes. */ static int PanedPanesCommand( | | | | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | } } /* $pw panes -- * Return list of managed panes. */ static int PanedPanesCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; Tcl_Size i; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } panes = Tcl_NewListObj(0, NULL); |
︙ | ︙ | |||
831 832 833 834 835 836 837 | } /* $pw sashpos $index ?$newpos? * Query or modify sash position. */ static int PanedSashposCommand( | | | | | | | < > > | 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 | } /* $pw sashpos $index ?$newpos? * Query or modify sash position. */ static int PanedSashposCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; Tcl_WideInt sashIndex, position = -1; Pane *pane; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2,objv, "index ?newpos?"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) { return TCL_ERROR; } if (sashIndex < 0 || sashIndex >= Ttk_NumberContent(pw->paned.mgr) - 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "sash index %" TCL_LL_MODIFIER "d out of range", sashIndex)); Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL); return TCL_ERROR; } pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos)); return TCL_OK; } /* else -- set new sash position */ if (Tcl_GetWideIntFromObj(interp, objv[3], &position) != TCL_OK) { return TCL_ERROR; } if (position < pane->sashPos) { ShoveUp(pw, sashIndex, position); } else { ShoveDown(pw, sashIndex, position); } AdjustPanes(pw); Ttk_ManagerLayoutChanged(pw->paned.mgr); 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. */ |
︙ | ︙ | |||
922 923 924 925 926 927 928 | static const int DEFAULT_SASH_THICKNESS = 5; typedef struct { Tcl_Obj *thicknessObj; } SashElement; static const Ttk_ElementOptionSpec SashElementOptions[] = { | | | | | | 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 | static const int DEFAULT_SASH_THICKNESS = 5; typedef struct { Tcl_Obj *thicknessObj; } SashElement; static const Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_PIXELS, offsetof(SashElement,thicknessObj), "5" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; Tk_GetPixelsFromObj(NULL, tkwin, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } static const Ttk_ElementSpec SashElementSpec = { TK_STYLE_VERSION_2, sizeof(SashElement), SashElementOptions, |
︙ | ︙ | |||
965 966 967 968 969 970 971 | TTK_BEGIN_LAYOUT(VerticalSashLayout) TTK_NODE("Sash.vsash", TTK_FILL_Y) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Registration routine. */ | > | | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | TTK_BEGIN_LAYOUT(VerticalSashLayout) TTK_NODE("Sash.vsash", TTK_FILL_Y) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Registration routine. */ MODULE_SCOPE void TtkPanedwindow_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec); Ttk_RegisterElement(interp, themePtr, "hsash", &SashElementSpec, 0); Ttk_RegisterElement(interp, themePtr, "vsash", &SashElementSpec, 0); Ttk_RegisterLayout(themePtr, "TPanedwindow", PanedLayout); Ttk_RegisterLayout(themePtr, "Horizontal.Sash", HorizontalSashLayout); Ttk_RegisterLayout(themePtr, "Vertical.Sash", VerticalSashLayout); } |
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 82 83 84 | {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.0", 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, 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", "", offsetof(Progressbar,progress.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-value", "value", "Value", |
︙ | ︙ | |||
116 117 118 119 120 121 122 | } /* AnimateProgressProc -- * Timer callback for progress bar animation. * Increments the -phase option, redisplays the widget, * and reschedules itself if animation still enabled. */ | | < > | | > > < | 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 | } /* AnimateProgressProc -- * Timer callback for progress bar animation. * Increments the -phase option, redisplays the widget, * and reschedules itself if animation still enabled. */ static void AnimateProgressProc(void *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. |
︙ | ︙ | |||
298 299 300 301 302 303 304 | Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; TtkWidgetSize(recordPtr, widthPtr, heightPtr); /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; TtkWidgetSize(recordPtr, widthPtr, heightPtr); /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = length; } else { *heightPtr = length; } |
︙ | ︙ | |||
371 372 373 374 375 376 377 | Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); /* Adjust the bar size: */ Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); | | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); /* Adjust the bar size: */ Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (pbar) { double fraction = value / maximum; Ttk_Box parcel = Ttk_ClientRegion(corePtr->layout, "trough"); if (pb->progress.mode == TTK_PROGRESSBAR_DETERMINATE) { ProgressbarDeterminateLayout( |
︙ | ︙ | |||
418 419 420 421 422 423 424 | /*------------------------------------------------------------------------ * +++ Widget commands: */ /* $sb step ?amount? */ static int ProgressbarStepCommand( | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | /*------------------------------------------------------------------------ * +++ Widget commands: */ /* $sb step ?amount? */ static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Progressbar *pb = (Progressbar *)recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; if (objc == 3) { if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) { |
︙ | ︙ | |||
474 475 476 477 478 479 480 | } /* $sb start|stop ?args? -- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( | | | | | < > > | 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 | } /* $sb start|stop ?args? -- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( Tcl_Interp *interp, const char *cmdName, Tcl_Size objc, Tcl_Obj *const objv[]) { Tcl_Obj *cmd = Tcl_NewListObj(objc, objv); Tcl_Obj *prefix[2]; int status; /* ASSERT: objc >= 2 */ prefix[0] = Tcl_NewStringObj(cmdName, -1); prefix[1] = objv[0]; Tcl_ListObjReplace(interp, cmd, 0, 2, 2,prefix); Tcl_IncrRefCount(cmd); status = Tcl_EvalObjEx(interp, cmd, 0); Tcl_DecrRefCount(cmd); return status; } static int ProgressbarStartCommand( TCL_UNUSED(void *), Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::start", objc, objv); } static int ProgressbarStopCommand( TCL_UNUSED(void *), Tcl_Interp *interp, Tcl_Size objc, 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 = |
︙ | ︙ | |||
555 556 557 558 559 560 561 | TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout) TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y) | | | | | 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 | TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout) TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y) TTK_NODE("Horizontal.Progressbar.ctext", TTK_PACK_LEFT)) TTK_END_LAYOUT /* * Initialization: */ MODULE_SCOPE void TtkProgressbar_Init(Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(themePtr, "Vertical.TProgressbar", VerticalProgressbarLayout); Ttk_RegisterLayout(themePtr, "Horizontal.TProgressbar", HorizontalProgressbarLayout); RegisterWidget(interp, "ttk::progressbar", &ProgressbarWidgetSpec); } /*EOF*/ |
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 72 73 74 75 76 77 | 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.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.0", offsetof(Scale,scale.valueObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, offsetof(Scale,scale.lengthObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-state", "state", "State", "normal", offsetof(Scale,scale.stateObj), TCL_INDEX_NONE, |
︙ | ︙ | |||
258 259 260 261 262 263 264 | /* $scale get ?x y? -- * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int ScaleGetCommand( | | < < < < | > > > | | 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 | /* $scale get ?x y? -- * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int ScaleGetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scale *scalePtr = (Scale *)recordPtr; int x, y, r = TCL_OK; double value = 0; if (objc == 2) { Tcl_SetObjResult(interp, scalePtr->scale.valueObj); } else if (objc == 4) { r = Tcl_GetIntFromObj(interp, objv[2], &x); if (r == TCL_OK) r = Tcl_GetIntFromObj(interp, objv[3], &y); if (r == TCL_OK) { value = PointToValue(scalePtr, x, y); Tcl_SetObjResult(interp, Tcl_NewDoubleObj(value)); } } else { Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?"); return TCL_ERROR; } return r; } /* $scale set $newValue */ static int ScaleSetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scale *scalePtr = (Scale *)recordPtr; double from = 0.0, to = 1.0, value; int result = TCL_OK; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "set value"); |
︙ | ︙ | |||
354 355 356 357 358 359 360 | } return result; } static int ScaleCoordsCommand( | | | > > > > < < < < < < | 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 | } return result; } static int ScaleCoordsCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scale *scalePtr = (Scale *)recordPtr; double value; int r = TCL_OK; if (objc == 3) { r = Tcl_GetDoubleFromObj(interp, objv[2], &value); } else if (objc == 2) { r = Tcl_GetDoubleFromObj(interp, scalePtr->scale.valueObj, &value); } else { Tcl_WrongNumArgs(interp, 1, objv, "coords ?value?"); return TCL_ERROR; } if (r == TCL_OK) { Tcl_Obj *point[2]; XPoint pt = ValueToPoint(scalePtr, value); point[0] = Tcl_NewWideIntObj(pt.x); point[1] = Tcl_NewWideIntObj(pt.y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, point)); } |
︙ | ︙ | |||
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 }, | > > | | < | | | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | 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 */ |
︙ | ︙ | |||
519 520 521 522 523 524 525 | TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ) TTK_END_LAYOUT /* * Initialization. */ | > | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ) TTK_END_LAYOUT /* * Initialization. */ MODULE_SCOPE void TtkScale_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "Vertical.TScale", VerticalScaleLayout); Ttk_RegisterLayout(theme, "Horizontal.TScale", HorizontalScaleLayout); RegisterWidget(interp, "ttk::scale", &ScaleWidgetSpec); } |
Changes to generic/ttk/ttkScroll.c.
︙ | ︙ | |||
86 87 88 89 90 91 92 | return TCL_OK; } arg1[0] = arg2[0] = ' '; Tcl_PrintDouble(interp, (double)s->first / s->total, arg1+1); Tcl_PrintDouble(interp, (double)s->last / s->total, arg2+1); Tcl_DStringInit(&buf); | | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | return TCL_OK; } arg1[0] = arg2[0] = ' '; Tcl_PrintDouble(interp, (double)s->first / s->total, arg1+1); Tcl_PrintDouble(interp, (double)s->last / s->total, arg2+1); Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, s->scrollCmd, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, arg1, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, arg2, TCL_INDEX_NONE); Tcl_Preserve(corePtr); code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (WidgetDestroyed(corePtr)) { Tcl_Release(corePtr); return TCL_ERROR; |
︙ | ︙ | |||
119 120 121 122 123 124 125 | } return code; } /* UpdateScrollbarBG -- * Idle handler to update the scrollbar. */ | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | } return code; } /* UpdateScrollbarBG -- * Idle handler to update the scrollbar. */ static void UpdateScrollbarBG(void *clientData) { ScrollHandle h = (ScrollHandle)clientData; Tcl_Interp *interp = h->corePtr->interp; int code; h->flags &= ~SCROLL_UPDATE_PENDING; Tcl_Preserve(interp); |
︙ | ︙ | |||
202 203 204 205 206 207 208 | * * $w [xy]view -- return current view region * $w [xy]view $index -- set topmost item * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | * * $w [xy]view -- return current view region * $w [xy]view $index -- set topmost item * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; int newFirst; TtkUpdateScrollInfo(h); newFirst = s->first; |
︙ | ︙ | |||
225 226 227 228 229 230 231 | return TCL_ERROR; } } else { double fraction; int count; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { | < < > > | 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 | return TCL_ERROR; } } else { double fraction; int count; switch (Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count)) { case TK_SCROLL_MOVETO: newFirst = (int) ((fraction * s->total) + 0.5); break; case TK_SCROLL_UNITS: newFirst = s->first + count; break; case TK_SCROLL_PAGES: { int perPage = s->last - s->first; /* @@@ */ newFirst = s->first + count * perPage; break; } default: return TCL_ERROR; } } TtkScrollTo(h, newFirst, 0); return TCL_OK; } |
︙ | ︙ |
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. |
︙ | ︙ | |||
129 130 131 132 133 134 135 | */ /* $sb set $first $last -- * Set the position of the scrollbar. */ static int ScrollbarSetCommand( | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | */ /* $sb set $first $last -- * Set the position of the scrollbar. */ static int ScrollbarSetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *firstObj, *lastObj; double first, last; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "first last"); |
︙ | ︙ | |||
180 181 182 183 184 185 186 | } /* $sb get -- * Returns the last thing passed to 'set'. */ static int ScrollbarGetCommand( | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | } /* $sb get -- * Returns the last thing passed to 'set'. */ static int ScrollbarGetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *result[2]; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; |
︙ | ︙ | |||
203 204 205 206 207 208 209 | /* $sb delta $dx $dy -- * Returns the percentage change corresponding to a mouse movement * of $dx, $dy. */ static int ScrollbarDeltaCommand( | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /* $sb delta $dx $dy -- * Returns the percentage change corresponding to a mouse movement * of $dx, $dy. */ static int ScrollbarDeltaCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scrollbar *sb = (Scrollbar *)recordPtr; double dx, dy; double delta = 0.0; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "dx dy"); |
︙ | ︙ | |||
243 244 245 246 247 248 249 | /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( | | | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Scrollbar *sb = (Scrollbar *)recordPtr; Ttk_Box b = sb->scrollbar.troughBox; int minSize = sb->scrollbar.minSize; double x, y; double fraction = 0.0; |
︙ | ︙ | |||
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 = |
︙ | ︙ | |||
327 328 329 330 331 332 333 | TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ | | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ * +++ Initialization. */ MODULE_SCOPE void TtkScrollbar_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme,"Vertical.TScrollbar",VerticalScrollbarLayout); Ttk_RegisterLayout(theme,"Horizontal.TScrollbar",HorizontalScrollbarLayout); RegisterWidget(interp, "ttk::scrollbar", &ScrollbarWidgetSpec); } /*EOF*/ |
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 */ |
︙ | ︙ | |||
116 117 118 119 120 121 122 | TTK_BEGIN_LAYOUT(SizegripLayout) TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E) TTK_END_LAYOUT /* +++ Initialization: */ | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | TTK_BEGIN_LAYOUT(SizegripLayout) TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E) TTK_END_LAYOUT /* +++ Initialization: */ MODULE_SCOPE void TtkSeparator_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); Ttk_RegisterLayout(theme, "TSeparator", SeparatorLayout); Ttk_RegisterLayout(theme, "TSizegrip", SizegripLayout); RegisterWidget(interp, "ttk::separator", &SeparatorWidgetSpec); RegisterWidget(interp, "ttk::sizegrip", &SizegripWidgetSpec); } /*EOF*/ |
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). |
︙ | ︙ | |||
194 195 196 197 198 199 200 | /* * The element geometry function is called when the layout code wishes to * find out how big this element wants to be. We must return our preferred * size and padding information */ static void SquareElementSize( | | | | | | | 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 | /* * The element geometry function is called when the layout code wishes to * find out how big this element wants to be. We must return our preferred * size and padding information */ static void SquareElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SquareElement *square = (SquareElement *)elementRecord; int borderWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, square->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, square->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, square->heightObj, heightPtr); } /* * Draw the element in the box provided. */ static void SquareElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { SquareElement *square = (SquareElement *)elementRecord; Tk_3DBorder foreground = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj); Tk_GetPixelsFromObj(NULL, tkwin, square->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, square->reliefObj, &relief); Tk_Fill3DRectangle(tkwin, d, foreground, b.x, b.y, b.width, b.height, borderWidth, relief); } static const Ttk_ElementSpec SquareElementSpec = |
︙ | ︙ |
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" /* |
︙ | ︙ | |||
46 47 48 49 50 51 52 | static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *obj); /* static void StateSpecFreeIntRep(Tcl_Obj *); */ #define StateSpecFreeIntRep 0 /* not needed */ static void StateSpecDupIntRep(Tcl_Obj *, Tcl_Obj *); static void StateSpecUpdateString(Tcl_Obj *); | | | | | > > | | < | 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 | static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *obj); /* static void StateSpecFreeIntRep(Tcl_Obj *); */ #define StateSpecFreeIntRep 0 /* not needed */ static void StateSpecDupIntRep(Tcl_Obj *, Tcl_Obj *); static void StateSpecUpdateString(Tcl_Obj *); static const TkObjType StateSpecObjType = { {"StateSpec", StateSpecFreeIntRep, StateSpecDupIntRep, StateSpecUpdateString, StateSpecSetFromAny, TCL_OBJTYPE_V0}, 0 }; static void StateSpecDupIntRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) { copyPtr->internalRep.longValue = srcPtr->internalRep.longValue; copyPtr->typePtr = &StateSpecObjType.objType; } static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { int status; Tcl_Size i, objc; Tcl_Obj **objv; unsigned int onbits = 0, offbits = 0; status = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv); if (status != TCL_OK) return status; for (i = 0; i < objc; ++i) { |
︙ | ︙ | |||
112 113 114 115 116 117 118 | /* Invalidate old intrep: */ if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) { objPtr->typePtr->freeIntRepProc(objPtr); } | | | | 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 | /* Invalidate old intrep: */ if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) { objPtr->typePtr->freeIntRepProc(objPtr); } objPtr->typePtr = &StateSpecObjType.objType; objPtr->internalRep.longValue = (onbits << 16) | offbits; return TCL_OK; } static void StateSpecUpdateString(Tcl_Obj *objPtr) { unsigned int onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16; unsigned int offbits = objPtr->internalRep.longValue & 0x0000FFFF; unsigned int mask = onbits | offbits; Tcl_DString result; int i; int len; Tcl_DStringInit(&result); for (i=0; stateNames[i] != NULL; ++i) { if (mask & (1<<i)) { if (offbits & (1<<i)) Tcl_DStringAppend(&result, "!", 1); Tcl_DStringAppend(&result, stateNames[i], TCL_INDEX_NONE); Tcl_DStringAppend(&result, " ", 1); } } len = Tcl_DStringLength(&result); if (len) { /* 'len' includes extra trailing ' ' */ |
︙ | ︙ | |||
160 161 162 163 164 165 166 | } Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits, unsigned int offbits) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_InvalidateStringRep(objPtr); | | | | 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 | } Tcl_Obj *Ttk_NewStateSpecObj(unsigned int onbits, unsigned int offbits) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_InvalidateStringRep(objPtr); objPtr->typePtr = &StateSpecObjType.objType; objPtr->internalRep.longValue = (onbits << 16) | offbits; return objPtr; } int Ttk_GetStateSpecFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_StateSpec *spec) { if (objPtr->typePtr != &StateSpecObjType.objType) { int status = StateSpecSetFromAny(interp, objPtr); if (status != TCL_OK) return status; } spec->onbits = (objPtr->internalRep.longValue & 0xFFFF0000) >> 16; spec->offbits = objPtr->internalRep.longValue & 0x0000FFFF; |
︙ | ︙ | |||
196 197 198 199 200 201 202 | */ Tcl_Obj *Ttk_StateMapLookup( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Ttk_StateMap map, /* State map */ Ttk_State state) /* State to look up */ { Tcl_Obj **specs; | | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | */ Tcl_Obj *Ttk_StateMapLookup( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Ttk_StateMap map, /* State map */ Ttk_State state) /* State to look up */ { Tcl_Obj **specs; Tcl_Size j, nSpecs; int status; status = Tcl_ListObjGetElements(interp, map, &nSpecs, &specs); if (status != TCL_OK) return NULL; for (j = 0; j < nSpecs; j += 2) { Ttk_StateSpec spec; |
︙ | ︙ | |||
228 229 230 231 232 233 234 | * this basically just checks for errors. */ Ttk_StateMap Ttk_GetStateMapFromObj( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Tcl_Obj *mapObj) /* State map */ { Tcl_Obj **specs; | | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | * this basically just checks for errors. */ Ttk_StateMap Ttk_GetStateMapFromObj( Tcl_Interp *interp, /* Where to leave error messages; may be NULL */ Tcl_Obj *mapObj) /* State map */ { Tcl_Obj **specs; Tcl_Size j, nSpecs; int status; status = Tcl_ListObjGetElements(interp, mapObj, &nSpecs, &specs); if (status != TCL_OK) return NULL; if (nSpecs % 2 != 0) { if (interp) { |
︙ | ︙ | |||
257 258 259 260 261 262 263 | return mapObj; } /* * Ttk_StateTableLooup -- * Look up an index from a statically allocated state table. */ | | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | return mapObj; } /* * Ttk_StateTableLooup -- * Look up an index from a statically allocated state table. */ int Ttk_StateTableLookup(const Ttk_StateTable *map, Ttk_State state) { while ((state & map->onBits) != map->onBits || (~state & map->offBits) != map->offBits) { ++map; } return map->index; } /*EOF*/ |
Changes to generic/ttk/ttkStubInit.c.
1 2 3 4 5 6 7 8 9 10 | /* * This file is (mostly) automatically generated from ttk.decls. * It is compiled and linked in with the ttk package proper. */ #include "tkInt.h" #include "ttkTheme.h" MODULE_SCOPE const TtkStubs ttkStubs; | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * This file is (mostly) automatically generated from ttk.decls. * It is compiled and linked in with the ttk package proper. */ #include "tkInt.h" #include "ttkTheme.h" MODULE_SCOPE const TtkStubs ttkStubs; #ifdef __GNUC__ /* * The rest of this file shouldn't warn about deprecated functions; they're * there because we intend them to be so and know that this file is OK to * touch those fields. */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
︙ | ︙ |
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 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * Tag tables. 3/4-baked, work in progress. * * Copyright © 2005, Joe English. Freely redistributable. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Internal data structures. */ struct TtkTag { Tcl_Size priority; /* 1=>highest */ const char *tagName; /* Back-pointer to hash table entry */ void *tagRecord; /* User data */ }; struct TtkTagTable { Tk_Window tkwin; /* owner window */ const Tk_OptionSpec *optionSpecs; /* ... */ Tk_OptionTable optionTable; /* ... */ size_t recordSize; /* size of tag record */ Tcl_Size nTags; /* #tags defined so far */ Tcl_HashTable tags; /* defined tags */ }; /*------------------------------------------------------------------------ * +++ Tags. */ static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName) |
︙ | ︙ | |||
49 50 51 52 53 54 55 | /*------------------------------------------------------------------------ * +++ Tag tables. */ Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *interp, Tk_Window tkwin, | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | /*------------------------------------------------------------------------ * +++ Tag tables. */ Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *interp, Tk_Window tkwin, const Tk_OptionSpec *optionSpecs, size_t recordSize) { Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable)); tagTable->tkwin = tkwin; tagTable->optionSpecs = optionSpecs; tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs); tagTable->recordSize = recordSize; tagTable->nTags = 0; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | * Non-NULL results must be passed to Ttk_FreeTagSet(). */ Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr) { Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset)); Tcl_Obj **objv; | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | * Non-NULL results must be passed to Ttk_FreeTagSet(). */ Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr) { Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset)); Tcl_Obj **objv; Tcl_Size i, objc; if (objPtr == NULL) { tagset->tags = NULL; tagset->nTags = 0; return tagset; } 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; } /* Ttk_NewTagSetObj -- * Construct a fresh Tcl_Obj * from a tag set. */ Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet tagset) { Tcl_Obj *result = Tcl_NewListObj(0,0); Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { Tcl_ListObjAppendElement( NULL, result, Tcl_NewStringObj(tagset->tags[i]->tagName, -1)); } return result; } void Ttk_FreeTagSet(Ttk_TagSet tagset) { ckfree(tagset->tags); ckfree(tagset); } /* Ttk_TagSetContains -- test if tag set contains a tag. */ int Ttk_TagSetContains(Ttk_TagSet tagset, Ttk_Tag tag) { Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 1; } } return 0; } /* Ttk_TagSetAdd -- add a tag to a tag set. * * Returns: 0 if tagset already contained tag, * 1 if tagset was modified. */ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) { Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; } } 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) { Tcl_Size i, j, total, nTags = tagset->nTags; int result = 0, found; 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) { Tcl_Size i = 0, j = 0; while (i < tagset->nTags) { if ((tagset->tags[j] = tagset->tags[i]) != tag) { ++j; } ++i; } tagset->nTags = j; |
︙ | ︙ | |||
255 256 257 258 259 260 261 | /* Ttk_ConfigureTag -- implements [$w tag configure $tag -option value...] */ int Ttk_ConfigureTag( Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag, | | > > > > > > > > > > > > > | < < | | < < | 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 | /* Ttk_ConfigureTag -- implements [$w tag configure $tag -option value...] */ int Ttk_ConfigureTag( Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag, Tcl_Size objc, Tcl_Obj *const objv[]) { return Tk_SetOptions( interp, tag->tagRecord, tagTable->optionTable, objc, objv, tagTable->tkwin, NULL/*savedOptions*/, NULL/*mask*/); } /*------------------------------------------------------------------------ * +++ 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; Tcl_Size i, j; for (i = 0; tagTable->optionSpecs[i].type != TK_OPTION_END; ++i) { const Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i; Tcl_Size offset = optionSpec->objOffset; int prio = LOWEST_PRIORITY; for (j = 0; j < tagSet->nTags; ++j) { Ttk_Tag tag = tagSet->tags[j]; if (OBJ_AT(tag->tagRecord, offset) != 0 && tag->priority < prio) { OBJ_AT(record, offset) = OBJ_AT(tag->tagRecord, offset); prio = tag->priority; } } } } void Ttk_TagSetApplyStyle( Ttk_TagTable tagTable, Ttk_Style style, Ttk_State state, void *record) { const Tk_OptionSpec *optionSpec = tagTable->optionSpecs; while (optionSpec->type != TK_OPTION_END) { Tcl_Size 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) |
︙ | ︙ | |||
138 139 140 141 142 143 144 | const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable); if (!optionSpec) return 0; /* Make sure widget option has a Tcl_Obj* entry: */ | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable); if (!optionSpec) return 0; /* Make sure widget option has a Tcl_Obj* entry: */ if (optionSpec->objOffset < 0) { return 0; } /* Grrr. Ignore accidental mismatches caused by prefix-matching: */ if (strcmp(optionSpec->optionName, optionName)) { return 0; |
︙ | ︙ | |||
399 400 401 402 403 404 405 | Theme *defaultTheme; /* Default theme; global fallback*/ Theme *currentTheme; /* Currently-selected theme */ Cleanup *cleanupList; /* Cleanup records */ Ttk_ResourceCache cache; /* Resource cache */ int themeChangePending; /* scheduled ThemeChangedProc call? */ } StylePackageData; | < < | < < < < < < < | 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 | Theme *defaultTheme; /* Default theme; global fallback*/ Theme *currentTheme; /* Currently-selected theme */ Cleanup *cleanupList; /* Cleanup records */ Ttk_ResourceCache cache; /* Resource cache */ int themeChangePending; /* scheduled ThemeChangedProc call? */ } StylePackageData; /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ static void Ttk_StylePkgFree( void *clientData, TCL_UNUSED(Tcl_Interp *)) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; /* * Free themes. */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); |
︙ | ︙ | |||
480 481 482 483 484 485 486 | * Register a function to be called when a theme engine is deleted. * (This only happens when the main interp is destroyed). The cleanup * function is called with the current Tcl interpreter and the client * data provided here. * */ void Ttk_RegisterCleanup( | | | | > > > > > > > > > > > > > > > > > > > > > | 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 | * Register a function to be called when a theme engine is deleted. * (This only happens when the main interp is destroyed). The cleanup * function is called with the current Tcl interpreter and the client * data provided here. * */ void Ttk_RegisterCleanup( Tcl_Interp *interp, void *clientData, Ttk_CleanupProc *cleanupProc) { StylePackageData *pkgPtr = GetStylePackageData(interp); Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; cleanup->next = pkgPtr->cleanupList; pkgPtr->cleanupList = cleanup; } /* ThemeChangedProc -- * Notify all widgets that the theme has been changed. * Scheduled as an idle callback; clientData is a StylePackageData *. * * Sends a <<ThemeChanged>> event to every widget in the hierarchy. * Widgets respond to this by calling the WorldChanged class proc, * which in turn recreates the layout. * * The Tk C API doesn't doesn't provide an easy way to traverse * the widget hierarchy, so this is done by evaluating a Tcl script. */ static void ThemeChangedProc(void *clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; StylePackageData *pkgPtr = (StylePackageData *)clientData; int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(pkgPtr->interp, code); } pkgPtr->themeChangePending = 0; } /* * ThemeChanged -- * Schedule a call to ThemeChanged if one is not already pending. */ static void ThemeChanged(StylePackageData *pkgPtr) { TtkSetBlinkCursorTimes(pkgPtr->interp); if (!pkgPtr->themeChangePending) { Tcl_DoWhenIdle(ThemeChangedProc, pkgPtr); pkgPtr->themeChangePending = 1; } } /* Ttk_TkDestroyedHandler -- * See bug [310c74ecf440]: idle calls to ThemeChangedProc() * need to be canceled when Tk is destroyed, since the interp * may still be active afterward; canceling them from * Ttk_StylePkgFree() would be too late. */ void Ttk_TkDestroyedHandler( Tcl_Interp* interp) { StylePackageData* pkgPtr = GetStylePackageData(interp); /* * Cancel any pending ThemeChanged calls: */ if (pkgPtr->themeChangePending) { Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr); } } /* * Ttk_CreateTheme -- * Create a new theme and register it in the global theme table. * * Returns: * Pointer to new Theme structure; NULL if named theme already exists. |
︙ | ︙ | |||
665 666 667 668 669 670 671 | return pkgPtr->cache; } /* * Register a new layout specification with a style. * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout */ | | | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | return pkgPtr->cache; } /* * Register a new layout specification with a style. * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout */ MODULE_SCOPE void Ttk_RegisterLayoutTemplate( Ttk_Theme theme, /* Target theme */ const char *layoutName, /* Name of new layout */ Ttk_LayoutTemplate layoutTemplate) /* Template */ { Ttk_Style style = Ttk_GetStyle(theme, layoutName); if (style->layoutTemplate) { Ttk_FreeLayoutTemplate(style->layoutTemplate); |
︙ | ︙ | |||
825 826 827 828 829 830 831 | /* Ttk_CloneElement -- element factory procedure. * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, | | | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | /* Ttk_CloneElement -- element factory procedure. * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, Tcl_Size objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; Ttk_ElementClass *fromElement; if (objc <= 0 || objc > 2) { Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?"); return TCL_ERROR; |
︙ | ︙ | |||
1129 1130 1131 1132 1133 1134 1135 | * Helper routine. Sets interp's result to the list of all keys * in the hash table. * * Returns: TCL_OK. * Side effects: Sets interp's result. */ | | | | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | * Helper routine. Sets interp's result to the list of all keys * in the hash table. * * Returns: TCL_OK. * Side effects: Sets interp's result. */ MODULE_SCOPE int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) { Tcl_HashSearch search; Tcl_Obj *result = Tcl_NewListObj(0, NULL); Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); |
︙ | ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | /* + style map $style ? -resource statemap ... ? * * Note that resource names are unconstrained; the Style * doesn't know what resources individual elements may use. */ static int StyleMapCmd( | | | | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 | /* + style map $style ? -resource statemap ... ? * * Note that resource names are unconstrained; the Style * doesn't know what resources individual elements may use. */ static int StyleMapCmd( void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ Tcl_Size objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; |
︙ | ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | ThemeChanged(pkgPtr); return TCL_OK; } /* + style configure $style -option ?value... */ static int StyleConfigureCmd( | | | | | 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 | ThemeChanged(pkgPtr); return TCL_OK; } /* + style configure $style -option ?value... */ static int StyleConfigureCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; if (objc < 3) { usage: 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; |
︙ | ︙ | |||
1296 1297 1298 1299 1300 1301 1302 | ThemeChanged(pkgPtr); return TCL_OK; } /* + style lookup $style -option ?statespec? ?defaultValue? */ static int StyleLookupCmd( | | < < | | 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 | ThemeChanged(pkgPtr); return TCL_OK; } /* + style lookup $style -option ?statespec? ?defaultValue? */ static int StyleLookupCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; Ttk_State state = 0ul; Tcl_Obj *result; 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; |
︙ | ︙ | |||
1338 1339 1340 1341 1342 1343 1344 | Tcl_SetObjResult(interp, result); } return TCL_OK; } static int StyleThemeCurrentCmd( | | | 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | Tcl_SetObjResult(interp, result); } return TCL_OK; } static int StyleThemeCurrentCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj * const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr = NULL; const char *name = NULL; if (objc != 3) { |
︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 | Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1)); return TCL_OK; } /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( | | | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1)); return TCL_OK; } /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *const optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; Ttk_Theme parentTheme = pkgPtr->defaultTheme, newTheme; Tcl_Obj *settingsScript = NULL; |
︙ | ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | } } /* + style theme names -- * Return list of registered themes. */ static int StyleThemeNamesCmd( | | | | | | | 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 | } } /* + style theme names -- * Return list of registered themes. */ static int StyleThemeNamesCmd( void *clientData, Tcl_Interp *interp, TCL_UNUSED(Tcl_Size), /* objc */ TCL_UNUSED(Tcl_Obj *const *)) /* objv */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } /* + style theme settings $theme $script * * Temporarily sets the current theme to $themeName, * evaluates $script, then restores the old theme. */ static int StyleThemeSettingsCmd( void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ Tcl_Size objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; |
︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 | return status; } /* + style element create name type ? ...args ? */ static int StyleElementCreateCmd( | | | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 | return status; } /* + style element create name type ? ...args ? */ static int StyleElementCreateCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; FactoryRec *recPtr; |
︙ | ︙ | |||
1519 1520 1521 1522 1523 1524 1525 | theme, elementName, objc - 5, objv + 5); } /* + style element names -- * Return a list of elements defined in the current theme. */ static int StyleElementNamesCmd( | | | | 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 | theme, elementName, objc - 5, objv + 5); } /* + style element names -- * Return a list of elements defined in the current theme. */ static int StyleElementNamesCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } return TtkEnumerateHashTable(interp, &theme->elementTable); } /* + style element options $element -- * Return list of element options for specified element */ static int StyleElementOptionsCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; Ttk_ElementClass *elementClass; if (objc != 4) { |
︙ | ︙ | |||
1573 1574 1575 1576 1577 1578 1579 | Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "ELEMENT", elementName, NULL); return TCL_ERROR; } /* + style layout name ?spec? */ static int StyleLayoutCmd( | | | 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "ELEMENT", elementName, NULL); return TCL_ERROR; } /* + style layout name ?spec? */ static int StyleLayoutCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; if (objc < 3 || objc > 4) { |
︙ | ︙ | |||
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 | 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( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 | 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, Tcl_Size 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( void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ Tcl_Size objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 3, objv, "?theme?"); |
︙ | ︙ | |||
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 }, | > | 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 | * 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 }, |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | { "theme", 0, StyleThemeEnsemble }, { "element", 0, StyleElementEnsemble }, { NULL, 0, 0 } }; static int StyleObjCmd( | | | | | | | 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 | { "theme", 0, StyleThemeEnsemble }, { "element", 0, StyleElementEnsemble }, { NULL, 0, 0 } }; static int StyleObjCmd( void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { return Ttk_InvokeEnsemble(StyleEnsemble, 1, clientData,interp,objc,objv); } MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */ const Ttk_Ensemble *ensemble, Tcl_Size cmdIndex, void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { while (cmdIndex < objc) { int index; if (Tcl_GetIndexFromObjStruct(interp, objv[cmdIndex], ensemble, sizeof(ensemble[0]), "command", 0, &index) != TCL_OK) |
︙ | ︙ |
Changes to generic/ttk/ttkTheme.h.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003 Joe English. Freely redistributable. * * Declarations for Tk theme engine. */ #ifndef _TTKTHEME #define _TTKTHEME |
︙ | ︙ | |||
199 200 201 202 203 204 205 | enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 }; typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*); typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); | < < < < < < < < | | | < | < | 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 | enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 }; typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*); typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); typedef struct Ttk_ElementOptionSpec { const char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ Tcl_Size offset; /* Offset of Tcl_Obj* field in element record */ const char *defaultValue; /* Default value to used if resource missing */ } Ttk_ElementOptionSpec; #define TK_OPTION_ANY TK_OPTION_STRING typedef struct Ttk_ElementSpec { enum TTKStyleVersion2 version; /* Version of the style support. */ size_t elementSize; /* Size of element record */ const Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */ Ttk_ElementSizeProc *size; /* Compute min size and padding */ Ttk_ElementDrawProc *draw; /* Draw the element */ } Ttk_ElementSpec; typedef int (*Ttk_ElementFactory) (Tcl_Interp *, void *clientData, Ttk_Theme, const char *elementName, Tcl_Size objc, Tcl_Obj *const objv[]); /* * Null element implementation: * has no geometry or layout; may be used as a stub or placeholder. */ typedef struct { Tcl_Obj *unused; } NullElement; MODULE_SCOPE Ttk_ElementSizeProc TtkNullElementSize; MODULE_SCOPE Ttk_ElementDrawProc TtkNullElementDraw; MODULE_SCOPE const Ttk_ElementOptionSpec TtkNullElementOptions[]; MODULE_SCOPE Ttk_ElementSpec ttkNullElementSpec; /*------------------------------------------------------------------------ * +++ Layout templates. */ typedef struct { |
︙ | ︙ | |||
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); | > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | 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); |
︙ | ︙ | |||
336 337 338 339 340 341 342 | /*------------------------------------------------------------------------ * +++ Image specifications. */ typedef struct TtkImageSpec Ttk_ImageSpec; TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *); TTKAPI Ttk_ImageSpec *TtkGetImageSpecEx(Tcl_Interp *, Tk_Window, Tcl_Obj *, | | | < | > | 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 | /*------------------------------------------------------------------------ * +++ Image specifications. */ typedef struct TtkImageSpec Ttk_ImageSpec; TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *); TTKAPI Ttk_ImageSpec *TtkGetImageSpecEx(Tcl_Interp *, Tk_Window, Tcl_Obj *, Tk_ImageChangedProc *, void *); TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *); TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Tk_Window, Ttk_State); /*------------------------------------------------------------------------ * +++ 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 */ |
︙ | ︙ | |||
372 373 374 375 376 377 378 | TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Compound *); typedef enum { /* -orient option values */ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL } Ttk_Orient; | < < < | | | | 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 | TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Compound *); typedef enum { /* -orient option values */ TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL } Ttk_Orient; /*------------------------------------------------------------------------ * +++ Utilities. */ typedef struct TtkEnsemble { const char *name; /* subcommand name */ Tcl_ObjCmdProc2 *command; /* subcommand implementation, OR: */ const struct TtkEnsemble *ensemble; /* subcommand ensemble */ } Ttk_Ensemble; MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */ const Ttk_Ensemble *commands, Tcl_Size cmdIndex, void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TtkEnumerateHashTable(Tcl_Interp *, Tcl_HashTable *); /*------------------------------------------------------------------------ * +++ Stub table declarations. */ |
︙ | ︙ |
Changes to generic/ttk/ttkThemeInt.h.
1 2 3 | /* * Theme engine: private definitions. * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * Theme engine: private definitions. * * Copyright © 2004 Joe English. Freely redistributable. */ #ifndef _TTKTHEMEINT #define _TTKTHEMEINT #include "ttkTheme.h" |
︙ | ︙ | |||
35 36 37 38 39 40 41 42 | MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate( Ttk_Theme themePtr, const char *layoutName); MODULE_SCOPE const char *Ttk_StyleName(Ttk_Style); #endif /* _TTKTHEMEINT */ | > > > > > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate( Ttk_Theme themePtr, const char *layoutName); MODULE_SCOPE const char *Ttk_StyleName(Ttk_Style); MODULE_SCOPE void TtkSetBlinkCursorTimes(Tcl_Interp* interp); MODULE_SCOPE int TtkBoxEqual(Ttk_Box, Ttk_Box); #define TTK_OPTION_UNDERLINE_DEF(type, field) NULL, offsetof(type, field), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL #endif /* _TTKTHEMEINT */ |
Changes to generic/ttk/ttkTrace.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | }; /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | }; /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( void *clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ TCL_UNUSED(const char *), /* name1 */ TCL_UNUSED(const char *), /* name2 */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData; const char *name, *value; |
︙ | ︙ | |||
110 111 112 113 114 115 116 | /* * Ttk_UntraceVariable -- * Remove previously-registered trace and free the handle. */ void Ttk_UntraceVariable(Ttk_TraceHandle *h) { if (h) { | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /* * Ttk_UntraceVariable -- * Remove previously-registered trace and free the handle. */ void Ttk_UntraceVariable(Ttk_TraceHandle *h) { if (h) { void *cd = NULL; /* * Workaround for Tcl Bug 3062331. The trace design problem is * that when variable unset traces fire, Tcl documents that the * traced variable has already been unset. It's already gone. * So from within an unset trace, if you try to call * Tcl_UntraceVar() on that variable, it will do nothing, because |
︙ | ︙ |
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); |
︙ | ︙ | |||
112 113 114 115 116 117 118 | | PointerMotionMask | LeaveWindowMask | EnterWindowMask | StructureNotifyMask ; static void | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | | PointerMotionMask | LeaveWindowMask | EnterWindowMask | StructureNotifyMask ; static void ElementStateEventProc(void *clientData, XEvent *ev) { ElementStateTracker *es = (ElementStateTracker *)clientData; Ttk_Layout layout = es->corePtr->layout; Ttk_Element element; /* Guard against dangling pointers [#2431428] */ |
︙ | ︙ |
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 35 36 37 38 | /* * Copyright © 2004, Joe English * * ttk::treeview widget implementation. */ #include "tkInt.h" #include "ttkThemeInt.h" #include "ttkWidget.h" #ifdef _WIN32 #include "tkWinInt.h" #endif #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} }; | > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | 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 | */ 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; Tcl_Size 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) { Tcl_Size 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 */ | | > > > | > > > > > > | | | > > > > > > > > > > > | | > > | 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 | /*------------------------------------------------------------------------ * +++ 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 }, | > > > | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | 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 }, |
︙ | ︙ | |||
329 330 331 332 333 334 335 | static int GetEnumSetFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const table[], unsigned *resultPtr) { unsigned result = 0; | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | static int GetEnumSetFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const table[], unsigned *resultPtr) { unsigned result = 0; Tcl_Size i, objc; Tcl_Obj **objv; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) return TCL_ERROR; for (i = 0; i < objc; ++i) { int index; |
︙ | ︙ | |||
364 365 366 367 368 369 370 | */ typedef struct { /* Resources acquired at initialization-time: */ Tk_OptionTable itemOptionTable; Tk_OptionTable columnOptionTable; Tk_OptionTable headingOptionTable; | | > > | > > > > | < | | > > > | > | | | | > > > | > > > > > > > > > | | 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 | */ 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 (screen units) */ int indent; /* Horizontal offset for child items (screen units) */ /* Tree data: */ Tcl_HashTable items; /* Map: item name -> item */ int serial; /* Next item # for autogenerated names */ TreeItem *root; /* Root item */ TreeColumn column0; /* Column options for display column #0 */ TreeColumn *columns; /* Array of column options for data columns */ TreeItem *focus; /* Current focus item */ TreeItem *endPtr; /* See EndPosition() */ /* 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_Size nTitleColumns; /* -titlecolumns */ Tcl_Size 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 */ Tcl_Size nColumns; /* #columns */ Tcl_Size 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), TK_OPTION_VAR(Tcl_Size), 0, GEOMETRY_CHANGED}, {TK_OPTION_INT, "-titleitems", "titleitems", "Titleitems", DEF_TITLEITEMS, TCL_INDEX_NONE, offsetof(Treeview,tree.nTitleItems), TK_OPTION_VAR(Tcl_Size), 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) { | > > > > > > > > > > > > > > | 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 | 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; | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | 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 | 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; Tcl_Size 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 < 0 || 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) { Tcl_WideInt colno; if (sscanf(Tcl_GetString(columnIDObj), "#%" TCL_LL_MODIFIER "d", &colno) == 1) { /* Display column specification, #n */ if (colno >= 0 && colno < tv->tree.nDisplayColumns) { return tv->tree.displayColumns[colno]; } /* else */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Column %s out of range", Tcl_GetString(columnIDObj))); |
︙ | ︙ | |||
600 601 602 603 604 605 606 | */ static TreeItem **GetItemListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr) { TreeItem **items; Tcl_Obj **elements; | | | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | */ static TreeItem **GetItemListFromObj( Tcl_Interp *interp, Treeview *tv, Tcl_Obj *objPtr) { TreeItem **items; Tcl_Obj **elements; Tcl_Size 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) { | | | | 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 | */ /* + TreeviewFreeColumns -- * Free column data. */ static void TreeviewFreeColumns(Treeview *tv) { Tcl_Size 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); ckfree(tv->tree.columns); tv->tree.columns = 0; } } /* + TreeviewInitColumns -- * Initialize column data when -columns changes. * Returns: TCL_OK or TCL_ERROR; */ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **columns; Tcl_Size i, ncols; if (Tcl_ListObjGetElements( interp, tv->tree.columnsObj, &ncols, &columns) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
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( | | | | | 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 | 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; } /* + TreeviewInitDisplayColumns -- * Initializes the 'displayColumns' array. * * Note that displayColumns[0] is always the tree column, * even when SHOW_TREE is not set. * * @@@ TODO: disallow duplicated columns */ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **dcolumns; Tcl_Size index, ndcols; TreeColumn **displayColumns = 0; if (Tcl_ListObjGetElements(interp, tv->tree.displayColumnsObj, &ndcols, &dcolumns) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
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) { | | > > > > > > > | 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 | #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) { Tcl_Size i = FirstColumn(tv); int width = 0; tv->tree.titleWidth = 0; while (i < tv->tree.nDisplayColumns) { if (i == tv->tree.nTitleColumns) { tv->tree.titleWidth = width; } width += tv->tree.displayColumns[i++]->width; } if (tv->tree.nTitleColumns >= tv->tree.nDisplayColumns) { tv->tree.titleWidth = width; } return width; } /* + RecomputeSlack -- */ static void RecomputeSlack(Treeview *tv) |
︙ | ︙ | |||
823 824 825 826 827 828 829 | return n; } /* + ShoveLeft -- * Adjust width of (stretchable) columns to the left by N pixels. * Returns: leftover slack. */ | | | | | 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 | return n; } /* + ShoveLeft -- * Adjust width of (stretchable) columns to the left by N pixels. * Returns: leftover slack. */ static int ShoveLeft(Treeview *tv, Tcl_Size i, int n) { Tcl_Size first = FirstColumn(tv); while (n != 0 && i >= first) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, n); } --i; } return n; } /* + ShoveRight -- * Adjust width of (stretchable) columns to the right by N pixels. * Returns: leftover slack. */ static int ShoveRight(Treeview *tv, Tcl_Size i, int n) { while (n != 0 && i < tv->tree.nDisplayColumns) { TreeColumn *c = tv->tree.displayColumns[i]; if (c->stretch) { n -= Stretch(c, n); } ++i; |
︙ | ︙ | |||
863 864 865 866 867 868 869 | * 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; | > | | 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | * 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; Tcl_Size i; int d, r; for (i = FirstColumn(tv); i < tv->tree.nDisplayColumns; ++i) { if (tv->tree.displayColumns[i]->stretch) { ++m; } } if (m == 0) { |
︙ | ︙ | |||
905 906 907 908 909 910 911 | DistributeWidth(tv, PickupSlack(tv, delta)))); } /* + DragColumn -- * Move the separator to the right of specified column, * adjusting other column widths as necessary. */ | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | DistributeWidth(tv, PickupSlack(tv, delta)))); } /* + DragColumn -- * Move the separator to the right of specified column, * adjusting other column widths as necessary. */ static void DragColumn(Treeview *tv, Tcl_Size 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) { Tcl_Size 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) { Tcl_Size 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, Tcl_Size *nCells) { TreeCell *cells; TreeCell cell; Tcl_Obj **elements; Tcl_Obj *oneCell; Tcl_Size i, 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 < 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 Tcl_Size 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; Tcl_Size 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 >= 0) { 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); | | | > | > > > > > > > > > > | | | | 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 | 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) | > > | | 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | 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 1120 1121 1122 1123 1124 1125 | 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; } /* + ConfigureItem -- * Set item options. */ static int ConfigureItem( Tcl_Interp *interp, Treeview *tv, TreeItem *item, | > > > > > > > > > > > > > > > > > > | | > > > > > > > > > | 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 | 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( "\"#%" TCL_SIZE_MODIFIER "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( "\"%" TCL_SIZE_MODIFIER "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; } /* + ConfigureItem -- * Set item options. */ static int ConfigureItem( Tcl_Interp *interp, Treeview *tv, TreeItem *item, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; Ttk_ImageSpec *newImageSpec = NULL; Ttk_TagSet newTagSet = NULL; if (Tk_SetOptions(interp, item, tv->tree.itemOptionTable, objc, objv, tv->core.tkwin, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Make sure that -values is a valid list: */ if (item->valuesObj) { Tcl_Size 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 1200 1201 1202 1203 1204 1205 1206 1207 | 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); } return TCL_ERROR; } /* + ConfigureColumn -- * Set column options. */ static int ConfigureColumn( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, | > | | 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 | 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); } return TCL_ERROR; } /* + ConfigureColumn -- * Set column options. */ static int ConfigureColumn( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, column, tv->tree.columnOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) |
︙ | ︙ | |||
1247 1248 1249 1250 1251 1252 1253 | } /* + ConfigureHeading -- * Set heading options. */ static int ConfigureHeading( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, | | | 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | } /* + ConfigureHeading -- * Set heading options. */ static int ConfigureHeading( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, column, tv->tree.headingOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) |
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | return TCL_ERROR; } /*------------------------------------------------------------------------ * +++ Geometry routines. */ | | | > | > > > | | < < < | | | > | > > > > > > | < < < < < < < < < < | < < | | | | < < | | > > > | < | | > > > > > > > > > > > > | > > > > > > > > > > > | > > > > | | | > > > > < | < < | < < < < < < < < < | < < < | < < < < < < < < < < < < < | | | < | | < | < | < < < < < < | | > | > > | | < < < > | | > > > > | | | > > > > > > | 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 | 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 Tcl_Size IdentifyDisplayColumn(Treeview *tv, int x, int *x1) { Tcl_Size colno = FirstColumn(tv); int xpos = tv->tree.treeArea.x; if (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 (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; Tcl_Size 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 < 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) { | | > < | 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 | static const char *const regionStrings[] = { "nothing", "heading", "separator", "tree", "cell", 0 }; static TreeRegion IdentifyRegion(Treeview *tv, int x, int y) { int x1 = 0; Tcl_Size colno = IdentifyDisplayColumn(tv, x, &x1); if (Ttk_BoxContains(tv->tree.headingArea, x, y)) { if (colno < 0) { return REGION_NOTHING; } else if (-HALO <= x1 - x && x1 - x <= HALO) { return REGION_SEPARATOR; } else { return REGION_HEADING; |
︙ | ︙ | |||
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; | | > > | | | > > | | > > > > > > > > > > | > | > > | | > > > > > > > | > < | | | > | | | > | > > > > > > > > > | 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 | */ 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)Tk_GetPixelsFromObj(NULL, tv->core.tkwin, objPtr, &tv->tree.rowHeight); } tv->tree.rowHeight = MAX(tv->tree.rowHeight, 1); if ((objPtr = Ttk_QueryOption(treeLayout, "-columnseparatorwidth", 0))) { (void)Tk_GetPixelsFromObj(NULL, tv->core.tkwin, objPtr, &tv->tree.colSeparatorWidth); } /* Get item indent from style: */ tv->tree.indent = DEFAULT_INDENT; if ((objPtr = Ttk_QueryOption(treeLayout, "-indent", 0))) { (void)Tk_GetPixelsFromObj(NULL, tv->core.tkwin, 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; if (tv->tree.treeArea.height % tv->tree.rowHeight) { /* When the treeview height doesn't correspond to an exact number * of rows, the last row count must be incremented to draw a * partial row at the bottom. The total row count must also be * incremented to be able to scroll all the way to the bottom. */ last++; total++; } 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) { | | | > > > > > > | | > | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > | | < | | > | > > > > > > > > | > | | > > > > | > > > > > | > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > | > | > > > > > > > | > | | > > | < | | | < | < < < < < < < > | | > > > > > > | | > > > > > > > > > > > > > > | > > > > | > > > > > > > > > | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | | | | > | | | < < < < < | | | | < | > | 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 | } /* + 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; Tcl_Size i = FirstColumn(tv); int x = 0; if (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 < 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; Tcl_Size 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 >= 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) { Tcl_Size i, 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 < 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 < 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; Tcl_Size 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 >= tv->tree.nTitleColumns) break; if (!title && i < 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 (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 (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 -- |
︙ | ︙ | |||
1941 1942 1943 1944 1945 1946 1947 | * +++ Widget commands -- item inquiry. */ /* + $tv children $item ?newchildren? -- * Return the list of children associated with $item */ static int TreeviewChildrenCommand( | | | 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 | * +++ Widget commands -- item inquiry. */ /* + $tv children $item ?newchildren? -- * Return the list of children associated with $item */ static int TreeviewChildrenCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; Tcl_Obj *result; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "item ?newchildren?"); |
︙ | ︙ | |||
1972 1973 1974 1975 1976 1977 1978 | int i; if (!newChildren) return TCL_ERROR; /* Sanity-check: */ | | | | > | | 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 | 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 -- * Return the item ID of $item's parent. */ static int TreeviewParentCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; |
︙ | ︙ | |||
2049 2050 2051 2052 2053 2054 2055 | return TCL_OK; } /* + $tv next $item * Return the ID of $item's next sibling. */ static int TreeviewNextCommand( | | | 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 | return TCL_OK; } /* + $tv next $item * Return the ID of $item's next sibling. */ static int TreeviewNextCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; |
︙ | ︙ | |||
2074 2075 2076 2077 2078 2079 2080 | return TCL_OK; } /* + $tv prev $item * Return the ID of $item's previous sibling. */ static int TreeviewPrevCommand( | | | 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 | return TCL_OK; } /* + $tv prev $item * Return the ID of $item's previous sibling. */ static int TreeviewPrevCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; |
︙ | ︙ | |||
2099 2100 2101 2102 2103 2104 2105 | return TCL_OK; } /* + $tv index $item -- * Return the index of $item within its parent. */ static int TreeviewIndexCommand( | | | | 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 | return TCL_OK; } /* + $tv index $item -- * Return the index of $item within its parent. */ static int TreeviewIndexCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; Tcl_Size index = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } item = FindItem(interp, tv, objv[2]); if (!item) { |
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | return TCL_OK; } /* + $tv exists $itemid -- * Test if the specified item id is present in the tree. */ static int TreeviewExistsCommand( | | | | | | > > > | | < | | | > | | | 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 | return TCL_OK; } /* + $tv exists $itemid -- * Test if the specified item id is present in the tree. */ static int TreeviewExistsCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Tcl_HashEntry *entryPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "itemid"); return TCL_ERROR; } entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2])); Tcl_SetObjResult(interp, Tcl_NewBooleanObj(entryPtr != 0)); return TCL_OK; } /* + $tv bbox $itemid ?$column? -- * Return bounding box [x y width height] of specified item. */ static int TreeviewBBoxCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item = 0; TreeColumn *column = 0; Ttk_Box bbox; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "itemid ?column"); 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)); } return TCL_OK; } /* + $tv identify $x $y -- (obsolescent) * Implements the old, horrible, 2-argument form of [$tv identify]. * * Returns: one of * heading #n * cell itemid #n * item itemid element * row itemid */ static int TreeviewHorribleIdentify( Tcl_Interp *interp, TCL_UNUSED(Tcl_Size), /* objc */ Tcl_Obj *const objv[], Treeview *tv) { const char *what = "nothing", *detail = NULL; TreeItem *item = 0; Tcl_Obj *result; Tcl_Size dColumnNumber; char dcolbuf[32]; int x, y, x1; /* ASSERT: objc == 4 */ if (Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[2], &x) != TCL_OK || Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &y) != TCL_OK) { return TCL_ERROR; } dColumnNumber = IdentifyDisplayColumn(tv, x, &x1); if (dColumnNumber < 0) { goto done; } snprintf(dcolbuf, sizeof(dcolbuf), "#%" TCL_SIZE_MODIFIER "d", 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"; |
︙ | ︙ | |||
2258 2259 2260 2261 2262 2263 2264 | } /* + $tv identify $component $x $y -- * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( | | | | | > | | | 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 | } /* + $tv identify $component $x $y -- * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size 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; Tcl_Size 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 || Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &x) != TCL_OK || Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[4], &y) != TCL_OK ) { return TCL_ERROR; } region = IdentifyRegion(tv, x, y); item = IdentifyItem(tv, y); colno = IdentifyDisplayColumn(tv, x, &x1); |
︙ | ︙ | |||
2309 2310 2311 2312 2313 2314 2315 | if (item) { Tcl_SetObjResult(interp, ItemID(tv, item)); } break; case I_COLUMN : if (colno >= 0) { | | > > > > > > > > > > > > > | | | | | 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 | if (item) { Tcl_SetObjResult(interp, ItemID(tv, item)); } break; case I_COLUMN : if (colno >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("#%" TCL_SIZE_MODIFIER "d", colno)); } break; case I_CELL : if (item && colno >= 0) { Tcl_Obj *elem[2]; elem[0] = ItemID(tv, item); elem[1] = Tcl_ObjPrintf("#%" TCL_SIZE_MODIFIER "d", 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; } } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- item and column configuration. */ /* + $tv item $item ?options ....? * Query or configure item options. */ static int TreeviewItemCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "item ?-option ?value??..."); return TCL_ERROR; |
︙ | ︙ | |||
2392 2393 2394 2395 2396 2397 2398 | } } /* + $tv column column ?options ....? * Column data accessor */ static int TreeviewColumnCommand( | | | 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 | } } /* + $tv column column ?options ....? * Column data accessor */ static int TreeviewColumnCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeColumn *column; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "column -option value..."); return TCL_ERROR; |
︙ | ︙ | |||
2420 2421 2422 2423 2424 2425 2426 | } } /* + $tv heading column ?options ....? * Heading data accessor */ static int TreeviewHeadingCommand( | | | 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 | } } /* + $tv heading column ?options ....? * Heading data accessor */ static int TreeviewHeadingCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Tk_OptionTable optionTable = tv->tree.headingOptionTable; Tk_Window tkwin = tv->core.tkwin; TreeColumn *column; if (objc < 3) { |
︙ | ︙ | |||
2450 2451 2452 2453 2454 2455 2456 | } } /* + $tv set $item ?$column ?value?? * Query or configure cell values */ static int TreeviewSetCommand( | | | | | 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 | } } /* + $tv set $item ?$column ?value?? * Query or configure cell values */ static int TreeviewSetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; TreeColumn *column; Tcl_Size 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); } } |
︙ | ︙ | |||
2515 2516 2517 2518 2519 2520 2521 | Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &result); if (!result) { result = Tcl_NewStringObj("",0); } Tcl_SetObjResult(interp, result); return TCL_OK; } else { /* set column */ | | | 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 | Tcl_ListObjIndex(interp, item->valuesObj, columnNumber, &result); if (!result) { result = Tcl_NewStringObj("",0); } Tcl_SetObjResult(interp, result); return TCL_OK; } else { /* set column */ Tcl_Size length; item->valuesObj = unshareObj(item->valuesObj); /* Make sure -values is fully populated: */ Tcl_ListObjLength(interp, item->valuesObj, &length); while (length < tv->tree.nColumns) { |
︙ | ︙ | |||
2544 2545 2546 2547 2548 2549 2550 | * +++ Widget commands -- tree modification. */ /* + $tv insert $parent $index ?-id id? ?-option value ...? * Insert a new item. */ static int TreeviewInsertCommand( | | | 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 | * +++ Widget commands -- tree modification. */ /* + $tv insert $parent $index ?-id id? ?-option value ...? * Insert a new item. */ static int TreeviewInsertCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *parent, *sibling, *newItem; Tcl_HashEntry *entryPtr; int isNew; if (objc < 4) { |
︙ | ︙ | |||
2593 2594 2595 2596 2597 2598 2599 | return TCL_ERROR; } objc -= 2; objv += 2; } else { char idbuf[16]; do { ++tv->tree.serial; | | | > | | | | | 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 | return TCL_ERROR; } objc -= 2; objv += 2; } else { char idbuf[16]; do { ++tv->tree.serial; snprintf(idbuf, sizeof(idbuf), "I%03X", tv->tree.serial); entryPtr = Tcl_CreateHashEntry(&tv->tree.items, idbuf, &isNew); } 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem **items; Tcl_Size i; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); return TCL_ERROR; } if (!(items = GetItemListFromObj(interp, tv, objv[2]))) { return TCL_ERROR; |
︙ | ︙ | |||
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 | } } 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. * * Do this in two passes: * First detach the item and all its descendants and remove them * from the hash table. Free the items themselves in a second pass. * * It's done this way because an item may appear more than once * in the list of items to delete (either directly or as a descendant * of a previously deleted item.) */ static int TreeviewDeleteCommand( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | > > > > > | > | > | | 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 | } } for (i = 0; items[i]; ++i) { DetachItem(items[i]); } tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); ckfree(items); return TCL_OK; } /* Is an item detached? The root is never detached. */ static int IsDetached(Treeview *tv, TreeItem *item) { return item->next == NULL && item->prev == NULL && item->parent == NULL && item != tv->tree.root; } /* + $tv detached ?$item? -- * List detached items (in arbitrary order) or query the detached state of * $item. */ static int TreeviewDetachedCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc == 2) { /* List detached items */ Tcl_HashSearch search; Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(&tv->tree.items, &search); Tcl_Obj *objPtr = Tcl_NewObj(); while (entryPtr != NULL) { item = (TreeItem *)Tcl_GetHashValue(entryPtr); entryPtr = Tcl_NextHashEntry(&search); if (IsDetached(tv, item)) { Tcl_ListObjAppendElement(NULL, objPtr, ItemID(tv, item)); } } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } else if (objc == 3) { /* Query; the root is never reported as detached */ if (!(item = FindItem(interp, tv, objv[2]))) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(IsDetached(tv, item))); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 2, objv, "?item?"); return TCL_ERROR; } } /* + $tv delete $items -- * Delete each item in $items. * * Do this in two passes: * First detach the item and all its descendants and remove them * from the hash table. Free the items themselves in a second pass. * * It's done this way because an item may appear more than once * in the list of items to delete (either directly or as a descendant * of a previously deleted item.) */ static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem **items, *delq; Tcl_Size i; int 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) { Tcl_Size 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. */ static int TreeviewMoveCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; TreeItem *sibling; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "item parent index"); |
︙ | ︙ | |||
2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | } /* Move item: */ DetachItem(item); InsertItem(parent, sibling, item); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- scrolling */ static int TreeviewXViewCommand( | > | | | | > > > > > > > > | > > | | | > | < | | > > > > | | | 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 | } /* Move item: */ DetachItem(item); InsertItem(parent, sibling, item); tv->tree.rowPosNeedsUpdate = 1; TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- scrolling */ static int TreeviewXViewCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle); } static int TreeviewYViewCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); } /* $tree see $item -- * Ensure that $item is visible. */ static int TreeviewSeeCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; int left = tv->tree.treeArea.x - tv->tree.xscroll.first; Tcl_Size 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 < 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; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "column %s is not displayed", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN_INVISIBLE", NULL); return TCL_ERROR; } static int TreeviewDropCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "drop"); return TCL_ERROR; } ResizeColumns(tv, TreeWidth(tv)); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- focus and selection */ /* + $tree focus ?item? */ static int TreeviewFocusCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; if (objc == 2) { if (tv->tree.focus) { Tcl_SetObjResult(interp, ItemID(tv, tv->tree.focus)); } |
︙ | ︙ | |||
2939 2940 2941 2942 2943 2944 2945 | return TCL_ERROR; } } /* + $tree selection ?add|remove|set|toggle $items? */ static int TreeviewSelectionCommand( | | | | 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 | return TCL_ERROR; } } /* + $tree selection ?add|remove|set|toggle $items? */ static int TreeviewSelectionCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size 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, 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)) { | > > | > | < > > > > > > > | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | 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) { Tcl_Size i, nElements; int 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, fromNo, toNo, anyChange = 0; Tcl_Size i, nElements; 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, Tcl_Size 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; Tcl_Size 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) { Tcl_Size n, 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. */ /* + $tv tag bind $tag ?$sequence ?$script?? */ static int TreeviewTagBindCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Tk_BindingTable bindingTable = tv->tree.bindingTable; Ttk_Tag tag; if (objc < 4 || objc > 6) { |
︙ | ︙ | |||
3068 3069 3070 3071 3072 3073 3074 | } return TCL_OK; } /* + $tv tag configure $tag ?-option ?value -option value...?? */ static int TreeviewTagConfigureCommand( | | | | 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 | } return TCL_OK; } /* + $tv tag configure $tag ?-option ?value -option value...?? */ static int TreeviewTagConfigureCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Ttk_Tag tag; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?-option ?value ...??"); return TCL_ERROR; } tag = Ttk_GetTagFromObj(tagTable, objv[3]); if (objc == 4) { return Ttk_EnumerateTagOptions(interp, tagTable, tag); |
︙ | ︙ | |||
3099 3100 3101 3102 3103 3104 3105 | TtkRedisplayWidget(&tv->core); return Ttk_ConfigureTag(interp, tagTable, tag, objc - 4, objv + 4); } /* + $tv tag delete $tag */ static int TreeviewTagDeleteCommand( | | | > > | | 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 | TtkRedisplayWidget(&tv->core); return Ttk_ConfigureTag(interp, tagTable, tag, objc - 4, objv + 4); } /* + $tv tag delete $tag */ static int TreeviewTagDeleteCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; TreeItem *item = tv->tree.root; Ttk_Tag tag; 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? */ static int TreeviewTagHasCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; if (objc == 4) { /* Return list of all items with tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); TreeItem *item = tv->tree.root; Tcl_Obj *result = Tcl_NewListObj(0,0); |
︙ | ︙ | |||
3152 3153 3154 3155 3156 3157 3158 | } else if (objc == 5) { /* Test if item has specified tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); TreeItem *item = FindItem(interp, tv, objv[4]); if (!item) { return TCL_ERROR; } Tcl_SetObjResult(interp, | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 | } else if (objc == 5) { /* Test if item has specified tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); TreeItem *item = FindItem(interp, tv, objv[4]); if (!item) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Ttk_TagSetContains(item->tagset, tag))); 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; TreeCell cell; Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, ""); return TCL_ERROR; } |
︙ | ︙ | |||
3187 3188 3189 3190 3191 3192 3193 | if (item->tagsObj) Tcl_DecrRefCount(item->tagsObj); item->tagsObj = Ttk_NewTagSetObj(item->tagset); Tcl_IncrRefCount(item->tagsObj); } } static int TreeviewTagAddCommand( | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > | 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 | if (item->tagsObj) Tcl_DecrRefCount(item->tagsObj); item->tagsObj = Ttk_NewTagSetObj(item->tagset); Tcl_IncrRefCount(item->tagsObj); } } static int TreeviewTagAddCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeItem **items; Tcl_Size i; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "tagName items"); return TCL_ERROR; } 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, Tcl_Size columnNumber) { Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeCell *cells; TreeItem *item; Tcl_Size 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) { Tcl_Size 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, Tcl_Size 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, Tcl_Size objc, Tcl_Obj *const objv[]) { Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeCell *cells; TreeItem *item; Tcl_Size 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 }, { "detached", TreeviewDetachedCommand,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 { | > > > > | 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 | 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 { |
︙ | ︙ | |||
3381 3382 3383 3384 3385 3386 3387 | offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( | > | > | > > < < > | > | > > < | 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 | offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; Ttk_Padding margins; int size = 0; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); *widthPtr = size + Ttk_PaddingWidth(margins); *heightPtr = size + Ttk_PaddingHeight(margins); } static void TreeitemIndicatorDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; ArrowDirection direction = (state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT; Ttk_Padding margins; XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); XGCValues gcvalues; GC gc; unsigned mask; if (state & TTK_STATE_LEAF) /* don't draw anything */ return; Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginsObj,&margins); b = Ttk_PadBox(b, margins); |
︙ | ︙ | |||
3451 3452 3453 3454 3455 3456 3457 | offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, offsetof(RowElement,rowNumberObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void RowElementDraw( | > | > | > > < < | | > | 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 | offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, offsetof(RowElement,rowNumberObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void RowElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { RowElement *row = (RowElement *)elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj); GC gc = Tk_GCForColor(color, d); XFillRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width, b.height); } static const Ttk_ElementSpec RowElementSpec = { TK_STYLE_VERSION_2, sizeof(RowElement), RowElementOptions, TtkNullElementSize, RowElementDraw }; /*------------------------------------------------------------------------ * +++ Initialisation. */ MODULE_SCOPE void TtkTreeview_Init(Tcl_Interp *interp) { 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 |
︙ | ︙ | |||
81 82 83 84 85 86 87 | Tk_FreePixmap(Tk_Display(tkwin), d); Tk_FreeGC(Tk_Display(tkwin), gc); } #else /* No double-buffering: draw directly into the window. */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); } | | > > > > | | 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 | Tk_FreePixmap(Tk_Display(tkwin), d); Tk_FreeGC(Tk_Display(tkwin), gc); } #else /* No double-buffering: draw directly into the window. */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); } static void EndDrawing( TCL_UNUSED(Tk_Window), TCL_UNUSED(Drawable)) { } #endif /* DrawWidget -- * Redraw a widget. Called as an idle handler. */ static void DrawWidget(void *recordPtr) { WidgetCore *corePtr = (WidgetCore *)recordPtr; corePtr->flags &= ~REDISPLAY_PENDING; if (Tk_IsMapped(corePtr->tkwin)) { Drawable d = BeginDrawing(corePtr->tkwin); corePtr->widgetSpec->layoutProc(recordPtr); |
︙ | ︙ | |||
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; } | > > > > > > > > > > > > > > | < | | 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 | } 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(void *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) { Ttk_State oldState = corePtr->state; corePtr->state = (oldState & ~clearBits) | setBits; if (corePtr->state ^ oldState) { TtkRedisplayWidget(corePtr); } } /* WidgetInstanceObjCmd -- * Widget instance command implementation. */ static int WidgetInstanceObjCmd( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)clientData; const Ttk_Ensemble *commands = corePtr->widgetSpec->commands; int status; Tcl_Preserve(clientData); status = Ttk_InvokeEnsemble(commands,1, clientData,interp,objc,objv); |
︙ | ︙ | |||
181 182 183 184 185 186 187 | * the WIDGET_DESTROYED flag bit upon return. */ /* WidgetInstanceObjCmdDeleted -- * Widget instance command deletion callback. */ static void | | < < < < < < < < < | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | * the WIDGET_DESTROYED flag bit upon return. */ /* WidgetInstanceObjCmdDeleted -- * Widget instance command deletion callback. */ static void WidgetInstanceObjCmdDeleted(void *clientData) { WidgetCore *corePtr = (WidgetCore *)clientData; corePtr->widgetCmd = NULL; if (corePtr->tkwin != NULL) Tk_DestroyWindow(corePtr->tkwin); } /* DestroyWidget -- * Main widget destructor; called from <DestroyNotify> event handler. */ static void DestroyWidget(WidgetCore *corePtr) { corePtr->flags |= WIDGET_DESTROYED; |
︙ | ︙ | |||
226 227 228 229 230 231 232 | corePtr->tkwin = NULL; if (corePtr->widgetCmd) { Tcl_Command cmd = corePtr->widgetCmd; corePtr->widgetCmd = 0; /* NB: this can reenter the interpreter via a command traces */ Tcl_DeleteCommandFromToken(corePtr->interp, cmd); } | | < < | | 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 | corePtr->tkwin = NULL; if (corePtr->widgetCmd) { Tcl_Command cmd = corePtr->widgetCmd; corePtr->widgetCmd = 0; /* NB: this can reenter the interpreter via a command traces */ Tcl_DeleteCommandFromToken(corePtr->interp, cmd); } Tcl_EventuallyFree(corePtr, TCL_DYNAMIC); } /* * CoreEventProc -- * Event handler for basic events. * Processes Expose, Configure, FocusIn/Out, and Destroy events. * Also handles <<ThemeChanged>> virtual events. * * For Expose and Configure, simply schedule the widget for redisplay. * For Destroy events, handle the cleanup process. * * For Focus events, set/clear the focus bit in the state field. * * For Deactivate/Activate pseudo-events, set/clear the background state * flag. */ static const unsigned CoreEventMask = ExposureMask | StructureNotifyMask | FocusChangeMask | VirtualEventMask | ActivateMask | EnterWindowMask | LeaveWindowMask ; static void CoreEventProc(void *clientData, XEvent *eventPtr) { WidgetCore *corePtr = (WidgetCore *)clientData; switch (eventPtr->type) { case ConfigureNotify : TtkRedisplayWidget(corePtr); |
︙ | ︙ | |||
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)) { | < | < < < < < < < < < < < < < < | | | | | | 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 | 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 *. */ int TtkWidgetConstructorObjCmd( void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetSpec *widgetSpec = (WidgetSpec *)clientData; const char *className = widgetSpec->className; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs); Tk_Window tkwin; void *recordPtr; WidgetCore *corePtr; Tk_SavedOptions savedOptions; Tcl_Size i; if (objc < 2 || objc % 2 == 1) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; } /* Check if a -class option has been specified. |
︙ | ︙ | |||
491 492 493 494 495 496 497 | Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_Layout layout; Tcl_DStringInit(&styleName); /* Prefix: */ | | | | | | > > < < | < | < | > | | 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 | Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_Layout layout; Tcl_DStringInit(&styleName); /* Prefix: */ Ttk_GetOrientFromObj(NULL, orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) Tcl_DStringAppend(&styleName, "Horizontal.", TCL_INDEX_NONE); else Tcl_DStringAppend(&styleName, "Vertical.", TCL_INDEX_NONE); /* Add base style name: */ if (corePtr->styleObj) baseStyleName = Tcl_GetString(corePtr->styleObj); if (!baseStyleName || *baseStyleName == '\0') baseStyleName = corePtr->widgetSpec->className; Tcl_DStringAppend(&styleName, baseStyleName, TCL_INDEX_NONE); /* Create layout: */ layout= Ttk_CreateLayout(interp, themePtr, Tcl_DStringValue(&styleName), recordPtr, corePtr->optionTable, corePtr->tkwin); Tcl_DStringFree(&styleName); return layout; } /* TtkNullInitialize -- * Default widget initializeProc (no-op) */ void TtkNullInitialize( TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(void *)) { } /* TtkNullPostConfigure -- * Default widget postConfigureProc (no-op) */ int TtkNullPostConfigure( TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(void *), TCL_UNUSED(int)) { return TCL_OK; } /* TtkCoreConfigure -- * Default widget configureProc. * Handles -style option. */ |
︙ | ︙ | |||
556 557 558 559 560 561 562 | return status; } /* TtkNullCleanup -- * Default widget cleanupProc (no-op) */ | | > < | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | return status; } /* TtkNullCleanup -- * Default widget cleanupProc (no-op) */ void TtkNullCleanup( TCL_UNUSED(void *)) { return; } /* TtkWidgetDoLayout -- * Default widget layoutProc. */ void TtkWidgetDoLayout(void *clientData) |
︙ | ︙ | |||
597 598 599 600 601 602 603 | /*------------------------------------------------------------------------ * +++ Default implementations for widget subcommands. */ /* $w cget -option */ int TtkWidgetCgetCommand( | | | | 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 | /*------------------------------------------------------------------------ * +++ Default implementations for widget subcommands. */ /* $w cget -option */ int TtkWidgetCgetCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } result = Tk_GetOptionValue(interp, recordPtr, corePtr->optionTable, objv[2], corePtr->tkwin); if (result == NULL) return TCL_ERROR; Tcl_SetObjResult(interp, result); return TCL_OK; } /* $w configure ?-option ?value ....?? */ int TtkWidgetConfigureCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc == 2) { result = Tk_GetOptionInfo(interp, recordPtr, corePtr->optionTable, NULL, corePtr->tkwin); |
︙ | ︙ | |||
687 688 689 690 691 692 693 | * If $stateSpec is specified, modify the widget state accordingly, * return a new stateSpec representing the changed bits. * * Otherwise, return a statespec matching all the currently-set bits. */ int TtkWidgetStateCommand( | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | * If $stateSpec is specified, modify the widget state accordingly, * return a new stateSpec representing the changed bits. * * Otherwise, return a statespec matching all the currently-set bits. */ int TtkWidgetStateCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_StateSpec spec; int status; Ttk_State oldState, changed; if (objc == 2) { |
︙ | ︙ | |||
727 728 729 730 731 732 733 | * * Tests if widget state matches $stateSpec. * If $script is specified, execute script if state matches. * Otherwise, return true/false */ int TtkWidgetInstateCommand( | | | | | | < > > > > > > > > > > > > > > > > > > > > | 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 | * * Tests if widget state matches $stateSpec. * If $script is specified, execute script if state matches. * Otherwise, return true/false */ int TtkWidgetInstateCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_State state = corePtr->state; Ttk_StateSpec spec; int status = TCL_OK; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "state-spec ?script?"); return TCL_ERROR; } status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec); if (status != TCL_OK) return status; if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Ttk_StateMatches(state,&spec))); } else if (objc == 4) { if (Ttk_StateMatches(state,&spec)) { status = Tcl_EvalObjEx(interp, objv[3], 0); } } return status; } /* $w identify $x $y * $w identify element $x $y * Returns: name of element at $x, $y */ int TtkWidgetIdentifyCommand( void *recordPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_Element element; static const char *const whatTable[] = { "element", NULL }; int x, y, what; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "?what? x y"); return TCL_ERROR; } if (objc == 5) { /* $w identify element $x $y */ if (Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) { return TCL_ERROR; } } if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK) { return TCL_ERROR; } 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, Tcl_Size 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.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright © 2003 Joe English * Helper routines for widget implementations. */ #ifndef _TTKWIDGET #define _TTKWIDGET /* |
︙ | ︙ | |||
85 86 87 88 89 90 91 92 | 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( | > > | | | | | | | | < > > > > > | > | 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 | 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 *, Tcl_Size, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetConfigureCommand( void *,Tcl_Interp *, Tcl_Size, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetIdentifyCommand( void *,Tcl_Interp *, Tcl_Size, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetInstateCommand( void *,Tcl_Interp *, Tcl_Size, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetStateCommand( void *,Tcl_Interp *, Tcl_Size, Tcl_Obj*const[]); MODULE_SCOPE int TtkWidgetStyleCommand( void *,Tcl_Interp *, Tcl_Size, Tcl_Obj*const[]); /* Widget constructor: */ MODULE_SCOPE Tcl_ObjCmdProc2 TtkWidgetConstructorObjCmd; #if TCL_MAJOR_VERSION > 8 #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand2(interp, name, \ TtkWidgetConstructorObjCmd, (void *)specPtr,NULL) #else #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (void *)specPtr,NULL) #endif /* 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. */ |
︙ | ︙ | |||
184 185 186 187 188 189 190 | typedef struct ScrollHandleRec *ScrollHandle; MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( | | | | | > > | 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 | typedef struct ScrollHandleRec *ScrollHandle; MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], ScrollHandle); MODULE_SCOPE void TtkUpdateScrollInfo(ScrollHandle h); MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst, int updateScrollInfo); MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total); MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle); /* * Tag sets (work in progress, half-baked) */ typedef struct TtkTag *Ttk_Tag; typedef struct TtkTagTable *Ttk_TagTable; typedef struct TtkTagSet { /* TODO: make opaque */ Ttk_Tag *tags; Tcl_Size nTags; } *Ttk_TagSet; MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *, Tk_Window tkwin, const Tk_OptionSpec *, size_t recordSize); MODULE_SCOPE void Ttk_DeleteTagTable(Ttk_TagTable); MODULE_SCOPE Ttk_Tag Ttk_GetTag(Ttk_TagTable, const char *tagName); MODULE_SCOPE Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable, Tcl_Obj *); MODULE_SCOPE Tcl_Obj *Ttk_TagOptionValue( Tcl_Interp *, Ttk_TagTable, Ttk_Tag, Tcl_Obj *optionName); MODULE_SCOPE int Ttk_EnumerateTagOptions( Tcl_Interp *, Ttk_TagTable, Ttk_Tag); MODULE_SCOPE int Ttk_EnumerateTags(Tcl_Interp *, Ttk_TagTable); MODULE_SCOPE void Ttk_DeleteTagFromTable(Ttk_TagTable, Ttk_Tag); MODULE_SCOPE int Ttk_ConfigureTag( Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE Ttk_TagSet Ttk_GetTagSetFromObj( 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"] \ |
︙ | ︙ | |||
119 120 121 122 123 124 125 | after 500 [list bgerror "$err" 0] return } } set ok [mc OK] # Truncate the message if it is too wide (>maxLine characters) or | | | > > > > > > | | > > > > | 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 | after 500 [list bgerror "$err" 0] return } } set ok [mc OK] # Truncate the message if it is too wide (>maxLine characters) or # too tall (>maxRows lines). Truncation occurs at the first point at # which one of those conditions is met. No trailing newline. set displayedErr "" set lines 0 set maxLine 45 set maxRows 5 foreach line [split $err \n] { if {$lines > $maxRows - 1} { # No more lines. Append to previous line. append displayedErr { ...} break } if {[string length $line] > $maxLine} { append displayedErr "[string range $line 0 $maxLine-3]..." break } if {$lines > $maxRows - 2 && [string length $line] > $maxLine-4} { append displayedErr "[string range $line 0 $maxLine-3]..." break } elseif {$lines > $maxRows - 2} { # Last line, but no break or newline. Room to add 4 chars. append displayedErr "${line}" } else { append displayedErr "${line}\n" } incr lines } set displayedErr [string trim $displayedErr] set title [mc "Application Error"] set text [mc "Error: %1\$s" $displayedErr] set buttons [list ok $ok dismiss [mc "Skip Messages"] \ function [mc "Details >>"]] # 1. Create the top-level window and divide it into top |
︙ | ︙ | |||
167 168 169 170 171 172 173 | ttk::frame $dlg.bot ttk::frame $dlg.top pack $dlg.bot -side bottom -fill both pack $dlg.top -side top -fill both -expand 1 set W [ttk::frame $dlg.top.info] | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | ttk::frame $dlg.bot ttk::frame $dlg.top pack $dlg.bot -side bottom -fill both pack $dlg.top -side top -fill both -expand 1 set W [ttk::frame $dlg.top.info] text $W.text -setgrid false -height 10 -wrap char \ -yscrollcommand [list $W.scroll set] if {$windowingsystem ne "aqua"} { $W.text configure -width 40 } ttk::scrollbar $W.scroll -command [list $W.text yview] pack $W.scroll -side right -fill y |
︙ | ︙ | |||
203 204 205 206 207 208 209 | # 3. Create a row of buttons at the bottom of the dialog. set i 0 foreach {name caption} $buttons { ttk::button $dlg.$name -text $caption -default normal \ -command [namespace code [list set button $i]] | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | # 3. Create a row of buttons at the bottom of the dialog. set i 0 foreach {name caption} $buttons { ttk::button $dlg.$name -text $caption -default normal \ -command [namespace code [list set button $i]] grid $dlg.$name -in $dlg.bot -column $i -row 0 -sticky ew -padx 7.5p grid columnconfigure $dlg.bot $i -weight 1 # We boost the size of some Mac buttons for l&f if {$windowingsystem eq "aqua"} { if {($name eq "ok") || ($name eq "dismiss")} { grid columnconfigure $dlg.bot $i -minsize 90 } grid configure $dlg.$name -pady 7 |
︙ | ︙ |
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 |
︙ | ︙ | |||
114 115 116 117 118 119 120 | # Cleanup traces on selectPath variable # foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1] } | > | > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | # Cleanup traces on selectPath variable # foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1] } if {[winfo exists $data(dirMenuBtn)]} { $data(dirMenuBtn) configure -textvariable {} } # Return value to user # return $Priv(selectFilePath) } |
︙ | ︙ |
Changes to library/clrpick.tcl.
︙ | ︙ | |||
46 47 48 49 50 51 52 | # This is the actual number of lines that are drawn in each color strip. # Note that the bars may be of any width. # However, NUM_COLORBARS must be a number that evenly divides 256. # Such as 256, 128, 64, etc. set data(NUM_COLORBARS) 16 # BARS_WIDTH is the number of pixels wide the color bar portion of the | > | | | > | | | 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 | # This is the actual number of lines that are drawn in each color strip. # Note that the bars may be of any width. # However, NUM_COLORBARS must be a number that evenly divides 256. # Such as 256, 128, 64, etc. set data(NUM_COLORBARS) 16 # BARS_WIDTH is the number of pixels wide the color bar portion of the # canvas is. BARS_WIDTH, BARS_WIDTH * 1.25, BARS_WIDTH * 1.5, and # BARS_WIDTH * 1.75 must be multiples of NUM_COLORBARS. set data(BARS_WIDTH) [::tk::ScaleNum 192] # PLGN_WIDTH is the number of pixels wide of the triangular selection # polygon. This also results in the definition of the padding on the # left and right sides which is half of PLGN_WIDTH. PLGN_WIDTH, # PLGN_WIDTH * 1.25, PLGN_WIDTH * 1.5, and PLGN_WIDTH * 1.75 must be even. set data(PLGN_WIDTH) [::tk::ScaleNum 8] # PLGN_HEIGHT is the height of the selection polygon and the height of the # selection rectangle at the bottom of the color bar. No restrictions. set data(PLGN_HEIGHT) [::tk::ScaleNum 8] Config $dataName $args InitValues $dataName set sc [winfo screen $data(-parent)] set winExists [winfo exists $w] if {!$winExists || $sc ne [winfo screen $w]} { |
︙ | ︙ | |||
231 232 233 234 235 236 237 | ::tk::AmpWidget label $box.label -text "[mc $l]:" \ -width $maxWidth -anchor ne bind $box.label <<AltUnderlined>> [list focus $box.entry] entry $box.entry -textvariable \ ::tk::dialog::color::[winfo name $w]($color,intensity) \ -width 4 | | | | | | | | < | 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 | ::tk::AmpWidget label $box.label -text "[mc $l]:" \ -width $maxWidth -anchor ne bind $box.label <<AltUnderlined>> [list focus $box.entry] entry $box.entry -textvariable \ ::tk::dialog::color::[winfo name $w]($color,intensity) \ -width 4 pack $box.label -side left -fill y -padx 1.5p -pady 2p pack $box.entry -side left -anchor n -pady 0 pack $box -side left -fill both set height [expr { [winfo reqheight $box.entry] - 2*([$box.entry cget -highlightthickness] + [$box.entry cget -bd]) }] canvas $f.color -height $height \ -width $data(BARS_WIDTH) -relief sunken -bd 2 canvas $f.sel -height $data(PLGN_HEIGHT) \ -width $data(canvasWidth) -highlightthickness 0 pack $f.color -expand yes -fill both pack $f.sel -expand yes -fill both pack $f -side top -fill x -padx 0 -pady 1.5p set data($color,entry) $box.entry set data($color,col) $f.color set data($color,sel) $f.sel bind $data($color,col) <Configure> \ [list tk::dialog::color::DrawColorScale $w $color 1] bind $data($color,col) <Enter> \ [list tk::dialog::color::EnterColorBar $w $color] bind $data($color,col) <Leave> \ [list tk::dialog::color::LeaveColorBar $w $color] bind $data($color,sel) <Enter> \ [list tk::dialog::color::EnterColorBar $w $color] bind $data($color,sel) <Leave> \ [list tk::dialog::color::LeaveColorBar $w $color] bind $box.entry <Return> [list tk::dialog::color::HandleRGBEntry $w] } pack $stripsFrame -side left -fill both -padx 3p -pady 7.5p # The selFrame contains a frame that demonstrates the currently # selected color # set selFrame [frame $topFrame.sel] set lab [::tk::AmpWidget label $selFrame.lab \ -text [mc "&Selection:"] -anchor sw] set ent [entry $selFrame.ent \ -textvariable ::tk::dialog::color::[winfo name $w](selection) \ -width 16] set f1 [frame $selFrame.f1 -relief sunken -bd 2] set data(finalCanvas) [frame $f1.demo -bd 0 -width 75p -height 51p] pack $lab $ent -side top -fill x -padx 3p -pady 1.5p pack $f1 -expand yes -anchor nw -fill both -padx 4.5p -pady 7.5p pack $data(finalCanvas) -expand yes -fill both bind $ent <Return> [list tk::dialog::color::HandleSelEntry $w] pack $selFrame -side left -fill none -anchor nw pack $topFrame -side top -expand yes -fill both -anchor nw # the botFrame frame contains the buttons # set botFrame [frame $w.bot -relief raised -bd 1] ::tk::AmpWidget button $botFrame.ok -text [mc "&OK"] \ -command [list tk::dialog::color::OkCmd $w] ::tk::AmpWidget button $botFrame.cancel -text [mc "&Cancel"] \ -command [list tk::dialog::color::CancelCmd $w] set data(okBtn) $botFrame.ok set data(cancelBtn) $botFrame.cancel grid x $botFrame.ok x $botFrame.cancel x -sticky ew grid configure $botFrame.ok $botFrame.cancel -padx 7.5p -pady 7.5p grid columnconfigure $botFrame {0 4} -weight 1 -uniform space grid columnconfigure $botFrame {1 3} -weight 1 -uniform button grid columnconfigure $botFrame 2 -weight 2 -uniform space pack $botFrame -side bottom -fill x # Accelerator bindings bind $lab <<AltUnderlined>> [list focus $ent] bind $w <Escape> [list tk::ButtonInvoke $data(cancelBtn)] bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A] wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w] } # ::tk::dialog::color::SetRGBValue -- # # Sets the current selection of the dialog box # proc ::tk::dialog::color::SetRGBValue {w color} { |
︙ | ︙ |
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>> { |
︙ | ︙ | |||
587 588 589 590 591 592 593 | bind Console <Insert> { catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]} } bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { | | < | | < | | | | | | | | | | | 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 | bind Console <Insert> { catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]} } bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { destroy {*}[winfo children .] 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 } ## ## Bindings for doing special things based on certain keys ## bind PostConsole <)> { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchPair %W \( \) promptEnd } } bind PostConsole <bracketright> { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchPair %W \[ \] promptEnd |
︙ | ︙ |
Changes to library/demos/anilabel.tcl.
1 2 3 4 5 6 7 8 9 | # anilabel.tcl -- # # This demonstration script creates a toplevel window containing # several animated label widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # anilabel.tcl -- # # This demonstration script creates a toplevel window containing # several animated label widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .anilabel catch {destroy $w} toplevel $w wm title $w "Animated Label Demonstration" wm iconname $w "anilabel" positionWindow $w |
︙ | ︙ | |||
62 63 64 65 66 67 68 | unset animationCallbacks(%W) } } ## Next, a similar pair of procedures to animate a GIF loaded into a ## photo image. proc SelectNextImageFrame {w interval} { | | | > | > > > > > > > | | | | | | | | | 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 | unset animationCallbacks(%W) } } ## Next, a similar pair of procedures to animate a GIF loaded into a ## photo image. proc SelectNextImageFrame {w interval} { global animationCallbacks image zoomFactor set animationCallbacks($w) \ [after $interval SelectNextImageFrame $w $interval] set image2 [$w cget -image] # The easy way to animate a GIF! set idx -1 scan [$image cget -format] "GIF -index %d" idx if {[catch { # Note that we get an error if the index is out of range $image configure -format "GIF -index [incr idx]" }]} then { $image configure -format "GIF -index 0" } $image2 copy $image -zoom $zoomFactor } proc animateLabelImage {w imageData interval} { global animationCallbacks image zoomFactor # Create a multi-frame GIF from base-64-encoded data set image [image create photo -format GIF -data $imageData] # Create a copy of the image just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copy will only be effectively magnified if $tk::scalingPct >= 200. set image2 [image create photo] set zoomFactor [expr {$tk::scalingPct / 100}] $image2 copy $image -zoom $zoomFactor # Install the image copy into the widget $w configure -image $image2 # Schedule the start of the animation loop set animationCallbacks($w) \ [after $interval SelectNextImageFrame $w $interval] # Make sure that the animation stops and is cleaned up after itself # when the animated label is destroyed. Note that at this point we # cannot manipulate the widget itself, as that has already died. # Also note that this script is in double-quotes; this is always OK # because image names are chosen automatically to be simple words. bind $w <Destroy> " after cancel \$animationCallbacks(%W) unset animationCallbacks(%W) rename $image {} " } # Make some widgets to contain the animations labelframe $w.left -text "Scrolling Texts" labelframe $w.right -text "GIF Image" pack $w.left $w.right -side left -padx 7.5p -pady 7.5p -expand yes # This method of scrolling text looks far better with a fixed-width font label $w.left.l1 -bd 3p -relief ridge -font fixedFont label $w.left.l2 -bd 3p -relief groove -font fixedFont label $w.left.l3 -bd 3p -relief flat -font fixedFont -width 18 pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -padx 7.5p -pady 7.5p -anchor w # Don't need to do very much with this label except turn off the border label $w.right.l -bd 0 pack $w.right.l -side top -expand yes -padx 7.5p -pady 7.5p # This is a base-64-encoded animated GIF file. set tclPoweredData { R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZEkyTKM2jOm66yPP |
︙ | ︙ |
Changes to library/demos/aniwave.tcl.
1 2 3 4 5 6 7 8 9 10 | # aniwave.tcl -- # # This demonstration script illustrates how to adjust canvas item # coordinates in a way that does something fairly similar to waveform # display. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # aniwave.tcl -- # # This demonstration script illustrates how to adjust canvas item # coordinates in a way that does something fairly similar to waveform # display. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .aniwave catch {destroy $w} toplevel $w wm title $w "Animated Wave Demonstration" wm iconname $w "aniwave" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Create a canvas large enough to hold the wave. In fact, the wave # sticks off both sides of the canvas to prevent visual glitches. pack [canvas $w.c -width 225p -height 150p -background black] -padx 7.5p -pady 7.5p -expand yes # Ensure that this this is an array array set animationCallbacks {} # Creates a coordinates list of a wave. This code does a very sketchy # job and relies on Tk's line smoothing to make things look better. set waveCoords {} for {set x -10} {$x<=300} {incr x 5} { lappend waveCoords $x 100 } lappend waveCoords $x 0 [incr x 5] 200 # Create a smoothed line and arrange for its coordinates to be the # contents of the variable waveCoords. $w.c create line $waveCoords -tags wave -width 0.75p -fill green -smooth 1 proc waveCoordsTracer {w args} { global waveCoords # Actual visual update will wait until we have finished # processing; Tk does that for us automatically. $w.c coords wave $waveCoords set scaleFactor [expr {$tk::scalingPct / 100.0}] $w.c scale wave 0 0 $scaleFactor $scaleFactor } trace add variable waveCoords write [list waveCoordsTracer $w] # Basic motion handler. Given what direction the wave is travelling # in, it advances the y coordinates in the coordinate-list one step in # that direction. proc basicMotion {} { |
︙ | ︙ |
Changes to library/demos/arrow.tcl.
1 2 3 4 5 6 7 8 9 | # arrow.tcl -- # # This demonstration script creates a canvas widget that displays a # large line with an arrowhead whose shape can be edited interactively. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # arrow.tcl -- # # This demonstration script creates a canvas widget that displays a # large line with an arrowhead whose shape can be edited interactively. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # scl -- # Scales an integer according to the display's current scaling percentage. # # Arguments: # num - An integer. proc scl num { return [expr {round($num*$tk::scalingPct/100.0)}] } # arrowSetup -- # This procedure regenerates all the text and graphics in the canvas # window. It's called when the canvas is initially created, and also # whenever any of the parameters of the arrow head are changed # interactively. # |
︙ | ︙ | |||
29 30 31 32 33 34 35 | } else { set cur "" } # Create the arrow and outline. $c delete all | | | | | > | | | | | | | | | | | > > > > > > | < | | < | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | } else { set cur "" } # Create the arrow and outline. $c delete all $c create line $v(x1) $v(y) $v(x2) $v(y) -arrow last \ -width [expr {10*$v(width)}] -arrowshape [list \ [expr {10*$v(a)}] [expr {10*$v(b)}] [expr {10*$v(c)}]] \ {*}$v(bigLineStyle) set xtip [expr {$v(x2)-10*$v(b)}] set deltaY [expr {10*$v(c)+5*$v(width)}] $c create line $v(x2) $v(y) $xtip [expr {$v(y)+$deltaY}] \ [expr {$v(x2)-10*$v(a)}] $v(y) $xtip [expr {$v(y)-$deltaY}] \ $v(x2) $v(y) -width 1.5p -capstyle round -joinstyle round # Create the boxes for reshaping the line and arrowhead. set _5 [scl 5] $c create rect [expr {$v(x2)-10*$v(a)-$_5}] [expr {$v(y)-$_5}] \ [expr {$v(x2)-10*$v(a)+$_5}] [expr {$v(y)+$_5}] \ -tags {box1 box} {*}$v(boxStyle) $c create rect [expr {$xtip-$_5}] [expr {$v(y)-$deltaY-$_5}] \ [expr {$xtip+$_5}] [expr {$v(y)-$deltaY+$_5}] \ -tags {box2 box} {*}$v(boxStyle) $c create rect [expr {$v(x1)-$_5}] [expr {$v(y)-5*$v(width)-$_5}] \ [expr {$v(x1)+$_5}] [expr {$v(y)-5*$v(width)+$_5}] \ -tags {box3 box} {*}$v(boxStyle) if {$cur != ""} { $c itemconfigure $cur {*}$v(activeStyle) } # Create three arrows in actual size with the same parameters. set _10 [scl 10] set _15 [scl 15] set _25 [scl 25] set _50 [scl 50] set _75 [scl 75] set _125 [scl 125] $c create line [expr {$v(x2)+$_50}] 0 [expr {$v(x2)+$_50}] 750p -width 1.5p set tmp [expr {$v(x2)+[scl 100]}] $c create line $tmp [expr {$v(y)-$_125}] $tmp [expr {$v(y)-$_75}] \ -width $v(width) -arrow both -arrowshape "$v(a) $v(b) $v(c)" $c create line [expr {$tmp-$_25}] $v(y) [expr {$tmp+$_25}] $v(y) \ -width $v(width) -arrow both -arrowshape "$v(a) $v(b) $v(c)" $c create line [expr {$tmp-$_25}] [expr {$v(y)+$_75}] \ [expr {$tmp+$_25}] [expr {$v(y)+$_125}] \ -width $v(width) -arrow both -arrowshape "$v(a) $v(b) $v(c)" # Create a bunch of other arrows and text items showing the # current dimensions. set tmp [expr {$v(x2)+$_10}] $c create line $tmp [expr {$v(y)-5*$v(width)}] \ $tmp [expr {$v(y)-$deltaY}] \ -arrow both -arrowshape $v(smallTips) $c create text [expr {$v(x2)+$_15}] [expr {$v(y)-$deltaY+5*$v(c)}] \ -text $v(c) -anchor w set tmp [expr {$v(x1)-$_10}] $c create line $tmp [expr {$v(y)-5*$v(width)}] \ $tmp [expr {$v(y)+5*$v(width)}] \ -arrow both -arrowshape $v(smallTips) $c create text [expr {$v(x1)-$_15}] $v(y) -text $v(width) -anchor e set tmp [expr {$v(y)+5*$v(width)+10*$v(c)+$_10}] $c create line [expr {$v(x2)-10*$v(a)}] $tmp $v(x2) $tmp \ -arrow both -arrowshape $v(smallTips) $c create text [expr {$v(x2)-5*$v(a)}] [expr {$tmp+$_5}] \ -text $v(a) -anchor n set tmp [expr {$tmp+$_25}] $c create line [expr {$v(x2)-10*$v(b)}] $tmp $v(x2) $tmp \ -arrow both -arrowshape $v(smallTips) $c create text [expr {$v(x2)-5*$v(b)}] [expr {$tmp+$_5}] \ -text $v(b) -anchor n $c create text $v(x1) 232.5p -text "-width $v(width)" \ -anchor w -font {Helvetica 18} $c create text $v(x1) 247.5p -text "-arrowshape {$v(a) $v(b) $v(c)}" \ -anchor w -font {Helvetica 18} incr v(count) } set w .arrow catch {destroy $w} toplevel $w wm title $w "Arrowhead Editor Demonstration" wm iconname $w "arrow" positionWindow $w set c $w.c label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x canvas $c -width 375p -height 262.5p -relief sunken -borderwidth 2 pack $c -expand yes -fill both set demo_arrowInfo(a) [scl 8] set demo_arrowInfo(b) [scl 10] set demo_arrowInfo(c) [scl 3] set demo_arrowInfo(width) [scl 2] set demo_arrowInfo(motionProc) arrowMoveNull set demo_arrowInfo(x1) [scl 40] set demo_arrowInfo(x2) [scl 350] set demo_arrowInfo(y) [scl 150] set demo_arrowInfo(smallTips) {3.75p 3.75p 1.5p} set demo_arrowInfo(count) 0 if {[winfo depth $c] > 1} { if {[tk windowingsystem] eq "aqua"} { set demo_arrowInfo(bigLineStyle) "-fill systemSelectedTextBackgroundColor" } else { set demo_arrowInfo(bigLineStyle) "-fill LightSeaGreen" } set demo_arrowInfo(boxStyle) "-fill {} -width 0.75p" set demo_arrowInfo(activeStyle) "-fill red -width 0.75p" } else { # Main widget program sets variable tk_demoDirectory set demo_arrowInfo(bigLineStyle) "-fill black \ -stipple @[file join $tk_demoDirectory images grey.25]" set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 0.75p" set demo_arrowInfo(activeStyle) "-fill black -outline black -width 0.75p" } arrowSetup $c $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)" $c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)" $c bind box <B1-Enter> " " $c bind box <B1-Leave> " " $c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1} |
︙ | ︙ | |||
167 168 169 170 171 172 173 | # # Arguments: # c - The name of the canvas window. # x, y - The coordinates of the mouse. proc arrowMove1 {c x y} { upvar #0 demo_arrowInfo v | | > | | > | > | | | > | | | > | | | 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 | # # Arguments: # c - The name of the canvas window. # x, y - The coordinates of the mouse. proc arrowMove1 {c x y} { upvar #0 demo_arrowInfo v set newA [expr {($v(x2)+[scl 5]-round([$c canvasx $x]))/10}] if {$newA < 0} { set newA 0 } set _25 [scl 25] if {$newA > $_25} { set newA $_25 } if {$newA != $v(a)} { $c move box1 [expr {10*($v(a)-$newA)}] 0 set v(a) $newA } } # arrowMove2 -- # This procedure is called for each mouse motion event on box2 (the # one at the trailing tip of the arrowhead). It updates the controlling # parameters for the line and arrowhead. # # Arguments: # c - The name of the canvas window. # x, y - The coordinates of the mouse. proc arrowMove2 {c x y} { upvar #0 demo_arrowInfo v set _5 [scl 5] set newB [expr {($v(x2)+$_5-round([$c canvasx $x]))/10}] if {$newB < 0} { set newB 0 } set _25 [scl 25] if {$newB > $_25} { set newB $_25 } set newC [expr {($v(y)+$_5-round([$c canvasy $y])-5*$v(width))/10}] if {$newC < 0} { set newC 0 } set _20 [scl 20] if {$newC > $_20} { set newC $_20 } if {($newB != $v(b)) || ($newC != $v(c))} { $c move box2 [expr {10*($v(b)-$newB)}] [expr {10*($v(c)-$newC)}] set v(b) $newB set v(c) $newC } } # arrowMove3 -- # This procedure is called for each mouse motion event on box3 (the # one that controls the thickness of the line). It updates the # controlling parameters for the line and arrowhead. # # Arguments: # c - The name of the canvas window. # x, y - The coordinates of the mouse. proc arrowMove3 {c x y} { upvar #0 demo_arrowInfo v set newWidth [expr {($v(y)+[scl 2]-round([$c canvasy $y]))/5}] if {$newWidth < 0} { set newWidth 0 } set _20 [scl 20] if {$newWidth > $_20} { set newWidth $_20 } if {$newWidth != $v(width)} { $c move box3 0 [expr {5*($v(width)-$newWidth)}] set v(width) $newWidth } } |
Changes to library/demos/bind.tcl.
1 2 3 4 5 6 7 8 9 | # bind.tcl -- # # This demonstration script creates a text widget with bindings set # up for hypertext-like effects. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # bind.tcl -- # # This demonstration script creates a text widget with bindings set # up for hypertext-like effects. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .bind catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Tag Bindings" wm iconname $w "bind" positionWindow $w |
︙ | ︙ |
Changes to library/demos/bitmap.tcl.
1 2 3 4 5 6 7 8 9 | # bitmap.tcl -- # # This demonstration script creates a toplevel window that displays # all of Tk's built-in bitmaps. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # bitmap.tcl -- # # This demonstration script creates a toplevel window that displays # all of Tk's built-in bitmaps. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # bitmapRow -- # Create a row of bitmap items in a window. # # Arguments: # w - The window that is to contain the row. # args - The names of one or more bitmaps, which will be displayed |
︙ | ︙ |
Changes to library/demos/browse.
1 2 3 4 5 6 7 8 9 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # browse -- # This script generates a directory browser, which lists the working # directory and allows you to open files or subdirectories by # double-clicking. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # browse -- # This script generates a directory browser, which lists the working # directory and allows you to open files or subdirectories by # double-clicking. package require tk # Create a scrollbar on the right side of the main window and a listbox # on the left side. scrollbar .scroll -command ".list yview" pack .scroll -side right -fill y listbox .list -yscroll ".scroll set" -relief sunken -width 20 -height 20 \ |
︙ | ︙ |
Changes to library/demos/button.tcl.
1 2 3 4 5 6 7 8 9 | # button.tcl -- # # This demonstration script creates a toplevel window containing # several button widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # button.tcl -- # # This demonstration script creates a toplevel window containing # several button widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .button catch {destroy $w} toplevel $w wm title $w "Button Demonstration" wm iconname $w "button" positionWindow $w |
︙ | ︙ | |||
40 41 42 43 44 45 46 | -command [list colorrefresh $w PeachPuff1] button $w.b2 -text "Light Blue" -width 10 \ -command [list colorrefresh $w LightBlue1] button $w.b3 -text "Sea Green" -width 10 \ -command [list colorrefresh $w SeaGreen2] button $w.b4 -text "Yellow" -width 10 \ -command [list colorrefresh $w Yellow1] | | | 40 41 42 43 44 45 46 47 | -command [list colorrefresh $w PeachPuff1] button $w.b2 -text "Light Blue" -width 10 \ -command [list colorrefresh $w LightBlue1] button $w.b3 -text "Sea Green" -width 10 \ -command [list colorrefresh $w SeaGreen2] button $w.b4 -text "Yellow" -width 10 \ -command [list colorrefresh $w Yellow1] pack $w.b1 $w.b2 $w.b3 $w.b4 -side top -expand yes -pady 1.5p |
Changes to library/demos/check.tcl.
1 2 3 4 5 6 7 8 9 | # check.tcl -- # # This demonstration script creates a toplevel window containing # several checkbuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # check.tcl -- # # This demonstration script creates a toplevel window containing # several checkbuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .check catch {destroy $w} toplevel $w wm title $w "Checkbutton Demonstration" wm iconname $w "check" positionWindow $w |
︙ | ︙ | |||
26 27 28 29 30 31 32 | checkbutton $w.b0 -text "Safety Check" -variable safety -relief flat \ -onvalue "all" \ -offvalue "none" \ -tristatevalue "partial" checkbutton $w.b1 -text "Wipers OK" -variable wipers -relief flat checkbutton $w.b2 -text "Brakes OK" -variable brakes -relief flat checkbutton $w.b3 -text "Driver Sober" -variable sober -relief flat | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | checkbutton $w.b0 -text "Safety Check" -variable safety -relief flat \ -onvalue "all" \ -offvalue "none" \ -tristatevalue "partial" checkbutton $w.b1 -text "Wipers OK" -variable wipers -relief flat checkbutton $w.b2 -text "Brakes OK" -variable brakes -relief flat checkbutton $w.b3 -text "Driver Sober" -variable sober -relief flat pack $w.b0 -side top -pady 1.5p -anchor w pack $w.b1 $w.b2 $w.b3 -side top -pady 1.5p -anchor w -padx 12p ## This code makes $w.b0 function as a tri-state button; it's not ## needed at all for just straight yes/no buttons. set in_check 0 proc tristate_check {n1 n2 op} { global safety wipers brakes sober in_check |
︙ | ︙ | |||
61 62 63 64 65 66 67 | } else { set safety none } } set in_check 0 } | | | | | | 61 62 63 64 65 66 67 68 69 70 71 | } else { set safety none } } set in_check 0 } trace add variable wipers write tristate_check trace add variable brakes write tristate_check trace add variable sober write tristate_check trace add variable safety write tristate_check |
Changes to library/demos/clrpick.tcl.
1 2 3 4 5 6 7 8 | # clrpick.tcl -- # # This demonstration script prompts the user to select a color. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # clrpick.tcl -- # # This demonstration script prompts the user to select a color. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .clrpick catch {destroy $w} toplevel $w wm title $w "Color Selection Dialog" wm iconname $w "colors" positionWindow $w |
︙ | ︙ |
Changes to library/demos/colors.tcl.
1 2 3 4 5 6 7 8 9 10 | # colors.tcl -- # # This demonstration script creates a listbox widget that displays # many of the colors from the X color database. You can click on # a color to change the application's palette. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # colors.tcl -- # # This demonstration script creates a listbox widget that displays # many of the colors from the X color database. You can click on # a color to change the application's palette. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .colors catch {destroy $w} toplevel $w wm title $w "Listbox Demonstration (colors)" wm iconname $w "Listbox" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing several color names is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by dragging in the listbox window with button 2 pressed. If you double-click button 1 on a color, then the application's color palette will be set to match that color" pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.frame -borderwidth 7.5p pack $w.frame -side top -expand yes -fill y ttk::scrollbar $w.frame.scroll -command "$w.frame.list yview" listbox $w.frame.list -yscroll "$w.frame.scroll set" \ -width 20 -height 16 -setgrid 1 pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1 bind $w.frame.list <Double-Button-1> { tk_setPalette [selection get] } |
︙ | ︙ |
Changes to library/demos/combo.tcl.
1 2 3 4 5 6 7 8 | # combo.tcl -- # # This demonstration script creates several combobox widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # combo.tcl -- # # This demonstration script creates several combobox widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .combo catch {destroy $w} toplevel $w wm title $w "Combobox Demonstration" wm iconname $w "combo" positionWindow $w |
︙ | ︙ | |||
52 53 54 55 56 57 58 | -values $australianCities bind $w.c1.c <Return> { if {[%W get] ni [%W cget -values]} { %W configure -values [concat [%W cget -values] [list [%W get]]] } } | | | | | | 52 53 54 55 56 57 58 59 60 61 62 | -values $australianCities bind $w.c1.c <Return> { if {[%W get] ni [%W cget -values]} { %W configure -values [concat [%W cget -values] [list [%W get]]] } } pack $w.c1 $w.c2 $w.c3 -side top -pady 3p -padx 7.5p pack $w.c1.c -pady 3p -padx 7.5p pack $w.c2.c -pady 3p -padx 7.5p pack $w.c3.c -pady 3p -padx 7.5p |
Changes to library/demos/cscroll.tcl.
1 2 3 4 5 6 7 8 9 | # cscroll.tcl -- # # This demonstration script creates a simple canvas that can be # scrolled in two dimensions. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # cscroll.tcl -- # # This demonstration script creates a simple canvas that can be # scrolled in two dimensions. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .cscroll catch {destroy $w} toplevel $w wm title $w "Scrollable Canvas Demonstration" wm iconname $w "cscroll" positionWindow $w set c $w.c label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget that can be scrolled by using the scrollbars, by dragging with button 2 in the canvas, by using a mouse wheel, or with the two-finger gesture on a touchpad. If you click button 1 on one of the rectangles, its indices will be printed on stdout." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.grid scrollbar $w.hscroll -orient horizontal -command "$c xview" scrollbar $w.vscroll -command "$c yview" canvas $c -relief sunken -borderwidth 2 -scrollregion {-11c -11c 50c 20c} \ -xscrollcommand "$w.hscroll set" \ -yscrollcommand "$w.vscroll set" pack $w.grid -expand yes -fill both -padx 1 -pady 1 grid rowconfig $w.grid 0 -weight 1 -minsize 0 grid columnconfig $w.grid 0 -weight 1 -minsize 0 |
︙ | ︙ | |||
52 53 54 55 56 57 58 | -anchor center -tags text } } $c bind all <Enter> "scrollEnter $c" $c bind all <Leave> "scrollLeave $c" $c bind all <Button-1> "scrollButton $c" | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | -anchor center -tags text } } $c bind all <Enter> "scrollEnter $c" $c bind all <Leave> "scrollLeave $c" $c bind all <Button-1> "scrollButton $c" if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide tk] 8.7-]} { bind $c <Button-3> "$c scan mark %x %y" bind $c <B3-Motion> "$c scan dragto %x %y" bind $c <MouseWheel> { %W yview scroll [expr {-%D}] units } bind $c <Option-MouseWheel> { %W yview scroll [expr {-10*%D}] units |
︙ | ︙ | |||
104 105 106 107 108 109 110 | bind $c <Shift-Option-MouseWheel> { if {%D >= 0} { %W xview scroll [expr {%D/-3}] units } else { %W xview scroll [expr {(%D-2)/-3}] units } } | > > > > | | > > | | | 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 | bind $c <Shift-Option-MouseWheel> { if {%D >= 0} { %W xview scroll [expr {%D/-3}] units } else { %W xview scroll [expr {(%D-2)/-3}] units } } bind $c <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0 || $deltaY != 0} { tk::ScrollByPixels %W $deltaX $deltaY } } } 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/ctext.tcl.
1 2 3 4 5 6 7 8 9 | # ctext.tcl -- # # This demonstration script creates a canvas widget with a text # item that can be edited and reconfigured in various ways. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # ctext.tcl -- # # This demonstration script creates a canvas widget with a text # item that can be edited and reconfigured in various ways. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ctext catch {destroy $w} toplevel $w wm title $w "Canvas Text Demonstration" wm iconname $w "Text" positionWindow $w |
︙ | ︙ | |||
27 28 29 30 31 32 33 | the character just after the insertion cursor." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | the character just after the insertion cursor." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x canvas $c -relief flat -borderwidth 0 -width 375p -height 262.5p pack $w.c -side top -expand yes -fill both set textFont {Helvetica 24} $c create rectangle 183.75p 122.25p 191.25p 129.75p -outline black -fill red # First, create the text item and give it bindings so it can be edited. $c addtag text withtag [$c create text 187.5p 126p -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 330p -anchor n -font $textFont -justify left] $c bind text <Button-1> "textB1Press $c %x %y" $c bind text <B1-Motion> "textB1Move $c %x %y" $c bind text <Shift-Button-1> "$c select adjust current @%x,%y" $c bind text <Shift-B1-Motion> "textB1Move $c %x %y" $c bind text <Key> "textInsert $c %A" $c bind text <Return> "textInsert $c \\n" $c bind text <Control-h> "textBs $c" $c bind text <BackSpace> "textBs $c" $c bind text <Delete> "textDel $c" if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { $c bind text <Button-3> "textPaste $c @%x,%y" } else { $c bind text <Button-2> "textPaste $c @%x,%y" } # Next, create some items that allow the text's anchor position # to be edited. proc mkTextConfigBox {w x y option value color} { ;# x, y are in points set item [$w create rect ${x}p ${y}p [expr {$x+22.5}]p [expr {$y+22.5}]p \ -outline black -fill $color -width 0.75p] $w bind $item <Button-1> "$w itemconf text $option $value" $w addtag config withtag $item } proc mkTextConfigPie {w x y a option value color} { ;# x, y are in points set item [$w create arc ${x}p ${y}p [expr {$x+67.5}]p [expr {$y+67.5}]p \ -start [expr {$a-15}] -extent 30 -outline black -fill $color \ -width 0.75p] $w bind $item <Button-1> "$w itemconf text $option $value" $w addtag config withtag $item } set x 37.5 ;# in points set y 37.5 ;# in points set color LightSkyBlue1 mkTextConfigBox $c $x $y -anchor se $color mkTextConfigBox $c [expr {$x+22.5}] [expr {$y }] -anchor s $color mkTextConfigBox $c [expr {$x+45 }] [expr {$y }] -anchor sw $color mkTextConfigBox $c [expr {$x }] [expr {$y+22.5}] -anchor e $color mkTextConfigBox $c [expr {$x+22.5}] [expr {$y+22.5}] -anchor center $color mkTextConfigBox $c [expr {$x+45 }] [expr {$y+22.5}] -anchor w $color mkTextConfigBox $c [expr {$x }] [expr {$y+45 }] -anchor ne $color mkTextConfigBox $c [expr {$x+22.5}] [expr {$y+45 }] -anchor n $color mkTextConfigBox $c [expr {$x+45 }] [expr {$y+45 }] -anchor nw $color set item [$c create rect \ [expr {$x+30}]p [expr {$y+30}]p [expr {$x+37.5}]p [expr {$y+37.5}]p \ -outline black -fill red] $c bind $item <Button-1> "$c itemconf text -anchor center" $c create text [expr {$x+33.75}]p [expr {$y-3.75}]p \ -text {Text Position} -anchor s -font {Times 20} -fill brown # Now create some items that allow the text's angle to be changed. set x 153.75 ;# in points set y 37.5 ;# in points set color Yellow mkTextConfigPie $c $x $y 0 -angle 90 $color mkTextConfigPie $c $x $y 30 -angle 120 $color mkTextConfigPie $c $x $y 60 -angle 150 $color mkTextConfigPie $c $x $y 90 -angle 180 $color mkTextConfigPie $c $x $y 120 -angle 210 $color mkTextConfigPie $c $x $y 150 -angle 240 $color mkTextConfigPie $c $x $y 180 -angle 270 $color mkTextConfigPie $c $x $y 210 -angle 300 $color mkTextConfigPie $c $x $y 240 -angle 330 $color mkTextConfigPie $c $x $y 270 -angle 0 $color mkTextConfigPie $c $x $y 300 -angle 30 $color mkTextConfigPie $c $x $y 330 -angle 60 $color $c create text [expr {$x+33.75}]p [expr {$y-3.75}]p \ -text {Text Angle} -anchor s -font {Times 20} -fill brown # Lastly, create some items that allow the text's justification to be # changed. set x 262.5 ;# in points set y 37.5 ;# in points set color SeaGreen2 mkTextConfigBox $c $x $y -justify left $color mkTextConfigBox $c [expr {$x+22.5}] $y -justify center $color mkTextConfigBox $c [expr {$x+45}] $y -justify right $color $c create text [expr {$x+33.75}]p [expr {$y-3.75}]p \ -text {Justification} -anchor s -font {Times 20} -fill brown $c bind config <Enter> "textEnter $c" $c bind config <Leave> "$c itemconf current -fill \$textConfigFill" set textConfigFill {} |
︙ | ︙ |
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/entry1.tcl.
1 2 3 4 5 6 7 8 9 | # entry1.tcl -- # # This demonstration script creates several entry widgets without # scrollbars. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # entry1.tcl -- # # This demonstration script creates several entry widgets without # scrollbars. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .entry1 catch {destroy $w} toplevel $w wm title $w "Entry Demonstration (no scrollbars)" wm iconname $w "entry1" positionWindow $w label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse the middle mouse button pressed." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x entry $w.e1 entry $w.e2 entry $w.e3 -placeholder {Enter text here} -placeholderforeground gray75 pack $w.e1 $w.e2 $w.e3 -side top -pady 3p -padx 7.5p -fill x $w.e1 insert 0 "Initial value" $w.e2 insert end "This entry contains a long value, much too long " $w.e2 insert end "to fit in the window at one time, so long in fact " $w.e2 insert end "that you'll have to scan or scroll to see the end." |
Changes to library/demos/entry2.tcl.
1 2 3 4 5 6 7 8 9 | # entry2.tcl -- # # This demonstration script is the same as the entry1.tcl script # except that it creates scrollbars for the entries. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # entry2.tcl -- # # This demonstration script is the same as the entry1.tcl script # except that it creates scrollbars for the entries. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .entry2 catch {destroy $w} toplevel $w wm title $w "Entry Demonstration (with scrollbars)" wm iconname $w "entry2" positionWindow $w label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with the middle mouse button pressed." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.frame -borderwidth 7.5p pack $w.frame -side top -fill x -expand 1 entry $w.frame.e1 -xscrollcommand "$w.frame.s1 set" ttk::scrollbar $w.frame.s1 -orient horizontal -command \ "$w.frame.e1 xview" frame $w.frame.spacer1 -width 15p -height 7.5p entry $w.frame.e2 -xscrollcommand "$w.frame.s2 set" ttk::scrollbar $w.frame.s2 -orient horizontal -command \ "$w.frame.e2 xview" frame $w.frame.spacer2 -width 15p -height 7.5p entry $w.frame.e3 -xscrollcommand "$w.frame.s3 set" ttk::scrollbar $w.frame.s3 -orient horizontal -command \ "$w.frame.e3 xview" pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \ $w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x $w.frame.e1 insert 0 "Initial value" $w.frame.e2 insert end "This entry contains a long value, much too long " $w.frame.e2 insert end "to fit in the window at one time, so long in fact " $w.frame.e2 insert end "that you'll have to scan or scroll to see the end." $w.frame.e3 configure -placeholder {Enter text here} -placeholderforeground gray75 |
Changes to library/demos/entry3.tcl.
1 2 3 4 5 6 7 8 9 10 | # entry3.tcl -- # # This demonstration script creates several entry widgets whose # permitted input is constrained in some way. It also shows off a # password entry. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # entry3.tcl -- # # This demonstration script creates several entry widgets whose # permitted input is constrained in some way. It also shows off a # password entry. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .entry3 catch {destroy $w} toplevel $w wm title $w "Constrained Entry Demonstration" wm iconname $w "entry3" positionWindow $w |
︙ | ︙ | |||
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/filebox.tcl.
1 2 3 4 5 6 7 8 | # filebox.tcl -- # # This demonstration script prompts the user to select a file. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # filebox.tcl -- # # This demonstration script prompts the user to select a file. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .filebox catch {destroy $w} toplevel $w wm title $w "File Selection Dialogs" wm iconname $w "filebox" positionWindow $w ttk::frame $w._bg place $w._bg -x 0 -y 0 -relwidth 1 -relheight 1 ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Enter a file name in the entry box or click on the \"Browse\" buttons to select a file name using the file selection dialog." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set f [ttk::frame $w.f] foreach i {open save} { ttk::label $f.lab_$i -text "Select a file to $i:" ttk::entry $f.ent_$i -width 20 ttk::button $f.but_$i -text "Browse ..." -command \ "fileDialog $w $f.ent_$i $i" grid $f.lab_$i $f.ent_$i $f.but_$i -pady 3p -sticky w grid configure $f.ent_$i -padx 3p -sticky ew } grid columnconfigure $f 1 -weight 1 pack $f -fill x -padx 1c if {[tk windowingsystem] eq "x11"} { ttk::checkbutton $w.strict -text "Use Motif Style Dialog" \ -variable tk_strictMotif -onvalue 1 -offvalue 0 pack $w.strict -anchor c # This binding ensures that we don't run the rest of the demos |
︙ | ︙ |
Changes to library/demos/floor.tcl.
1 2 3 4 5 6 7 8 9 | # floor.tcl -- # # This demonstration script creates a canvas widet that displays the # floorplan for DEC's Western Research Laboratory. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # floor.tcl -- # # This demonstration script creates a canvas widet that displays the # floorplan for DEC's Western Research Laboratory. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # floorDisplay -- # Recreate the floorplan display in the canvas given by "w". The # floor given by "active" is displayed on top with its office structure # visible. # # Arguments: |
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. catch {unset floorLabels} catch {unset floorItems} fg$active $w $colors(offices) $w raise room # Offset the floors diagonally from each other. $w move floor1 2c 2c $w move floor2 1c 1c # Create items for the room entry and its label. | > > > > > > | | > > > | > > > > > | 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 | # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. catch {unset floorLabels} catch {unset floorItems} fg$active $w $colors(offices) $w raise room # Rescale the coordinates in pixels of all of the # items according to the display's DPI scaling level. set scaleFactor [expr {$tk::scalingPct / 100.0}] $w scale all 0 0 $scaleFactor $scaleFactor # Offset the floors diagonally from each other. $w move floor1 2c 2c $w move floor2 1c 1c # Create items for the room entry and its label. $w create window 450p 75p -anchor w -window $w.entry $w create text 450p 75p -anchor e -text "Room: " # Configure the canvas. set bbox [$w bbox all] lassign $bbox x1 y1 x2 y2 set morePx [expr {round(20 * $tk::scalingPct / 100.0)}] set width [expr {$x2 - $x1 + $morePx}] set height [expr {$y2 - $y1 + $morePx}] $w configure -scrollregion $bbox -width $width -height $height } # newRoom -- # This procedure is invoked whenever the mouse enters a room # in the floorplan. It changes tags so that the current room is # highlighted. # |
︙ | ︙ | |||
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 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # # 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 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # # 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 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # # 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} |
︙ | ︙ | |||
1292 1293 1294 1295 1296 1297 1298 | set w .floor global c currentRoom colors activeFloor catch {destroy $w} toplevel $w wm title $w "Floorplan Canvas Demonstration" wm iconname $w "Floorplan" wm geometry $w +20+20 | | | | < | 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 | set w .floor global c currentRoom colors activeFloor catch {destroy $w} toplevel $w wm title $w "Floorplan Canvas Demonstration" wm iconname $w "Floorplan" wm geometry $w +20+20 wm minsize $w 75p 75p label $w.msg -font $font -wraplength 8i -justify left -text "This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set f [frame $w.frame] pack $f -side top -fill both -expand yes set h [ttk::scrollbar $f.hscroll -orient horizontal] set v [ttk::scrollbar $f.vscroll -orient vertical] set f1 [frame $f.f1 -borderwidth 2 -relief sunken] set c [canvas $f1.c -highlightthickness 0 \ -xscrollcommand [list $h set] -yscrollcommand [list $v set]] pack $c -expand yes -fill both grid $f1 -padx 1 -pady 1 -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news grid $v -padx 1 -pady 1 -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news grid $h -padx 1 -pady 1 -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news grid rowconfig $f 0 -weight 1 -minsize 0 grid columnconfig $f 0 -weight 1 -minsize 0 pack $f -expand yes -fill both -padx 1 -pady 1 |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | # Set up event bindings for canvas: $c bind floor1 <Button-1> "floorDisplay $c 1" $c bind floor2 <Button-1> "floorDisplay $c 2" $c bind floor3 <Button-1> "floorDisplay $c 3" $c bind room <Enter> "newRoom $c" $c bind room <Leave> {set currentRoom ""} | | | | 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 | # Set up event bindings for canvas: $c bind floor1 <Button-1> "floorDisplay $c 1" $c bind floor2 <Button-1> "floorDisplay $c 2" $c bind floor3 <Button-1> "floorDisplay $c 3" $c bind room <Enter> "newRoom $c" $c bind room <Leave> {set currentRoom ""} if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { bind $c <Button-3> "$c scan mark %x %y" bind $c <B3-Motion> "$c scan dragto %x %y" } else { bind $c <Button-2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" } bind $c <Destroy> "unset currentRoom" set currentRoom "" trace add variable currentRoom write "roomChanged $c" |
Changes to library/demos/fontchoose.tcl.
1 2 3 4 5 6 7 8 | # fontchoose.tcl -- # # Show off the stock font selector dialog if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # fontchoose.tcl -- # # Show off the stock font selector dialog if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .fontchoose catch {destroy $w} toplevel $w wm title $w "Font Selection Dialog" wm iconname $w "fontchooser" positionWindow $w |
︙ | ︙ | |||
36 37 38 39 40 41 42 | %W.f.font state disabled } else { %W.f.font state !disabled } } | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | %W.f.font state disabled } else { %W.f.font state !disabled } } set f [ttk::frame $w.f -relief sunken -padding 1.5p] text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \ -yscrollcommand [list $f.vs set] ttk::scrollbar $f.vs -command [list $f.msg yview] $f.msg insert end "Press the buttons below to choose a new font for the\ text shown in this window.\n" {} |
︙ | ︙ |
Changes to library/demos/form.tcl.
1 2 3 4 5 6 7 8 9 | # form.tcl -- # # This demonstration script creates a simple form with a bunch # of entry widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # form.tcl -- # # This demonstration script creates a simple form with a bunch # of entry widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .form catch {destroy $w} toplevel $w wm title $w "Form Demonstration" wm iconname $w "form" positionWindow $w |
︙ | ︙ |
Changes to library/demos/goldberg.tcl.
︙ | ︙ | |||
36 37 38 39 40 41 42 | # I could comment on the code, but it's just 26 state machines with # lots of canvas create and move calls. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | > | | > | | | | > > > > > > > > > > > > > > > > > > > > > | | | | > < > | | | > | | | > | > > | | > | | | | | | | | | | < | | | > > > > > | | | | | < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # I could comment on the code, but it's just 26 state machines with # lots of canvas create and move calls. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .goldberg catch {destroy $w} toplevel $w wm title $w "Tk Goldberg (demonstration)" wm iconname $w "goldberg" wm resizable $w 0 0 #positionWindow $w proc StartMessage {w} { set msg1 "This\ is a demonstration of just how complex you can make your animations\ become. Close this dialog and click the ball to start things\ moving!\n\n\"Man will always find a difficult means to perform a\ simple task\"\n - Rube Goldberg" PlacedDialog $w.c.messframe $msg1 {Helvetica 12} } ###--- End of Boilerplate ---### array set BaseDimensions { CanX 675 CanY 540 ScrX 750 ScrY 750 MsgX 338 MsgY 573 MovX 10 MovY -45 } # The original value was 1.0 but this can make the demo # too large for the screen. Try a smaller value. set overallFactor 0.75 foreach el [array names BaseDimensions] { set Dims($el) [expr {$BaseDimensions($el) * $overallFactor}]p } set scaleFactor [expr {$::tk::scalingPct / 100.0 * $overallFactor}] # Ensure that this is an array array set animationCallbacks {} bind $w <Destroy> { if {"%W" eq [winfo toplevel %W]} { unset S C delays } } set S(title) "Tk Goldberg" set S(speed) 5 set S(cnt) 0 set S(message) "\\nWelcome\\nto\\nTcl/Tk!" array set delays \ {1 500 2 400 3 300 4 200 5 150 6 100 7 80 8 50 9 20 10 10} 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 Dims ttk::frame $w.ctrl -relief ridge -borderwidth 1 -padding 3p pack [frame $w.screen -bd 1 -relief raised] \ -side left -fill both -expand 1 canvas $w.c -width $Dims(CanX) -height $Dims(CanY) -bg $C(bg) \ -highlightthickness 0 $w.c config -scrollregion [list 0 0 $Dims(ScrX) $Dims(ScrY)] $w.c yview moveto .06 ;# Kludge: move everything up pack $w.c -in $w.screen -side top -fill both -expand 1 bind $w.c <Configure> { %W yview moveto .06 } bind $w.c <Button-3> [list $w.pause invoke] bind $w.c <Destroy> { after cancel $animationCallbacks(goldberg) unset animationCallbacks(goldberg) } DoCtrlFrame $w DoDetailFrame $w if {[tk windowingsystem] ne "aqua"} { ttk::button $w.show -text "▶" -command [list ShowCtrl $w] -width 2 } else { button $w.show -text "▶" -command [list ShowCtrl $w] -width 1 \ -borderwidth 1 -highlightthickness 0 -padx 0 -pady 0 \ -highlightbackground $C(bg) } place $w.show -in $w.c -relx 1 -rely 0 -anchor ne update } proc DoCtrlFrame {w} { global S ttk::button $w.start -text "Start" -command [list DoButton $w 0] ttk::checkbutton $w.pause -text "Pause" -command [list DoButton $w 1] \ -variable S(pause) ttk::button $w.step -text "Single Step" -command [list DoButton $w 2] ttk::button $w.bstep -text "Big Step" -command [list DoButton $w 4] ttk::button $w.reset -text "Reset" -command [list DoButton $w 3] ttk::labelframe $w.details raise $w.details set S(details) 0 ttk::checkbutton $w.details.cb -text "Details" -variable S(details) ttk::labelframe $w.message -text "Message" ttk::entry $w.message.e -textvariable S(message) -justify center ttk::labelframe $w.speed -text "Speed: 0" ttk::scale $w.speed.scale -orient horizontal -from 1 -to 10 \ -variable S(speed) ttk::button $w.about -text About -command [list About $w] grid $w.start -in $w.ctrl -row 0 -sticky ew grid rowconfigure $w.ctrl 1 -minsize 3p grid $w.pause -in $w.ctrl -row 2 -sticky ew grid $w.step -in $w.ctrl -sticky ew -pady 1.5p grid $w.bstep -in $w.ctrl -sticky ew grid $w.reset -in $w.ctrl -sticky ew -pady 1.5p grid rowconfigure $w.ctrl 10 -minsize 3p grid $w.details -in $w.ctrl -row 11 -sticky ew grid rowconfigure $w.ctrl 11 -minsize 3p $w.details configure -labelwidget $w.details.cb grid [ttk::frame $w.details.b -height 1] ;# Work around minor bug raise $w.details raise $w.details.cb grid rowconfigure $w.ctrl 50 -weight 1 trace add variable ::S(mode) write [list ActiveGUI $w] trace add variable ::S(details) write [list ActiveGUI $w] trace add variable ::S(speed) write [list ActiveGUI $w] grid $w.message -in $w.ctrl -row 98 -sticky ew -pady {0 3p} grid $w.message.e -sticky nsew grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 3p} pack $w.speed.scale -fill both -expand 1 grid $w.about -in $w.ctrl -row 100 -sticky ew bind $w.reset <Button-3> {set S(mode) -1} ;# Debugging ## See Code / Dismiss buttons hack! grid [ttk::separator $w.ctrl.sep] -sticky ew -pady {3p 1.5p} set btns {} foreach b [winfo children [addSeeDismiss $w.ctrl.buttons $w]] { if {[winfo class $b] eq "TButton"} { set btns [linsert $btns 0 $b] ;# Prepend } } set i 0 foreach b $btns { grid [set b2 [ttk::button $w.ctrl.b[incr i]]] -sticky ew -pady {1.5p 0} foreach b3 [$b configure] { set b3 [lindex $b3 0] # Some options are read-only; ignore those errors catch {$b2 configure $b3 [$b cget $b3]} } } destroy $btns } proc DoDetailFrame {w} { set w2 $w.details.f ttk::frame $w2 ttk::label $w2.l -textvariable S(cnt) -background white grid $w2.l - - - -sticky ew -row 0 for {set i 1} {1} {incr i} { if {[info procs "Move$i"] eq ""} break ttk::label $w2.l$i -text $i -anchor e -width 2 -background white ttk::label $w2.ll$i -textvariable STEP($i) -width 5 -background white set row [expr {($i + 1) / 2}] set col [expr {(($i + 1) & 1) * 2}] grid $w2.l$i -sticky ew -row $row -column $col grid $w2.ll$i -sticky ew -row $row -column [incr col] } grid columnconfigure $w2 1 -weight 1 } # Map or unmap the ctrl window proc ShowCtrl {w} { if {[winfo ismapped $w.ctrl]} { pack forget $w.ctrl $w.show config -text "▶" } else { pack $w.ctrl -side right -fill both -ipady 5 $w.show config -text "◀" } } proc DrawAll {w} { global scaleFactor ResetStep $w.c delete all for {set i 0} {1} {incr i} { set p "Draw$i" if {[info procs $p] eq ""} break $p $w } $w.c scale all 0 0 $scaleFactor $scaleFactor # Tile the strike box with a 4x4 bitmap image derived # from Tk's built-in 16x16 bitmap gray25. Adjust # x1, y2 to make dimensions multiples of 4 pixels. image create bitmap smallGray25 -data { #define smallGray25_width 4 #define smallGray25_height 4 static unsigned char smallGray25_bits[] = { 0x08, 0x02, 0x08, 0x02}; } -foreground $::C(fg) lassign [$w.c coords StrikeBox] x1 y1 x2 y2 set oldMidY [expr {round(($y1 + $y2) / 2.0)}] set rowCount [expr {round(($y2 - $y1) / 4.0)}] set colCount [expr {round(($x2 - $x1) / 4.0)}] set x2 [expr {round($x2)}] set x1 [expr {$x2 - $colCount * 4}] set y1 [expr {round($y1)}] set y2 [expr {$y1 + $rowCount * 4}] set newMidY [expr {round(($y1 + $y2) / 2.0)}] set deltaY [expr {$oldMidY - $newMidY}] incr y1 $deltaY; incr y2 $deltaY $w.c coords StrikeBox $x1 $y1 $x2 $y2 for {set row 0; set y $y1} {$row < $rowCount} {incr row; incr y 4} { for {set col 0; set x $x1} {$col < $colCount} {incr col; incr x 4} { $w.c create image $x $y -image smallGray25 -anchor nw } } } proc ActiveGUI {w var1 var2 op} { global S MGO MSTART MDONE array set z {0 disabled 1 normal} set m $S(mode) |
︙ | ︙ | |||
263 264 265 266 267 268 269 | Reset $w } elseif {$what == 4} { ;# Big step set S(mode) $MBSTEP } } proc Go {w {who {}}} { | | | | | 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 | Reset $w } elseif {$what == 4} { ;# Big step set S(mode) $MBSTEP } } proc Go {w {who {}}} { global S delays animationCallbacks MGO MPAUSE MSSTEP MBSTEP set now [clock clicks -milliseconds] catch {after cancel $animationCallbacks(goldberg)} if {$who ne ""} { ;# Start here for debugging set S(active) $who set S(mode) $MGO } if {$S(mode) == -1} return ;# Debugging set n 0 if {$S(mode) != $MPAUSE} { ;# Not paused set n [NextStep $w] ;# Do the next move } if {$S(mode) == $MSSTEP} { ;# Single step set S(mode) $MPAUSE } if {$S(mode) == $MBSTEP && $n} { ;# Big step set S(mode) $MSSTEP } set elapsed [expr {[clock click -milliseconds] - $now}] set delay [expr {$delays($S(speed)) - $elapsed}] if {$delay <= 0} { set delay 1 } set animationCallbacks(goldberg) [after $delay [list Go $w]] } # NextStep: drives the next step of the animation |
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 | set S(active) {} ;# No more animation return 1 } } set S(active) $alive return $rval } proc About {w} { set msg "$::S(title)\nby Keith Vetter, March 2003\n(Reproduced by kind\ permission of the author)\n\n\"Man will always find a difficult\ | > | | > | | | | | | | | | | > > | | | | | 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 | set S(active) {} ;# No more animation return 1 } } set S(active) $alive return $rval } proc About {w} { set msg "$::S(title)\nby Keith Vetter, March 2003\n(Reproduced by kind\ permission of the author)\n\n\"Man will always find a difficult\ means to perform a simple task.\"\n - Rube Goldberg" PlacedDialog $w.c.messframe $msg {Helvetica 12 bold} return } ################################################################ # # All the drawing and moving routines # # START HERE! banner proc Draw0 {w} { set color $::C(0) set xy {699 119} $w.c create text $xy -text "START HERE!" -fill $color -anchor e \ -tag {I0 I0_0} -font {Times 12 italic bold} set xy {719 119 763 119} $w.c create line $xy -tag {I0 I0_1} -fill $color -width 3.75p -arrow last \ -arrowshape {13.5p 13.5p 3.75p} $w.c bind I0 <Button-1> Start } proc Move0 {w {step {}}} { set step [GetStep 0 $step] if {$::S(mode) > $::MSTART} { ;# Start the ball rolling MoveAbs $w I0 {-100 -100} ;# Hide the banner return 2 } set pos [scl { {719 119} {724 119} {729 119} {734 119} {739 119} {734 119} {729 119} {724 119} }] set step [expr {$step % [llength $pos]}] lassign [lindex $pos $step] x y $w.c coords I0_0 [expr {$x - [scl 20]}] $y $w.c coords I0_1 $x $y [expr {$x + [scl 44]}] $y return 1 } # Dropping ball proc Draw1 {w} { set color $::C(1a) set color2 $::C(1b) set xy {844 133 800 133 800 346 820 346 820 168 844 168 844 133} $w.c create poly $xy -width 2.25p -fill $color -outline {} set xy {771 133 685 133 685 168 751 168 751 346 771 346 771 133} $w.c create poly $xy -width 2.25p -fill $color -outline {} set xy [box 812 122 9] $w.c create oval $xy -tag I1 -fill $color2 -outline {} $w.c bind I1 <Button-1> Start } proc Move1 {w {step {}}} { set step [GetStep 1 $step] set pos [scl { {807 122} {802 122} {797 123} {793 124} {789 129} {785 153} {785 203} {785 278 x} {785 367} {810 392} {816 438} {821 503} {824 585 y} {838 587} {848 593} {857 601} {-100 -100} }] if {$step >= [llength $pos]} { return 0 } set where [lindex $pos $step] MoveAbs $w I1 $where if {[lindex $where 2] eq "y"} { |
︙ | ︙ | |||
399 400 401 402 403 404 405 | # Lighting the match proc Draw2 {w} { set color red set color $::C(2) set xy {750 369 740 392 760 392} ;# Fulcrum $w.c create poly $xy -fill $::C(fg) -outline $::C(fg) set xy {628 335 660 383} ;# Strike box | | < < < < < < | < | | | | | > | | | | 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 | # Lighting the match proc Draw2 {w} { set color red set color $::C(2) set xy {750 369 740 392 760 392} ;# Fulcrum $w.c create poly $xy -fill $::C(fg) -outline $::C(fg) set xy {628 335 660 383} ;# Strike box $w.c create rect $xy -fill {} -outline $::C(fg) -tag StrikeBox set xy {702 366 798 366} ;# Lever $w.c create line $xy -fill $::C(fg) -width 5.25p -tag I2_0 set xy {712 363 712 355} ;# R strap $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I2_1 set xy {705 363 705 355} ;# L strap $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I2_2 set xy {679 356 679 360 717 360 717 356 679 356} ;# Match stick $w.c create line $xy -fill $::C(fg) -tag I2_3 #set xy {662 352 680 365} ;# Match head set xy { 671 352 677.4 353.9 680 358.5 677.4 363.1 671 365 664.6 363.1 662 358.5 664.6 353.9 } $w.c create poly $xy -fill $color -outline $color -tag I2_4 } proc Move2 {w {step {}}} { set step [GetStep 2 $step] set stages {0 0 1 2 0 2 1 0 1 2 0 2 1} set xy(0) [scl { 686 333 692 323 682 316 674 309 671 295 668 307 662 318 662 328 671 336 }] set xy(1) [scl { 687 331 698 322 703 295 680 320 668 297 663 311 661 327 671 335}] set xy(2) [scl { 686 331 704 322 688 300 678 283 678 283 674 298 666 309 660 324 672 336 }] if {$step >= [llength $stages]} { $w.c delete I2 return 0 } if {$step == 0} { ;# Rotate the match |
︙ | ︙ | |||
464 465 466 467 468 469 470 | proc Draw3 {w} { set color $::C(3a) set color2 $::C(3b) set xy {602 296 577 174 518 174} foreach {x y} $xy { ;# 3 Pulleys $w.c create oval [box $x $y 13] -fill $color -outline $::C(fg) \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | proc Draw3 {w} { set color $::C(3a) set color2 $::C(3b) set xy {602 296 577 174 518 174} foreach {x y} $xy { ;# 3 Pulleys $w.c create oval [box $x $y 13] -fill $color -outline $::C(fg) \ -width 2.25p $w.c create oval [box $x $y 2] -fill $::C(fg) -outline $::C(fg) } set xy {750 309 670 309} ;# Wall to flame $w.c create line $xy -tag I3_s -width 2.25p -fill $::C(fg) -smooth 1 set xy {670 309 650 309} ;# Flame to pulley 1 $w.c create line $xy -tag I3_0 -width 2.25p -fill $::C(fg) set xy {650 309 600 309} ;# Flame to pulley 1 $w.c create line $xy -tag I3_1 -width 2.25p -fill $::C(fg) set xy {589 296 589 235} ;# Pulley 1 half way to 2 $w.c create line $xy -tag I3_2 -width 2.25p -fill $::C(fg) set xy {589 235 589 174} ;# Pulley 1 other half to 2 $w.c create line $xy -width 2.25p -fill $::C(fg) set xy {577 161 518 161} ;# Across the top $w.c create line $xy -width 2.25p -fill $::C(fg) set xy {505 174 505 205} ;# Down to weight $w.c create line $xy -tag I3_w -width 2.25p -fill $::C(fg) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle set xy {515 207 495 207} foreach {x1 y1 x2 y2} $xy { $w.c create oval [box $x1 $y1 6] -tag I3_ -fill $color2 \ -outline $color2 $w.c create oval [box $x2 $y2 6] -tag I3_ -fill $color2 \ -outline $color2 incr y1 -6; incr y2 6 $w.c create rect $x1 $y1 $x2 $y2 -tag I3_ -fill $color2 \ -outline $color2 } set xy {492 220 518 263} set xy [RoundRect $w $xy 15] $w.c create poly $xy -smooth 1 -tag I3_ -fill $color2 -outline $color2 set xy {500 217 511 217} $w.c create line $xy -tag I3_ -fill $color2 -width 7.5p set xy {502 393 522 393 522 465} ;# Bottom weight target $w.c create line $xy -tag I3__ -fill $::C(fg) -join miter -width 7.5p } proc Move3 {w {step {}}} { set step [GetStep 3 $step] set pos [scl {{505 247} {505 297} {505 386.5} {505 386.5}}] set rope(0) [scl {750 309 729 301 711 324 690 300}] set rope(1) [scl {750 309 737 292 736 335 717 315 712 320}] set rope(2) [scl {750 309 737 309 740 343 736 351 725 340}] set rope(3) [scl {750 309 738 321 746 345 742 356}] if {$step >= [llength $pos]} { return 0 } $w.c delete "I3_$step" ;# Delete part of the rope MoveAbs $w I3_ [lindex $pos $step] ;# Move weight down $w.c coords I3_s $rope($step) ;# Flapping rope end $w.c coords I3_w [concat [scl {505 174}] [lindex $pos $step]] if {$step == 2} { $w.c move I3__ 0 30 return 2 } return 1 } # Cage and door proc Draw4 {w} { set color $::C(4) lassign {527 356 611 464} x0 y0 x1 y1 for {set y $y0} {$y <= $y1} {incr y 12} { ;# Horizontal bars $w.c create line $x0 $y $x1 $y -fill $color -width 0.75p } for {set x $x0} {$x <= $x1} {incr x 12} { ;# Vertical bars $w.c create line $x $y0 $x $y1 -fill $color -width 0.75p } set xy {518 464 518 428} ;# Swing gate $w.c create line $xy -tag I4 -fill $color -width 2.25p } proc Move4 {w {step {}}} { set step [GetStep 4 $step] set angles {-10 -20 -30 -30} if {$step >= [llength $angles]} { return 0 } RotateItem $w I4 [scl 518] [scl 464] [lindex $angles $step] $w.c raise I4 return [expr {$step == 3 ? 3 : 1}] } # Mouse proc Draw5 {w} { set color $::C(5a) set color2 $::C(5b) set xy {377 248 410 248 410 465 518 465} ;# Mouse course lappend xy 518 428 451 428 451 212 377 212 $w.c create poly $xy -fill $color2 -outline $::C(fg) -width 2.25p set xy { 534.5 445.5 541 440 552 436 560 436 569 440 574 446 575 452 574 454 566 456 554 456 545 456 537 454 530 452 } $w.c create poly $xy -tag {I5 I5_0} -fill $color set xy {573 452 592 458 601 460 613 456} ;# Tail $w.c create line $xy -tag {I5 I5_1} -fill $color -smooth 1 -width 2.25p set xy [box 540 446 2] ;# Eye set xy {540 444 541 445 541 447 540 448 538 447 538 445} #.c create oval $xy -tag {I5 I5_2} -fill $::C(bg) -outline {} $w.c create poly $xy -tag {I5 I5_2} -fill $::C(bg) -outline {} -smooth 1 set xy {538 454 535 461} ;# Front leg $w.c create line $xy -tag {I5 I5_3} -fill $color -width 1.5p set xy {566 455 569 462} ;# Back leg $w.c create line $xy -tag {I5 I5_4} -fill $color -width 1.5p set xy {544 455 545 460} ;# 2nd front leg $w.c create line $xy -tag {I5 I5_5} -fill $color -width 1.5p set xy {560 455 558 460} ;# 2nd back leg $w.c create line $xy -tag {I5 I5_6} -fill $color -width 1.5p } proc Move5 {w {step {}}} { set step [GetStep 5 $step] set pos [scl { {553 452} {533 452} {513 452} {493 452} {473 452} {463 442 30} {445.5 441.5 30} {425.5 434.5 30} {422 414} {422 394} {422 374} {422 354} {422 334} {422 314} {422 294} {422 274 -30} {422 260.5 -30 x} {422.5 248.5 -28} {425 237} }] if {$step >= [llength $pos]} { return 0 } lassign [lindex $pos $step] x y beta next MoveAbs $w I5 [list $x $y] if {$beta ne ""} { |
︙ | ︙ | |||
627 628 629 630 631 632 633 | 13,12 {331 420} 13,13 {360 417} 13,14 {345 412} 13,15 {376 410} 13,16 {360 403} } proc Draw6 {w} { set color $::C(6) set xy {324 130 391 204} ;# Ball holder set xy [RoundRect $w $xy 10] | | | | | | | | | | | | | | > > > | > > > > | > | | | | | | | | | | | | | 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 | 13,12 {331 420} 13,13 {360 417} 13,14 {345 412} 13,15 {376 410} 13,16 {360 403} } proc Draw6 {w} { set color $::C(6) set xy {324 130 391 204} ;# Ball holder set xy [RoundRect $w $xy 10] $w.c create poly $xy -smooth 1 -outline $::C(fg) -width 2.25p -fill $color set xy {339 204 376 253} ;# Below the ball holder $w.c create rect $xy -fill {} -outline $::C(fg) -width 2.25p -fill $color \ -tag I6c set xy [box 346 339 28] $w.c create oval $xy -fill $color -outline {} ;# Rotor $w.c create arc $xy -outline $::C(fg) -width 1.5p -style arc \ -start 80 -extent 205 $w.c create arc $xy -outline $::C(fg) -width 1.5p -style arc \ -start -41 -extent 85 set xy [box 346 339 15] ;# Center of rotor $w.c create oval $xy -outline $::C(fg) -fill $::C(fg) -tag I6m set xy {352 312 352 254 368 254 368 322} ;# Top drop to rotor $w.c create poly $xy -fill $color -outline {} $w.c create line $xy -fill $::C(fg) -width 1.5p set xy {353 240 367 300} ;# Poke bottom hole $w.c create rect $xy -fill $color -outline {} set xy {341 190 375 210} ;# Poke another hole $w.c create rect $xy -fill $color -outline {} set xy {368 356 368 403 389 403 389 464 320 464 320 403 352 403 352 366} $w.c create poly $xy -fill $color -outline {} -width 1.5p ;# Below rotor $w.c create line $xy -fill $::C(fg) -width 1.5p set xy [box 275 342 7] ;# On/off rotor $w.c create oval $xy -outline $::C(fg) -fill $::C(fg) set xy {276 334 342 325} ;# Fan belt top $w.c create line $xy -fill $::C(fg) -width 2.25p set xy {276 349 342 353} ;# Fan belt bottom $w.c create line $xy -fill $::C(fg) -width 2.25p set xy {337 212 337 247} ;# What the mouse pushes $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I6_ set xy {392 212 392 247} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I6_ set xy {337 230 392 230} $w.c create line $xy -fill $::C(fg) -width 5.25p -tag I6_ set who -1 ;# All the balls set colors {red cyan orange green blue darkblue} lappend colors {*}$colors {*}$colors for {set i 0} {$i < 17} {incr i} { set loc [expr {-1 * $i}] set color [lindex $colors $i] $w.c create oval [box {*}$::XY6($loc) 5] -fill $color \ -outline $color -tag I6_b$i } Draw6a $w 12 ;# The wheel } proc Draw6a {w beta {scale 0}} { $w.c delete I6_0 if {$scale} { lassign [scl {346 339}] Ox Oy } else { lassign {346 339} Ox Oy } for {set i 0} {$i < 4} {incr i} { set b [expr {$beta + $i * 45}] if {$scale} { lassign [RotateC [scl 28] 0 0 0 $b] x y } else { lassign [RotateC 28 0 0 0 $b] x y } set xy [list [expr {$Ox+$x}] [expr {$Oy+$y}] \ [expr {$Ox-$x}] [expr {$Oy-$y}]] $w.c create line $xy -tag I6_0 -fill $::C(fg) -width 1.5p } } proc Move6 {w {step {}}} { set step [GetStep 6 $step] if {$step > 62} { return 0 } if {$step < 2} { ;# Open gate for balls to drop $w.c move I6_ -5.25p 0 if {$step == 1} { ;# Poke a hole set xy [scl {348 226 365 240}] $w.c create rect $xy -fill [$w.c itemcget I6c -fill] -outline {} } return 1 } set s [expr {$step - 1}] ;# Do the gumball drop dance for {set i 0} {$i <= int(($s-1) / 3)} {incr i} { set tag "I6_b$i" if {[$w.c find withtag $tag] eq ""} break set loc [expr {$s - 3 * $i}] if {[info exists ::XY6($loc,$i)]} { MoveAbs $w $tag [scl $::XY6($loc,$i)] } elseif {[info exists ::XY6($loc)]} { MoveAbs $w $tag [scl $::XY6($loc)] } } if {($s % 3) == 1} { set first [expr {($s + 2) / 3}] for {set i $first} {1} {incr i} { set tag "I6_b$i" if {[$w.c find withtag $tag] eq ""} break set loc [expr {$first - $i}] MoveAbs $w $tag [scl $::XY6($loc)] } } if {$s >= 3} { ;# Rotate the motor set idx [expr {$s % 3}] #Draw6a $w [lindex {12 35 64} $idx] Draw6a $w [expr {12 + $s * 15}] 1 } return [expr {$s == 3 ? 3 : 1}] } # On/off switch proc Draw7 {w} { set color $::C(7) set xy {198 306 277 374} ;# Box $w.c create rect $xy -outline $::C(fg) -width 1.5p -fill $color -tag I7z $w.c lower I7z set xy {275 343 230 349} $w.c create line $xy -tag I7 -fill $::C(fg) -arrow last \ -arrowshape {17.25p 17.25p 6p} -width 4.5p set xy {225 324} ;# On button $w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg) set xy {218 323} ;# On text set font {Times 8} $w.c create text $xy -text "on" -anchor e -fill $::C(fg) -font $font set xy {225 350} ;# Off button $w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg) set xy {218 349} ;# Off button $w.c create text $xy -text "off" -anchor e -fill $::C(fg) -font $font } proc Move7 {w {step {}}} { set step [GetStep 7 $step] set numsteps 30 if {$step > $numsteps} { return 0 } set beta [expr {30.0 / $numsteps}] RotateItem $w I7 [scl 275] [scl 343] $beta return [expr {$step == $numsteps ? 3 : 1}] } # Electricity to the fan proc Draw8 {w} { Sine $w 271 248 271 306 5 8 -tag I8_s -fill $::C(8) -width 2.25p } proc Move8 {w {step {}}} { set step [GetStep 8 $step] if {$step > 3} { return 0 } |
︙ | ︙ | |||
802 803 804 805 806 807 808 | set xy {288 249 252 249 260 240 280 234 296 234 316 240 324 249 288 249} $w.c create poly $xy -fill $color -smooth 1 set xy {248 205 265 214 264 205 265 196} ;# Spinner $w.c create poly $xy -fill $color set xy {255 206 265 234} ;# Fan blades | | | | | | | | | | | | | | | | | | | | | | | 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 | set xy {288 249 252 249 260 240 280 234 296 234 316 240 324 249 288 249} $w.c create poly $xy -fill $color -smooth 1 set xy {248 205 265 214 264 205 265 196} ;# Spinner $w.c create poly $xy -fill $color set xy {255 206 265 234} ;# Fan blades $w.c create oval $xy -fill {} -outline $::C(fg) -width 2.25p -tag I9_0 set xy {255 176 265 204} $w.c create oval $xy -fill {} -outline $::C(fg) -width 2.25p -tag I9_0 set xy {255 206 265 220} $w.c create oval $xy -fill {} -outline $::C(fg) -width 0.75p -tag I9_1 set xy {255 190 265 204} $w.c create oval $xy -fill {} -outline $::C(fg) -width 0.75p -tag I9_1 } proc Move9 {w {step {}}} { set step [GetStep 9 $step] if {$step & 1} { $w.c itemconfig I9_0 -width 3p $w.c itemconfig I9_1 -width 0.75p $w.c lower I9_1 I9_0 } else { $w.c itemconfig I9_0 -width 0.75p $w.c itemconfig I9_1 -width 3p $w.c lower I9_0 I9_1 } if {$step == 0} { return 3 } return 1 } # Boat proc Draw10 {w} { set color $::C(10a) set color2 $::C(10b) set xy {191 230 233 230 233 178 191 178} ;# Sail $w.c create poly $xy -fill $color -width 2.25p -outline $::C(fg) -tag I10 set xy [box 209 204 31] ;# Front $w.c create arc $xy -outline {} -fill $color -style pie \ -start 120 -extent 120 -tag I10 $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \ -start 120 -extent 120 -tag I10 set xy [box 249 204 31] ;# Back $w.c create arc $xy -outline {} -fill $::C(bg) -width 2.25p -style pie \ -start 120 -extent 120 -tag I10 $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \ -start 120 -extent 120 -tag I10 set xy {200 171 200 249} ;# Mast $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I10 set xy {159 234 182 234} ;# Bow sprit $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I10 set xy {180 234 180 251 220 251} ;# Hull $w.c create line $xy -fill $::C(fg) -width 4.5p -tag I10 set xy {92 255 221 255} ;# Waves Sine $w {*}$xy 2 25 -fill $color2 -width 0.75p -tag I10w set xy [lrange [$w.c coords I10w] 4 end-4] ;# Water set xy [concat $xy 222 266 222 277 99 277] $w.c create poly $xy -fill $color2 -outline $color2 set xy {222 266 222 277 97 277 97 266} ;# Water bottom $w.c create line $xy -fill $::C(fg) -width 2.25p set xy [box 239 262 17] $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \ -start 95 -extent 103 set xy [box 76 266 21] $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc -extent 190 } proc Move10 {w {step {}}} { set step [GetStep 10 $step] set pos [scl { {195 212} {193 212} {190 212} {186 212} {181 212} {176 212} {171 212} {166 212} {161 212} {156 212} {151 212} {147 212} {142 212} {137 212} {132 212 x} {127 212} {121 212} {116 212} {111 212} }] if {$step >= [llength $pos]} { return 0 } set where [lindex $pos $step] MoveAbs $w I10 $where |
︙ | ︙ | |||
897 898 899 900 901 902 903 | set color2 $::C(11b) set xy {23 264 55 591} ;# Color the down tube $w.c create rect $xy -fill $color -outline {} set xy [box 71 460 48] ;# Color the outer loop $w.c create oval $xy -fill $color -outline {} set xy {55 264 55 458} ;# Top right side | | | | | | | | | | | | 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 | set color2 $::C(11b) set xy {23 264 55 591} ;# Color the down tube $w.c create rect $xy -fill $color -outline {} set xy [box 71 460 48] ;# Color the outer loop $w.c create oval $xy -fill $color -outline {} set xy {55 264 55 458} ;# Top right side $w.c create line $xy -fill $::C(fg) -width 2.25p set xy {55 504 55 591} ;# Bottom right side $w.c create line $xy -fill $::C(fg) -width 2.25p set xy [box 71 460 48] ;# Outer loop $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \ -start 110 -extent -290 -tag I11i set xy [box 71 460 16] ;# Inner loop $w.c create oval $xy -outline $::C(fg) -fill {} -width 2.25p -tag I11i $w.c create oval $xy -outline $::C(fg) -fill $::C(bg) -width 2.25p set xy {23 264 23 591} ;# Left side $w.c create line $xy -fill $::C(fg) -width 2.25p set xy [box 1 266 23] ;# Top left curve $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc -extent 90 set xy [box 75 235 9] ;# The ball $w.c create oval $xy -fill $color2 -outline {} -width 2.25p -tag I11 } proc Move11 {w {step {}}} { set step [GetStep 11 $step] set pos [scl { {75 235} {70 235} {65 237} {56 240} {46 247} {38 266} {38 296} {38 333} {38 399} {38 475} {74 496} {105 472} {100 437} {65 423} {-100 -100} {38 505} {38 527 x} {38 591} }] if {$step >= [llength $pos]} { return 0 } set where [lindex $pos $step] MoveAbs $w I11 $where if {[lindex $where 2] eq "x"} { |
︙ | ︙ | |||
948 949 950 951 952 953 954 | set y1 645 for {set x 50} {$x > 20} {incr x -10} { set x1 [expr {$x - 5}] set x2 [expr {$x - 10}] lappend xy $x $y0 $x1 $y1 $x2 $y0 } $w.c create poly $xy -fill $::C(12) -outline $::C(fg) -smooth 1 -tag I12 \ | | | | | | | | < | < | | | | | | | | | | 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 | set y1 645 for {set x 50} {$x > 20} {incr x -10} { set x1 [expr {$x - 5}] set x2 [expr {$x - 10}] lappend xy $x $y0 $x1 $y1 $x2 $y0 } $w.c create poly $xy -fill $::C(12) -outline $::C(fg) -smooth 1 -tag I12 \ -width 2.25p } proc Move12 {w {step {}}} { set step [GetStep 12 $step] set pos [scl {{42 641 x}}] if {$step >= [llength $pos]} { return 0 } set where [lindex $pos $step] MoveAbs $w I12 $where if {[lindex $where 2] eq "x"} { return 3 } return 1 } # Fax proc Draw13 {w} { set color $::C(13a) set xy {86 663 149 663 149 704 50 704 50 681 64 681 86 671} set xy2 {784 663 721 663 721 704 820 704 820 681 806 681 784 671} set radii {2 9 9 8 5 5 2} RoundPoly $w.c $xy $radii -width 2.25p -outline $::C(fg) -fill $color RoundPoly $w.c $xy2 $radii -width 2.25p -outline $::C(fg) -fill $color set xy {56 677} $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 2.25p \ -tag I13 set xy {809 677} $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 2.25p \ -tag I13R set xy {112 687} ;# Label $w.c create text $xy -text "FAX" -fill $::C(fg) -font {Times 12 bold} set xy {762 687} $w.c create text $xy -text "FAX" -fill $::C(fg) -font {Times 12 bold} set xy {138 663 148 636 178 636} ;# Paper guide $w.c create line $xy -smooth 1 -fill $::C(fg) -width 2.25p set xy {732 663 722 636 692 636} $w.c create line $xy -smooth 1 -fill $::C(fg) -width 2.25p Sine $w 149 688 720 688 5 15 -tag I13_s -fill $::C(fg) -width 2.25p } proc Move13 {w {step {}}} { set step [GetStep 13 $step] set numsteps 7 if {$step == $numsteps+2} { MoveAbs $w I13_star {-100 -100} $w.c itemconfig I13R -fill $::C(13b) -width 1.5p return 2 } if {$step == 0} { ;# Button down $w.c delete I13 Sparkle $w {-100 -100} I13_star ;# Create off screen return 1 } lassign [Anchor $w I13_s w] x0 y0 lassign [Anchor $w I13_s e] x1 y1 set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}] MoveAbs $w I13_star [list $x $y0] return 1 } # Paper in fax proc Draw14 {w} { set color $::C(14) set xy {102 661 113 632 130 618} ;# Left paper edge $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14L_0 set xy {148 629 125 640 124 662} ;# Right paper edge $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14L_1 Draw14a $w L set xy { 768.0 662.5 767.991316225 662.433786215 767.926187912 662.396880171 } $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14R_0 $w.c lower I14R_0 # NB. these numbers are VERY sensitive, you must start with final size # and shrink down to get the values set xy { 745.947897349 662.428358855 745.997829056 662.452239237 746.0 662.5 } $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14R_1 $w.c lower I14R_1 } proc Draw14a {w side} { set color $::C(14) set xy [$w.c coords I14${side}_0] set xy2 [$w.c coords I14${side}_1] lassign $xy x0 y0 x1 y1 x2 y2 lassign $xy2 x3 y3 x4 y4 x5 y5 set zz [concat \ $x0 $y0 $x0 $y0 $xy $x2 $y2 $x2 $y2 \ $x3 $y3 $x3 $y3 $xy2 $x5 $y5 $x5 $y5] $w.c delete I14$side $w.c create poly $zz -tag I14$side -smooth 1 -fill $color -outline $color \ -width 2.25p $w.c lower I14$side } proc Move14 {w {step {}}} { set step [GetStep 14 $step] # Paper going down set sc [expr {.9 - .05*$step}] |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | return [expr {$step == 10 ? 3 : 1}] } # Light beam proc Draw15 {w} { set color $::C(15a) set xy {824 599 824 585 820 585 829 585} | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | return [expr {$step == 10 ? 3 : 1}] } # Light beam proc Draw15 {w} { set color $::C(15a) set xy {824 599 824 585 820 585 829 585} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I15a set xy {789 599 836 643} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p set xy {778 610 788 632} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p set xy {766 617 776 625} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p set xy {633 600 681 640} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p set xy {635 567 657 599} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p set xy {765 557 784 583} $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p Sine $w 658 580 765 580 3 15 -tag I15_s -fill $::C(fg) -width 2.25p } proc Move15a {w} { set color $::C(15b) $w.c scale I15a [scl 824] [scl 599] 1 .3 ;# Button down set xy [scl {765 621 681 621}] $w.c create line $xy -dash "-" -width 2.25p -fill $color -tag I15 } proc Move15 {w {step {}}} { set step [GetStep 15 $step] set numsteps 6 if {$step == $numsteps+2} { MoveAbs $w I15_star {-100 -100} return 2 } if {$step == 0} { ;# Break the light beam Sparkle $w {-100 -100} I15_star set xy [scl {765 621 745 621}] $w.c coords I15 $xy return 1 } lassign [Anchor $w I15_s w] x0 y0 lassign [Anchor $w I15_s e] x1 y1 set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}] MoveAbs $w I15_star [list $x $y0] return 1 } # Bell proc Draw16 {w} { set color $::C(16) set xy {722 485 791 556} $w.c create rect $xy -fill {} -outline $::C(fg) -width 2.25p set xy [box 752 515 25] ;# Bell $w.c create oval $xy -fill $color -outline black -tag I16b -width 1.5p set xy [box 752 515 5] ;# Bell button $w.c create oval $xy -fill black -outline black -tag I16b set xy {784 523 764 549} ;# Clapper $w.c create line $xy -width 2.25p -tag I16c -fill $::C(fg) set xy [box 784 523 4] $w.c create oval $xy -fill $::C(fg) -outline $::C(fg) -tag I16d } proc Move16 {w {step {}}} { set step [GetStep 16 $step] # Note: we never stop lassign [scl {760 553}] Ox Oy if {$step & 1} { set beta 12 $w.c move I16b 2.25p 0 } else { set beta -12 $w.c move I16b -2.25p 0 } RotateItem $w I16c $Ox $Oy $beta RotateItem $w I16d $Ox $Oy $beta return [expr {$step == 1 ? 3 : 1}] } # Cat proc Draw17 {w} { set color $::C(17) set xy {584 556 722 556} $w.c create line $xy -fill $::C(fg) -width 2.25p set xy {584 485 722 485} $w.c create line $xy -fill $::C(fg) -width 2.25p set xy {664 523 717 549} ;# Body $w.c create arc $xy -outline $::C(fg) -fill $color -width 2.25p \ -style chord -start 128 -extent -260 -tag I17 set xy {709 554 690 543} ;# Paw $w.c create oval $xy -outline $::C(fg) -fill $color -width 2.25p -tag I17 set xy {657 544 676 555} $w.c create oval $xy -outline $::C(fg) -fill $color -width 2.25p -tag I17 set xy [box 660 535 15] ;# Lower face $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \ -start 150 -extent 240 -tag I17_ $w.c create arc $xy -outline {} -fill $color -width 0.75p -style chord \ -start 150 -extent 240 -tag I17_ set xy {674 529 670 513 662 521 658 521 650 513 647 529} ;# Ears $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ $w.c create poly $xy -fill $color -outline {} -width 0.75p -tag {I17_ I17_c} set xy {652 542 628 539} ;# Whiskers $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy {652 543 632 545} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy {652 546 632 552} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy {668 543 687 538} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w} set xy {668 544 688 546} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w} set xy {668 547 688 553} $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w} set xy {649 530 654 538 659 530} ;# Left eye $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17 set xy {671 530 666 538 661 530} ;# Right eye $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17 set xy {655 543 660 551 665 543} ;# Mouth $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17 } proc Move17 {w {step {}}} { set step [GetStep 17 $step] if {$step == 0} { $w.c delete I17 ;# Delete most of the cat set xy [scl {655 543 660 535 665 543}] ;# Mouth $w.c create line $xy -fill $::C(fg) -width 2.25p -smooth 1 -tag I17_ set xy [box [scl 654] [scl 530] [scl 4]] ;# Left eye $w.c create oval $xy -outline $::C(fg) -width 2.25p -fill {} -tag I17_ set xy [box [scl 666] [scl 530] [scl 4]] ;# Right eye $w.c create oval $xy -outline $::C(fg) -width 2.25p -fill {} -tag I17_ $w.c move I17_ 0 -15p ;# Move face up set xy [scl {652 528 652 554}] ;# Front leg $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy [scl {670 528 670 554}] ;# 2nd front leg $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy [scl { 675 506 694 489 715 513 715 513 715 513 716 525 716 525 716 525 706 530 695 530 679 535 668 527 668 527 668 527 675 522 676 517 677 512 }] ;# Body $w.c create poly $xy -fill [$w.c itemcget I17_c -fill] \ -outline $::C(fg) -width 2.25p -smooth 1 -tag I17_ set xy [scl {716 514 716 554}] ;# Back leg $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy [scl {694 532 694 554}] ;# 2nd back leg $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_ set xy [scl {715 514 718 506 719 495 716 488}] ;# Tail $w.c create line $xy -fill $::C(fg) -width 2.25p -smooth 1 -tag I17_ $w.c raise I17w ;# Make whiskers visible $w.c move I17_ -3.75p 0 ;# Move away from wall a bit return 2 } return 0 } # Sling shot proc Draw18 {w} { set color $::C(18) set xy {721 506 627 506} ;# Sling hold $w.c create line $xy -width 3p -fill $::C(fg) -tag I18 set xy {607 500 628 513} ;# Sling rock $w.c create oval $xy -fill $color -outline {} -tag I18a set xy {526 513 606 507 494 502} ;# Sling band $w.c create line $xy -fill $::C(fg) -width 3p -tag I18b set xy { 485 490 510 540 510 575 510 540 535 491 } ;# Sling $w.c create line $xy -fill $::C(fg) -width 4.5p } proc Move18 {w {step {}}} { set step [GetStep 18 $step] set pos [scl { {587 506} {537 506} {466 506} {376 506} {266 506 x} {136 506} {16 506} {-100 -100} }] set b(0) [scl {490 502 719 507 524 512}] ;# Band collapsing set b(1) [scl { 491 503 524 557 563 505 559 496 546 506 551 525 553 536 538 534 532 519 529 499 }] set b(2) [scl {491 503 508 563 542 533 551 526 561 539 549 550 530 500}] set b(3) [scl {491 503 508 563 530 554 541 562 525 568 519 544 530 501}] if {$step >= [llength $pos]} { return 0 } if {$step == 0} { $w.c delete I18 |
︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | # Water pipe proc Draw19 {w} { set color $::C(19) set xx {249 181 155 118 86 55 22 0} foreach {x1 x2} $xx { $w.c create rect $x1 453 $x2 467 -fill $color -outline {} -tag I19 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # Water pipe proc Draw19 {w} { set color $::C(19) set xx {249 181 155 118 86 55 22 0} foreach {x1 x2} $xx { $w.c create rect $x1 453 $x2 467 -fill $color -outline {} -tag I19 $w.c create line $x1 453 $x2 453 -fill $::C(fg) -width 0.75p;# Pipe top $w.c create line $x1 467 $x2 467 -fill $::C(fg) -width 0.75p;# Pipe btm } $w.c raise I11i set xy [box 168 460 16] ;# Bulge by the joint $w.c create oval $xy -fill $color -outline {} $w.c create arc $xy -outline $::C(fg) -width 0.75p -style arc \ -start 21 -extent 136 $w.c create arc $xy -outline $::C(fg) -width 0.75p -style arc \ -start -21 -extent -130 set xy {249 447 255 473} ;# First joint 26x6 $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy [box 257 433 34] ;# Bend up $w.c create arc $xy -outline {} -fill $color -width 0.75p \ -style pie -start 0 -extent -91 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 0 -extent -90 set xy [box 257 433 20] $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \ -style pie -start 0 -extent -92 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 0 -extent -90 set xy [box 257 421 34] ;# Bend left $w.c create arc $xy -outline {} -fill $color -width 0.75p \ -style pie -start 1 -extent 91 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 0 -extent 90 set xy [box 257 421 20] $w.c create arc $xy -outline {} -fill $::C(bg) -width 0.75p \ -style pie -start 0 -extent 90 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 0 -extent 90 set xy [box 243 421 34] ;# Bend down $w.c create arc $xy -outline {} -fill $color -width 0.75p \ -style pie -start 90 -extent 90 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 90 -extent 90 set xy [box 243 421 20] $w.c create arc $xy -outline {} -fill $::C(bg) -width 0.75p \ -style pie -start 90 -extent 90 $w.c create arc $xy -outline $::C(fg) -width 0.75p \ -style arc -start 90 -extent 90 set xy {270 427 296 433} ;# 2nd joint bottom $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy {270 421 296 427} ;# 2nd joint top $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy {249 382 255 408} ;# Third joint right $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy {243 382 249 408} ;# Third joint left $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy {203 420 229 426} ;# Last joint $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p set xy [box 168 460 6] ;# Handle joint $w.c create oval $xy -fill $::C(fg) -outline {} -tag I19a set xy {168 460 168 512} ;# Handle bar $w.c create line $xy -fill $::C(fg) -width 3.75p -tag I19b } proc Move19 {w {step {}}} { set step [GetStep 19 $step] set angles {30 30 30} if {$step == [llength $angles]} { return 2 } RotateItem $w I19b {*}[Centroid $w I19a] [lindex $angles $step] return 1 } # Water pouring proc Draw20 {w} { } proc Move20 {w {step {}}} { set step [GetStep 20 $step] set pos [scl {451 462 473 484 496 504 513 523 532}] set freq {20 40 40 40 40 40 40 40 40} set pos [scl { {451 20} {462 40} {473 40} {484 40} {496 40} {504 40} {513 40} {523 40} {532 40 x} }] if {$step >= [llength $pos]} { return 0 } $w.c delete I20 set where [lindex $pos $step] lassign $where y f H2O $w $y $f if {[lindex $where 2] eq "x"} { return 3 } return 1 } proc H2O {w y f} { set color $::C(20) $w.c delete I20 Sine $w [scl 208] [scl 428] [scl 208] $y 4 $f -tag {I20 I20s} \ -width 2.25p -fill $color -smooth 1 $w.c create line [$w.c coords I20s] -width 2.25p -fill $color -smooth 1 \ -tag {I20 I20a} $w.c create line [$w.c coords I20s] -width 2.25p -fill $color -smooth 1 \ -tag {I20 I20b} $w.c move I20a 6p 0 $w.c move I20b 12p 0 } # Bucket proc Draw21 {w} { set color $::C(21) set xy {217 451 244 490} ;# Right handle $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21_a set xy {201 467 182 490} ;# Left handle $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21_a set xy {245 490 237 535} ;# Right side set xy2 {189 535 181 490} ;# Left side $w.c create poly [concat $xy $xy2] -fill $color -outline {} \ -tag {I21 I21f} $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21 $w.c create line $xy2 -fill $::C(fg) -width 1.5p -tag I21 set xy {182 486 244 498} ;# Top $w.c create oval $xy -fill $color -outline {} -width 1.5p -tag {I21 I21f} $w.c create oval $xy -fill {} -outline $::C(fg) -width 1.5p -tag {I21 I21t} set xy {189 532 237 540} ;# Bottom $w.c create oval $xy -fill $color -outline $::C(fg) -width 1.5p \ -tag {I21 I21b} } proc Move21 {w {step {}}} { set step [GetStep 21 $step] set numsteps 30 if {$step >= $numsteps} { return 0 } lassign [$w.c coords I21b] x1 y1 x2 y2 #lassign [$w.c coords I21t] X1 Y1 X2 Y2 lassign [scl {183 492 243 504}] X1 Y1 X2 Y2 set f [expr {$step / double($numsteps)}] set y2 [expr {$y2 - [scl 3]}] set xx1 [expr {$x1 + ($X1 - $x1) * $f}] set yy1 [expr {$y1 + ($Y1 - $y1) * $f}] set xx2 [expr {$x2 + ($X2 - $x2) * $f}] set yy2 [expr {$y2 + ($Y2 - $y2) * $f}] #H2O $w $yy1 40 $w.c itemconfig I21b -fill $::C(20) |
︙ | ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | } # Bucket drop proc Draw22 {w} { } proc Move22 {w {step {}}} { set step [GetStep 22 $step] | | | 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 | } # Bucket drop proc Draw22 {w} { } proc Move22 {w {step {}}} { set step [GetStep 22 $step] set pos [scl {{213 513} {213 523} {213 543 x} {213 583} {213 593}}] if {$step == 0} {$w.c itemconfig I21f -fill $::C(22)} if {$step >= [llength $pos]} { return 0 } set where [lindex $pos $step] MoveAbs $w I21 $where |
︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 | # Blow dart proc Draw23 {w} { set color $::C(23a) set color2 $::C(23b) set color3 $::C(23c) set xy {185 623 253 650} ;# Block | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # Blow dart proc Draw23 {w} { set color $::C(23a) set color2 $::C(23b) set color3 $::C(23c) set xy {185 623 253 650} ;# Block $w.c create rect $xy -fill black -outline $::C(fg) -width 1.5p -tag I23a set xy {187 592 241 623} ;# Balloon $w.c create oval $xy -outline {} -fill $color -tag I23b $w.c create arc $xy -outline $::C(fg) -width 2.25p -tag I23b \ -style arc -start 12 -extent 336 set xy {239 604 258 589 258 625 239 610} ;# Balloon nozzle $w.c create poly $xy -outline {} -fill $color -tag I23b $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23b set xy {285 611 250 603} ;# Dart body $w.c create oval $xy -fill $color2 -outline $::C(fg) -width 2.25p -tag I23d set xy {249 596 249 618 264 607 249 596} ;# Dart tail $w.c create poly $xy -fill $color3 -outline $::C(fg) -width 2.25p -tag I23d set xy {249 607 268 607} ;# Dart detail $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23d set xy {285 607 305 607} ;# Dart needle $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23d } proc Move23 {w {step {}}} { set step [GetStep 23 $step] set pos [scl { {277 607} {287 607} {307 607 x} {347 607} {407 607} {487 607} {587 607} {687 607} {787 607} {-100 -100} }] if {$step >= [llength $pos]} { return 0 } if {$step <= 1} { $w.c scale I23b {*}[Anchor $w I23a n] .9 .5 } set where [lindex $pos $step] MoveAbs $w I23d $where if {[lindex $where 2] eq "x"} { return 3 } return 1 } # Balloon proc Draw24 {w} { set color $::C(24a) set xy {366 518 462 665} ;# Balloon $w.c create oval $xy -fill $color -outline $::C(fg) -width 2.25p -tag I24 set xy {414 666 414 729} ;# String $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I24 set xy {410 666 404 673 422 673 418 666} ;# Nozzle $w.c create poly $xy -fill $color -outline $::C(fg) -width 2.25p -tag I24 set xy {387 567 390 549 404 542} ;# Reflections $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24 set xy {395 568 399 554 413 547} $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24 set xy {403 570 396 555 381 553} $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24 set xy {408 564 402 547 386 545} $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24 } proc Move24 {w {step {}}} { global S Dims set step [GetStep 24 $step] if {$step > 4} { return 0 } elseif {$step == 4} { return 2 } if {$step == 0} { $w.c delete I24 ;# Exploding balloon set xy [scl { 347 465 361 557 271 503 272 503 342 574 259 594 259 593 362 626 320 737 320 740 398 691 436 738 436 739 476 679 528 701 527 702 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 7.5p -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 18 bold} return 1 } $w.c itemconfig I24t -font [list Times [expr {18 + 6*$step}] bold] $w.c move I24 $Dims(MovX) $Dims(MovY) $w.c scale I24 {*}[Centroid $w I24] 1.25 1.25 return 1 } # Displaying the message proc Move25 {w {step {}}} { global S |
︙ | ︙ | |||
1609 1610 1611 1612 1613 1614 1615 | return 1 } return 2 } # Collapsing balloon proc Move26 {w {step {}}} { | | | | | | | 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 | return 1 } return 2 } # Collapsing balloon proc Move26 {w {step {}}} { global S Dims set step [GetStep 26 $step] if {$step >= 3} { $w.c delete I24 I26 $w.c create text $Dims(MsgX) $Dims(MsgY) -anchor s -tag I26 \ -fill $::C(26) -text "click to continue" -font {Times 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 45p $w.c itemconfig I24t -font [list Times [expr {30 - 6*$step}] bold] return 1 } ################################################################ # # Helper functions # |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | } elseif {[string match *e* $where]} { set x $x2 } else { set x [expr {($x1 + $x2) / 2.0}] } return [list $x $y] } DoDisplay $w Reset $w Go $w ;# Start everything going | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } elseif {[string match *e* $where]} { set x $x2 } else { set x [expr {($x1 + $x2) / 2.0}] } return [list $x $y] } proc scl {lst} { global scaleFactor set lst2 {} foreach elem $lst { set elem2 {} set idx 0 foreach val $elem { if {$idx < 2} { set val [expr {round($val * $scaleFactor)}] } lappend elem2 $val incr idx } lappend lst2 $elem2 } return $lst2 } # Simple placed dialog - stacked dialogs are not allowed, # the command does nothing if another grab already exists. proc PlacedDialog {w msg {labelFnt {Helvetica 10}}} { if {[grab current] ne {}} { return } destroy $w frame $w -relief raised -bd 3p label $w.lab -font $labelFnt -wraplength 3i -justify left -text $msg ttk::button $w.but -text "OK" -underline 0 \ -command [list ClosePlacedDialog $w] foreach key {Escape Return o O} { bind $w.but "<KeyPress-${key}>" { ClosePlacedDialog [winfo parent %W] } } foreach child {{} .but .lab} { bind $w$child <<NextWindow>> break bind $w$child <<PrevWindow>> break } pack $w.lab -padx 10p -pady {10p 5p} pack $w.but -padx 10p -pady {0p 10p} place $w -anchor center -relx 0.5 -rely 0.5 set tl [winfo toplevel $w] set ::PlacedDialogOldFocus [focus -lastfor $tl] focus $w.but grab set $w return } proc ClosePlacedDialog {w} { set tl [winfo toplevel $w] if {![winfo exists $::PlacedDialogOldFocus]} { set ::PlacedDialogOldFocus $tl } focus $::PlacedDialogOldFocus set ::PlacedDialogOldFocus {} grab release $w destroy $w return } DoDisplay $w Reset $w Go $w ;# Start everything going StartMessage $w ;# Message box at startup |
Changes to library/demos/hello.
1 2 3 4 5 6 7 8 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # hello -- # Simple Tk script to create a button that prints "Hello, world". # Click on the button to terminate the program. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # hello -- # Simple Tk script to create a button that prints "Hello, world". # Click on the button to terminate the program. package require tk # The first line below creates the button, and the second line # asks the packer to shrink-wrap the application's main window # around the button. button .hello -text "Hello, world" -command { puts stdout "Hello, world"; destroy . |
︙ | ︙ |
Changes to library/demos/hscale.tcl.
1 2 3 4 5 6 7 8 | # hscale.tcl -- # # This demonstration script shows an example with a horizontal scale. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # hscale.tcl -- # # This demonstration script shows an example with a horizontal scale. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .hscale catch {destroy $w} toplevel $w wm title $w "Horizontal Scale Demonstration" wm iconname $w "hscale" positionWindow $w label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the length of the arrow." pack $w.msg -side top -padx .5c ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.frame -borderwidth 7.5p pack $w.frame -side top -fill x canvas $w.frame.canvas -width 37.5p -height 37.5p -bd 0 -highlightthickness 0 $w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line scale $w.frame.scale -orient horizontal -length 213p -from 0 -to 250 \ -command "setWidth $w.frame.canvas" -tickinterval 50 pack $w.frame.canvas -side top -expand yes -anchor s -fill x -padx 12p pack $w.frame.scale -side bottom -expand yes -anchor n $w.frame.scale set 75 proc setWidth {w width} { incr width 21 set x2 [expr {$width - 30}] if {$x2 < 21} { set x2 21 } $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15 $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15 set scaleFactor [expr {$tk::scalingPct / 100.0}] $w scale poly 0 0 $scaleFactor $scaleFactor $w scale line 0 0 $scaleFactor $scaleFactor } |
Changes to library/demos/icon.tcl.
1 2 3 4 5 6 7 8 9 | # icon.tcl -- # # This demonstration script creates a toplevel window containing # buttons that display bitmaps instead of text. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # icon.tcl -- # # This demonstration script creates a toplevel window containing # buttons that display bitmaps instead of text. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .icon catch {destroy $w} toplevel $w wm title $w "Iconic Button Demonstration" wm iconname $w "icon" positionWindow $w |
︙ | ︙ | |||
26 27 28 29 30 31 32 | # Main widget program sets variable tk_demoDirectory image create bitmap flagup \ -file [file join $tk_demoDirectory images flagup.xbm] \ -maskfile [file join $tk_demoDirectory images flagup.xbm] image create bitmap flagdown \ -file [file join $tk_demoDirectory images flagdown.xbm] \ -maskfile [file join $tk_demoDirectory images flagdown.xbm] | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # Main widget program sets variable tk_demoDirectory image create bitmap flagup \ -file [file join $tk_demoDirectory images flagup.xbm] \ -maskfile [file join $tk_demoDirectory images flagup.xbm] image create bitmap flagdown \ -file [file join $tk_demoDirectory images flagdown.xbm] \ -maskfile [file join $tk_demoDirectory images flagdown.xbm] frame $w.frame -borderwidth 7.5p pack $w.frame -side top checkbutton $w.frame.b1 -image flagdown -selectimage flagup \ -indicatoron 0 $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background] checkbutton $w.frame.b2 \ -bitmap @[file join $tk_demoDirectory images letters.xbm] \ |
︙ | ︙ |
Changes to library/demos/image1.tcl.
1 2 3 4 5 6 7 8 | # image1.tcl -- # # This demonstration script displays two image widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # image1.tcl -- # # This demonstration script displays two image widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .image1 catch {destroy $w} toplevel $w wm title $w "Image Demonstration #1" wm iconname $w "Image1" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration displays two images, each in a separate label widget." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Main widget program sets variable tk_demoDirectory catch {image delete image1a} image create photo image1a -file [file join $tk_demoDirectory images earth.gif] catch {image delete image1b} image create photo image1b \ -file [file join $tk_demoDirectory images earthris.gif] # Create copies of the images just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copies will only be effectively magnified if $tk::scalingPct >= 200. set zoomFactor [expr {$tk::scalingPct / 100}] image create photo image1a2 image1a2 copy image1a -zoom $zoomFactor image create photo image1b2 image1b2 copy image1b -zoom $zoomFactor label $w.l1 -image image1a2 -bd 1 -relief sunken label $w.l2 -image image1b2 -bd 1 -relief sunken pack $w.l1 $w.l2 -side top -padx .5m -pady .5m |
Changes to library/demos/image2.tcl.
1 2 3 4 5 6 7 8 9 | # image2.tcl -- # # This demonstration script creates a simple collection of widgets # that allow you to select and view images in a Tk label. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # image2.tcl -- # # This demonstration script creates a simple collection of widgets # that allow you to select and view images in a Tk label. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # loadDir -- # This procedure reloads the directory listbox from the directory # named in the demo's entry. # # Arguments: # w - Name of the toplevel window of the demo. |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 | # w - Name of the toplevel window of the demo. # x, y- Mouse position within the listbox. proc loadImage {w x y} { global dirName set file [file join $dirName [$w.f.list get @$x,$y]] if {[catch { | > > > > > > | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # w - Name of the toplevel window of the demo. # x, y- Mouse position within the listbox. proc loadImage {w x y} { global dirName set file [file join $dirName [$w.f.list get @$x,$y]] set opts [list -file $file] if {[string tolower [file extension $file]] eq ".svg"} { lappend opts -format $tk::svgFmt } else { lappend opts -format {} } if {[catch { image2a configure {*}$opts }]} then { # Mark the file as not loadable $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000 } } set w .image2 |
︙ | ︙ | |||
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 | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | 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 grid $w.dir - -sticky ew -padx 1m -pady 1m -in $w.mid grid $w.f $w.image -sticky nw -padx 1m -pady 1m -in $w.mid grid columnconfigure $w.mid 1 -weight 1 |
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
Changes to library/demos/items.tcl.
1 2 3 4 5 6 7 8 9 | # items.tcl -- # # This demonstration script creates a canvas that displays the # canvas item types. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # items.tcl -- # # This demonstration script creates a canvas that displays the # canvas item types. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .items catch {destroy $w} toplevel $w wm title $w "Canvas Item Demonstration" wm iconname $w "Items" positionWindow $w |
︙ | ︙ | |||
28 29 30 31 32 33 34 | pack $w.frame -side top -fill both -expand yes canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \ -relief sunken -borderwidth 2 \ -xscrollcommand "$w.frame.hscroll set" \ -yscrollcommand "$w.frame.vscroll set" ttk::scrollbar $w.frame.vscroll -command "$c yview" | | > > > > > > > | | | | | | 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 | pack $w.frame -side top -fill both -expand yes canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \ -relief sunken -borderwidth 2 \ -xscrollcommand "$w.frame.hscroll set" \ -yscrollcommand "$w.frame.vscroll set" ttk::scrollbar $w.frame.vscroll -command "$c yview" ttk::scrollbar $w.frame.hscroll -orient horizontal -command "$c xview" bind $c <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0 || $deltaY != 0} { tk::ScrollByPixels %W $deltaX $deltaY } } grid $c -in $w.frame \ -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news grid $w.frame.vscroll \ -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news grid $w.frame.hscroll \ -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news grid rowconfig $w.frame 0 -weight 1 -minsize 0 grid columnconfig $w.frame 0 -weight 1 -minsize 0 # Display a 3x3 rectangular grid. $c create rect 0c 0c 30c 24c -width 1.5p $c create line 0c 8c 30c 8c -width 1.5p $c create line 0c 16c 30c 16c -width 1.5p $c create line 10c 0c 10c 24c -width 1.5p $c create line 20c 0c 20c 24c -width 1.5p set font1 {Helvetica 12} set font2 {Helvetica 24 bold} if {[winfo depth $c] > 1} { set blue DeepSkyBlue3 set red red set bisque bisque3 |
︙ | ︙ | |||
70 71 72 73 74 75 76 | $c create text 5c .2c -text Lines -anchor n $c create line 1c 1c 3c 1c 1c 4c 3c 4c -width 2m -fill $blue \ -cap butt -join miter -tags item $c create line 4.67c 1c 4.67c 4c -arrow last -tags item $c create line 6.33c 1c 6.33c 4c -arrow both -tags item $c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \ 8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \ | | | | | 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 | $c create text 5c .2c -text Lines -anchor n $c create line 1c 1c 3c 1c 1c 4c 3c 4c -width 2m -fill $blue \ -cap butt -join miter -tags item $c create line 4.67c 1c 4.67c 4c -arrow last -tags item $c create line 6.33c 1c 6.33c 4c -arrow both -tags item $c create line 5c 6c 9c 6c 9c 1c 8c 1c 8c 4.8c 8.8c 4.8c 8.8c 1.2c \ 8.2c 1.2c 8.2c 4.6c 8.6c 4.6c 8.6c 1.4c 8.4c 1.4c 8.4c 4.4c \ -width 2.25p -fill $red -tags item # Main widget program sets variable tk_demoDirectory $c create line 1c 5c 7c 5c 7c 7c 9c 7c -width .5c \ -stipple @[file join $tk_demoDirectory images gray25.xbm] \ -arrow both -arrowshape {15 15 7} -tags item $c create line 1c 7c 1.75c 5.8c 2.5c 7c 3.25c 5.8c 4c 7c -width .5c \ -cap round -join round -tags item $c create text 15c .2c -text "Curves (smoothed lines)" -anchor n $c create line 11c 4c 11.5c 1c 13.5c 1c 14c 4c -smooth on \ -fill $blue -tags item $c create line 15.5c 1c 19.5c 1.5c 15.5c 4.5c 19.5c 4c -smooth on \ -arrow both -width 2.25p -tags item $c create line 12c 6c 13.5c 4.5c 16.5c 7.5c 18c 6c \ 16.5c 4.5c 13.5c 7.5c 12c 6c -smooth on -width 3m -cap round \ -stipple @[file join $tk_demoDirectory images gray25.xbm] \ -fill $red -tags item $c create text 25c .2c -text Polygons -anchor n $c create polygon 21c 1.0c 22.5c 1.75c 24c 1.0c 23.25c 2.5c \ 24c 4.0c 22.5c 3.25c 21c 4.0c 21.75c 2.5c -fill $green \ -outline {} -width 3p -tags item $c create polygon 25c 4c 25c 4c 25c 1c 26c 1c 27c 4c 28c 1c \ 29c 1c 29c 4c 29c 4c -fill $red -outline {} -smooth on -tags item $c create polygon 22c 4.5c 25c 4.5c 25c 6.75c 28c 6.75c \ 28c 5.25c 24c 5.25c 24c 6.0c 26c 6c 26c 7.5c 22c 7.5c \ -stipple @[file join $tk_demoDirectory images gray25.xbm] \ -fill $blue -outline {} -tags item |
︙ | ︙ | |||
144 145 146 147 148 149 150 | $c create text 15c 16.2c -text "Bitmaps and Images" -anchor n catch { image create photo items.ousterhout \ -file [file join $tk_demoDirectory images ouster.png] image create photo items.ousterhout.active -format "png -alpha 0.5" \ -file [file join $tk_demoDirectory images ouster.png] | > > > > > | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | $c create text 15c 16.2c -text "Bitmaps and Images" -anchor n catch { image create photo items.ousterhout \ -file [file join $tk_demoDirectory images ouster.png] image create photo items.ousterhout.active -format "png -alpha 0.5" \ -file [file join $tk_demoDirectory images ouster.png] set zoomFactor [expr {$tk::scalingPct / 100}] foreach img {items.ousterhout items.ousterhout.active} { image create photo ${img}2 ${img}2 copy $img -zoom $zoomFactor } $c create image 13c 20c -tags item -image items.ousterhout2 \ -activeimage items.ousterhout.active2 } $c create bitmap 17c 18.5c -tags item \ -bitmap @[file join $tk_demoDirectory images noletter.xbm] $c create bitmap 17c 21.5c -tags item \ -bitmap @[file join $tk_demoDirectory images letters.xbm] $c create text 25c 16.2c -text Windows -anchor n |
︙ | ︙ | |||
169 170 171 172 173 174 175 | $c create text 21c 20.9c -text Entry: -anchor sw $c create text 28.5c 17.4c -text Scale: -anchor s # Set up event bindings for canvas: $c bind item <Enter> "itemEnter $c" $c bind item <Leave> "itemLeave $c" | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | $c create text 21c 20.9c -text Entry: -anchor sw $c create text 28.5c 17.4c -text Scale: -anchor s # Set up event bindings for canvas: $c bind item <Enter> "itemEnter $c" $c bind item <Leave> "itemLeave $c" if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { bind $c <Button-2> "itemMark $c %x %y" bind $c <B2-Motion> "itemStroke $c %x %y" bind $c <Button-3> "$c scan mark %x %y" bind $c <B3-Motion> "$c scan dragto %x %y" } else { bind $c <Button-2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" |
︙ | ︙ |
Changes to library/demos/ixset.
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # ixset -- # A nice interface to "xset" to change X server settings # # History : # 91/11/23 : [email protected], [email protected] : design # 92/08/01 : [email protected] : cleaning | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # ixset -- # A nice interface to "xset" to change X server settings # # History : # 91/11/23 : [email protected], [email protected] : design # 92/08/01 : [email protected] : cleaning package require tk # # Button actions # proc quit {} { destroy . |
︙ | ︙ | |||
189 190 191 192 193 194 195 | button .buttons.apply -default normal -command apply -text "Apply" \ -state disabled button .buttons.cancel -default normal -command cancel -text "Cancel" \ -state disabled button .buttons.quit -default normal -command quit -text "Quit" pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \ | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | button .buttons.apply -default normal -command apply -text "Apply" \ -state disabled button .buttons.cancel -default normal -command cancel -text "Cancel" \ -state disabled button .buttons.quit -default normal -command quit -text "Quit" pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \ -side left -expand yes -pady 3p bind . <Return> {.buttons.ok flash; .buttons.ok invoke} bind . <Escape> {.buttons.quit flash; .buttons.quit invoke} bind . <Button-1> { if {![string match .buttons* %W]} { .buttons.apply configure -state normal .buttons.cancel configure -state normal |
︙ | ︙ | |||
217 218 219 220 221 222 223 | # # Bell settings # labelframe .bell -text "Bell Settings" -padx 1.5m -pady 1.5m scale .bell.vol \ | | | | | | | 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 | # # Bell settings # labelframe .bell -text "Bell Settings" -padx 1.5m -pady 1.5m scale .bell.vol \ -from 0 -to 100 -length 150p -tickinterval 20 \ -label "Volume (%)" -orient horizontal frame .bell.val labelentry .bell.val.pit "Pitch (Hz)" 6 {25 20000} labelentry .bell.val.dur "Duration (ms)" 6 {1 10000} pack .bell.val.pit -side left -padx 3p pack .bell.val.dur -side right -padx 3p pack .bell.vol .bell.val -side top -expand yes # # Keyboard settings # labelframe .kbd -text "Keyboard Repeat Settings" -padx 1.5m -pady 1.5m frame .kbd.val checkbutton .kbd.val.onoff \ -text "On" \ -onvalue "on" -offvalue "off" -variable kbdrep \ -relief flat scale .kbd.val.cli \ -from 0 -to 100 -length 150p -tickinterval 20 \ -label "Click Volume (%)" -orient horizontal pack .kbd.val.onoff -side left -fill x -expand yes -padx {0 1m} pack .kbd.val.cli -side left -expand yes -fill x -padx {1m 0} pack .kbd.val -side top -expand yes -pady 1.5p -fill x # # Mouse settings # labelframe .mouse -text "Mouse Settings" -padx 1.5m -pady 1.5m |
︙ | ︙ |
Changes to library/demos/knightstour.tcl.
︙ | ︙ | |||
17 18 19 20 21 22 23 | # If the call to the Edgemost function is commented out you can see # this occur. # # You can drag the knight to a specific square to start if you wish. # If you let it repeat then it will choose random start positions # for each new tour. | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # If the call to the Edgemost function is commented out you can see # this occur. # # You can drag the knight to a specific square to start if you wish. # If you let it repeat then it will choose random start positions # for each new tour. package require tk # Return a list of accessible squares from a given square proc ValidMoves {square} { set moves {} foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} { set col [expr {($square % 8) + [lindex $pair 0]}] set row [expr {($square / 8) + [lindex $pair 1]}] |
︙ | ︙ | |||
77 78 79 80 81 82 83 | set rowA [expr {3-int(abs(3.5-($a/8)))}] set rowB [expr {3-int(abs(3.5-($b/8)))}] return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}] } # Display a square number as a standard chess square notation. proc N {square} { | | < > | | | | 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 | set rowA [expr {3-int(abs(3.5-($a/8)))}] set rowB [expr {3-int(abs(3.5-($b/8)))}] return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}] } # Display a square number as a standard chess square notation. proc N {square} { return [format %c%d [expr {97 + $square % 8}] [expr {$square / 8 + 1}]] } # Perform a Knight's move and schedule the next move. proc MovePiece {dlg last square} { variable visited variable delay variable continuous set line [format "%2d. %s .. %s" [llength $visited] [N $last] [N $square]] $dlg.f.txt insert end $line\n $dlg.f.txt see end $dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black $dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red $dlg.f.c moveto knight {*}[lrange [$dlg.f.c coords [expr {1+$square}]] 0 1] lappend visited $square set next [Next $square] if {$next ne -1} { variable aid [after $delay [list MovePiece $dlg $square $next]] } else { $dlg.tf.b1 configure -state normal if {[llength $visited] == 64} { variable initial if {$initial == $square} { $dlg.f.txt insert end "Closed tour!" } else { $dlg.f.txt insert end "Success" if {$continuous} { after [expr {$delay * 2}] [namespace code \ [list Tour $dlg [expr {int(rand() * 64)}]]] } } } else { $dlg.f.txt insert end "FAILED!" } } } # Begin a new tour of the board given a random start position proc Tour {dlg {square {}}} { variable visited {} |
︙ | ︙ | |||
141 142 143 144 145 146 147 | proc Exit {dlg} { Stop destroy $dlg } proc SetDelay {new} { | > | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | proc Exit {dlg} { Stop destroy $dlg } proc SetDelay {new} { variable speed [expr {int($new)}] variable delay [expr {2000 - $speed}] } proc DragStart {w x y} { $w dtag selected $w addtag selected withtag current variable dragging [list $x $y] } |
︙ | ︙ | |||
167 168 169 170 171 172 173 | $w dtag selected variable dragging ; unset dragging } proc CreateGUI {} { catch {destroy .knightstour} set dlg [toplevel .knightstour] | | | | | > | | < | | | > | > | > | | | > > | | | 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 | $w dtag selected variable dragging ; unset dragging } proc CreateGUI {} { catch {destroy .knightstour} set dlg [toplevel .knightstour] wm title $dlg "Knight's Tour" wm withdraw $dlg set f [ttk::frame $dlg.f] set c [canvas $f.c -width 192p -height 192p] text $f.txt -width 12 -height 1 -padx 3p \ -yscrollcommand [list $f.vs set] -font TkFixedFont ttk::scrollbar $f.vs -command [list $f.txt yview] variable speed 1400 variable delay [expr {2000 - $speed}] variable continuous 0 ttk::frame $dlg.tf ttk::checkbutton $dlg.tf.cc -text Repeat \ -variable [namespace which -variable continuous] ttk::scale $dlg.tf.sc -from 0 -to 1992 -command [list SetDelay] \ -variable [namespace which -variable speed] ttk::label $dlg.tf.ls -text Speed ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg] ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg] set square 0 for {set row 7} {$row >= 0} {incr row -1} { for {set col 0} {$col < 8} {incr col} { if {(($col & 1) ^ ($row & 1))} { set fill tan3 ; set dfill tan4 } else { set fill bisque ; set dfill bisque3 } set coords [list [expr {$col * 24 + 3}]p \ [expr {$row * 24 + 3}]p \ [expr {$col * 24 + 24}]p \ [expr {$row * 24 + 24}]p] $c create rectangle $coords -fill $fill -disabledfill $dfill \ -width 1.5p -state disabled -outline black } } if {[tk windowingsystem] ne "x11"} { catch {eval font create KnightFont -size 18} $c create text 0 0 -font KnightFont -text "♞" \ -anchor nw -tags knight -fill black -activefill "#600000" } else { # On X11 we cannot reliably tell if the ♞ glyph is available # so just use a polygon set pts { 2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16 2 17 4 14 5 15 3 17 5 17 9 14 10 15 5 21 } $c create polygon $pts -tag knight -offset 8 \ -fill black -activefill "#600000" set scaleFactor [expr {$tk::scalingPct / 100.0}] $c scale knight 0 0 $scaleFactor $scaleFactor } $c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1] $c bind knight <Button-1> [namespace code [list DragStart %W %x %y]] $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]] $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]] grid $c $f.txt $f.vs -sticky news grid rowconfigure $f 0 -weight 1 grid columnconfigure $f 1 -weight 1 grid $f - - - - - -sticky news set things [list $dlg.tf.cc $dlg.tf.sc $dlg.tf.ls $dlg.tf.b1] if {![info exists ::widgetDemo]} { lappend things $dlg.tf.b2 if {[tk windowingsystem] ne "aqua"} { set things [linsert $things 0 [ttk::sizegrip $dlg.tf.sg]] } } pack {*}$things -side right -padx 3p if {[tk windowingsystem] eq "aqua"} { pack configure {*}$things -padx {4 4} -pady {12 12} pack configure [lindex $things 0] -padx {4 24} pack configure [lindex $things end] -padx {16 4} } grid $dlg.tf - - - - - -sticky ew if {[info exists ::widgetDemo]} { |
︙ | ︙ |
Changes to library/demos/label.tcl.
1 2 3 4 5 6 7 8 9 | # label.tcl -- # # This demonstration script creates a toplevel window containing # several label widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # label.tcl -- # # This demonstration script creates a toplevel window containing # several label widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .label catch {destroy $w} toplevel $w wm title $w "Label Demonstration" wm iconname $w "label" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right. Labels are pretty boring because you can't do anything with them." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.left frame $w.right pack $w.left $w.right -side left -expand yes -padx 7.5p -pady 7.5p -fill both label $w.left.l1 -text "First label" label $w.left.l2 -text "Second label, raised" -relief raised label $w.left.l3 -text "Third label, sunken" -relief sunken pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 1.5p -anchor w # Main widget program sets variable tk_demoDirectory image create photo label.ousterhout \ -file [file join $tk_demoDirectory images ouster.png] # Create a copy of the image just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copy will only be effectively magnified if $tk::scalingPct >= 200. image create photo label.ousterhout2 label.ousterhout2 copy label.ousterhout -zoom [expr {$tk::scalingPct / 100}] label $w.right.picture -borderwidth 2 -relief sunken -image label.ousterhout2 label $w.right.caption -text "Tcl/Tk Creator" pack $w.right.picture $w.right.caption -side top |
Changes to library/demos/labelframe.tcl.
1 2 3 4 5 6 7 8 9 | # labelframe.tcl -- # # This demonstration script creates a toplevel window containing # several labelframe widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # labelframe.tcl -- # # This demonstration script creates a toplevel window containing # several labelframe widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .labelframe catch {destroy $w} toplevel $w wm title $w "Labelframe Demonstration" wm iconname $w "labelframe" positionWindow $w |
︙ | ︙ | |||
31 32 33 34 35 36 37 | frame $w.f pack $w.f -side bottom -fill both -expand 1 set w $w.f # A group of radiobuttons in a labelframe | | | | | | 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 | frame $w.f pack $w.f -side bottom -fill both -expand 1 set w $w.f # A group of radiobuttons in a labelframe labelframe $w.f -text "Value" -padx 1.5p -pady 1.5p grid $w.f -row 0 -column 0 -pady 2m -padx 2m foreach value {1 2 3 4} { radiobutton $w.f.b$value -text "This is value $value" \ -variable lfdummy -value $value pack $w.f.b$value -side top -fill x -pady 1.5p } # Using a label window to control a group of options. proc lfEnableButtons {w} { foreach child [winfo children $w] { if {$child == "$w.cb"} continue if {$::lfdummy2} { $child configure -state normal } else { $child configure -state disabled } } } labelframe $w.f2 -pady 1.5p -padx 1.5p checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \ -command "lfEnableButtons $w.f2" -padx 0 $w.f2 configure -labelwidget $w.f2.cb grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m set t 0 foreach str {Option1 Option2 Option3} { checkbutton $w.f2.b$t -text $str pack $w.f2.b$t -side top -fill x -pady 1.5p incr t } lfEnableButtons $w.f2 grid columnconfigure $w {0 1} -weight 1 |
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 | # 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." } 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 20 -height 20 image create nsimage remove -source NSRemoveTemplate -width 18 -height 4 # 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 {2 0}] -side left pack [ttk::button $buttonFrame.gradient.remove -style GradientButton \ -image remove -padding {2 8}] -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 { [wm attributes $w -isdark] } { $dark state selected } else { $light state selected } proc beLight {f w} { wm attributes $w -appearance aqua $f.dark state !selected $f.light state selected after 10 $f.light state !hover } proc beDark {f w} { wm attributes $w -appearance 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 |
Added library/demos/mac_tabs.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 | # mac_tabs.tcl -- # # This demonstration script creates three tabbable windows and allows the # wm attributes tabbingid and tabbingmode to be manipulated for the third # window, to demonstrate the effects of those attributes. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk catch {font create giant -family {Times New Roman} -size 64} set w .mac_tabs catch {destroy $w} toplevel $w wm title $w "Tabbed Windows in Aqua" wm iconname $w "mac_tabs" positionWindow $w set suffix 0 set winlist {} ## ## See Code / Dismiss pack [addSeeDismiss $w.buttons $w] -side bottom -fill x ## set info "\ This demo shows 3 toplevels, A, B, and C. \ Each of these has tabbingmode set to preferred. \ The tabbingid of Window A is groupA, the \ tabbingid of Window B is groupB and the tabbingid \ of Window C is groupC. Use the menubuttons below \ to see the effect of changing the tabbingid and \ tabbingmode attributes for Window C. \ " pack [message $w.info -text $info -width 300] wm geometry $w +450+350 ttk::frame $w.f menu $w.idmenu -tearoff 0 foreach id {groupA groupB groupC} { $w.idmenu add command -label $id \ -command [list wm attributes $w.c -tabbingid $id] } menu $w.modemenu -tearoff 0 foreach mode {auto preferred disallowed} { $w.modemenu add command -label $mode \ -command [list wm attributes $w.c -tabbingmode $mode] } ttk::menubutton $w.f.idbutton -menu $w.idmenu -text "tabbingid"\ -direction below grid $w.f.idbutton -row 0 -column 0 ttk::menubutton $w.f.modebutton -menu $w.modemenu -text "tabbingmode"\ -direction below grid $w.f.modebutton -row 1 -column 0 pack $w.f wm attributes $w.a -tabbingid groupA wm attributes $w.a -tabbingmode preferred toplevel $w.a wm geometry $w.a +50+100 wm title $w.a "Window A" pack [ttk::label $w.a.l -text A -font giant] -padx 100 -pady 30 wm attributes $w.b -tabbingid groupB wm attributes $w.b -tabbingmode preferred toplevel $w.b wm geometry $w.b +400+100 wm title $w.b "Window B" pack [ttk::label $w.b.l -text B -font giant] -padx 100 -pady 30 wm attributes $w.c -tabbingid groupC wm attributes $w.c -tabbingmode preferred toplevel $w.c wm geometry $w.c +750+100 wm title $w.c "Window C" pack [ttk::label $w.c.l -text C -font giant] -padx 100 -pady 30 |
Added library/demos/mac_wm.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 | # mac_window_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_wm catch {destroy $w} toplevel $w wm title $w "Tk Aqua Window Styles" wm iconname $w "mac_wm" positionWindow $w set suffix 0 set winlist {} ## ## See Code / Dismiss pack [addSeeDismiss $w.buttons $w] -side bottom -fill x proc launch {name windowInfo class} { if {[winfo exists $name]} { wm deiconify $name focus -force $name return } wm attributes $name -class $class; toplevel $name wm title $name $class set f $name.f ttk::frame $f set t $f.t text $t -background systemWindowBackgroundColor \ -highlightcolor systemWindowBackgroundColor \ -font systemDefaultFont\ -wrap word -width 50 -height 6 $t insert insert $windowInfo $t configure -state disabled grid columnconfigure $f 0 -weight 1 grid $t -row 0 -column 0 -columnspan 2 -sticky NSEW ttk::labelframe $f.stylemask -text "styleMask bits" # titled if {$class == "nswindow"} { ttk::checkbutton $f.stylemask.titled -text titled -variable $name.titled \ -command [list setbit $name $f.stylemask.titled titled] $f.stylemask.titled state selected grid $f.stylemask.titled -row 0 -column 0 -sticky w } # closable ttk::checkbutton $f.stylemask.closable -text closable -variable $name.closable \ -command [list setbit $name $f.stylemask.closable closable] $f.stylemask.closable state selected grid $f.stylemask.closable -row 1 -column 0 -sticky w # miniaturizableable ttk::checkbutton $f.stylemask.miniaturizable -text miniaturizable \ -variable $name.miniaturizable \ -command [list setbit $name $f.stylemask.miniaturizable miniaturizable] if {$class == "nswindow"} { $f.stylemask.miniaturizable state selected } else { $f.stylemask.miniaturizable state !alternate } grid $f.stylemask.miniaturizable -row 2 -column 0 -sticky w # resizable ttk::checkbutton $f.stylemask.resizable -text resizable -variable $name.resizable \ -command [list setbit $name $f.stylemask.resizable resizable] $f.stylemask.resizable state selected grid $f.stylemask.resizable -row 3 -column 0 -sticky w # docmodal ttk::checkbutton $f.stylemask.docmodal -text docmodal -variable $name.docmodal \ -command [list setbit $name $f.stylemask.docmodal docmodal] $f.stylemask.docmodal state !alternate grid $f.stylemask.docmodal -row 4 -column 0 -sticky w grid $f.stylemask -row 1 -column 0 pack $name.f -side bottom -fill both -expand 1 -padx 16 -pady 16 } set info "The command wm attributes window -stylemask ?bitnames? can \ be used to modify bits in the stylemask property of the NSWindow or \ NSPanel underlying a Tk Window. Changing these bits causes the \ style of the window to change. This demo allows you to see the \ effects of changing the bits. (Note that buttons in the title bar \ can also be enabled or disabled with the ::tk::unsupported::MacWindowStyle \ command.)" set panelInfo "A toplevel based on an NSPanel has a narrower title bar\ than one based on an NSWindow. In addition the panel remains above all\ windows on the screen, regardless of which app is active. These are\ intended to be used as modal windows." set windowInfo "This is a standard Apple document window, based on an\ NSWindow. It has a larger title bar and behaves normally with respect\ to other windows from the same or another app." ## background frame set f $w.f ttk::frame $f set t $f.t text $t -background systemWindowBackgroundColor \ -highlightcolor systemWindowBackgroundColor \ -font systemDefaultFont\ -wrap word -width 50 -height 8 $t insert insert $info $t configure -state disabled grid columnconfigure $f 0 -weight 1 grid $t -row 0 -column 0 -columnspan 2 -sticky NSEW ttk::labelframe $f.stylemask -text "styleMask" grid $f.stylemask -row 1 -column 0 grid [ttk::button $f.wbw -text "Open an NSWindow" -width 20 \ -command [list launch .nswindow $windowInfo nswindow]] -row 2 -column 0 grid [ttk::button $f.wbp -text "Open an NSPanel" -width 20 \ -command [list launch .nspanel $panelInfo nspanel]] -row 3 -column 0 grid [ttk::button $f.wbm -text "Open a modern window" -width 20 \ -command launchModernWindow] -row 4 -column 0 pack $w.f -side bottom -fill both -expand 1 -padx 16 -pady 16 proc setbit {win cb bitname} { set state [$cb instate selected] set bits [wm attributes $win -stylemask] set index [lsearch $bits $bitname] if {$index >= 0 && !$state} { set bits [lreplace $bits $index $index] } if {$index < 0 && $state} { lappend bits $bitname } wm attributes $win -stylemask $bits } set aboutText \ "Most of the apps which ship with a contemporary version of macOS \ feature a window similar to this one, with a left sidebar that \ allows selecting the content to be shown on the right hand side of \ the window. These windows do not have a (visible) titlebar.\ \n\nApps that use such windows include the Finder and the App Store as \ well as Notes, Messages, Books, Maps and many others.\ \n\nTo create a window like this one in Tk simply set the fullsizecontent bit \ in the stylemask. For example:\n\n" set aboutCode \ "wm attributes .t -stylemask {titled \\\ \nfullsizecontent closable miniaturizable \\\ \nresizable}\n\n" set detailsText \ "(1) In the Apple API, setting the fullsizecontent bit in the stylemask \ only allows content to be drawn in the part of the window covered by \ the titlebar. In order for that content to be visible the title bar \ must be transparent. Since it would be pointless to draw content under \ an opaque title bar, Tk makes the title bar transparent whenever the \ fullsizecontent bit is set.\ \n\n\(2) Each radio button in the sidebar is a standard ttk::radiobutton \ but created with a special value for its -style option. The value of the \ -style option used to create these buttons is SidebarButton.\n" set whichPage 1 trace add variable whichPage write "flipPage whichPage" proc flipPage {varname args} { global whichPage set newpage [set $varname] grid remove [grid content .mod.right -row 0 -column 0] switch $newpage\ 1 {grid .mod.right.about -padx 30 -pady 30 -row 0 -column 0 -sticky nsew}\ 2 {grid .mod.right.details -padx 30 -pady 30 -row 0 -column 0 -sticky nsew} update idletasks } proc launchModernWindow {} { global whichPage global aboutText global aboutCode global detailsText if {[winfo exists .mod]} { wm deiconify .mod focus -force .mod return } toplevel .mod wm title .mod {} wm attributes .mod -stylemask {titled fullsizecontent closable \ miniaturizable resizable} .mod configure -background white grid columnconfigure .mod 0 -weight 0 grid columnconfigure .mod 1 -weight 1 grid rowconfigure .mod 0 -weight 1 frame .mod.left -width 220 -height 400 -background systemWindowBackgroundColor catch { font create leftFont -family .AppleSystemUIFont -size 11 font create rightFont -family .AppleSystemUIFont -size 16 font create codeFont -family Courier -size 16 } grid [ttk::label .mod.left.spacer -padding {220 30 0 0}] -row 0 -column 0 grid [ttk::radiobutton .mod.left.about -text About -style SidebarButton \ -variable whichPage -value 1] \ -row 1 -column 0 -sticky nsew -padx 14 grid [ttk::radiobutton .mod.left.details -text Details -style SidebarButton \ -variable whichPage -value 2] \ -row 2 -column 0 -sticky nsew -padx 14 grid .mod.left -row 0 -column 0 -sticky nsew frame .mod.right -width 500 -background systemTextBackgroundColor grid rowconfigure .mod.right 0 -weight 0 text .mod.right.about -highlightcolor systemTextBackgroundColor \ -background systemTextBackgroundColor -font rightFont \ -highlightthickness 0 -wrap word -width 40 .mod.right.about tag configure code -font codeFont .mod.right.about insert end $aboutText .mod.right.about insert end $aboutCode code .mod.right.about configure -state disabled text .mod.right.details -highlightcolor systemTextBackgroundColor \ -background systemTextBackgroundColor -font rightFont\ -highlightthickness 0 -wrap word -width 40 .mod.right.details insert end $detailsText .mod.right.details configure -state disabled grid .mod.right.about -padx 30 -pady 30 -row 0 -column 0 -sticky nsew grid .mod.right -row 0 -column 1 -sticky nsew wm geometry .mod 800x500 update idletasks } |
Changes to library/demos/mclist.tcl.
1 2 3 4 5 6 7 8 9 | # mclist.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # tree widget configured as a multi-column listbox. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # mclist.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # tree widget configured as a multi-column listbox. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .mclist catch {destroy $w} toplevel $w -class MCList wm title $w "Multi-Column List" wm iconname $w "mclist" 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 grid $w.tree $w.vsb -in $w.container -sticky nsew grid $w.hsb -in $w.container -sticky nsew grid column $w.container 0 -weight 1 grid row $w.container 0 -weight 1 set upArrowData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="4" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="m4 4 4-4 4 4z" fill="#000000"/> </svg> } set downArrowData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="4" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="m4 0 4 4 4-4z" fill="#000000"/> </svg> } proc createArrowImages {} { set fgColor [ttk::style lookup . -foreground {} black] lassign [winfo rgb . $fgColor] r g b set fgColor [format "#%02x%02x%02x" \ [expr {$r >> 8}] [expr {$g >> 8}] [expr {$b >> 8}]] foreach dir {up down} { upvar ${dir}ArrowData imgData set idx1 [string first "#000000" $imgData] set idx2 [expr {$idx1 + 6}] set data [string replace $imgData $idx1 $idx2 $fgColor] image create photo ${dir}Arrow -format $::tk::svgFmt -data $data] } } createArrowImages foreach event {<<ThemeChanged>> <<LightAqua>> <<DarkAqua>>} { bind MCList $event { createArrowImages } } unset event image create photo noArrow -format $tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="4" version="1.1" xmlns="http://www.w3.org/2000/svg"> </svg> } ## The data we're going to insert set data { Argentina {Buenos Aires} ARS Australia Canberra AUD Brazil Brazilia BRL Canada Ottawa CAD |
︙ | ︙ | |||
58 59 60 61 62 63 64 | Russia Moscow RUB {South Africa} Pretoria ZAR {United Kingdom} London GBP {United States} {Washington, D.C.} USD } ## Code to insert the data nicely | | > | < < | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | Russia Moscow RUB {South Africa} Pretoria ZAR {United Kingdom} London GBP {United States} {Washington, D.C.} USD } ## Code to insert the data nicely set font [ttk::style lookup Heading -font {} TkDefaultFont] set morePx [expr {[image width noArrow] + round(4 * $tk::scalingPct / 100.0)}] foreach col {country capital currency} name {Country Capital Currency} { $w.tree heading $col -text $name -image noArrow -anchor w \ -command [list SortBy $w.tree $col 0] $w.tree column $col -width [expr {[font measure $font $name] + $morePx}] } set font [ttk::style lookup Treeview -font {} TkDefaultFont] foreach {country capital currency} $data { $w.tree insert {} end -values [list $country $capital $currency] foreach col {country capital currency} { set len [font measure $font "[set $col] "] if {[$w.tree column $col -width] < $len} { $w.tree column $col -width $len } |
︙ | ︙ | |||
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"}] } } | > > > > > > > > > > > > > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | 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.
1 2 3 4 5 6 7 8 9 | # menu.tcl -- # # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubars. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # menu.tcl -- # # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubars. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .menu catch {destroy $w} 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 " " |
︙ | ︙ | |||
52 53 54 55 56 57 58 | set m $w.menu.basic $w.menu add cascade -label "Basic" -menu $m -underline 0 menu $m -tearoff 0 $m add command -label "Long entry that does nothing" if {[tk windowingsystem] eq "aqua"} { set modifier Command | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | set m $w.menu.basic $w.menu add cascade -label "Basic" -menu $m -underline 0 menu $m -tearoff 0 $m add command -label "Long entry that does nothing" if {[tk windowingsystem] eq "aqua"} { set modifier Command } elseif {[tk windowingsystem] eq "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.
1 2 3 4 5 6 7 8 9 | # menubu.tcl -- # # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # menubu.tcl -- # # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .menubu catch {destroy $w} 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 |
︙ | ︙ | |||
44 45 46 47 48 49 50 | grid $w.body.above -row 2 -column 1 -sticky s ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set body $w.body.center | | | | | > > > | | | | | | | | | | | | | < < | 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 | grid $w.body.above -row 2 -column 1 -sticky s ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set body $w.body.center label $body.label -wraplength 225p -font "Helvetica 14" -justify left -text "This is a demonstration of menubuttons. The \"Below\" menubutton pops its menu below the button; the \"Right\" button pops to the right, etc. There are two option menus directly below this text; one is just a standard menu and the other is a 16-color palette." pack $body.label -side top -padx 18p -pady 18p frame $body.buttons pack $body.buttons -padx 18p -pady 18p tk_optionMenu $body.buttons.options menubuttonoptions one two three pack $body.buttons.options -side left -padx 18p -pady 18p set m [tk_optionMenu $body.buttons.colors paletteColor Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet] if {[tk windowingsystem] eq "aqua"} { set topBorderColor Black set bottomBorderColor Black } else { set topBorderColor gray50 set bottomBorderColor gray75 } set dim [expr {round(16 * $tk::scalingPct / 100.0)}] set dim1 [expr {$dim - 1}] set dim2 [expr {$dim - 2}] for {set i 0} {$i <= [$m index last]} {incr i} { set name [$m entrycget $i -label] image create photo image_$name -height $dim -width $dim image_$name put $topBorderColor -to 0 0 $dim 1 image_$name put $topBorderColor -to 0 1 1 $dim image_$name put $bottomBorderColor -to 0 $dim1 $dim $dim image_$name put $bottomBorderColor -to $dim1 1 $dim $dim image_$name put $name -to 1 1 $dim1 $dim1 image create photo image_${name}_s -height $dim -width $dim image_${name}_s put Black -to 0 0 $dim 2 image_${name}_s put Black -to 0 2 2 $dim image_${name}_s put Black -to 2 $dim2 $dim $dim image_${name}_s put Black -to $dim2 2 $dim $dim2 image_${name}_s put $name -to 2 2 $dim2 $dim2 $m entryconfigure $i -image image_$name -selectimage image_${name}_s -hidemargin 1 } $m configure -tearoff 1 foreach i {Black gray75 gray50 White} { $m entryconfigure $i -columnbreak 1 } pack $body.buttons.colors -side left -padx 18p -pady 18p |
Changes to library/demos/msgbox.tcl.
1 2 3 4 5 6 7 8 | # msgbox.tcl -- # # This demonstration script creates message boxes of various type if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # msgbox.tcl -- # # This demonstration script creates message boxes of various type if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .msgbox catch {destroy $w} toplevel $w wm title $w "Message Box Demonstration" wm iconname $w "messagebox" positionWindow $w |
︙ | ︙ | |||
32 33 34 35 36 37 38 | pack $w.left.label -side top pack $w.left.sep -side top -fill x -expand no set msgboxIcon info foreach i {error info question warning} { radiobutton $w.left.b$i -text $i -variable msgboxIcon \ -relief flat -value $i -width 16 -anchor w | | | | 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 | pack $w.left.label -side top pack $w.left.sep -side top -fill x -expand no set msgboxIcon info foreach i {error info question warning} { radiobutton $w.left.b$i -text $i -variable msgboxIcon \ -relief flat -value $i -width 16 -anchor w pack $w.left.b$i -side top -pady 1.5p -anchor w -fill x } label $w.right.label -text "Type" frame $w.right.sep -relief ridge -bd 1 -height 2 pack $w.right.label -side top pack $w.right.sep -side top -fill x -expand no set msgboxType ok foreach t {abortretryignore ok okcancel retrycancel yesno yesnocancel} { radiobutton $w.right.$t -text $t -variable msgboxType \ -relief flat -value $t -width 16 -anchor w pack $w.right.$t -side top -pady 1.5p -anchor w -fill x } proc showMessageBox {w} { global msgboxIcon msgboxType set button [tk_messageBox -icon $msgboxIcon -type $msgboxType \ -title Message -parent $w\ -message "This is a \"$msgboxType\" type messagebox with the \"$msgboxIcon\" icon"] tk_messageBox -icon info -message "You have selected \"$button\"" -type ok\ -parent $w } |
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/paned1.tcl.
1 2 3 4 5 6 7 8 9 | # paned1.tcl -- # # This demonstration script creates a toplevel window containing # a paned window that separates two windows horizontally. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # paned1.tcl -- # # This demonstration script creates a toplevel window containing # a paned window that separates two windows horizontally. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .paned1 catch {destroy $w} toplevel $w wm title $w "Horizontal Paned Window Demonstration" wm iconname $w "paned1" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)" pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x panedwindow $w.pane pack $w.pane -side top -expand yes -fill both -pady 1.5p -padx 2m label $w.pane.left -text "This is the\nleft side" -fg black -bg yellow label $w.pane.right -text "This is the\nright side" -fg black -bg cyan $w.pane add $w.pane.left $w.pane.right -stretch always |
Changes to library/demos/paned2.tcl.
1 2 3 4 5 6 7 8 9 | # paned2.tcl -- # # This demonstration script creates a toplevel window containing # a paned window that separates two windows vertically. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # paned2.tcl -- # # This demonstration script creates a toplevel window containing # a paned window that separates two windows vertically. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .paned2 catch {destroy $w} toplevel $w wm title $w "Vertical Paned Window Demonstration" wm iconname $w "paned2" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)" pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Create the pane itself panedwindow $w.pane -orient vertical pack $w.pane -side top -expand yes -fill both -pady 1.5p -padx 2m # The top window is a listbox with scrollbar set paneList { {List of Tk Widgets} button canvas checkbutton |
︙ | ︙ | |||
67 68 69 70 71 72 73 | grid $f.text $f.yscr -sticky nsew grid $f.xscr -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 $f.text insert 1.0 "This is just a normal text widget" # Now add our contents to the paned window | | | 67 68 69 70 71 72 73 74 | grid $f.text $f.yscr -sticky nsew grid $f.xscr -sticky nsew grid columnconfigure $f 0 -weight 1 grid rowconfigure $f 0 -weight 1 $f.text insert 1.0 "This is just a normal text widget" # Now add our contents to the paned window $w.pane add $w.pane.top $w.pane.bottom -stretch always |
Changes to library/demos/pendulum.tcl.
1 2 3 4 5 6 7 8 9 | # pendulum.tcl -- # # This demonstration illustrates how Tcl/Tk can be used to construct # simulations of physical systems. if {![info exists widgetDemo]} { error "This script should be run from the \"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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | # pendulum.tcl -- # # This demonstration illustrates how Tcl/Tk can be used to construct # simulations of physical systems. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .pendulum catch {destroy $w} toplevel $w wm title $w "Pendulum Animation Demonstration" wm iconname $w "pendulum" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas." pack $w.msg ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x # Create some structural widgets pack [panedwindow $w.p] -fill both -expand 1 $w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"] -stretch always $w.p add [labelframe $w.p.l2 -text "Phase Space"] -stretch always # Create the canvas containing the graphical representation of the # simulated system. canvas $w.c -width 240p -height 150p -background white -bd 1.5p -relief sunken $w.c create text 3p 3p -anchor nw -text "Click to Adjust Bob Start Position" # Coordinates of these items don't matter; they will be set properly below $w.c create line 0 25 320 25 -tags plate -fill grey50 -width 1.5p $w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {} $w.c create line 1 1 1 1 -tags rod -fill black -width 2.25p $w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black pack $w.c -in $w.p.l1 -fill both -expand true # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. canvas $w.k -width 240p -height 150p -background white -bd 1.5p -relief sunken $w.k create line 120p 150p 120p 0 -fill grey75 -arrow last -tags y_axis $w.k create line 0 75p 240p 75p -fill grey75 -arrow last -tags x_axis for {set i 90} {$i>=0} {incr i -10} { # Coordinates of these items don't matter; they will be set properly below $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i } $w.k create text 0 0 -anchor ne -text "θ" -tags label_theta $w.k create text 0 0 -anchor ne -text "δθ" -tags label_dtheta pack $w.k -in $w.p.l2 -fill both -expand true # Initialize some variables set points {} set Theta 45.0 set dTheta 0.0 set pi 3.1415926535897933 set tkScl [tk scaling] set length [expr {round(111*$tkScl)}] ;# 111p -> pixels set xHome [expr {round(120*$tkScl)}] ;# 120p -> pixels set yHome [expr {round( 18*$tkScl)}] ;# 18p -> pixels set rBob [expr {round( 12*$tkScl)}] ;# 12p -> pixels set rPivot [expr {round( 3*$tkScl)}] ;# 3p -> pixels # This procedure makes the pendulum appear at the correct place on the # canvas. If the additional arguments "at $x $y" are passed (the 'at' # is really just syntactic sugar) instead of computing the position of # the pendulum from the length of the pendulum rod and its angle, the # length and angle are computed in reverse from the given location # (which is taken to be the centre of the pendulum bob.) proc showPendulum {canvas {at {}} {x {}} {y {}}} { global Theta dTheta pi length xHome yHome rBob if {$at eq "at" && ($x!=$xHome || $y!=$yHome)} { set dTheta 0.0 set x2 [expr {$x - $xHome}] set y2 [expr {$y - $yHome}] set length [expr {hypot($x2, $y2)}] set Theta [expr {atan2($x2, $y2) * 180/$pi}] } else { set angle [expr {$Theta * $pi/180}] set x [expr {$xHome + $length*sin($angle)}] set y [expr {$yHome + $length*cos($angle)}] } $canvas coords rod $xHome $yHome $x $y $canvas coords bob [expr {$x - $rBob}] [expr {$y - $rBob}] \ [expr {$x + $rBob}] [expr {$y + $rBob}] } showPendulum $w.c # 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 set sclFactor [expr {$tk::scalingPct / 100.0}] lappend points [expr {$Theta + $psw}] [expr {-20*$sclFactor*$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 $canvas scale graph$i $psw $psh $sclFactor $sclFactor } } } # Set up some bindings on the canvases. Note that when the user # clicks we stop the animation until they release the mouse # button. Also note that both canvases are sensitive to <Configure> |
︙ | ︙ | |||
121 122 123 124 125 126 127 | showPendulum %W at %x %y } bind $w.c <ButtonRelease-1> { showPendulum %W at %x %y set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]] } bind $w.c <Configure> { | | | | | | | | > | 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 | showPendulum %W at %x %y } bind $w.c <ButtonRelease-1> { showPendulum %W at %x %y set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]] } bind $w.c <Configure> { %W coords plate 0 18p %w 18p set xHome [expr {%w/2}] %W coords pivot [expr {$xHome - $rPivot}] 15p [expr {$xHome + $rPivot}] 21p } bind $w.k <Configure> { set psh [expr {%h/2}] set psw [expr {%w/2}] %W coords x_axis 1.5p $psh [expr {%w - round(1.5*$tkScl)}] $psh %W coords y_axis $psw [expr {%h - round(1.5*$tkScl)}] $psw 1.5p %W coords label_dtheta [expr {$psw - round(3*$tkScl)}] 4.5p %W coords label_theta [expr {%w - round(4.5*$tkScl)}] \ [expr {$psh + round(3*$tkScl)}] } # This procedure is the "business" part of the simulation that does # simple numerical integration of the formula for a simple rotational # pendulum. proc recomputeAngle {} { global Theta dTheta pi length |
︙ | ︙ |
Changes to library/demos/plot.tcl.
1 2 3 4 5 6 7 8 9 | # plot.tcl -- # # This demonstration script creates a canvas widget showing a 2-D # plot with data points that can be dragged with the mouse. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # plot.tcl -- # # This demonstration script creates a canvas widget showing a 2-D # plot with data points that can be dragged with the mouse. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .plot catch {destroy $w} toplevel $w wm title $w "Plot Demonstration" wm iconname $w "Plot" positionWindow $w set c $w.c label $w.msg -font $font -wraplength 4i -justify left -text "This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x canvas $c -relief raised -width 337.5p -height 225p pack $w.c -side top -fill x set plotFont {Helvetica 16} $c create line 75p 187.5p 300p 187.5p -width 1.5p $c create line 75p 187.5p 75p 37.5p -width 1.5p $c create text 168.75p 15p -text "A Simple Plot" -font $plotFont -fill brown for {set i 0} {$i <= 10} {incr i} { set x [expr {75 + ($i*22.5)}] ;# in points $c create line ${x}p 187.5p ${x}p 183.75p -width 1.5p $c create text ${x}p 190.5p -text [expr {10*$i}] -anchor n -font $plotFont } for {set i 0} {$i <= 5} {incr i} { set y [expr {187.5 - ($i*30)}] ;# in points $c create line 75p ${y}p 78.75p ${y}p -width 1.5p $c create text 72p ${y}p -text [expr {$i*50}].0 -anchor e -font $plotFont } foreach point { {9 42} {15 70.5} {24.75 73.5} {24 90} {45.75 135} {56.25 120} {73.5 167.25} } { set x [expr {75 + (2.25*[lindex $point 0])}] ;# in points set y [expr {187.5 - (3*[lindex $point 1])/5}] ;# in points set item [$c create oval [expr {$x-4.5}]p [expr {$y-4.5}]p \ [expr {$x+4.5}]p [expr {$y+4.5}]p -width 0.75p -outline black \ -fill SkyBlue2] $c addtag point withtag $item } $c bind point <Enter> "$c itemconfig current -fill red" $c bind point <Leave> "$c itemconfig current -fill SkyBlue2" $c bind point <Button-1> "plotDown $c %x %y" |
︙ | ︙ |
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 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 | # 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 pack [label $w.l -text "This demonstration showcases the tk print command. Clicking the buttons below prints the data from the canvas and text widgets using platform-native dialogs."] -side top ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x frame $w.m image create photo logo -data { R0lGODlhMABLAPUAAP//////zP//mf//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM/8zMzMyZzMyZ mcyZZsyZAMxmZsxmM8xmAMwzM8wzAJnMzJmZzJmZmZlmmZlmZplmM5kzZpkzM5kzAGaZzGZmzGZm mWYzZmYzMzNmzDNmmTMzmTMzZgAzmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+BSAtZGwtACH5BAEKAAIALAAAAAAw AEsAAAb+QIFwSCwahY9HRMI8Op/JJVNSqVqv2OvjyRU8slbIJGwYg60S5ZR6jRi/4ITBOhkYIOd8 dltEnAdmFQMJeoVXCEd/VnKGjRVOZ3NVgHlsjpBxVRCEYBIEAAARl4lgZmVgEQAKFx8Mo0ZnpqgA Fyi2JqKGmGebWRIAILbCIo27cYFWASTCtievRXqSVwQfzLYeeYESxlnSVRIW1igjWHJmjBXbpKXe FQTizlh1eJNVHbYf0LGc39XW2PIoVZE0whasWPSqFBBHrkKEA3QG0DFTEMXBUsjCWesg4oMFAGwg tKsiwqA+jGiCiRPGAM6pLCVLGKHQ6EGJlc0IuDxzAgX+CCOW9DjAaUsEyAoT+GHpeSRoHgxEUWgA UEUpFhMWgTbKEPUBAU15TBZxekYD0RMEqCDLIpYIWTAcmGEd9rWQBxQyjeQqdK/ZTWEO3mK5l+9N o75SrcHhm9WwnlzNoA5zdM+JHz0HCPQdUauZowoFnSw+c2CBvw6dUXT4LMKE6EIHUqMexgCiIREk nOwl7Q+FhNQoLuzOc6Kw3kIIVOLqjYKBYCwinmgo9CBEswfMAziK7mRDoQhcUZxwoBKFibq3n3jX I0GyCPLC0DrS8GR1oaEoRBRYVhT99/qG4DcCA/yNU4Ajbjhhnx4P2DJggR3YZog6RyyYxwM9PSgM BaP+sQdgIRL0JAKBwnTooRMAFWLdiPyJ8JwvTnyQoh5midCASh149ZkTIFAmHnzOZOBfIU6U4Mhd 4zF34DNEoDAhARGY50BvJkioyxFOGkKAShGkFsJwejiR5Xf8aZAaBp89coQJjuDXAQOApekEm45A NaAtIbyYxREf0OlICCK841uaahZBQjyfjXCACYjuaASjhFagRKSFNtloHg+hYWIxRohnBQWCSSAh BVZ+hkgRnlbxwJIVgIqGlaU6wkeTxHxjm6gVLImrFbHWVEQ1taZjWxJX7KqqnqgUEUxDwtqajrOa RkqhEDcxWwECbEjxTYe9gojqOJQ6JO231ob72bSqAjh4RgfsjiDCCfDCK8K8I9TL7r33nvGtCO7C O1dUAONk3LcBFxzwwEMwZ/DC4iAsRIE+CWNCbzeV8FfEtoDwVwnlacxMkcKQYIE/F5TQ2QcedUZC agyc3NsFGrXVZMipWVBCzKv4Q0JvCviDsjAwf4ylxBeX0KcwGs81ccgqGS3MBxc3RjDDVAvdBRcf eFy1MFd3bcQHJEQdlddkP5E1Cf9yXfbaV2d9RBAAOw== } # Create a copy of the image just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copy will only be effectively magnified if $tk::scalingPct >= 200. image create photo logo2 logo2 copy logo -zoom [expr {$tk::scalingPct / 100}] set c [canvas $w.m.c -bg white] pack $c -fill both -expand yes -fill both -side left # For scaling-awareness specify the coordinates of the canvas items in points # rather than pixels. Create the items with a left and top padding of 15 pt. $c create rectangle 15p 15p 165p 60p -fill blue -outline black ;# 150p x 45p $c create oval 15p 75p 165p 120p -fill green ;# 150p x 45p set imgId [$c create image 90p 135p -image logo2 -anchor n] # Compute the scaled y coordinate of the next canvas item's top edge in pixels lassign [$c bbox $imgId] x1 y1 x2 y2 ;# x1, y1, x2, y2 are in pixels incr y2 [expr {round(15 * [tk scaling])}] ;# convert 15 pt to pixels $c create text 15p $y2 -anchor nw -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 -expand yes -fill both $t insert end $txt frame $w.f pack [button $w.f.c -text "Print Canvas" -command [list tk print $w.m.c]] \ -side left -anchor w -padx 3p pack [button $w.f.t -text "Print Text" -command [list tk print $w.m.t]] \ -side right -anchor e -padx 3p pack $w.f -side bottom -fill x pack $w.m -expand yes -fill both -side top |
Changes to library/demos/puzzle.tcl.
1 2 3 4 5 6 7 8 9 | # 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." } | | | | 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)) |
︙ | ︙ | |||
54 55 56 57 58 59 60 | scrollbar $w.s # The button metrics are a bit bigger in Aqua, and since we are # using place which doesn't autosize, then we need to have a # slightly larger frame here... if {[tk windowingsystem] eq "aqua"} { | | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | scrollbar $w.s # The button metrics are a bit bigger in Aqua, and since we are # using place which doesn't autosize, then we need to have a # slightly larger frame here... if {[tk windowingsystem] eq "aqua"} { set frameSize 126p } else { set frameSize 90p } frame $w.frame -width $frameSize -height $frameSize -borderwidth 2 \ -relief sunken -bg [$w.s cget -troughcolor] pack $w.frame -side top -pady 1c -padx 1c destroy $w.s set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12} for {set i 0} {$i < 15} {set i [expr {$i+1}]} { set num [lindex $order $i] |
︙ | ︙ |
Changes to library/demos/radio.tcl.
1 2 3 4 5 6 7 8 9 | # radio.tcl -- # # This demonstration script creates a toplevel window containing # several radiobutton widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # radio.tcl -- # # This demonstration script creates a toplevel window containing # several radiobutton widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .radio catch {destroy $w} toplevel $w wm title $w "Radiobutton Demonstration" wm iconname $w "radio" positionWindow $w label $w.msg -font $font -wraplength 5i -justify left -text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. When the 'Tristate' button is pressed, the radio buttons will display the tri-state mode. Selecting any radio button will return the buttons to their respective on/off state. Click the \"See Variables\" button to see the current values of the variables." grid $w.msg -row 0 -column 0 -columnspan 3 -sticky nsew ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w [list size color align]] grid $btns -row 3 -column 0 -columnspan 3 -sticky ew labelframe $w.left -pady 1.5p -text "Point Size" -padx 1.5p labelframe $w.mid -pady 1.5p -text "Color" -padx 1.5p labelframe $w.right -pady 1.5p -text "Alignment" -padx 1.5p button $w.tristate -text Tristate -command "set size multi; set color multi" \ -pady 1.5p -padx 1.5p if {[tk windowingsystem] eq "aqua"} { $w.tristate configure -padx 7.5p } grid $w.left -column 0 -row 1 -pady .5c -padx .5c -rowspan 2 grid $w.mid -column 1 -row 1 -pady .5c -padx .5c -rowspan 2 grid $w.right -column 2 -row 1 -pady .5c -padx .5c grid $w.tristate -column 2 -row 2 -pady .5c -padx .5c foreach i {10 12 14 18 24} { radiobutton $w.left.b$i -text "Point Size $i" -variable size \ -relief flat -value $i -tristatevalue "multi" pack $w.left.b$i -side top -pady 1.5p -anchor w -fill x } foreach c {Red Green Blue Yellow Orange Purple} { set lower [string tolower $c] radiobutton $w.mid.$lower -text $c -variable color \ -relief flat -value $lower -anchor w \ -command "$w.mid configure -fg \$color" \ -tristatevalue "multi" pack $w.mid.$lower -side top -pady 1.5p -fill x } label $w.right.l -text "Label" -bitmap questhead -compound left $w.right.l configure -width [winfo reqwidth $w.right.l] -compound top $w.right.l configure -height [winfo reqheight $w.right.l] foreach a {Top Left Right Bottom} { |
︙ | ︙ |
Changes to library/demos/rmt.
1 2 3 4 5 6 7 8 9 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # rmt -- # This script implements a simple remote-control mechanism for # Tk applications. It allows you to select an application and # then type commands to that application. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # rmt -- # This script implements a simple remote-control mechanism for # Tk applications. It allows you to select an application and # then type commands to that application. package require tk wm title . "Tk Remote Controller" wm iconname . "Tk Remote" wm minsize . 1 1 # The global variable below keeps track of the remote application # that we're sending to. If it's an empty string then we execute |
︙ | ︙ |
Changes to library/demos/rolodex.
1 2 3 4 5 6 7 8 9 10 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # rolodex -- # This script was written as an entry in Tom LaStrange's rolodex # benchmark. It creates something that has some of the look and # feel of a rolodex program, although it's lifeless and doesn't # actually do the rolodex application. | | | | | | | 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 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # rolodex -- # This script was written as an entry in Tom LaStrange's rolodex # benchmark. It creates something that has some of the look and # feel of a rolodex program, although it's lifeless and doesn't # actually do the rolodex application. package require tk foreach i [winfo children .] { catch {destroy $i} } set version 1.2 #------------------------------------------ # Phase 0: create the front end. #------------------------------------------ frame .frame -relief flat pack .frame -side top -fill y -anchor center set names {{} Name: Address: {} {} {Home Phone:} {Work Phone:} Fax:} foreach i {1 2 3 4 5 6 7} { label .frame.label$i -text [lindex $names $i] -anchor e entry .frame.entry$i -width 35 grid .frame.label$i .frame.entry$i -sticky ew -pady 1.5p -padx 0.75p } frame .buttons pack .buttons -side bottom -pady 1.5p -anchor center button .buttons.clear -text Clear button .buttons.add -text Add button .buttons.search -text Search button .buttons.delete -text "Delete ..." pack .buttons.clear .buttons.add .buttons.search .buttons.delete \ -side left -padx 1.5p #------------------------------------------ # Phase 1: Add menus, dialog boxes #------------------------------------------ # DKF - note that this is an old-style menu bar; I just have not yet # got around to converting the context help code to work with the new |
︙ | ︙ |
Changes to library/demos/ruler.tcl.
1 2 3 4 5 6 7 8 9 | # ruler.tcl -- # # This demonstration script creates a canvas widget that displays a ruler # with tab stops that can be set, moved, and deleted. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # ruler.tcl -- # # This demonstration script creates a canvas widget that displays a ruler # with tab stops that can be set, moved, and deleted. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # rulerMkTab -- # This procedure creates a new triangular polygon in a canvas to # represent a tab stop. # # Arguments: # c - The canvas window. |
︙ | ︙ |
Changes to library/demos/sayings.tcl.
1 2 3 4 5 6 7 8 9 10 | # sayings.tcl -- # # This demonstration script creates a listbox that can be scrolled # both horizontally and vertically. It displays a collection of # well-known sayings. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # sayings.tcl -- # # This demonstration script creates a listbox that can be scrolled # both horizontally and vertically. It displays a collection of # well-known sayings. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .sayings catch {destroy $w} toplevel $w wm title $w "Listbox Demonstration (well-known sayings)" wm iconname $w "sayings" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "The listbox below contains a collection of well-known sayings. You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.frame -borderwidth 7.5p pack $w.frame -side top -expand yes -fill both -padx 1c ttk::scrollbar $w.frame.yscroll -command "$w.frame.list yview" ttk::scrollbar $w.frame.xscroll -orient horizontal \ -command "$w.frame.list xview" listbox $w.frame.list -width 20 -height 10 -setgrid 1 \ |
︙ | ︙ |
Changes to library/demos/search.tcl.
1 2 3 4 5 6 7 8 9 10 | # search.tcl -- # # This demonstration script creates a collection of widgets that # allow you to load a file into a text widget, then perform searches # on that file. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # search.tcl -- # # This demonstration script creates a collection of widgets that # allow you to load a file into a text widget, then perform searches # on that file. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # textLoadFile -- # This procedure below loads a file into a text widget, discarding # the previous contents of the widget. Tags for the old widget are # not affected, however. # # Arguments: |
︙ | ︙ | |||
88 89 90 91 92 93 94 | frame $w.file label $w.file.label -text "File name:" -width 13 -anchor w entry $w.file.entry -width 40 -textvariable fileName button $w.file.button -text "Load File" \ -command "textLoadFile $w.text \$fileName" pack $w.file.label $w.file.entry -side left | | | | 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 | frame $w.file label $w.file.label -text "File name:" -width 13 -anchor w entry $w.file.entry -width 40 -textvariable fileName button $w.file.button -text "Load File" \ -command "textLoadFile $w.text \$fileName" pack $w.file.label $w.file.entry -side left pack $w.file.button -side left -pady 3p -padx 7.5p bind $w.file.entry <Return> " textLoadFile $w.text \$fileName focus $w.string.entry " focus $w.file.entry frame $w.string label $w.string.label -text "Search string:" -width 13 -anchor w entry $w.string.entry -width 40 -textvariable searchString button $w.string.button -text "Highlight" \ -command "textSearch $w.text \$searchString search" pack $w.string.label $w.string.entry -side left pack $w.string.button -side left -pady 3p -padx 7.5p bind $w.string.entry <Return> "textSearch $w.text \$searchString search" text $w.text -yscrollcommand "$w.scroll set" -setgrid true ttk::scrollbar $w.scroll -command "$w.text yview" pack $w.file $w.string -side top -fill x pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both |
︙ | ︙ |
Changes to library/demos/spin.tcl.
1 2 3 4 5 6 7 8 | # spin.tcl -- # # This demonstration script creates several spinbox widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # spin.tcl -- # # This demonstration script creates several spinbox widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .spin catch {destroy $w} toplevel $w wm title $w "Spinbox Demonstration" wm iconname $w "spin" positionWindow $w |
︙ | ︙ | |||
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 | 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 pack $w.s1 $w.s2 $w.s3 -side top -pady 3p -padx 7.5p |
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} |
︙ | ︙ |
Changes to library/demos/states.tcl.
1 2 3 4 5 6 7 8 9 | # states.tcl -- # # This demonstration script creates a listbox widget that displays # the names of the 50 states in the United States of America. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # states.tcl -- # # This demonstration script creates a listbox widget that displays # the names of the 50 states in the United States of America. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .states catch {destroy $w} toplevel $w wm title $w "Listbox Demonstration (50 states)" wm iconname $w "states" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing the 50 states is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by scanning. To scan, press button 2 in the widget and drag up or down." pack $w.msg -side top labelframe $w.justif -text Justification foreach c {Left Center Right} { set lower [string tolower $c] radiobutton $w.justif.$lower -text $c -variable just \ -relief flat -value $lower -anchor w \ -command "$w.frame.list configure -justify \$just" \ -tristatevalue "multi" pack $w.justif.$lower -side left -pady 1.5p -fill x } pack $w.justif ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x |
︙ | ︙ |
Changes to library/demos/style.tcl.
1 2 3 4 5 6 7 8 9 | # style.tcl -- # # This demonstration script creates a text widget that illustrates the # various display styles that may be set for tags. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # style.tcl -- # # This demonstration script creates a text widget that illustrates the # various display styles that may be set for tags. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .style catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Display Styles" wm iconname $w "style" positionWindow $w |
︙ | ︙ | |||
48 49 50 51 52 53 54 | -borderwidth 1 $w.text tag configure sunken -background white -relief sunken \ -borderwidth 1 } $w.text tag configure bgstipple -background black -borderwidth 0 \ -bgstipple gray12 $w.text tag configure fgstipple -fgstipple gray50 | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | -borderwidth 1 $w.text tag configure sunken -background white -relief sunken \ -borderwidth 1 } $w.text tag configure bgstipple -background black -borderwidth 0 \ -bgstipple gray12 $w.text tag configure fgstipple -fgstipple gray50 $w.text tag configure underline -underline 1 $w.text tag configure overstrike -overstrike 1 $w.text tag configure right -justify right $w.text tag configure center -justify center $w.text tag configure super -offset 4p -font "$family 10" $w.text tag configure sub -offset -2p -font "$family 10" $w.text tag configure margins -lmargin1 12m -lmargin2 6m -rmargin 10m $w.text tag configure spacing -spacing1 10p -spacing2 2p \ -lmargin1 12m -lmargin2 6m -rmargin 10m |
︙ | ︙ |
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 ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x 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 3p -pady 3p -side left -expand true -fill x button $w.b3 -text "Display Notification" -command notify pack $w.f $w.b3 -fill x -padx 3p -pady 3p 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 |
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/tcolor.
1 2 3 4 5 6 7 8 9 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # tcolor -- # This script implements a simple color editor, where you can # create colors using either the RGB, HSB, or CYM color spaces # and apply the color to existing applications. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # tcolor -- # This script implements a simple color editor, where you can # create colors using either the RGB, HSB, or CYM color spaces # and apply the color to existing applications. package require tk wm title . "Color Editor" # Global variables that control the program: # # colorSpace - Color space currently being used for # editing. Must be "rgb", "cmy", or "hsb". # label1, label2, label3 - Labels for the scales. |
︙ | ︙ |
Changes to library/demos/text.tcl.
1 2 3 4 5 6 7 8 9 | # text.tcl -- # # This demonstration script creates a text widget that describes # the basic editing functions. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # text.tcl -- # # This demonstration script creates a text widget that describes # the basic editing functions. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .text catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Basic Facilities" wm iconname $w "text" positionWindow $w |
︙ | ︙ |
Changes to library/demos/textpeer.tcl.
1 2 3 4 5 6 7 8 9 10 | # textpeer.tcl -- # # This demonstration script creates a pair of text widgets that can edit a # single logical buffer. This is particularly useful when editing related text # in two (or more) parts of the same file. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # textpeer.tcl -- # # This demonstration script creates a pair of text widgets that can edit a # single logical buffer. This is particularly useful when editing related text # in two (or more) parts of the same file. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .textpeer catch {destroy $w} toplevel $w wm title $w "Text Widget Peering Demonstration" wm iconname $w "textpeer" positionWindow $w |
︙ | ︙ |
Changes to library/demos/timer.
1 2 3 4 5 6 7 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # timer -- # This script generates a counter with start and stop buttons. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # timer -- # This script generates a counter with start and stop buttons. package require tk label .counter -text 0.00 -relief raised -width 10 -padx 2m -pady 1m button .start -text Start -command { if {$stopped} { set stopped 0 set startMoment [clock clicks -milliseconds] tick |
︙ | ︙ |
Changes to library/demos/toolbar.tcl.
1 2 3 4 5 6 7 8 | # toolbar.tcl -- # # This demonstration script creates a toolbar that can be torn off. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # toolbar.tcl -- # # This demonstration script creates a toolbar that can be torn off. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .toolbar destroy $w toplevel $w wm title $w "Toolbar Demonstration" wm iconname $w "toolbar" positionWindow $w |
︙ | ︙ | |||
27 28 29 30 31 32 33 | ## Set up the toolbar hull set t [frame $w.toolbar] ;# Must be a frame! ttk::separator $w.sep ttk::frame $t.tearoff -cursor fleur ttk::separator $t.tearoff.to -orient vertical ttk::separator $t.tearoff.to2 -orient vertical | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Set up the toolbar hull set t [frame $w.toolbar] ;# Must be a frame! ttk::separator $w.sep ttk::frame $t.tearoff -cursor fleur ttk::separator $t.tearoff.to -orient vertical ttk::separator $t.tearoff.to2 -orient vertical pack $t.tearoff.to -fill y -expand 1 -padx 3p -side left pack $t.tearoff.to2 -fill y -expand 1 -side left ttk::frame $t.contents grid $t.tearoff $t.contents -sticky nsew grid columnconfigure $t $t.contents -weight 1 grid columnconfigure $t.contents 1000 -weight 1 ## Bindings so that the toolbar can be torn off and reattached |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } ## Some content for the rest of the toplevel text $w.txt -width 40 -height 10 interp alias {} doInsert {} $w.txt insert end ;# Make bindings easy to write ## Arrange contents | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | } ## Some content for the rest of the toplevel text $w.txt -width 40 -height 10 interp alias {} doInsert {} $w.txt insert end ;# Make bindings easy to write ## Arrange contents grid $t.button $t.check $t.menu $t.combo -in $t.contents -padx 1.5p -pady 3p -sticky ns grid $t -sticky ew grid $w.sep -sticky ew grid $w.msg -sticky ew grid $w.txt -sticky nsew grid rowconfigure $w $w.txt -weight 1 grid columnconfigure $w $w.txt -weight 1 ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] grid $btns -sticky ew |
Changes to library/demos/tree.tcl.
1 2 3 4 5 6 7 8 9 | # tree.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # tree widget. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # tree.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # tree widget. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .tree catch {destroy $w} toplevel $w wm title $w "Directory Browser" wm iconname $w "tree" positionWindow $w |
︙ | ︙ |
Changes to library/demos/ttkbut.tcl.
1 2 3 4 5 6 7 8 9 10 | # ttkbut.tcl -- # # This demonstration script creates a toplevel window containing several # simple Ttk widgets, such as labels, labelframes, buttons, checkbuttons and # radiobuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # ttkbut.tcl -- # # This demonstration script creates a toplevel window containing several # simple Ttk widgets, such as labels, labelframes, buttons, checkbuttons and # radiobuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkbut catch {destroy $w} toplevel $w wm title $w "Simple Ttk Widgets" wm iconname $w "ttkbut" positionWindow $w ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the “Enabled” button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons." pack $w.msg -side top -fill x ## See Code / Dismiss pack [addSeeDismiss $w.seeDismiss $w {enabled cheese tomato basil oregano happiness}]\ -side bottom -fill x ## Add buttons for setting the theme ttk::labelframe $w.buttons -text "Buttons" foreach theme [lsort [ttk::themes]] { ttk::button $w.buttons.$theme -text $theme \ -command [list ttk::setTheme $theme] pack $w.buttons.$theme -pady 1.5p } ## Helper procedure for the top checkbutton proc setState {rootWidget exceptThese value} { if {$rootWidget in $exceptThese} { return } |
︙ | ︙ | |||
61 62 63 64 65 66 67 | ttk::separator $w.checks.sep1 ttk::checkbutton $w.checks.c1 -text Cheese -variable cheese ttk::checkbutton $w.checks.c2 -text Tomato -variable tomato ttk::separator $w.checks.sep2 ttk::checkbutton $w.checks.c3 -text Basil -variable basil ttk::checkbutton $w.checks.c4 -text Oregano -variable oregano pack $w.checks.e $w.checks.sep1 $w.checks.c1 $w.checks.c2 $w.checks.sep2 \ | | | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | ttk::separator $w.checks.sep1 ttk::checkbutton $w.checks.c1 -text Cheese -variable cheese ttk::checkbutton $w.checks.c2 -text Tomato -variable tomato ttk::separator $w.checks.sep2 ttk::checkbutton $w.checks.c3 -text Basil -variable basil ttk::checkbutton $w.checks.c4 -text Oregano -variable oregano pack $w.checks.e $w.checks.sep1 $w.checks.c1 $w.checks.c2 $w.checks.sep2 \ $w.checks.c3 $w.checks.c4 -fill x -pady 1.5p ## Set up the radiobutton group ttk::labelframe $w.radios -text "Radiobuttons" ttk::radiobutton $w.radios.r1 -text "Great" -variable happiness -value great ttk::radiobutton $w.radios.r2 -text "Good" -variable happiness -value good ttk::radiobutton $w.radios.r3 -text "OK" -variable happiness -value ok ttk::radiobutton $w.radios.r4 -text "Poor" -variable happiness -value poor ttk::radiobutton $w.radios.r5 -text "Awful" -variable happiness -value awful pack $w.radios.r1 $w.radios.r2 $w.radios.r3 $w.radios.r4 $w.radios.r5 \ -fill x -padx 3p -pady 1.5p ## Arrange things neatly pack [ttk::frame $w.f] -fill both -expand 1 lower $w.f grid $w.buttons $w.checks $w.radios -in $w.f -sticky nwe -pady 1.5p -padx 3p grid columnconfigure $w.f {0 1 2} -weight 1 -uniform yes |
Changes to library/demos/ttkmenu.tcl.
1 2 3 4 5 6 7 8 9 | # ttkmenu.tcl -- # # This demonstration script creates a toplevel window containing several Ttk # menubutton widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # ttkmenu.tcl -- # # This demonstration script creates a toplevel window containing several Ttk # menubutton widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkmenu catch {destroy $w} toplevel $w wm title $w "Ttk Menu Buttons" wm iconname $w "ttkmenu" positionWindow $w |
︙ | ︙ | |||
31 32 33 34 35 36 37 | menu $w.m1.menu -tearoff 0 menu $w.m2.menu -tearoff 0 menu $w.m3.menu -tearoff 0 menu $w.m4.menu -tearoff 0 menu $w.m5.menu -tearoff 0 | | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | menu $w.m1.menu -tearoff 0 menu $w.m2.menu -tearoff 0 menu $w.m3.menu -tearoff 0 menu $w.m4.menu -tearoff 0 menu $w.m5.menu -tearoff 0 foreach theme [lsort [ttk::themes]] { $w.m1.menu add command -label $theme -command [list ttk::setTheme $theme] $w.m2.menu add command -label $theme -command [list ttk::setTheme $theme] $w.m3.menu add command -label $theme -command [list ttk::setTheme $theme] $w.m4.menu add command -label $theme -command [list ttk::setTheme $theme] $w.m5.menu add command -label $theme -command [list ttk::setTheme $theme] } pack [ttk::frame $w.f] -fill x pack [ttk::frame $w.f1] -fill both -expand yes lower $w.f grid anchor $w.f center grid x $w.m1 x -in $w.f -padx 2.25p -pady 1.5p grid $w.m2 $w.m4 $w.m3 -in $w.f -padx 2.25p -pady 1.5p grid x $w.m5 x -in $w.f -padx 2.25p -pady 1.5p |
Changes to library/demos/ttknote.tcl.
1 2 3 4 5 6 7 8 9 | # ttknote.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # notebook widget. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # ttknote.tcl -- # # This demonstration script creates a toplevel window containing a Ttk # notebook widget. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttknote catch {destroy $w} toplevel $w wm title $w "Ttk Notebook Widget" wm iconname $w "ttknote" positionWindow $w ## See Code / Dismiss pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x ttk::frame $w.f pack $w.f -fill both -expand 1 set w $w.f ## Make the notebook and set up Ctrl+Tab traversal ttk::notebook $w.note pack $w.note -fill both -expand 1 -padx 1.5p -pady 3p ttk::notebook::enableTraversal $w.note ## Popuplate the first pane ttk::frame $w.note.msg ttk::label $w.note.msg.m -font $font -wraplength 4i -justify left -anchor n -text "Ttk is the new Tk themed widget set. One of the widgets it includes is the notebook widget, which provides a set of tabs that allow the selection of a group of panels, each with distinct content. They are a feature of many modern user interfaces. Not only can the tabs be selected with the mouse, but they can also be switched between using Ctrl+Tab when the notebook page heading itself is selected. Note that the second tab is disabled, and cannot be selected." ttk::button $w.note.msg.b -text "Neat!" -underline 0 -command { set neat "Yeah, I know..." after 500 {set neat {}} } bind $w <Alt-n> "focus $w.note.msg.b; $w.note.msg.b invoke" ttk::label $w.note.msg.l -textvariable neat $w.note add $w.note.msg -text "Description" -underline 0 -padding 1.5p grid $w.note.msg.m - -sticky new -pady 1.5p grid $w.note.msg.b $w.note.msg.l -pady {1.5p 3p} grid rowconfigure $w.note.msg 1 -weight 1 grid columnconfigure $w.note.msg {0 1} -weight 1 -uniform 1 ## Populate the second pane. Note that the content doesn't really matter ttk::frame $w.note.disabled $w.note add $w.note.disabled -text "Disabled" -state disabled ## Popuplate the third pane ttk::frame $w.note.editor $w.note add $w.note.editor -text "Text Editor" -underline 0 text $w.note.editor.t -width 40 -height 10 -wrap char \ -yscroll "$w.note.editor.s set" ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview" pack $w.note.editor.s -side right -fill y -padx {0 1.5p} -pady 1.5p pack $w.note.editor.t -fill both -expand 1 -pady 1.5p -padx {1.5p 0} |
Changes to library/demos/ttkpane.tcl.
1 2 3 4 5 6 7 8 | # ttkpane.tcl -- # # This demonstration script creates a Ttk pane with some content. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # ttkpane.tcl -- # # This demonstration script creates a Ttk pane with some content. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkpane catch {destroy $w} toplevel $w wm title $w "Themed Nested Panes" wm iconname $w "ttkpane" positionWindow $w |
︙ | ︙ | |||
38 39 40 41 42 43 44 | } # Fill the button pane ttk::button $w.outer.inLeft.top.b -text "Press Me" -command { tk_messageBox -type ok -icon info -message "Ouch!" -detail "That hurt..." \ -parent .ttkpane -title "Button Pressed" } | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | } # Fill the button pane ttk::button $w.outer.inLeft.top.b -text "Press Me" -command { tk_messageBox -type ok -icon info -message "Ouch!" -detail "That hurt..." \ -parent .ttkpane -title "Button Pressed" } pack $w.outer.inLeft.top.b -padx 1.5p -pady 3p # Fill the clocks pane set i 0 proc every {delay script} { uplevel #0 $script after $delay [list every $delay $script] } |
︙ | ︙ | |||
93 94 95 96 97 98 99 | # The trick with the ttk::frame makes the text widget look like it fits with # the current Ttk theme despite not being a themed widget itself. It is done # by styling the frame like an entry, turning off the border in the text # widget, and putting the text widget in the frame with enough space to allow # the surrounding border to show through (2 pixels seems to be enough). ttk::frame $w.outer.inRight.bot.f -style TEntry text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | # The trick with the ttk::frame makes the text widget look like it fits with # the current Ttk theme despite not being a themed widget itself. It is done # by styling the frame like an entry, turning off the border in the text # widget, and putting the text widget in the frame with enough space to allow # the surrounding border to show through (2 pixels seems to be enough). ttk::frame $w.outer.inRight.bot.f -style TEntry text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 1.5p -padx 1.5p ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" pack $w.sb -side right -fill y -in $w.outer.inRight.bot pack $w.outer.inRight.bot.f -fill both -expand 1 pack $w.outer -fill both -expand 1 } else { text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" pack $w.sb -side right -fill y -in $w.outer.inRight.bot pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot pack $w.outer -fill both -expand 1 -padx 10 -pady {6 10} } |
Changes to library/demos/ttkprogress.tcl.
1 2 3 4 5 6 7 8 | # ttkprogress.tcl -- # # This demonstration script creates several progress bar widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # ttkprogress.tcl -- # # This demonstration script creates several progress bar widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkprogress catch {destroy $w} toplevel $w wm title $w "Progress Bar Demonstration" wm iconname $w "ttkprogress" positionWindow $w |
︙ | ︙ | |||
34 35 36 37 38 39 40 | ttk::progressbar $w.p1 -mode determinate ttk::progressbar $w.p2 -mode indeterminate ttk::button $w.start -text "Start Progress" -command [list \ doBars start $w.p1 $w.p2] ttk::button $w.stop -text "Stop Progress" -command [list \ doBars stop $w.p1 $w.p2] | | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 | ttk::progressbar $w.p1 -mode determinate ttk::progressbar $w.p2 -mode indeterminate ttk::button $w.start -text "Start Progress" -command [list \ doBars start $w.p1 $w.p2] ttk::button $w.stop -text "Stop Progress" -command [list \ doBars stop $w.p1 $w.p2] grid $w.p1 - -pady 3p -padx 7.5p grid $w.p2 - -pady 3p -padx 7.5p grid $w.start $w.stop -padx 7.5p -pady 3p grid configure $w.start -sticky e grid configure $w.stop -sticky w grid columnconfigure $w all -weight 1 |
Changes to library/demos/ttkscale.tcl.
1 2 3 4 5 6 7 8 | # ttkscale.tcl -- # # This demonstration script shows an example with a horizontal scale. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # ttkscale.tcl -- # # This demonstration script shows an example with a horizontal scale. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkscale catch {destroy $w} toplevel $w -bg [ttk::style lookup TLabel -background] wm title $w "Themed Scale Demonstration" wm iconname $w "ttkscale" positionWindow $w pack [ttk::frame [set w $w.contents]] -fill both -expand 1 ttk::label $w.msg -font $font -wraplength 3.5i -justify left -text "A label tied to a horizontal scale is displayed below. If you click or drag mouse button 1 in the scale, you can change the contents of the label; a callback command is used to couple the slider to both the text and the coloring of the label." pack $w.msg -side top -padx .5c ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons [winfo toplevel $w]] pack $btns -side bottom -fill x ttk::frame $w.frame -borderwidth 7.5p pack $w.frame -side top -fill x # List of colors from rainbow; "Indigo" is not a standard color set colorList {Red Orange Yellow Green Blue Violet} ttk::label $w.frame.label ttk::scale $w.frame.scale -from 0 -to 5 -command [list apply {{w idx} { set c [lindex $::colorList [tcl::mathfunc::int $idx]] $w.frame.label configure -foreground $c -text "Color: $c" }} $w] # Trigger the setting of the label's text $w.frame.scale set 0 pack $w.frame.label $w.frame.scale |
Added library/demos/ttkspin.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 | # ttkspin.tcl -- # # This demonstration script creates several Ttk spinbox widgets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .ttkspin catch {destroy $w} toplevel $w wm title $w "Themed Spinbox Demonstration" wm iconname $w "ttkspin" positionWindow $w label $w.msg -font $font -wraplength 5i -justify left -text "Three different\ themed spin-boxes are displayed below. You can add characters by\ pointing, clicking and typing. The normal Motif editing characters\ are supported, along with many Emacs bindings. For example, Backspace\ and Control-h delete the character to the left of the insertion\ cursor and Delete and Control-d delete the chararacter to the right\ of the insertion cursor. For values that are too large to fit in the\ window all at once, you can scan through the value by dragging with\ mouse button2 pressed. Note that the first spin-box will only permit\ you to type in integers, and the third selects from a list of\ Australian cities." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set australianCities { Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart Darwin "Alice Springs" } ttk::spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \ -validatecommand {string is integer %P} ttk::spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10 ttk::spinbox $w.s3 -values $australianCities -width 10 $w.s1 set 1 $w.s2 set 00.00 $w.s3 set Canberra pack $w.s1 $w.s2 $w.s3 -side top -pady 3p -padx 7.5p |
Changes to library/demos/twind.tcl.
1 2 3 4 5 6 7 8 9 | # twind.tcl -- # # This demonstration script creates a text widget with a bunch of # embedded windows. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # twind.tcl -- # # This demonstration script creates a text widget with a bunch of # embedded windows. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk # Make an Aqua button's fill color match its parent's background proc blend {bt} { if {[tk windowingsystem] eq "aqua"} { $bt configure -highlightbackground [[winfo parent $bt] cget -background] } return $bt |
︙ | ︙ | |||
33 34 35 36 37 38 39 | text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \ -height 35 -wrap word -highlightthickness 0 -borderwidth 0 pack $t -expand yes -fill both ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y panedwindow $w.pane pack $w.pane -expand yes -fill both | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | text $t -yscrollcommand "$w.scroll set" -setgrid true -font $font -width 70 \ -height 35 -wrap word -highlightthickness 0 -borderwidth 0 pack $t -expand yes -fill both ttk::scrollbar $w.scroll -command "$t yview" pack $w.scroll -side right -fill y panedwindow $w.pane pack $w.pane -expand yes -fill both $w.pane add $w.f -stretch always # Import to raise given creation order above raise $w.f $t tag configure center -justify center -spacing1 5m -spacing3 5m $t tag configure buttons -lmargin1 1c -lmargin2 1c -rmargin 1c \ -spacing1 3m -spacing2 0 -spacing3 0 |
︙ | ︙ | |||
88 89 90 91 92 93 94 | $t insert end " the plot again.\n\n" $t insert end "You can also create multiple text widgets each of which " $t insert end "display the same underlying text. Click this button to " $t window create end \ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \ -cursor top_left_arrow | | | | 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 | $t insert end " the plot again.\n\n" $t insert end "You can also create multiple text widgets each of which " $t insert end "display the same underlying text. Click this button to " $t window create end \ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \ -cursor top_left_arrow blend %W.peer} -padx 3p $t insert end " widget. Notice how peer widgets can have different " $t insert end "font settings, and by default contain all the images " $t insert end "of the 'parent', but that the embedded windows, " $t insert end "such as buttons may not appear in the peer. To ensure " $t insert end "that embedded windows appear in all peers you can set the " $t insert end "'-create' option to a script or a string containing %W. " $t insert end "(The plot above and the 'Make A Peer' button are " $t insert end "designed to show up in all peers.) A good use of " $t insert end "peers is for " $t window create end \ -create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \ -cursor top_left_arrow blend %W.split} -padx 3p $t insert end " \n\n" $t insert end "Users of previous versions of Tk will also be interested " $t insert end "to note that now cursor movement is now by visual line by " $t insert end "default, and that all scrolling of this widget is by pixel.\n\n" $t insert end "You may also find it useful to put embedded windows in " |
︙ | ︙ | |||
124 125 126 127 128 129 130 | $t insert end "you can see how the text widget automatically " $t insert end "changes the layout. Click on the button again " $t insert end "to restore the short string.\n" $t insert end "\nNOTE: these buttons will not appear in peers!\n" "peer_warning" button $t.default -text Default -command "embDefBg $t" \ -cursor top_left_arrow | | | | | | 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 | $t insert end "you can see how the text widget automatically " $t insert end "changes the layout. Click on the button again " $t insert end "to restore the short string.\n" $t insert end "\nNOTE: these buttons will not appear in peers!\n" "peer_warning" button $t.default -text Default -command "embDefBg $t" \ -cursor top_left_arrow $t window create end -window $t.default -padx 3p global embToggle set embToggle Short checkbutton $t.toggle -textvariable embToggle -indicatoron 0 \ -variable embToggle -onvalue "A much longer string" \ -offvalue "Short" -cursor top_left_arrow -pady 3p -padx 1.5p $t window create end -window $t.toggle -padx 3p -pady 1.5p set i 1 foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4} { button $t.color$i -text $color -cursor top_left_arrow -command \ "changeBg $t $color" $t window create end -window [blend $t.color$i] -padx 3p -pady 1.5p incr i } $t tag add buttons [blend $t.default] end button $t.bigB -text "Big borders" -command "textWindBigB $t" \ -cursor top_left_arrow button $t.smallB -text "Small borders" -command "textWindSmallB $t" \ |
︙ | ︙ | |||
171 172 173 174 175 176 177 | $t window create end -window [blend $t.bigH] $t window create end -window [blend $t.smallH] $t window create end -window [blend $t.bigP] $t window create end -window [blend $t.smallP] $t insert end "\n\nFinally, images fit comfortably in text widgets too:" | > > > > > > > > | < | | | | 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 | $t window create end -window [blend $t.bigH] $t window create end -window [blend $t.smallH] $t window create end -window [blend $t.bigP] $t window create end -window [blend $t.smallP] $t insert end "\n\nFinally, images fit comfortably in text widgets too:" image create photo img -file [file join $tk_demoDirectory images ouster.png] # Create a copy of the image just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copy will only be effectively magnified if $tk::scalingPct >= 200. image create photo img2 img2 copy img -zoom [expr {$tk::scalingPct / 100}] $t image create end -image img2 proc textWindBigB w { $w configure -borderwidth 12p } proc textWindBigH w { $w configure -highlightthickness 12p } proc textWindBigP w { $w configure -padx 12p -pady 12p } proc textWindSmallB w { $w configure -borderwidth $::text_normal(border) } proc textWindSmallH w { |
︙ | ︙ | |||
339 340 341 342 343 344 345 | destroy .twind.peer } else { set parent [winfo parent $textW] set w [winfo parent $parent] set t [$textW peer create $w.peer \ -yscrollcommand "$w.scroll set"] $t tag configure peer_warning -font boldFont | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 | destroy .twind.peer } else { set parent [winfo parent $textW] set w [winfo parent $parent] set t [$textW peer create $w.peer \ -yscrollcommand "$w.scroll set"] $t tag configure peer_warning -font boldFont $w.pane add $t -stretch always } } else { return } } |
Changes to library/demos/unicodeout.tcl.
1 2 3 4 5 6 7 8 9 | # unicodeout.tcl -- # # This demonstration script shows how you can produce output (in label # widgets) using many different alphabets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # unicodeout.tcl -- # # This demonstration script shows how you can produce output (in label # widgets) using many different alphabets. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .unicodeout catch {destroy $w} toplevel $w wm title $w "Unicode Label Demonstration" wm iconname $w "unicodeout" positionWindow $w |
︙ | ︙ |
Changes to library/demos/vscale.tcl.
1 2 3 4 5 6 7 8 | # vscale.tcl -- # # This demonstration script shows an example with a vertical scale. if {![info exists widgetDemo]} { error "This script should be run from the \"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 | # vscale.tcl -- # # This demonstration script shows an example with a vertical scale. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require tk set w .vscale catch {destroy $w} toplevel $w wm title $w "Vertical Scale Demonstration" wm iconname $w "vscale" positionWindow $w label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a vertical scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the size of the arrow." pack $w.msg -side top -padx .5c ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x frame $w.frame -borderwidth 7.5p pack $w.frame scale $w.frame.scale -orient vertical -length 213p -from 0 -to 250 \ -command "setHeight $w.frame.canvas" -tickinterval 50 canvas $w.frame.canvas -width 37.5p -height 37.5p -bd 0 -highlightthickness 0 $w.frame.canvas create polygon 0 0 1 1 2 2 -fill SeaGreen3 -tags poly $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line frame $w.frame.right -borderwidth 11.25p pack $w.frame.scale -side left -anchor ne pack $w.frame.canvas -side left -anchor nw -fill y $w.frame.scale set 75 proc setHeight {w height} { incr height 21 set y2 [expr {$height - 30}] if {$y2 < 21} { set y2 21 } $w coords poly 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20 $w coords line 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20 set scaleFactor [expr {$tk::scalingPct / 100.0}] $w scale poly 0 0 $scaleFactor $scaleFactor $w scale line 0 0 $scaleFactor $scaleFactor } |
Changes to library/demos/widget.
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # widget -- # This script demonstrates the various widgets provided by Tk, along with many # of the features of the Tk toolkit. This file only contains code to generate # the main window for the application, which invokes individual # demonstrations. The code for the actual demonstrations is contained in # separate ".tcl" files is this directory, which are sourced by this script as # needed. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/bin/sh # the next line restarts using wish \ exec wish "$0" ${1+"$@"} # widget -- # This script demonstrates the various widgets provided by Tk, along with many # of the features of the Tk toolkit. This file only contains code to generate # the main window for the application, which invokes individual # demonstrations. The code for the actual demonstrations is contained in # separate ".tcl" files is this directory, which are sourced by this script as # needed. package require tk package require msgcat destroy {*}[winfo children .] set tk_demoDirectory [file join [pwd] [file dirname [info script]]] ::msgcat::mcload $tk_demoDirectory namespace import ::msgcat::mc wm title . [mc "Widget Demonstration"] if {[tk windowingsystem] eq "x11"} { # This won't work everywhere, but there's no other way in core Tk at the # moment to display a coloured icon. |
︙ | ︙ | |||
53 54 55 56 57 58 59 | font create varsFont -family Helvetica -size 14 } } set widgetDemo 1 set font mainFont | | | > > > | > > > > | | < < < > > > > | < < > > > > > | < < < < > > > > | > > > > > > > | | > | | < < < < < < < < | < > | > > > | > > > > > > | < > > > > > > | 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 | font create varsFont -family Helvetica -size 14 } } set widgetDemo 1 set font mainFont # The SVG images used below are based on some icons provided by the # official open source SVG icon library for the Bootstrap project, # licensed under the MIT license (https://opensource.org/licenses/MIT). # # See https://github.com/twbs/icons. set viewData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" fill="#000000"/> </svg> } set refreshData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="M11 5.466V4H5a4 4 0 0 0-3.584 5.777.5.5 0 1 1-.896.446A5 5 0 0 1 5 3h6V1.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384l-2.36 1.966a.25.25 0 0 1-.41-.192Zm3.81.086a.5.5 0 0 1 .67.225A5 5 0 0 1 11 13H5v1.466a.25.25 0 0 1-.41.192l-2.36-1.966a.25.25 0 0 1 0-.384l2.36-1.966a.25.25 0 0 1 .41.192V12h6a4 4 0 0 0 3.585-5.777.5.5 0 0 1 .225-.67Z" fill="#000000"/> </svg> } set printData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="M2.5 8a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z" fill="#000000"/> <path d="M5 1a2 2 0 0 0-2 2v2H2a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h1v1a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-1h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1V3a2 2 0 0 0-2-2H5zM4 3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2H4V3zm1 5a2 2 0 0 0-2 2v1H2a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v-1a2 2 0 0 0-2-2H5zm7 2v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1z" fill="#000000"/> </svg> } proc images {arg} { set fgColor [ttk::style lookup . -foreground {} black] lassign [winfo rgb . $fgColor] r g b set fgColor [format "#%02x%02x%02x" \ [expr {$r >> 8}] [expr {$g >> 8}] [expr {$b >> 8}]] foreach action {view refresh print} { upvar ${action}Data imgData for {set data $imgData; set startIdx 0} \ {[set idx1 [string first "#000000" $data $startIdx]] >= 0} \ {set startIdx [expr {$idx1 + 7}]} { set idx2 [expr {$idx1 + 6}] set data [string replace $data $idx1 $idx2 $fgColor] } switch $arg { create { image create photo ::img::$action -format $::tk::svgFmt \ -data $data } configure { ::img::$action configure -data $data } } } } images create set mainClass [winfo class .] foreach event {<<ThemeChanged>> <<LightAqua>> <<DarkAqua>>} { bind $mainClass $event { images configure } } unset mainClass event image create photo ::img::delete -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z" fill="#d00000"/> </svg> } #---------------------------------------------------------------- # The code below creates the main window, consisting of a menu bar and a text # widget that explains how to use the program, plus lists all of the demos as # hypertext items. #---------------------------------------------------------------- |
︙ | ︙ | |||
132 133 134 135 136 137 138 | ttk::frame .statusBar ttk::label .statusBar.lab -text " " -anchor w if {[tk windowingsystem] eq "aqua"} { ttk::separator .statusBar.sep pack .statusBar.sep -side top -expand yes -fill x -pady 0 } | | | | | | 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 | ttk::frame .statusBar ttk::label .statusBar.lab -text " " -anchor w if {[tk windowingsystem] eq "aqua"} { ttk::separator .statusBar.sep pack .statusBar.sep -side top -expand yes -fill x -pady 0 } pack .statusBar.lab -side left -padx 1.5p -expand yes -fill both if {[tk windowingsystem] ne "aqua"} { ttk::sizegrip .statusBar.foo pack .statusBar.foo -side left -padx 1.5p } pack .statusBar -side bottom -fill x -pady 1.5p set textheight 30 catch { set textheight [expr { ([winfo screenheight .] * 0.7) / [font metrics mainFont -displayof . -linespace] }] } ttk::frame .textFrame ttk::scrollbar .s -orient vertical -command {.t yview} -takefocus 1 pack .s -in .textFrame -side right -fill y text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \ -font mainFont -setgrid 1 -highlightthickness 0 \ -padx 3p -pady 1.5p -takefocus 0 pack .t -in .textFrame -expand y -fill both -padx 1 pack .textFrame -expand yes -fill both if {[tk windowingsystem] eq "aqua"} { pack configure .statusBar.lab -padx {10 18} -pady {4 6} pack configure .statusBar -pady 0 .t configure -padx 10 -pady 0 } |
︙ | ︙ | |||
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | -foreground #303080 -underline 1 if {[tk windowingsystem] eq "aqua"} { .t tag configure demo -foreground systemLinkColor .t tag configure visited -foreground purple } .t tag configure hot -foreground red -underline 1 } .t tag bind demo <ButtonRelease-1> { invoke [.t index {@%x,%y}] } set lastLine "" .t tag bind demo <Enter> { set lastLine [.t index {@%x,%y linestart}] .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars" | > > > > > | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | -foreground #303080 -underline 1 if {[tk windowingsystem] eq "aqua"} { .t tag configure demo -foreground systemLinkColor .t tag configure visited -foreground purple } .t tag configure hot -foreground red -underline 1 } # The tag "new" must be the one having the highest priority. # .t tag configure new -foreground #c00000 -underline 0 -font boldFont .t tag bind demo <ButtonRelease-1> { invoke [.t index {@%x,%y}] } set lastLine "" .t tag bind demo <Enter> { set lastLine [.t index {@%x,%y linestart}] .t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars" |
︙ | ︙ | |||
271 272 273 274 275 276 277 | set demoCount 0 } demo { set description [lassign $values name] .t insert end "[incr demoCount]. [mc $description]" \ [list demo demo-$name] if {$new} { | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | set demoCount 0 } demo { set description [lassign $values name] .t insert end "[incr demoCount]. [mc $description]" \ [list demo demo-$name] if {$new} { .t insert end " [mc NEW]" new set new 0 } .t insert end " \n " demospace } new { set new 1 } |
︙ | ︙ | |||
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 | | > > > > > > > > > > > > > > > | 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 | @@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 { @@subtitle Mac-Specific Widgets and Window Styles @@new @@demo mac_styles Special widgets for macOS @@new @@demo mac_wm Window styles for macOS @@new @@demo mac_tabs Tabbed Windows on 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 @@subtitle Entries, Spin-boxes and Combo-boxes @@demo entry1 Entries without scrollbars @@demo entry2 Entries with scrollbars @@demo entry3 Validated entries and password fields @@demo spin Spin-boxes @@demo ttkspin Themed spin-boxes @@demo combo Combo-boxes @@demo form Simple Rolodex-like form @@subtitle Text @@demo text Basic editable text @@demo style Text display styles @@demo bind Hypertext (tag bindings) |
︙ | ︙ | |||
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 | < > > > > > > < > | | | 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 | @@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 # addSeeDismiss -- # Add "See Code" and "Dismiss" button frame, with optional "See Vars" # # Arguments: # w - The name of the frame to use. proc addSeeDismiss {w show {vars {}} {extra {}}} { ## See Code / Dismiss buttons ttk::frame $w #ttk::frame $w.sep -height 2 -relief sunken ttk::separator $w.sep grid $w.sep -columnspan 4 -row 0 -sticky ew -pady 1.5p ttk::button $w.dismiss -text [mc "Dismiss"] \ -image ::img::delete -compound left \ -command [list destroy [winfo toplevel $w]] ttk::button $w.code -text [mc "See Code"] \ -image ::img::view -compound left \ -command [list showCode $show] set buttons [list x $w.code $w.dismiss] if {[llength $vars]} { ttk::button $w.vars -text [mc "See Variables"] \ -image ::img::view -compound left \ -command [concat [list showVars $w.dialog] $vars] set buttons [linsert $buttons 1 $w.vars] } if {$extra ne ""} { set buttons [linsert $buttons 1 [uplevel 1 $extra]] } grid {*}$buttons -padx 3p -pady 3p grid columnconfigure $w 0 -weight 1 if {[tk windowingsystem] eq "aqua"} { foreach b [lrange $buttons 1 end] {$b configure -takefocus 0} grid configure $w.sep -pady 0 grid configure {*}$buttons -pady {10 12} grid configure [lindex $buttons 1] -padx {16 4} grid configure [lindex $buttons end] -padx {4 18} |
︙ | ︙ | |||
472 473 474 475 476 477 478 | set b [ttk::frame $w.frame] grid $b -sticky news set f [ttk::labelframe $b.title -text [mc "Variable values:"]] foreach var $args { ttk::label $f.n$var -text "$var:" -anchor w ttk::label $f.v$var -textvariable $var -anchor w | | | | | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | set b [ttk::frame $w.frame] grid $b -sticky news set f [ttk::labelframe $b.title -text [mc "Variable values:"]] foreach var $args { ttk::label $f.n$var -text "$var:" -anchor w ttk::label $f.v$var -textvariable $var -anchor w grid $f.n$var $f.v$var -padx 1.5p -pady 1.5p -sticky w } ttk::button $b.ok -text [mc "OK"] \ -command [list destroy $w] -default active bind $w <Return> [list $b.ok invoke] bind $w <Escape> [list $b.ok invoke] grid $f -sticky news -padx 3p grid $b.ok -sticky e -padx 3p -pady {4.5p 3p} if {[tk windowingsystem] eq "aqua"} { $b.ok configure -takefocus 0 grid configure $b.ok -pady {10 12} -padx {16 18} grid configure $f -padx 10 -pady {10 0} } grid columnconfig $f 1 -weight 1 grid rowconfigure $f 100 -weight 1 |
︙ | ︙ | |||
571 572 573 574 575 576 577 | toplevel $top if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog} set t [frame $top.f] set text [text $t.text -font fixedFont -height 24 -wrap word \ -xscrollcommand [list $t.xscroll set] \ -yscrollcommand [list $t.yscroll set] \ | | > | | | 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 | toplevel $top if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog} set t [frame $top.f] set text [text $t.text -font fixedFont -height 24 -wrap word \ -xscrollcommand [list $t.xscroll set] \ -yscrollcommand [list $t.yscroll set] \ -setgrid 1 -highlightthickness 0 -padx 3p -pady 1.5p \ -tabstyle wordprocessor] ttk::scrollbar $t.xscroll -command [list $t.text xview] \ -orient horizontal ttk::scrollbar $t.yscroll -command [list $t.text yview] \ -orient vertical grid $t.text $t.yscroll -sticky news #grid $t.xscroll grid rowconfigure $t 0 -weight 1 grid columnconfig $t 0 -weight 1 set btns [ttk::frame $top.btns] ttk::separator $btns.sep grid $btns.sep -columnspan 4 -row 0 -sticky ew -pady 1.5p ttk::button $btns.dismiss -text [mc "Dismiss"] \ -default active -command [list destroy $top] \ -image ::img::delete -compound left ttk::button $btns.print -text [mc "Print Code"] \ -command [list printCode $text $file] \ -image ::img::print -compound left ttk::button $btns.rerun -text [mc "Rerun Demo"] \ -command [list evalShowCode $text] \ -image ::img::refresh -compound left set buttons [list x $btns.rerun $btns.print $btns.dismiss] grid {*}$buttons -padx 3p -pady 3p grid columnconfigure $btns 0 -weight 1 if {[tk windowingsystem] eq "aqua"} { foreach b [lrange $buttons 1 end] {$b configure -takefocus 0} grid configure $btns.sep -pady 0 grid configure {*}$buttons -pady {10 12} grid configure [lindex $buttons 1] -padx {16 4} grid configure [lindex $buttons end] -padx {4 18} |
︙ | ︙ | |||
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]] | | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > | 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 | } 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 100 101 102 103 104 105 106 107 108 | # 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 ## See Code / Dismiss buttons pack [addSeeDismiss $w.buttons $w] -side bottom -fill x 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 # Create a copy of the image just created, magnified according to the # display's DPI scaling level. Since the zooom factor must be an integer, # the copy will only be effectively magnified if $tk::scalingPct >= 200. image create photo icon2 icon2 copy icon -zoom [expr {$tk::scalingPct / 100}] pack [button $w.i -text "Set Window Icon to Globe" -image icon2 \ -compound top -command {wm iconphoto . icon}] -fill x -padx 3p pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] \ -fill x -padx 3p pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] \ -fill x -padx 3p pack [button $w.f -text "Reset Badge" -command {wm iconbadge . ""}] \ -fill x -padx 3p |
Changes to library/dialog.tcl.
︙ | ︙ | |||
105 106 107 108 109 110 111 | button $w.button$i -text $but -command [list set ::tk::Priv(button) $i] if {$i == $default} { $w.button$i configure -default active } else { $w.button$i configure -default normal } grid $w.button$i -in $w.bot -column $i -row 0 -sticky ew \ | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | button $w.button$i -text $but -command [list set ::tk::Priv(button) $i] if {$i == $default} { $w.button$i configure -default active } else { $w.button$i configure -default normal } grid $w.button$i -in $w.bot -column $i -row 0 -sticky ew \ -padx 7.5p -pady 3p grid columnconfigure $w.bot $i # We boost the size of some Mac buttons for l&f if {$windowingsystem eq "aqua"} { set tmp [string tolower $but] if {$tmp eq "ok" || $tmp eq "cancel"} { grid columnconfigure $w.bot $i -minsize 90 } |
︙ | ︙ |
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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 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] } bind Entry <<SelectPrevWord>> { tk::EntryKeySelect %W [tk::EntryPreviousWord %W insert] tk::EntrySeeInsert %W } bind Entry <<SelectNextWord>> { tk::EntryKeySelect %W [tk::EntrySelectNextWord %W insert] tk::EntrySeeInsert %W } bind Entry <<LineStart>> { tk::EntrySetCursor %W 0 } bind Entry <<SelectLineStart>> { tk::EntryKeySelect %W 0 |
︙ | ︙ | |||
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 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | 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 start-of-word position after the next # end-of-word position after a given position in the text. # # Arguments: # w - The entry window in which the cursor is to move. # start - Position at which to start search. proc ::tk::EntryNextWord {w start} { # the check on [winfo class] is because the spinbox also uses this proc if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} { return end } 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 } # ::tk::EntrySelectNextWord -- # Returns the index of the next end-of-word position after a given # position in the text. # # Arguments: # w - The entry window in which the cursor is to move. # start - Position at which to start search. proc ::tk::EntrySelectNextWord {w start} { # the check on [winfo class] is because the spinbox also uses this proc if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} { return end } 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} { # the check on [winfo class] is because the spinbox also uses this proc if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} { return 0 } 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 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 | } 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 outer [::ttk::frame $S(W).outer -padding {7.5p 7.5p}] ::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:"] 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) [::tk::ScaleNum 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 [::tk::ScaleNum 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]] bind $S(W).lfonts.list <<ListboxSelect>> [namespace code [list Click font]] bind $S(W).lstyles.list <<ListboxSelect>> [namespace code [list Click style]] bind $S(W).lsizes.list <<ListboxSelect>> [namespace code [list Click size]] bind $S(W) <Alt-Key> [list ::tk::AltKeyInDialog $S(W) %A] bind $S(W).font <<AltUnderlined>> [list ::focus $S(W).efont] bind $S(W).style <<AltUnderlined>> [list ::focus $S(W).estyle] bind $S(W).size <<AltUnderlined>> [list ::focus $S(W).esize] 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 4.5p -pady 3p 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 1.5p} grid $S(W).cancel -in $bbox -sticky new -pady 1.5p grid $S(W).apply -in $bbox -sticky new -pady 1.5p grid columnconfigure $bbox 0 -weight 1 grid $WE.strike -sticky w -padx 7.5p grid $WE.under -sticky w -padx 7.5p -pady {0 22.5p} 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 {11p 22.5p} 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 remove variable S(size) write [namespace code [list Tracer]] trace remove variable S(style) write [namespace code [list Tracer]] trace remove variable S(font) write [namespace code [list Tracer]] trace remove variable S(strike) write [namespace code [list Tracer]] trace remove variable S(under) write [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) | > > < < < < < < < | | < | < | | | | | | | > > > > | < < | > | | > | > > | | > | > > | > > > | > | > > | > > | > > | > > | > | > > | | | 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 | # 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 1.5p] if {[catch { listbox $f.list -relief flat -highlightthickness 0 -borderwidth 0 {*}$args ttk::scrollbar $f.vs -command [list $f.list yview] $f.list configure -yscrollcommand [list $f.vs set] grid $f.list $f.vs -sticky news grid rowconfigure $f 0 -weight 1 grid columnconfigure $f 0 -weight 1 |
︙ | ︙ |
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 |
︙ | ︙ | |||
373 374 375 376 377 378 379 | } my DrawSelection } method DrawSelection {} { $canvas delete selection | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | } my DrawSelection } method DrawSelection {} { $canvas delete selection $canvas itemconfigure selectionText -fill $fill $canvas dtag selectionText set cbg [ttk::style lookup TEntry -selectbackground focus] set cfg [ttk::style lookup TEntry -selectforeground focus] foreach item $selection { set rTag [lindex $list $item 2] foreach {iTag tTag text serial} $itemList($rTag) { break |
︙ | ︙ | |||
401 402 403 404 405 406 407 | # operations. # method Create {} { variable hull set sbar [ttk::scrollbar $hull.sbar -orient horizontal -takefocus 0] catch {$sbar configure -highlightthickness 0} set canvas [canvas $hull.canvas -highlightthick 0 -takefocus 1 \ | > | | | < < < < | < | 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 | # operations. # method Create {} { variable hull set sbar [ttk::scrollbar $hull.sbar -orient horizontal -takefocus 0] catch {$sbar configure -highlightthickness 0} set canvas [canvas $hull.canvas -highlightthick 0 -takefocus 1 \ -width 300p -height 90p \ -background [ttk::style lookup Treeview -background {} white]] pack $sbar -side bottom -fill x -padx 1.5p -pady {0 1.5p} pack $canvas -expand yes -fill both -padx 1.5p -pady {1.5p 0} $sbar configure -command [list $canvas xview] $canvas configure -xscrollcommand [list $sbar set] # Initializes the max icon/text width and height and other variables # set maxIW 1 set maxIH 1 set maxTW 1 set maxTH 1 set numItems 0 set noScroll 1 set selection {} set index(anchor) "" set fill [ttk::style lookup Treeview -foreground {} black] # Creates the event bindings. # bind $canvas <Configure> [namespace code {my WhenIdle Arrange}] bind $canvas <Button-1> [namespace code {my Btn1 %x %y}] bind $canvas <B1-Motion> [namespace code {my Motion1 %x %y}] |
︙ | ︙ | |||
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}] | > > | > | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | 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 | # icons.tcl -- # # A set of stock icons for use in Tk dialogs. The icons used 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # icons.tcl -- # # A set of stock icons for use in Tk dialogs. The icons used here # were provided by the Vimix Icon Theme 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/4.0/) # # See https://github.com/vinceliuice/vimix-icon-theme # # Copyright © 2009 Pat Thoyts <[email protected]> # Copyright © 2022 Harald Oehlmann <[email protected]> # Copyright © 2022 Csaba Nemethi <[email protected]> namespace eval ::tk::icons {} variable ::tk::svgFmt [list svg -scale [expr {[::tk::ScalingPct] / 100.0}]] image create photo ::tk::icons::error -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="#d32f2f"/> <g transform="rotate(45,16,16)" fill="#fff"> <rect x="6" y="14" width="20" height="4"/> <rect x="14" y="6" width="4" height="20"/> </g> </svg> } image create photo ::tk::icons::warning -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="#f67400"/> <circle cx="16" cy="24" r="2" fill="#fff"/> <path d="m14 20h4v-14h-4z" fill="#fff"/> </svg> } image create photo ::tk::icons::information -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="#2091df"/> <circle cx="16" cy="8" r="2" fill="#fff"/> <path d="m14 12h4v14h-4z" fill="#fff"/> </svg> } image create photo ::tk::icons::question -format $::tk::svgFmt -data { <?xml version="1.0" encoding="UTF-8"?> <svg width="32" height="32" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="#5c6bc0"/> <path d="m17.6 27.2h-3.2v-3.2h3.2zm3.312-12.4-1.44 1.472c-1.152 1.168-1.872 2.128-1.872 4.528h-3.2v-0.8c0-1.76 0.72-3.36 1.872-4.528l1.984-2.016a3.128 3.128 0 0 0 0.944-2.256c0-1.76-1.44-3.2-3.2-3.2s-3.2 1.44-3.2 3.2h-3.2c0-3.536 2.864-6.4 6.4-6.4s6.4 2.864 6.4 6.4c0 1.408-0.576 2.688-1.488 3.6z" fill="#fff"/> </svg> } |
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: # |
︙ | ︙ | |||
171 172 173 174 175 176 177 | bind Listbox <Button-2> { %W scan mark %x %y } bind Listbox <B2-Motion> { %W scan dragto %x %y } | < | | | | > > > > > > > > > > > > | 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 | bind Listbox <Button-2> { %W scan mark %x %y } bind Listbox <B2-Motion> { %W scan dragto %x %y } bind Listbox <MouseWheel> { tk::MouseWheel %W y %D -40.0 units } bind Listbox <Option-MouseWheel> { tk::MouseWheel %W y %D -12.0 units } bind Listbox <Shift-MouseWheel> { tk::MouseWheel %W x %D -40.0 units } bind Listbox <Shift-Option-MouseWheel> { tk::MouseWheel %W x %D -12.0 units } bind Listbox <TouchpadScroll> { if {%# %% 5 != 0} { return } lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0} { %W xview scroll [expr {-$deltaX}] units } if {$deltaY != 0} { %W yview scroll [expr {-$deltaY}] units } } # ::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) | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | $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) | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | 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 |
︙ | ︙ | |||
280 281 282 283 284 285 286 | {-cursor cursor Cursor {}} {-takefocus takeFocus TakeFocus ::ttk::takefocus} } } method CreateHull {} { ttk::frame $w set hull [ttk::entry $w.cHull -takefocus 0 -cursor $options(-cursor)] | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | {-cursor cursor Cursor {}} {-takefocus takeFocus TakeFocus ::ttk::takefocus} } } method CreateHull {} { ttk::frame $w set hull [ttk::entry $w.cHull -takefocus 0 -cursor $options(-cursor)] pack $hull -expand yes -fill both -ipadx 1.5p -ipady 1.5p my TraceOption -cursor UpdateCursorOption } } return # Local Variables: # mode: tcl # fill-column: 78 # End: |
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 | 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 activeindex [$w index active] set isCascade [string equal [$w type $activeindex] "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 $activeindex] } } else { if {$Priv(popup) eq "" || [$w index 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"} { | | | | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | 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 "" \ | | | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | 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} { | | > | | | | | 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 | # # 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 {$last+1}] set quitAfter $length set activeindex [$menu index active] if {$activeindex < 0} { set i 0 } else { set i [expr {$activeindex + $count}] } while {1} { if {$quitAfter <= 0} { # We've tried every entry in the menu. Either there are # none, or they're all disabled. Just give up. return |
︙ | ︙ | |||
846 847 848 849 850 851 852 | if {[catch {$menu entrycget $i -state} state] == 0} { if {$state ne "disabled" && \ ($i!=0 || [$menu cget -type] ne "tearoff" \ || [$menu type 0] ne "tearoff")} { break } } | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | if {[catch {$menu entrycget $i -state} state] == 0} { if {$state ne "disabled" && \ ($i!=0 || [$menu cget -type] ne "tearoff" \ || [$menu type 0] ne "tearoff")} { break } } if {$i == $activeindex} { return } incr i $count incr quitAfter -1 } $menu activate $i GenerateMenuSelect $menu |
︙ | ︙ | |||
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. | | | < | > | < | | 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 | 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 } set last [$child index last] for {set i [$child cget -tearoff]} {$i <= $last} {incr i} { if {([$child type $i] eq "separator") || ([$child entrycget $i -state] eq "disabled")} { continue } set underline [$child entrycget $i -underline] if {$underline >= 0} { if {$char eq [string tolower [string index [$child entrycget $i -label] $underline]]} { return $child } } } } } 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] | < < < | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | 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 | | < < < | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | # 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] | < < < | 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | 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"} { | | | 1126 1127 1128 1129 1130 1131 1132 1133 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"} { 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] } | | | | < < < < | | > > > > > | | > | | | | 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 | } 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 | > | | 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | # 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 |
︙ | ︙ | |||
1336 1337 1338 1339 1340 1341 1342 | } focus $menu } proc ::tk::GenerateMenuSelect {menu} { variable ::tk::Priv | | | < < < | | | > | 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | } focus $menu } proc ::tk::GenerateMenuSelect {menu} { variable ::tk::Priv if {$Priv(activeMenu) ne $menu \ || $Priv(activeItem) ne [$menu index active]} { set Priv(activeMenu) $menu set Priv(activeItem) [$menu index active] event generate $menu <<MenuSelect>> } } # ::tk_popup -- # This procedure pops up a menu and sets things up for traversing # the menu and its submenus. # # Arguments: |
︙ | ︙ | |||
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]} { | | | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 | 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/msgbox.tcl.
︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | # by tk_messageBox if the platform does not have native # messagebox support, or if the particular type of messagebox is # not supported natively. # # Color icons are used on Unix displays that have a color # depth of 4 or more and $tk_strictMotif is not on. # # This procedure is a private procedure shouldn't be called # directly. Call tk_messageBox instead. # # See the user documentation for details on what tk_messageBox does. # proc ::tk::MessageBox {args} { global tk_strictMotif | > > > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | # by tk_messageBox if the platform does not have native # messagebox support, or if the particular type of messagebox is # not supported natively. # # Color icons are used on Unix displays that have a color # depth of 4 or more and $tk_strictMotif is not on. # # Uses ::tk::Priv.${disp}(button) instead of ::tk::Priv(button) to # avoid adverse effects of [::tk::ScreenChanged]. Bug [e2cec2fa41]. # # This procedure is a private procedure shouldn't be called # directly. Call tk_messageBox instead. # # See the user documentation for details on what tk_messageBox does. # proc ::tk::MessageBox {args} { global tk_strictMotif |
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 | } } if {![winfo exists $data(-parent)]} { return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \ "bad window path name \"$data(-parent)\"" } switch -- $data(-type) { abortretryignore { set names [list abort retry ignore] set labels [list &Abort &Retry &Ignore] set cancel abort } | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } } if {![winfo exists $data(-parent)]} { return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \ "bad window path name \"$data(-parent)\"" } # Select the vwait variable carefully. set oldScreen $Priv(screen) set screen [winfo screen $data(-parent)] # Extract the display name (cf. ScreenChanged, including [Bug 2912473] fix). set disp [string range $screen 0 [string last . $screen]-1] # Ensure that namespace separators never occur in the display name (as # they cause problems in variable names). Double-colons exist in some VNC # display names. [Bug 2912473] set disp [string map {:: _doublecolon_} $disp] if {![info exists ::tk::Priv.${disp}]} { # Use ScreenChanged to create ::tk::Priv.${disp}, then change back to old # screen to avoid interfering with Tk expectations for bindings. ScreenChanged $screen ScreenChanged $oldScreen } variable ::tk::Priv.${disp} # Now in place of ::tk::Priv(button), use ::tk::Priv.${disp}(button) which # is the intended target variable of upvar and will not be redefined when # ::tk::ScreenChanged is called. switch -- $data(-type) { abortretryignore { set names [list abort retry ignore] set labels [list &Abort &Retry &Ignore] set cancel abort } |
︙ | ︙ | |||
332 333 334 335 336 337 338 | if {![llength $opts]} { # Capitalize the first letter of $name set capName [string toupper $name 0] set opts [list -text $capName] } eval [list tk::AmpWidget ttk::button $w.$name] $opts \ | | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | if {![llength $opts]} { # Capitalize the first letter of $name set capName [string toupper $name 0] set opts [list -text $capName] } eval [list tk::AmpWidget ttk::button $w.$name] $opts \ [list -command [list set tk::Priv.${disp}(button) $name]] if {$name eq $data(-default)} { $w.$name configure -default active } else { $w.$name configure -default normal } grid $w.$name -in $w.bot -row 0 -column $i -padx 3m -pady 2m -sticky ew |
︙ | ︙ | |||
389 390 391 392 393 394 395 | } } # Invoke the designated cancelling operation bind $w <Escape> [list $w.$cancel invoke] # At <Destroy> the buttons have vanished, so must do this directly. | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | } } # Invoke the designated cancelling operation bind $w <Escape> [list $w.$cancel invoke] # At <Destroy> the buttons have vanished, so must do this directly. bind $w.msg <Destroy> [list set tk::Priv.${disp}(button) $cancel] # 7. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) |
︙ | ︙ | |||
412 413 414 415 416 417 418 | # 9. Wait for the user to respond, then restore the focus and # return the index of the selected button. Restore the focus # before deleting the window, since otherwise the window manager # may take the focus away so we can't redirect it. Finally, # restore any grab that was in effect. | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | # 9. Wait for the user to respond, then restore the focus and # return the index of the selected button. Restore the focus # before deleting the window, since otherwise the window manager # may take the focus away so we can't redirect it. Finally, # restore any grab that was in effect. vwait ::tk::Priv.${disp}(button) # Copy the result now so any <Destroy> that happens won't cause # trouble set result [set Priv.${disp}(button)] ::tk::RestoreFocusGrab $w $focus return $result } |
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 " "Letter" ::msgcat::mcset de "Legal " "Legal" ::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" "Skalierung" ::msgcat::mcset de "Orientation" "Ausrichtung" ::msgcat::mcset de "Portrait" "Hochformat" ::msgcat::mcset de "Landscape" "Querformat" ::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" "输出" } |
Deleted library/obsolete.tcl.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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 } |
Changes to library/palette.tcl.
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | set new(disabledForeground) [format #%02x%02x%02x \ [expr {(3*$bg_r + $fg_r)/1024}] \ [expr {(3*$bg_g + $fg_g)/1024}] \ [expr {(3*$bg_b + $fg_b)/1024}]] } if {![info exists new(highlightBackground)]} { set new(highlightBackground) $new(background) } if {![info exists new(activeBackground)]} { # Pick a default active background that islighter than the # normal background. To do this, round each color component # up by 15% or 1/3 of the way to full white, whichever is # greater. | > > > > > > > > > > > > > > | 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 | set new(disabledForeground) [format #%02x%02x%02x \ [expr {(3*$bg_r + $fg_r)/1024}] \ [expr {(3*$bg_g + $fg_g)/1024}] \ [expr {(3*$bg_b + $fg_b)/1024}]] } if {![info exists new(highlightBackground)]} { set new(highlightBackground) $new(background) } # 'buttonBackground' is the background color of the buttons in # the spinbox widget. if {![info exists new(buttonBackground)]} { set new(buttonBackground) $new(background) } # 'selectColor' is the background of check & radio buttons. if {![info exists new(selectColor)]} { foreach {r g b} $bg {break} if {$r+1.5*$g+0.5*$b > 100000} { set new(selectColor) white } else { set new(selectColor) black } } if {![info exists new(activeBackground)]} { # Pick a default active background that islighter than the # normal background. To do this, round each color component # up by 15% or 1/3 of the way to full white, whichever is # greater. |
︙ | ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | option add *$option $new($option) widgetDefault } # Save the options in the variable ::tk::Palette, for use the # next time we change the options. array set ::tk::Palette [array get new] } # ::tk::RecolorTree -- # This procedure changes the colors in a window and all of its # descendants, according to information provided by the colors # argument. This looks at the defaults provided by the option # database, if it exists, and if not, then it looks at the default | > > > > > > > > > > > > > > > > > > > > | 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 | option add *$option $new($option) widgetDefault } # Save the options in the variable ::tk::Palette, for use the # next time we change the options. array set ::tk::Palette [array get new] if {[tk windowingsystem] ne "x11" || [ttk::style theme use] ne "default"} { return } # Update the 'default' ttk theme with the new palette, # and then set 'default' as the current ttk theme, # in order to apply the new palette to the ttk widgets. foreach option [array names new] { if {[info exists ttk::theme::default::colorOptionLookup($option)]} { foreach colorName $ttk::theme::default::colorOptionLookup($option) { set ttk::theme::default::colors($colorName) $new($option) } } } ttk::theme::default::reconfigureDefaultTheme ttk::setTheme default return } # ::tk::RecolorTree -- # This procedure changes the colors in a window and all of its # descendants, according to information provided by the colors # argument. This looks at the defaults provided by the option # database, if it exists, and if not, then it looks at the default |
︙ | ︙ |
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 1007 1008 | # 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 dumpfile [file join /tmp rawprint.txt] set tmpfile [file join /tmp $filename] set f [open $dumpfile w] try { puts -nonewline $f $contents } finally { close $f if {[file extension $filename] == ".ps"} { #don't apply formatting to PostScript file rename -force $dumpfile $tmpfile } else { #Make text fixed width for improved printed output exec fmt -w 75 $dumpfile > $tmpfile } return $tmpfile } } 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 9p -pady 9p 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 4.5p} pack $pf.printer -side left # Start of printing options set of [ttk::labelframe $p.optionsframe -text [mc "Options"]] pack $of -fill x -padx 9p -pady {0 9p} -ipadx 2p -ipady 2p # COPIES ttk::label $of.copiesl -text "[mc "Copies"] :" ttk::spinbox $of.copies -from 1 -to 1000 \ -textvariable [myvar dlg::sel](copies) grid $of.copiesl $of.copies -sticky ew -padx 2p -pady 2p # 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 2p -pady 2p # 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 2p -pady 2p # 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 2p -pady 2p # 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 2p -pady 2p } # The buttons frame. set bf [ttk::frame $p.buttonf] pack $bf -fill x -expand no -side bottom -padx 9p -pady {0 9p} 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 4.5p} #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" { ::tk::print::_printcanvas $w set printfile /tmp/tk_canvas.pdf ::tk::print::_print $printfile } "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 [file join /tmp 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/safetk.tcl.
︙ | ︙ | |||
246 247 248 249 250 251 252 | # frame the button so it does not expand horizontally # but still have the default background instead of red one from the parent ttk::frame $wc.fb -borderwidth 0 ttk::button $wc.fb.b -text "Delete" \ -command [list ::safe::tkDelete $w $w $child] pack $wc.fb.b -side right -fill both pack $wc.fb -side right -fill both -expand 1 | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | # frame the button so it does not expand horizontally # but still have the default background instead of red one from the parent ttk::frame $wc.fb -borderwidth 0 ttk::button $wc.fb.b -text "Delete" \ -command [list ::safe::tkDelete $w $w $child] pack $wc.fb.b -side right -fill both pack $wc.fb -side right -fill both -expand 1 pack $wc.l -side left -fill both -expand 1 -ipady 1.5p pack $wc -side bottom -fill x # Container frame frame $w.c -container 1 pack $w.c -fill both -expand 1 # return both the toplevel window name and the id to use for embedding |
︙ | ︙ |
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 -- |
︙ | ︙ |
Added library/scaling.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 | # scaling.tcl -- # # Contains scaling-related utility procedures. # # Copyright © 2022 Csaba Nemethi <[email protected]> # ::tk::ScalingPct -- # # Returns the display's "scaling percentage" (the display resolution expressed # as a percentage of 96dpi), rounded to the nearest multiple of 25 that is at # least 100. # # On X11 systems (but not on SDL systems that claim to be X11), the first call # of the command also sets [tk scaling] and ::tk::fontScalingFactor to values # extracted from the X11 configuration. # # The command is called during Tk initialization, from icons.tcl, when the # latter is sourced by tk.tcl. proc ::tk::ScalingPct {} { set pct [expr {[tk scaling] * 75}] variable doneScalingInitX11 if {![info exists doneScalingInitX11]} { set pct [::tk::ScalingInitX11 $pct] set doneScalingInitX11 1 } # # Save the value of pct rounded to the nearest multiple # of 25 that is at least 100, in the variable scalingPct. # See "man n tk_scalingPct" for use of ::tk::scalingPct. # variable scalingPct for {set scalingPct 100} {1} {incr scalingPct 25} { if {$pct < $scalingPct + 12.5} { break } } return $scalingPct } proc ::tk::ScalingInitX11 {pct} { set onX11 [expr {[tk windowingsystem] eq "x11"}] set usingSDL [expr {[info exists ::tk::sdltk] && $::tk::sdltk}] if {$onX11 && !$usingSDL} { set origPct $pct # # Try to get the window scaling factor (1 or 2), partly # based on https://wiki.archlinux.org/title/HiDPI # set winScalingFactor 1 variable fontScalingFactor 1 ;# needed in the file ttk/fonts if {[catch {exec ps -e | grep xfce4-session}] == 0} { ;# Xfce if {[catch {exec xfconf-query -c xsettings \ -p /Gdk/WindowScalingFactor} result] == 0} { set winScalingFactor $result if {$winScalingFactor >= 2} { set fontScalingFactor 2 } } # # The DPI value can be set in the "Fonts" tab of the "Appearance" # dialog or (on Linux Lite 5+) via the "HiDPI Settings" dialog. # } elseif {[catch {exec ps -e | grep mate-session}] == 0} { ;# MATE if {[catch {exec gsettings get org.mate.interface \ window-scaling-factor} result] == 0} { if {$result == 0} { ;# means: "Auto-detect" # # Try to get winScalingFactor from the cursor size # if {[catch {exec xrdb -query | grep Xcursor.size} result] == 0 && [catch {exec gsettings get org.mate.peripherals-mouse \ cursor-size} defCursorSize] == 0} { set cursorSize [lindex $result 1] set winScalingFactor \ [expr {($cursorSize + $defCursorSize - 1) / $defCursorSize}] } } else { set winScalingFactor $result } } # # The DPI value can be set via the "Font Rendering Details" # dialog, which can be opened using the "Details..." button # in the "Fonts" tab of the "Appearance Preferences" dialog. # } elseif {[catch {exec ps -e | grep gnome-session}] == 0 && [catch {exec gsettings get \ org.gnome.settings-daemon.plugins.xsettings overrides} \ result] == 0 && [set idx \ [string first "'Gdk/WindowScalingFactor'" $result]] >= 0} { scan [string range $result $idx end] "%*s <%d>" winScalingFactor } # # Get the scaling percentage # if {$winScalingFactor >= 2} { set pct 200 } elseif {[catch {exec xrdb -query | grep Xft.dpi} result] == 0} { # # Derive the value of pct from that of the font DPI # set dpi [lindex $result 1] set pct [expr {100.0 * $dpi / 96}] } elseif {[catch {exec ps -e | grep gnome-session}] == 0 && ![info exists ::env(WAYLAND_DISPLAY)] && [catch {exec xrandr | grep " connected"} result] == 0 && [catch {open $::env(HOME)/.config/monitors.xml} chan] == 0} { # # Update pct by scanning the file ~/.config/monitors.xml # ScanMonitorsFile $result $chan pct } if {($pct != 100) && ($pct != $origPct) && (![interp issafe])} { # # Set Tk's scaling factor according to $pct # tk scaling [expr {$pct / 75.0}] } } return $pct } # ::tk::ScaleNum -- # # Scales an integer according to the display's current scaling percentage. # # Arguments: # num - An integer. proc ::tk::ScaleNum num { return [expr {round($num * [tk scaling] * 0.75)}] } # ::tk::FontScalingFactor -- # # Accessor command for variable ::tk::fontScalingFactor. proc ::tk::FontScalingFactor {} { variable fontScalingFactor if {[info exists fontScalingFactor]} { return $fontScalingFactor } else { return 1 } } # ::tk::ScanMonitorsFile -- # # Updates the scaling percentage by scanning the file ~/.config/monitors.xml. # # Arguments: # xrandrResult - The output of 'xrandr | grep " connected"'. # chan - Returned from 'open ~/.config/monitors.xml'. # pctName - The name of a variable containing the scaling percentage. proc ::tk::ScanMonitorsFile {xrandrResult chan pctName} { upvar $pctName pct # # Get the list of connected outputs reported by xrandr # set outputList {} foreach line [split $xrandrResult "\n"] { set idx [string first " " $line] set output [string range $line 0 [incr idx -1]] lappend outputList $output } set outputList [lsort $outputList] # # Get the content of the file ~/.config/monitors.xml # set str [read $chan] close $chan # # Run over the file's "configuration" sections # set idx 0 while {[set idx2 [string first "<configuration>" $str $idx]] >= 0} { set idx2 [string first ">" $str $idx2] set idx [string first "</configuration>" $str $idx2] set config [string range $str [incr idx2] [incr idx -1]] # # Get the list of connectors within this configuration # set connectorList {} foreach {dummy connector} [regexp -all -inline \ {<connector>([^<]+)</connector>} $config] { lappend connectorList $connector } set connectorList [lsort $connectorList] # # If $outputList and $connectorList are identical then set the # variable pct to 100, 200, 300, 400, or 500, depending on the # max. scaling within this configuration, and exit the loop # if {$outputList eq $connectorList} { set maxScaling 1.0 foreach {dummy scaling} [regexp -all -inline \ {<scale>([^<]+)</scale>} $config] { if {$scaling > $maxScaling} { set maxScaling $scaling } } foreach n {4 3 2 1 0} { if {$maxScaling > $n} { set pct [expr {($n + 1) * 100}] break } } break } } } |
Changes to library/scrlbar.tcl.
︙ | ︙ | |||
125 126 127 128 129 130 131 132 | tk::ScrollToPos %W 0 } bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } bind Scrollbar <MouseWheel> { | > > > | | > > > > > > > > > > > > > > > | 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 | tk::ScrollToPos %W 0 } bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } bind Scrollbar <Enter> {+ set tk::Priv(xEvents) 0; set tk::Priv(yEvents) 0 } bind Scrollbar <MouseWheel> { tk::ScrollByUnits %W vh %D -40.0 } bind Scrollbar <Option-MouseWheel> { tk::ScrollByUnits %W vh %D -12.0 } bind Scrollbar <Shift-MouseWheel> { tk::ScrollByUnits %W hv %D -40.0 } bind Scrollbar <Shift-Option-MouseWheel> { tk::ScrollByUnits %W hv %D -12.0 } bind Scrollbar <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0 && [%W cget -orient] eq "horizontal"} { tk::ScrollbarScrollByPixels %W h $deltaX } if {$deltaY != 0 && [%W cget -orient] eq "vertical"} { tk::ScrollbarScrollByPixels %W v $deltaY } } # 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. # |
︙ | ︙ | |||
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | if {[$w cget -jump]} { set delta [$w delta [expr {$x - $Priv(pressX)}] \ [expr {$y - $Priv(pressY)}]] ScrollToPos $w [expr {$Priv(initPos) + $delta}] } set Priv(initPos) "" } # ::tk::ScrollByUnits -- # This procedure tells the scrollbar's associated widget to scroll up # or down by a given number of units. It notifies the associated widget # in different ways for old and new command syntaxes. # # Arguments: # w - The scrollbar widget. # orient - Which kinds of scrollbars this applies to: "h" for | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > | 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 | if {[$w cget -jump]} { set delta [$w delta [expr {$x - $Priv(pressX)}] \ [expr {$y - $Priv(pressY)}]] ScrollToPos $w [expr {$Priv(initPos) + $delta}] } set Priv(initPos) "" } # ::tk::ScrollbarScrollByPixels -- # This procedure tells the scrollbar's associated widget to scroll up # or down by a given number of pixels. It only works with scrollbars # because it uses the delta command. # # Arguments: # w - The scrollbar widget. # orient - Which kind of scrollbar this applies to: "h" for # horizontal, "v" for vertical. # amount - How many pixels to scroll. proc ::tk::ScrollbarScrollByPixels {w orient amount} { set cmd [$w cget -command] if {$cmd eq ""} { return } set xyview [lindex [split $cmd] end] if {$orient eq "v"} { if {$xyview eq "xview"} { return } } if {$orient eq "h"} { if {$xyview eq "yview"} { return } } # The code below works with both the current and old syntax for # the scrollbar get command. set info [$w get] if {[llength $info] == 2} { set first [lindex $info 0] } else { set first [lindex $info 2] } set pixels [expr {-$amount}] uplevel #0 $cmd moveto [expr $first + [$w delta $pixels $pixels]] } # ::tk::ScrollByUnits -- # This procedure tells the scrollbar's associated widget to scroll up # or down by a given number of units. It notifies the associated widget # in different ways for old and new command syntaxes. # # Arguments: # w - The scrollbar widget. # orient - Which kinds of scrollbars this applies to: "h" for # horizontal, "v" for vertical, "hv" or "vh" for both. # amount - How many units to scroll: typically 1 or -1. proc ::tk::ScrollByUnits {w orient amount {factor 1.0}} { set cmd [$w cget -command] if {$cmd eq "" || ([string first \ [string index [$w cget -orient] 0] $orient] < 0)} { return } if {[string length $orient] == 2 && $factor != 1.0} { # Count both the <MouseWheel> and <Shift-MouseWheel> # events, and ignore the non-dominant ones variable ::tk::Priv set axis [expr {[string index $orient 0] eq "h" ? "x" : "y"}] incr Priv(${axis}Events) if {($Priv(xEvents) + $Priv(yEvents) > 10) && ($axis eq "x" && $Priv(xEvents) < $Priv(yEvents) || $axis eq "y" && $Priv(yEvents) < $Priv(xEvents))} { return } } set info [$w get] if {[llength $info] == 2} { uplevel #0 $cmd scroll [expr {$amount/$factor}] units } else { uplevel #0 $cmd [expr {[lindex $info 2] + [expr {$amount/$factor}]}] } } |
︙ | ︙ |
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | %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] } bind Spinbox <<SelectPrevWord>> { ::tk::EntryKeySelect %W [::tk::EntryPreviousWord %W insert] ::tk::EntrySeeInsert %W } bind Spinbox <<SelectNextWord>> { ::tk::EntryKeySelect %W [::tk::EntrySelectNextWord %W insert] ::tk::EntrySeeInsert %W } bind Spinbox <<LineStart>> { ::tk::EntrySetCursor %W 0 } bind Spinbox <<SelectLineStart>> { ::tk::EntryKeySelect %W 0 |
︙ | ︙ | |||
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::endOfCluster [%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 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 | # 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 exists namespace ensemble create } # Pure-Tcl system notification window for use if native implementation not available. # This is supposed to happen only on X11 when libnotify is not present. namespace eval ::tk::sysnotify:: { # These defaults mimic the default behaviour of gnome and xfce notifications. # These are hardcoded defaults. variable defaults { padX 3 padY 3 background gray15 foreground white delay 10000 alpha 0.85 } # These options are meant to be "public". The user could tinker with # these values to adjust the system notification appearance/behaviour. option add *Sysnotify.padX [dict get $defaults padX] option add *Sysnotify.padY [dict get $defaults padY] option add *Sysnotify.background [dict get $defaults background] option add *Sysnotify.foreground [dict get $defaults foreground] option add *Sysnotify.delay [dict get $defaults delay] option add *Sysnotify.alpha [dict get $defaults alpha] proc _notifywindow {title msg} { variable defaults # cleanup any previous notify window and create a new one set w ._notify _notifyDestroy $w toplevel $w -class Sysnotify # read the option database to check out whether the user has set # some options; fall back to our hardcoded defaults otherwise dict for {option value} [dict remove $defaults alpha] { set $option [option get $w $option ""] if {[set $option] eq ""} { set $option $value } } set xpos [tk::ScaleNum 16] set ypos [tk::ScaleNum 48] # position from the "ne" corner wm geometry $w -$xpos+$ypos wm overrideredirect $w true # internal options option add *Sysnotify.Label.anchor w option add *Sysnotify.Label.justify left option add *Sysnotify.Label.wrapLength [expr {[winfo screenwidth .] / 4}] foreach option {padX padY foreground background} { option add *Sysnotify.Label.$option [set $option] } set icon ::tk::icons::information set width [expr {[image width $icon] + 2 * $padX}] set height [expr {[image height $icon] + 2 * $padY}] label $w.icon -image $icon -width $width -height $height -anchor c label $w.title -text $title -font TkHeadingFont label $w.message -text [_filterMarkup $msg] -font TkTooltipFont grid $w.icon $w.title -sticky news grid ^ $w.message -sticky news bind Sysnotify <Map> [namespace code { # set the wm attribute here; it is ignored if set # before the window is mapped wm attributes %W -alpha 0.0 if {[wm attributes %W -alpha] == 0.0} { _fadeIn %W } }] bind Sysnotify <Enter> [namespace code {_onEnter %W}] bind Sysnotify <Leave> [namespace code {_onLeave %W}] bind $w <Button-1> [namespace code [list _notifyDestroy $w]] after $delay [namespace code [list _fadeOut $w]] return } # Fade the window into view. proc _fadeIn {w} { variable defaults if {![winfo exists $w]} {return} if {[set alpha [option get $w alpha ""]] eq ""} { set alpha [dict get $defaults alpha] } raise $w set before [wm attributes $w -alpha] set new [expr { min($alpha, $before + 0.10) }] wm attributes $w -alpha $new set after [wm attributes $w -alpha] if {($before == 1.0) || ($before == $after)} { # not supported or we're done return } after 40 [namespace code [list _fadeIn $w]] } # Fade out and destroy window. proc _fadeOut {w} { if {![winfo exists $w]} {return} set before [wm attributes $w -alpha] set new [expr { $before - 0.02 }] wm attributes $w -alpha $new set after [wm attributes $w -alpha] if {($after == 1.0) || ($before == $after)} { _notifyDestroy $w return } after 40 [namespace code [list _fadeOut $w]] } proc _notifyDestroy {w} { # cancel any pending fade in or fade out _cancelFading $w destroy $w } proc _onEnter {w} { wm attributes $w -alpha 1.0 _cancelFading $w } proc _onLeave {w} { variable defaults if {[set alpha [option get $w alpha ""]] eq ""} { set alpha [dict get $defaults alpha] } if {[set delay [option get $w delay ""]] eq ""} { set delay [dict get $defaults delay] } wm attributes $w -alpha $alpha after $delay [namespace code [list _fadeOut $w]] } proc _cancelFading {w} { after cancel [namespace code [list _fadeOut $w]] after cancel [namespace code [list _fadeIn $w]] } # The Desktop Notifications Specification allow for some markup # in the message to display. It also specifies # "Notification servers that do not support these tags should # filter them out" # See https://specifications.freedesktop.org/notification-spec/latest/ar01s04.html # We don't event try to render those properly proc _filterMarkup {txt} { # remove fixed tags set maplist {<b> "" </b> "" <i> "" </i> "" <u> "" </u> "" </a> ""} set txt [string map $maplist $txt] # remove <img> tags leaving (possible) alt text set txt [regsub -- {<img *src="[^"]*" *(alt="([^"]*)")? */?>} $txt {\2}] # remove <a href=""> variable tag set txt [regsub -- {<a[^>]*>} $txt {}] return $txt } } # 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 icon existence. proc tk::systray::exists {} { variable _created return $_created } # 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/tclIndex.
︙ | ︙ | |||
118 119 120 121 122 123 124 | set auto_index(::tk::SaveGrabInfo) [list source [file join $dir menu.tcl]] set auto_index(::tk::RestoreOldGrab) [list source [file join $dir menu.tcl]] set auto_index(tk_menuSetFocus) [list source [file join $dir menu.tcl]] set auto_index(::tk::GenerateMenuSelect) [list source [file join $dir menu.tcl]] set auto_index(tk_popup) [list source [file join $dir menu.tcl]] set auto_index(::tk::ensure_psenc_is_loaded) [list source [file join $dir mkpsenc.tcl]] set auto_index(::tk::MessageBox) [list source [file join $dir msgbox.tcl]] | < < < > > > > | 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 | set auto_index(::tk::SaveGrabInfo) [list source [file join $dir menu.tcl]] set auto_index(::tk::RestoreOldGrab) [list source [file join $dir menu.tcl]] set auto_index(tk_menuSetFocus) [list source [file join $dir menu.tcl]] set auto_index(::tk::GenerateMenuSelect) [list source [file join $dir menu.tcl]] set auto_index(tk_popup) [list source [file join $dir menu.tcl]] set auto_index(::tk::ensure_psenc_is_loaded) [list source [file join $dir mkpsenc.tcl]] set auto_index(::tk::MessageBox) [list source [file join $dir msgbox.tcl]] set auto_index(tk_optionMenu) [list source [file join $dir optMenu.tcl]] set auto_index(tk_setPalette) [list source [file join $dir palette.tcl]] set auto_index(::tk::RecolorTree) [list source [file join $dir palette.tcl]] set auto_index(::tk::Darken) [list source [file join $dir palette.tcl]] set auto_index(tk_bisque) [list source [file join $dir palette.tcl]] set auto_index(::safe::tkInterpInit) [list source [file join $dir safetk.tcl]] set auto_index(::safe::loadTk) [list source [file join $dir safetk.tcl]] set auto_index(::safe::TkInit) [list source [file join $dir safetk.tcl]] set auto_index(::safe::allowTk) [list source [file join $dir safetk.tcl]] set auto_index(::safe::disallowTk) [list source [file join $dir safetk.tcl]] set auto_index(::safe::tkDelete) [list source [file join $dir safetk.tcl]] set auto_index(::safe::tkTopLevel) [list source [file join $dir safetk.tcl]] set auto_index(::tk::ScaleActivate) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleButtonDown) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleDrag) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleEndDrag) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleIncrement) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleControlPress) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScaleButton2Down) [list source [file join $dir scale.tcl]] set auto_index(::tk::ScalingPct) [list source [file join $dir scaling.tcl]] set auto_index(::tk::ScaleNum) [list source [file join $dir scaling.tcl]] set auto_index(::tk::FontScalingFactor) [list source [file join $dir scaling.tcl]] set auto_index(::tk::ScanMonitorsFile) [list source [file join $dir scaling.tcl]] set auto_index(::tk::ScrollButtonDown) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollButtonUp) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollSelect) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollStartDrag) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollDrag) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollEndDrag) [list source [file join $dir scrlbar.tcl]] set auto_index(::tk::ScrollByUnits) [list source [file join $dir scrlbar.tcl]] |
︙ | ︙ | |||
244 245 246 247 248 249 250 | set auto_index(::tk::MotifFDialog_FilterCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::MotifFDialog_CancelCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Set) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]] | < < | 245 246 247 248 249 250 251 252 | set auto_index(::tk::MotifFDialog_FilterCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::MotifFDialog_CancelCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Set) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]] |
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 84 85 86 87 88 89 90 91 92 93 | # 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] while {[winfo class $parent] eq "Menu"} { set parent [winfo toplevel [winfo parent $parent]] } wm transient $menu [winfo toplevel $parent] wm attributes $menu -toolwindow 1 } $menu post $x $y if {[winfo exists $menu] == 0} { |
︙ | ︙ | |||
130 131 132 133 134 135 136 | } if {[lindex $option 0] eq "-type"} { continue } lappend cmd [lindex $option 0] [lindex $option 4] } eval $cmd | | | < | > | | < | < | < < < < < < < < | | < < < < < < < < < < < < < < < < < < < | 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 | } if {[lindex $option 0] eq "-type"} { continue } lappend cmd [lindex $option 0] [lindex $option 4] } eval $cmd # Copy the meny entries, if any set last [$src index last] for {set i [$src cget -tearoff]} {$i <= $last} {incr i} { set cmd [list $dst add [$src type $i] [$src id $i]] foreach option [$src entryconfigure $i] { lappend cmd [lindex $option 0] [lindex $option 4] } eval $cmd } # Duplicate the binding tags from the source menu, replacing src with dst set tags [bindtags $src] set x [lsearch -exact $tags $src] if {$x >= 0} {lset tags $x $dst} bindtags $dst $tags } |
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 146 147 148 | } } # 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::TextSelectNextWord %W insert] } bind Text <<SelectPrevPara>> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } bind Text <<SelectNextPara>> { tk::TextKeySelect %W [tk::TextNextPara %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 1 } # 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 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 | if {!$tk_strictMotif} { tk::TextScanDrag %W %x %y } } set ::tk::Priv(prevPos) {} bind Text <MouseWheel> { tk::MouseWheel %W y [tk::ScaleNum %D] -4.0 pixels } bind Text <Option-MouseWheel> { tk::MouseWheel %W y [tk::ScaleNum %D] -1.2 pixels } bind Text <Shift-MouseWheel> { tk::MouseWheel %W x [tk::ScaleNum %D] -4.0 pixels } bind Text <Shift-Option-MouseWheel> { tk::MouseWheel %W x [tk::ScaleNum %D] -1.2 pixels } bind Text <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0} { %W xview scroll [tk::ScaleNum [expr {-$deltaX}]] pixels } if {$deltaY != 0} { %W yview scroll [tk::ScaleNum [expr {-$deltaY}]] 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. # # Arguments: # w - The text window. # x - X-coordinate within the window. # y - Y-coordinate within the window. proc ::tk::TextClosestGap {w x y} { set pos [$w index @$x,$y] set bbox [$w bbox $pos] if {$bbox eq ""} { return $pos } # The check on y coord of the line bbox with dlineinfo is to fix # [a9cf210a42] to properly handle selecting and moving the mouse # out of the widget. if {$y < [lindex [$w dlineinfo $pos] 1] || $x - [lindex $bbox 0] < [lindex $bbox 2]/2} { return $pos } $w index "$pos + 1 char" } # ::tk::TextButton1 -- # This procedure is invoked to handle button-1 presses in text |
︙ | ︙ | |||
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 | | | | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | 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 |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | $w edit separator $w configure -autoseparators 1 } } } # ::tk::TextNextWord -- | > | > > > > | > > > > > > | | < | < < < < < | | | | 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 | $w edit separator $w configure -autoseparators 1 } } } # ::tk::TextNextWord -- # Returns the index of the next start-of-word position after the next # end-of-word position after a given position in the text. # # Arguments: # w - The text window in which the cursor is to move. # start - Position at which to start search. proc ::tk::TextNextWord {w start} { TextNextPos $w [TextNextPos $w $start tk::endOfWord] \ tk::startOfNextWord } # ::tk::TextSelectNextWord -- # Returns the index of the next end-of-word position after a given # position in the text. # # Arguments: # w - The text window in which the cursor is to move. # start - Position at which to start search. proc ::tk::TextSelectNextWord {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. # # Arguments: # w - The text window in which the cursor is to move. |
︙ | ︙ |
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 9.0b2 # 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}]} { |
︙ | ︙ | |||
174 175 176 177 178 179 180 | unset ::tk::FocusGrab($index) } else { set oldGrab "" } catch {focus $oldFocus} grab release $grab | > | | | | | > > > > | | | 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 | unset ::tk::FocusGrab($index) } else { set oldGrab "" } catch {focus $oldFocus} grab release $grab if {[winfo exists $grab]} { if {$destroy eq "withdraw"} { wm withdraw $grab } else { destroy $grab } } if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} { # The "grab" command will fail if another application # already holds the grab on a window with the same name. # So catch it. See [7447ed20ec] for an example. if {$oldStatus eq "global"} { catch {grab -global $oldGrab} } else { catch {grab $oldGrab} } } } # ::tk::GetSelection -- # This tries to obtain the default selection. On Unix, we first try # and get a UTF8_STRING, a type supported by modern Unix apps for |
︙ | ︙ | |||
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. | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | 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> | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | "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 | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | "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> |
︙ | ︙ | |||
489 490 491 492 493 494 495 | # ---------------------------------------------------------------------- # Read in files that define all of the class bindings. # ---------------------------------------------------------------------- if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { | | > > > > > | 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 | # ---------------------------------------------------------------------- # Read in files that define all of the class bindings. # ---------------------------------------------------------------------- if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { namespace eval :: [list source [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. # ---------------------------------------------------------------------- |
︙ | ︙ | |||
535 536 537 538 539 540 541 542 543 544 545 546 547 548 | ## ::tk::MouseWheel $w $dir $amount $factor $units proc ::tk::MouseWheel {w dir amount {factor -120.0} {units units}} { $w ${dir}view scroll [expr {$amount/$factor}] $units } # ::tk::TabToWindow -- # This procedure moves the focus to the given widget. # It sends a <<TraverseOut>> virtual event to the previous focus window, # if any, before changing the focus, and a <<TraverseIn>> event # to the new focus window afterwards. # | > > > > > > > > > > > > > > > > > > > > > > | 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 | ## ::tk::MouseWheel $w $dir $amount $factor $units proc ::tk::MouseWheel {w dir amount {factor -120.0} {units units}} { $w ${dir}view scroll [expr {$amount/$factor}] $units } ## ::tk::PreciseScrollDeltas $dxdy proc ::tk::PreciseScrollDeltas {dxdy} { set deltaX [expr {$dxdy >> 16}] set low [expr {$dxdy & 0xffff}] set deltaY [expr {$low < 0x8000 ? $low : $low - 0x10000}] return [list $deltaX $deltaY] } # Helper for smooth scrolling of widgets that support xview moveto, # yview moveto, height and width. proc ::tk::ScrollByPixels {w deltaX deltaY} { set width [expr {1.0 * [$w cget -width]}] set height [expr {1.0 * [$w cget -height]}] set X [lindex [$w xview] 0] set Y [lindex [$w yview] 0] set x [expr {$X - $deltaX / $width}] set y [expr {$Y - $deltaY / $height}] $w xview moveto $x $w yview moveto $y } # ::tk::TabToWindow -- # This procedure moves the focus to the given widget. # It sends a <<TraverseOut>> virtual event to the previous focus window, # if any, before changing the focus, and a <<TraverseIn>> event # to the new focus window afterwards. # |
︙ | ︙ | |||
623 624 625 626 627 628 629 | # button or label which has $char as underlined character. # proc ::tk::FindAltKeyTarget {path char} { set class [winfo class $path] if {$class in { Button Checkbutton Label Radiobutton TButton TCheckbutton TLabel TRadiobutton | | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | # button or label which has $char as underlined character. # proc ::tk::FindAltKeyTarget {path char} { set class [winfo class $path] if {$class in { Button Checkbutton Label Radiobutton TButton TCheckbutton TLabel TRadiobutton } && ([$path cget -underline] >= 0) && [string equal -nocase $char \ [string index [$path cget -text] [$path cget -underline]]]} { return $path } set subwins [concat [grid content $path] [pack content $path] \ [place content $path]] if {$class eq "Canvas"} { foreach item [$path find all] { |
︙ | ︙ | |||
675 676 677 678 679 680 681 | if {$length > $maxlen} { set maxlen $length } } return $maxlen } | < < < < < < < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | 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 $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 } 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 } 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 } 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 } 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 "" } 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 {$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] # Scale the default parameters of the panedwindow sash option add *Panedwindow.handlePad 6p widgetDefault option add *Panedwindow.handleSize 6p widgetDefault option add *Panedwindow.sashWidth 2.25p widgetDefault # Scale the default size of the scale widget and its slider option add *Scale.length 75p widgetDefault option add *Scale.sliderLength 22.5p widgetDefault option add *Scale.width 11.25p widgetDefault # Scale the default scrollbar width on X11 if {[tk windowingsystem] eq "x11"} { option add *Scrollbar.width 8.25p widgetDefault } # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { uplevel \#0 [list source $::ttk::library/ttk.tcl] } # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to library/tkfbox.tcl.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 | # namespace eval ::tk::dialog {} namespace eval ::tk::dialog::file { namespace import -force ::tk::msgcat::* variable showHiddenBtn 0 variable showHiddenVar 1 # Create the images if they did not already exist. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | < | < < < < < < < < < < < < < < < < < < < < < < < < | | > > > > > | > > > | > | < < < < < < < < < | < < < | > | < < < < < < < < > | 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 | # namespace eval ::tk::dialog {} namespace eval ::tk::dialog::file { namespace import -force ::tk::msgcat::* variable showHiddenBtn 0 variable showHiddenVar 1 # Based on Vimix/16/actions/go-up.svg # See https://github.com/vinceliuice/vimix-icon-theme set updirImageData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="m7 14v-9l-4 4-1-1 6-6 6 6-1 1-4-4v9z" fill="#000000"/> </svg> } proc UpdateUpdirImageData {} { variable updirImageData set idx1 [string first "#000000" $updirImageData] set idx2 [expr {$idx1 + 6}] set fgColor [ttk::style lookup . -foreground {} black] lassign [winfo rgb . $fgColor] r g b set fgColor [format "#%02x%02x%02x" \ [expr {$r >> 8}] [expr {$g >> 8}] [expr {$b >> 8}]] return [string replace $updirImageData $idx1 $idx2 $fgColor] } # Based on https://icons8.com/icon/JXYalxb9XWWd/folder set folderImageData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="m0.5 13.5v-12h4.293l2 2h8.707v10z" fill="#59afff"/> <path d="m4.586 2 2 2h8.414v9h-14v-11h3.586m0.414-1h-5v13h16v-11h-9l-2-2z" fill="#2d8cff"/> <path d="m0.5 14.5v-10h4.618l2-1h8.382v11z" fill="#8cc5ff"/> <path d="m15 4v10h-14v-9h4.236l0.211-0.106 1.789-0.894h7.764m1-1h-9l-2 1h-5v11h16z" fill="#2d8cff"/> </svg> } # Based on https://icons8.com/icon/mEF_vyjYlnE3/file set fileImageData { <?xml version="1.0" encoding="UTF-8"?> <svg width="16" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <path d="m2 1h8l4 4v11h-12z" fill="#808080"/> <path d="m3 2h6.5l3.5 3.5v9.5h-10z" fill="#f0f0f0"/> <path d="m9 1v5h5v-1h-4v-4h-1z" fill="#808080"/> </svg> } # Create the images if they did not already exist. if {![info exists ::tk::Priv(updirImage)] || $::tk::Priv(updirImage) ni [image names]} { set ::tk::Priv(updirImage) [image create photo \ -format $::tk::svgFmt -data [UpdateUpdirImageData]] if {"TkFileDialog" ni [bindtags .]} { bindtags . [linsert [bindtags .] 1 TkFileDialog] bind TkFileDialog <<ThemeChanged>> { if {$::tk::Priv(updirImage) in [image names]} { $::tk::Priv(updirImage) configure \ -data [::tk::dialog::file::UpdateUpdirImageData] } } } } if {![info exists ::tk::Priv(folderImage)] || $::tk::Priv(folderImage) ni [image names]} { set ::tk::Priv(folderImage) [image create photo \ -format $::tk::svgFmt -data $folderImageData] } if {![info exists ::tk::Priv(fileImage)] || $::tk::Priv(fileImage) ni [image names]} { set ::tk::Priv(fileImage) [image create photo \ -format $::tk::svgFmt -data $fileImageData] } } # ::tk::dialog::file:: -- # # Implements the TK file selection dialog. This dialog is used when the # tk_strictMotif flag is set to false. This procedure shouldn't be |
︙ | ︙ | |||
222 223 224 225 226 227 228 | # Cleanup traces on selectPath variable # foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) {*}$trace } | > | > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | # Cleanup traces on selectPath variable # foreach trace [trace info variable data(selectPath)] { trace remove variable data(selectPath) {*}$trace } if {[winfo exists $data(dirMenuBtn)]} { $data(dirMenuBtn) configure -textvariable {} } return $Priv(selectFilePath) } # ::tk::dialog::file::Config -- # # Configures the TK filedialog according to the argument list |
︙ | ︙ | |||
357 358 359 360 361 362 363 | $data(dirMenu) add radiobutton -label "" -variable \ [format %s(selectPath) ::tk::dialog::file::$dataName] set data(upBtn) [ttk::button $f1.up] $data(upBtn) configure -image $Priv(updirImage) $f1.menu configure -takefocus 1;# -highlightthickness 2 | | | | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | $data(dirMenu) add radiobutton -label "" -variable \ [format %s(selectPath) ::tk::dialog::file::$dataName] set data(upBtn) [ttk::button $f1.up] $data(upBtn) configure -image $Priv(updirImage) $f1.menu configure -takefocus 1;# -highlightthickness 2 pack $data(upBtn) -side right -padx 3p -fill both pack $f1.lab -side left -padx 3p -fill both pack $f1.menu -expand yes -fill both -padx 3p # data(icons): the IconList that list the files and directories. # if {$class eq "TkFDialog"} { if { $data(-multiple) } { set fNameCaption [mc "File &names:"] } else { |
︙ | ︙ | |||
419 420 421 422 423 424 425 | } else { set text [mc "Show &Hidden Directories"] } set data(hiddenBtn) [::tk::AmpWidget ttk::checkbutton $f2.hidden \ -text $text -state disabled \ -variable ::tk::dialog::file::showHiddenVar \ -command [list ::tk::dialog::file::UpdateWhenIdle $w]] | | | | | | | | | | | | | 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 | } else { set text [mc "Show &Hidden Directories"] } set data(hiddenBtn) [::tk::AmpWidget ttk::checkbutton $f2.hidden \ -text $text -state disabled \ -variable ::tk::dialog::file::showHiddenVar \ -command [list ::tk::dialog::file::UpdateWhenIdle $w]] # -anchor w -padx 2p # the okBtn is created after the typeMenu so that the keyboard traversal # is in the right order, and add binding so that we find out when the # dialog is destroyed by the user (added here instead of to the overall # window so no confusion about how much <Destroy> gets called; exactly # once will do). [Bug 987169] set data(okBtn) [::tk::AmpWidget ttk::button $f2.ok \ -text [mc "&OK"] -default active];# -pady 2p] bind $data(okBtn) <Destroy> [list ::tk::dialog::file::Destroyed $w] set data(cancelBtn) [::tk::AmpWidget ttk::button $f2.cancel \ -text [mc "&Cancel"] -default normal];# -pady 2p] # grid the widgets in f2 # grid $f2.lab $f2.ent $data(okBtn) -padx 3p -pady 2p -sticky ew grid configure $f2.ent -padx 1.5p if {$class eq "TkFDialog"} { grid $data(typeMenuLab) $data(typeMenuBtn) $data(cancelBtn) \ -padx 3p -sticky ew grid configure $data(typeMenuBtn) -padx 0 grid $data(hiddenBtn) -columnspan 2 -padx 3p -sticky ew } else { grid $data(hiddenBtn) - $data(cancelBtn) -padx 3p -sticky ew } grid columnconfigure $f2 1 -weight 1 # Pack all the frames together. We are done with widget construction. # pack $f1 -side top -fill x -pady 3p pack $f2 -side bottom -pady 3p -fill x pack $data(icons) -expand yes -fill both -padx 3p -pady 1p # Set up the event handlers that are common to Directory and File Dialogs # wm protocol $w WM_DELETE_WINDOW [list ::tk::dialog::file::CancelCmd $w] $data(upBtn) configure -command [list ::tk::dialog::file::UpDirCmd $w] $data(cancelBtn) configure -command [list ::tk::dialog::file::CancelCmd $w] |
︙ | ︙ | |||
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] | | | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | 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 | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | ::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 { | | | | | | 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | } 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) \ | | < | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | 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 18 19 20 21 22 23 24 25 26 27 28 | # # 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" } ttk::style theme settings alt { ttk::style configure "." \ -background $colors(-frame) \ -foreground black \ -troughcolor $colors(-darker) \ -bordercolor $colors(-border) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ | > | | < | | | | < | | | > | > | | > | > | > | | | < | > | | > | | | | < > > | > > > > | | > | > | 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 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" } ttk::style theme settings alt { ttk::style configure "." \ -background $colors(-frame) \ -foreground black \ -troughcolor $colors(-darker) \ -bordercolor $colors(-border) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -font TkDefaultFont ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground [list disabled $colors(-disabledfg)] ttk::style map "." -embossed [list disabled 1] ttk::style configure TButton \ -anchor center -width -11 -padding 0.75p \ -relief raised -shiftrelief 1 \ -highlightthickness 1 -highlightcolor $colors(-frame) ttk::style map TButton -relief { {pressed !disabled} sunken {active !disabled} raised } -highlightcolor {alternate black} ttk::style configure TCheckbutton -indicatorcolor "#ffffff" \ -indicatormargin {0 1.5p 3p 1.5p} -padding 1.5p ttk::style configure TRadiobutton -indicatorcolor "#ffffff" \ -indicatormargin {0 1.5p 3p 1.5p} -padding 1.5p ttk::style map TCheckbutton -indicatorcolor \ [list pressed $colors(-frame) \ alternate $colors(-altindicator) \ disabled $colors(-frame)] ttk::style map TRadiobutton -indicatorcolor \ [list pressed $colors(-frame) \ alternate $colors(-altindicator) \ disabled $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -padding 2.25p -arrowsize 3.75p -relief raised ttk::style configure TEntry -padding 1 \ -focuswidth 2 -focuscolor $colors(-selectbg) ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox -padding 1 -arrowsize 10.5p \ -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure ComboboxPopdownFrame -relief solid -borderwidth 1 ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} \ -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure Toolbutton -relief flat -padding 1.5p ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style map Toolbutton -background \ [list pressed $colors(-darker) active $colors(-activebg)] ttk::style configure TScrollbar -relief raised \ -arrowsize 10.5p -width 10.5p ttk::style configure TLabelframe -relief groove -borderwidth 2 ttk::style configure TNotebook -tabmargins {1.5p 1.5p 0.75p 0} ttk::style configure TNotebook.Tab -background $colors(-darker) \ -padding {3p 1.5p} ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -expand {selected {1.5p 1.5p 0.75p 0}} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-alternate) -indent 15p ttk::setTreeviewRowHeight 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 3p -troughrelief sunken \ -sliderthickness 11.25p -borderwidth 2 ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 \ -barsize 22.5p -thickness 11.25p } } |
Changes to library/ttk/aquaTheme.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # # Aqua theme (OSX native look and feel) # namespace eval ttk::theme::aqua { ttk::style theme settings aqua { ttk::style configure . \ -font TkDefaultFont \ -background systemWindowBackgroundColor \ -foreground systemLabelColor \ -selectbackground systemSelectedTextBackgroundColor \ -selectforeground systemSelectedTextColor \ | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > | > > > | > > | | < < < < < < < < < < < < < < | < < | < < < < < < < < | < < < < < < < < < | > | | | > > > > | 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 | # # Aqua theme (OSX native look and feel) # namespace eval ttk::theme::aqua { ttk::style theme settings aqua { ttk::style configure . \ -font TkDefaultFont \ -background systemWindowBackgroundColor \ -foreground systemLabelColor \ -selectbackground systemSelectedTextBackgroundColor \ -selectforeground systemSelectedTextColor \ -insertwidth 1 ttk::style map . \ -foreground { disabled systemDisabledControlTextColor background systemLabelColor} \ -selectbackground { 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 } # Sidebar (radio) button font create SidebarFont -family .AppleSystemUIFont -size 11 -weight normal ttk::style configure SidebarButton \ -foreground systemControlTextColor \ -font SidebarFont ttk::style map SidebarButton \ -foreground { {disabled selected} systemWindowBackgroundColor3 {disabled !selected} systemDisabledControlTextColor selected systemTextColor active systemTextColor pressed systemTextColor } # 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 systemControlBackgroundColor \ -stripedbackground systemControlAlternatingRowColor \ -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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # # "Clam" theme. # # Inspired by the XFCE family of Gnome themes. # namespace eval ttk::theme::clam { variable colors array set colors { -disabledfg "#999999" -frame "#dcdad5" -window "#ffffff" -dark "#cfcdc8" -darker "#bab5ab" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # "Clam" theme. # # Inspired by the XFCE family of Gnome themes. # namespace eval ttk::theme::clam { variable colors array set colors { -disabledfg "#999999" -frame "#dcdad5" -window "#ffffff" -dark "#cfcdc8" -darker "#bab5ab" |
︙ | ︙ | |||
28 29 30 31 32 33 34 | -foreground black \ -bordercolor $colors(-darkest) \ -darkcolor $colors(-dark) \ -lightcolor $colors(-lighter) \ -troughcolor $colors(-darker) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ | < | < | | | | | | < | | < | | | | > | | | | < | < | > | > | | | > | | | < | > > | > > > > | | > > > > > > | > | | 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 | -foreground black \ -bordercolor $colors(-darkest) \ -darkcolor $colors(-dark) \ -lightcolor $colors(-lighter) \ -troughcolor $colors(-darker) \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -font TkDefaultFont ttk::style map "." \ -background [list disabled $colors(-frame) \ active $colors(-lighter)] \ -foreground [list disabled $colors(-disabledfg)] \ -selectbackground [list !focus $colors(-darkest)] \ -selectforeground [list !focus white] # -selectbackground [list !focus "#847d73"] ttk::style configure TButton \ -anchor center -width -11 -padding 3.75p -relief raised ttk::style map TButton \ -background [list \ disabled $colors(-frame) \ pressed $colors(-darker) \ active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ -darkcolor [list pressed $colors(-darker)] \ -bordercolor {alternate #000000} ttk::style configure Toolbutton \ -anchor center -padding 1.5p -relief flat ttk::style map Toolbutton \ -relief [list \ disabled flat \ selected sunken \ pressed sunken \ active raised] \ -background [list \ disabled $colors(-frame) \ pressed $colors(-darker) \ active $colors(-lighter)] \ -lightcolor [list pressed $colors(-darker)] \ -darkcolor [list pressed $colors(-darker)] ttk::style configure TCheckbutton \ -indicatorbackground "#ffffff" \ -indicatormargin {0.75p 0.75p 3p 0.75p} \ -padding 1.5p ttk::style configure TRadiobutton \ -indicatorbackground "#ffffff" \ -indicatormargin {0.75p 0.75p 3p 0.75p} \ -padding 1.5p ttk::style map TCheckbutton -indicatorbackground \ [list pressed $colors(-frame) \ {!disabled alternate} $colors(-altindicator) \ {disabled alternate} $colors(-disabledaltindicator) \ disabled $colors(-frame)] ttk::style map TRadiobutton -indicatorbackground \ [list pressed $colors(-frame) \ {!disabled alternate} $colors(-altindicator) \ {disabled alternate} $colors(-disabledaltindicator) \ disabled $colors(-frame)] ttk::style configure TMenubutton \ -width -11 -arrowsize 3.75p -arrowpadding 2.25p -padding 3.75p \ -relief raised ttk::style configure TEntry -padding 1 -insertwidth 1 ttk::style map TEntry \ -background [list readonly $colors(-frame)] \ -bordercolor [list focus $colors(-selectbg)] \ -lightcolor [list focus #6f9dc6] ttk::style configure TCombobox -padding 1 -insertwidth 1 \ -arrowsize 10.5p ttk::style map TCombobox \ -background [list active $colors(-lighter) \ pressed $colors(-lighter)] \ -fieldbackground [list {readonly focus} $colors(-selectbg) \ readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ -arrowcolor [list disabled $colors(-disabledfg)] \ -bordercolor [list focus $colors(-selectbg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} ttk::style map TSpinbox \ -background [list readonly $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] \ -bordercolor [list focus $colors(-selectbg)] ttk::style configure TNotebook.Tab -padding {4.5p 1.5p 4.5p 1.5p} ttk::style map TNotebook.Tab \ -padding {selected {4.5p 3p 4.5p 1.5p}} \ -background [list selected $colors(-frame) {} $colors(-darker)] \ -lightcolor [list selected $colors(-lighter) {} $colors(-dark)] # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding 2.25p ttk::style configure Item -indicatorsize 9p \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-lighter) -indent 15p ttk::setTreeviewRowHeight 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 3p} \ -borderwidth 2 -relief raised ttk::style configure TScrollbar -gripsize 7.5p \ -arrowsize 10.5p -width 10.5p ttk::style configure TScale -gripsize 7.5p \ -arrowsize 10.5p -sliderlength 22.5p ttk::style configure TProgressbar -background $colors(-frame) \ -arrowsize 10.5p -sliderlength 22.5p ttk::style configure Sash -sashthickness 4.5p -gripsize 15p } } |
Changes to library/ttk/classicTheme.tcl.
1 2 3 4 5 6 7 8 | # # "classic" Tk theme. # # Implements Tk's traditional Motif-like look and feel. # namespace eval ttk::theme::classic { | | > > | | < > | | | > | | < | > | | < | > | > > | > > | | | > | > > | > > > | > > > > | | > > | > | 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 | # # "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 "#b3b3b3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" -altindicator "#b05e5e" } ttk::style theme settings classic { ttk::style configure "." \ -font TkDefaultFont \ -background $colors(-frame) \ -foreground black \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -troughcolor $colors(-troughbg) \ -indicatorcolor $colors(-frame) \ -highlightcolor $colors(-frame) \ -highlightthickness 1 \ -borderwidth 1 \ -insertwidth 2 \ -focuswidth 0 # To match pre-Xft X11 appearance, use: # ttk::style configure . -font {Helvetica 12 bold} ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style map "." -highlightcolor {focus black} ttk::style configure TButton \ -anchor center -padding "3m 1m" -relief raised -shiftrelief 1 ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TCheckbutton -indicatorrelief raised \ -indicatormargin {0 1.5p 3p 1.5p} ttk::style map TCheckbutton \ -indicatorcolor [list \ pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TRadiobutton -indicatorrelief raised \ -indicatormargin {0 1.5p 3p 1.5p} ttk::style map TRadiobutton \ -indicatorcolor [list \ pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TMenubutton -relief raised \ -indicatormargin {3.75p 0} -padding {3m 1m} ttk::style configure TEntry -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style element create Combobox.downarrow from default ttk::style configure TCombobox -padding 1 -arrowsize 9p ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 ttk::style element create Spinbox.uparrow from default ttk::style element create Spinbox.downarrow from default ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure TScrollbar -relief raised -arrowsize 9p -width 9p ttk::style map TScrollbar -relief {{pressed !disabled} sunken} ttk::style configure TScale -sliderrelief raised \ -sliderlength 22.5p -sliderthickness 11.25p ttk::style map TScale -sliderrelief {{pressed !disabled} sunken} ttk::style configure TProgressbar -background SteelBlue \ -barsize 22.5p -thickness 11.25p ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ -background $colors(-troughbg) \ -focussolid 1 ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item -indicatorsize 9p \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ -stripedbackground $colors(-alternate) -indent 15p ttk::setTreeviewRowHeight 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)] # # Toolbar buttons: # ttk::style configure Toolbutton -padding 1.5p -relief flat -shiftrelief 2 ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style map Toolbutton -background \ [list pressed $colors(-troughbg) active $colors(-activebg)] ttk::style configure Sash \ -sashthickness 4.5p -sashpad 1.5 -handlesize 6p -handlepad 6p } } |
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 } |
︙ | ︙ | |||
51 52 53 54 55 56 57 | bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y } bind TCombobox <Shift-Button-1> { ttk::combobox::Press "s" %W %x %y } bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y } bind TCombobox <Triple-Button-1> { ttk::combobox::Press "3" %W %x %y } bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x } bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y } | | > > | > > > > > > > > > > | 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 | bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y } bind TCombobox <Shift-Button-1> { ttk::combobox::Press "s" %W %x %y } bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y } bind TCombobox <Triple-Button-1> { ttk::combobox::Press "3" %W %x %y } bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x } bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y } ttk::bindMouseWheel TCombobox { ttk::combobox::Scroll %W } bind TCombobox <Shift-MouseWheel> { # Ignore the event } bind TCombobox <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY # TouchpadScroll events fire about 60 times per second. if {$deltaY != 0 && %# %% 15 == 0} { ttk::combobox::Scroll %W [expr {$deltaY > 0 ? -1 : 1}] } } bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W } ### Combobox listbox bindings. # bind ComboboxListbox <ButtonRelease-1> { ttk::combobox::LBSelected %W } bind ComboboxListbox <Return> { ttk::combobox::LBSelected %W } bind ComboboxListbox <Escape> { ttk::combobox::LBCancel %W } bind ComboboxListbox <Tab> { ttk::combobox::LBTab %W next } bind ComboboxListbox <<PrevWindow>> { ttk::combobox::LBTab %W prev } bind ComboboxListbox <Destroy> { ttk::combobox::LBCleanup %W } bind ComboboxListbox <Motion> { ttk::combobox::LBHover %W %x %y } bind ComboboxListbox <Map> { focus -force %W } 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 } | < < < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | ## 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] | > > > | > | | < | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | ## 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. # | > > | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > | 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 | 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 { | < < | | | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | } 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] | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | > | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | $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* | > > > > | 543 544 545 546 547 548 549 550 551 552 553 554 555 | # 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 18 | # # 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" -disabledindicator "#a3a3a3" | > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | < > | > | < < | | | | | | | | < < < < | < | > | < < | > | > > > | > | > > > | > > > | > > > > > > | | > > > | | > > > > > > | > > > > | 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 | # # 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" -disabledindicator "#a3a3a3" -pressedindicator "#5895bc" } # On X11, if the user specifies their own choice of colour scheme via # X resources, then set the colour palette based on the user's choice. if {[tk windowingsystem] eq "x11"} { foreach \ xResourceName { { background Background } { foreground Foreground } { background Background } { background Background } { foreground Foreground } { activeBackground ActiveBackground } { selectBackground SelectBackground } { selectForeground SelectForeground } { troughColor TroughColor } { disabledForeground DisabledForeground } { selectBackground SelectBackground } { disabledForeground DisabledForeground } { selectBackground SelectBackground } { windowColor Background } } \ colorName { -frame -foreground -window -alternate -text -activebg -selectbg -selectfg -darker -disabledfg -indicator -disabledindicator -pressedindicator -window } { set color [eval option get . $xResourceName] if {$color ne ""} { set colors($colorName) $color } } } # This array is used to match up the tk widget options with # the corresponding values in the 'colors' array. # This is used by tk_setPalette to apply the new palette # to the ttk widgets. variable colorOptionLookup array set colorOptionLookup { background {-frame -window -alternate} foreground {-foreground -text} activeBackground -activebg selectBackground {-selectbg -indicator -pressedindicator} selectForeground -selectfg troughColor -darker disabledForeground {-disabledfg -disabledindicator} } } # ttk::theme::default::reconfigureDefaultTheme -- # # This procedure contains the definition of the 'default' theme itself. # The theme definition is in a procedure, so it can be re-called when # required, enabling tk_setPalette to set the colours of the ttk widgets. # # Arguments: # None. proc ttk::theme::default::reconfigureDefaultTheme {} { upvar ttk::theme::default::colors colors # The definition of the 'default' theme. ttk::style theme settings default { ttk::style configure "." \ -borderwidth 1 \ -background $colors(-frame) \ -foreground $colors(-foreground) \ -troughcolor $colors(-darker) \ -font TkDefaultFont \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -insertwidth 1 \ -insertcolor $colors(-foreground) \ -focuscolor $colors(-text) ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style configure TButton \ -anchor center -padding 2.25p -width -9 \ -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] foreach style {TCheckbutton TRadiobutton} { ttk::style configure $style \ -indicatorbackground $colors(-window) \ -indicatorforeground $colors(-selectfg) \ -indicatormargin {0 1.5p 3p 1.5p} -padding 0.75p ttk::style map $style -indicatorbackground \ [list {alternate disabled} $colors(-disabledindicator) \ {alternate pressed} $colors(-pressedindicator) \ alternate $colors(-indicator) \ {selected disabled} $colors(-disabledindicator) \ {selected pressed} $colors(-pressedindicator) \ selected $colors(-indicator) \ disabled $colors(-frame) \ pressed $colors(-darker)] } ttk::style configure TMenubutton \ -relief raised -arrowsize 3.75p -arrowpadding 2.25p \ -arrowcolor $colors(-text) -padding {7.5p 2.25p} ttk::style map TMenubutton \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TEntry \ -fieldbackground $colors(-window) -padding 1 \ -focuswidth 2 -focuscolor $colors(-selectbg) ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TCombobox \ -arrowsize 9p -arrowcolor $colors(-text) \ -fieldbackground $colors(-window) -padding 1 \ -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TSpinbox \ -arrowsize 7.5p -arrowcolor $colors(-text) \ -fieldbackground $colors(-window) -padding {1.5p 0 7.5p 0} \ -focuswidth 1 -focuscolor $colors(-selectbg) ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TLabelframe \ -relief groove -borderwidth 2 ttk::style configure TScrollbar \ -width 9p -arrowsize 9p -arrowcolor $colors(-text) ttk::style map TScrollbar \ -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TScale \ -innercolor $colors(-selectbg) \ -outercolor $colors(-window) \ -bordercolor $colors(-darker) \ -groovewidth 3p ttk::style map TScale \ -outercolor [list active $colors(-activebg)] ttk::style configure TProgressbar \ -background $colors(-selectbg) \ -borderwidth 0 \ -barsize 22.5p \ -thickness 3p ttk::style configure TNotebook.Tab \ -padding {3p 1.5p} -background $colors(-darker) ttk::style map TNotebook.Tab \ -background [list selected $colors(-frame)] \ -highlight [list selected 1] \ -highlightcolor [list selected $colors(-selectbg)] # Treeview. # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item -indicatorsize 9p \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview \ -background $colors(-window) \ -stripedbackground $colors(-alternate) \ -fieldbackground $colors(-window) \ -foreground $colors(-text) \ -indent 15p ttk::setTreeviewRowHeight 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 |
︙ | ︙ | |||
130 131 132 133 134 135 136 | Toolbutton.padding -children { Toolbutton.label } } } ttk::style configure Toolbutton \ | | > > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | Toolbutton.padding -children { Toolbutton.label } } } ttk::style configure Toolbutton \ -padding 1.5p -relief flat ttk::style map Toolbutton -relief \ [list disabled flat selected sunken pressed sunken active raised] ttk::style map Toolbutton -background \ [list pressed $colors(-darker) active $colors(-activebg)] } } ttk::theme::default::reconfigureDefaultTheme |
Changes to library/ttk/entry.tcl.
︙ | ︙ | |||
100 101 102 103 104 105 106 | bind TEntry <<NextWord>> { ttk::entry::Move %W nextword } bind TEntry <<LineStart>> { ttk::entry::Move %W home } bind TEntry <<LineEnd>> { ttk::entry::Move %W end } bind TEntry <<SelectPrevChar>> { ttk::entry::Extend %W prevchar } bind TEntry <<SelectNextChar>> { ttk::entry::Extend %W nextchar } bind TEntry <<SelectPrevWord>> { ttk::entry::Extend %W prevword } | | | < < < < | > | | 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 | bind TEntry <<NextWord>> { ttk::entry::Move %W nextword } bind TEntry <<LineStart>> { ttk::entry::Move %W home } bind TEntry <<LineEnd>> { ttk::entry::Move %W end } bind TEntry <<SelectPrevChar>> { ttk::entry::Extend %W prevchar } bind TEntry <<SelectNextChar>> { ttk::entry::Extend %W nextchar } bind TEntry <<SelectPrevWord>> { ttk::entry::Extend %W prevword } bind TEntry <<SelectNextWord>> { ttk::entry::Extend %W selectnextword } bind TEntry <<SelectLineStart>> { ttk::entry::Extend %W home } bind TEntry <<SelectLineEnd>> { ttk::entry::Extend %W end } bind TEntry <<SelectAll>> { %W selection range 0 end } bind TEntry <<SelectNone>> { %W selection clear } bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end } ## 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. # |
︙ | ︙ | |||
234 235 236 237 238 239 240 | set c [$w index $index] # @@@ OR: check [$w index left] / [$w index right] if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} { $w xview $c } } | | < | | | > | > | < < | | | > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > | | > | 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 | set c [$w index $index] # @@@ OR: check [$w index left] / [$w index right] if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} { $w xview $c } } ## NextWord -- # Returns the index of the next start-of-word position after the next # end-of-word position after a given position in the text. # proc ttk::entry::NextWord {w start} { # the check on [winfo class] is because the spinbox and combobox also use this proc if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} { return end } 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 } ## SelectNextWord -- # Returns the index of the next end-of-word position after a given # position in the text. # proc ttk::entry::SelectNextWord {w start} { # the check on [winfo class] is because the spinbox and combobox also use this proc if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} { return end } set pos [tk::endOfWord [$w get] [$w index $start]] if {$pos < 0} { return end } return $pos } ## PrevWord -- Find the previous word position. # proc ttk::entry::PrevWord {w start} { # the check on [winfo class] is because the spinbox and combobox also use this proc if {[winfo class $w] eq "TEntry" && [$w cget -show] ne ""} { return 0 } 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 } selectnextword { SelectNextWord $w $index } home { return 0 } end { $w index end } default { error "Bad relative index $index" } } } ## Move -- Move insert cursor to relative location. |
︙ | ︙ | |||
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]} { | | | | | 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 | # 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 { | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | # 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 } |
︙ | ︙ | |||
494 495 496 497 498 499 500 | $w icursor $last } $w selection range $first $last } ## WordBack, WordForward -- helper routines for WordSelect. # | | | | | | 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | $w icursor $last } $w selection range $first $last } ## WordBack, WordForward -- helper routines for WordSelect. # proc ttk::entry::WordBack {text index {locale {}}} { if {[set pos [tk::wordBreakBefore $text $index $locale]] < 0} { return 0 } return $pos } proc ttk::entry::WordForward {text index {locale {}}} { if {[set pos [tk::wordBreakAfter $text $index $locale]] < 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]]} { | | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | 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]} { | | | | > | 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 | ## 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.
︙ | ︙ | |||
41 42 43 44 45 46 47 | # # Note that the font for column headings (TkHeadingFont) is # _smaller_ than the default font. # # There does not appear to be any recommendations for fixed-width fonts. # # X11: | < < < | | | | | | | | | | | < | | | | | | | | | | | | | | | | < | | | | | | | | | | > | | | | > > > > > | > | | | < | < | | | | | < | | 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 | # # Note that the font for column headings (TkHeadingFont) is # _smaller_ than the default font. # # There does not appear to be any recommendations for fixed-width fonts. # # X11: # "Classic" look used Helvetica bold for everything except # for entry widgets, which use Helvetica medium. # Most other toolkits use medium weight for all UI elements, # which is what we do now. # namespace eval ttk { variable tip145 [catch {font create TkDefaultFont}] catch {font create TkTextFont} catch {font create TkHeadingFont} 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" } if {[::tk::FontScalingFactor] == 1} { set size 10 set ttsize 9 set capsize 12 set fixedsize 10 } else { set size 20 set ttsize 18 set capsize 24 set fixedsize 20 } 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 | 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 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 } | | | | | 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 | } 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.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | bind TNotebook <Left> { ttk::notebook::CycleTab %W -1; break } 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; | > > > > > > > > > > > > > > > > > > > > > > | 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 | bind TNotebook <Left> { ttk::notebook::CycleTab %W -1; break } 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 } bind TNotebook <Enter> { set tk::Priv(xEvents) 0; set tk::Priv(yEvents) 0 } bind TNotebook <MouseWheel> { ttk::notebook::CondCycleTab1 %W y %D -120.0 } bind TNotebook <Option-MouseWheel> { ttk::notebook::CondCycleTab1 %W y %D -12.0 } bind TNotebook <Shift-MouseWheel> { ttk::notebook::CondCycleTab1 %W x %D -120.0 } bind TNotebook <Shift-Option-MouseWheel> { ttk::notebook::CondCycleTab1 %W x %D -12.0 } bind TNotebook <TouchpadScroll> { # TouchpadScroll events fire about 60 times per second. if {%# %% 15 == 0} { ttk::notebook::CondCycleTab2 %W %D } } # 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; |
︙ | ︙ | |||
52 53 54 55 56 57 58 | ActivateTab $w $index } } # CycleTab -- # Select the next/previous tab in the list. # | | < | > > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | 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 | 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 } } } # CondCycleTab1 -- # Conditionally invoke the ttk::notebook::CycleTab proc. # proc ttk::notebook::CondCycleTab1 {w axis dir {factor 1.0}} { # Count both the <MouseWheel> and <Shift-MouseWheel> # events, and ignore the non-dominant ones variable ::tk::Priv incr Priv(${axis}Events) if {($Priv(xEvents) + $Priv(yEvents) > 10) && ($axis eq "x" && $Priv(xEvents) < $Priv(yEvents) || $axis eq "y" && $Priv(yEvents) < $Priv(xEvents))} { return } CycleTab $w $dir $factor } # CondCycleTab2 -- # Conditionally invoke the ttk::notebook::CycleTab proc. # proc ttk::notebook::CondCycleTab2 {w dxdy} { if {[set style [$w cget -style]] eq ""} { set style TNotebook } set tabSide [string index [ttk::style lookup $style -tabposition {} nw] 0] lassign [tk::PreciseScrollDeltas $dxdy] deltaX deltaY if {$tabSide in {n s} && $deltaX != 0} { CycleTab $w [expr {$deltaX < 0 ? -1 : 1}] } elseif {$tabSide in {w e} && $deltaY != 0} { CycleTab $w [expr {$deltaY < 0 ? -1 : 1}] } } # MnemonicTab $nb $key -- # Scan all tabs in the specified notebook for one with the # specified mnemonic. If found, returns path name of tab; # otherwise returns "" # proc ttk::notebook::MnemonicTab {nb key} { set key [string toupper $key] foreach tab [$nb tabs] { set label [$nb tab $tab -text] set underline [$nb tab $tab -underline] if {$underline >= 0} { set mnemonic [string toupper [string index $label $underline]] if {$mnemonic ne "" && $mnemonic eq $key} { return $tab } } } return "" } # +++ Toplevel keyboard traversal. # |
︙ | ︙ | |||
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} } | < | | < < < < | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | 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 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 | # # Bindings for ttk::panedwindow widget. # namespace eval ttk::panedwindow { variable State array set State { pressed 0 pressX - pressY - sash - sashPos - } } ## Bindings: # bind TPanedwindow <Button-1> { ttk::panedwindow::Press %W %x %y } bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y } bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y } bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W } ## 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 -glob -- [$w cget -orient] { h* { set delta [expr {$x - $State(pressX)}] } v* { 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]]} { | | | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 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 -glob -- [$w cget -orient] { h* { set cursor hresize } v* { 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.
︙ | ︙ | |||
13 14 15 16 17 18 19 | bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y } bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y } bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y } | | | > > | > > > > > | 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 | bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y } bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y } bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y } bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y } # Copy the mouse wheel event bindings from Scrollbar to TScrollbar # bind TScrollbar <Enter> { set tk::Priv(xEvents) 0; set tk::Priv(yEvents) 0 } foreach event {<MouseWheel> <Option-MouseWheel> <Shift-MouseWheel> <Shift-Option-MouseWheel> <TouchpadScroll>} { bind TScrollbar $event [bind Scrollbar $event] } unset event proc ttk::scrollbar::Scroll {w n units} { set cmd [$w cget -command] if {$cmd ne ""} { uplevel #0 $cmd scroll $n $units } } |
︙ | ︙ | |||
70 71 72 73 74 75 76 | } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | } } } 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 34 35 36 37 38 39 40 41 42 43 | 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 { ttk::spinbox::Spin %W } bind TSpinbox <Shift-MouseWheel> { # Ignore the event } bind TSpinbox <TouchpadScroll> { lassign [tk::PreciseScrollDeltas %D] deltaX deltaY # TouchpadScroll events fire about 60 times per second. if {$deltaY != 0 && %# %% 12 == 0} { ttk::spinbox::Spin %W [expr {$deltaY > 0 ? -1 : 1}] } } ## 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) | | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 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. # | | > > | | | 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 | ## 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/ttk.tcl.
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | variable currentTheme ;# @@@ Temp -- [::ttk::style theme use] doesn't work if {$theme ni [::ttk::style theme names]} { package require ttk::theme::$theme } ::ttk::style theme use $theme set currentTheme $theme } ### Load widget bindings. # source -encoding utf-8 [file join $::ttk::library button.tcl] source -encoding utf-8 [file join $::ttk::library menubutton.tcl] source -encoding utf-8 [file join $::ttk::library scrollbar.tcl] source -encoding utf-8 [file join $::ttk::library scale.tcl] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | variable currentTheme ;# @@@ Temp -- [::ttk::style theme use] doesn't work if {$theme ni [::ttk::style theme names]} { package require ttk::theme::$theme } ::ttk::style theme use $theme set currentTheme $theme } ## ttk::setTreeviewRowHeight -- # Sets the default height of the ttk::treeview rows for the current theme. # To be invoked from within the library files for the built-in themes. # proc ::ttk::setTreeviewRowHeight {} { set font [::ttk::style lookup Treeview -font] if {$font eq {}} { set font TkDefaultFont } ::ttk::style configure Treeview -rowheight \ [expr {[font metrics $font -linespace] + 2}] } # Applications should make sure that the ttk::setTreeviewRowHeight # procedure will be invoked whenever the virtual event <<ThemeChanged>> # is received (e.g., because the value of the Treeview style's -font # option has changed), or the virtual event <<TkWorldChanged>> with # the user_data field (%d) set to "FontChanged" is received. Example: # # bindtags . [linsert [bindtags .] 1 MyMainWin] # bind MyMainWin <<ThemeChanged>> ttk::setTreeviewRowHeight # bind MyMainWin <<TkWorldChanged>> { # if {"%d" eq "FontChanged"} { # ttk::setTreeviewRowHeight # } # } ### Load widget bindings. # source -encoding utf-8 [file join $::ttk::library button.tcl] source -encoding utf-8 [file join $::ttk::library menubutton.tcl] source -encoding utf-8 [file join $::ttk::library scrollbar.tcl] source -encoding utf-8 [file join $::ttk::library scale.tcl] |
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 | return $theme } } return "default" } ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {} #*EOF* | > > > > | 196 197 198 199 200 201 202 203 204 205 206 207 208 | return $theme } } return "default" } ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {} # Scale the default ttk::scale and ttk::progressbar length option add *TScale.length 75p widgetDefault option add *TProgressbar.length 75p widgetDefault #*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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | # 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 } ## Touchpad scrolling # bind TtkScrollable <TouchpadScroll> { if {%# %% 5 != 0} { return } lassign [tk::PreciseScrollDeltas %D] deltaX deltaY if {$deltaX != 0} { %W xview scroll [expr {-$deltaX}] units } if {$deltaY != 0} { %W yview scroll [expr {-$deltaY}] units } } #*EOF* |
Changes to library/ttk/vistaTheme.tcl.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -insertcolor SystemWindowText \ | | | < | < | < | | | | | < | > > > | | | 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 | ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -insertcolor SystemWindowText \ -font TkDefaultFont ttk::style map "." -foreground {disabled SystemGrayText} ttk::style configure TButton -anchor center -padding 0.75p -width -11 ttk::style configure TRadiobutton -padding 1.5p ttk::style configure TCheckbutton -padding 1.5p ttk::style configure TMenubutton -padding {6p 3p} ttk::style element create Menubutton.dropdown vsapi \ TOOLBAR 4 {{selected active} 6 {selected !active} 5 disabled 4 pressed 3 active 2 {} 1} \ -syssize {SM_CXVSCROLL SM_CYVSCROLL} ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab -expand {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 3p # Combobox ttk::style configure TCombobox -padding 1.5p ttk::style element create Combobox.border vsapi \ COMBOBOX 4 {disabled 4 focus 3 active 2 hover 2 {} 1} ttk::style element create Combobox.background vsapi \ EDIT 3 {disabled 3 readonly 5 focus 4 hover 2 {} 1} ttk::style element create Combobox.rightdownarrow vsapi \ COMBOBOX 6 {disabled 4 pressed 3 active 2 {} 1} \ -syssize {SM_CXVSCROLL SM_CYVSCROLL} |
︙ | ︙ | |||
87 88 89 90 91 92 93 | } } ttk::style map TCombobox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ -foreground [list \ disabled SystemGrayText \ | | | < | < | 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::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 \ EDIT 6 {disabled 4 focus 3 hover 2 {} 1} -padding {2 2 2 2} ttk::style element create Entry.background vsapi \ EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} ttk::style layout TEntry { Entry.field -sticky news -border 0 -children { Entry.background -sticky news -children { Entry.padding -sticky news -children { Entry.textarea -sticky news } } } } ttk::style map TEntry \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] # Spinbox ttk::style configure TSpinbox -padding 0 ttk::style element create Spinbox.field vsapi \ EDIT 9 {disabled 4 focus 3 hover 2 {} 1} -padding {1 1 1 2} ttk::style element create Spinbox.background vsapi \ EDIT 3 {disabled 3 readonly 3 focus 4 hover 2 {} 1} |
︙ | ︙ | |||
144 145 146 147 148 149 150 | Spinbox.uparrow -side top -sticky ens Spinbox.downarrow -side bottom -sticky ens } } } ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ | | < | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | Spinbox.uparrow -side top -sticky ens Spinbox.downarrow -side bottom -sticky ens } } } ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] # SCROLLBAR elements (Vista includes a state for 'hover') ttk::style element create Vertical.Scrollbar.uparrow vsapi \ SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \ -syssize {SM_CXVSCROLL SM_CYVSCROLL} ttk::style element create Vertical.Scrollbar.downarrow vsapi \ |
︙ | ︙ | |||
183 184 185 186 187 188 189 | # Progressbar ttk::style element create Horizontal.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Horizontal.TProgressbar { Horizontal.Progressbar.trough -sticky nswe -children { Horizontal.Progressbar.pbar -side left -sticky ns | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | # Progressbar ttk::style element create Horizontal.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Horizontal.TProgressbar { Horizontal.Progressbar.trough -sticky nswe -children { Horizontal.Progressbar.pbar -side left -sticky ns Horizontal.Progressbar.ctext -sticky nesw } } ttk::style element create Vertical.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Vertical.TProgressbar { Vertical.Progressbar.trough -sticky nswe -children { Vertical.Progressbar.pbar -side bottom -sticky we |
︙ | ︙ | |||
219 220 221 222 223 224 225 | Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } } } # Treeview | | > > | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } } } # Treeview ttk::style configure Item -padding {3p 0 0 0} ttk::style configure Treeview -indent 15p ttk::setTreeviewRowHeight package provide ttk::theme::vista 1.0 } } |
Changes to library/ttk/winTheme.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # Settings for 'winnative' theme. # namespace eval ttk::theme::winnative { ttk::style theme settings winnative { ttk::style configure "." \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -fieldbackground SystemWindow \ -insertcolor SystemWindowText \ -troughcolor SystemScrollbar \ | > | | < | | > > | | > < | < | | | | | < | | | | < | | | | | | > > | > > | > | 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 | # # Settings for 'winnative' theme. # namespace eval ttk::theme::winnative { ttk::style theme settings winnative { ttk::style configure "." \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -fieldbackground SystemWindow \ -insertcolor SystemWindowText \ -troughcolor SystemScrollbar \ -font TkDefaultFont ttk::style map "." -foreground {disabled SystemGrayText} ttk::style map "." -embossed {disabled 1} ttk::style configure TButton \ -anchor center -width -11 -relief raised -shiftrelief 1 ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TCheckbutton -padding {1.5p 3p} ttk::style configure TRadiobutton -padding {1.5p 3p} ttk::style configure TMenubutton \ -padding {6p 3p} -arrowsize 2.25p -relief raised ttk::style configure TEntry \ -padding 2 -insertwidth 1 ttk::style map TEntry \ -fieldbackground \ {readonly SystemButtonFace disabled SystemButtonFace} \ -selectbackground {!focus SystemWindow} \ -selectforeground {!focus SystemWindowText} ttk::style configure TCombobox -padding 1.5p 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 {{readonly focus} SystemHighlight} ttk::style element create ComboboxPopdownFrame.border from default ttk::style configure ComboboxPopdownFrame \ -borderwidth 1 -relief solid ttk::style configure TSpinbox -padding {1.5p 0 12p 0} ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure Toolbutton -relief flat -padding {6p 3p} ttk::style map Toolbutton -relief \ {disabled flat selected sunken pressed sunken active raised} ttk::style configure TScale -groovewidth 3p ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style configure TNotebook.Tab -padding {2.25p 0.75p} -borderwidth 1 ttk::style map TNotebook.Tab -expand {selected {2 2 2 0}} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight -indent 15p ttk::setTreeviewRowHeight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 \ -barsize 22.5p -thickness 11.25p } } |
Changes to library/ttk/xpTheme.tcl.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -insertcolor SystemWindowText \ | | | < < | | < | | | | | < | < | | | | < | | | < | > > | > > | | 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 | ttk::style configure . \ -background SystemButtonFace \ -foreground SystemWindowText \ -selectforeground SystemHighlightText \ -selectbackground SystemHighlight \ -insertcolor SystemWindowText \ -font TkDefaultFont ttk::style map "." -foreground [list disabled SystemGrayText] ttk::style configure TButton -anchor center -padding 0.75p -width -11 ttk::style configure TRadiobutton -padding 1.5p ttk::style configure TCheckbutton -padding 1.5p ttk::style configure TMenubutton -padding {6p 3p} ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab -expand {selected {2 2 2 2}} ttk::style configure TLabelframe.Label -foreground "#0046d5" # OR: -padding {3 3 3 6}, which some apps seem to use. ttk::style configure TEntry -padding {2 2 2 4} ttk::style map TEntry \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] ttk::style configure TCombobox -padding 1.5p 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 {1.5p 0 10.5p 0} ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] ttk::style configure Toolbutton -padding 3p # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background SystemWindow \ -stripedbackground System3dLight -indent 15p ttk::setTreeviewRowHeight ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] } } |
Deleted library/unsupported.tcl.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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"} { |
︙ | ︙ | |||
340 341 342 343 344 345 346 | pack $f1 -side top -fill x pack $f3 -side bottom -fill x pack $f2 -expand yes -fill both set f2a [frame $f2.a] set f2b [frame $f2.b] | | | | | | | | | 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 | pack $f1 -side top -fill x pack $f3 -side bottom -fill x pack $f2 -expand yes -fill both set f2a [frame $f2.a] set f2b [frame $f2.b] grid $f2a -row 0 -column 0 -rowspan 1 -columnspan 1 -padx 3p -pady 3p \ -sticky news grid $f2b -row 0 -column 1 -rowspan 1 -columnspan 1 -padx 3p -pady 3p \ -sticky news grid rowconfigure $f2 0 -minsize 0 -weight 1 grid columnconfigure $f2 0 -minsize 0 -weight 1 grid columnconfigure $f2 1 -minsize 150 -weight 2 # The Filter box # bind [::tk::AmpWidget label $f1.lab -text [mc "Fil&ter:"] -anchor w] \ <<AltUnderlined>> [list focus $f1.ent] entry $f1.ent pack $f1.lab -side top -fill x -padx 4.5p -pady 3p pack $f1.ent -side top -fill x -padx 3p -pady 0 set data(fEnt) $f1.ent # The file and directory lists # set data(dList) [MotifFDialog_MakeSList $w $f2a \ [mc "&Directory:"] DList] set data(fList) [MotifFDialog_MakeSList $w $f2b \ [mc "Fi&les:"] FList] # The Selection box # bind [::tk::AmpWidget label $f3.lab -text [mc "&Selection:"] -anchor w] \ <<AltUnderlined>> [list focus $f3.ent] entry $f3.ent pack $f3.lab -side top -fill x -padx 4.5p -pady 0 pack $f3.ent -side top -fill x -padx 3p -pady 3p set data(sEnt) $f3.ent # The buttons # set maxWidth [::tk::mcmaxamp &OK &Filter &Cancel] set maxWidth [expr {$maxWidth<6?6:$maxWidth}] set data(okBtn) [::tk::AmpWidget button $bot.ok -text [mc "&OK"] \ -width $maxWidth \ -command [list tk::MotifFDialog_OkCmd $w]] set data(filterBtn) [::tk::AmpWidget button $bot.filter -text [mc "&Filter"] \ -width $maxWidth \ -command [list tk::MotifFDialog_FilterCmd $w]] set data(cancelBtn) [::tk::AmpWidget button $bot.cancel -text [mc "&Cancel"] \ -width $maxWidth \ -command [list tk::MotifFDialog_CancelCmd $w]] pack $bot.ok $bot.filter $bot.cancel -padx 7.5p -pady 7.5p -expand yes \ -side left # Create the bindings: # bind $w <Alt-Key> [list ::tk::AltKeyInDialog $w %A] bind $data(fEnt) <Return> [list tk::MotifFDialog_ActivateFEnt $w] |
︙ | ︙ | |||
437 438 439 440 441 442 443 | bind [::tk::AmpWidget label $f.lab -text $label -anchor w] \ <<AltUnderlined>> [list focus $f.l] listbox $f.l -width 12 -height 5 -exportselection 0\ -xscrollcommand [list $f.h set] -yscrollcommand [list $f.v set] scrollbar $f.v -orient vertical -takefocus 0 -command [list $f.l yview] scrollbar $f.h -orient horizontal -takefocus 0 -command [list $f.l xview] grid $f.lab -row 0 -column 0 -sticky news -rowspan 1 -columnspan 2 \ | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | bind [::tk::AmpWidget label $f.lab -text $label -anchor w] \ <<AltUnderlined>> [list focus $f.l] listbox $f.l -width 12 -height 5 -exportselection 0\ -xscrollcommand [list $f.h set] -yscrollcommand [list $f.v set] scrollbar $f.v -orient vertical -takefocus 0 -command [list $f.l yview] scrollbar $f.h -orient horizontal -takefocus 0 -command [list $f.l xview] grid $f.lab -row 0 -column 0 -sticky news -rowspan 1 -columnspan 2 \ -padx 1.5p -pady 1.5p grid $f.l -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news grid $f.v -row 1 -column 1 -rowspan 1 -columnspan 1 -sticky news grid $f.h -row 2 -column 0 -rowspan 1 -columnspan 1 -sticky news grid rowconfigure $f 0 -weight 0 -minsize 0 grid rowconfigure $f 1 -weight 1 -minsize 0 grid columnconfigure $f 0 -weight 1 -minsize 0 |
︙ | ︙ | |||
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.
1 2 3 4 5 6 | ######################################################################################################## # # Makefile wrapper to build tk on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem # uses the standard unix build system in tk/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ######################################################################################################## # # Makefile wrapper to build tk on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem # uses the standard unix build system in tk/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # # Copyright © 2002-2008 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. # ######################################################################################################## #------------------------------------------------------------------------------------------------------- |
︙ | ︙ | |||
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 arm64 -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 |
︙ | ︙ | |||
641 642 643 644 645 646 647 | occurred when scrolling a Text widget which contained embedded subwindows. It involved some specific differences between the low-level behavior of Apple's window manager versus those of the other platforms, and the fix ultimately required changes in the generic Tk implementation (documented in the comments in the DisplayText function). | | | | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | occurred when scrolling a Text widget which contained embedded subwindows. It involved some specific differences between the low-level behavior of Apple's window manager versus those of the other platforms, and the fix ultimately required changes in the generic Tk implementation (documented in the comments in the DisplayText function). The Text widget attempts to improve performance when scrolling by minimizing the number of text lines which need to be redisplayed. It does this by calling the platform-specific TkScrollWindow function which uses a low-level routine to map one rectangle of the window to another. The TkScrollWindow function returns a damage region which is then used by the Text widget's DisplayText function to determine which text lines need to be redrawn. On the unix and win platforms, this damage region includes bounding rectangles for all embedded windows inside the Text widget. The way that this works is system dependent. On unix, the low level scrolling is done by XCopyArea, which generates a GraphicsExpose event for each embedded window. These GraphicsExposed events are processsed within TkScrollWindow, using a special handler which adds the bounding rectangle of each subwindow to the damage region. On the win platform the damage region is built by the low level function ScrollWindowEx, and it also includes bounding rectangles for all embedded windows. This is possible because on X11 and Windows every Tk widget is also known to the window manager as a |
︙ | ︙ | |||
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.
1 2 3 4 5 6 | // // Tk-Common.xcconfig -- // // This file contains the Xcode build settings comon to all // project configurations in Wish.xcodeproj. // | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // // Tk-Common.xcconfig -- // // This file contains the Xcode build settings comon to all // project configurations in Wish.xcodeproj. // // Copyright © 2007-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. HEADER_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TK_SRCROOT)/xlib "$(DERIVED_FILE_DIR)/tcl" "$(DERIVED_FILE_DIR)/tk" $(HEADER_SEARCH_PATHS) REZ_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TCL_SRCROOT)/generic $(REZ_SEARCH_PATHS) OTHER_LDFLAGS = -headerpad_max_install_names -sectcreate __TEXT __info_plist "$(DERIVED_FILE_DIR)/tk/Wish-Info.plist" $(OTHER_LDFLAGS) |
︙ | ︙ | |||
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-Debug.xcconfig.
1 2 3 4 5 6 | // // Tk-Debug.xcconfig -- // // This file contains the Xcode build settings for all Debug // project configurations in Wish.xcodeproj. // | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // // Tk-Debug.xcconfig -- // // This file contains the Xcode build settings for all Debug // project configurations in Wish.xcodeproj. // // 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. #include "Tk-Common.xcconfig" DEBUG_INFORMATION_FORMAT = dwarf |
︙ | ︙ |
Changes to macosx/Tk-Info.plist.in.
1 2 3 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- Copyright © 2005-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. --> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> |
︙ | ︙ |
Changes to macosx/Tk-Release.xcconfig.
1 2 3 4 5 6 | // // Tk-Release.xcconfig -- // // This file contains the Xcode build settings for all Release // project configurations in Wish.xcodeproj. // | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // // Tk-Release.xcconfig -- // // This file contains the Xcode build settings for all Release // project configurations in Wish.xcodeproj. // // 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. #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.
1 2 3 4 5 6 7 8 9 | // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; }; F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; }; F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; }; F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; }; F93599B30DF1F75400E04F67 /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; }; F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; }; F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; }; |
︙ | ︙ | |||
516 517 518 519 520 521 522 | F9FD31780CC1AD070073837D /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; }; F9FD31790CC1AD070073837D /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; }; F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; }; F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; }; F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; }; F9FD317D0CC1AD070073837D /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; }; F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; }; | < | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | F9FD31780CC1AD070073837D /* tkMain.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE608F27A39005CB29B /* tkMain.c */; }; F9FD31790CC1AD070073837D /* tkMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE708F27A39005CB29B /* tkMenu.c */; }; F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAE908F27A39005CB29B /* tkMenubutton.c */; }; F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEB08F27A39005CB29B /* tkMenuDraw.c */; }; F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEC08F27A39005CB29B /* tkMessage.c */; }; F9FD317D0CC1AD070073837D /* tkObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAED08F27A39005CB29B /* tkObj.c */; }; F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEE08F27A39005CB29B /* tkOldConfig.c */; }; F9FD31800CC1AD070073837D /* tkOption.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAEF08F27A39005CB29B /* tkOption.c */; }; F9FD31810CC1AD070073837D /* tkPack.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF008F27A39005CB29B /* tkPack.c */; }; F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF108F27A39005CB29B /* tkPanedWindow.c */; }; F9FD31830CC1AD070073837D /* tkPlace.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF208F27A39005CB29B /* tkPlace.c */; }; F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF608F27A39005CB29B /* tkRectOval.c */; }; F9FD31860CC1AD070073837D /* tkScale.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF708F27A39005CB29B /* tkScale.c */; }; F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAF908F27A39005CB29B /* tkScrollbar.c */; }; |
︙ | ︙ | |||
592 593 594 595 596 597 598 | F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8308F27A3D005CB29B /* tkUnixFocus.c */; }; F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9008F27A3D005CB29B /* tkUnixWm.c */; }; F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */; }; F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7808F27A3D005CB29B /* tkUnix.c */; }; F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8808F27A3D005CB29B /* tkUnixMenu.c */; }; F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */; }; F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8008F27A3D005CB29B /* tkUnixDraw.c */; }; | < | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8308F27A3D005CB29B /* tkUnixFocus.c */; }; F9FD32000CC1ADB70073837D /* tkUnixWm.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC9008F27A3D005CB29B /* tkUnixWm.c */; }; F9FD32010CC1ADB70073837D /* tkUnixRFont.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8B08F27A3D005CB29B /* tkUnixRFont.c */; }; F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7808F27A3D005CB29B /* tkUnix.c */; }; F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8808F27A3D005CB29B /* tkUnixMenu.c */; }; F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */; }; F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8008F27A3D005CB29B /* tkUnixDraw.c */; }; F9FD32070CC1ADB70073837D /* tkUnixSelect.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */; }; F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8208F27A3D005CB29B /* tkUnixEvent.c */; }; F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7B08F27A3D005CB29B /* tkUnixColor.c */; }; F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC7A08F27A3D005CB29B /* tkUnixButton.c */; }; F9FD320B0CC1ADB70073837D /* tkUnixMenubu.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8908F27A3D005CB29B /* tkUnixMenubu.c */; }; F9FD320C0CC1ADB70073837D /* tkUnixScrlbr.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BC8D08F27A3D005CB29B /* tkUnixScrlbr.c */; }; F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD32140CC1AF170073837D /* libX11.dylib */; }; |
︙ | ︙ | |||
681 682 683 684 685 686 687 | F966BA0708F27A37005CB29B /* gray50.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray50.xbm; sourceTree = "<group>"; }; F966BA0808F27A37005CB29B /* gray75.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray75.xbm; sourceTree = "<group>"; }; F966BA0908F27A37005CB29B /* hourglass.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = hourglass.xbm; sourceTree = "<group>"; }; F966BA0A08F27A37005CB29B /* info.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = info.xbm; sourceTree = "<group>"; }; F966BA0B08F27A37005CB29B /* questhead.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = questhead.xbm; sourceTree = "<group>"; }; F966BA0C08F27A37005CB29B /* question.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = question.xbm; sourceTree = "<group>"; }; F966BA0D08F27A37005CB29B /* warning.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = warning.xbm; sourceTree = "<group>"; }; | < | | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | F966BA0708F27A37005CB29B /* gray50.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray50.xbm; sourceTree = "<group>"; }; F966BA0808F27A37005CB29B /* gray75.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray75.xbm; sourceTree = "<group>"; }; F966BA0908F27A37005CB29B /* hourglass.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = hourglass.xbm; sourceTree = "<group>"; }; F966BA0A08F27A37005CB29B /* info.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = info.xbm; sourceTree = "<group>"; }; F966BA0B08F27A37005CB29B /* questhead.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = questhead.xbm; sourceTree = "<group>"; }; F966BA0C08F27A37005CB29B /* question.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = question.xbm; sourceTree = "<group>"; }; F966BA0D08F27A37005CB29B /* warning.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = warning.xbm; sourceTree = "<group>"; }; F966BA0F08F27A37005CB29B /* changes.md */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes.md; sourceTree = "<group>"; }; F966BA1108F27A37005CB29B /* 3DBorder.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = 3DBorder.3; sourceTree = "<group>"; }; F966BA1208F27A37005CB29B /* AddOption.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddOption.3; sourceTree = "<group>"; }; F966BA1308F27A37005CB29B /* bell.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bell.n; sourceTree = "<group>"; }; F966BA1408F27A37005CB29B /* bind.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bind.n; sourceTree = "<group>"; }; F966BA1508F27A37005CB29B /* BindTable.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = BindTable.3; sourceTree = "<group>"; }; F966BA1608F27A37005CB29B /* bindtags.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bindtags.n; sourceTree = "<group>"; }; F966BA1708F27A37005CB29B /* bitmap.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = bitmap.n; sourceTree = "<group>"; }; |
︙ | ︙ | |||
778 779 780 781 782 783 784 | F966BA6908F27A38005CB29B /* MainLoop.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainLoop.3; sourceTree = "<group>"; }; F966BA6A08F27A38005CB29B /* MaintGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MaintGeom.3; sourceTree = "<group>"; }; F966BA6B08F27A38005CB29B /* MainWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainWin.3; sourceTree = "<group>"; }; F966BA6D08F27A38005CB29B /* ManageGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ManageGeom.3; sourceTree = "<group>"; }; F966BA6E08F27A38005CB29B /* MapWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MapWindow.3; sourceTree = "<group>"; }; F966BA6F08F27A38005CB29B /* MeasureChar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MeasureChar.3; sourceTree = "<group>"; }; F966BA7008F27A38005CB29B /* menu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menu.n; sourceTree = "<group>"; }; | < < | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | F966BA6908F27A38005CB29B /* MainLoop.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainLoop.3; sourceTree = "<group>"; }; F966BA6A08F27A38005CB29B /* MaintGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MaintGeom.3; sourceTree = "<group>"; }; F966BA6B08F27A38005CB29B /* MainWin.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MainWin.3; sourceTree = "<group>"; }; F966BA6D08F27A38005CB29B /* ManageGeom.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ManageGeom.3; sourceTree = "<group>"; }; F966BA6E08F27A38005CB29B /* MapWindow.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MapWindow.3; sourceTree = "<group>"; }; F966BA6F08F27A38005CB29B /* MeasureChar.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MeasureChar.3; sourceTree = "<group>"; }; F966BA7008F27A38005CB29B /* menu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menu.n; sourceTree = "<group>"; }; F966BA7208F27A38005CB29B /* menubutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = menubutton.n; sourceTree = "<group>"; }; F966BA7308F27A38005CB29B /* message.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = message.n; sourceTree = "<group>"; }; F966BA7408F27A38005CB29B /* messageBox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = messageBox.n; sourceTree = "<group>"; }; F966BA7508F27A38005CB29B /* MoveToplev.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = MoveToplev.3; sourceTree = "<group>"; }; F966BA7608F27A38005CB29B /* Name.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Name.3; sourceTree = "<group>"; }; F966BA7708F27A38005CB29B /* NameOfImg.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = NameOfImg.3; sourceTree = "<group>"; }; F966BA7808F27A38005CB29B /* option.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = option.n; sourceTree = "<group>"; }; F966BA7908F27A38005CB29B /* optionMenu.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = optionMenu.n; sourceTree = "<group>"; }; F966BA7A08F27A38005CB29B /* options.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = options.n; sourceTree = "<group>"; }; F966BA7B08F27A38005CB29B /* OwnSelect.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = OwnSelect.3; sourceTree = "<group>"; }; F966BA7D08F27A38005CB29B /* pack.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = pack.n; sourceTree = "<group>"; }; F966BA7E08F27A38005CB29B /* palette.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = palette.n; sourceTree = "<group>"; }; F966BA7F08F27A38005CB29B /* panedwindow.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = panedwindow.n; sourceTree = "<group>"; }; F966BA8008F27A38005CB29B /* ParseArgv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ParseArgv.3; sourceTree = "<group>"; }; F966BA8108F27A38005CB29B /* photo.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = photo.n; sourceTree = "<group>"; }; F966BA8208F27A38005CB29B /* place.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = place.n; sourceTree = "<group>"; }; F966BA8308F27A38005CB29B /* popup.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = popup.n; sourceTree = "<group>"; }; |
︙ | ︙ | |||
913 914 915 916 917 918 919 | F966BAF708F27A39005CB29B /* tkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScale.c; sourceTree = "<group>"; }; F966BAF808F27A39005CB29B /* tkScale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScale.h; sourceTree = "<group>"; }; F966BAF908F27A39005CB29B /* tkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScrollbar.c; sourceTree = "<group>"; }; F966BAFA08F27A39005CB29B /* tkScrollbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScrollbar.h; sourceTree = "<group>"; }; F966BAFB08F27A39005CB29B /* tkSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSelect.c; sourceTree = "<group>"; }; F966BAFC08F27A39005CB29B /* tkSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkSelect.h; sourceTree = "<group>"; }; F966BAFD08F27A39005CB29B /* tkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSquare.c; sourceTree = "<group>"; }; | < | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | F966BAF708F27A39005CB29B /* tkScale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScale.c; sourceTree = "<group>"; }; F966BAF808F27A39005CB29B /* tkScale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScale.h; sourceTree = "<group>"; }; F966BAF908F27A39005CB29B /* tkScrollbar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkScrollbar.c; sourceTree = "<group>"; }; F966BAFA08F27A39005CB29B /* tkScrollbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkScrollbar.h; sourceTree = "<group>"; }; F966BAFB08F27A39005CB29B /* tkSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSelect.c; sourceTree = "<group>"; }; F966BAFC08F27A39005CB29B /* tkSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkSelect.h; sourceTree = "<group>"; }; F966BAFD08F27A39005CB29B /* tkSquare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkSquare.c; sourceTree = "<group>"; }; F966BAFF08F27A39005CB29B /* tkStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubInit.c; sourceTree = "<group>"; }; F966BB0008F27A39005CB29B /* tkStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStubLib.c; sourceTree = "<group>"; }; F966BB0108F27A39005CB29B /* tkStyle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkStyle.c; sourceTree = "<group>"; }; F966BB0208F27A39005CB29B /* tkTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTest.c; sourceTree = "<group>"; }; F966BB0308F27A39005CB29B /* tkText.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkText.c; sourceTree = "<group>"; }; F966BB0408F27A39005CB29B /* tkText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkText.h; sourceTree = "<group>"; }; F966BB0508F27A39005CB29B /* tkTextBTree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkTextBTree.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1003 1004 1005 1006 1007 1008 1009 | F966BB6208F27A3A005CB29B /* dialog.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.tcl; sourceTree = "<group>"; }; F966BB6308F27A3A005CB29B /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; }; F966BB6408F27A3A005CB29B /* focus.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.tcl; sourceTree = "<group>"; }; F966BB7308F27A3A005CB29B /* listbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.tcl; sourceTree = "<group>"; }; F966BB7408F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; }; F966BB7508F27A3A005CB29B /* mkpsenc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mkpsenc.tcl; sourceTree = "<group>"; }; F966BB7608F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; }; | < < | 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 | F966BB6208F27A3A005CB29B /* dialog.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.tcl; sourceTree = "<group>"; }; F966BB6308F27A3A005CB29B /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; }; F966BB6408F27A3A005CB29B /* focus.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = focus.tcl; sourceTree = "<group>"; }; F966BB7308F27A3A005CB29B /* listbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = listbox.tcl; sourceTree = "<group>"; }; F966BB7408F27A3A005CB29B /* menu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.tcl; sourceTree = "<group>"; }; F966BB7508F27A3A005CB29B /* mkpsenc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mkpsenc.tcl; sourceTree = "<group>"; }; F966BB7608F27A3A005CB29B /* msgbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.tcl; sourceTree = "<group>"; }; F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; }; F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; }; F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; }; F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; }; F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; }; F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; }; F966BB8E08F27A3B005CB29B /* spinbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = spinbox.tcl; sourceTree = "<group>"; }; F966BB8F08F27A3B005CB29B /* tclIndex */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclIndex; sourceTree = "<group>"; }; F966BB9008F27A3B005CB29B /* tearoff.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tearoff.tcl; sourceTree = "<group>"; }; F966BB9108F27A3B005CB29B /* text.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = text.tcl; sourceTree = "<group>"; }; F966BB9208F27A3B005CB29B /* tk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.tcl; sourceTree = "<group>"; }; F966BB9308F27A3B005CB29B /* tkfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tkfbox.tcl; sourceTree = "<group>"; }; F966BB9508F27A3B005CB29B /* xmfbox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.tcl; sourceTree = "<group>"; }; F966BB9608F27A3B005CB29B /* license.terms */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = license.terms; sourceTree = "<group>"; }; F966BBBA08F27A3B005CB29B /* configure.ac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure.ac; sourceTree = "<group>"; }; F966BBBB08F27A3B005CB29B /* GNUmakefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = GNUmakefile; sourceTree = "<group>"; }; F966BBBE08F27A3B005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F966BBC008F27A3B005CB29B /* Tk-Info.plist.in */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = "Tk-Info.plist.in"; sourceTree = "<group>"; }; F966BBC208F27A3B005CB29B /* tkMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSX.h; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1121 1122 1123 1124 1125 1126 1127 | F966BC3808F27A3C005CB29B /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; }; F966BC3908F27A3C005CB29B /* menu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.test; sourceTree = "<group>"; }; F966BC3A08F27A3C005CB29B /* menubut.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubut.test; sourceTree = "<group>"; }; F966BC3B08F27A3C005CB29B /* menuDraw.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menuDraw.test; sourceTree = "<group>"; }; F966BC3C08F27A3C005CB29B /* message.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = message.test; sourceTree = "<group>"; }; F966BC3D08F27A3C005CB29B /* msgbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.test; sourceTree = "<group>"; }; F966BC3E08F27A3C005CB29B /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; }; | < | 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | F966BC3808F27A3C005CB29B /* main.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = main.test; sourceTree = "<group>"; }; F966BC3908F27A3C005CB29B /* menu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menu.test; sourceTree = "<group>"; }; F966BC3A08F27A3C005CB29B /* menubut.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubut.test; sourceTree = "<group>"; }; F966BC3B08F27A3C005CB29B /* menuDraw.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menuDraw.test; sourceTree = "<group>"; }; F966BC3C08F27A3C005CB29B /* message.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = message.test; sourceTree = "<group>"; }; F966BC3D08F27A3C005CB29B /* msgbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.test; sourceTree = "<group>"; }; F966BC3E08F27A3C005CB29B /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; }; F966BC4008F27A3C005CB29B /* option.file1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file1; sourceTree = "<group>"; }; F966BC4108F27A3C005CB29B /* option.file2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file2; sourceTree = "<group>"; }; F966BC4208F27A3C005CB29B /* option.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = option.test; sourceTree = "<group>"; }; F966BC4308F27A3C005CB29B /* pack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pack.test; sourceTree = "<group>"; }; F966BC4408F27A3C005CB29B /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; }; F966BC4508F27A3D005CB29B /* place.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = place.test; sourceTree = "<group>"; }; F966BC4608F27A3D005CB29B /* raise.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = raise.test; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1184 1185 1186 1187 1188 1189 1190 | F966BC7808F27A3D005CB29B /* tkUnix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix.c; sourceTree = "<group>"; }; F966BC7908F27A3D005CB29B /* tkUnix3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix3d.c; sourceTree = "<group>"; }; F966BC7A08F27A3D005CB29B /* tkUnixButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixButton.c; sourceTree = "<group>"; }; F966BC7B08F27A3D005CB29B /* tkUnixColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixColor.c; sourceTree = "<group>"; }; F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixConfig.c; sourceTree = "<group>"; }; F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixCursor.c; sourceTree = "<group>"; }; F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixDefault.h; sourceTree = "<group>"; }; | < | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | F966BC7808F27A3D005CB29B /* tkUnix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix.c; sourceTree = "<group>"; }; F966BC7908F27A3D005CB29B /* tkUnix3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnix3d.c; sourceTree = "<group>"; }; F966BC7A08F27A3D005CB29B /* tkUnixButton.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixButton.c; sourceTree = "<group>"; }; F966BC7B08F27A3D005CB29B /* tkUnixColor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixColor.c; sourceTree = "<group>"; }; F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixConfig.c; sourceTree = "<group>"; }; F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixCursor.c; sourceTree = "<group>"; }; F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixDefault.h; sourceTree = "<group>"; }; F966BC8008F27A3D005CB29B /* tkUnixDraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixDraw.c; sourceTree = "<group>"; }; F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEmbed.c; sourceTree = "<group>"; }; F966BC8208F27A3D005CB29B /* tkUnixEvent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixEvent.c; sourceTree = "<group>"; }; F966BC8308F27A3D005CB29B /* tkUnixFocus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFocus.c; sourceTree = "<group>"; }; F966BC8408F27A3D005CB29B /* tkUnixFont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixFont.c; sourceTree = "<group>"; }; F966BC8508F27A3D005CB29B /* tkUnixInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixInit.c; sourceTree = "<group>"; }; F966BC8608F27A3D005CB29B /* tkUnixInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkUnixInt.h; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1365 1366 1367 1368 1369 1370 1371 | F968887F0AF788F6000797B5 /* ttk_Theme.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Theme.3; sourceTree = "<group>"; }; F96888800AF788F6000797B5 /* ttk_treeview.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_treeview.n; sourceTree = "<group>"; }; F96888810AF788F6000797B5 /* ttk_widget.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_widget.n; sourceTree = "<group>"; }; F96888840AF78938000797B5 /* ttkMacOSXTheme.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = ttkMacOSXTheme.c; sourceTree = "<group>"; }; F96888860AF78953000797B5 /* ttkWinMonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinMonitor.c; sourceTree = "<group>"; }; F96888870AF78953000797B5 /* ttkWinTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinTheme.c; sourceTree = "<group>"; }; F96888880AF78953000797B5 /* ttkWinXPTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinXPTheme.c; sourceTree = "<group>"; }; | < | | 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | F968887F0AF788F6000797B5 /* ttk_Theme.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Theme.3; sourceTree = "<group>"; }; F96888800AF788F6000797B5 /* ttk_treeview.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_treeview.n; sourceTree = "<group>"; }; F96888810AF788F6000797B5 /* ttk_widget.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_widget.n; sourceTree = "<group>"; }; F96888840AF78938000797B5 /* ttkMacOSXTheme.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = ttkMacOSXTheme.c; sourceTree = "<group>"; }; F96888860AF78953000797B5 /* ttkWinMonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinMonitor.c; sourceTree = "<group>"; }; F96888870AF78953000797B5 /* ttkWinTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinTheme.c; sourceTree = "<group>"; }; F96888880AF78953000797B5 /* ttkWinXPTheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttkWinXPTheme.c; sourceTree = "<group>"; }; F96D3DFB08F272A4004A47F5 /* changes.md */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = changes.md; sourceTree = "<group>"; }; F96D3DFD08F272A4004A47F5 /* Access.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Access.3; sourceTree = "<group>"; }; F96D3DFE08F272A4004A47F5 /* AddErrInfo.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AddErrInfo.3; sourceTree = "<group>"; }; F96D3DFF08F272A4004A47F5 /* after.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = after.n; sourceTree = "<group>"; }; F96D3E0008F272A4004A47F5 /* Alloc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Alloc.3; sourceTree = "<group>"; }; F96D3E0108F272A4004A47F5 /* AllowExc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AllowExc.3; sourceTree = "<group>"; }; F96D3E0208F272A4004A47F5 /* append.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = append.n; sourceTree = "<group>"; }; F96D3E0308F272A4004A47F5 /* AppInit.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = AppInit.3; sourceTree = "<group>"; }; |
︙ | ︙ | |||
2248 2249 2250 2251 2252 2253 2254 | F966BA6908F27A38005CB29B /* MainLoop.3 */, F966BA6A08F27A38005CB29B /* MaintGeom.3 */, F966BA6B08F27A38005CB29B /* MainWin.3 */, F966BA6D08F27A38005CB29B /* ManageGeom.3 */, F966BA6E08F27A38005CB29B /* MapWindow.3 */, F966BA6F08F27A38005CB29B /* MeasureChar.3 */, F966BA7008F27A38005CB29B /* menu.n */, | < < | 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 | F966BA6908F27A38005CB29B /* MainLoop.3 */, F966BA6A08F27A38005CB29B /* MaintGeom.3 */, F966BA6B08F27A38005CB29B /* MainWin.3 */, F966BA6D08F27A38005CB29B /* ManageGeom.3 */, F966BA6E08F27A38005CB29B /* MapWindow.3 */, F966BA6F08F27A38005CB29B /* MeasureChar.3 */, F966BA7008F27A38005CB29B /* menu.n */, F966BA7208F27A38005CB29B /* menubutton.n */, F966BA7308F27A38005CB29B /* message.n */, F966BA7408F27A38005CB29B /* messageBox.n */, F966BA7508F27A38005CB29B /* MoveToplev.3 */, F966BA7608F27A38005CB29B /* Name.3 */, F966BA7708F27A38005CB29B /* NameOfImg.3 */, F966BA7808F27A38005CB29B /* option.n */, F966BA7908F27A38005CB29B /* optionMenu.n */, F966BA7A08F27A38005CB29B /* options.n */, F966BA7B08F27A38005CB29B /* OwnSelect.3 */, F966BA7D08F27A38005CB29B /* pack.n */, F966BA7E08F27A38005CB29B /* palette.n */, F966BA7F08F27A38005CB29B /* panedwindow.n */, F966BA8008F27A38005CB29B /* ParseArgv.3 */, F966BA8108F27A38005CB29B /* photo.n */, F966BA8208F27A38005CB29B /* place.n */, F966BA8308F27A38005CB29B /* popup.n */, |
︙ | ︙ | |||
2415 2416 2417 2418 2419 2420 2421 | F966BAF708F27A39005CB29B /* tkScale.c */, F966BAF808F27A39005CB29B /* tkScale.h */, F966BAF908F27A39005CB29B /* tkScrollbar.c */, F966BAFA08F27A39005CB29B /* tkScrollbar.h */, F966BAFB08F27A39005CB29B /* tkSelect.c */, F966BAFC08F27A39005CB29B /* tkSelect.h */, F966BAFD08F27A39005CB29B /* tkSquare.c */, | < | 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 | F966BAF708F27A39005CB29B /* tkScale.c */, F966BAF808F27A39005CB29B /* tkScale.h */, F966BAF908F27A39005CB29B /* tkScrollbar.c */, F966BAFA08F27A39005CB29B /* tkScrollbar.h */, F966BAFB08F27A39005CB29B /* tkSelect.c */, F966BAFC08F27A39005CB29B /* tkSelect.h */, F966BAFD08F27A39005CB29B /* tkSquare.c */, F966BAFF08F27A39005CB29B /* tkStubInit.c */, F966BB0008F27A39005CB29B /* tkStubLib.c */, F966BB0108F27A39005CB29B /* tkStyle.c */, F966BB0208F27A39005CB29B /* tkTest.c */, F966BB0308F27A39005CB29B /* tkText.c */, F966BB0408F27A39005CB29B /* tkText.h */, F966BB0508F27A39005CB29B /* tkTextBTree.c */, |
︙ | ︙ | |||
2460 2461 2462 2463 2464 2465 2466 | F99388380EE0114B0065FE6B /* fontchooser.tcl */, F974D57C0FBE7EFF00BF728B /* iconlist.tcl */, F974D57D0FBE7EFF00BF728B /* icons.tcl */, F966BB7308F27A3A005CB29B /* listbox.tcl */, F966BB7408F27A3A005CB29B /* menu.tcl */, F966BB7508F27A3A005CB29B /* mkpsenc.tcl */, F966BB7608F27A3A005CB29B /* msgbox.tcl */, | < < | 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 | F99388380EE0114B0065FE6B /* fontchooser.tcl */, F974D57C0FBE7EFF00BF728B /* iconlist.tcl */, F974D57D0FBE7EFF00BF728B /* icons.tcl */, F966BB7308F27A3A005CB29B /* listbox.tcl */, F966BB7408F27A3A005CB29B /* menu.tcl */, F966BB7508F27A3A005CB29B /* mkpsenc.tcl */, F966BB7608F27A3A005CB29B /* msgbox.tcl */, F966BB8708F27A3A005CB29B /* optMenu.tcl */, F966BB8808F27A3A005CB29B /* palette.tcl */, F966BB8908F27A3B005CB29B /* panedwindow.tcl */, F966BB8B08F27A3B005CB29B /* safetk.tcl */, F966BB8C08F27A3B005CB29B /* scale.tcl */, F966BB8D08F27A3B005CB29B /* scrlbar.tcl */, F966BB8E08F27A3B005CB29B /* spinbox.tcl */, F966BB8F08F27A3B005CB29B /* tclIndex */, F966BB9008F27A3B005CB29B /* tearoff.tcl */, F966BB9108F27A3B005CB29B /* text.tcl */, F966BB9208F27A3B005CB29B /* tk.tcl */, F966BB9308F27A3B005CB29B /* tkfbox.tcl */, F96888360AF787B3000797B5 /* ttk */, F966BB9508F27A3B005CB29B /* xmfbox.tcl */, ); path = library; sourceTree = "<group>"; }; F966BB1A08F27A39005CB29B /* demos */ = { isa = PBXGroup; |
︙ | ︙ | |||
2678 2679 2680 2681 2682 2683 2684 | F966BC3808F27A3C005CB29B /* main.test */, F966BC3908F27A3C005CB29B /* menu.test */, F966BC3A08F27A3C005CB29B /* menubut.test */, F966BC3B08F27A3C005CB29B /* menuDraw.test */, F966BC3C08F27A3C005CB29B /* message.test */, F966BC3D08F27A3C005CB29B /* msgbox.test */, F966BC3E08F27A3C005CB29B /* obj.test */, | < | 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 | F966BC3808F27A3C005CB29B /* main.test */, F966BC3908F27A3C005CB29B /* menu.test */, F966BC3A08F27A3C005CB29B /* menubut.test */, F966BC3B08F27A3C005CB29B /* menuDraw.test */, F966BC3C08F27A3C005CB29B /* message.test */, F966BC3D08F27A3C005CB29B /* msgbox.test */, F966BC3E08F27A3C005CB29B /* obj.test */, F966BC4008F27A3C005CB29B /* option.file1 */, F966BC4108F27A3C005CB29B /* option.file2 */, F966BC4208F27A3C005CB29B /* option.test */, F966BC4308F27A3C005CB29B /* pack.test */, F966BC4408F27A3C005CB29B /* panedwindow.test */, F966BC4508F27A3D005CB29B /* place.test */, F966BC4608F27A3D005CB29B /* raise.test */, |
︙ | ︙ | |||
2750 2751 2752 2753 2754 2755 2756 | F966BC7808F27A3D005CB29B /* tkUnix.c */, F966BC7908F27A3D005CB29B /* tkUnix3d.c */, F966BC7A08F27A3D005CB29B /* tkUnixButton.c */, F966BC7B08F27A3D005CB29B /* tkUnixColor.c */, F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */, F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */, F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */, | < | 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 | F966BC7808F27A3D005CB29B /* tkUnix.c */, F966BC7908F27A3D005CB29B /* tkUnix3d.c */, F966BC7A08F27A3D005CB29B /* tkUnixButton.c */, F966BC7B08F27A3D005CB29B /* tkUnixColor.c */, F966BC7C08F27A3D005CB29B /* tkUnixConfig.c */, F966BC7D08F27A3D005CB29B /* tkUnixCursor.c */, F966BC7E08F27A3D005CB29B /* tkUnixDefault.h */, F966BC8008F27A3D005CB29B /* tkUnixDraw.c */, F966BC8108F27A3D005CB29B /* tkUnixEmbed.c */, F966BC8208F27A3D005CB29B /* tkUnixEvent.c */, F966BC8308F27A3D005CB29B /* tkUnixFocus.c */, F966BC8408F27A3D005CB29B /* tkUnixFont.c */, F966BC8508F27A3D005CB29B /* tkUnixInit.c */, F966BC8608F27A3D005CB29B /* tkUnixInt.h */, |
︙ | ︙ | |||
2996 2997 2998 2999 3000 3001 3002 | F96D425C08F272B2004A47F5 /* libtommath */, F96D446E08F272B9004A47F5 /* win */, F96D3F3808F272A7004A47F5 /* library */, F96D434408F272B5004A47F5 /* tests */, F96D3DFC08F272A4004A47F5 /* doc */, F96D43D008F272B8004A47F5 /* tools */, F9183E690EFC81560030B814 /* pkgs */, | < | < | | 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 | F96D425C08F272B2004A47F5 /* libtommath */, F96D446E08F272B9004A47F5 /* win */, F96D3F3808F272A7004A47F5 /* library */, F96D434408F272B5004A47F5 /* tests */, F96D3DFC08F272A4004A47F5 /* doc */, F96D43D008F272B8004A47F5 /* tools */, F9183E690EFC81560030B814 /* pkgs */, F96D3DFB08F272A4004A47F5 /* changes.md */, F96D434308F272B5004A47F5 /* README */, F96D432B08F272B4004A47F5 /* license.terms */, ); name = "Tcl Sources"; sourceTree = TCL_SRCROOT; }; F96D3DF708F271BE004A47F5 /* Tk Sources */ = { isa = PBXGroup; children = ( F966BAA508F27A38005CB29B /* generic */, F966BB9708F27A3B005CB29B /* macosx */, F966BC6B08F27A3D005CB29B /* unix */, F966BD1908F27A3F005CB29B /* xlib */, F966BA0308F27A37005CB29B /* bitmaps */, F966BC9208F27A3D005CB29B /* win */, F966BB1308F27A39005CB29B /* library */, F966BC0408F27A3C005CB29B /* tests */, F966BA1008F27A37005CB29B /* doc */, F966BA0F08F27A37005CB29B /* changes.md */, F966BC0308F27A3C005CB29B /* README */, F966BB9608F27A3B005CB29B /* license.terms */, ); name = "Tk Sources"; sourceTree = TK_SRCROOT; }; F96D3DFC08F272A4004A47F5 /* doc */ = { |
︙ | ︙ | |||
4258 4259 4260 4261 4262 4263 4264 | F966BE0908F27A3F005CB29B /* tkMain.c in Sources */, F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */, F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */, F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */, F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */, F966BE1008F27A3F005CB29B /* tkObj.c in Sources */, F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */, | < | 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 | F966BE0908F27A3F005CB29B /* tkMain.c in Sources */, F966BE0A08F27A3F005CB29B /* tkMenu.c in Sources */, F966BE0C08F27A3F005CB29B /* tkMenubutton.c in Sources */, F966BE0E08F27A3F005CB29B /* tkMenuDraw.c in Sources */, F966BE0F08F27A3F005CB29B /* tkMessage.c in Sources */, F966BE1008F27A3F005CB29B /* tkObj.c in Sources */, F966BE1108F27A3F005CB29B /* tkOldConfig.c in Sources */, F966BE1208F27A3F005CB29B /* tkOption.c in Sources */, F966BE1308F27A3F005CB29B /* tkPack.c in Sources */, F966BE1408F27A3F005CB29B /* tkPanedWindow.c in Sources */, F966BE1508F27A3F005CB29B /* tkPlace.c in Sources */, F966BE1708F27A3F005CB29B /* tkPointer.c in Sources */, F966BE1908F27A3F005CB29B /* tkRectOval.c in Sources */, F966BE1A08F27A3F005CB29B /* tkScale.c in Sources */, |
︙ | ︙ | |||
4572 4573 4574 4575 4576 4577 4578 | F9FD31780CC1AD070073837D /* tkMain.c in Sources */, F9FD31790CC1AD070073837D /* tkMenu.c in Sources */, F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */, F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */, F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */, F9FD317D0CC1AD070073837D /* tkObj.c in Sources */, F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */, | < | 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 | F9FD31780CC1AD070073837D /* tkMain.c in Sources */, F9FD31790CC1AD070073837D /* tkMenu.c in Sources */, F9FD317A0CC1AD070073837D /* tkMenubutton.c in Sources */, F9FD317B0CC1AD070073837D /* tkMenuDraw.c in Sources */, F9FD317C0CC1AD070073837D /* tkMessage.c in Sources */, F9FD317D0CC1AD070073837D /* tkObj.c in Sources */, F9FD317E0CC1AD070073837D /* tkOldConfig.c in Sources */, F9FD31800CC1AD070073837D /* tkOption.c in Sources */, F9FD31810CC1AD070073837D /* tkPack.c in Sources */, F9FD31820CC1AD070073837D /* tkPanedWindow.c in Sources */, F9FD31830CC1AD070073837D /* tkPlace.c in Sources */, F9FD31850CC1AD070073837D /* tkRectOval.c in Sources */, F9FD31860CC1AD070073837D /* tkScale.c in Sources */, F9FD31870CC1AD070073837D /* tkScrollbar.c in Sources */, |
︙ | ︙ | |||
4637 4638 4639 4640 4641 4642 4643 | F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */, F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */, F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */, F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */, F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */, F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */, F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */, | < | 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 | F9FD31DA0CC1AD070073837D /* tkAppInit.c in Sources */, F9FD32020CC1ADB70073837D /* tkUnix.c in Sources */, F9FD31DB0CC1AD070073837D /* tkUnix3d.c in Sources */, F9FD320A0CC1ADB70073837D /* tkUnixButton.c in Sources */, F9FD32090CC1ADB70073837D /* tkUnixColor.c in Sources */, F9FD32040CC1ADB70073837D /* tkUnixConfig.c in Sources */, F9FD31F80CC1ADB70073837D /* tkUnixCursor.c in Sources */, F9FD32050CC1ADB70073837D /* tkUnixDraw.c in Sources */, F9FD31FD0CC1ADB70073837D /* tkUnixEmbed.c in Sources */, F9FD32080CC1ADB70073837D /* tkUnixEvent.c in Sources */, F9FD31FF0CC1ADB70073837D /* tkUnixFocus.c in Sources */, F9FD31FC0CC1ADB70073837D /* tkUnixInit.c in Sources */, F9FD31FA0CC1ADB70073837D /* tkUnixKey.c in Sources */, F9FD32030CC1ADB70073837D /* tkUnixMenu.c in Sources */, |
︙ | ︙ | |||
4745 4746 4747 4748 4749 4750 4751 | }; name = ReleaseUniversal; }; F91BCC51093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { | | | | 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 | }; name = ReleaseUniversal; }; F91BCC51093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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 = { | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | PRODUCT_NAME = "tktest-X11"; }; name = DebugNoFixAndContinue; }; F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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; }; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 | /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 = { | | | | 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 | }; 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 arm64 $(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 = { | | | | | | 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 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal gcc40"; }; F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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 arm64 $(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 = { | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal llvm-gcc"; }; F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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)", | < | | 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 | }; F9A9D1F30FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", ); CFLAGS = "-arch x86_64 -arch arm64 $(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 = { | | | | 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 | PRODUCT_NAME = tktest; }; name = "ReleaseUniversal clang"; }; F9A9D1F60FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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 = { | | | | | | 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 | PRODUCT_NAME = tktest; }; name = ReleaseUniversal10.5SDK; }; F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CFLAGS = "-arch x86_64 -arch arm64 $(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 arm64 $(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 */, | < < < < < < < < < < < < | 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 | 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/Wish-Info.plist.in.
1 2 3 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- Copyright © 2005-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. --> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> |
︙ | ︙ |
Changes to macosx/Wish.sdef.
1 2 3 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> <!-- | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd"> <!-- Copyright © 1997 Sun Microsystems, Inc. Copyright © 2009 Kevin Walzer/WordTech Communications LLC. Copyright © 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. --> <dictionary title="Wish Terminology"> <suite name="Standard Suite" code="reqd" description="Common commands for all applications."> <command name="open" code="aevtodoc" description="Open a document."> |
︙ | ︙ |
Changes to macosx/tkMacOSX.h.
1 2 3 4 5 | /* * tkMacOSX.h -- * * Declarations of Macintosh specific exported variables and procedures. * | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkMacOSX.h -- * * Declarations of Macintosh specific exported variables and procedures. * * 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. */ #ifndef _TKMAC #define _TKMAC |
︙ | ︙ |
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 24 25 26 27 28 29 30 31 32 33 34 | /* * 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. */ } BuiltInIcon; /* * This array maps a string name to the supported builtin icons * on the Macintosh. */ static BuiltInIcon builtInIcons[] = { {"document", kGenericDocumentIcon}, {"stationery", kGenericStationeryIcon}, {"edition", kGenericEditionFileIcon}, |
︙ | ︙ | |||
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 | {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, {NULL, 0} }; #define builtInIconSize 32 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 -- |
︙ | ︙ | |||
131 132 133 134 135 136 137 | Display *display, NSImage* image, CGSize size) { TkMacOSXDrawingContext dc; Pixmap pixmap; | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | Display *display, NSImage* image, CGSize size) { TkMacOSXDrawingContext dc; Pixmap pixmap; pixmap = Tk_GetPixmap(display, None, (int)size.width, (int)size.height, 0); if (TkMacOSXSetupDrawingContext(pixmap, NULL, &dc)) { if (dc.context) { CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = size.height}; CGContextConcatCTM(dc.context, t); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:GET_NSCONTEXT(dc.context, NO)]; |
︙ | ︙ | |||
170 171 172 173 174 175 176 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { | | | < | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { NSString *filetype = TkMacOSXOSTypeToUTI(PTR2UINT(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"); | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | static int OSTypeFromString(const char *s, OSType *t) { int result = TCL_ERROR; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); (void)Tcl_UtfToExternalDString(encoding, s, TCL_INDEX_NONE, &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 }; | < | | | | | 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 | 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]; |
︙ | ︙ | |||
304 305 306 307 308 309 310 | } } if (image) { size = [image size]; } } if (image) { | < < > > > > > | | < > > | 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 | } } if (image) { size = [image size]; } } if (image) { 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)); } } *width = (int)size.width; *height = (int)size.height; return pixmap; } /* *---------------------------------------------------------------------- * * TkMacOSXIconBitmapObjCmd -- |
︙ | ︙ | |||
343 344 345 346 347 348 349 | TkMacOSXIconBitmapObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_HashEntry *hPtr; | | > | | | | | | 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 | TkMacOSXIconBitmapObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_HashEntry *hPtr; int isNew, result = TCL_ERROR; Tcl_Size i = 1, len; const char *name, *value; IconBitmap ib, *iconBitmap; if (objc != 6) { Tcl_WrongNumArgs(interp, 1, objv, "name width height " "-file|-fileType|-osType|-systemType|-namedImage|-imageFile " "value"); goto end; } name = Tcl_GetStringFromObj(objv[i++], &len); if (!len) { Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap name", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "BAD", NULL); goto end; } if (Tcl_GetIntFromObj(interp, objv[i++], &ib.width) != TCL_OK) { goto end; } if (Tcl_GetIntFromObj(interp, objv[i++], &ib.height) != TCL_OK) { goto end; } if (Tcl_GetIndexFromObjStruct(interp, objv[i++], iconBitmapOptionStrings, sizeof(char *), "kind", TCL_EXACT, &ib.kind) != TCL_OK) { goto end; } value = Tcl_GetStringFromObj(objv[i++], &len); if (!len) { Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap value", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "EMPTY", NULL); goto end; } #if 0 if ((kind == ICON_TYPE || kind == ICON_SYSTEM)) { Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); (void)Tcl_UtfToExternalDString(encoding, value, TCL_INDEX_NONE, &ds); len = Tcl_DStringLength(&ds); Tcl_DStringFree(&ds); Tcl_FreeEncoding(encoding); if (len > 4) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid bitmap value", TCL_INDEX_NONE)); 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" |
︙ | ︙ | |||
72 73 74 75 76 77 78 | static void ButtonBackgroundDrawCB(const HIRect *btnbounds, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonContentDrawCB(const HIRect *bounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacButton *ptr, SInt16 depth, Boolean isColorDev); | | | | 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 | static void ButtonBackgroundDrawCB(const HIRect *btnbounds, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonContentDrawCB(const HIRect *bounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonEventProc(void *clientData, XEvent *eventPtr); static void TkMacOSXComputeButtonParams(TkButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo); static int TkMacOSXComputeButtonDrawParams(TkButton *butPtr, DrawParams * dpPtr); static void TkMacOSXDrawButton(MacButton *butPtr, GC gc, Pixmap pixmap); static void DrawButtonImageAndText(TkButton *butPtr); static void PulseDefaultButtonProc(void *clientData); /* * The class procedure table for the button widgets. */ const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ |
︙ | ︙ | |||
175 176 177 178 179 180 181 | * REDRAW_PENDING flag is cleared. * *---------------------------------------------------------------------- */ void TkpDisplayButton( | | | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | * REDRAW_PENDING flag is cleared. * *---------------------------------------------------------------------- */ void TkpDisplayButton( void *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)) { |
︙ | ︙ | |||
312 313 314 315 316 317 318 | Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, text, TCL_INDEX_NONE, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth + 2*butPtr->padX; txtHeight = butPtr->textHeight + 2*butPtr->padY; haveText = 1; } |
︙ | ︙ | |||
405 406 407 408 409 410 411 | * Pushbutton whose overall size is our content size expanded by the * standard padding. */ tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY); HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); if (height < contBounds.size.height) { | | | | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | * Pushbutton whose overall size is our content size expanded by the * standard padding. */ tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY); HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); if (height < contBounds.size.height) { height = (int)contBounds.size.height; } if (width < contBounds.size.width) { width = (int)contBounds.size.width; } height += 2*HI_PADY; width += 2*HI_PADX; } Tk_GeometryRequest(butPtr->tkwin, width, height); Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset); } |
︙ | ︙ | |||
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); |
︙ | ︙ | |||
894 895 896 897 898 899 900 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ButtonEventProc( | | | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ButtonEventProc( void *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; |
︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | * Side effects: * Sets a timer to run itself again. * *-------------------------------------------------------------- */ static void | | | | 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | * Side effects: * Sets a timer to run itself again. * *-------------------------------------------------------------- */ static void PulseDefaultButtonProc(void *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" |
︙ | ︙ | |||
33 34 35 36 37 38 39 | targetPtr = targetPtr->nextPtr) { if (targetPtr->type == XA_STRING || targetPtr->type == dispPtr->utf8Atom) { for (TkClipboardBuffer *cbPtr = targetPtr->firstBufferPtr; cbPtr; cbPtr = cbPtr->nextPtr) { NSString *s = [[TKNSString alloc] initWithTclUtfBytes:cbPtr->buffer | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | targetPtr = targetPtr->nextPtr) { if (targetPtr->type == XA_STRING || targetPtr->type == dispPtr->utf8Atom) { for (TkClipboardBuffer *cbPtr = targetPtr->firstBufferPtr; cbPtr; cbPtr = cbPtr->nextPtr) { NSString *s = [[TKNSString alloc] initWithTclUtfBytes:cbPtr->buffer length:(NSUInteger)cbPtr->length]; [string appendString:s]; [s release]; } break; } } } |
︙ | ︙ | |||
114 115 116 117 118 119 120 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ | | < | < < < < < | 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 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ void *clientData) /* Arbitrary value to pass to proc. */ { int result = TCL_ERROR; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; int haveExternalClip = ([[NSPasteboard generalPasteboard] changeCount] != changeCount); if (dispPtr && (haveExternalClip || dispPtr->clipboardActive) && selection == dispPtr->clipboardAtom && (target == XA_STRING || target == dispPtr->utf8Atom)) { NSString *string = nil; NSPasteboard *pb = [NSPasteboard generalPasteboard]; 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); |
︙ | ︙ | |||
176 177 178 179 180 181 182 | XSetSelectionOwner( Display *display, /* X Display. */ Atom selection, /* What selection to own. */ Window owner, /* Window to be the owner. */ TCL_UNUSED(Time)) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); | < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | XSetSelectionOwner( Display *display, /* X Display. */ Atom selection, /* What selection to own. */ Window owner, /* Window to be the owner. */ TCL_UNUSED(Time)) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); if (dispPtr && selection == dispPtr->clipboardAtom) { clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL; if (!dispPtr->clipboardActive) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; changeCount = [pb declareTypes:[NSArray array] owner:NSApp]; |
︙ | ︙ |
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | /* * 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 size_t numSystemColors; static size_t rgbColorIndex; static size_t controlAccentIndex; static size_t controlAlternatingRowIndex; static size_t selectedTabTextIndex; static size_t 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}; static void initColorTable() { NSAutoreleasePool *pool = [NSAutoreleasePool new]; Tcl_InitHashTable(&systemColors, TCL_STRING_KEYS); SystemColorDatum *entry, *oldEntry; Tcl_HashSearch search; Tcl_HashEntry *hPtr; int newPtr; size_t index = 0; NSColorList *systemColorList = [NSColorList colorListNamed:@"System"]; NSString *key; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; |
︙ | ︙ | |||
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; | | > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 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:@"controlAlternatingRowColor"] && ![colorName isEqualToString:@"pressedButtonTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; } } entry->selector = [colorName retain]; } |
︙ | ︙ | |||
86 87 88 89 90 91 92 | } /* * Add all of the colors in the System ColorList. */ for (key in [systemColorList allKeys]) { | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | } /* * Add all of the colors in the System ColorList. */ for (key in [systemColorList allKeys]) { NSUInteger length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; char *name; entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum)); bzero(entry, sizeof(SystemColorDatum)); name = (char *)ckalloc(length + 1); strcpy(name, key.UTF8String); name[0] = (char)toupper(UCHAR(name[0])); if (!strcmp(name, "WindowBackgroundColor")) { /* * Avoid black windows on old systems. */ continue; |
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | hPtr = Tcl_FindHashEntry(&systemColors, "Pixel"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); 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 163 164 165 166 167 168 | hPtr = Tcl_FindHashEntry(&systemColors, "Pixel"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); rgbColorIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; hPtr = Tcl_FindHashEntry(&systemColors, "ControlAlternatingRowColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAlternatingRowIndex = 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) { | | | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | MODULE_SCOPE unsigned long TkMacOSXRGBPixel( unsigned long red, unsigned long green, unsigned long blue) { MacPixel p = {0}; p.pixel.colortype = rgbColor; p.pixel.value = (unsigned int)(((red & 0xff) << 16) | ((green & 0xff) << 8) | (blue & 0xff)); return p.ulong; } /* *---------------------------------------------------------------------- * * TkMacOSXClearPixel -- |
︙ | ︙ | |||
203 204 205 206 207 208 209 | * None. *---------------------------------------------------------------------- */ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | * None. *---------------------------------------------------------------------- */ MODULE_SCOPE unsigned long TkMacOSXClearPixel( void) { MacPixel p = {0}; p.pixel.value = 0; p.pixel.colortype = clearColor; return p.ulong; } /* |
︙ | ︙ | |||
228 229 230 231 232 233 234 | * * Side effects: * None * *---------------------------------------------------------------------- */ | | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | * * Side effects: * None * *---------------------------------------------------------------------- */ static SystemColorDatum* GetEntryFromPixel( unsigned long pixel) { MacPixel p = {0}; size_t index = rgbColorIndex; p.ulong = pixel; if (p.pixel.colortype != rgbColor) { index = p.pixel.value; } if (index < numSystemColors) { return systemColorIndex[index]; |
︙ | ︙ | |||
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 | > > | > > > > > > > > > > > > > < > > > > > > > > < < | 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 | 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 == controlAlternatingRowIndex) { /* * Color which is now called alternatingContentBackgroundColor on 10.14. * Taken from NSColor.controlAlternatingRowBackgroundColors (which was * replaced by NSColor.alternatingContentBackgroundColors on 10.14). */ color = [[NSColor colorWithCatalogName:@"System" colorName:@"controlAlternatingRowColor"] colorUsingColorSpace:sRGB]; } 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; } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | static Bool SetCGColorComponents( SystemColorDatum *entry, unsigned long pixel, CGColorRef *c) { CGFloat rgba[4] = {0, 0, 0, 1}; /* * This function is called before our autorelease pool is set up, * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; | > > > > > < < < < | 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 | static Bool SetCGColorComponents( SystemColorDatum *entry, unsigned long pixel, CGColorRef *c) { CGFloat rgba[4] = {0, 0, 0, 1}; if (entry->type == HIBrush) { OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c); return err == noErr; } /* * This function is called before our autorelease pool is set up, * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; 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 { | | > > | | < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > < < < | | | < | | 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 | 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:(NSInteger)CGColorGetNumberOfComponents(cgColor)]; CGColorRelease(cgColor); } return nsColor; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
621 622 623 624 625 626 627 | * None. * *---------------------------------------------------------------------- */ void TkMacOSXSetColorInContext( | | | | < < | 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 | * 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; | < < | | | < | > > > > > > > > > > > > | | | > > | | | | | | | | 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 | { 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 = (unsigned int)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 = (unsigned short)(rgba[0] * 65535.0); color.green = (unsigned short)(rgba[1] * 65535.0); color.blue = (unsigned short)(rgba[2] * 65535.0); goto validXColor; } else if (SetCGColorComponents(entry, 0, &c)) { const size_t n = CGColorGetNumberOfComponents(c); const CGFloat *rgba = CGColorGetComponents(c); switch (n) { case 4: color.red = (unsigned short)(rgba[0] * 65535.0); color.green = (unsigned short)(rgba[1] * 65535.0); color.blue = (unsigned short)(rgba[2] * 65535.0); break; case 2: color.red = color.green = color.blue = (unsigned short)(rgba[0] * 65535.0); break; default: Tcl_Panic("CGColor with %d components", (int) n); } CGColorRelease(c); goto validXColor; } |
︙ | ︙ | |||
838 839 840 841 842 843 844 | Status XAllocColor( Display *display, /* Display. */ TCL_UNUSED(Colormap), /* Not used. */ XColor *colorPtr) /* XColor struct to modify. */ { | | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | Status XAllocColor( Display *display, /* Display. */ TCL_UNUSED(Colormap), /* Not used. */ XColor *colorPtr) /* XColor struct to modify. */ { LastKnownRequestProcessed(display)++; colorPtr->pixel = TkpGetPixel(colorPtr); return 1; } Colormap XCreateColormap( TCL_UNUSED(Display *), /* Display. */ |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.h.
︙ | ︙ | |||
67 68 69 70 71 72 73 | * In TkMacOSXColor.c a Tk hash table is constructed from the static data * below to map system color names to CGColors. */ typedef struct { const char *name; enum colorType type; | | | | | 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 | * In TkMacOSXColor.c a Tk hash table is constructed from the static data * below to map system color names to CGColors. */ typedef struct { const char *name; enum colorType type; ThemeBrush value; const char *macName; /* Fields below are filled in after or during construction of the hash table. */ size_t index; NSString *selector; } SystemColorDatum; /* * WARNING: Semantic colors which are not supported on all systems must be * 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 202 203 | {"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 }, /* This color is available since 10.3, so the fallback is unused */ {"ControlAlternatingRowColor", 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 45 46 47 48 | /* * 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 Tcl_Obj* with 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( TCL_UNUSED(Tk_Window), /* A window to use. */ TCL_UNUSED(const char *), /* The option database name. */ TCL_UNUSED(const char *)) /* The name of the option class. */ { return NULL; } /* * Local Variables: * mode: objc * c-basic-offset: 4 |
︙ | ︙ |
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" |
︙ | ︙ | |||
227 228 229 230 231 232 233 | /* * System cursor of type @filename */ macCursorPtr->type = IMAGEPATH; path = [NSString stringWithUTF8String:&name[1]]; } else { | | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | /* * System cursor of type @filename */ macCursorPtr->type = IMAGEPATH; path = [NSString stringWithUTF8String:&name[1]]; } else { Tcl_Obj *strPtr = Tcl_NewStringObj(name, TCL_INDEX_NONE); int idx; result = Tcl_GetIndexFromObjStruct(NULL, strPtr, cursorNames, sizeof(struct CursorName), NULL, TCL_EXACT, &idx); Tcl_DecrRefCount(strPtr); if (result == TCL_OK) { macCursorPtr->type = cursorNames[idx].kind; |
︙ | ︙ | |||
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; Tcl_Size 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.
1 2 3 4 5 6 | /* * tkMacOSXDefault.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /* * tkMacOSXDefault.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * * Copyright © 1991-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 _TKMACDEFAULT #define _TKMACDEFAULT |
︙ | ︙ | |||
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 387 388 389 390 | #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 NULL #define DEF_MESSAGE_PADY NULL #define DEF_MESSAGE_RELIEF "flat" #define DEF_MESSAGE_TAKE_FOCUS "0" #define DEF_MESSAGE_TEXT "" #define DEF_MESSAGE_TEXT_VARIABLE "" #define DEF_MESSAGE_WIDTH "0" /* * Defaults for panedwindows |
︙ | ︙ | |||
438 439 440 441 442 443 444 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE | | | | | | | | | 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 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE #define DEF_SCALE_BIG_INCREMENT "0.0" #define DEF_SCALE_BORDER_WIDTH "1" #define DEF_SCALE_COMMAND "" #define DEF_SCALE_CURSOR "" #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.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" #define DEF_SCALE_RESOLUTION "1.0" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" #define DEF_SCALE_TAKE_FOCUS NULL #define DEF_SCALE_TICK_INTERVAL "0.0" #define DEF_SCALE_TO "100.0" #define DEF_SCALE_VARIABLE "" #define DEF_SCALE_WIDTH "15" /* * Defaults for scrollbars: */ #define DEF_SCROLLBAR_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCROLLBAR_ACTIVE_BG_MONO BLACK #define DEF_SCROLLBAR_ACTIVE_RELIEF "raised" #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 | /* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. * | | | | | > | > > > > > > > > > > > > > > > > > > > > > > > > | 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 © 1996-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2017 Christian Gollwitzer * Copyright © 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[] = { |
︙ | ︙ | |||
204 205 206 207 208 209 210 | - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { (void)sender; (void)url; return YES; } - (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { | | > | > | | | | > | < < < < < < | | | > | < < < < | < | | | | | > | > > > > > > > > | | | | | | | < | | | | | < | < > > | < > > > | | < < < < < < < < < < < < | | | | | < | < | | 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 | - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { (void)sender; (void)url; return YES; } - (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { (void)sender; (void)url; } - (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError { (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]) { Tcl_ListObjAppendElement(callbackInfo->interp, resultObj, Tcl_NewStringObj([[url path] UTF8String], TCL_INDEX_NONE)); } } else { resultObj = Tcl_NewStringObj([[[panel URL]path] UTF8String], TCL_INDEX_NONE); } if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; Tcl_Size objc; int result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); ckfree(tmpv); } } 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]], TCL_INDEX_NONE); if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; Tcl_Size objc; int result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, TCL_EVAL_GLOBAL); ckfree(tmpv); } } else { Tcl_SetObjResult(callbackInfo->interp, resultObj); } } if ([alert window] == [NSApp modalWindow]) { [NSApp stopModalWithCode:returnCode]; } } - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = (NSUInteger)[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 = (NSUInteger)[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 -- * |
︙ | ︙ | |||
413 414 415 416 417 418 419 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ChooseColorObjCmd( | | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_ChooseColorObjCmd( void *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) { | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | 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:TCL_INDEX_NONE]; [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) { | | | | 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 | 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:TCL_INDEX_NONE]; [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:TCL_INDEX_NONE]; 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 = | | | | 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 | * Check that the typevariable exists. */ if (selectedFileTypeObj != NULL) { const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = [[TKNSString alloc] initWithTclUtfBytes:selectedFileType length:TCL_INDEX_NONE]; NSUInteger index = [filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr]; if (index != NSNotFound) { filterInfo.fileTypeIndex = index; filterInfo.preselectFilter = true; } } } } TkFreeFileFilters(&fl); return TCL_OK; } static bool filterCompatible( NSString *extension, NSUInteger filterIndex) { NSMutableArray *allowedExtensions = [filterInfo.fileTypeExtensions objectAtIndex: filterIndex]; /* * If this contains the all pattern, accept any extension. */ |
︙ | ︙ | |||
669 670 671 672 673 674 675 | * Side effects: * See user documentation. *---------------------------------------------------------------------- */ int Tk_GetOpenFileObjCmd( | | | | > < < | 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 | * Side effects: * See user documentation. *---------------------------------------------------------------------- */ int Tk_GetOpenFileObjCmd( 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; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, multiple = 0; Tcl_Size len; 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) { | | | > | < > > | < > | 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 | 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; |
︙ | ︙ | |||
775 776 777 778 779 780 781 | } if (message) { [openpanel setMessage:message]; [message release]; } | | > | | | < < < < | > > > | 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 | } if (message) { [openpanel setMessage:message]; [message release]; } [openpanel setAllowsMultipleSelection:multiple != 0]; if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 240, 22.0) pullsDown:NO]; NSView *accessoryView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; [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:(NSInteger)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) { /* |
︙ | ︙ | |||
914 915 916 917 918 919 920 | selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; } } } Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, | | | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; } } } Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], TCL_INDEX_NONE), TCL_GLOBAL_ONLY); } end: return result; } /* |
︙ | ︙ | |||
940 941 942 943 944 945 946 | * See user documentation. * *---------------------------------------------------------------------- */ int Tk_GetSaveFileObjCmd( | | | > < < | 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 | * See user documentation. * *---------------------------------------------------------------------- */ int Tk_GetSaveFileObjCmd( 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; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; int index; Tcl_Size 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 == '.')) { | | | | | > | < > > | < > | 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 | 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; |
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; | | > < > | | < < < < | 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 | [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton selectItemAtIndex:(NSInteger)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; } | | > > > | | 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 | 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) { /* * The -typevariable must be set to the selected file type, if the * dialog was not cancelled. */ NSString *selectedFilter = [filterInfo.fileTypeNames objectAtIndex:filterInfo.fileTypeIndex]; Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], TCL_INDEX_NONE), TCL_GLOBAL_ONLY); } end: return result; } |
︙ | ︙ | |||
1182 1183 1184 1185 1186 1187 1188 | * A modal dialog window is created. * *---------------------------------------------------------------------- */ int Tk_ChooseDirectoryObjCmd( | | | > < < | 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 | * A modal dialog window is created. * *---------------------------------------------------------------------- */ int Tk_ChooseDirectoryObjCmd( 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; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, mustexist = 0; Tcl_Size len; 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) { | | > | < > > | < > < < < < | > > > | 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 | 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) { | < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 | * *---------------------------------------------------------------------- */ 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; } | | | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | 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 -- |
︙ | ︙ | |||
1418 1419 1420 1421 1422 1423 1424 | * none * *---------------------------------------------------------------------- */ int Tk_MessageBoxObjCmd( | | | | 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 | * none * *---------------------------------------------------------------------- */ int Tk_MessageBoxObjCmd( 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; 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: | < | > > < | > > < | > > | 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 | * know the '-type' as well. */ indexDefaultOption = i; break; case ALERT_DETAIL: str = Tcl_GetString(objv[i + 1]); message = [[TKNSString alloc] initWithTclUtfBytes: str length:TCL_INDEX_NONE]; [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:TCL_INDEX_NONE]; [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:TCL_INDEX_NONE]; [[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) { |
︙ | ︙ | |||
1528 1529 1530 1531 1532 1533 1534 | * Need to map from "ok" etc. to 1, 2, 3, right to left. */ defaultNativeButtonIndex = alertButtonIndexAndTypeToNativeButtonIndex[typeIndex][index]; if (!defaultNativeButtonIndex) { Tcl_SetObjResult(interp, | | | < | | | | | | > > > | 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 | * Need to map from "ok" etc. to 1, 2, 3, right to left. */ defaultNativeButtonIndex = alertButtonIndexAndTypeToNativeButtonIndex[typeIndex][index]; if (!defaultNativeButtonIndex) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Illegal default option", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MSGBOX", "DEFAULT", NULL); goto end; } } [alert setIcon:[NSApp applicationIconImage]]; [alert setAlertStyle:alertStyles[iconIndex]]; i = 0; while (i < 3 && alertButtonNames[typeIndex][i]) { [alert addButtonWithTitle:(NSString*) alertButtonNames[typeIndex][i++]]; } buttons = [alert buttons]; for (NSButton *b in buttons) { NSString *ke = [b keyEquivalent]; if (([ke isEqualToString:@"\r"] || [ke isEqualToString:@"\033"]) && ![b keyEquivalentModifierMask]) { [b setKeyEquivalent:@""]; } } [[buttons objectAtIndex: [buttons count]-1] setKeyEquivalent: @"\033"]; [[buttons objectAtIndex: (NSUInteger)(defaultNativeButtonIndex-1)] 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]; } |
︙ | ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | FontchooserClosed, FontchooserSelection }; static void FontchooserEvent(int kind); static Tcl_Obj * FontchooserCget(FontchooserData *fcdPtr, int optionIndex); | | < < | < < | < < | | | | | 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 | FontchooserClosed, FontchooserSelection }; static void FontchooserEvent(int kind); static Tcl_Obj * FontchooserCget(FontchooserData *fcdPtr, int optionIndex); static Tcl_ObjCmdProc2 FontchooserConfigureCmd; static Tcl_ObjCmdProc2 FontchooserShowCmd; static Tcl_ObjCmdProc2 FontchooserHideCmd; static void FontchooserParentEventHandler(void *clientData, XEvent *eventPtr); static void DeleteFontchooserData(void *clientData, Tcl_Interp *interp); MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[]; const TkEnsemble tkFontchooserEnsemble[] = { { "configure", FontchooserConfigureCmd, NULL }, { "show", FontchooserShowCmd, NULL }, { "hide", FontchooserHideCmd, NULL }, { NULL, NULL, NULL } }; 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 { |
︙ | ︙ | |||
1694 1695 1696 1697 1698 1699 1700 | NSFontPanelUnderlineEffectModeMask | NSFontPanelStrikethroughEffectModeMask; } - (void) windowDidOrderOffScreen: (NSNotification *)notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | | | 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 | NSFontPanelUnderlineEffectModeMask | NSFontPanelStrikethroughEffectModeMask; } - (void) windowDidOrderOffScreen: (NSNotification *)notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif if ([[notification object] isEqual:[[NSFontManager sharedFontManager] fontPanel:NO]]) { FontchooserEvent(FontchooserClosed); } } @end |
︙ | ︙ | |||
1730 1731 1732 1733 1734 1735 1736 | { FontchooserData *fcdPtr; Tcl_Obj *fontObj; if (!fontchooserInterp) { return; } | | | > | | 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 | { 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); if (fontObj) { if (fcdPtr->cmdObj) { Tcl_Size objc; int result; Tcl_Obj **objv, **tmpv; result = Tcl_ListObjGetElements(fontchooserInterp, fcdPtr->cmdObj, &objc, &objv); if (result == TCL_OK) { tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); |
︙ | ︙ | |||
1789 1790 1791 1792 1793 1794 1795 | FontchooserData *fcdPtr, int optionIndex) { Tcl_Obj *resObj = NULL; switch(optionIndex) { case FontchooserParent: | | | | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 | FontchooserData *fcdPtr, int optionIndex) { Tcl_Obj *resObj = NULL; switch(optionIndex) { case FontchooserParent: if (fcdPtr->parent != NULL) { resObj = Tcl_NewStringObj( ((TkWindow *)fcdPtr->parent)->pathName, TCL_INDEX_NONE); } else { resObj = Tcl_NewStringObj(".", 1); } break; case FontchooserTitle: if (fcdPtr->titleObj) { resObj = fcdPtr->titleObj; |
︙ | ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | if (fcdPtr->cmdObj) { resObj = fcdPtr->cmdObj; } else { resObj = Tcl_NewObj(); } break; case FontchooserVisible: | | | | 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 | 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; } |
︙ | ︙ | |||
1846 1847 1848 1849 1850 1851 1852 | * Per-interp data structure may be modified * * ---------------------------------------------------------------------- */ static int FontchooserConfigureCmd( | | | | > | | | | > | 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 | * Per-interp data structure may be modified * * ---------------------------------------------------------------------- */ static int FontchooserConfigureCmd( void *clientData, /* Main window */ Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); Tcl_Size i; int r = TCL_OK; /* * With no arguments we return all the options in a dict */ if (objc == 1) { Tcl_Obj *keyObj, *valueObj; Tcl_Obj *dictObj = Tcl_NewDictObj(); for (i = 0; r == TCL_OK && fontchooserOptionStrings[i] != NULL; ++i) { keyObj = Tcl_NewStringObj(fontchooserOptionStrings[i], TCL_INDEX_NONE); valueObj = FontchooserCget(fcdPtr, (int)i); r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj); } if (r == TCL_OK) { Tcl_SetObjResult(interp, dictObj); } return r; } for (i = 1; i < objc; i += 2) { int optionIndex; Tcl_Size len; if (Tcl_GetIndexFromObjStruct(interp, objv[i], fontchooserOptionStrings, sizeof(char *), "option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } if (objc == 2) { /* |
︙ | ︙ | |||
1901 1902 1903 1904 1905 1906 1907 | return TCL_ERROR; } switch (optionIndex) { case FontchooserVisible: { const char *msg = "cannot change read-only option " "\"-visible\": use the show or hide command"; | | | | 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 | return TCL_ERROR; } switch (optionIndex) { case FontchooserVisible: { const char *msg = "cannot change read-only option " "\"-visible\": use the show or hide command"; Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE)); 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; | | | 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 | 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]; | > | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | [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]; |
︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | * Font Panel may be shown. * * ---------------------------------------------------------------------- */ static int FontchooserShowCmd( | | | | | | 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | * Font Panel may be shown. * * ---------------------------------------------------------------------- */ static int FontchooserShowCmd( void *clientData, /* Main window */ Tcl_Interp *interp, TCL_UNUSED(Tcl_Size), 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]; |
︙ | ︙ | |||
2060 2061 2062 2063 2064 2065 2066 | * ---------------------------------------------------------------------- */ static int FontchooserHideCmd( TCL_UNUSED(void *), /* Main window */ TCL_UNUSED(Tcl_Interp *), | | | 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 | * ---------------------------------------------------------------------- */ static int FontchooserHideCmd( TCL_UNUSED(void *), /* Main window */ TCL_UNUSED(Tcl_Interp *), TCL_UNUSED(Tcl_Size), TCL_UNUSED(Tcl_Obj *const *)) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; if ([fp isVisible]) { [fp orderOut:NSApp]; } |
︙ | ︙ | |||
2090 2091 2092 2093 2094 2095 2096 | * Font chooser parent info is cleared and font panel is hidden. * * ---------------------------------------------------------------------- */ static void FontchooserParentEventHandler( | | | | 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 | * Font chooser parent info is cleared and font panel is hidden. * * ---------------------------------------------------------------------- */ static void FontchooserParentEventHandler( void *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); } |
︙ | ︙ | |||
2122 2123 2124 2125 2126 2127 2128 | * per-interp configuration data is destroyed. * * ---------------------------------------------------------------------- */ static void DeleteFontchooserData( | | | | 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 | * per-interp configuration data is destroyed. * * ---------------------------------------------------------------------- */ static void DeleteFontchooserData( void *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 |
︙ | ︙ | |||
81 82 83 84 85 86 87 | initialized = TRUE; if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit", | | | | | 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 | initialized = TRUE; if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit", &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) { Tcl_ResetResult(interp); } cgAntiAliasLimit = limit; /* * Piggy-back the themed drawing var init here. */ if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel", &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame", &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } transparentColor = TkMacOSXClearPixel(); } return TCL_OK; } |
︙ | ︙ | |||
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); |
︙ | ︙ | |||
170 171 172 173 174 175 176 | Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0); NSImage *nsImage; unsigned long origBackground = gc->background; gc->background = transparentColor; XSetClipOrigin(display, gc, 0, 0); | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0); NSImage *nsImage; unsigned long origBackground = gc->background; gc->background = transparentColor; XSetClipOrigin(display, gc, 0, 0); XCopyPlane(display, bitmap, pixmap, gc, 0, 0, (unsigned)width, (unsigned)height, 0, 0, 1); gc->background = origBackground; nsImage = CreateNSImageFromPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); return [nsImage autorelease]; } |
︙ | ︙ | |||
243 244 245 246 247 248 249 | Tk_MacOSXGetCGContextForDrawable( Drawable drawable) { MacDrawable *macDraw = (MacDrawable *)drawable; if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; | < < < < < < < < < | | | 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 | Tk_MacOSXGetCGContextForDrawable( Drawable drawable) { MacDrawable *macDraw = (MacDrawable *)drawable; if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; CGColorSpaceRef colorspace = NULL; CGBitmapInfo bitmapInfo = #ifdef __LITTLE_ENDIAN__ kCGBitmapByteOrder32Host; #else kCGBitmapByteOrderDefault; #endif CGRect bounds = CGRectMake(0, 0, macDraw->size.width, macDraw->size.height); if (macDraw->flags & TK_IS_BW_PIXMAP) { bitmapInfo = (CGBitmapInfo)kCGImageAlphaOnly; } else { colorspace = CGColorSpaceCreateDeviceRGB(); bitmapInfo |= kCGImageAlphaPremultipliedFirst; } macDraw->context = CGBitmapContextCreate(NULL, (unsigned)macDraw->size.width, (unsigned)macDraw->size.height, bitsPerComponent, 0, colorspace, bitmapInfo); if (macDraw->context) { CGContextClearRect(macDraw->context, bounds); } if (colorspace) { CFRelease(colorspace); } |
︙ | ︙ | |||
414 415 416 417 418 419 420 | TkMacOSXDrawingContext dc; int i, lw = gc->line_width; if (npoints < 2) { return BadValue; } | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | TkMacOSXDrawingContext dc; int i, lw = gc->line_width; if (npoints < 2) { return BadValue; } LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { double prevx, prevy; double o = (lw % 2) ? .5 : 0; |
︙ | ︙ | |||
482 483 484 485 486 487 488 | XSegment *segments, int nsegments) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; | | | 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | XSegment *segments, int nsegments) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { double o = (lw % 2) ? .5 : 0; for (i = 0; i < nsegments; i++) { |
︙ | ︙ | |||
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. */ | | | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | 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; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { double prevx, prevy; double o = (gc->line_width % 2) ? .5 : 0; |
︙ | ︙ | |||
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); } } | > | > | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | 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; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
596 597 598 599 600 601 602 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0) { return BadDrawable; } | | | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0) { return BadDrawable; } LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; |
︙ | ︙ | |||
650 651 652 653 654 655 656 | int nRects) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i, lw = gc->line_width; | | | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | int nRects) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i, lw = gc->line_width; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; |
︙ | ︙ | |||
702 703 704 705 706 707 708 | int n_rectangles) /* Number of rectangles. */ { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i; | | | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | int n_rectangles) /* Number of rectangles. */ { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; for (i = 0, rectPtr = rectangles; i < n_rectangles; i++, rectPtr++) { |
︙ | ︙ | |||
807 808 809 810 811 812 813 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { return BadDrawable; } | | | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { return BadDrawable; } LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; |
︙ | ︙ | |||
877 878 879 880 881 882 883 | int nArcs) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc *arcPtr; int i, lw = gc->line_width; | | | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | int nArcs) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc *arcPtr; int i, lw = gc->line_width; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; |
︙ | ︙ | |||
958 959 960 961 962 963 964 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { return BadDrawable; } | | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | TkMacOSXDrawingContext dc; int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { return BadDrawable; } LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0, u = 0; |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | int nArcs) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc * arcPtr; int i, lw = gc->line_width; | | | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | int nArcs) { MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc * arcPtr; int i, lw = gc->line_width; LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) { return BadDrawable; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0, u = 0; |
︙ | ︙ | |||
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); | | | | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | > > > | > > | > | > > > | | | > > > | > | > | 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 | 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); CFRelease(dstRgn); CFRelease(srcRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; } /* * Convert the HIShape dmgRgn into a TkRegion and store it. */ TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); 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); | > > > > > > | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | 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); | | < < < < | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | /* * 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. */ | | > > > > > > > > > > | | | | | | < < < < < | > < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | 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 | * 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) { /* * Make non-antialiased CG drawing look more like X11. */ w -= (gc->line_width ? NON_AA_CG_OFFSET : 0); } CGContextSetShouldAntialias(dc.context, shouldAntialias); CGContextSetLineWidth(dc.context, w); if (gc->line_style != LineSolid) { size_t num = 0; char *p = &gc->dashes; CGFloat dashOffset = gc->dash_offset; dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0; CGFloat lengths[10]; while (p[num] != '\0' && num < 10) { lengths[num] = p[num]; |
︙ | ︙ | |||
1417 1418 1419 1420 1421 1422 1423 | CGContextSetLineJoin(dc.context, cgJoin[(unsigned) gc->join_style]); } } end: #ifdef TK_MAC_DEBUG_DRAWING | | < < < | | < | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | 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)); | > > > > > > > | > | 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 | 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; } /* *---------------------------------------------------------------------- * | | | | 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 | } 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; } /* *---------------------------------------------------------------------- * | | | 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | { 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 | | | 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | * 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" |
︙ | ︙ | |||
44 45 46 47 48 49 50 | /* First in list of all containers managed by * this process. */ /* * Prototypes for static procedures defined in this file: */ | | | | | | | | | | | | | 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 | /* First in list of all containers managed by * this process. */ /* * Prototypes for static procedures defined in this file: */ static void ContainerEventProc(void *clientData, XEvent *eventPtr); static void EmbeddedEventProc(void *clientData, XEvent *eventPtr); static void EmbedActivateProc(void *clientData, XEvent *eventPtr); static void EmbedFocusProc(void *clientData, XEvent *eventPtr); static void EmbedGeometryRequest(Container *containerPtr, int width, int height); static void EmbedSendConfigure(Container *containerPtr); static void EmbedStructureProc(void *clientData, XEvent *eventPtr); static void EmbedWindowDeleted(TkWindow *winPtr); /* *---------------------------------------------------------------------- * * Tk_MakeWindow -- * * Creates an X Window (Mac subwindow). * * Results: * The window id is returned. * * Side effects: * None. * *---------------------------------------------------------------------- */ Window Tk_MakeWindow( Tk_Window tkwin, TCL_UNUSED(Window)) { MacDrawable *macWin; TkWindow *winPtr = (TkWindow *)tkwin; /* * 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; } /* *---------------------------------------------------------------------- * | | | | | 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 | } 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. */ { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *usePtr; MacDrawable *parent, *macWin; Container *containerPtr; if (winPtr->window != None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't modify container after widget is created", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL); return TCL_ERROR; } /* * Decode the container window ID, and look for it among the list of * available containers. |
︙ | ︙ | |||
318 319 320 321 322 323 324 | return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | 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 | 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; /* |
︙ | ︙ | |||
431 432 433 434 435 436 437 438 439 440 441 442 | */ MacDrawable * TkMacOSXGetHostToplevel( TkWindow *winPtr) /* Tk's structure for a window. */ { TkWindow *contWinPtr, *topWinPtr; topWinPtr = winPtr->privatePtr->toplevel->winPtr; if (!Tk_IsEmbedded(topWinPtr)) { return winPtr->privatePtr->toplevel; } | > > > > | < < < | 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 | */ MacDrawable * TkMacOSXGetHostToplevel( TkWindow *winPtr) /* Tk's structure for a window. */ { TkWindow *contWinPtr, *topWinPtr; if (!(winPtr && winPtr->privatePtr)) { return NULL; } 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. */ return TkMacOSXGetHostToplevel(contWinPtr); } /* *---------------------------------------------------------------------- * * TkpClaimFocus -- |
︙ | ︙ | |||
515 516 517 518 519 520 521 | * None. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( | | | < | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | * None. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; } else { all = 0; } Tcl_DStringInit(&dString); |
︙ | ︙ | |||
553 554 555 556 557 558 559 | /* * Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { | | | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | /* * Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { snprintf(buffer, sizeof(buffer), "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->parent); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* |
︙ | ︙ | |||
619 620 621 622 623 624 625 | * The event may get sent to a different application. * *---------------------------------------------------------------------- */ void TkpRedirectKeyEvent( | | | < < < | | | | | | | | | | | | 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 | * The event may get sent to a different application. * *---------------------------------------------------------------------- */ void TkpRedirectKeyEvent( TCL_UNUSED(TkWindow *), /* Window to which the event was originally * reported. */ TCL_UNUSED(XEvent *)) /* X event to redirect (should be KeyPress or * KeyRelease). */ { /* 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 (!(tkwin && (((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; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
697 698 699 700 701 702 703 | * destroyed. * *---------------------------------------------------------------------- */ static void EmbeddedEventProc( | | | | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | * destroyed. * *---------------------------------------------------------------------- */ static void EmbeddedEventProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); } } /* |
︙ | ︙ | |||
732 733 734 735 736 737 738 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( | | | | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( void *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. */ |
︙ | ︙ | |||
840 841 842 843 844 845 846 | * The embedded window gets resized to match the container. * *---------------------------------------------------------------------- */ static void EmbedStructureProc( | | | | | | | 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 | * The embedded window gets resized to match the container. * *---------------------------------------------------------------------- */ static void EmbedStructureProc( void *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. */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, -1, -1, NULL, NULL); Tk_MoveResizeWindow((Tk_Window)containerPtr->embeddedPtr, 0, 0, Tk_Width((Tk_Window)containerPtr->parentPtr), Tk_Height((Tk_Window)containerPtr->parentPtr)); Tk_DeleteErrorHandler(errHandler); } } else if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(containerPtr->parentPtr); } } |
︙ | ︙ | |||
894 895 896 897 898 899 900 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedActivateProc( | | | | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedActivateProc( void *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); } |
︙ | ︙ | |||
929 930 931 932 933 934 935 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedFocusProc( | | | | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedFocusProc( void *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; |
︙ | ︙ | |||
1040 1041 1042 1043 1044 1045 1046 | * None. * *---------------------------------------------------------------------- */ static void EmbedSendConfigure( | | < | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | * None. * *---------------------------------------------------------------------- */ static void EmbedSendConfigure( TCL_UNUSED(Container *)) /* Information about the embedding. */ { } /* *---------------------------------------------------------------------- * * EmbedWindowDeleted -- * |
︙ | ︙ | |||
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 && | > > > | 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | * 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 && |
︙ | ︙ | |||
1148 1149 1150 1151 1152 1153 1154 | * Creates the platform-specific part of a busy window structure. * *---------------------------------------------------------------------- */ void TkpShowBusyWindow( | | < | < | | < < | | | | | < < < < < | 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 | * Creates the platform-specific part of a busy window structure. * *---------------------------------------------------------------------- */ void TkpShowBusyWindow( TCL_UNUSED(TkBusy)) { } void TkpHideBusyWindow( TCL_UNUSED(TkBusy)) { } void TkpMakeTransparentWindowExist( TCL_UNUSED(Tk_Window), /* Token for window. */ TCL_UNUSED(Window)) /* Parent window. */ { } void TkpCreateBusy( TCL_UNUSED(Tk_FakeWin *), TCL_UNUSED(Tk_Window), TCL_UNUSED(Window *), TCL_UNUSED(Tk_Window), TCL_UNUSED(TkBusy)) { } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
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" |
︙ | ︙ | |||
255 256 257 258 259 260 261 | /* * We had to make the entry part of the window smaller so that we wouldn't * overdraw the spin buttons with the focus highlight. So now we have to * draw the highlightbackground. */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); | | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | /* * We had to make the entry part of the window smaller so that we wouldn't * overdraw the spin buttons with the focus highlight. So now we have to * draw the highlightbackground. */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); rects[0].x = (short)(Tk_Width(tkwin) - incDecWidth - 1); rects[0].y = 0; rects[0].width = (unsigned short)(incDecWidth + 1); rects[0].height = (unsigned short)Tk_Height(tkwin); XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1); if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) { return 0; } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); TkMacOSXRestoreDrawingContext(&dc); |
︙ | ︙ |
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" |
︙ | ︙ | |||
23 24 25 26 27 28 29 | }; @implementation TKApplication(TKEvent) /* TODO: replace by +[addLocalMonitorForEventsMatchingMask ? */ - (NSEvent *) tkProcessEvent: (NSEvent *) theEvent { #ifdef TK_MAC_DEBUG_EVENTS | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | }; @implementation TKApplication(TKEvent) /* TODO: replace by +[addLocalMonitorForEventsMatchingMask ? */ - (NSEvent *) tkProcessEvent: (NSEvent *) theEvent { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), theEvent); #endif NSEvent *processedEvent = theEvent; NSEventType type = [theEvent type]; NSInteger subtype; switch ((NSInteger)type) { case NSAppKitDefined: |
︙ | ︙ | |||
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].) */ LastKnownRequestProcessed(display)++; 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 | /* 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" #define CHARS_TO_OSTYPE(string) (OSType) string[0] << 24 | \ (OSType) string[1] << 16 | \ (OSType) string[2] << 8 | \ (OSType) string[3] MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) { char string[5]; string[4] = '\0'; string[3] = ostype; string[2] = ostype >> 8; string[1] = ostype >> 16; string[0] = ostype >> 24; NSString *tag = [NSString stringWithCString:string encoding:NSMacOSRomanStringEncoding]; if (tag == nil) { return nil; } NSString *result = nil; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (@available(macOS 11.0, *)) { return [UTType typeWithTag:tag tagClass:@"com.apple.ostype" conformingToType:nil].identifier; } #endif #if MAC_OS_X_VERSION_MIN_REQUIRED < 110000 result = (NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, (CFStringRef)tag, NULL); #endif return result; } /* * 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 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 */ if (filetype == nil) { /* * Bug 9be830f61b: match the behavior of * [NSWorkspace.sharedWorkspace iconForFileType:nil] */ filetype = @"public.data"; } 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: */ |
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 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 | /* * 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" #include "tkMacOSXConstants.h" #define defaultOrientation kCTFontDefaultOrientation #define verticalOrientation kCTFontVerticalOrientation #define fixedPitch kCTFontUserFixedPitchFontType /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_FONTS #endif */ /* * TclNumUtfChars() is the same as Tcl_NumUtfChars(), but counting * in UTF-16 in stead of UTF-32. For Tcl 8.7 it's a little bit * tricky to get this function, because we are compiling with * TCL_UTF_MAX=4. Same for TclUtfAtIndex() */ #if TCL_MAJOR_VERSION < 9 # undef TclNumUtfChars # undef TclUtfAtIndex # ifdef USE_TCL_STUBS # define TclNumUtfChars \ (tclStubsPtr->tcl_NumUtfChars) /* 312 */ # define TclUtfAtIndex \ (tclStubsPtr->tcl_UtfAtIndex) /* 325 */ # else # define TclNumUtfChars Tcl_NumUtfChars # define TclUtfAtIndex Tcl_UtfAtIndex # endif #endif /* * The following structure represents our Macintosh-specific implementation * of a font object. */ typedef struct { TkFont font; /* Stuff used by generic font package. Must be |
︙ | ︙ | |||
43 44 45 46 47 48 49 | */ #define SYSTEMFONT_NAME "system" #define APPLFONT_NAME "application" #define MENUITEMFONT_NAME "menu" struct SystemFontMapEntry { | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | */ #define SYSTEMFONT_NAME "system" #define APPLFONT_NAME "application" #define MENUITEMFONT_NAME "menu" struct SystemFontMapEntry { ThemeFontID id; const char *systemName; const char *tkName; const char *tkName1; }; #define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ } static const struct SystemFontMapEntry systemFontMap[] = { |
︙ | ︙ | |||
70 71 72 73 74 75 76 | ThemeFont(PushButton, NULL, NULL), ThemeFont(UtilityWindowTitle, NULL, NULL), ThemeFont(AlertHeader, NULL, NULL), ThemeFont(Toolbar, NULL, NULL), ThemeFont(MiniSystem, NULL, NULL), { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ThemeFont(PushButton, NULL, NULL), ThemeFont(UtilityWindowTitle, NULL, NULL), ThemeFont(AlertHeader, NULL, NULL), ThemeFont(Toolbar, NULL, NULL), ThemeFont(MiniSystem, NULL, NULL), { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, { (ThemeFontID)-1, NULL, NULL, NULL } }; #undef ThemeFont static int antialiasedTextEnabled = -1; static NSCharacterSet *whitespaceCharacterSet = nil; static NSCharacterSet *lineendingCharacterSet = nil; |
︙ | ︙ | |||
108 109 110 111 112 113 114 | - (instancetype)initWithTclUtfBytes:(const void *)bytes length:(NSUInteger)len { self = [self init]; if (self) { Tcl_DStringInit(&_ds); | | | | 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 | - (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]; } | < < < < | | < < > | 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 | } - (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. */ char *p; NSUInteger index; Tcl_DStringInit(&_ds); Tcl_DStringSetLength(&_ds, 3 * [_string length]); p = Tcl_DStringValue(&_ds); for (index = 0; index < [_string length]; index++) { p += Tcl_UniCharToUtf([_string characterAtIndex: index]|TCL_COMBINE, p); } Tcl_DStringSetLength(&_ds, (Tcl_Size)(p - Tcl_DStringValue(&_ds))); } return _ds; } @synthesize UTF8String = _UTF8String; @synthesize DString = _ds; @end #define GetNSFontTraitsFromTkFontAttributes(faPtr) \ ((faPtr)->weight == TK_FW_BOLD ? NSBoldFontMask : NSUnboldFontMask) | \ ((faPtr)->slant == TK_FS_ITALIC ? NSItalicFontMask : NSUnitalicFontMask) /* |
︙ | ︙ | |||
204 205 206 207 208 209 210 | GetTkFontAttributesForNSFont( NSFont *nsFont, TkFontAttributes *faPtr) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; faPtr->family = Tk_GetUid([[nsFont familyName] UTF8String]); | > | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | GetTkFontAttributesForNSFont( NSFont *nsFont, TkFontAttributes *faPtr) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; faPtr->family = Tk_GetUid([[nsFont familyName] UTF8String]); #define FACTOR 0.75 faPtr->size = [nsFont pointSize] * FACTOR; faPtr->weight = (traits & NSBoldFontMask ? TK_FW_BOLD : TK_FW_NORMAL); faPtr->slant = (traits & NSItalicFontMask ? TK_FS_ITALIC : TK_FS_ROMAN); } /* *--------------------------------------------------------------------------- |
︙ | ︙ | |||
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) { | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | { 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:TCL_INDEX_NONE] autorelease]; } else { family = [defaultFont familyName]; } if (size == 0.0) { size = [defaultFont pointSize] * FACTOR; } nsFont = [fm fontWithFamily:family traits:traits weight:weight size:size]; /* * A second bug in NSFontManager that Apple created for the Catalina OS * causes requests as above to sometimes return fonts with additional * traits that were not requested, even though fonts without those unwanted |
︙ | ︙ | |||
348 349 350 351 352 353 354 | renderingMode = (antialiasedTextEnabled == 0/* || dontAA*/) ? NSFontIntegerAdvancementsRenderingMode : NSFontAntialiasedRenderingMode; } nsFont = [nsFont screenFontWithRenderingMode:renderingMode]; GetTkFontAttributesForNSFont(nsFont, faPtr); fmPtr = &fontPtr->font.fm; | | | | | | | 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 | renderingMode = (antialiasedTextEnabled == 0/* || dontAA*/) ? NSFontIntegerAdvancementsRenderingMode : NSFontAntialiasedRenderingMode; } nsFont = [nsFont screenFontWithRenderingMode:renderingMode]; GetTkFontAttributesForNSFont(nsFont, faPtr); fmPtr = &fontPtr->font.fm; fmPtr->ascent = (int)floor([nsFont ascender] + [nsFont leading] + 0.5); fmPtr->descent = (int)floor(-[nsFont descender] + 0.5); fmPtr->maxWidth = (int)[nsFont maximumAdvancement].width; fmPtr->fixed = [nsFont isFixedPitch]; /* Does not work for all fonts */ /* * The ascent, descent and fixed fields are not correct for all fonts, as * a workaround deduce that info from the metrics of some typical glyphs, * along with screenfont kerning (space advance difference to printer font) */ bounds = [nsFont boundingRectForFont]; if (CTFontGetGlyphsForCharacters((CTFontRef) nsFont, ch, glyphs, nCh)) { fmPtr->fixed = [nsFont advancementForGlyph:glyphs[0]].width == [nsFont advancementForGlyph:glyphs[1]].width; bounds = NSRectFromCGRect(CTFontGetBoundingRectsForGlyphs((CTFontRef) nsFont, defaultOrientation, ch, boundingRects, nCh)); kern = [nsFont advancementForGlyph:glyphs[2]].width - [fontPtr->nsFont advancementForGlyph:glyphs[2]].width; } descent = (int)floor(-bounds.origin.y + 0.5); ascent = (int)floor(bounds.size.height + bounds.origin.y + 0.5); if (ascent > fmPtr->ascent) { fmPtr->ascent = ascent; } if (descent > fmPtr->descent) { fmPtr->descent = descent; } nsAttributes = [NSDictionary dictionaryWithObjectsAndKeys: |
︙ | ︙ | |||
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: /* *------------------------------------------------------------------------- * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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; Tcl_Size len, idx; if ((unsigned)(objc - 3) > 1) { Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?"); return TCL_ERROR; } stringArg = Tcl_GetStringFromObj(objv[1], &len); if (stringArg == NULL) { return TCL_ERROR; } Tcl_Size ulen = Tcl_GetCharLength(objv[1]); S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:len]; len = [S length]; if (TkGetIntForIndex(objv[2], ulen - 1, 0, &idx) != 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 (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-16 index */ Tcl_Size newIdx = 0; for (Tcl_Size i = 0; i < idx; i++) { newIdx += 1 + (((newIdx < len-1) && ([S characterAtIndex:newIdx]&0xFC00) == 0xD800) && (([S characterAtIndex:newIdx+1]&0xFC00) == 0xDC00)); } idx = newIdx; } if (idx >= 0) { if (idx >= len) { idx = len; } else { NSRange range = [S rangeOfComposedCharacterSequenceAtIndex:idx]; idx = range.location; } if (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-32 index */ Tcl_Size newIdx = 1; for (Tcl_Size i = 1; i < idx; i++) { if ((([S characterAtIndex:i-1]&0xFC00) != 0xD800) || (([S characterAtIndex:i]&0xFC00) != 0xDC00)) newIdx++; } idx = newIdx; } Tcl_SetObjResult(interp, TkNewIndexObj(idx)); } 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; Tcl_Size idx, len; if ((unsigned)(objc - 3) > 1) { Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?"); return TCL_ERROR; } stringArg = Tcl_GetStringFromObj(objv[1], &len); if (stringArg == NULL) { return TCL_ERROR; } Tcl_Size ulen = Tcl_GetCharLength(objv[1]); S = [[TKNSString alloc] initWithTclUtfBytes:stringArg length:len]; len = [S length]; if (TkGetIntForIndex(objv[2], ulen - 1, 0, &idx) != 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 (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-16 index */ Tcl_Size newIdx = 0; for (Tcl_Size i = 0; i < idx; i++) { newIdx += 1 + (((newIdx < len-1) && ([S characterAtIndex:newIdx]&0xFC00) == 0xD800) && (([S characterAtIndex:newIdx+1]&0xFC00) == 0xDC00)); } idx = newIdx; } if (idx + 1 <= len) { if (idx < 0) { idx = 0; } else { NSRange range = [S rangeOfComposedCharacterSequenceAtIndex:idx]; idx = range.location + range.length; if (idx > 0 && len != ulen) { /* The string contains codepoints > \uFFFF. Determine UTF-32 index */ Tcl_Size newIdx = 1; for (Tcl_Size i = 1; i < idx; i++) { if ((([S characterAtIndex:i-1]&0xFC00) != 0xD800) || (([S characterAtIndex:i]&0xFC00) != 0xDC00)) newIdx++; } idx = newIdx; } } Tcl_SetObjResult(interp, TkNewIndexObj(idx)); } 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 -- * | > > | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | 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 -- * |
︙ | ︙ | |||
613 614 615 616 617 618 619 | * released. If NULL, a new TkFont structure is * allocated. */ Tk_Window tkwin, /* For display where font will be used. */ const TkFontAttributes *faPtr) /* Set of attributes to match. */ { MacFont *fontPtr; | | | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | * released. If NULL, a new TkFont structure is * allocated. */ Tk_Window tkwin, /* For display where font will be used. */ const TkFontAttributes *faPtr) /* Set of attributes to match. */ { MacFont *fontPtr; CGFloat points = floor(TkFontGetPoints(tkwin, faPtr->size / FACTOR) + 0.5); NSFontTraitMask traits = GetNSFontTraitsFromTkFontAttributes(faPtr); NSInteger weight = (faPtr->weight == TK_FW_BOLD ? 9 : 5); NSFont *nsFont; nsFont = FindNSFont(faPtr->family, traits, weight, points, 0); if (!nsFont) { const char *const *aliases = TkFontGetAliasList(faPtr->family); |
︙ | ︙ | |||
635 636 637 638 639 640 641 | } if (!nsFont) { Tcl_Panic("Could not determine NSFont from TkFontAttributes"); } if (tkFontPtr == NULL) { fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); } else { | | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | } if (!nsFont) { Tcl_Panic("Could not determine NSFont from TkFontAttributes"); } if (tkFontPtr == NULL) { fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); } else { fontPtr = (MacFont *)tkFontPtr; TkpDeleteFont(tkFontPtr); } CFRetain(nsFont); /* Always needed to allow unconditional CFRelease below */ InitFont(nsFont, faPtr, fontPtr); return (TkFont *) fontPtr; } |
︙ | ︙ | |||
702 703 704 705 706 707 708 | TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; for (NSString *family in list) { Tcl_ListObjAppendElement(NULL, resultPtr, | | | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; for (NSString *family in list) { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj([family UTF8String], TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultPtr); } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
742 743 744 745 746 747 748 | objectForKey:NSFontCascadeListAttribute]; for (NSFontDescriptor *subFontDesc in list) { NSString *family = [subFontDesc objectForKey:NSFontFamilyAttribute]; if (family) { Tcl_ListObjAppendElement(NULL, resultPtr, | | | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | objectForKey:NSFontCascadeListAttribute]; for (NSFontDescriptor *subFontDesc in list) { NSString *family = [subFontDesc objectForKey:NSFontFamilyAttribute]; if (family) { Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj([family UTF8String], TCL_INDEX_NONE)); } } } Tcl_SetObjResult(interp, resultPtr); } /* |
︙ | ︙ | |||
770 771 772 773 774 775 776 | *---------------------------------------------------------------------- */ void TkpGetFontAttrsForChar( TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | *---------------------------------------------------------------------- */ void TkpGetFontAttrsForChar( TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ { MacFont *fontPtr = (MacFont *) tkfont; NSFont *nsFont = fontPtr->nsFont; *faPtr = fontPtr->font.fa; if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) { UTF16Char ch = (UTF16Char) c; |
︙ | ︙ | |||
822 823 824 825 826 827 828 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ Tcl_Size numBytes, /* Maximum number of bytes to consider from * source string. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length; don't consider any * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: |
︙ | ︙ | |||
872 873 874 875 876 877 878 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | | | | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ Tcl_Size numBytes, /* Maximum number of bytes to consider from * source string in all. */ Tcl_Size rangeStart, /* Index of first byte to measure. */ Tcl_Size rangeLength, /* Length of range to measure in bytes. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length; don't consider any * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char |
︙ | ︙ | |||
929 930 931 932 933 934 935 | fit = rangeLength; goto done; } attributedString = [[NSAttributedString alloc] initWithString:string attributes:fontPtr->nsAttributes]; typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | fit = rangeLength; goto done; } attributedString = [[NSAttributedString alloc] initWithString:string attributes:fontPtr->nsAttributes]; typesetter = CTTypesetterCreateWithAttributedString( (CFAttributedStringRef)attributedString); start = TclNumUtfChars(source, rangeStart); len = TclNumUtfChars(source + rangeStart, rangeLength); if (start > 0) { range.length = start; line = CTTypesetterCreateLine(typesetter, range); offset = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } if (maxLength < 0) { index = len; range.length = len; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } else { double maxWidth = maxLength + offset; NSCharacterSet *cs; /* * Get a line breakpoint in the source string. */ index = start; if (flags & TK_WHOLE_WORDS) { index = CTTypesetterSuggestLineBreak(typesetter, start, maxWidth); if (index <= start && (flags & TK_AT_LEAST_ONE)) { flags &= ~TK_WHOLE_WORDS; } } if (index <= start && !(flags & TK_WHOLE_WORDS)) { index = CTTypesetterSuggestClusterBreak(typesetter, start, maxWidth); } /* * Trim right whitespace/lineending characters. */ cs = (index <= len && (flags & TK_WHOLE_WORDS)) ? whitespaceCharacterSet : lineendingCharacterSet; while (index > start && [cs characterIsMember:[string characterAtIndex:(index - 1)]]) { index--; } /* * If there is no line breakpoint in the source string between its * start and the index position that fits in maxWidth, then * CTTypesetterSuggestLineBreak() returns that very last index. * However if the TK_WHOLE_WORDS flag is set, we want to break at a * word boundary. In this situation, unless TK_AT_LEAST_ONE is set, we * must report that zero chars actually fit (in other words the * smallest word of the source string is still larger than maxWidth). */ if ((index >= start) && (index < len) && (flags & TK_WHOLE_WORDS) && !(flags & TK_AT_LEAST_ONE) && ![cs characterIsMember:[string characterAtIndex:index]]) { index = start; } if (index <= start && (flags & TK_AT_LEAST_ONE)) { index = start + 1; } /* * Now measure the string width in pixels. */ if (index > 0) { range.length = index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } else { width = 0; } if (width < maxWidth && (flags & TK_PARTIAL_OK) && index < len) { range.length = ++index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } /* * The call to CTTypesetterSuggestClusterBreak above will always return * at least one character regardless of whether it exceeded it or not. * Clean that up now. */ while (width > maxWidth && !(flags & TK_PARTIAL_OK) && index > start+(flags & TK_AT_LEAST_ONE)) { range.length = --index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } } CFRelease(typesetter); [attributedString release]; [string release]; length = ceil(width - offset); fit = (TclUtfAtIndex(source, index) - source) - rangeStart; done: #ifdef TK_MAC_DEBUG_FONTS TkMacOSXDbgMsg("measure: source=\"%s\" range=\"%.*s\" maxLength=%d " "flags='%s%s%s%s' -> width=%d bytesFit=%d\n", source, rangeLength, source+rangeStart, maxLength, flags & TK_PARTIAL_OK ? "partialOk " : "", flags & TK_WHOLE_WORDS ? "wholeWords " : "", |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ int x, int y) /* Coordinates at which to place origin of the * string when drawing. */ { TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes, 0, numBytes, x, y, 0.0); } |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) /* What angle to put text at, in degrees. */ { TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes, 0, numBytes, x, y, angle); } |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | < | | | | | | | | > | | > > | | | | | | < | 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 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size 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. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size rangeLength, /* Length of range to draw in bytes. */ double x, double y, /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ double angle) /* What angle to put text at, in degrees. */ { const MacFont *fontPtr = (const MacFont *) tkfont; NSString *string; NSMutableDictionary *attributes; 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); } CGContextConcatCTM(context, t); start = TclNumUtfChars(source, rangeStart); length = TclNumUtfChars(source, rangeStart + rangeLength) - start; line = CTTypesetterCreateLine(typesetter, CFRangeMake(start, length)); if (start > 0) { /* * We are only drawing part of the string. To compute the x coordinate * of the part we are drawing we subtract its typographical length from * the typographical length of the full string. This accounts for the * kerning after the initial part of the string. */ full = CTTypesetterCreateLine(typesetter, CFRangeMake(0, start + length)); width = CTLineGetTypographicBounds(full, NULL, NULL, NULL); CFRelease(full); 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: |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont( Tk_Font tkfont) { return tkfont ? ((MacFont *)tkfont)->nsAttributes : nil; } | < < < < < < < < < < < < < < < < < < < < < < < < < | 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont( Tk_Font tkfont) { return tkfont ? ((MacFont *)tkfont)->nsAttributes : nil; } /* *---------------------------------------------------------------------- * * TkMacOSXFontDescriptionForNSFontAndNSFontAttributes -- * * Get text description of a font specified by NSFont and attributes. |
︙ | ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; id underline = [nsAttributes objectForKey: NSUnderlineStyleAttributeName]; id strikethrough = [nsAttributes objectForKey: NSStrikethroughStyleAttributeName]; | | | | 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; id underline = [nsAttributes objectForKey: NSUnderlineStyleAttributeName]; id strikethrough = [nsAttributes objectForKey: NSStrikethroughStyleAttributeName]; objv[i++] = Tcl_NewStringObj(familyName, TCL_INDEX_NONE); objv[i++] = Tcl_NewWideIntObj((Tcl_WideInt)floor([nsFont pointSize] * FACTOR + 0.5)); #define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && ([underline intValue] & (NSUnderlineStyleSingle | NSUnderlineStyleThick | NSUnderlineStyleDouble))) { objv[i++] = S(underline); |
︙ | ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | if (!initialized) { initialized = TRUE; if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::antialiasedtext", | | | 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | if (!initialized) { initialized = TRUE; if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::antialiasedtext", &antialiasedTextEnabled, TCL_LINK_INT) != TCL_OK) { Tcl_ResetResult(interp); } } antialiasedTextEnabled = enable; return TCL_OK; } |
︙ | ︙ |
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> |
︙ | ︙ | |||
44 45 46 47 48 49 50 | /* * Static functions used only in this file. */ static int MissedAnyParameters(const AppleEvent *theEvent); static int ReallyKillMe(Tcl_Event *eventPtr, int flags); | | > > | 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 | /* * Static functions used only in this file. */ static int MissedAnyParameters(const AppleEvent *theEvent); static int ReallyKillMe(Tcl_Event *eventPtr, int flags); static void ProcessAppleEvent(void *clientData); /* * Names of the procedures which can be used to process AppleEvents. */ 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]; |
︙ | ︙ | |||
109 110 111 112 113 114 115 | { (void)event; (void)replyEvent; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication", | | | | | 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 | { (void)event; (void)replyEvent; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } } } - (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { (void)event; (void)replyEvent; [NSApp activateIgnoringOtherApps: YES]; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ReopenApplication", NULL, 0)) { int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ReopenApplication", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK){ Tcl_BackgroundException(_eventInterp, code); } } } - (void) handleShowPreferencesEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { (void)event; (void)replyEvent; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowPreferences", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } } } - (void) handleOpenDocumentsEvent: (NSAppleEventDescriptor *)event |
︙ | ︙ | |||
205 206 207 208 209 210 211 | * Construct a Tcl expression which calls the ::tk::mac::OpenDocument * procedure, passing the paths contained in the AppleEvent as arguments. */ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *openCommand = &AEInfo->command; Tcl_DStringInit(openCommand); | | | > < < | | | < | | 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 | * Construct a Tcl expression which calls the ::tk::mac::OpenDocument * procedure, passing the paths contained in the AppleEvent as arguments. */ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *openCommand = &AEInfo->command; Tcl_DStringInit(openCommand); Tcl_DStringAppend(openCommand, openDocumentProc, TCL_INDEX_NONE); utf8 = Tcl_GetEncoding(NULL, "utf-8"); for (index = 1; index <= count; index++) { if (noErr != AEGetNthPtr(fileSpecDesc, index, typeFileURL, &keyword, &type, (Ptr) URLString, URL_MAX_LENGTH, &actual)) { continue; } if (type != typeFileURL) { continue; } URLString[actual] = '\0'; fileURL = [NSURL URLWithString:[NSString stringWithUTF8String:(char*)URLString]]; if (fileURL == nil) { continue; } (void)Tcl_ExternalToUtfDString(utf8, [[fileURL path] UTF8String], TCL_INDEX_NONE, &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((void *)AEInfo); } else { Tcl_CreateTimerHandler(500, ProcessAppleEvent, (void *)AEInfo); } } - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *printFile = [file UTF8String]; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *printCommand = &AEInfo->command; (void)replyEvent; Tcl_DStringInit(printCommand); Tcl_DStringAppend(printCommand, printDocProc, TCL_INDEX_NONE); Tcl_DStringAppendElement(printCommand, printFile); AEInfo->interp = _eventInterp; AEInfo->procedure = printDocProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((void *)AEInfo); } - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { OSStatus err; const AEDesc *theDesc = nil; |
︙ | ︙ | |||
285 286 287 288 289 290 291 | if (theDesc == nil) { return; } err = AEGetParamPtr(theDesc, keyDirectObject, typeWildCard, &initialType, NULL, 0, NULL); if (err != noErr) { | | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | if (theDesc == nil) { return; } err = AEGetParamPtr(theDesc, keyDirectObject, typeWildCard, &initialType, NULL, 0, NULL); if (err != noErr) { snprintf(errString, sizeof(errString), "AEDoScriptHandler: GetParamDesc error %d", (int)err); AEPutParamPtr((AppleEvent*)[replyEvent aeDesc], keyErrorString, typeChar, errString, strlen(errString)); return; } if (MissedAnyParameters((AppleEvent*)theDesc)) { snprintf(errString, sizeof(errString), "AEDoScriptHandler: extra parameters"); AEPutParamPtr((AppleEvent*)[replyEvent aeDesc], keyErrorString, typeChar,errString, strlen(errString)); return; } if (initialType == typeFileURL || initialType == typeAlias) { |
︙ | ︙ | |||
315 316 317 318 319 320 321 | if (actual > 0) { URLBuffer[actual] = '\0'; NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; NSURL *fileURL = [NSURL URLWithString:urlString]; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptFileCommand = &AEInfo->command; Tcl_DStringInit(scriptFileCommand); | | < | | < | > | > > > > > > > > > > > > > | > | 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 | if (actual > 0) { URLBuffer[actual] = '\0'; NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; NSURL *fileURL = [NSURL URLWithString:urlString]; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptFileCommand = &AEInfo->command; Tcl_DStringInit(scriptFileCommand); Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE); Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]); AEInfo->interp = _eventInterp; AEInfo->procedure = scriptFileProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((void *)AEInfo); } } } else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, NULL, 0, &actual)) { /* * The descriptor cannot be coerced to a file URL but can be coerced to * text. Construct a Tcl expression which passes the text as a string * argument to ::tk::mac::DoScriptText. */ if (actual > 0) { char *data = (char *)ckalloc(actual + 1); if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, data, actual, NULL)) { data[actual] = '\0'; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptTextCommand = &AEInfo->command; Tcl_DStringInit(scriptTextCommand); Tcl_DStringAppend(scriptTextCommand, scriptTextProc, TCL_INDEX_NONE); Tcl_DStringAppendElement(scriptTextCommand, data); AEInfo->interp = _eventInterp; 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); } } } } } - (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *cURL=[url UTF8String]; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *launchCommand = &AEInfo->command; (void)replyEvent; Tcl_DStringInit(launchCommand); Tcl_DStringAppend(launchCommand, launchURLProc, TCL_INDEX_NONE); Tcl_DStringAppendElement(launchCommand, cURL); AEInfo->interp = _eventInterp; AEInfo->procedure = launchURLProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((void *)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, TCL_INDEX_NONE); AEInfo->interp = _eventInterp; AEInfo->procedure = getSdefProc; AEInfo->replyEvent = nil; AEInfo->retryCount = 0; ProcessAppleEvent((void *)AEInfo); } @end #pragma mark - /* |
︙ | ︙ | |||
409 410 411 412 413 414 415 | * The replyEvent may be modified to contain the result of evaluating * a Tcl expression. * *---------------------------------------------------------------------- */ static void ProcessAppleEvent( | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | * The replyEvent may be modified to contain the result of evaluating * a Tcl expression. * *---------------------------------------------------------------------- */ static void ProcessAppleEvent( void *clientData) { int code; AppleEventInfo *AEInfo = (AppleEventInfo*) clientData; if (!AEInfo->interp) { return; } |
︙ | ︙ | |||
439 440 441 442 443 444 445 | } return; } code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command), Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL); if (AEInfo->replyEvent && code >= 0) { | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | } return; } code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command), Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL); if (AEInfo->replyEvent && code >= 0) { Tcl_Size reslen; const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(AEInfo->interp), &reslen); if (code == TCL_OK) { AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], keyDirectObject, typeChar, result, reslen); } else { AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], |
︙ | ︙ | |||
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 -- |
︙ | ︙ | |||
597 598 599 600 601 602 603 | Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL; if (!quit) { Tcl_Exit(0); } | | | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL; if (!quit) { Tcl_Exit(0); } int code = Tcl_EvalEx(interp, "::tk::mac::Quit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { /* * Should be never reached... */ Tcl_BackgroundException(interp, code); |
︙ | ︙ |
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 | /* * tkMacOSXImage.c -- * * The code in this file provides an interface for XImages, and * implements the nsimage image type. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 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 "tkMacOSXImage.h" #include "tkColor.h" #include "xbytes.h" /* 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 */ | | | | > < > > | | | | | | | | | | < > > | < > > | < > < < < | > > > | < | | 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 | * *---------------------------------------------------------------------- */ static void ReleaseData( void *info, TCL_UNUSED(const void *), /* data */ TCL_UNUSED(size_t)) /* size */ { ckfree(info); } static CGImageRef TkMacOSXCreateCGImageWithXImage( XImage *image, uint32_t bitmapInfo) { CGImageRef img = NULL; size_t bitsPerComponent, bitsPerPixel; size_t len = image->bytes_per_line * image->height; const CGFloat *decode = NULL; CGDataProviderRef provider = NULL; char *data = NULL; CGDataProviderReleaseDataCallback releaseData = ReleaseData; if (image->bits_per_pixel == 1) { /* * BW image */ /* 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; 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 */ | > | < < < | | | < > | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | 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 -- * | | > > > | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } /* *---------------------------------------------------------------------- * * 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 { | < < < | < | < < < | | | | 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 | 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, | | | | | | 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 | * *---------------------------------------------------------------------- */ 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; LastKnownRequestProcessed(display)++; ximage = (XImage *)ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; ximage->depth = depth; ximage->xoffset = offset; ximage->format = format; ximage->data = data; ximage->obdata = NULL; if (format == ZPixmap) { ximage->bits_per_pixel = 32; ximage->bitmap_unit = 32; } else { ximage->bits_per_pixel = 1; ximage->bitmap_unit = 8; } if (bitmap_pad) { ximage->bitmap_pad = bitmap_pad; } else { /* * Use 16 byte alignment for best Quartz performance. */ ximage->bitmap_pad = 128; } if (bytes_per_line) { ximage->bytes_per_line = bytes_per_line; } else { |
︙ | ︙ | |||
388 389 390 391 392 393 394 | return ximage; } /* *---------------------------------------------------------------------- * | | > | | > > > > > > > | > > > > < > > > > | | > | > > > > | | < > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | | > > | | | | | > | > | < | < | > | < > | | | < > | > > | 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 | 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 | kCGBitmapByteOrder32Big) #define IGNORE_ALPHA (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little) 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; if (width <= 0 || height <= 0) { return Success; /* Is OK. Nothing to see here, literally. */ } LastKnownRequestProcessed(display)++; 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; | < < < < < < < < > > > > > > > > > > > > > > > > > > > > > | > > | > > | | | < | < < < | < < < < | | < > | > > > | > | > | < < | < > | < | > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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; } /* *---------------------------------------------------------------------- * * CreatePDFFromDrawableRect * * Extract PDF data from a MacOSX drawable. * * Results: * Returns a CFDataRef that can be written to a file. * * NOTE: The x,y coordinates should be relative to a coordinate system * with origin at the bottom left as used by NSView, not top left * as used by XImage and CGImage. * * Side effects: * None * *---------------------------------------------------------------------- */ CFDataRef CreatePDFFromDrawableRect( Drawable drawable, int x, int y, unsigned int width, unsigned int height) { MacDrawable *mac_drawable = (MacDrawable *)drawable; NSView *view = TkMacOSXGetNSViewForDrawable(mac_drawable); if (view == nil) { TkMacOSXDbgMsg("Invalid source drawable"); return NULL; } NSRect bounds, viewSrcRect; /* * Get the child window area in NSView coordinates * (origin at bottom left). */ bounds = [view bounds]; viewSrcRect = NSMakeRect(mac_drawable->xOff + x, bounds.size.height - height - (mac_drawable->yOff + y), width, height); NSData *viewData = [view dataWithPDFInsideRect:viewSrcRect]; CFDataRef result = (CFDataRef)viewData; return result; } /* *---------------------------------------------------------------------- * * CreateCGImageFromPixmap -- * * Create a CGImage from an X Pixmap. |
︙ | ︙ | |||
610 611 612 613 614 615 616 | * constructed. * * Side effects: * None. * *---------------------------------------------------------------------- */ | < < < | | | < | 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 | * 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]; | < < | | | | | | > | > > > > > | < | | | | < < | > > | | | | < < < < > > | 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 | } else { TkMacOSXDbgMsg("XGetImage: Failed to construct CGImage"); return NULL; } bitmap_fmt = [bitmapRep bitmapFormat]; size = [bitmapRep bytesPerPlane]; bytes_per_row = [bitmapRep bytesPerRow]; 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; } bitmap = (char *)ckalloc(size); 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; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
733 734 735 736 737 738 739 | int dest_y) { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *)src; CGImageRef img = NULL; CGRect bounds, srcRect, dstRect; | | | 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | int dest_y) { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *)src; CGImageRef img = NULL; CGRect bounds, srcRect, dstRect; LastKnownRequestProcessed(display)++; if (!width || !height) { return BadDrawable; } if (!TkMacOSXSetupDrawingContext(dst, gc, &dc)) { TkMacOSXDbgMsg("Failed to setup drawing context."); return BadDrawable; |
︙ | ︙ | |||
807 808 809 810 811 812 813 | int dest_y, unsigned long plane) /* Which plane to copy. */ { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *)src; MacDrawable *dstDraw = (MacDrawable *)dst; CGRect bounds, srcRect, dstRect; | | | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | int dest_y, unsigned long plane) /* Which plane to copy. */ { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *)src; MacDrawable *dstDraw = (MacDrawable *)dst; CGRect bounds, srcRect, dstRect; LastKnownRequestProcessed(display)++; if (!width || !height) { /* TkMacOSXDbgMsg("Drawing of empty area requested"); */ return BadDrawable; } if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } |
︙ | ︙ | |||
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: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * 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*/ 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. */ bool pressed; /* Image is for use in a pressed button.*/ bool templ; /* Image is for use as a template.*/ 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, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); static void *TkMacOSXNSImageGet(Tk_Window tkwin, void *clientData); static void TkMacOSXNSImageDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); static void TkMacOSXNSImageFree(void *clientData, Display *display); static void TkMacOSXNSImageDelete(void *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, offsetof(TkMacOSXNSImageModel, source), 0, NULL, 0}, {TK_OPTION_STRING, "-as", NULL, NULL, DEF_AS, -1, offsetof(TkMacOSXNSImageModel, as), 0, NULL, 0}, {TK_OPTION_INT, "-width", NULL, NULL, DEF_WIDTH, -1, offsetof(TkMacOSXNSImageModel, width), 0, NULL, 0}, {TK_OPTION_INT, "-height", NULL, NULL, DEF_HEIGHT, -1, offsetof(TkMacOSXNSImageModel, height), 0, NULL, 0}, {TK_OPTION_INT, "-radius", NULL, NULL, DEF_RADIUS, -1, offsetof(TkMacOSXNSImageModel, radius), 0, NULL, 0}, {TK_OPTION_INT, "-ring", NULL, NULL, DEF_RING, -1, offsetof(TkMacOSXNSImageModel, ring), 0, NULL, 0}, {TK_OPTION_DOUBLE, "-alpha", NULL, NULL, DEF_ALPHA, -1, offsetof(TkMacOSXNSImageModel, alpha), 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-pressed", NULL, NULL, DEF_PRESSED, -1, offsetof(TkMacOSXNSImageModel, pressed), TK_OPTION_VAR(bool), NULL, 0}, {TK_OPTION_BOOLEAN, "-template", NULL, NULL, DEF_TEMPLATE, -1, offsetof(TkMacOSXNSImageModel, templ), TK_OPTION_VAR(bool), 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. */ Tcl_Size 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", TCL_INDEX_NONE); Tcl_IncrRefCount(asOption); } modelPtr->width = 0; modelPtr->height = 0; if (Tk_SetOptions(interp, 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.", TCL_INDEX_NONE)); 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.", TCL_INDEX_NONE)); 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->templ) { 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.", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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( void *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. */ Tcl_Size 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. */ void **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 void * TkMacOSXNSImageGet( TCL_UNUSED(Tk_Window), /* tkwin */ void *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( void *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( void *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( void *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: */ |
Added macosx/tkMacOSXImage.h.
> > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /* * tkMacOSXImage.h -- * * * The code in this file provides an interface for XImages, and * implements the nsimage image type. * * Copyright © 1995-1997 Sun Microsystems, Inc. * Copyright © 2001-2009 Apple Inc. * Copyright © 2005-2009 Daniel A. Steffen <[email protected]> * Copyright © 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. */ /* * Function prototypes */ MODULE_SCOPE CFDataRef CreatePDFFromDrawableRect( Drawable drawable, int x, int y, unsigned int width, unsigned int height); |
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 | /* * 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 Tcl_ObjCmdProc TkMacOSXGetAppPathObjCmd; static Tcl_ObjCmdProc TkMacOSVersionObjCmd; #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 (winPtr) { Tcl_Preserve(winPtr); } if (_tkPointerWindow) { Tcl_Release(_tkPointerWindow); } _tkPointerWindow = winPtr; return; } @synthesize tkEventTarget = _tkEventTarget; - (void) setTkEventTarget: (TkWindow *)winPtr { if (winPtr) { Tcl_Preserve(winPtr); } if (_tkEventTarget) { Tcl_Release(_tkEventTarget); } _tkEventTarget = winPtr; return; } @synthesize tkDragTarget = _tkDragTarget; - (void) setTkDragTarget: (TkWindow *)winPtr { if (winPtr) { Tcl_Preserve(winPtr); } if (_tkDragTarget) { Tcl_Release(_tkDragTarget); } _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 |
︙ | ︙ | |||
68 69 70 71 72 73 74 | - (void) _unlockAutoreleasePool { [self setPoolLock:[self poolLock] - 1]; } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) _postedNotification: (NSNotification *) notification { | | > > > > > > > > > > < < < < < > | | > > > > | < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | - (void) _unlockAutoreleasePool { [self setPoolLock:[self poolLock] - 1]; } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) _postedNotification: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); } #endif - (void) _setupApplicationNotifications { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; #define observe(n, s) \ [nc addObserver:self selector:@selector(s) name:(n) object:nil] observe(NSApplicationDidBecomeActiveNotification, applicationActivate:); observe(NSApplicationWillResignActiveNotification, applicationDeactivate:); observe(NSApplicationDidUnhideNotification, applicationShowHide:); observe(NSApplicationDidHideNotification, applicationShowHide:); observe(NSApplicationDidChangeScreenParametersNotification, displayChanged:); observe(NSTextInputContextKeyboardSelectionDidChangeNotification, keyboardChanged:); #undef observe } /* * Fix for 10b38a7a7c. */ - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app { return YES; } -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { (void)aNotification; /* * Initialize notifications. */ #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 | [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]; | > | | > > > > > > > > > > > > > > > > > > | 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 | [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 = (int)systemVersion.majorVersion; minorVersion = (int)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 = (int)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]; } } } } | > | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | 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]; } } } } |
︙ | ︙ | |||
322 323 324 325 326 327 328 | * Tcl_Exit does not call Tcl_Finalize if there is an exit proc installed. */ Tcl_Finalize(); if (doCleanup == YES) { [(TKApplication *)NSApp superTerminate:nil]; /* Should not return. */ } | | | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | * Tcl_Exit does not call Tcl_Finalize if there is an exit proc installed. */ Tcl_Finalize(); if (doCleanup == YES) { [(TKApplication *)NSApp superTerminate:nil]; /* Should not return. */ } exit((int)PTR2INT(clientdata)); /* Convince the compiler that we don't return. */ } #endif /* * This signal handler is installed for the SIGINT, SIGHUP and SIGTERM signals * so that normal finalization occurs when a Tk app is killed by one of these * signals (e.g when ^C is pressed while running Wish in the shell). It calls |
︙ | ︙ | |||
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 | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | 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 | | | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | * 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); } /* | | | | > | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | 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); } | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * 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()), TCL_INDEX_NONE)); CFRelease(mainBundleURL); CFRelease(appPath); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
596 597 598 599 600 601 602 | name = "tk"; } else { p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } | | | | > > | | | > | | < < < | < < < | < < < < | < < < < | 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 | name = "tk"; } else { p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } Tcl_DStringAppend(namePtr, name, TCL_INDEX_NONE); } /* *---------------------------------------------------------------------- * * 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 *), 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 -- |
︙ | ︙ | |||
672 673 674 675 676 677 678 | TkpDisplayWarning( const char *msg, /* Message to be displayed. */ const char *title) /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { | | | | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | TkpDisplayWarning( const char *msg, /* Message to be displayed. */ const char *title) /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { Tcl_WriteChars(errChannel, title, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, ": ", 2); Tcl_WriteChars(errChannel, msg, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, "\n", 1); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
715 716 717 718 719 720 721 | if (appMainURL != NULL) { CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; if (CFURLGetFileSystemRepresentation(appMainURL, true, (unsigned char *) startupScript, PATH_MAX)) { | | | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | if (appMainURL != NULL) { CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; if (CFURLGetFileSystemRepresentation(appMainURL, true, (unsigned char *) startupScript, PATH_MAX)) { Tcl_SetStartupScript(Tcl_NewStringObj(startupScript, TCL_INDEX_NONE), NULL); scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL, appMainURL); if (scriptFldrURL != NULL) { CFURLGetFileSystemRepresentation(scriptFldrURL, true, (unsigned char *) scriptPath, PATH_MAX); CFRelease(scriptFldrURL); } |
︙ | ︙ |
Changes to macosx/tkMacOSXInt.h.
1 2 3 4 5 | /* * tkMacOSXInt.h -- * * Declarations of Macintosh specific shared variables and procedures. * | | | | > > | 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 | /* * tkMacOSXInt.h -- * * Declarations of Macintosh specific shared variables and procedures. * * 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. */ #ifndef _TKMACINT #define _TKMACINT #ifndef _TKINT #include "tkInt.h" #endif /* * 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 Bool TkTestLogDisplay(Drawable drawable); /* * Include the stubbed internal platform-specific API. */ #include "tkIntPlatDecls.h" |
︙ | ︙ |
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" |
︙ | ︙ | |||
43 44 45 46 47 48 49 | #pragma mark TKApplication(TKKeyEvent) @implementation TKApplication(TKKeyEvent) - (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent { #ifdef TK_MAC_DEBUG_EVENTS | | | > > > > > > > > > > > > | > > > | | > | | | > > > > > | > | | | 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 | #pragma mark TKApplication(TKKeyEvent) @implementation TKApplication(TKKeyEvent) - (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_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, sel_getName(_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]) { |
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 | */ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange replacementRange: (NSRange)repRange { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; (void)selRange; str = ([aString isKindOfClass: [NSAttributedString class]]) ? [aString string] : aString; | > > > | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | */ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange replacementRange: (NSRange)repRange { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); if (!winPtr) { return; } Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; (void)selRange; str = ([aString isKindOfClass: [NSAttributedString class]]) ? [aString string] : aString; |
︙ | ︙ | |||
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; | | > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | * 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)) { | | > > | | | > | 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 | { 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 { MacDrawable *topMacWin = TkMacOSXGetHostToplevel(winPtr); if (topMacWin) { TkWindow *topPtr = topMacWin->winPtr; local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x); local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y); } } } else if (winPtr->wmInfoPtr != NULL) { local.x -= winPtr->wmInfoPtr->xInParent; local.y -= winPtr->wmInfoPtr->yInParent; } tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); local.x = win_x; |
︙ | ︙ | |||
684 685 686 687 688 689 690 | *---------------------------------------------------------------------- */ int XGrabKeyboard( Display* display, Window grab_window, | | | | | < < < < | > > > | > | 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 | *---------------------------------------------------------------------- */ int XGrabKeyboard( Display* display, Window grab_window, TCL_UNUSED(Bool), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(Time)) { keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window); TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture(); 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; |
︙ | ︙ | |||
730 731 732 733 734 735 736 | * Sets the keyboard focus back to the value before the grab. * *---------------------------------------------------------------------- */ int XUngrabKeyboard( | | | < < < | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | * Sets the keyboard focus back to the value before the grab. * *---------------------------------------------------------------------- */ int XUngrabKeyboard( TCL_UNUSED(Display *), TCL_UNUSED(Time)) { if (modalSession) { [NSApp endModalSession:modalSession]; modalSession = nil; } if (keyboardGrabNSWindow) { [keyboardGrabNSWindow release]; keyboardGrabNSWindow = nil; |
︙ | ︙ |
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 154 155 156 157 158 159 160 161 162 163 | /* * 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 { (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif keyboardChanged = YES; UpdateKeymaps(); } @end #pragma mark - |
︙ | ︙ | |||
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); } } |
︙ | ︙ | |||
497 498 499 500 501 502 503 | { MacKeycode macKC; char utfChars[8]; int length = 0; macKC.uint = eventPtr->xkey.keycode; if (IS_PRINTABLE(macKC.v.keychar)) { | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | { MacKeycode macKC; char utfChars[8]; int length = 0; macKC.uint = eventPtr->xkey.keycode; if (IS_PRINTABLE(macKC.v.keychar)) { length = Tcl_UniCharToUtf(macKC.v.keychar, utfChars); } utfChars[length] = 0; Tcl_DStringInit(dsPtr); return Tcl_DStringAppend(dsPtr, utfChars, length); } |
︙ | ︙ | |||
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}, |
︙ | ︙ | |||
81 82 83 84 85 86 87 | {100, XK_F8, NSF8FunctionKey}, {101, XK_F9, NSF9FunctionKey}, {103, XK_F11, NSF11FunctionKey}, {105, XK_F13, NSF13FunctionKey}, {106, XK_F16, NSF16FunctionKey}, {107, XK_F14, NSF14FunctionKey}, {109, XK_F10, NSF10FunctionKey}, | | | | | 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 | {100, XK_F8, NSF8FunctionKey}, {101, XK_F9, NSF9FunctionKey}, {103, XK_F11, NSF11FunctionKey}, {105, XK_F13, NSF13FunctionKey}, {106, XK_F16, NSF16FunctionKey}, {107, XK_F14, NSF14FunctionKey}, {109, XK_F10, NSF10FunctionKey}, {110, XK_Menu, UNKNOWN_KEYCHAR}, {111, XK_F12, NSF12FunctionKey}, {113, XK_F15, NSF15FunctionKey}, {114, XK_Help, NSHelpFunctionKey}, {115, XK_Home, NSHomeFunctionKey}, /* Fn Left */ {116, XK_Prior, NSPageUpFunctionKey}, /* Fn Up */ {117, XK_Delete, NSDeleteFunctionKey}, /* Fn Delete */ {118, XK_F4, NSF4FunctionKey}, {119, XK_End, NSEndFunctionKey}, /* Fn Right */ {120, XK_F2, NSF2FunctionKey}, {121, XK_Next, NSPageDownFunctionKey}, /* Fn Down */ {122, XK_F1, NSF1FunctionKey}, {123, XK_Left, NSLeftArrowFunctionKey}, {124, XK_Right, NSRightArrowFunctionKey}, {125, XK_Down, NSDownArrowFunctionKey}, {126, XK_Up, NSUpArrowFunctionKey}, {0, 0, 0} }; |
︙ | ︙ | |||
137 138 139 140 141 142 143 | */ typedef struct KeysymInfo { KeySym keysym; KeyCode keycode; } KeysymInfo; | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | */ typedef struct KeysymInfo { KeySym keysym; KeyCode keycode; } KeysymInfo; static const KeysymInfo keysymTable[] = { {0x0020, 0x0020}, /* space */ {0x0021, 0x0021}, /* exclam */ {0x0022, 0x0022}, /* quotedbl */ {0x0023, 0x0023}, /* numbersign */ {0x0024, 0x0024}, /* dollar */ {0x0025, 0x0025}, /* percent */ {0x0026, 0x0026}, /* ampersand */ |
︙ | ︙ |
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 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 | } [pool drain]; } @end TKBackgroundLoop *backgroundLoop = nil; #pragma mark TKMenu /* * This interface is not declared in tkMacOSXPrivate.h because it requires * tkMenu.h. */ @interface TKMenu(TKMenuPrivate) - (id) initWithTkMenu: (TkMenu *) tkMenu; - (TkMenu *) tkMenu; - (Tcl_Size) tkIndexOfItem: (NSMenuItem *) menuItem; - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index; @end @implementation TKMenu - (void) setSpecial: (NSUInteger) special { 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:TCL_INDEX_NONE]; 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 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | copy->_tkItemCount = _tkItemCount; copy->_tkSpecial = _tkSpecial; return copy; } - (TkMenu *) tkMenu { return (TkMenu *)_tkMenu; } - (Tcl_Size) tkIndexOfItem: (NSMenuItem *) menuItem { NSInteger index = [self indexOfItem:menuItem]; if (index < 0 || (NSUInteger) index < _tkOffset) { return TCL_INDEX_NONE; } return ((Tcl_Size)index - (Tcl_Size)_tkOffset); } - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index { [super insertItem:newItem atIndex:index + (NSInteger)_tkOffset]; _tkItemCount++; } - (void) insertItem: (NSMenuItem *) newItem atIndex: (NSInteger) index { if (_tkMenu && index >= 0) { if ((NSUInteger) index <= _tkOffset) { |
︙ | ︙ | |||
297 298 299 300 301 302 303 | - (BOOL)worksWhenModal { return YES; } - (void) tkMenuItemInvoke: (id) sender { | > > | > > > | > > > | > | < < < < < < < < < < | 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 | - (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) { | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | } - (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); | | | | > > > > | > | | 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 | 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); } } @end #pragma mark TKApplication(TKMenu) @implementation TKApplication(TKMenu) - (void) menuBeginTracking: (NSNotification *) notification { (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #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, sel_getName(_cmd), notification); #endif if (backgroundLoop) { [backgroundLoop cancel]; [backgroundLoop release]; backgroundLoop = nil; } if (!inPostMenu) { |
︙ | ︙ | |||
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; | < < < < | < | < > | | | > | > > > > > | | > > > > > > > > > > > > | | > | | < > > | | | | > | < > > | > | > > > | | | | | > > < < | < | < < < < < < < < | < | 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 | 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] autorelease]; 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]; [attributedTitle release]; [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 (Tcl_Size 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]; |
︙ | ︙ | |||
832 833 834 835 836 837 838 | TkpDestroyMenuEntry( TkMenuEntry *mePtr) { NSMenuItem *menuItem; TKMenu *menu; NSInteger index; | | < > > | | | | > > | 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 | TkpDestroyMenuEntry( TkMenuEntry *mePtr) { NSMenuItem *menuItem; TKMenu *menu; NSInteger index; if (mePtr->platformEntryData) { menuItem = (NSMenuItem *) mePtr->platformEntryData; if (mePtr->menuPtr->platformData) { menu = (TKMenu *) mePtr->menuPtr->platformData; index = [menu indexOfItem:menuItem]; if (index > -1) { [menu removeItemAtIndex:index]; } } [menuItem setTag:(NSInteger) NULL]; [menuItem release]; mePtr->platformEntryData = NULL; } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
871 872 873 874 875 876 877 | int TkpPostMenu( TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ | | | 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | int TkpPostMenu( TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ Tcl_Size index) { int result; Tk_Window realWin = menuPtr->tkwin; TkWindow *realWinPtr; NSView *realWinView; while (1) { |
︙ | ︙ | |||
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); | | | | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | 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]; | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | if (menuPtr->tkwin == NULL) { return TCL_OK; } [menu popUpMenuPositioningItem:item atLocation:[win tkConvertPointFromScreen:location] inView:view]; inPostMenu = false; return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpPostTearoffMenu -- |
︙ | ︙ | |||
965 966 967 968 969 970 971 | *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ | | < < < < < < < | > > > > > > > > > > > > | 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 | *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, Tcl_Size 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, TCL_INDEX_NONE); 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 || 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; } } /* *---------------------------------------------------------------------- * | | | | 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 | 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; |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | if (cascadeEntryPtr->menuPtr->menuType == MENUBAR && cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin) { TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr; int i = 0; Tcl_DString ds; Tcl_DStringInit(&ds); | | | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | if (cascadeEntryPtr->menuPtr->menuType == MENUBAR && cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin) { TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr; int i = 0; Tcl_DString ds; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), TCL_INDEX_NONE); while (specialMenus[i].name) { Tcl_DStringAppend(&ds, specialMenus[i].name, specialMenus[i].len); if (strcmp(Tcl_DStringValue(&ds), Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) { cascadeEntryPtr->entryFlags |= specialMenus[i].flag; } else { |
︙ | ︙ | |||
1227 1228 1229 1230 1231 1232 1233 | size_t len; int i; *maskPtr = 0; while (1) { i = 0; while (allModifiers[i].name) { | | | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | size_t len; int i; *maskPtr = 0; while (1) { i = 0; while (allModifiers[i].name) { size_t l = allModifiers[i].len; if (!strncasecmp(accel, allModifiers[i].name, l) && (accel[l] == '-' || accel[l] == '+')) { *maskPtr |= allModifiers[i].mask; accel += l+1; break; } |
︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | } i++; } } if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { | | | | 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 | } i++; } } if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { return [[[[TKNSString alloc] initWithTclUtfBytes:accel length:TCL_INDEX_NONE] 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; | | | | | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | 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, maxWidth, windowHeight, accelWidth; Tcl_Size i; int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth; TkMenuEntry *mePtr; int haveAccel = 0; /* * Do nothing if this menu is a clone. */ |
︙ | ︙ | |||
1370 1371 1372 1373 1374 1375 1376 | * give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); menuModifierCharWidth = ModifierCharWidth(menuFont); | | | < < | 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 | * give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); menuModifierCharWidth = ModifierCharWidth(menuFont); for (i = 0; i < menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->type == CASCADE_ENTRY || mePtr->accelLength > 0) { haveAccel = 1; break; } } for (i = 0; i < 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 { /* |
︙ | ︙ | |||
1526 1527 1528 1529 1530 1531 1532 | GenerateMenuSelectEvent( TKMenu *menu, NSMenuItem *menuItem) { TkMenu *menuPtr = [menu tkMenu]; if (menuPtr) { | | | | | 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | GenerateMenuSelectEvent( TKMenu *menu, NSMenuItem *menuItem) { TkMenu *menuPtr = [menu tkMenu]; if (menuPtr) { Tcl_Size index = [menu tkIndexOfItem:menuItem]; if (index < 0 || index >= menuPtr->numEntries || (menuPtr->entries[index])->state == ENTRY_DISABLED) { TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); } else { TkActivateMenuEntry(menuPtr, index); MenuSelectEvent(menuPtr); return true; } } return false; |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | *---------------------------------------------------------------------- */ void MenuSelectEvent( TkMenu *menuPtr) /* the menu we have selected. */ { | | | | | | | | | | | | | | | | | | 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 | *---------------------------------------------------------------------- */ 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 -- |
︙ | ︙ | |||
1604 1605 1606 1607 1608 1609 1610 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { | | | | | 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { Tcl_Size i; TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); for (i = 0; i < menuPtr->numEntries; i++) { TkMenuEntry *mePtr = menuPtr->entries[i]; if (mePtr->type == CASCADE_ENTRY && (mePtr->childMenuRefPtr != NULL) && (mePtr->childMenuRefPtr->menuPtr != NULL)) { RecursivelyClearActiveMenu(mePtr->childMenuRefPtr->menuPtr); } |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | * *---------------------------------------------------------------------- */ void TkpMenuInit(void) { | < < | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 | * *---------------------------------------------------------------------- */ 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 | | > > > > | | 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 | /* *---------------------------------------------------------------------- * * 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" |
︙ | ︙ | |||
45 46 47 48 49 50 51 | DrawParams drawParams; } MacMenuButton; /* * Forward declarations for static functions defined later in this file: */ | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | DrawParams drawParams; } MacMenuButton; /* * Forward declarations for static functions defined later in this file: */ static void MenuButtonEventProc(void *clientData, XEvent *eventPtr); static void MenuButtonBackgroundDrawCB(MacMenuButton *ptr, SInt16 depth, Boolean isColorDev); static void MenuButtonContentDrawCB(ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacMenuButton *ptr, SInt16 depth, Boolean isColorDev); static void MenuButtonEventProc(void *clientData, XEvent *eventPtr); static void TkMacOSXComputeMenuButtonParams(TkMenuButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo); static void TkMacOSXComputeMenuButtonDrawParams( TkMenuButton *butPtr, DrawParams *dpPtr); static void TkMacOSXDrawMenuButton(MacMenuButton *butPtr, GC gc, |
︙ | ︙ | |||
159 160 161 162 163 164 165 | * Commands are output to X to display the menubutton in its current mode. * *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( | | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | * Commands are output to X to display the menubutton in its current mode. * *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( void *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; /* |
︙ | ︙ | |||
266 267 268 269 270 271 272 | haveImage = 1; } if (butPtr->text && strlen(butPtr->text) > 0) { haveText = 1; Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | haveImage = 1; } if (butPtr->text && strlen(butPtr->text) > 0) { haveText = 1; Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth; txtHeight = butPtr->textHeight; avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); Tk_GetFontMetrics(butPtr->tkfont, &fm); } |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
682 683 684 685 686 687 688 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MenuButtonEventProc( | | | | | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MenuButtonEventProc( void *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 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 | - (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", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } Tcl_ResetResult(_eventInterp); } } - (void) showHelp: (id) sender { if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "::tk::mac::ShowHelp", NULL, 0)) { [super showHelp:sender]; } else { int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowHelp", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } Tcl_ResetResult(_eventInterp); } } - (void) tkSource: (id) sender { (void)sender; if (_eventInterp) { if (Tcl_EvalEx(_eventInterp, "tk_getOpenFile -filetypes {" "{{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}", TCL_INDEX_NONE, TCL_EVAL_GLOBAL) == TCL_OK) { Tcl_Obj *path = Tcl_GetObjResult(_eventInterp); Tcl_Size len; Tcl_GetStringFromObj(path, &len); if (len) { Tcl_IncrRefCount(path); int code = Tcl_FSEvalFileEx(_eventInterp, path, NULL); |
︙ | ︙ | |||
329 330 331 332 333 334 335 | static Tcl_Obj * GetWidgetDemoPath( Tcl_Interp *interp) { Tcl_Obj *result = NULL; if (Tcl_EvalEx(interp, "::tk::pkgconfig get demodir,runtime", | | > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | static Tcl_Obj * GetWidgetDemoPath( Tcl_Interp *interp) { Tcl_Obj *result = NULL; if (Tcl_EvalEx(interp, "::tk::pkgconfig get demodir,runtime", TCL_INDEX_NONE, TCL_EVAL_GLOBAL) == TCL_OK) { Tcl_Obj *libpath, *demo[1] = { Tcl_NewStringObj("widget", 6) }; libpath = Tcl_GetObjResult(interp); Tcl_IncrRefCount(libpath); Tcl_IncrRefCount(demo[0]); result = Tcl_FSJoinToPath(libpath, 1, demo); Tcl_DecrRefCount(demo[0]); Tcl_DecrRefCount(libpath); } Tcl_ResetResult(interp); return result; } /* |
︙ | ︙ | |||
387 388 389 390 391 392 393 | *---------------------------------------------------------------------- */ static void GenerateEditEvent( const char *name) { | | | | | | | | | | | | | | | | | 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 | *---------------------------------------------------------------------- */ 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 | /* * 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" |
︙ | ︙ | |||
25 26 27 28 29 30 31 | Point local; } MouseEventData; static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ static int GenerateButtonEvent(MouseEventData *medPtr); | < < | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > > > > | > > | | | | > > | | > | | > | | < > > | < | > | < | > > | > > > > > > > > > > > > > > > > | < | > > | > > | | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | | | | < < < < < < | < < > > | < > > < < < < < < < < < > | < < < | < < < < | < | | < < < < < < < < | < | < | > > | | | | > > | | | > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < > < | | > > > > > > > > | > > > > | > > > > > > > > | | | > | < | 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 | Point local; } MouseEventData; 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, sel_getName(_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]] && ![eventWindow isMemberOfClass:[TKPanel 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(location, [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(location, bounds)) { return theEvent; } if (NSPointInRect(location, 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; MacDrawable *topMacWin; if (dragPtr) { dragWindow = (TKWindow *)TkMacOSXGetNSWindowForDrawable( dragPtr->window); } if (!dragWindow) { [NSApp setTkDragTarget: nil]; target = NULL; return theEvent; } topMacWin = TkMacOSXGetHostToplevel(dragPtr); if (topMacWin) { winPtr = topMacWin->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 { MacDrawable *topMacWin = TkMacOSXGetHostToplevel(winPtr); if (topMacWin) { TkWindow* topPtr = topMacWin->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) { | > > > > > > > > | > | < < > > | < > > > > > > > | | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > | > > > | > | < < < < < < > > > > > > > > > > | > > > > > | | > | | | | | | | > | | | | > > > > > > > > > > > > > > > > > > > > > | 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 | } 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 { static unsigned long scrollCounter = 0; int delta; CGFloat Delta; Bool deltaIsPrecise = [theEvent hasPreciseScrollingDeltas]; XEvent xEvent = {0}; 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); if (deltaIsPrecise) { int deltaX = [theEvent scrollingDeltaX]; int deltaY = [theEvent scrollingDeltaY]; delta = (deltaX << 16) | (deltaY & 0xffff); if (delta != 0) { xEvent.type = TouchpadScroll; xEvent.xbutton.state = state; xEvent.xkey.keycode = delta; xEvent.xany.serial = scrollCounter++; Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } else { /* * A low precision scroll is 120 or -120 wheel units per click. * Each click generates one event. */ Delta = [theEvent scrollingDeltaY]; if (Delta != 0.0) { xEvent.type = MouseWheelEvent; xEvent.xbutton.state = state; xEvent.xkey.keycode = Delta > 0.0 ? 120 : -120; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } Delta = [theEvent scrollingDeltaX]; if (Delta != 0.0) { xEvent.type = MouseWheelEvent; xEvent.xbutton.state = state | ShiftMask; xEvent.xkey.keycode = Delta > 0 ? 120 : -120; 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) { | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | * *---------------------------------------------------------------------- */ unsigned int TkMacOSXButtonKeyState(void) { return [NSApp tkButtonState]; } /* *---------------------------------------------------------------------- * * XQueryPointer -- * |
︙ | ︙ | |||
456 457 458 459 460 461 462 | * None. * *---------------------------------------------------------------------- */ Bool XQueryPointer( | | | | < < < | 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 | * 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); } | < | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | 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 -- * | > > > > > > | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | 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 | /* * 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" #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(void *clientData); static void TkMacOSXEventsSetupProc(void *clientData, int flags); static void TkMacOSXEventsCheckProc(void *clientData, int flags); #ifdef TK_MAC_DEBUG_EVENTS static const char *Tk_EventName[39] = { "", "", "KeyPress", /*2*/ "KeyRelease", /*3*/ |
︙ | ︙ | |||
73 74 75 76 77 78 79 | "ActivateNotify", /*36*/ "DeactivateNotify", /*37*/ "MouseWheelEvent" /*38*/ }; static Tk_RestrictAction InspectQueueRestrictProc( | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | "ActivateNotify", /*36*/ "DeactivateNotify", /*37*/ "MouseWheelEvent" /*38*/ }; static Tk_RestrictAction InspectQueueRestrictProc( void *arg, XEvent *eventPtr) { XVirtualEvent* ve = (XVirtualEvent*) eventPtr; const char *name; long serial = ve->serial; long time = eventPtr->xkey.time; |
︙ | ︙ | |||
97 98 99 100 101 102 103 | /* * Debugging tool which prints the current Tcl queue. */ void DebugPrintQueue(void) { | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | /* * Debugging tool which prints the current Tcl queue. */ void DebugPrintQueue(void) { void *oldArg; Tk_RestrictProc *oldProc; oldProc = Tk_RestrictEvents(InspectQueueRestrictProc, NULL, &oldArg); fprintf(stderr, "Current queue:\n"); while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT)) {}; Tk_RestrictEvents(oldProc, oldArg, &oldArg); } |
︙ | ︙ | |||
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); | | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | 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); } } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
290 291 292 293 294 295 296 | * None. * *---------------------------------------------------------------------- */ static void TkMacOSXNotifyExitHandler( | | < | | > | | > | | 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 | * None. * *---------------------------------------------------------------------- */ static void TkMacOSXNotifyExitHandler( TCL_UNUSED(void *)) /* Not used. */ { TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); tsdPtr->initialized = 0; } /* *---------------------------------------------------------------------- * * TkMacOSXDrawAllViews -- * * 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( void *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( | | | < | | 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 | */ #define TICK 200 static Tcl_TimerToken ticker = NULL; static void Heartbeat( TCL_UNUSED(void *)) { if (ticker) { ticker = Tcl_CreateTimerHandler(TICK, Heartbeat, NULL); } } static const Tcl_Time zeroBlockTime = { 0, 0 }; static void TkMacOSXEventsSetupProc( TCL_UNUSED(void *), int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; /* * runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { [NSApp _resetAutoreleasePool]; /* * 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( | | < | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | * 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]; /* * runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { NSEvent *currentEvent = nil; |
︙ | ︙ | |||
537 538 539 540 541 542 543 | /* * Generate Xevents. */ NSEvent *processedEvent = [NSApp tkProcessEvent:currentEvent]; if (processedEvent) { | < | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | /* * Generate Xevents. */ NSEvent *processedEvent = [NSApp tkProcessEvent:currentEvent]; if (processedEvent) { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@" event: %@", currentEvent); #endif if (modalSession) { [NSApp _modalSession:modalSession sendEvent:currentEvent]; |
︙ | ︙ |
Changes to macosx/tkMacOSXPort.h.
1 2 3 4 5 6 7 | /* * tkMacOSXPort.h -- * * This file is included by all of the Tk C files. It contains * information that may be configuration-dependent, such as * #includes for system include files and a few other things. * | | | | < < < < < | < < < | | < | 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 | /* * tkMacOSXPort.h -- * * This file is included by all of the Tk C files. It contains * information that may be configuration-dependent, such as * #includes for system include files and a few other things. * * Copyright © 1994-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. */ #ifndef _TKMACPORT #define _TKMACPORT #include <stdio.h> #include <pwd.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <ctype.h> #include <math.h> #include <string.h> #include <limits.h> #include <sys/types.h> #include <sys/file.h> #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> #include <inttypes.h> #include <unistd.h> #if defined(__GNUC__) && !defined(__cplusplus) # pragma GCC diagnostic ignored "-Wc++-compat" #endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.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 | > > > > > > > > > > > > > | 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 | # 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 |
︙ | ︙ | |||
120 121 122 123 124 125 126 | #define TkpSync(display) /* * This macro stores a representation of the window handle in a string. */ #define TkpPrintWindowId(buf,w) \ | | | | | > > > > > > > > > > > < < < < < < < < | 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 | #define TkpSync(display) /* * This macro stores a representation of the window handle in a string. */ #define TkpPrintWindowId(buf,w) \ snprintf((buf), TCL_INTEGER_SPACE, "0x%lx", (unsigned long) (w)) /* * Turn off Tk double-buffering as Aqua windows are already double-buffered. */ #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 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 | /* * 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> #include "tkMacOSXImage.h" #include "tkMacOSXPrivate.h" NSString * fileName = nil; CFStringRef urlFile = NULL; /*Forward declaration of functions.*/ static Tcl_ObjCmdProc StartPrint; static OSStatus FinishPrint(NSString *file, int buttonValue); static Tcl_ObjCmdProc MakePDF; 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( TCL_UNUSED(void *), Tcl_Interp * interp, int objc, Tcl_Obj *const objv[]) { 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 = (int)[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; } /* *---------------------------------------------------------------------- * * MakePDF-- * * Converts a Tk canvas to PDF data. * * Results: * Outputs PDF file. * *---------------------------------------------------------------------- */ int MakePDF( TCL_UNUSED(void *), Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]) { Tk_Window path; Drawable d; unsigned int width, height; CFDataRef pdfData; if (objc != 2) { Tcl_WrongNumArgs(ip, 1, objv, "path?"); return TCL_ERROR; } /*Get window and render to PDF.*/ path = Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip)); if (path == NULL) { return TCL_ERROR; } Tk_MakeWindowExist(path); Tk_MapWindow(path); d = Tk_WindowId(path); width = Tk_Width(path); height = Tk_Height(path); pdfData = CreatePDFFromDrawableRect(d, 0, 0, width, height); NSData *viewData = (NSData*)pdfData; [viewData writeToFile:@"/tmp/tk_canvas.pdf" atomically:YES]; return TCL_OK; } /* *---------------------------------------------------------------------- * * 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); Tcl_CreateObjCommand(interp, "::tk::print::_printcanvas", MakePDF, 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 | * 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 OSStatus TkMacOSHIShapeDifferenceWithRect( HIMutableShapeRef inShape, const CGRect *inRect); 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); | | < | < < | < | | < > | > > > > > > | 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 | 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}; |
︙ | ︙ | |||
321 322 323 324 325 326 327 | Tcl_Interp *_eventInterp; NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSMenuItem *_demoMenuItem; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems; NSAutoreleasePool *_mainPool; | < < < < < < < < < < > > > > > > > > > > > | 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 | Tcl_Interp *_eventInterp; NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSMenuItem *_demoMenuItem; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems; NSAutoreleasePool *_mainPool; } @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; | > | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | @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 { | < < < < < < < < < < < < < < > > > | 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 | - (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 @interface TKPanel(TKWm) - (void) tkLayoutChanged; @end #pragma mark NSMenu & NSMenuItem Utilities @interface NSMenu(TKUtils) + (id)menuWithTitle:(NSString *)title; + (id)menuWithTitle:(NSString *)title menuItems:(NSArray *)items; + (id)menuWithTitle:(NSString *)title submenus:(NSArray *)submenus; - (NSMenuItem *)itemWithSubmenu:(NSMenu *)submenu; |
︙ | ︙ | |||
535 536 537 538 539 540 541 | /* *--------------------------------------------------------------------------- * * TKNSString -- * | < < < < < < | | | < > | 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 | /* *--------------------------------------------------------------------------- * * TKNSString -- * * Tcl uses modified UTF-8 as internal encoding. Apple's NSString class * does not provide a constructor which accepts a modified UTF-8 encoded * byte sequence as initial data. So we add a new class which does provide * such a constructor. It also has a DString property which is a DString whose * string pointer is a byte sequence encoding the NSString with modified UTF-8. * *--------------------------------------------------------------------------- */ @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 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 | /* * 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 ReleaseRegion(TkRegion r); #ifdef DEBUG static int totalRegions = 0; static int totalRegionRetainCount = 0; #define DebugLog(msg, ...) fprintf(stderr, (msg), ##__VA_ARGS__) #else #define DebugLog(msg, ...) #endif /* *---------------------------------------------------------------------- * * XCreateRegion -- * * Implements the equivalent of the X window function XCreateRegion. See * Xwindow documentation for more details. * * Results: * Returns an allocated region handle. * * Side effects: * None. * *---------------------------------------------------------------------- */ Region XCreateRegion(void) { Region region = (Region) HIShapeCreateMutable(); DebugLog("Created region: total regions = %d, total count is %d\n", ++totalRegions, ++totalRegionRetainCount); return region; } /* *---------------------------------------------------------------------- * * XDestroyRegion -- * * Implements the equivalent of the X window function XDestroyRegion. See * Xwindow documentation for more details. * * Results: * None. * * Side effects: * Memory is freed. |
︙ | ︙ | |||
135 136 137 138 139 140 141 | } /* *---------------------------------------------------------------------- * * XUnionRectWithRegion -- * | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | } /* *---------------------------------------------------------------------- * * XUnionRectWithRegion -- * * Implements the equivalent of the X window function * XUnionRectWithRegion. See Xwindow documentation for more details. * * Results: * None. * * Side effects: * None. |
︙ | ︙ | |||
157 158 159 160 161 162 163 | Region src_region, Region dest_region_return) { const CGRect r = CGRectMake(rectangle->x, rectangle->y, rectangle->width, rectangle->height); if (src_region == dest_region_return) { | | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | Region src_region, Region dest_region_return) { const CGRect r = CGRectMake(rectangle->x, rectangle->y, rectangle->width, rectangle->height); if (src_region == dest_region_return) { ChkErr(HIShapeUnionWithRect, (HIMutableShapeRef) dest_region_return, &r); } else { HIShapeRef rectRgn = HIShapeCreateWithRect(&r); ChkErr(HIShapeUnion, rectRgn, (HIShapeRef) src_region, (HIMutableShapeRef) dest_region_return); CFRelease(rectRgn); } return Success; } /* |
︙ | ︙ | |||
197 198 199 200 201 202 203 | } /* *---------------------------------------------------------------------- * * XRectInRegion -- * | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | } /* *---------------------------------------------------------------------- * * XRectInRegion -- * * Implements the equivalent of the X window function XRectInRegion. See * Xwindow documentation for more details. * * Results: * Returns RectanglePart or RectangleOut. Note that this is not a complete * implementation since it doesn't test for RectangleIn. * * Side effects: |
︙ | ︙ | |||
233 234 235 236 237 238 239 | } /* *---------------------------------------------------------------------- * * XClipBox -- * | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | } /* *---------------------------------------------------------------------- * * XClipBox -- * * Implements the equivalent of the X window function XClipBox. See * Xwindow documentation for more details. * * Results: * None. * * Side effects: * None. |
︙ | ︙ | |||
330 331 332 333 334 335 336 | dataPtr += lineStride; } } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | dataPtr += lineStride; } } /* *---------------------------------------------------------------------- * * ReleaseRegion -- * * Decreases reference count of region. * * Results: * None. * |
︙ | ︙ | |||
442 443 444 445 446 447 448 | */ void TkMacOSXSetWithNativeRegion( Region r, HIShapeRef rgn) { | | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | */ void TkMacOSXSetWithNativeRegion( Region r, HIShapeRef rgn) { ChkErr(HIShapeSetWithShape, (HIMutableShapeRef) r, rgn); } /* *---------------------------------------------------------------------- * * XOffsetRegion -- * |
︙ | ︙ | |||
474 475 476 477 478 479 480 | ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy); return Success; } /* *---------------------------------------------------------------------- * | > > > > > > > > > > > > | > > > > > | > | > > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | > | | > > > > > > | > > > > > | | > > | < > | | < < | > > > > | < | | > > > > > > > > > > > | 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 | ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy); return Success; } /* *---------------------------------------------------------------------- * * TkpCopyRegion -- * * Makes the destination region a copy of the source region. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void TkpCopyRegion( TkRegion dst, TkRegion src) { ChkErr(HIShapeSetWithShape, (HIMutableShapeRef)dst, (HIShapeRef)src); } /* *---------------------------------------------------------------------- * * TkMacOSHIShapeDifferenceWithRect -- * * Wrapper functions for missing/buggy HIShape API * *---------------------------------------------------------------------- */ OSStatus TkMacOSHIShapeDifferenceWithRect( HIMutableShapeRef inShape, const CGRect *inRect) { OSStatus result; HIShapeRef rgn = HIShapeCreateWithRect(inRect); result = HIShapeDifference(inShape, rgn, inShape); CFRelease(rgn); 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" |
︙ | ︙ | |||
47 48 49 50 51 52 53 | */ static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */ /* * Forward declarations for procedures defined later in this file: */ | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | */ static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */ /* * Forward declarations for procedures defined later in this file: */ static void MacScaleEventProc(void *clientData, XEvent *eventPtr); static pascal void ScaleActionProc(ControlRef theControl, ControlPartCode partCode); /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
135 136 137 138 139 140 141 | * The scale gets redisplayed. * *---------------------------------------------------------------------- */ void TkpDisplayScale( | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | * The scale gets redisplayed. * *---------------------------------------------------------------------- */ void TkpDisplayScale( void *clientData) /* Widget record for scale. */ { TkScale *scalePtr = clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; int result; char string[TCL_DOUBLE_SPACE]; MacScale *macScalePtr = clientData; |
︙ | ︙ | |||
170 171 172 173 174 175 176 | if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); | | | | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command executed by scale)"); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); } |
︙ | ︙ | |||
374 375 376 377 378 379 380 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MacScaleEventProc( | | | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MacScaleEventProc( void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { MacScale *macScalePtr = (MacScale *) clientData; Point where; Rect bounds; int part; |
︙ | ︙ |
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" |
︙ | ︙ | |||
91 92 93 94 95 96 97 | 15, MIN_SLIDER_LENGTH, 26, 14, 14, kControlSizeNormal }; /* * Declarations of static functions defined later in this file: */ | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | 15, MIN_SLIDER_LENGTH, 26, 14, 14, kControlSizeNormal }; /* * Declarations of static functions defined later in this file: */ static void ScrollbarEventProc(void *clientData, XEvent *eventPtr); static int ScrollbarEvent(TkScrollbar *scrollPtr, XEvent *eventPtr); static void UpdateControlValues(TkScrollbar *scrollPtr); /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
240 241 242 243 244 245 246 | CFRelease(path); } } #endif void TkpDisplayScrollbar( | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | CFRelease(path); } } #endif void TkpDisplayScrollbar( void *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); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
480 481 482 483 484 485 486 | * Currently, none. * *---------------------------------------------------------------------- */ void TkpConfigureScrollbar( | | < | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | * Currently, none. * *---------------------------------------------------------------------- */ void TkpConfigureScrollbar( TCL_UNUSED(TkScrollbar *)) { /* empty */ } /* *-------------------------------------------------------------- * * TkpScrollbarPosition -- |
︙ | ︙ | |||
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; | | < | 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 | 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. */ |
︙ | ︙ | |||
763 764 765 766 767 768 769 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ScrollbarEventProc( | | | | | | 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 | * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ScrollbarEventProc( void *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" |
︙ | ︙ | |||
205 206 207 208 209 210 211 | * application and the display. */ const char *name) /* The name that will be used to refer to the * interpreter in later "send" commands. Must * be globally unique. */ { TkWindow *winPtr = (TkWindow *) tkwin; Tcl_Interp *interp = winPtr->mainPtr->interp; | | > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | * application and the display. */ const char *name) /* The name that will be used to refer to the * interpreter in later "send" commands. Must * be globally unique. */ { TkWindow *winPtr = (TkWindow *) tkwin; Tcl_Interp *interp = winPtr->mainPtr->interp; int suffix, result; Tcl_Size i, offset; RegisteredInterp *riPtr, *prevPtr; const char *actualName; Tcl_DString dString; Tcl_Obj *resultObjPtr, *interpNamePtr; char *interpName; if (!initialized) { |
︙ | ︙ | |||
256 257 258 259 260 261 262 | result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr); if (result != TCL_OK || interpNamePtr == NULL) { break; } interpName = Tcl_GetString(interpNamePtr); if (strcmp(actualName, interpName) == 0) { if (suffix == 1) { | | | | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr); if (result != TCL_OK || interpNamePtr == NULL) { break; } interpName = Tcl_GetString(interpNamePtr); if (strcmp(actualName, interpName) == 0) { if (suffix == 1) { Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE); Tcl_DStringAppend(&dString, " #", 2); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE); actualName = Tcl_DStringValue(&dString); } suffix++; snprintf(Tcl_DStringValue(&dString) + offset, TCL_INTEGER_SPACE, "%d", suffix); i = 0; } else { i++; } } Tcl_DecrRefCount(resultObjPtr); |
︙ | ︙ | |||
316 317 318 319 320 321 322 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SendObjCmd( | | > > > | > > | | | > > > | | < | | | > | 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 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SendObjCmd( TCL_UNUSED(void *), /* Not used */ Tcl_Interp *interp, /* The interp we are sending from */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* The arguments */ { enum { SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST }; static const char *const sendOptions[] = { "-async", "-displayof", "--", NULL }; const char *stringRep, *destName; /*int async = 0;*/ int i, firstArg, index; RegisteredInterp *riPtr; Tcl_Obj *listObjPtr; int result = TCL_OK; /* * Process the command options. */ for (i = 1; i < (objc - 1); i++) { stringRep = Tcl_GetString(objv[i]); if (stringRep[0] == '-') { if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == SEND_ASYNC) { /*async = 1;*/ } else if (index == SEND_DISPLAYOF) { i++; } else /* if (index == SEND_LAST) */ { i++; break; } } else { break; } } if (objc < (i + 2)) { |
︙ | ︙ | |||
458 459 460 461 462 463 464 | * *---------------------------------------------------------------------- */ int TkGetInterpNames( Tcl_Interp *interp, /* Interpreter for returning a result. */ | | < | | 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 | * *---------------------------------------------------------------------- */ int TkGetInterpNames( Tcl_Interp *interp, /* Interpreter for returning a result. */ TCL_UNUSED(Tk_Window)) /* Window whose display is to be used for the * lookup. */ { Tcl_Obj *listObjPtr; RegisteredInterp *riPtr; listObjPtr = Tcl_NewListObj(0, NULL); riPtr = interpListPtr; while (riPtr != NULL) { Tcl_ListObjAppendElement(interp, listObjPtr, Tcl_NewStringObj(riPtr->name, TCL_INDEX_NONE)); riPtr = riPtr->nextPtr; } Tcl_SetObjResult(interp, listObjPtr); return TCL_OK; } |
︙ | ︙ | |||
496 497 498 499 500 501 502 | * Sets up various data structures and windows. * *-------------------------------------------------------------- */ static int SendInit( | | < | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | * Sets up various data structures and windows. * *-------------------------------------------------------------- */ static int SendInit( TCL_UNUSED(Tcl_Interp *)) /* Not used */ { return TCL_OK; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
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" |
︙ | ︙ | |||
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 | CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } ckfree(macWin); return Success; } if (macWin->visRgn) { CFRelease(macWin->visRgn); macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } macWin->view = nil; /* | > > | | | 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 | CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } macWin->winPtr->privatePtr = NULL; ckfree(macWin); return Success; } if (macWin->visRgn) { CFRelease(macWin->visRgn); macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } macWin->view = nil; macWin->winPtr->privatePtr = NULL; /* * Delay deletion of a toplevel data structure until all children have * been deleted. */ if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } return Success; } /* *---------------------------------------------------------------------- * * XMapWindow -- * * This X11 stub maps the given X11 Window but does not update any of * the Tk structures describing the window. Tk applications should * never call this directly, but it is called by Tk_MapWindow and * Tk_WmMapWindow. * * Results: * Always returns Success or BadWindow. * * Side effects: * The subwindow or toplevel may appear on the screen. VisibilityNotify * events are generated. * * *---------------------------------------------------------------------- |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | 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. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } | > > | | 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 | 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. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr)) { TKContentView *view = [win contentView]; /* * We want to activate Tk when a toplevel is mapped but we must not * supply YES here. This is because during Tk initialization the |
︙ | ︙ | |||
181 182 183 184 185 186 187 188 | if (initialized) { if ([win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } else { [win orderFrontRegardless]; } } } else { | > > > > > > > > > > | | | 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 | 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 |
︙ | ︙ | |||
296 297 298 299 300 301 302 | TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); if (!window) { return BadWindow; } | | | > | > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > | | 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 | TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); if (!window) { return BadWindow; } LastKnownRequestProcessed(display)++; 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]) { |
︙ | ︙ | |||
352 353 354 355 356 357 358 | Display *display, /* Display. */ Window window, /* Window. */ unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *)window; | | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | Display *display, /* Display. */ Window window, /* Window. */ unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *)window; LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TKWindow *w = (TKWindow *)macWin->winPtr->wmInfoPtr->window; if (w) { if ([w styleMask] & NSFullScreenWindowMask) { [(TKWindow *)w tkLayoutChanged]; } else { NSRect r = [w contentRectForFrameRect:[w frame]]; r.origin.y += r.size.height - height; r.size.width = width; r.size.height = height; [w setFrame:[w frameRectForContentRect:r] display:NO]; |
︙ | ︙ | |||
401 402 403 404 405 406 407 | Window window, /* Window. */ int x, int y, unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *)window; | | | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | Window window, /* Window. */ int x, int y, unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *)window; LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { /* * We explicitly convert everything to doubles so we don't get * surprised (again) by what happens when you do arithmetic with |
︙ | ︙ | |||
454 455 456 457 458 459 460 | XMoveWindow( Display *display, /* Display. */ Window window, /* Window. */ int x, int y) { MacDrawable *macWin = (MacDrawable *)window; | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | XMoveWindow( Display *display, /* Display. */ Window window, /* Window. */ int x, int y) { MacDrawable *macWin = (MacDrawable *)window; LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { [w setFrameTopLeftPoint: NSMakePoint( x, TkMacOSXZeroScreenHeight() - y)]; } |
︙ | ︙ | |||
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)) { | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | 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 |
︙ | ︙ | |||
597 598 599 600 601 602 603 | int XRaiseWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *)window; | | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | int XRaiseWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *)window; LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Above, NULL); } else { /* * TODO: this should generate damage */ } |
︙ | ︙ | |||
631 632 633 634 635 636 637 | int XLowerWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *)window; | | | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | int XLowerWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *)window; LastKnownRequestProcessed(display)++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Below, NULL); } else { /* * TODO: this should generate damage */ } |
︙ | ︙ | |||
670 671 672 673 674 675 676 | Window w, /* Window. */ unsigned int value_mask, TCL_UNUSED(XWindowChanges *)) { MacDrawable *macWin = (MacDrawable *)w; TkWindow *winPtr = macWin->winPtr; | | | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | Window w, /* Window. */ unsigned int value_mask, TCL_UNUSED(XWindowChanges *)) { MacDrawable *macWin = (MacDrawable *)w; TkWindow *winPtr = macWin->winPtr; LastKnownRequestProcessed(display)++; /* * Change the shape and/or position of the window. */ if (value_mask & (CWX|CWY|CWWidth|CWHeight)) { XMoveResizeWindow(display, w, winPtr->changes.x, winPtr->changes.y, |
︙ | ︙ | |||
755 756 757 758 759 760 761 | } /* * If the window is a container, set the flag for its embedded window. */ if (Tk_IsContainer(winPtr)) { | | | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | } /* * 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); } } } |
︙ | ︙ | |||
808 809 810 811 812 813 814 | HIMutableShapeRef rgn; /* * Start with a region defined by the window bounds. */ TkMacOSXWinCGBounds(winPtr, &bounds); | | | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | HIMutableShapeRef rgn; /* * Start with a region defined by the window bounds. */ TkMacOSXWinCGBounds(winPtr, &bounds); rgn = HIShapeCreateMutableWithRect(&bounds); /* * Clip away the area of any windows that may obscure this window. * For a non-toplevel window, first, clip to the parent's visible * clip region. Second, clip away any siblings that are higher in * the stacking order. For an embedded toplevel, just clip to the * container's visible clip region. Remember, we only allow one |
︙ | ︙ | |||
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)) { | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | 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)) { | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | 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)) { | | | | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 | * (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 = HIShapeCreateEmpty(); } if (!macWin->visRgn) { macWin->visRgn = HIShapeCreateCopy(macWin->aboveVisRgn); } macWin->flags &= ~TK_CLIP_INVALID; } } |
︙ | ︙ | |||
969 970 971 972 973 974 975 | InvalViewRect( int msg, TCL_UNUSED(HIShapeRef), const CGRect *rect, void *ref) { static CGAffineTransform t; | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | 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)) { | | | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | 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 { | | | 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | 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)) { | | | 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | } /* * 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)) { | | | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | 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. */ |
︙ | ︙ | |||
1387 1388 1389 1390 1391 1392 1393 | int width, /* Dimensions of pixmap. */ int height, int depth) /* Bits per pixel for pixmap. */ { MacDrawable *macPix; if (display != NULL) { | | | 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | int width, /* Dimensions of pixmap. */ int height, int depth) /* Bits per pixel for pixmap. */ { MacDrawable *macPix; if (display != NULL) { LastKnownRequestProcessed(display)++; } macPix = (MacDrawable *)ckalloc(sizeof(MacDrawable)); macPix->winPtr = NULL; macPix->xOff = 0; macPix->yOff = 0; macPix->visRgn = NULL; macPix->aboveVisRgn = NULL; |
︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 | void Tk_FreePixmap( Display *display, /* Display. */ Pixmap pixmap) /* Pixmap to destroy */ { MacDrawable *macPix = (MacDrawable *)pixmap; | | < < < < < | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | void Tk_FreePixmap( Display *display, /* Display. */ Pixmap pixmap) /* Pixmap to destroy */ { MacDrawable *macPix = (MacDrawable *)pixmap; LastKnownRequestProcessed(display)++; if (macPix->context) { 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 | /* * 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( void *clientData) { 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, 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 37 | /* * 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 MoveMouseObjCmd; 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. */ | | > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 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, "movemouse", MoveMouseObjCmd, 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. * *---------------------------------------------------------------------- */ | | | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | * * 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 /* |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | * case when within [NSView drawRect]. * * Side effects: * None * *---------------------------------------------------------------------- */ MODULE_SCOPE Bool TkTestLogDisplay( Drawable drawable) { MacDrawable *macWin = (MacDrawable *)drawable; NSWindow *win = nil; if (macWin->toplevel && macWin->toplevel->winPtr && | > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | * case when within [NSView drawRect]. * * Side effects: * None * *---------------------------------------------------------------------- */ MODULE_SCOPE Bool TkTestLogDisplay( Drawable drawable) { MacDrawable *macWin = (MacDrawable *)drawable; NSWindow *win = nil; if (macWin->toplevel && macWin->toplevel->winPtr && |
︙ | ︙ | |||
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 | | < | 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 | * * 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; /* | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | < < < < < < < < < < < < < < < < < < < < | | | | | | | | 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 | } } 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; } /* *---------------------------------------------------------------------- * * MoveMouseObjCmd -- * * This Tcl command simulates a mouse motion to a specific screen * location. It injects an NSEvent into the NSApplication event queue, * as opposed to adding events to the Tcl queue as event generate would * do. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int MoveMouseObjCmd( 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; NSArray *screens = [NSScreen screens]; CGFloat ScreenHeight = 0; enum {X=1, Y}; if (screens && [screens count]) { ScreenHeight = [[screens objectAtIndex:0] frame].size.height; } if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "x y"); return TCL_ERROR; } for (i = 1; i < objc; i++) { if (Tcl_GetIntFromObj(interp,objv[i],&value) != TCL_OK) { return TCL_ERROR; } switch (i) { case X: x = value; break; case Y: y = value; break; default: break; } } 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]; 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 | | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | 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" |
︙ | ︙ | |||
46 47 48 49 50 51 52 | @implementation TKApplication(TKWindowEvent) - (void) windowActivation: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | | < < > > > > > > > > > > > > > > > > > > > > > > | | | 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 | @implementation TKApplication(TKWindowEvent) - (void) windowActivation: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_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, sel_getName(_cmd), notification); #endif BOOL movedOnly = [[notification name] isEqualToString:NSWindowDidMoveNotification]; NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { |
︙ | ︙ | |||
99 100 101 102 103 104 105 | } } - (void) windowExpanded: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | } } - (void) windowExpanded: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { winPtr->wmInfoPtr->hints.initial_state = TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState; |
︙ | ︙ | |||
156 157 158 159 160 161 162 | return proposedSize; } - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | | > > > | > > > | > | | 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 | return proposedSize; } - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_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, sel_getName(_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, sel_getName(_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 TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), w); #endif TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { TkGenWMDestroyEvent((Tk_Window)winPtr); } |
︙ | ︙ | |||
208 209 210 211 212 213 214 | - (void) windowBecameVisible: (NSNotification *) notification { NSWindow *window = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(window); if (winPtr) { TKContentView *view = [window contentView]; | | | > > > > > > > > > > > | < < < < < < | | 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 | - (void) windowBecameVisible: (NSNotification *) notification { NSWindow *window = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(window); if (winPtr) { TKContentView *view = [window contentView]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { [view viewDidChangeEffectiveAppearance]; } #endif [view addTkDirtyRect:[view bounds]]; Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL); Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL); } } - (void) windowMapped: (NSNotification *) notification { 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, sel_getName(_cmd), notification); } - (void) windowUnmapped: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { //Tk_UnmapWindow((Tk_Window)winPtr); } } |
︙ | ︙ | |||
270 271 272 273 274 275 276 277 | observe(NSWindowDidResignKeyNotification, windowActivation:); observe(NSWindowDidMoveNotification, windowBoundsChanged:); observe(NSWindowDidResizeNotification, windowBoundsChanged:); observe(NSWindowDidDeminiaturizeNotification, windowExpanded:); observe(NSWindowDidMiniaturizeNotification, windowCollapsed:); observe(NSWindowWillOrderOnScreenNotification, windowMapped:); observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:); | > > | < < > > > > > > > > > > | > > > > | > > > > > | | 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 | 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, sel_getName(_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; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif /* * To prevent zombie windows on systems with a TouchBar, set the key window * to nil if the current key window is not visible. This allows a closed * Help or About window to be deallocated so it will not reappear as a * zombie when the app is reactivated. |
︙ | ︙ | |||
360 361 362 363 364 365 366 | return NO; } - (void) applicationShowHide: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS | | | | | | 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 | return NO; } - (void) applicationShowHide: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif const char *cmd = ([[notification name] isEqualToString: NSApplicationDidUnhideNotification] ? "::tk::mac::OnShow" : "::tk::mac::OnHide"); if (_eventInterp && Tcl_FindCommand(_eventInterp, cmd, NULL, 0)) { int code = Tcl_EvalEx(_eventInterp, cmd, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } Tcl_ResetResult(_eventInterp); } } - (void) displayChanged: (NSNotification *) notification { (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); #endif TkDisplay *dispPtr = TkGetDisplayList(); if (dispPtr) { TkMacOSXDisplayChanged(dispPtr->display); } } @end #pragma mark - /* *---------------------------------------------------------------------- * * 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. */ |
︙ | ︙ | |||
816 817 818 819 820 821 822 | protocol = (Atom) eventPtr->xclient.data.l[0]; for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protocol == protPtr->protocol) { Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); | | | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | protocol = (Atom) eventPtr->xclient.data.l[0]; for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protocol == protPtr->protocol) { Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", Tk_GetAtomName((Tk_Window)winPtr, protocol))); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); |
︙ | ︙ | |||
890 891 892 893 894 895 896 | /* * Restrict event processing to Expose events. */ static Tk_RestrictAction ExposeRestrictProc( | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * Restrict event processing to Expose events. */ static Tk_RestrictAction ExposeRestrictProc( void *arg, XEvent *eventPtr) { return (eventPtr->type==Expose && eventPtr->xany.serial==PTR2UINT(arg) ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } /* * Restrict event processing to ConfigureNotify events. */ static Tk_RestrictAction ConfigureRestrictProc( 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; } #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - (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; } #endif - (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]; |
︙ | ︙ | |||
974 975 976 977 978 979 980 | [w respondsToSelector: @selector (tkLayoutChanged)]) { [(TKWindow *)w tkLayoutChanged]; } if (winPtr) { unsigned int width = (unsigned int)newsize.width; unsigned int height=(unsigned int)newsize.height; | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | [w respondsToSelector: @selector (tkLayoutChanged)]) { [(TKWindow *)w tkLayoutChanged]; } if (winPtr) { unsigned int width = (unsigned int)newsize.width; unsigned int height=(unsigned int)newsize.height; void *oldArg; Tk_RestrictProc *oldProc; /* * This can be called from outside the Tk event loop. Since it calls * Tcl_DoOneEvent, we need to make sure we don't clobber the * AutoreleasePool set up by the caller. */ |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | - (void) generateExposeEvents: (NSRect) rect { unsigned long serial; int updatesNeeded; CGRect updateBounds; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); | | | 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | - (void) generateExposeEvents: (NSRect) rect { unsigned long serial; int updatesNeeded; CGRect updateBounds; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); void *oldArg; Tk_RestrictProc *oldProc; if (!winPtr) { return; } /* * Generate Tk Expose events. All of these events will share the same |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | static const char *defaultColor = NULL; if (effectiveAppearanceName == NSAppearanceNameAqua) { Tk_SendVirtualEvent(tkwin, "LightAqua", NULL); } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { Tk_SendVirtualEvent(tkwin, "DarkAqua", NULL); } | < < < < < < < < < < < < < < < < < < < < < | > > | | | | | | | | | | | | | | | | | 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 | static const char *defaultColor = NULL; if (effectiveAppearanceName == NSAppearanceNameAqua) { Tk_SendVirtualEvent(tkwin, "LightAqua", NULL); } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { Tk_SendVirtualEvent(tkwin, "DarkAqua", NULL); } if (!defaultColor) { defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; } NSString *accent = [preferences stringForKey:@"AppleAccentColor"]; NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"] componentsSeparatedByString: @" "]; NSString *highlight = [words count] > 3 ? [words objectAtIndex:3] : nil; const char *accentName = accent ? accentNames[1 + accent.intValue] : defaultColor; const char *highlightName = highlight ? highlight.UTF8String: defaultColor; char data[256]; snprintf(data, 256, "Appearance %s Accent %s Highlight %s", effectiveAppearanceName.UTF8String, accentName, highlightName); Tk_SendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, TCL_INDEX_NONE)); } - (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, sel_getName(_cmd), sender); #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. */ |
︙ | ︙ | |||
1235 1236 1237 1238 1239 1240 1241 | */ - (void) keyDown: (NSEvent *) theEvent { (void)theEvent; #ifdef TK_MAC_DEBUG_EVENTS | | | 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 | */ - (void) keyDown: (NSEvent *) theEvent { (void)theEvent; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), theEvent); #endif } /* * When the services menu is opened this is called for each Responder in * the Responder chain until a service provider is found. The TKContentView * should be the first (and generally only) Responder in the chain. We |
︙ | ︙ |
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" |
︙ | ︙ | |||
33 34 35 36 37 38 39 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_WINDOWS #endif */ /* | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_WINDOWS #endif */ /* * Carbon window attributes and classes. */ #define WM_NSMASK_SHIFT 36 #define tkWindowDoesNotHideAttribute \ ((UInt64) 1 << kHIWindowBitDoesNotHide) #define tkCanJoinAllSpacesAttribute \ ((UInt64) NSWindowCollectionBehaviorCanJoinAllSpaces << 34) |
︙ | ︙ | |||
107 108 109 110 111 112 113 | .forceOffAttrs = kWindowCollapseBoxAttribute, .flags = WM_TOPMOST, .styleMask = NSUtilityWindowMask, }, [kHelpWindowClass] = { .defaultAttrs = kWindowHideOnSuspendAttribute, .forceOnAttrs = kWindowNoTitleBarAttribute | kWindowDoesNotCycleAttribute, | | > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | .forceOffAttrs = kWindowCollapseBoxAttribute, .flags = WM_TOPMOST, .styleMask = NSUtilityWindowMask, }, [kHelpWindowClass] = { .defaultAttrs = kWindowHideOnSuspendAttribute, .forceOnAttrs = kWindowNoTitleBarAttribute | kWindowDoesNotCycleAttribute, .flags = WM_TOPMOST, .styleMask = 0}, [kSheetWindowClass] = { .validAttrs = kWindowResizableAttribute, .forceOnAttrs = kWindowNoTitleBarAttribute | kWindowDoesNotCycleAttribute, .styleMask = NSDocModalWindowMask, }, [kToolbarWindowClass] = { .defaultAttrs = kWindowHideOnSuspendAttribute, |
︙ | ︙ | |||
146 147 148 149 150 151 152 | }; #define ForceAttributes(attributes, class) \ ((attributes) & (~macClassAttrs[(class)].forceOffAttrs | \ (macClassAttrs[(class)].forceOnAttrs & ~kWindowResizableAttribute))) /* | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | | | | | | | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > > > > > < < < < < < < < < < < | < < | < < < < < < < < < < < < < < < < < < < < | | 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 | }; #define ForceAttributes(attributes, class) \ ((attributes) & (~macClassAttrs[(class)].forceOffAttrs | \ (macClassAttrs[(class)].forceOnAttrs & ~kWindowResizableAttribute))) /* * Structures and data for the wm attributes command (macOS 10.13 and later): */ /* Hash tables for attributes which can be set before a window exists */ static Tcl_HashTable pathnameToSubclass; static Tcl_HashTable pathnameToTabbingId; static Tcl_HashTable pathnameToTabbingMode; enum NSWindowSubclass { subclassNSWindow = 0, subclassNSPanel = 1 }; /* This array must be indexed by the enum above.*/ static const char *subclassNames[] = {"nswindow", "nspanel", NULL}; typedef struct buttonField_t { unsigned zoom: 1; unsigned miniaturize: 1; unsigned close: 1; } buttonField; /* The order of these names must match the order of the bits above! */ static const char *buttonNames[] = {"zoom", "miniaturize", "close", NULL}; typedef union windowButtonState_t { int intvalue; buttonField bits; } windowButtonState; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 enum NSWindowClass { NSWindowClass_any = 0, NSWindowClass_window = 1, NSWindowClass_panel = 2 }; typedef struct styleMaskBit_t { const char *bitname; unsigned long bitvalue; enum NSWindowClass allowed; } styleMaskBit; static const styleMaskBit styleMaskBits[] = { /* Make the titlebar visible and use round corners. */ {"titled", NSWindowStyleMaskTitled, NSWindowClass_window}, /* Enable the close button. */ {"closable", NSWindowStyleMaskClosable, NSWindowClass_window}, /* Enable the miniaturize button. */ {"miniaturizable", NSWindowStyleMaskMiniaturizable, NSWindowClass_window}, /* Allow the user to resize the window. */ {"resizable", NSWindowStyleMaskResizable, NSWindowClass_window}, /* * Make the content view extend under the titlebar. We force * titlebarAppearsTransparent when this bit is set. Otherwise it is * pretty useless. */ {"fullsizecontentview", NSWindowStyleMaskFullSizeContentView, NSWindowClass_window}, /* Rounded corners, cannot have a titlebar (overrides titled bit). */ {"docmodal", NSWindowStyleMaskDocModalWindow, NSWindowClass_any}, /* ============================================ * The following bits are only valid for panels. */ /* Make the title bar thinner. */ {"utility", NSWindowStyleMaskUtilityWindow, NSWindowClass_panel}, /* Do not activate the app when the window is activated. */ {"nonactivatingpanel", NSWindowStyleMaskNonactivatingPanel, NSWindowClass_panel}, /* * Requires utility. Cannot be resizable. Close button is an X; no other buttons. * Cannot be a docmodal. */ {"HUDwindow", NSWindowStyleMaskHUDWindow, NSWindowClass_panel}, {NULL, 0, NSWindowClass_any} }; typedef struct tabbingMode_t { const char *modeName; long modeValue; } tabbingMode; static const tabbingMode tabbingModes[] = { {"auto", NSWindowTabbingModeAutomatic}, {"disallowed", NSWindowTabbingModeDisallowed}, {"preferred", NSWindowTabbingModePreferred}, {NULL, -1} }; static const char *const appearanceStrings[] = { "aqua", "auto", "darkaqua", NULL }; enum appearances { APPEARANCE_AQUA, APPEARANCE_AUTO, APPEARANCE_DARKAQUA }; static Bool wantsToBeTab(NSWindow *macWindow) { Bool result; switch ([macWindow tabbingMode]) { case NSWindowTabbingModeDisallowed: result = False; break; case NSWindowTabbingModePreferred: result = True; break; case NSWindowTabbingModeAutomatic: result = ([NSWindow userTabbingPreference] == NSWindowUserTabbingPreferenceAlways); break; default: result = False; break; } return result; } /* * Helper for the tkLayoutChanged methods. Synchronizes Tk's understanding of * the bounds of a contentView with the window's. It is needed because there * are situations when the window manager can change the layout of an NSWindow * without having been requested to do so by Tk. Examples are when a window * goes FullScreen or shows a tab bar. NSWindow methods which involve such * layout changes should be overridden or protected by methods which call this. */ static void syncLayout(NSWindow *macWindow) { TkWindow *winPtr = TkMacOSXGetTkWindow(macWindow); if (winPtr) { // Using screen coordinates with origin at bottom left. NSRect frameRect = [macWindow frame]; // This accounts for the tab bar, if there is one. NSRect contentRect = [macWindow contentRectForFrameRect: frameRect]; WmInfo *wmPtr = winPtr->wmInfoPtr; // The parent includes the title bar, tab bar and window frame. wmPtr->xInParent = frameRect.origin.x - contentRect.origin.x; wmPtr->yInParent = (frameRect.origin.y + frameRect.size.height - contentRect.origin.y - contentRect.size.height); wmPtr->parentWidth = winPtr->changes.width + frameRect.size.width - contentRect.size.width; wmPtr->parentHeight = winPtr->changes.height + frameRect.size.height - contentRect.size.height; } } #endif typedef enum { WMATT_ALPHA, WMATT_APPEARANCE, WMATT_BUTTONS, WMATT_FULLSCREEN, WMATT_ISDARK, WMATT_MODIFIED, WMATT_NOTIFY, WMATT_TITLEPATH, WMATT_TOPMOST, WMATT_TRANSPARENT, WMATT_STYLEMASK, WMATT_CLASS, WMATT_TABBINGID, WMATT_TABBINGMODE, WMATT_TYPE, _WMATT_LAST_ATTRIBUTE } WmAttribute; static const char *const WmAttributeNames[] = { "-alpha", "-appearance", "-buttons", "-fullscreen", "-isdark", "-modified", "-notify", "-titlepath", "-topmost", "-transparent", "-stylemask", "-class", "-tabbingid", "-tabbingmode", "-type", NULL }; /* * The variable below is used to enable or disable tracing in this module. If * tracing is enabled, then information is printed on standard output about * interesting interactions with the window manager. */ static int wmTracing = 0; /* * The following structure is the official type record for geometry management * of top-level windows. */ static void TopLevelReqProc(void *dummy, Tk_Window tkwin); static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ NULL, /* lostContentProc */ }; /* * The following keeps state for Aqua dock icon bounce notification. */ static int tkMacOSXWmAttrNotifyVal = 0; /* * Declarations of static functions defined in this file: */ static NSRect InitialWindowBounds(TkWindow *winPtr, NSWindow *macWindow); static int ParseGeometry(Tcl_Interp *interp, char *string, TkWindow *winPtr); static void TopLevelEventProc(void *clientData, XEvent *eventPtr); static void WmStackorderToplevelWrapperMap(TkWindow *winPtr, Display *display, Tcl_HashTable *table); static void UpdateGeometryInfo(void *clientData); static void UpdateSizeHints(TkWindow *winPtr); static void UpdateVRootGeometry(WmInfo *wmPtr); static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmOverrideredirectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); static int WmWinStyle(Tcl_Interp *interp, TkWindow *winPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmWinAppearance(Tcl_Interp *interp, TkWindow *winPtr, Tcl_Size objc, Tcl_Obj *const objv[]); static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr, NSWindow *macWindow, UInt64 oldAttributes, int oldFlags, int create, int initial); static void ApplyContainerOverrideChanges(TkWindow *winPtr, NSWindow *macWindow); static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr); static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); static void RemoveTransient(TkWindow *winPtr); #if MAC_OS_X_VERSION_MAX_ALLOWED > 101300 /* * Add a window as a tab in the group specified by its tabbingid, or * make it a standalone window if it is the only window with that * tabbingid. Adjust the window size if a tab bar appeared or * disappeared. */ static void placeAsTab(TKWindow *macWindow) { TkWindow *winPtr = NULL, *winPtr2 = NULL; TKWindow *target = NULL, *sibling = NULL; NSString *identifier = [macWindow tabbingIdentifier]; if (!wantsToBeTab(macWindow)) { [macWindow moveTabToNewWindow:NSApp]; [(TKWindow *)target tkLayoutChanged]; return; } for (NSWindow *window in [NSApp windows]) { if (window == macWindow) { continue; } if ([identifier isEqualTo: [window tabbingIdentifier]] && wantsToBeTab(window)) { target = (TKWindow*) window; syncLayout(target); break; } } syncLayout(macWindow); NSArray<NSWindow *> *tabs = [macWindow tabbedWindows]; if ([tabs count] == 2) { sibling = tabs[0] == macWindow ? (TKWindow *)tabs[1] : (TKWindow *)tabs[0]; syncLayout(sibling); winPtr2 = TkMacOSXGetTkWindow(sibling); } if (target) { CGFloat winHeight = [macWindow contentRectForFrameRect: [macWindow frame]].size.height; CGFloat winDelta = 0, targetHeight, targetDelta = 0; targetHeight = [target contentRectForFrameRect: [target frame]].size.height; [target addTabbedWindow:macWindow ordered:NSWindowAbove]; targetDelta = targetHeight - [target contentRectForFrameRect: [target frame]].size.height; winDelta = winHeight - [target contentRectForFrameRect: [target frame]].size.height; if (winDelta) { winPtr = TkMacOSXGetTkWindow(macWindow); XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, winPtr->changes.width, winPtr->changes.height + winDelta ); if (sibling) { winPtr = TkMacOSXGetTkWindow(sibling); XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, winPtr->changes.width, winPtr->changes.height - winDelta ); } } if (targetDelta) { winPtr = TkMacOSXGetTkWindow(target); XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, winPtr->changes.width, winPtr->changes.height + targetDelta ); } } else { CGFloat height = [macWindow contentRectForFrameRect: [macWindow frame]].size.height; [macWindow moveTabToNewWindow:NSApp]; CGFloat delta = height - [macWindow contentRectForFrameRect: [macWindow frame]].size.height; winPtr = TkMacOSXGetTkWindow(macWindow); XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, winPtr->changes.width, winPtr->changes.height + delta); if (winPtr2) { XMoveResizeWindow(winPtr2->display, winPtr2->window, winPtr2->changes.x, winPtr2->changes.y, winPtr2->changes.width, winPtr2->changes.height + delta ); } } } #endif #pragma mark NSWindow(TKWm) @implementation NSWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - (NSPoint) tkConvertPointToScreen: (NSPoint) point { return [self convertBaseToScreen:point]; } - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { return [self convertScreenToBase:point]; } #else - (NSPoint) tkConvertPointToScreen: (NSPoint) point { NSRect pointrect = {point, {0,0}}; return [self convertRectToScreen:pointrect].origin; } - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { NSRect pointrect = {point, {0,0}}; return [self convertRectFromScreen:pointrect].origin; } #endif @end #pragma mark - @implementation TKPanel: NSPanel @synthesize tkWindow = _tkWindow; - (void) tkLayoutChanged { syncLayout(self); } @end @implementation TKDrawerWindow: NSWindow @synthesize tkWindow = _tkWindow; @end @implementation TKWindow: NSWindow @synthesize tkWindow = _tkWindow; @end #pragma mark TKWindow(TKWm) @implementation TKWindow(TKWm) - (void) tkLayoutChanged { syncLayout(self); } #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 - (void)toggleTabBar:(id)sender { TkWindow *winPtr = TkMacOSXGetTkWindow(self); if (!winPtr) { return; } [super toggleTabBar:sender]; |
︙ | ︙ | |||
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | wmPtr->macClass = kDocumentWindowClass; wmPtr->attributes = macClassAttrs[kDocumentWindowClass].defaultAttrs; wmPtr->scrollWinPtr = NULL; wmPtr->menuPtr = NULL; wmPtr->window = nil; winPtr->wmInfoPtr = wmPtr; UpdateVRootGeometry(wmPtr); /* * Tk must monitor structure events for top-level windows, in order to * detect size and position changes caused by window managers. */ Tk_CreateEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); /* * Arrange for geometry requests to be reflected from the window to the * window manager. */ Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } | > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | wmPtr->macClass = kDocumentWindowClass; wmPtr->attributes = macClassAttrs[kDocumentWindowClass].defaultAttrs; wmPtr->scrollWinPtr = NULL; wmPtr->menuPtr = NULL; wmPtr->window = nil; winPtr->wmInfoPtr = wmPtr; // initialize wmPtr->NSWindowSubclass here UpdateVRootGeometry(wmPtr); /* * Tk must monitor structure events for top-level windows, in order to * detect size and position changes caused by window managers. */ Tk_CreateEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); /* * Arrange for geometry requests to be reflected from the window to the * window manager. */ Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } /* *---------------------------------------------------------------------- * * TkWmMapWindow -- * * This procedure is invoked to map a top-level window. This module gets |
︙ | ︙ | |||
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; | | | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | 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 -- * |
︙ | ︙ | |||
938 939 940 941 942 943 944 | */ void TkWmUnmapWindow( TkWindow *winPtr) /* Top-level window that's about to be * unmapped. */ { | > > > | | | | | | | | < < | > | 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 | */ void TkWmUnmapWindow( TkWindow *winPtr) /* Top-level window that's about to be * unmapped. */ { winPtr->flags &= ~TK_MAPPED; if ((winPtr->window != None) && (XUnmapWindow(winPtr->display, winPtr->window) == Success)) { XEvent event; event.xany.serial = LastKnownRequestProcessed(winPtr->display); event.xany.send_event = False; event.xany.display = winPtr->display; event.xunmap.type = UnmapNotify; event.xunmap.window = winPtr->window; event.xunmap.event = winPtr->window; event.xunmap.from_configure = false; Tk_HandleEvent(&event); } } /* *---------------------------------------------------------------------- * * TkWmDeadWindow -- * |
︙ | ︙ | |||
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. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > < | 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 | 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 (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]; | > > > > > > > > > > > > > > > < | 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 | * 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]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; [preferences removeObserver:deadNSWindow.contentView forKeyPath:@"AppleHighlightColor"]; #endif [deadNSWindow release]; #if DEBUG_ZOMBIES > 1 fprintf(stderr, "================= Pool dump ===================\n"); [NSAutoreleasePool showPools]; #endif } |
︙ | ︙ | |||
1178 1179 1180 1181 1182 1183 1184 | * See the user documentation. * *---------------------------------------------------------------------- */ int Tk_WmObjCmd( | | | | | > | < > > > > > > > > > | > > > > > > > > > > > > > > > | | | | 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 | * 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", "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_TRANSIENT, WMOPT_WITHDRAW }; int index; Tcl_Size 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 (index == WMOPT_ATTRIBUTES && objc == 5 && strcmp(Tcl_GetString(objv[3]), "-class") == 0) { if (TkGetWindowFromObj(NULL, tkwin, objv[2], (Tk_Window *) &winPtr) == TCL_OK) { if (winPtr->wmInfoPtr->window != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Cannot change the class after the mac window is created.",-1)); Tcl_SetErrorCode(interp, "TK", "CLASS_CHANGE", NULL); return TCL_ERROR; } } else { winPtr = NULL; } } else if (index == WMOPT_ATTRIBUTES && objc == 5 && strcmp(Tcl_GetString(objv[3]), "-tabbingid") == 0) { if (TkGetWindowFromObj(NULL, tkwin, objv[2], (Tk_Window *) &winPtr) != TCL_OK) { winPtr = NULL; } } else if (index == WMOPT_ATTRIBUTES && objc == 5 && strcmp(Tcl_GetString(objv[3]), "-tabbingmode") == 0) { if (TkGetWindowFromObj(NULL, tkwin, objv[2], (Tk_Window *) &winPtr) != TCL_OK) { winPtr = NULL; } } else if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr) != TCL_OK) { return TCL_ERROR; } if (winPtr && !Tk_IsTopLevel(winPtr) && (index != WMOPT_MANAGE) && (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: | > > | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 | 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: |
︙ | ︙ | |||
1343 1344 1345 1346 1347 1348 1349 | */ static int WmAspectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 | */ static int WmAspectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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, |
︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 | || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "aspect number can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "ASPECT", NULL); return TCL_ERROR; } wmPtr->minAspect.x = numer1; wmPtr->minAspect.y = denom1; wmPtr->maxAspect.x = numer2; wmPtr->maxAspect.y = denom2; |
︙ | ︙ | |||
1418 1419 1420 1421 1422 1423 1424 | TkWindow *winPtr, /* Toplevel to work with */ NSWindow *macWindow, Tcl_Interp *interp, /* Current interpreter */ WmAttribute attribute, /* Code of attribute to set */ Tcl_Obj *value) /* New value */ { WmInfo *wmPtr = winPtr->wmInfoPtr; | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | > > | 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 | TkWindow *winPtr, /* Toplevel to work with */ NSWindow *macWindow, Tcl_Interp *interp, /* Current interpreter */ WmAttribute attribute, /* Code of attribute to set */ Tcl_Obj *value) /* New value */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int boolValue; NSString *identifier; switch (attribute) { case WMATT_ALPHA: { double dval; if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) { return TCL_ERROR; } /* * The user should give (transparent) 0 .. 1.0 (opaque) */ if (dval < 0.0) { dval = 0.0; } else if (dval > 1.0) { dval = 1.0; } [macWindow setAlphaValue:dval]; break; } case WMATT_APPEARANCE: { int index; if (Tcl_GetIndexFromObjStruct(interp, value, appearanceStrings, sizeof(char *), "appearancename", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum appearances) index) { case APPEARANCE_AQUA: macWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; break; case APPEARANCE_DARKAQUA: #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { macWindow.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 break; default: macWindow.appearance = nil; } break; } case WMATT_BUTTONS: { windowButtonState state = {0}; Tcl_Obj **elements; Tcl_Size nElements, i; if (Tcl_ListObjGetElements(interp, value, &nElements, &elements) == TCL_OK) { int index = 0; for (i = 0; i < nElements; i++) { if (Tcl_GetIndexFromObjStruct(interp, elements[i], buttonNames, sizeof(char *), "window button name", 0, &index) != TCL_OK) { return TCL_ERROR; } else { state.intvalue |= (1 << index); } } } else if (Tcl_GetIntFromObj(interp, value, &state.intvalue) != TCL_OK) { return TCL_ERROR; } NSButton *closer = [macWindow standardWindowButton: NSWindowCloseButton]; NSButton *miniaturizer = [macWindow standardWindowButton: NSWindowMiniaturizeButton]; NSButton *zoomer = [macWindow standardWindowButton: NSWindowZoomButton]; closer.enabled = (state.bits.close != 0); miniaturizer.enabled = (state.bits.miniaturize != 0); zoomer.enabled = (state.bits.zoom != 0); break; } case WMATT_FULLSCREEN: if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } if (boolValue != (([macWindow styleMask] & NSFullScreenWindowMask) != 0)) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 [macWindow toggleFullScreen:macWindow]; #else TKLog(@"The fullscreen attribute is ignored on this system."); #endif } break; case WMATT_MODIFIED: if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } if (boolValue != [macWindow isDocumentEdited]) { [macWindow setDocumentEdited:(BOOL)boolValue]; } break; case WMATT_NOTIFY: if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } if (boolValue == !tkMacOSXWmAttrNotifyVal) { static NSInteger request = -1; if (request >= 0) { [NSApp cancelUserAttentionRequest:request]; request = -1; } if (boolValue) { request = [NSApp requestUserAttention:NSCriticalRequest]; } tkMacOSXWmAttrNotifyVal = boolValue; } break; case WMATT_STYLEMASK: { unsigned long styleMaskValue = 0; Tcl_Obj **elements; Tcl_Size nElements, i; if (Tcl_ListObjGetElements(interp, value, &nElements, &elements) == TCL_OK) { int index; for (i = 0; i < nElements; i++) { if (Tcl_GetIndexFromObjStruct(interp, elements[i], styleMaskBits, sizeof(styleMaskBit), "styleMask bit", 0, &index) != TCL_OK) { return TCL_ERROR; } else if (![macWindow isKindOfClass: [NSPanel class]] && styleMaskBits[index].allowed == NSWindowClass_panel) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "styleMask bit \"%s\" can only be used with an NSPanel", styleMaskBits[index].bitname)); Tcl_SetErrorCode(interp, "TK", "INVALID_STYLEMASK_BIT", NULL); return TCL_ERROR; } else { styleMaskValue |= styleMaskBits[index].bitvalue; } /* * Be sure not to change the fullscreen bit. */ styleMaskValue |= (NSWindowStyleMaskFullScreen & macWindow.styleMask); } /* * A resizable docmodal NSWindow or NSPanel does not work * correctly. It cannot be resized from the top edge. Other bits, * such as titled are ignored for docmodals. To be safe, we clear * all other bits when the docmodal bit is set. */ if (styleMaskValue & NSDocModalWindowMask) { styleMaskValue &= ~NSWindowStyleMaskResizable; } if ([macWindow isKindOfClass: [NSPanel class]]) { /* * We always make NSPanels titled, nonactivating utility windows, * even if these bits are not requested in the command. */ if (!(styleMaskValue & NSWindowStyleMaskTitled) ) { styleMaskValue |= NSWindowStyleMaskTitled; styleMaskValue |= NSWindowStyleMaskUtilityWindow; styleMaskValue |= NSWindowStyleMaskNonactivatingPanel; } } if (styleMaskValue & NSWindowStyleMaskFullSizeContentView) { macWindow.titlebarAppearsTransparent = YES; } else { macWindow.titlebarAppearsTransparent = NO; } } else { return TCL_ERROR; } NSRect oldFrame = [macWindow frame]; #ifdef DEBUG fprintf(stderr, "Current styleMask: %lx\n", [macWindow styleMask]); fprintf(stderr, "Setting styleMask to %lx\n", styleMaskValue); #endif macWindow.styleMask = (unsigned long) styleMaskValue; NSRect newFrame = [macWindow frame]; int heightDiff = newFrame.size.height - oldFrame.size.height; int newHeight = heightDiff < 0 ? newFrame.size.height : newFrame.size.height - heightDiff; [(TKWindow *)macWindow tkLayoutChanged]; if (heightDiff) { //Calling XMoveResizeWindow twice is a hack to force a relayout //of the window. XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, newFrame.size.width, newHeight - 1); XMoveResizeWindow(winPtr->display, winPtr->window, winPtr->changes.x, winPtr->changes.y, newFrame.size.width, newHeight); } break; } case WMATT_TABBINGID: { NSString *oldId = [macWindow tabbingIdentifier]; char *valueString; Tcl_Size length; if ([NSApp macOSVersion] < 101300) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Tabbing identifiers require macOS 10.13", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "TABBINGID", NULL); return TCL_ERROR; } valueString = Tcl_GetStringFromObj(value, &length); identifier = [NSString stringWithUTF8String:valueString]; [macWindow setTabbingIdentifier: identifier]; /* * If the tabbingIdentifier of a tab is changed we move it into * the tab group with that identifier. */ if ([oldId compare:identifier] != NSOrderedSame) { placeAsTab((TKWindow *)macWindow); } break; } case WMATT_TABBINGMODE: { int index; tabbingMode mode; if (Tcl_GetIndexFromObjStruct(interp, value, tabbingModes, sizeof(tabbingMode), "NSWindow Tabbing Mode", 0, &index) != TCL_OK) { return TCL_ERROR; } mode = tabbingModes[index]; [macWindow setTabbingMode: mode.modeValue]; placeAsTab((TKWindow *)macWindow); break; } case WMATT_ISDARK: { 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; } case WMATT_TOPMOST: if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } if (boolValue != ((wmPtr->flags & WM_TOPMOST) != 0)) { int oldFlags = wmPtr->flags; if (boolValue) { wmPtr->flags |= WM_TOPMOST; } else { wmPtr->flags &= ~WM_TOPMOST; } ApplyWindowAttributeFlagChanges(winPtr, macWindow, wmPtr->attributes, oldFlags, 1, 0); } break; case WMATT_TRANSPARENT: if (Tcl_GetBooleanFromObj(interp, value, &boolValue) != TCL_OK) { return TCL_ERROR; } if (boolValue != ((wmPtr->flags & WM_TRANSPARENT) != 0)) { UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; if (boolValue) { wmPtr->flags |= WM_TRANSPARENT; wmPtr->attributes |= kWindowNoShadowAttribute; } else { wmPtr->flags &= ~WM_TRANSPARENT; wmPtr->attributes &= ~kWindowNoShadowAttribute; } ApplyWindowAttributeFlagChanges(winPtr, macWindow, oldAttributes, oldFlags, 1, 0); [macWindow setBackgroundColor:boolValue ? [NSColor clearColor] : nil]; [macWindow setOpaque:!boolValue]; TkMacOSXInvalidateWindow((MacDrawable *)winPtr->window, TK_PARENT_WINDOW); } break; case WMATT_CLASS: break; case WMATT_TYPE: TKLog(@"The type attribute is ignored on macOS."); break; case _WMATT_LAST_ATTRIBUTE: default: return TCL_ERROR; |
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | { Tcl_Obj *result = NULL; WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_FULLSCREEN: result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask); break; case WMATT_MODIFIED: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > | | | | 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 | { Tcl_Obj *result = NULL; WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_APPEARANCE: { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 NSAppearanceName appearance; #else NSString *appearance; #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 const char *resultString = "unrecognized"; appearance = macWindow.appearance.name; if (appearance == nil) { resultString = appearanceStrings[APPEARANCE_AUTO]; } else if (appearance == NSAppearanceNameAqua) { resultString = appearanceStrings[APPEARANCE_AQUA]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 } else if (@available(macOS 10.14, *)) { if (appearance == NSAppearanceNameDarkAqua) { resultString = appearanceStrings[APPEARANCE_DARKAQUA]; } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 } result = Tcl_NewStringObj(resultString, TCL_INDEX_NONE); break; } case WMATT_BUTTONS: { result = Tcl_NewListObj(3, NULL); if ([macWindow standardWindowButton:NSWindowCloseButton].enabled) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj("close", TCL_INDEX_NONE)); } if ([macWindow standardWindowButton:NSWindowMiniaturizeButton].enabled) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj("miniaturize", TCL_INDEX_NONE)); } if ([macWindow standardWindowButton:NSWindowZoomButton].enabled) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj("zoom", TCL_INDEX_NONE)); } break; } case WMATT_CLASS: if ([macWindow isKindOfClass:[NSPanel class]]) { result = Tcl_NewStringObj(subclassNames[subclassNSPanel], TCL_INDEX_NONE); } else { result = Tcl_NewStringObj(subclassNames[subclassNSWindow], TCL_INDEX_NONE); } break; case WMATT_FULLSCREEN: result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask); break; case WMATT_ISDARK: result = Tcl_NewBooleanObj(TkMacOSXInDarkMode((Tk_Window)winPtr)); break; case WMATT_MODIFIED: result = Tcl_NewBooleanObj([macWindow isDocumentEdited]); break; case WMATT_NOTIFY: result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal); break; case WMATT_STYLEMASK: { unsigned long styleMaskValue = [macWindow styleMask]; const styleMaskBit *bit; result = Tcl_NewListObj(9, NULL); for (bit = styleMaskBits; bit->bitname != NULL; bit++) { if (styleMaskValue & bit->bitvalue) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(bit->bitname, TCL_INDEX_NONE)); } } break; } case WMATT_TABBINGID: result = Tcl_NewStringObj([[macWindow tabbingIdentifier] UTF8String], -1); break; case WMATT_TABBINGMODE: { long mode = [macWindow tabbingMode]; const char *name = "unrecognized"; for (const tabbingMode *m = tabbingModes; m->modeName != NULL; m++) { if (m->modeValue == mode) { name = m->modeName; break; } } result = Tcl_NewStringObj(name, TCL_INDEX_NONE); break; } case WMATT_TITLEPATH: result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String], TCL_INDEX_NONE); 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", TCL_INDEX_NONE); break; case _WMATT_LAST_ATTRIBUTE: default: break; } return result; } |
︙ | ︙ | |||
1608 1609 1610 1611 1612 1613 1614 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmAttributesCmd( | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmAttributesCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int attribute = 0; NSWindow *macWindow; if (winPtr == NULL && objc == 5) { int index, isNew = 0; Tcl_Size length; /* * If we are setting an atttribute of a future window, save the value * in a hash table so we can look it up when the window is actually * created. */ if (strcmp(Tcl_GetString(objv[3]), "-class") == 0) { if (Tcl_GetIndexFromObjStruct(interp, objv[4], subclassNames, sizeof(char *), "NSWindow subclass", 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(&pathnameToSubclass, Tcl_GetString(objv[2]), &isNew); if (hPtr) { Tcl_SetHashValue(hPtr, INT2PTR(index)); return TCL_OK; } } else if (strcmp(Tcl_GetString(objv[3]), "-tabbingid") == 0) { char *identifier = Tcl_GetStringFromObj(objv[4], &length); char *value = (char *)ckalloc(length + 1); strncpy(value, identifier, length + 1); Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(&pathnameToTabbingId, Tcl_GetString(objv[2]), &isNew); if (hPtr) { Tcl_SetHashValue(hPtr, value); return TCL_OK; } } else if (strcmp(Tcl_GetString(objv[3]), "-tabbingmode") == 0) { long value = NSWindowTabbingModeAutomatic; int modeIndex; if (Tcl_GetIndexFromObjStruct(interp, objv[4], tabbingModes, sizeof(tabbingMode), "NSWindow Tabbing Mode", 0, &modeIndex) == TCL_OK) { value = tabbingModes[modeIndex].modeValue; } Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(&pathnameToTabbingMode, Tcl_GetString(objv[2]), &isNew); if (hPtr) { Tcl_SetHashValue(hPtr, value); return TCL_OK; } } } if (!winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Only -class, -tabbingid, or -tabbingmode can be set before the window exists.")); Tcl_SetErrorCode(interp, "TK", "NO_WINDOW", NULL); return TCL_ERROR; } if (winPtr && winPtr->window == None) { Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { TkMacOSXMakeRealWindowExist(winPtr); } macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); 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], TCL_INDEX_NONE)); 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... */ Tcl_Size 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; |
︙ | ︙ | |||
1683 1684 1685 1686 1687 1688 1689 | */ static int WmClientCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmClientCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; Tcl_Size 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, TCL_INDEX_NONE)); } return TCL_OK; } argv3 = Tcl_GetStringFromObj(objv[3], &length); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); |
︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | > | | 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2; Tcl_Size i, windowObjc; int gotToplevel = 0; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
1799 1800 1801 1802 1803 1804 1805 | if (wmPtr->cmapList != NULL) { ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* | | | 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | 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; } /* |
︙ | ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | */ static int WmCommandCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 | */ static int WmCommandCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_Size len; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->commandObj != NULL) { |
︙ | ︙ | |||
1885 1886 1887 1888 1889 1890 1891 | */ static int WmDeiconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 | */ static int WmDeiconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); |
︙ | ︙ | |||
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 -- | > > | 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 | ((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 -- |
︙ | ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | */ static int WmFocusmodelCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmFocusmodelCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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", TCL_INDEX_NONE)); return TCL_OK; } if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
2017 2018 2019 2020 2021 2022 2023 | */ 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. */ | | | 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 | */ 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(Tcl_Size), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window)winPtr; if (Tk_IsTopLevel(frameWin)) { MacDrawable *macWin; |
︙ | ︙ | |||
2083 2084 2085 2086 2087 2088 2089 | */ static int WmFrameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmFrameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } window = wmPtr->reparent; if (window == None) { window = Tk_WindowId((Tk_Window)winPtr); } snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)window); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmGeometryCmd -- |
︙ | ︙ | |||
2125 2126 2127 2128 2129 2130 2131 | */ static int WmGeometryCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 | */ static int WmGeometryCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); char xSign = '+', ySign = '+'; int width, height, x = wmPtr->x, y= wmPtr->y; char *argv3; |
︙ | ︙ | |||
2196 2197 2198 2199 2200 2201 2202 | */ static int WmGridCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 | */ static int WmGridCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; const char *errorMsg; if ((objc != 3) && (objc != 7)) { |
︙ | ︙ | |||
2226 2227 2228 2229 2230 2231 2232 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ | | | 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; |
︙ | ︙ | |||
2263 2264 2265 2266 2267 2268 2269 | heightInc); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; error: | | | 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 | heightInc); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; error: Tcl_SetObjResult(interp, Tcl_NewStringObj(errorMsg, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "GRID", NULL); return TCL_ERROR; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2290 2291 2292 2293 2294 2295 2296 | */ static int WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; char *argv3; Tcl_Size length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE)); } return TCL_OK; } argv3 = Tcl_GetStringFromObj(objv[3], &length); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; |
︙ | ︙ | |||
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. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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. */ Tcl_Size 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. |
︙ | ︙ | |||
2354 2355 2356 2357 2358 2359 2360 | */ static int WmIconbitmapCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 | */ static int WmIconbitmapCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; char *str; Tcl_Size len; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPixmapHint) { |
︙ | ︙ | |||
2423 2424 2425 2426 2427 2428 2429 | */ static int WmIconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 | */ static int WmIconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; } |
︙ | ︙ | |||
2504 2505 2506 2507 2508 2509 2510 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; char *argv3; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
2564 2565 2566 2567 2568 2569 2570 | */ static int WmIconnameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmIconnameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size length; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->iconName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, TCL_INDEX_NONE)); } return TCL_OK; } if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } |
︙ | ︙ | |||
2617 2618 2619 2620 2621 2622 2623 | */ static int WmIconphotoCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | < | 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 | */ static int WmIconphotoCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; } } |
︙ | ︙ | |||
2706 2707 2708 2709 2710 2711 2712 | */ static int WmIconpositionCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 | */ static int WmIconpositionCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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?"); |
︙ | ︙ | |||
2764 2765 2766 2767 2768 2769 2770 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
2821 2822 2823 2824 2825 2826 2827 | NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window); /* * The old icon should be withdrawn. */ TkpWmSetState(oldIcon, WithdrawnState); | | | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | 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( | | | | | > > > > > > > > > > > > | 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 | * 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(Tcl_Size), /* 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; |
︙ | ︙ | |||
2928 2929 2930 2931 2932 2933 2934 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; GetMaxSize(winPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->maxWidth = width; wmPtr->maxHeight = height; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; |
︙ | ︙ | |||
2982 2983 2984 2985 2986 2987 2988 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; GetMinSize(winPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->minWidth = width; wmPtr->minHeight = height; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; |
︙ | ︙ | |||
3036 3037 3038 3039 3040 3041 3042 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmOverrideredirectCmd( | | | | | | | > > > > > > > | > | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Bool boolValue; XSetWindowAttributes atts; TKWindow *win = (TKWindow *)TkMacOSXGetNSWindowForDrawable(winPtr->window); 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], &boolValue) != TCL_OK) { return TCL_ERROR; } atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); if ([NSApp macOSVersion] >= 101300) { if (boolValue) { win.styleMask |= NSWindowStyleMaskDocModalWindow; } else { win.styleMask &= ~NSWindowStyleMaskDocModalWindow; } } else { ApplyContainerOverrideChanges(winPtr, win); } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmPositionfromCmd -- |
︙ | ︙ | |||
3088 3089 3090 3091 3092 3093 3094 | */ static int WmPositionfromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmPositionfromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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) { if (wmPtr->sizeHintsFlags & USPosition) { Tcl_SetObjResult(interp, Tcl_NewStringObj("user", TCL_INDEX_NONE)); } else if (wmPtr->sizeHintsFlags & PPosition) { Tcl_SetObjResult(interp, Tcl_NewStringObj("program", TCL_INDEX_NONE)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USPosition|PPosition); } else { |
︙ | ︙ | |||
3154 3155 3156 3157 3158 3159 3160 | */ static int WmProtocolCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 | */ static int WmProtocolCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; ProtocolHandler *protPtr, *prevPtr; Atom protocol; char *cmd; Tcl_Size cmdLength; Tcl_Obj *resultObj; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } |
︙ | ︙ | |||
3194 3195 3196 3197 3198 3199 3200 | * Return the command to handle a given protocol. */ for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, | | | 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 | * Return the command to handle a given protocol. */ for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE)); return TCL_OK; } } return TCL_OK; } /* |
︙ | ︙ | |||
3255 3256 3257 3258 3259 3260 3261 | */ static int WmResizableCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | < | < | | 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 | */ static int WmResizableCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; if ((objc != 3) && (objc != 5)) { 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; |
︙ | ︙ | |||
3334 3335 3336 3337 3338 3339 3340 | */ static int WmSizefromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmSizefromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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) { if (wmPtr->sizeHintsFlags & USSize) { Tcl_SetObjResult(interp, Tcl_NewStringObj("user", TCL_INDEX_NONE)); } else if (wmPtr->sizeHintsFlags & PSize) { Tcl_SetObjResult(interp, Tcl_NewStringObj("program", TCL_INDEX_NONE)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USSize|PSize); } else { |
︙ | ︙ | |||
3400 3401 3402 3403 3404 3405 3406 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkWindow **windows, **windowPtr; static const char *const optionStrings[] = { "isabove", "isbelow", NULL }; enum options { |
︙ | ︙ | |||
3469 3470 3471 3472 3473 3474 3475 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "TkWmStackorderToplevel failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "STACK", "FAIL", NULL); return TCL_ERROR; } for (windowPtr = windows; *windowPtr ; windowPtr++) { if (*windowPtr == winPtr) { index1 = windowPtr - windows; |
︙ | ︙ | |||
3499 3500 3501 3502 3503 3504 3505 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } | | | 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 | 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; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3526 3527 3528 3529 3530 3531 3532 | */ static int WmStateCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 | */ static int WmStateCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; } |
︙ | ︙ | |||
3599 3600 3601 3602 3603 3604 3605 | TkpWmSetState(winPtr, WithdrawnState); break; default: /* OPT_ZOOMED */ TkpWmSetState(winPtr, ZoomState); break; } } else if (wmPtr->iconFor != NULL) { | | | | | | | 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 | TkpWmSetState(winPtr, WithdrawnState); break; default: /* OPT_ZOOMED */ TkpWmSetState(winPtr, ZoomState); break; } } else if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("icon", TCL_INDEX_NONE)); } else { if (wmPtr->hints.initial_state == NormalState || wmPtr->hints.initial_state == ZoomState) { wmPtr->hints.initial_state = (TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState); } switch (wmPtr->hints.initial_state) { case NormalState: Tcl_SetObjResult(interp, Tcl_NewStringObj("normal", TCL_INDEX_NONE)); break; case IconicState: Tcl_SetObjResult(interp, Tcl_NewStringObj("iconic", TCL_INDEX_NONE)); break; case WithdrawnState: Tcl_SetObjResult(interp, Tcl_NewStringObj("withdrawn", TCL_INDEX_NONE)); break; case ZoomState: Tcl_SetObjResult(interp, Tcl_NewStringObj("zoomed", TCL_INDEX_NONE)); break; } } return TCL_OK; } /* |
︙ | ︙ | |||
3646 3647 3648 3649 3650 3651 3652 | */ static int WmTitleCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmTitleCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; Tcl_Size length; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( wmPtr->titleUid ? wmPtr->titleUid : winPtr->nameUid, TCL_INDEX_NONE)); return TCL_OK; } argv3 = Tcl_GetStringFromObj(objv[3], &length); wmPtr->titleUid = Tk_GetUid(argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED) && !Tk_IsEmbedded(winPtr)) { TkSetWMName(winPtr, wmPtr->titleUid); |
︙ | ︙ | |||
3694 3695 3696 3697 3698 3699 3700 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | > | 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 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window container; TkWindow *containerPtr, *w; WmInfo *wmPtr2; Transient *transient; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?window?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->container != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(wmPtr->container), TCL_INDEX_NONE)); } return TCL_OK; } 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; | | | 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 | "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; } |
︙ | ︙ | |||
3874 3875 3876 3877 3878 3879 3880 | */ static int WmWithdrawCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 | */ static int WmWithdrawCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; |
︙ | ︙ | |||
3995 3996 3997 3998 3999 4000 4001 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) | | < | 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) && ((wmPtr->sizeHintsFlags & PBaseSize) == PBaseSize)) { return; } /* * If gridding was previously off, then forget about any window size * requests made by the user or via "wm geometry": these are in pixel units * and there's no easy way to translate them to grid units since the new |
︙ | ︙ | |||
4026 4027 4028 4029 4030 4031 4032 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; | | | 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; wmPtr->sizeHintsFlags |= PBaseSize; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; } } |
︙ | ︙ | |||
4074 4075 4076 4077 4078 4079 4080 | } wmPtr = winPtr->wmInfoPtr; if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; | | | 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 | } wmPtr = winPtr->wmInfoPtr; if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; |
︙ | ︙ | |||
4111 4112 4113 4114 4115 4116 4117 | * the structural change. * *---------------------------------------------------------------------- */ static void TopLevelEventProc( | | | | 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 | * the structural change. * *---------------------------------------------------------------------- */ static void TopLevelEventProc( void *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 |
︙ | ︙ | |||
4198 4199 4200 4201 4202 4203 4204 | * from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( | | | | 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 | * from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( void *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)) { | | | | 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 | * 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; } | | | 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 | 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)) { | | | 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 | /* * 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. */ | < < | | 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 | 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; /* | | | 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 | 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; } | | | 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 | TkWindow *winPtr, Tk_Uid titleUid) { if (Tk_IsEmbedded(winPtr)) { return; } NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:TCL_INDEX_NONE]; [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title]; [title release]; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5500 5501 5502 5503 5504 5505 5506 | */ Tk_Window Tk_MacOSXGetTkWindow( void *w) { Window window = None; | < | > | > > > | 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 | */ 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 */ { | | | | 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 | */ 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) && |
︙ | ︙ | |||
5605 5606 5607 5608 5609 5610 5611 | * Changes the style of a new Mac window. * *---------------------------------------------------------------------- */ int TkUnsupported1ObjCmd( | | | | | | 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 | * Changes the style of a new Mac window. * *---------------------------------------------------------------------- */ int TkUnsupported1ObjCmd( void *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", NULL }; enum SubCmds { TKMWS_APPEARANCE, TKMWS_ISDARK, TKMWS_STYLE }; Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; int index; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
5648 5649 5650 5651 5652 5653 5654 | switch((enum SubCmds) index) { case TKMWS_STYLE: if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?"); return TCL_ERROR; } return WmWinStyle(interp, winPtr, objc, objv); | < < < < < < < < < < < < | | 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 | switch((enum SubCmds) index) { case TKMWS_STYLE: if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?"); return TCL_ERROR; } return WmWinStyle(interp, winPtr, objc, objv); case TKMWS_APPEARANCE: if ([NSApp macOSVersion] < 100900) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL); return TCL_ERROR; } if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?appearancename?"); return TCL_ERROR; } |
︙ | ︙ | |||
5714 5715 5716 5717 5718 5719 5720 | *---------------------------------------------------------------------- */ static int WmWinStyle( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ | | | 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 | *---------------------------------------------------------------------- */ static int WmWinStyle( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { struct StrIntMap { const char *strValue; UInt64 intValue; }; static const struct StrIntMap classMap[] = { |
︙ | ︙ | |||
5785 5786 5787 5788 5789 5790 5791 | { "canJoinAllSpaces", tkCanJoinAllSpacesAttribute }, { "moveToActiveSpace", tkMoveToActiveSpaceAttribute }, { "nonActivating", tkNonactivatingPanelAttribute }, { "hud", tkHUDWindowAttribute }, { NULL, 0 } }; | | > | | 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 | { "canJoinAllSpaces", tkCanJoinAllSpacesAttribute }, { "moveToActiveSpace", tkMoveToActiveSpaceAttribute }, { "nonActivating", tkNonactivatingPanelAttribute }, { "hud", tkHUDWindowAttribute }, { NULL, 0 } }; int index; Tcl_Size i; WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc == 3) { Tcl_Obj *attributeList, *newResult = NULL; UInt64 attributes; for (i = 0; classMap[i].strValue != NULL; i++) { if (wmPtr->macClass == classMap[i].intValue) { newResult = Tcl_NewStringObj(classMap[i].strValue, TCL_INDEX_NONE); break; } } if (newResult == NULL) { Tcl_Panic("invalid class"); } |
︙ | ︙ | |||
5819 5820 5821 5822 5823 5824 5825 | attributes &= ~intValue; break; } } for (i = 0; attrMap[i].strValue != NULL; i++) { if (attributes & attrMap[i].intValue) { Tcl_ListObjAppendElement(NULL, attributeList, | | | | 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 | attributes &= ~intValue; break; } } for (i = 0; attrMap[i].strValue != NULL; i++) { if (attributes & attrMap[i].intValue) { Tcl_ListObjAppendElement(NULL, attributeList, Tcl_NewStringObj(attrMap[i].strValue, TCL_INDEX_NONE)); } } Tcl_ListObjAppendElement(NULL, newResult, attributeList); Tcl_SetObjResult(interp, newResult); } else { Tcl_Size attrObjc; Tcl_Obj **attrObjv = NULL; WindowClass macClass; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; if (Tcl_GetIndexFromObjStruct(interp, objv[3], classMap, sizeof(struct StrIntMap), "class", 0, &index) != TCL_OK) { |
︙ | ︙ | |||
5878 5879 5880 5881 5882 5883 5884 | return TCL_OK; } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 | return TCL_OK; } /* *---------------------------------------------------------------------- * * 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. * |
︙ | ︙ | |||
5985 5986 5987 5988 5989 5990 5991 | *---------------------------------------------------------------------- */ static int WmWinAppearance( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ | | | | | < > | | < > | 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 | *---------------------------------------------------------------------- */ static int WmWinAppearance( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ Tcl_Size 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; #else 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, | | | | < < | 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 | 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 if (@available(macOS 10.14, *)) { win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 break; default: win.appearance = nil; } } Tcl_SetObjResult(interp, result); return TCL_OK; #endif } /* *---------------------------------------------------------------------- * * TkpMakeMenuWindow -- |
︙ | ︙ | |||
6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 | void TkMacOSXMakeRealWindowExist( TkWindow *winPtr) /* Tk window. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; MacDrawable *macWin; WindowClass macClass; Bool overrideRedirect = Tk_Attributes((Tk_Window)winPtr)->override_redirect; if (TkMacOSXHostToplevelExists(winPtr)) { return; } macWin = (MacDrawable *)winPtr->window; /* * If this is embedded, make sure its container's toplevel exists, then * return... */ if (Tk_IsEmbedded(winPtr)) { | > > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 6749 6750 6751 6752 6753 6754 6755 6756 6757 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 | void TkMacOSXMakeRealWindowExist( TkWindow *winPtr) /* Tk window. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; MacDrawable *macWin; WindowClass macClass; Class winClass = nil; Bool overrideRedirect = Tk_Attributes((Tk_Window)winPtr)->override_redirect; Tcl_HashEntry *hPtr = NULL; NSUInteger styleMask; NSString *identifier; char *tabbingId = NULL; long tabbingMode = NSWindowTabbingModeAutomatic; static int initialized = 0; if (TkMacOSXHostToplevelExists(winPtr)) { return; } macWin = (MacDrawable *)winPtr->window; /* * 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; } Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container"); return; /* * TODO: Here we should handle out of process embedding. */ } if ([NSApp macOSVersion] >= 101300) { /* * Prior to macOS 10.12 the styleMask was readonly. From macOS 10.12 * onward, the styleMask can replace the Carbon window classes and * attributes. */ int index; if (!initialized) { Tcl_InitHashTable(&pathnameToSubclass, TCL_STRING_KEYS); Tcl_InitHashTable(&pathnameToTabbingId, TCL_STRING_KEYS); Tcl_InitHashTable(&pathnameToTabbingMode, TCL_STRING_KEYS); initialized = 1; } hPtr = Tcl_FindHashEntry(&pathnameToSubclass, Tk_PathName(winPtr)); index = hPtr ? PTR2INT(Tcl_GetHashValue(hPtr)) : subclassNSWindow; switch(index) { case subclassNSPanel: winClass = [TKPanel class]; styleMask = (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable | NSWindowStyleMaskUtilityWindow | NSWindowStyleMaskNonactivatingPanel ); break; default: winClass = [TKWindow class]; styleMask = (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable ); break; } if (overrideRedirect) { styleMask |= NSWindowStyleMaskDocModalWindow; } /* Help windows (used for tooltips) should have stylemask 0. */ if (wmPtr->macClass == kHelpWindowClass) { styleMask = 0; } if (hPtr) { Tcl_DeleteHashEntry(hPtr); } hPtr = Tcl_FindHashEntry(&pathnameToTabbingId, Tk_PathName(winPtr)); if (hPtr) { tabbingId = (char *)Tcl_GetHashValue(hPtr); Tcl_DeleteHashEntry(hPtr); } hPtr = Tcl_FindHashEntry(&pathnameToTabbingMode, Tk_PathName(winPtr)); if (hPtr) { tabbingMode = PTR2INT(Tcl_GetHashValue(hPtr)); Tcl_DeleteHashEntry(hPtr); } } else { /* * If this is an override-redirect window, the NSWindow is created first as * a document window then converted to a simple window. */ if (overrideRedirect) { wmPtr->macClass = kDocumentWindowClass; } macClass = wmPtr->macClass; wmPtr->attributes &= (tkAlwaysValidAttributes | macClassAttrs[macClass].validAttrs); wmPtr->flags |= macClassAttrs[macClass].flags | ((wmPtr->attributes & kWindowResizableAttribute) ? 0 : WM_WIDTH_NOT_RESIZABLE|WM_HEIGHT_NOT_RESIZABLE); UInt64 attributes = (wmPtr->attributes & ~macClassAttrs[macClass].forceOffAttrs) | macClassAttrs[macClass].forceOnAttrs; styleMask = macClassAttrs[macClass].styleMask | ((attributes & kWindowNoTitleBarAttribute) ? 0 : NSTitledWindowMask) | ((attributes & kWindowCloseBoxAttribute) ? NSClosableWindowMask : 0) | ((attributes & kWindowCollapseBoxAttribute) ? NSMiniaturizableWindowMask : 0) | ((attributes & kWindowResizableAttribute) ? NSResizableWindowMask : 0) | ((attributes & kWindowMetalAttribute) ? NSTexturedBackgroundWindowMask : 0) | ((attributes & kWindowUnifiedTitleAndToolbarAttribute) ? NSUnifiedTitleAndToolbarWindowMask : 0) | ((attributes & kWindowSideTitlebarAttribute) ? 1 << 9 : 0) | (attributes >> WM_NSMASK_SHIFT); winClass = (macClass == kDrawerWindowClass ? [TKDrawerWindow class] : (styleMask & (NSUtilityWindowMask|NSDocModalWindowMask| NSNonactivatingPanelMask|NSHUDWindowMask)) ? [TKPanel class] : [TKWindow class]); } NSRect structureRect = [winClass frameRectForContentRect:NSZeroRect styleMask:styleMask]; NSRect contentRect = NSMakeRect(5 - structureRect.origin.x, TkMacOSXZeroScreenHeight() - (TkMacOSXZeroScreenTop() + 5 + structureRect.origin.y + structureRect.size.height + 200), 200, 200); if (wmPtr->hints.initial_state == WithdrawnState) { //// ??????? } TKWindow *window = [[winClass alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES]; if (!window) { Tcl_Panic("couldn't allocate new Mac window"); } #if MAC_OS_X_VERSION_MAX_ALLOWED > 101200 if (tabbingId) { identifier = [NSString stringWithUTF8String:tabbingId]; } else { identifier = [NSString stringWithUTF8String:Tk_PathName(winPtr)]; } [window setTabbingIdentifier: identifier]; [window setTabbingMode: tabbingMode]; #endif if (tabbingId) { ckfree(tabbingId); } TKContentView *contentView = [[TKContentView alloc] initWithFrame:NSZeroRect]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; /* * AppKit calls the viewDidChangeEffectiveAppearance method when the * user changes the Accent Color but not when the user changes the * Highlight Color. So we register to receive KVO notifications for * Highlight Color as well. */ [preferences addObserver:contentView forKeyPath:@"AppleHighlightColor" options:NSKeyValueObservingOptionNew context:NULL]; #endif [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)) { /* |
︙ | ︙ | |||
6227 6228 6229 6230 6231 6232 6233 | macWin->flags |= TK_HOST_EXISTS; if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); | > > > | | > > | 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 | macWin->flags |= TK_HOST_EXISTS; if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); if ([NSApp macOSVersion] >= 101300) { window.styleMask |= NSWindowStyleMaskDocModalWindow; } else { 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); | < | | 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 | 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]; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
6385 6386 6387 6388 6389 6390 6391 | * * Side effects: * May maximize, minimize, restore, or withdraw a window. * *---------------------------------------------------------------------- */ | | | > > > > > > > > > > > > > > | > > | 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 | * * Side effects: * May maximize, minimize, restore, or withdraw a window. * *---------------------------------------------------------------------- */ int TkpWmSetState( TkWindow *winPtr, /* Toplevel window to operate on. */ int state) /* One of IconicState, ZoomState, NormalState, * or WithdrawnState. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; NSWindow *macWin; wmPtr->hints.initial_state = state; if (wmPtr->flags & WM_NEVER_MAPPED) { goto setStateEnd; } 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)){} setStateEnd: return 1; } /* *---------------------------------------------------------------------- * * TkpIsWindowFloating -- * |
︙ | ︙ | |||
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 | > | 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 | 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) { | | | 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 | 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) */ | | | 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 | * 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; } | | | 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 | 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); |
︙ | ︙ | |||
7174 7175 7176 7177 7178 7179 7180 | TkWindow *winPtr, /* Toplevel window to operate on. */ int *maxWidthPtr, /* Where to store the current maximum width of * the window. */ int *maxHeightPtr) /* Where to store the current maximum height * of the window. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; | | | 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 | TkWindow *winPtr, /* Toplevel window to operate on. */ int *maxWidthPtr, /* Where to store the current maximum width of * the window. */ int *maxHeightPtr) /* Where to store the current maximum height * of the window. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect *maxBounds = (NSRect*)(ScreenOfDisplay(winPtr->display, 0)->ext_data); if (wmPtr->maxWidth > 0) { *maxWidthPtr = wmPtr->maxWidth; } else { int maxWidth = maxBounds->size.width - wmPtr->xInParent; if (wmPtr->gridWin != NULL) { |
︙ | ︙ |
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 |
︙ | ︙ | |||
167 168 169 170 171 172 173 | * be. */ /* * List of children of the toplevel which have private colormaps. */ TkWindow **cmapList; /* Array of window with private colormaps. */ | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | * be. */ /* * List of children of the toplevel which have private colormaps. */ TkWindow **cmapList; /* Array of window with private colormaps. */ Tcl_Size cmapCount; /* Number of windows in array. */ /* * Miscellaneous information. */ ProtocolHandler *protPtr; /* First in list of protocol handlers for this * window (NULL means none). */ |
︙ | ︙ |
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 20 21 22 23 24 25 | /* * 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. */ #define XLIB_ILLEGAL_ACCESS #include "tkMacOSXPrivate.h" #include "tkMacOSXInt.h" #include <IOKit/IOKitLib.h> #include <IOKit/hidsystem/IOHIDShared.h> /* |
︙ | ︙ | |||
75 76 77 78 79 80 81 | TkMacOSXDisplayChanged( Display *display) { Screen *screen; NSArray *nsScreens; | | | | | | | | | 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 | TkMacOSXDisplayChanged( Display *display) { Screen *screen; NSArray *nsScreens; if (display == NULL || (((_XPrivDisplay)(display))->screens) == NULL) { return; } screen = (((_XPrivDisplay)(display))->screens); nsScreens = [NSScreen screens]; if (nsScreens && [nsScreens count]) { NSScreen *s = [nsScreens objectAtIndex:0]; NSRect bounds = [s frame]; NSRect maxBounds = NSZeroRect; DefaultDepthOfScreen(screen) = NSBitsPerPixelFromDepth([s depth]); WidthOfScreen(screen) = bounds.size.width; HeightOfScreen(screen) = bounds.size.height; WidthMMOfScreen(screen) = (bounds.size.width * 381 + 720) / 1440; /* = 3/4 * 254/720 */ HeightMMOfScreen(screen) = (bounds.size.height * 381 + 720) / 1440; /* = 3/4 * 254/720 */ for (s in nsScreens) { maxBounds = NSUnionRect(maxBounds, [s visibleFrame]); } *((NSRect *)screen->ext_data) = maxBounds; } } |
︙ | ︙ | |||
182 183 184 185 186 187 188 | */ TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; | < | > > | | 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 | */ TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; if (gMacDisplay != NULL) { if (strcmp(DisplayString(gMacDisplay->display), display_name) == 0) { return gMacDisplay; } else { return NULL; } } NSAutoreleasePool *pool = [NSAutoreleasePool new]; display = XkbOpenDisplay(display_name, NULL, NULL, NULL, NULL, NULL); /* * Initialize screen bits that may change */ TkMacOSXDisplayChanged(display); |
︙ | ︙ | |||
228 229 230 231 232 233 234 | TCL_UNUSED(const char *), int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason) { | | | | 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 | TCL_UNUSED(const char *), int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason) { _XPrivDisplay display = (_XPrivDisplay)ckalloc(sizeof(Display)); Screen *screen = (Screen *)ckalloc(sizeof(Screen)); int fd = 0; NSArray *cgVers; static char vendor[25] = ""; static NSRect maxBounds = {{0, 0}, {0, 0}}; bzero(display, sizeof(Display)); bzero(screen, sizeof(Screen)); display->resource_alloc = MacXIdAlloc; LastKnownRequestProcessed(display) = 1; display->qlen = 0; display->fd = fd; display->screens = screen; display->nscreens = 1; display->default_screen = 0; display->display_name = (char *) macScreenName; |
︙ | ︙ | |||
288 289 290 291 292 293 294 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMajor, (SInt32*)&major); Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor); Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch); #else NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; | | | | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMajor, (SInt32*)&major); Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor); Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch); #else NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; major = (int)systemVersion.majorVersion; minor = (int)systemVersion.minorVersion; patch = (int)systemVersion.patchVersion; #endif display->release = major << 16 | minor << 8 | patch; } if (ev_rtrn) *ev_rtrn = 0; if (err_rtrn) *err_rtrn = 0; |
︙ | ︙ | |||
325 326 327 328 329 330 331 | *---------------------------------------------------------------------- */ void TkpCloseDisplay( TkDisplay *displayPtr) { | | | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | *---------------------------------------------------------------------- */ void TkpCloseDisplay( TkDisplay *displayPtr) { _XPrivDisplay display = (_XPrivDisplay)displayPtr->display; if (gMacDisplay != displayPtr) { Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display"); } gMacDisplay = NULL; if (display->screens != NULL) { if (DefaultVisualOfScreen(ScreenOfDisplay(display, 0)) != NULL) { ckfree(DefaultVisualOfScreen(ScreenOfDisplay(display, 0))); } ckfree(display->screens); } ckfree(display); } /* |
︙ | ︙ | |||
451 452 453 454 455 456 457 | } char * XGetAtomName( Display *display, TCL_UNUSED(Atom)) { | | | | | 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 | } char * XGetAtomName( Display *display, TCL_UNUSED(Atom)) { LastKnownRequestProcessed(display)++; return NULL; } XErrorHandler XSetErrorHandler( TCL_UNUSED(XErrorHandler)) { return DefaultErrorHandler; } Window XRootWindow( Display *display, TCL_UNUSED(int)) { LastKnownRequestProcessed(display)++; return ROOT_ID; } int XGetGeometry( Display *display, Drawable d, Window *root_return, int *x_return, int *y_return, unsigned int *width_return, unsigned int *height_return, unsigned int *border_width_return, unsigned int *depth_return) { TkWindow *winPtr = ((MacDrawable *)d)->winPtr; LastKnownRequestProcessed(display)++; *root_return = ROOT_ID; if (winPtr) { *x_return = Tk_X(winPtr); *y_return = Tk_Y(winPtr); *width_return = Tk_Width(winPtr); *height_return = Tk_Height(winPtr); *border_width_return = winPtr->changes.border_width; |
︙ | ︙ | |||
799 800 801 802 803 804 805 | TCL_UNUSED(Atom), Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, TCL_UNUSED(unsigned char **)) { | | | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | TCL_UNUSED(Atom), Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, TCL_UNUSED(unsigned char **)) { LastKnownRequestProcessed(display)++; *actual_type_return = None; *actual_format_return = *bytes_after_return = 0; *nitems_return = 0; return 0; } int |
︙ | ︙ | |||
855 856 857 858 859 860 861 | Display* display, TCL_UNUSED(Window), TCL_UNUSED(const char *)) { /* * This is a no-op, no icon name for Macs. */ | | > > > > > > > > | | < < < < < < < < < < < < < < < < < < < < < < < < | 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 | Display* display, TCL_UNUSED(Window), TCL_UNUSED(const char *)) { /* * This is a no-op, no icon name for Macs. */ LastKnownRequestProcessed(display)++; return Success; } Bool XFilterEvent( TCL_UNUSED(XEvent *), TCL_UNUSED(Window)) { return 0; } int XForceScreenSaver( Display* display, TCL_UNUSED(int)) { /* * This function is just a no-op. It is defined to reset the screen saver. * However, there is no real way to do this on a Mac. Let me know if there * is! */ LastKnownRequestProcessed(display)++; return Success; } /* *---------------------------------------------------------------------- * * TkGetServerInfo -- * * Given a window, this procedure returns information about the window * server for that window. This procedure provides the guts of the "winfo |
︙ | ︙ | |||
1060 1061 1062 1063 1064 1065 1066 | int XGetInputFocus( Display *display, TCL_UNUSED(Window *), TCL_UNUSED(int *)) { | | | | 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 | int XGetInputFocus( Display *display, TCL_UNUSED(Window *), TCL_UNUSED(int *)) { LastKnownRequestProcessed(display)++; return Success; } VisualID XVisualIDFromVisual( Visual *visual) { return visual->visualid; } XAfterFunction XSynchronize( Display *display, TCL_UNUSED(Bool)) { LastKnownRequestProcessed(display)++; return NULL; } int XUngrabServer( TCL_UNUSED(Display *)) { |
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 | return Success; } int XNoOp( Display *display) { | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | return Success; } int XNoOp( Display *display) { LastKnownRequestProcessed(display)++; return 0; } int XGrabServer( TCL_UNUSED(Display *)) { |
︙ | ︙ |
Changes to macosx/ttkMacOSXTheme.c.
1 2 3 4 5 | /* * ttkMacOSXTheme.c -- * * Tk theme engine for Mac OSX, using the Appearance Manager API. * | | | | | | | | 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 © 2004 Joe English * Copyright © 2005 Neil Madden * Copyright © 2006-2009 Daniel A. Steffen <[email protected]> * Copyright © 2008-2009 Apple Inc. * Copyright © 2009 Kevin Walzer/WordTech Communications LLC. * 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. * * 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 798 799 800 | * * 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, Ttk_State 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 TkSidebarButton: bounds.size.height += 8; 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, Ttk_State 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, Ttk_State 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) | > > > > > > | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | 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); } /*---------------------------------------------------------------------- | > > > | > | > > > > > > > > > > > > > > > | > > > > | < | | | > > > > > > > > > > > > > > > | > | > > > > > | > > > > > > | > | > > > > > > > > | > > | < > > | > | < > > > > > > > > > > > > > > > > > | > > > | > > > > > | > > | > > > > | < > | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > | < | | > > > > | | < > > > | > > > > | > > | > > > | | > | > | | | > | > > | > > > | > > > > > > > > | | | > | > > > > > > > > > > > > > > > > > > > > < > | | > | > > | > > > > > > > > > > > > | > > > > > > > > > > > | < > | > > > | < < < < < | > > > > > > | < > > | > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > | > > | < < | < | | < < | | < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < < < < | < < < < < < < < > > > > > > | > > | > > > | < < > | | | | > | > | < | | > | < | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < | > | < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < > | > > > | | | | < | | | | | | < < < < < < < < < < | < < | < | | | | | | | < > > > > | > > > > > > > | > > > | > > > > > | > > > > > > > > > | > > | | | < < | < < | | | | | | < < < | < | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < | < < | < < | < < < < < < < < | < < < < < < | < < < < < < < < < < < < < < < < < < < < > | < | < < < < < < | | < < < < < < < | < < < | < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < < < | < < < < | | < | < < < < < < < < < < < | < < < < < | < < < < | < < < < < < < < < | < < < < < | < < < < < | < < < < | < | < < < < < < < < < | < < < < < < < | > < < | < | > > > > > | > | | | | | > > > > > | > > > > > > > > > > > > > | > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < | | | | | | | | | | | > > > | | < | | | | 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 | {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 TkSidebarButton: DrawGrayButton(context, bounds, &sidebarDesign, 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 TkSidebarButton: *paddingPtr = Ttk_MakePadding(30, 10, 30, 10); return; 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: case TkSidebarButton: 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( | | | | | | < | < | | > > > > > > | | | | | | | | | < < < < < | | | | | | | | | 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 | * * <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." * | < < | | | | | | | | | | 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 | /*---------------------------------------------------------------------- * +++ 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( | | | | | | | | | | > > | | | < < < | < < < | < < < < < < < | < < | | > > > > | | | 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 | 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), | | | | | 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 | 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. */ | > | | | | | | | < < < < | < < < | | | > > > < | 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 | * 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. */ | | | > > > > > > > > > > > > > > > | | | | | | | > | | | < < < < < < < | < < < < < < < < | | > | | | | | | 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 | * 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, | | | | | | | | | < < < < < | | | | | | | | < > | | < < < | < > | > | | | > | 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 | {"-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); Ttk_GetOrientFromObj(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( | | | | | | 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 | * 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), |
︙ | ︙ | |||
2244 2245 2246 2247 2248 2249 2250 | Tcl_Obj *modeObj; /* progress bar mode */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(PbarElement, orientObj), "horizontal"}, {"-value", TK_OPTION_DOUBLE, | | | | | | | | | | | > > | | > | < | > > > | > > > | < < < | | | < < < < < < | < < | < | 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 | Tcl_Obj *modeObj; /* progress bar mode */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(PbarElement, orientObj), "horizontal"}, {"-value", TK_OPTION_DOUBLE, offsetof(PbarElement, valueObj), "0.0"}, {"-maximum", TK_OPTION_DOUBLE, offsetof(PbarElement, maximumObj), "100.0"}, {"-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)); Ttk_GetOrientFromObj(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( | | | | | < < < < < < < < < < < < < < | | | < | < | < < < > | | | | | | | | | | < | > | > > > > | | | < < | | 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 | 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; Ttk_GetOrientFromObj(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; Ttk_GetOrientFromObj(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; Ttk_GetOrientFromObj(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; Ttk_GetOrientFromObj(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( | | | | | | 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 | 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( | | | | | | | | | 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 | * * 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, Ttk_State state) { CGRect bounds = BoxToRect(d, b); const HIThemeSeparatorDrawInfo info = { .version = 0, /* Separator only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), |
︙ | ︙ | |||
2653 2654 2655 2656 2657 2658 2659 | * +++ Size grip elements -- (obsolete) */ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( | | | | | | | | | | 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 | * +++ 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, Ttk_State state) { CGRect bounds = BoxToRect(d, b); HIThemeGrowBoxDrawInfo info = { .version = 0, /* Grow box only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), |
︙ | ︙ | |||
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( | | | < | < | < < < | < | | 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 | * 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, void *elementRecord, Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), Ttk_State state) { FillElementDraw(clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); } static Ttk_ElementSpec FillElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
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( | | | | 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 | * <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 | | | | | | | | | | | | | | 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 | 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, | | | < < < | < | 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 | 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 | | | | | | | | | 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 | /*---------------------------------------------------------------------- * +++ 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, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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)))) /* Sidebar Button - text only radio button for sidebars */ TTK_LAYOUT("SidebarButton", TTK_GROUP("SidebarButton.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) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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); | > > > > > > > > > > > > > > | > > > | > | 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 | 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, "SidebarButton.button", &ButtonElementSpec, &SidebarButtonParams); 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); |
︙ | ︙ | |||
3277 3278 3279 3280 3281 3282 3283 | Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION); return TCL_OK; } | | | | 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 | Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION); return TCL_OK; } MODULE_SCOPE int Ttk_MacOSXPlatformInit( Tcl_Interp *interp) { return AquaTheme_Init(interp); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
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 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | /* * 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 sidebarDesign = { .radius = 8.0, .palettes = { { .light = {.face = 210.0, .top = 210.0, .side = 210.0, .bottom = 210.0}, .dark = {.face = 129.0, .top = 129.0, .side = 129.0, .bottom = 129.0}, .onBits = TTK_STATE_SELECTED, .offBits = 0 }, { .light = {.face = 210.0, .top = 210.0, .side = 210.0, .bottom = 210.0}, .dark = {.face = 129.0, .top = 129.0, .side = 129.0, .bottom = 129.0}, .onBits = TTK_STATE_PRESSED, .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 #define TkSidebarButton 0x8005 /* * 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}, SidebarButtonParams = {TkSidebarButton, NoThemeMetric, 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 |
︙ | ︙ | |||
24 25 26 27 28 29 30 | test bell-1.4 {bell command} -body { bell -nice -displayof } -returnCodes {error} -result {wrong # args: should be "bell ?-displayof window? ?-nice?"} test bell-1.5 {bell command} -body { bell -nice -nice -nice | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | test bell-1.4 {bell command} -body { bell -nice -displayof } -returnCodes {error} -result {wrong # args: should be "bell ?-displayof window? ?-nice?"} test bell-1.5 {bell command} -body { bell -nice -nice -nice } -returnCodes {ok} -result {} ;#keep -result {} and -returnCodes {ok} for clarity? test bell-1.6 {bell command} -body { bell -displayof . -nice } -returnCodes {ok} -result {} test bell-1.7 {bell command} -body { bell -nice -displayof . -nice |
︙ | ︙ |
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 | # 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 toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks foreach p [event info] {event delete $p} foreach event [bind Test] { |
︙ | ︙ | |||
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 | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # 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 | | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | .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 :"} | | | | | | | | | | | | 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 | } -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)"} | | | | 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 | 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)}} |
︙ | ︙ | |||
573 574 575 576 577 578 579 | bind .t.f <Button> {lappend x "%W z (.t.f <Button> binding)"} event generate .t.f <Button-1> event generate .t.f <Button-2> return $x } -cleanup { destroy .t.f } -result {{.t.f z (.t.f <Button-1> binding)} {.t.f z (.t.f <Button> binding)}} | | | | 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 | bind .t.f <Button> {lappend x "%W z (.t.f <Button> binding)"} event generate .t.f <Button-1> event generate .t.f <Button-2> return $x } -cleanup { destroy .t.f } -result {{.t.f z (.t.f <Button-1> binding)} {.t.f z (.t.f <Button> binding)}} test bind-13.10 {Tk_BindEvent procedure: don't ignore NotifyInferior - bug 47d4f29159} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <Enter> "lappend x Enter%#" bind .t.f <Leave> "lappend x Leave%#" event generate .t.f <Enter> -serial 100 -detail NotifyAncestor event generate .t.f <Enter> -serial 101 -detail NotifyInferior event generate .t.f <Leave> -serial 102 -detail NotifyAncestor event generate .t.f <Leave> -serial 103 -detail NotifyInferior return $x } -cleanup { destroy .t.f } -result {Enter100 Enter101 Leave102 Leave103} test bind-13.11 {Tk_BindEvent procedure: collapse Motions} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { |
︙ | ︙ | |||
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" | | | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | 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> | > > | 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 | 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 | > > > | 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 | 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 | | | 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | 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> | > > > > > > > > > > > > > | | 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 | 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 -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>> | | | | 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 | } -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>> | | | 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | } -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>> | | | | 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 | 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] |
︙ | ︙ | |||
2969 2970 2971 2972 2973 2974 2975 | set x {} } -body { bind .t.f <Configure> "lappend x %B" event generate .t.f <Configure> -borderwidth xyz return $x } -cleanup { destroy .t.f | | | 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 | set x {} } -body { bind .t.f <Configure> "lappend x %B" event generate .t.f <Configure> -borderwidth xyz return $x } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.25 {HandleEventGenerate: options <Configure> -borderwidth 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
3211 3212 3213 3214 3215 3216 3217 | update set x {} } -body { bind .t.f <Expose> "lappend x %h" event generate .t.f <Expose> -height xyz } -cleanup { destroy .t.f | | | 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 | update set x {} } -body { bind .t.f <Expose> "lappend x %h" event generate .t.f <Expose> -height xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.42 {HandleEventGenerate: options <Expose> -height 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
3643 3644 3645 3646 3647 3648 3649 | update set x {} } -body { bind .t.f <Key> "lappend x %X" event generate .t.f <Key> -rootx xyz } -cleanup { destroy .t.f | | | 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 | update set x {} } -body { bind .t.f <Key> "lappend x %X" event generate .t.f <Key> -rootx xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.74 {HandleEventGenerate: options <Key> -rootx 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
3753 3754 3755 3756 3757 3758 3759 | update set x {} } -body { bind .t.f <Key> "lappend x %Y" event generate .t.f <Key> -rooty xyz } -cleanup { destroy .t.f | | | 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 | update set x {} } -body { bind .t.f <Key> "lappend x %Y" event generate .t.f <Key> -rooty xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.82 {HandleEventGenerate: options <Key> -rooty 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
4343 4344 4345 4346 4347 4348 4349 | update set x {} } -body { bind .t.f <Expose> "lappend x %w" event generate .t.f <Expose> -width xyz } -cleanup { destroy .t.f | | | 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 | update set x {} } -body { bind .t.f <Expose> "lappend x %w" event generate .t.f <Expose> -width xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.125 {HandleEventGenerate: options <Expose> -width 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
4548 4549 4550 4551 4552 4553 4554 | update set x {} } -body { bind .t.f <Key> "lappend x %x" event generate .t.f <Key> -x xyz } -cleanup { destroy .t.f | | | 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 | update set x {} } -body { bind .t.f <Key> "lappend x %x" event generate .t.f <Key> -x xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.140 {HandleEventGenerate: options <Key> -x 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
4714 4715 4716 4717 4718 4719 4720 | update set x {} } -body { bind .t.f <Key> "lappend x %y" event generate .t.f <Key> -y xyz } -cleanup { destroy .t.f | | | 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 | update set x {} } -body { bind .t.f <Key> "lappend x %y" event generate .t.f <Key> -y xyz } -cleanup { destroy .t.f } -returnCodes error -result {expected screen distance but got "xyz"} test bind-22.152 {HandleEventGenerate: options <Key> -y 2i} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} |
︙ | ︙ | |||
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 | | | | 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 | } -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 { | | | 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 | } -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 | > > > > > > > > > > > > > > > > > | 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 | } -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 | < < < < < < < < < < < < < < | 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 | } -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>} | < < < < < < < < < < < < < < | 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 | 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 { | | | | | 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 | 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}} | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > | 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 | 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} -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] | > | 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 | # 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 | | | | 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 | 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 | | | | | | | | | | | 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 | 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 | | | > | > > > > > > | 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 | } -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> { | | | | 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 | } -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 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 | } 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 unset x1 y1 x2 y2 } -result 1 # cleanup cleanupTests return # vi:set ts=4 sw=4 et: # Local Variables: # mode: tcl # End: | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } 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 unset x1 y1 x2 y2 } -result 1 test bind-37.1 {Promotion tables do not contain duplicate sequences, bug [43573999ca]} -body { proc A {} { bind .c <B1-Motion><Enter> {} set myv(a) 1 set b [array get myv] bind .c <B1-Motion><Enter> "puts Trigger" } pack [canvas .c] bind .c <ButtonRelease-1> "A" A update event generate .c <Button-1> event generate .c <B1-Motion> event generate .c <B1-Motion> event generate .c <B1-Motion> event generate .c <ButtonRelease-1> event generate .c <B1-Motion> } -cleanup { destroy .c } -returnCodes ok -result {} ; # shall not crash (assertion failed) # cleanup cleanupTests return # vi:set ts=4 sw=4 et: # Local Variables: # mode: tcl # End: |
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 |
︙ | ︙ | |||
339 340 341 342 343 344 345 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -bd badValue } -cleanup { destroy .l | | | | | | 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 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -bd badValue } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.35 {configuration option: "bd" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -bd 4 .b cget -bd } -cleanup { destroy .b } -result 4 test button-1.36 {configuration option: "bd" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -bd badValue } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.37 {configuration option: "bd" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -bd 4 .c cget -bd } -cleanup { destroy .c } -result 4 test button-1.38 {configuration option: "bd" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -bd badValue } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.39 {configuration option: "bd" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -bd 4 .r cget -bd } -cleanup { destroy .r } -result 4 test button-1.40 {configuration option: "bd" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -bd badValue } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.41 {configuration option: "bg" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -bg #ff0000 |
︙ | ︙ | |||
570 571 572 573 574 575 576 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -borderwidth badValue } -cleanup { destroy .l | | | | | | 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 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -borderwidth badValue } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.59 {configuration option: "borderwidth" for button} -setup { button .b -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -borderwidth 1.3 .b cget -borderwidth } -cleanup { destroy .b } -result {1.3} test button-1.60 {configuration option: "borderwidth" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -borderwidth badValue } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.61 {configuration option: "borderwidth" for checkbutton} -setup { checkbutton .c -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -borderwidth 1.3 .c cget -borderwidth } -cleanup { destroy .c } -result {1.3} test button-1.62 {configuration option: "borderwidth" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -borderwidth badValue } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.63 {configuration option: "borderwidth" for radiobutton} -setup { radiobutton .r -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -borderwidth 1.3 .r cget -borderwidth } -cleanup { destroy .r } -result {1.3} test button-1.64 {configuration option: "borderwidth" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -borderwidth badValue } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.65 {configuration option: "command" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -command {set x} |
︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -highlightthickness badValue } -cleanup { destroy .l | | | | | | 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 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -highlightthickness badValue } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.145 {configuration option: "highlightthickness" for button} -setup { button .b -borderwidth 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -highlightthickness 6m .b cget -highlightthickness } -cleanup { destroy .b } -result {6m} test button-1.146 {configuration option: "highlightthickness" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -highlightthickness badValue } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.147 {configuration option: "highlightthickness" for checkbutton} -setup { checkbutton .c -borderwidth 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -highlightthickness 6m .c cget -highlightthickness } -cleanup { destroy .c } -result {6m} test button-1.148 {configuration option: "highlightthickness" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -highlightthickness badValue } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.149 {configuration option: "highlightthickness" for radiobutton} -setup { radiobutton .r -borderwidth 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -highlightthickness 6m .r cget -highlightthickness } -cleanup { destroy .r } -result {6m} test button-1.150 {configuration option: "highlightthickness" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -highlightthickness badValue } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "badValue"} test button-1.151 {configuration option: "image" for label} -constraints { testImageType } -setup { image create test image1 label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l |
︙ | ︙ | |||
1748 1749 1750 1751 1752 1753 1754 | button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -overrelief 1.5 } -cleanup { destroy .b | | | | | | | | | | | | | 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 | 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} -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} -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 .l cget -padx } -cleanup { destroy .l } -result {12m} test button-1.184 {configuration option: "padx" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -padx 420x } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.185 {configuration option: "padx" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -padx 12m .b cget -padx } -cleanup { destroy .b } -result {12m} test button-1.186 {configuration option: "padx" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -padx 420x } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.187 {configuration option: "padx" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -padx 12m .c cget -padx } -cleanup { destroy .c } -result {12m} test button-1.188 {configuration option: "padx" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -padx 420x } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.189 {configuration option: "padx" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -padx 12m .r cget -padx } -cleanup { destroy .r } -result {12m} test button-1.190 {configuration option: "padx" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -padx 420x } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.191 {configuration option: "pady" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -pady 12m .l cget -pady } -cleanup { destroy .l } -result {12m} test button-1.192 {configuration option: "pady" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -pady 420x } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.193 {configuration option: "pady" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -pady 12m .b cget -pady } -cleanup { destroy .b } -result {12m} test button-1.194 {configuration option: "pady" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -pady 420x } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.195 {configuration option: "pady" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -pady 12m .c cget -pady } -cleanup { destroy .c } -result {12m} test button-1.196 {configuration option: "pady" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -pady 420x } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.197 {configuration option: "pady" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -pady 12m .r cget -pady } -cleanup { destroy .r } -result {12m} test button-1.198 {configuration option: "pady" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -pady 420x } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "420x"} test button-1.199 {configuration option: "repeatdelay" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -repeatdelay 100 |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
2596 2597 2598 2599 2600 2601 2602 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -wraplength 6x } -cleanup { destroy .l | | | | | | 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 | label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -wraplength 6x } -cleanup { destroy .l } -returnCodes {error} -result {expected screen distance but got "6x"} test button-1.264 {configuration option: "wraplength" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -wraplength 100 .b cget -wraplength } -cleanup { destroy .b } -result 100 test button-1.265 {configuration option: "wraplength" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -wraplength 6x } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "6x"} test button-1.266 {configuration option: "wraplength" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -wraplength 100 .c cget -wraplength } -cleanup { destroy .c } -result 100 test button-1.267 {configuration option: "wraplength" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -wraplength 6x } -cleanup { destroy .c } -returnCodes {error} -result {expected screen distance but got "6x"} test button-1.268 {configuration option: "wraplength" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -wraplength 100 .r cget -wraplength } -cleanup { destroy .r } -result 100 test button-1.269 {configuration option: "wraplength" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -wraplength 6x } -cleanup { destroy .r } -returnCodes {error} -result {expected screen distance but got "6x"} test button-1.270 {configuration options} -body { # Additional check to make sure that -selectcolor may be empty in # checkbox widgets checkbutton .c .c configure -selectcolor {} } -cleanup { |
︙ | ︙ | |||
2906 2907 2908 2909 2910 2911 2912 | } -cleanup { destroy .r } -result {} test button-3.24 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 | | | | | | | | | | 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 | } -cleanup { destroy .r } -result {} test button-3.24 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 trace add variable checkvar write bogusTrace .c deselect } -cleanup { destroy .c trace remove variable checkvar write bogusTrace } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.25 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 trace add variable checkvar write bogusTrace catch {.c deselect} list $errorInfo $checkvar } -cleanup { trace remove variable checkvar write bogusTrace destroy .c } -match {glob} -result {{*trace aborted while executing * ".c deselect"} 0} test button-3.26 {ButtonWidgetCmd procedure, "deselect" option} -body { radiobutton .r -variable radiovar -value red set radiovar red trace add variable radiovar write bogusTrace .r deselect } -cleanup { destroy .r trace remove variable radiovar write bogusTrace } -match {glob} -returnCodes {error} -result {can't set "radiovar": trace aborted} test button-3.27 {ButtonWidgetCmd procedure, "deselect" option} -body { radiobutton .r -variable radiovar -value red set radiovar red trace add variable radiovar write bogusTrace catch {.r deselect} list $errorInfo $radiovar } -cleanup { destroy .r trace remove variable radiovar write bogusTrace } -match glob -result {{*trace aborted while executing * ".r deselect"} {}} test button-3.28 {ButtonWidgetCmd procedure, "flash" option} -body { button .b |
︙ | ︙ | |||
3066 3067 3068 3069 3070 3071 3072 | return $radiovar } -cleanup { destroy .r } -result {red} test button-3.44 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar yellow | | | | | | 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 | return $radiovar } -cleanup { destroy .r } -result {red} test button-3.44 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar yellow trace add variable radiovar write bogusTrace .r select } -cleanup { destroy .r trace remove variable radiovar write bogusTrace } -returnCodes {error} -result {can't set "radiovar": trace aborted} test button-3.45 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar yellow trace add variable radiovar write bogusTrace catch {.r select} list $errorInfo $radiovar } -cleanup { destroy .r trace remove variable radiovar write bogusTrace } -match {glob} -result {{*trace aborted while executing * ".r select"} red} # ex 4.43 test button-3.46 {ButtonWidgetCmd procedure, "toggle" option} -body { |
︙ | ︙ | |||
3127 3128 3129 3130 3131 3132 3133 | return $result } -cleanup { destroy .c } -result {sunshine rain sunshine} test button-3.51 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar xyz | | | | | | | | | | 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 | return $result } -cleanup { destroy .c } -result {sunshine rain sunshine} test button-3.51 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar xyz trace add variable checkvar write bogusTrace .c toggle } -cleanup { destroy .c trace remove variable checkvar write bogusTrace } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.52 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar xyz trace add variable checkvar write bogusTrace catch {.c toggle} list $errorInfo $checkvar } -cleanup { trace remove variable checkvar write bogusTrace destroy .c } -match {glob} -result {{*trace aborted while executing * ".c toggle"} abc} test button-3.53 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar abc trace add variable checkvar write bogusTrace .c toggle } -cleanup { trace remove variable checkvar write bogusTrace destroy .c } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.54 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar abc trace add variable checkvar write bogusTrace catch {.c toggle} list $errorInfo $checkvar } -cleanup { trace remove variable checkvar write bogusTrace destroy .c } -match {glob} -result {{*trace aborted while executing * ".c toggle"} xyz} test button-3.55 {ButtonWidgetCmd procedure, "toggle" option} -setup { unset -nocomplain checkvar |
︙ | ︙ | |||
3300 3301 3302 3303 3304 3305 3306 | } -cleanup { destroy .r } -result {} test button-5.10 {ConfigureButton - error in setting variable} -setup { unset -nocomplain x } -body { | | | | 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 | } -cleanup { destroy .r } -result {} test button-5.10 {ConfigureButton - error in setting variable} -setup { unset -nocomplain x } -body { trace add variable x write bogusTrace radiobutton .r -variable x } -cleanup { destroy .r trace remove variable x write bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-5.11 {ConfigureButton - bad image name} -body { button .b -image bogus } -cleanup { destroy .b } -returnCodes {error} -result {image "bogus" doesn't exist} |
︙ | ︙ | |||
3333 3334 3335 3336 3337 3338 3339 | } -cleanup { destroy .b } -result {Override} test button-5.14 {ConfigureButton - variable handling} -setup { unset -nocomplain x } -body { | | | | | | 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 | } -cleanup { destroy .b } -result {Override} test button-5.14 {ConfigureButton - variable handling} -setup { unset -nocomplain x } -body { trace add variable x write bogusTrace radiobutton .r -text foo -textvariable x } -cleanup { trace remove variable x write bogusTrace destroy .r } -returnCodes {error} -result {can't set "x": trace aborted} test button-5.15 {ConfigureButton - variable handling} -setup { unset -nocomplain x } -body { trace add variable x write bogusTrace catch {radiobutton .r -text foo -textvariable x} return $x } -cleanup { trace remove variable x write bogusTrace destroy .r } -result {foo} #ex 6.14 test button-5.16 {ConfigureButton - -width option} -body { button .b -text "Button 1" .b configure -width 1i |
︙ | ︙ | |||
3389 3390 3391 3392 3393 3394 3395 | ".b configure -height 0.5c"} #ex 6.16 test button-5.20 {ConfigureButton - -width option} -body { button .b -bitmap questhead .b configure -width abc } -cleanup { destroy .b | | | | | | 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 | ".b configure -height 0.5c"} #ex 6.16 test button-5.20 {ConfigureButton - -width option} -body { button .b -bitmap questhead .b configure -width abc } -cleanup { destroy .b } -returnCodes {error} -result {expected screen distance but got "abc"} test button-5.21 {ConfigureButton - -width option} -body { button .b -bitmap questhead catch {.b configure -width abc} return $errorInfo } -cleanup { destroy .b } -result {expected screen distance but got "abc" (processing -width option) invoked from within ".b configure -width abc"} test button-5.22 {ConfigureButton - -height option} -constraints { testImageType } -setup { image create test image1 } -body { button .b -image image1 .b configure -height 0.5x } -cleanup { destroy .b image delete image1 } -returnCodes {error} -result {expected screen distance but got "0.5x"} test button-5.23 {ConfigureButton - -height option} -constraints { testImageType } -setup { image create test image1 } -body { #ztestImageType button .b -image image1 catch {.b configure -height 0.5x} return $errorInfo } -cleanup { destroy .b image delete image1 } -result {expected screen distance but got "0.5x" (processing -height option) invoked from within ".b configure -height 0.5x"} #ex 6.18 test button-5.24 {ConfigureButton - computing geometry} -constraints { fonts } -body { |
︙ | ︙ | |||
3534 3535 3536 3537 3538 3539 3540 | destroy .c } -result {0 1 0} test button-8.2 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x | | | | | | | | | | | | | | 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 | destroy .c } -result {0 1 0} test button-8.2 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x trace add variable x write bogusTrace .c invoke } -cleanup { destroy .c trace remove variable x write bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.3 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x trace add variable x write bogusTrace catch {.c invoke} return $x } -cleanup { destroy .c trace remove variable x write bogusTrace } -result 1 test button-8.4 {TkInvokeButton procedure} -setup { set x 1 } -body { checkbutton .c -variable x trace add variable x write bogusTrace .c invoke } -cleanup { destroy .c trace remove variable x write bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.5 {TkInvokeButton procedure} -setup { set x 1 } -body { checkbutton .c -variable x trace add variable x write bogusTrace catch {.c invoke} return $x } -cleanup { destroy .c trace remove variable x write bogusTrace } -result 0 test button-8.6 {TkInvokeButton procedure} -setup { set x 0 } -body { radiobutton .r -variable x -value red set result $x .r invoke lappend result $x .r invoke lappend result $x } -cleanup { destroy .r } -result {0 red red} test button-8.7 {TkInvokeButton procedure} -body { radiobutton .r -variable x -value red set x green trace add variable x write bogusTrace .r invoke } -cleanup { destroy .r trace remove variable x write bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.8 {TkInvokeButton procedure} -body { radiobutton .r -variable x -value red set x green trace add variable x write bogusTrace catch {.r invoke} list $errorInfo $x } -cleanup { destroy .r trace remove variable x write bogusTrace } -match {glob} -result {{*trace aborted while executing * ".r invoke"} red} #ex 9.6 test button-8.9 {TkInvokeButton procedure} -setup { |
︙ | ︙ |
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 |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } -cleanup { .c delete all } -result {center {} {}} test canvImg-2.4 {CreateImage procedure} -body { .c create image xyz 40 } -cleanup { .c delete all | | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | } -cleanup { .c delete all } -result {center {} {}} test canvImg-2.4 {CreateImage procedure} -body { .c create image xyz 40 } -cleanup { .c delete all } -returnCodes {error} -result {expected screen distance but got "xyz"} test canvImg-2.5 {CreateImage procedure} -body { .c create image 50 qrs } -cleanup { .c delete all } -returnCodes {error} -result {expected screen distance but got "qrs"} test canvImg-2.6 {CreateImage procedure} -constraints testImageType -body { .c create image 50 50 -gorp foo } -cleanup { .c delete all } -returnCodes {error} -result {unknown option "-gorp"} |
︙ | ︙ | |||
105 106 107 108 109 110 111 | image create test foo } -body { .c create image 50 100 -image foo -tags i1 .c coords i1 dumb 100 } -cleanup { .c delete all image delete foo | | | | 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 | image create test foo } -body { .c create image 50 100 -image foo -tags i1 .c coords i1 dumb 100 } -cleanup { .c delete all image delete foo } -returnCodes {error} -result {expected screen distance but got "dumb"} test canvImg-3.3 {ImageCoords procedure} -constraints testImageType -setup { image create test foo } -body { .c delete all .c create image 50 100 -image foo -tags i1 .c coords i1 250 dumb0 } -cleanup { .c delete all image delete foo } -returnCodes {error} -result {expected screen distance but got "dumb0"} test canvImg-3.4 {ImageCoords procedure} -constraints testImageType -setup { image create test foo } -body { .c delete all .c create image 50 100 -image foo -tags i1 .c coords i1 250 } -cleanup { |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
21 22 23 24 25 26 27 | .c moveto rect } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-1.3 {Bad args handling for "moveto" command} -body { .c moveto test 12 } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-1.4 {Bad args handling for "moveto" command} -body { .c moveto test 12 y | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | .c moveto rect } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-1.3 {Bad args handling for "moveto" command} -body { .c moveto test 12 } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-1.4 {Bad args handling for "moveto" command} -body { .c moveto test 12 y } -returnCodes error -result {expected screen distance but got "y"} test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { .c moveto test 12 20 -anchor } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-2.1 {Canvas "moveto" command coordinates} { .c moveto test 200 150 .c bbox test |
︙ | ︙ |
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 |
︙ | ︙ | |||
49 50 51 52 53 54 55 | } -result {test xyz} test canvRect-1.9 {configuration options: good value for -width} -body { .c itemconfigure test -width 6.0 list [.c itemcget test -width] [lindex [.c itemconfigure test -width] 4] } -result {6.0 6.0} test canvRect-1.10 {configuration options: bad value for -width} -body { .c itemconfigure test -width abc | | | | | | | 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 | } -result {test xyz} test canvRect-1.9 {configuration options: good value for -width} -body { .c itemconfigure test -width 6.0 list [.c itemcget test -width] [lindex [.c itemconfigure test -width] 4] } -result {6.0 6.0} test canvRect-1.10 {configuration options: bad value for -width} -body { .c itemconfigure test -width abc } -returnCodes error -result {expected screen distance but got "abc"} .c delete withtag all test canvRect-2.1 {CreateRectOval procedure} -body { .c create rect } -returnCodes error -result {wrong # args: should be ".c create rect coords ?arg ...?"} test canvRect-2.2 {CreateRectOval procedure} -body { .c create oval x y z } -returnCodes error -result {wrong # coordinates: expected 0 or 4, got 3} test canvRect-2.3 {CreateRectOval procedure} -body { .c create rectangle x 2 3 4 } -returnCodes error -result {expected screen distance but got "x"} test canvRect-2.4 {CreateRectOval procedure} -body { .c create rectangle 1 y 3 4 } -returnCodes error -result {expected screen distance but got "y"} test canvRect-2.5 {CreateRectOval procedure} -body { .c create rectangle 1 2 z 4 } -returnCodes error -result {expected screen distance but got "z"} test canvRect-2.6 {CreateRectOval procedure} -body { .c create rectangle 1 2 3 q } -returnCodes error -result {expected screen distance but got "q"} test canvRect-2.7 {CreateRectOval procedure} -body { .c create rectangle 1 2 3 4 -tags x set result {} foreach element [.c coords x] { lappend result [format %.1f $element] } set result |
︙ | ︙ | |||
100 101 102 103 104 105 106 | .c delete withtag all } -result {10.0 20.0 30.0 40.0} test canvRect-3.2 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x a 2 3 4 } -cleanup { .c delete withtag all | | | | | | < < < | | | < > > > > > > > | < | | < | < | < | 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 | .c delete withtag all } -result {10.0 20.0 30.0 40.0} test canvRect-3.2 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x a 2 3 4 } -cleanup { .c delete withtag all } -returnCodes error -result {expected screen distance but got "a"} test canvRect-3.3 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x 1 b 3 4 } -cleanup { .c delete withtag all } -returnCodes error -result {expected screen distance but got "b"} test canvRect-3.4 {RectOvalCoords procedure} -body { .c create rectangle 10 20 30 40 -tags x .c coords x 1 2 c 4 } -cleanup { .c delete withtag all } -returnCodes error -result {expected screen distance but got "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 {expected screen distance but got "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 .c coords x 1 2 3 4 5 } -cleanup { .c delete withtag all } -returnCodes error -result {wrong # coordinates: expected 0 or 4, got 5} test canvRect-4.1 {ConfigureRectOval procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 .c itemconfigure x -width abc } -cleanup { .c delete withtag all } -returnCodes error -result {expected screen distance but got "abc"} test canvRect-4.2 {ConfigureRectOval procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 catch {.c itemconfigure x -width abc} .c itemcget x -width } -cleanup { .c delete withtag all } -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 {expected screen distance but got "-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} # I can't come up with any good tests for DeleteRectOval. # On Windows the bbox of rectangle items is 1 pixel larger at each border due # to the "bloat" implemented in ComputeRectOvalBbox() in case -outline is {} if {[tk windowingsystem] eq "win32"} { set result_5_1 {9 4 21 16} } else { set result_5_1 {10 5 20 15} } test canvRect-5.1 {ComputeRectOvalBbox procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 -outline {} .c coords x 20 15 10 5 .c bbox x } -cleanup { .c delete withtag all } -result $result_5_1 test canvRect-5.2 {ComputeRectOvalBbox procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 -outline {} .c coords x 10 20 30 10 .c itemconfigure x -width 1 -outline red .c bbox x } -cleanup { .c delete withtag all } -result {9 9 31 21} test canvRect-5.3 {ComputeRectOvalBbox procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 -outline {} .c coords x 10 20 30 10 .c itemconfigure x -width 2 -outline red .c bbox x } -cleanup { .c delete withtag all } -result {9 9 31 21} test canvRect-5.4 {ComputeRectOvalBbox procedure} -body { .c create rectangle 10 20 30 40 -tags x -width 1 -outline {} .c coords x 10 20 30 10 .c itemconfigure x -width 3 -outline red .c bbox x } -cleanup { .c delete withtag all } -result {8 8 32 22} |
︙ | ︙ | |||
424 425 426 427 428 429 430 | .c create rect 100 300 200 350 -tags x .c move x 100 -10 format {%.6g %.6g %.6g %.6g} {*}[.c coords x] } -result {200 290 300 340} test canvRect-11.1 {RectOvalToPostscript procedure} -constraints { | | < < | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | .c create rect 100 300 200 350 -tags x .c move x 100 -10 format {%.6g %.6g %.6g %.6g} {*}[.c coords x] } -result {200 290 300 340} test canvRect-11.1 {RectOvalToPostscript procedure} -constraints { nonPortable } -setup { .c delete withtag all } -body { # This test is non-portable because different color information # will get generated on different displays (e.g. mono displays # vs. color). .c configure -bd 0 -highlightthickness 0 .c create rect 50 60 90 80 -fill black -stipple gray50 -outline {} .c create oval 100 150 200 200 -fill {} -outline #ff0000 -width 5 update set x [.c postscript] string range $x [string first "-200 -150 translate" $x] end } -result {-200 -150 translate |
︙ | ︙ |
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 | # 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 # Canvas used in 1.* - 17.* tests canvas .c -width 400 -height 300 -bd 2 -relief sunken pack .c update # Item used in 1.* tests .c create text 20 20 -tag test |
︙ | ︙ | |||
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 | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | } -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 {expected screen distance but got "xyz"} test canvText-1.16 {configuration options: good value for "tags"} -body { .c itemconfigure test -tags {test a b c} list [lindex [.c itemconfigure test -tags] 4] [.c itemcget test -tags] } -result {{test a b c} {test a b c}} test canvasText-1.17 {configuration options: bad value for "angle"} -body { .c itemconfigure test -angle xyz } -returnCodes error -result {expected floating-point number but got "xyz"} |
︙ | ︙ | |||
99 100 101 102 103 104 105 | test canvText-2.1 {CreateText procedure: args} -body { .c create text } -returnCodes {error} -result {wrong # args: should be ".c create text coords ?arg ...?"} test canvText-2.2 {CreateText procedure: args} -body { .c create text xyz 0 } -cleanup { .c delete all | | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | test canvText-2.1 {CreateText procedure: args} -body { .c create text } -returnCodes {error} -result {wrong # args: should be ".c create text coords ?arg ...?"} test canvText-2.2 {CreateText procedure: args} -body { .c create text xyz 0 } -cleanup { .c delete all } -returnCodes {error} -result {expected screen distance but got "xyz"} test canvText-2.3 {CreateText procedure: args} -body { .c create text 0 xyz } -cleanup { .c delete all } -returnCodes {error} -result {expected screen distance but got "xyz"} test canvText-2.4 {CreateText procedure: args} -body { .c create text 0 0 -xyz xyz } -cleanup { .c delete all } -returnCodes {error} -result {unknown option "-xyz"} test canvText-2.5 {CreateText procedure} -body { .c create text 0 0 -tags x |
︙ | ︙ | |||
132 133 134 135 136 137 138 | } -result {0.0 0.0} test canvText-3.2 {TextCoords procedure} -setup { .c create text 20 20 -tag test } -body { .c coords test xyz 0 } -cleanup { .c delete test | | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | } -result {0.0 0.0} test canvText-3.2 {TextCoords procedure} -setup { .c create text 20 20 -tag test } -body { .c coords test xyz 0 } -cleanup { .c delete test } -returnCodes {error} -result {expected screen distance but got "xyz"} test canvText-3.3 {TextCoords procedure} -setup { .c create text 20 20 -tag test } -body { .c coords test 0 xyz } -cleanup { .c delete test } -returnCodes {error} -result {expected screen distance but got "xyz"} test canvText-3.4 {TextCoords procedure} -setup { .c create text 20 20 -tag test } -body { .c coords test 10 10 set result {} foreach element [.c coords test] { lappend result [format %.1f $element] |
︙ | ︙ | |||
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] \ | | | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | .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 |
︙ | ︙ | |||
939 940 941 942 943 944 945 | set y2 [expr {160 + ($metrics(-linespace) / 2)}] lappend results [$c index tbox1 @$x,$y1] lappend results [$c index tbox2 @$x,$y2] } -cleanup { destroy .c } -result {{Yeah } Yeah- 4 4} | | > > > > > > | > | | | | 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 | set y2 [expr {160 + ($metrics(-linespace) / 2)}] lappend results [$c index tbox1 @$x,$y1] lappend results [$c index tbox2 @$x,$y2] } -cleanup { destroy .c } -result {{Yeah } Yeah- 4 4} test canvText-20.1 {angled text bounding box} -setup { destroy .c canvas .c proc transpose {bbox} { lassign $bbox a b c d list $b $a $d $c } proc almosteq {b1 b2} { # check whether the two boxes are equal, with 1 unit tolerance on each x y w h lassign $b1 a b c d lassign $b2 e f g h expr {($e-$a)<=1 && ($f-$b)<=1 && ($g-$c)<=1 && ($h-$d)<=1} } } -body { .c create text 2 2 -tag t -anchor center -text 0 -font {TkDefaultFont 24} set bb0 [.c bbox t] .c itemconf t -angle 90 set bb1 [.c bbox t] .c itemconf t -angle 180 set bb2 [.c bbox t] .c itemconf t -angle 270 set bb3 [.c bbox t] # bboxes should be the same, possibly with a small (platform-specific) rounding difference list [expr {[almosteq $bb0 $bb2] ? "ok" : "$bb0,$bb2"}] \ [expr {[almosteq $bb1 $bb3] ? "ok" : "$bb1,$bb3"}] \ [expr {[almosteq $bb0 [transpose $bb1]] ? "ok" : "$bb0,$bb1"}] } -cleanup { destroy .c rename transpose {} } -result {ok ok ok} test canvText-20.2 {crash on angled text selection (X11, without xft) - bug 2712f43f6e} -setup { destroy .c |
︙ | ︙ |
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.
︙ | ︙ | |||
36 37 38 39 40 41 42 | } -returnCodes error -result {unknown color name "non-existent"} test canvas-1.5 {configuration options: good value for "bd"} -body { .c configure -bd 4 .c cget -bd } -result 4 test canvas-1.6 {configuration options: bad value for "bd"} -body { .c configure -bd badValue | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | } -returnCodes error -result {unknown color name "non-existent"} test canvas-1.5 {configuration options: good value for "bd"} -body { .c configure -bd 4 .c cget -bd } -result 4 test canvas-1.6 {configuration options: bad value for "bd"} -body { .c configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test canvas-1.7 {configuration options: good value for "borderwidth"} -body { .c configure -borderwidth 1.3 .c cget -borderwidth } -result 1 test canvas-1.8 {configuration options: bad value for "borderwidth"} -body { .c configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test canvas-1.9 {configuration options: good value for "closeenough"} -body { .c configure -closeenough 24 .c cget -closeenough } -result {24.0} test canvas-1.10 {configuration options: bad value for "closeenough"} -body { .c configure -closeenough bogus } -returnCodes error -result {expected floating-point number but got "bogus"} |
︙ | ︙ | |||
71 72 73 74 75 76 77 | } -returnCodes error -result {bad cursor spec "badValue"} test canvas-1.15 {configuration options: good value for "height"} -body { .c configure -height 2.1 .c cget -height } -result 2 test canvas-1.16 {configuration options: bad value for "height"} -body { .c configure -height x42 | | | | | | | | | | | 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 | } -returnCodes error -result {bad cursor spec "badValue"} test canvas-1.15 {configuration options: good value for "height"} -body { .c configure -height 2.1 .c cget -height } -result 2 test canvas-1.16 {configuration options: bad value for "height"} -body { .c configure -height x42 } -returnCodes error -result {expected screen distance but got "x42"} test canvas-1.17 {configuration options: good value for "highlightbackground"} -body { .c configure -highlightbackground #112233 .c cget -highlightbackground } -result {#112233} test canvas-1.18 {configuration options: bad value for "highlightbackground"} -body { .c configure -highlightbackground ugly } -returnCodes error -result {unknown color name "ugly"} test canvas-1.19 {configuration options: good value for "highlightcolor"} -body { .c configure -highlightcolor #110022 .c cget -highlightcolor } -result {#110022} test canvas-1.20 {configuration options: bad value for "highlightcolor"} -body { .c configure -highlightcolor bogus } -returnCodes error -result {unknown color name "bogus"} test canvas-1.21 {configuration options: good value for "highlightthickness"} -body { .c configure -highlightthickness 18 .c cget -highlightthickness } -result 18 test canvas-1.22 {configuration options: bad value for "highlightthickness"} -body { .c configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test canvas-1.23 {configuration options: good value for "insertbackground"} -body { .c configure -insertbackground #110022 .c cget -insertbackground } -result {#110022} test canvas-1.24 {configuration options: bad value for "insertbackground"} -body { .c configure -insertbackground bogus } -returnCodes error -result {unknown color name "bogus"} test canvas-1.25 {configuration options: good value for "insertborderwidth"} -body { .c configure -insertborderwidth 1.3 .c cget -insertborderwidth } -result 1 test canvas-1.26 {configuration options: bad value for "insertborderwidth"} -body { .c configure -insertborderwidth 2.6x } -returnCodes error -result {expected screen distance but got "2.6x"} test canvas-1.27 {configuration options: good value for "insertofftime"} -body { .c configure -insertofftime 100 .c cget -insertofftime } -result 100 test canvas-1.28 {configuration options: bad value for "insertofftime"} -body { .c configure -insertofftime 3.2 } -returnCodes error -result {expected integer but got "3.2"} test canvas-1.29 {configuration options: good value for "insertontime"} -body { .c configure -insertontime 100 .c cget -insertontime } -result 100 test canvas-1.30 {configuration options: bad value for "insertontime"} -body { .c configure -insertontime 3.2 } -returnCodes error -result {expected integer but got "3.2"} test canvas-1.31 {configuration options: good value for "insertwidth"} -body { .c configure -insertwidth 1.3 .c cget -insertwidth } -result 1 test canvas-1.32 {configuration options: bad value for "insertwidth"} -body { .c configure -insertwidth 6x } -returnCodes error -result {expected screen distance but got "6x"} test canvas-1.33 {configuration options: good value for "relief"} -body { .c configure -relief g .c cget -relief } -result {groove} test canvas-1.34 {configuration options: bad value for "relief"} -body { .c configure -relief r } -returnCodes error -result {bad relief "r": must be flat, groove, raised, ridge, solid, or sunken} test canvas-1.35 {configuration options: good value for "selectbackground"} -body { .c configure -selectbackground #110022 .c cget -selectbackground } -result {#110022} test canvas-1.36 {configuration options: bad value for "selectbackground"} -body { .c configure -selectbackground bogus } -returnCodes error -result {unknown color name "bogus"} test canvas-1.37 {configuration options: good value for "selectborderwidth"} -body { .c configure -selectborderwidth 1.3 .c cget -selectborderwidth } -result 1 test canvas-1.38 {configuration options: bad value for "selectborderwidth"} -body { .c configure -selectborderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test canvas-1.39 {configuration options: good value for "selectforeground"} -body { .c configure -selectforeground #654321 .c cget -selectforeground } -result {#654321} test canvas-1.40 {configuration options: bad value for "selectforeground"} -body { .c configure -selectforeground bogus } -returnCodes error -result {unknown color name "bogus"} test canvas-1.41 {configuration options: good value for "takefocus"} -body { .c configure -takefocus "any string" .c cget -takefocus } -result {any string} test canvas-1.42 {configuration options: good value for "width"} -body { .c configure -width 402 .c cget -width } -result 402 test canvas-1.43 {configuration options: bad value for "width"} -body { .c configure -width xyz } -returnCodes error -result {expected screen distance but got "xyz"} test canvas-1.44 {configuration options: good value for "xscrollcommand"} -body { .c configure -xscrollcommand {Some command} .c cget -xscrollcommand } -result {Some command} test canvas-1.45 {configuration options: good value for "yscrollcommand"} -body { .c configure -yscrollcommand {Another command} .c cget -yscrollcommand |
︙ | ︙ | |||
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] |
︙ | ︙ | |||
751 752 753 754 755 756 757 | } -returnCodes error -body { .c create window 0 } -result {wrong # coordinates: expected 2, got 1} test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup { destroy .c canvas .c } -body { | | > > > > > > > > > > > > > > > > | 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 | } -returnCodes error -body { .c create window 0 } -result {wrong # coordinates: expected 2, got 1} 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 1c 1c] 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 |
︙ | ︙ | |||
866 867 868 869 870 871 872 | test canvas-18.10 {imove method - errors} -setup { canvas .c } -body { set id [.c create line 0 0 1 1 2 2 3 3] .c imove $id 0 foobar 4 } -cleanup { destroy .c | | | | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | test canvas-18.10 {imove method - errors} -setup { canvas .c } -body { set id [.c create line 0 0 1 1 2 2 3 3] .c imove $id 0 foobar 4 } -cleanup { destroy .c } -returnCodes error -result {expected screen distance but got "foobar"} test canvas-18.11 {imove method - errors} -setup { canvas .c } -body { set id [.c create line 0 0 1 1 2 2 3 3] .c imove $id 0 4 foobar } -cleanup { destroy .c } -returnCodes error -result {expected screen distance but got "foobar"} test canvas-19.1 {rchars method - lines} -setup { canvas .c } -body { set id [.c create line 0 0 1 1 2 2 3 3] .c rchars $id 2 4 {4 4} .c coords $id |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | } -result {missing tag in tag search expression} test canvas-21.6 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all x 1 1 } -returnCodes error -cleanup { destroy .c | | | | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | } -result {missing tag in tag search expression} test canvas-21.6 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all x 1 1 } -returnCodes error -cleanup { destroy .c } -result {expected screen distance but got "x"} test canvas-21.7 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 1 x 1 } -returnCodes error -cleanup { destroy .c } -result {expected screen distance but got "x"} test canvas-21.8 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 1 1 x } -returnCodes error -cleanup { destroy .c } -result {expected floating-point number but got "x"} |
︙ | ︙ |
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 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 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. # ################################################################# # Note that some of these tests may fail if another application # # is grabbing the clipboard (e.g. an X server, or a VNC viewer) # ################################################################# package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands # set up a very large buffer to test INCR retrievals set longValue "" foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} { set j $i.1$i.2$i.3$i.4$i.5$i.6$i.7$i.8$i.9$i.10$i.11$i.12$i.13$i.14 append longValue A$j B$j C$j D$j E$j F$j G$j H$j I$j K$j L$j M$j N$j } |
︙ | ︙ | |||
231 232 233 234 235 236 237 | clipboard append "first chunk" selection own -s CLIPBOARD . clipboard append " second chunk" clipboard get } -cleanup { clipboard clear } -returnCodes ok -result {first chunk second chunk} | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | clipboard append "first chunk" selection own -s CLIPBOARD . clipboard append " second chunk" clipboard get } -cleanup { clipboard clear } -returnCodes ok -result {first chunk second chunk} test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints x11 -setup { clipboard clear } -body { setupbg clipboard append -f INTEGER -t TEST "16" set result [dobg {clipboard get TEST}] return $result } -cleanup { |
︙ | ︙ |
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 | # 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 |
︙ | ︙ | |||
37 38 39 40 41 42 43 | } } .c delete $i incr i } destroy .c } else { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | } } .c delete $i incr i } destroy .c } else { testConstraint colorsLeftover 1 } test clrpick-1.1 {tk_chooseColor command} -body { tk_chooseColor -foo } -returnCodes error -result {bad option "-foo": must be -initialcolor, -parent, or -title} test clrpick-1.2 {tk_chooseColor command } -body { |
︙ | ︙ | |||
73 74 75 76 77 78 79 | test clrpick-1.7 {tk_chooseColor command} -body { tk_chooseColor -initialcolor ##badbadbaadcolor } -returnCodes error -result {invalid color name "##badbadbaadcolor"} # tests 3.1 and 3.2 fail when individually run # if there is no catch {tk_chooseColor -foo 1} msg | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | test clrpick-1.7 {tk_chooseColor command} -body { tk_chooseColor -initialcolor ##badbadbaadcolor } -returnCodes error -result {invalid color name "##badbadbaadcolor"} # tests 3.1 and 3.2 fail when individually run # if there is no catch {tk_chooseColor -foo 1} msg # before setting isNative catch {tk_chooseColor -foo 1} msg set isNative [expr {[info commands tk::dialog::color::] eq ""}] proc ToPressButton {parent btn} { global isNative if {!$isNative} { after 200 "SendButtonPress . $btn mouse" |
︙ | ︙ | |||
138 139 140 141 142 143 144 | focus $w event generate $button <Enter> event generate $w <Key> -keysym Return } } | < | < < < < < < < < < < < < | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | focus $w event generate $button <Enter> event generate $w <Key> -keysym Return } } test clrpick-2.1 {tk_chooseColor command} -constraints { nonUnixUserInteraction colorsLeftover } -setup { set verylongstring [string repeat longstring: 100] } -body { ToPressButton . ok tk_chooseColor -title "Press Ok $verylongstring" -initialcolor #404040 \ -parent . } -result {#404040} test clrpick-2.2 {tk_chooseColor command} -constraints { nonUnixUserInteraction colorsLeftover |
︙ | ︙ |
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 needsICU [expr {[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 needsICU -body { ::tk::startOfCluster é 1 } -result 0 test cluster-1.3 {::tk::startOfCluster} -constraints needsICU -body { ::tk::startOfCluster é 2 } -result 2 test cluster-1.4 {::tk::startOfCluster} -constraints needsICU -body { ::tk::startOfCluster é 3 } -result 2 test cluster-1.5 {::tk::startOfCluster} -constraints needsICU -body { ::tk::startOfCluster é end } -result 0 test cluster-1.6 {::tk::startOfCluster} -body { ::tk::startOfCluster é {} } -result {} test cluster-1.7 {::tk::startOfCluster} -constraints needsICU -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 needsICU -body { ::tk::endOfCluster é 0 } -result 2 test cluster-2.2 {::tk::endOfCluster} -constraints needsICU -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 needsICU -body { ::tk::endOfCluster é end } -result 2 test cluster-2.6 {::tk::endOfCluster} -body { ::tk::endOfCluster é {} } -result 0 test cluster-2.7 {::tk::endOfCluster} -constraints needsICU -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 |
︙ | ︙ | |||
205 206 207 208 209 210 211 | winfo rgb . #abz } -returnCodes error -result {invalid color name "#abz"} test color-2.11 {Tk_GetColor, 6 hex digits, last one invalid} -body { winfo rgb . #12345g } -returnCodes error -result {invalid color name "#12345g"} test color-3.1 {Tk_FreeColor procedure, reference counting} colorsFree { | | | | 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 | winfo rgb . #abz } -returnCodes error -result {invalid color name "#abz"} test color-2.11 {Tk_GetColor, 6 hex digits, last one invalid} -body { winfo rgb . #12345g } -returnCodes error -result {invalid color name "#12345g"} test color-3.1 {Tk_FreeColor procedure, reference counting} colorsFree { destroy {*}[winfo children .t] mkColors .t.c 40 6 0 240 240 0 -6 0 0 0 -40 pack .t.c mkColors .t.c2 20 1 250 0 0 -10 0 0 0 0 0 pack .t.c2 update set last [.t.c2 create rectangle 50 50 70 60 -outline {} \ -fill [cname 0 240 240]] .t.c delete 1 set result [colorsFree .t] .t.c2 delete $last lappend result [colorsFree .t] } {0 1} test color-3.2 {Tk_FreeColor procedure, flushing stressed cmap information} colorsFree { destroy {*}[winfo children .t] mkColors .t.c 40 6 0 240 240 0 -6 0 0 0 -40 pack .t.c mkColors .t.c2 20 1 250 0 0 -10 0 0 0 0 0 mkColors .t.c2 20 1 250 250 0 -10 -10 0 0 0 0 pack .t.c2 update closest .t 241 241 1 |
︙ | ︙ |
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 | 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 } -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 } -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 | | | | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | } -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 | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | 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 | | | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | } -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 | | | | | | | | | | 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 | 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 | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | 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 } -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 -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 } -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 { testobjconfig alltypes .foo -pixel foo } -cleanup { killTables } -returnCodes error -result {expected screen distance or "" but got "foo"} test config-4.98 {DoObjConfig - new pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42m .foo configure -pixel 3c } -cleanup { killTables } -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 | | | | 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 | 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 | | | | | 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 | 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 | | | | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | 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 | | | | | 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 | 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 | | | 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | } -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 | | | | | | | | | | | | | | | | | | 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 | 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 | | | | | | 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 | 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 { | | | | 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | 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 | | | | | | | | | | | 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 | .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 .]} { |
︙ | ︙ | |||
117 118 119 120 121 122 123 | } Export bg::setup as setupbg Export bg::cleanup as cleanupbg Export bg::do as dobg namespace export deleteWindows proc deleteWindows {} { | | > > > > > > < | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } Export bg::setup as setupbg Export bg::cleanup as cleanupbg Export bg::do as dobg namespace export deleteWindows proc deleteWindows {} { destroy {*}[winfo children .] # This update is needed to avoid intermittent failures on macOS in unixEmbed.test # with the (GitHub Actions) CI runner. # 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 [lsearch -all -inline -glob -not [lsort [image names]] ::tk::icons::indicator*] } imageCleanup if {[lsort [image names]] ne $ImageNames} { return -code error "IMAGE NAMES mismatch: [image names] != $ImageNames" } } proc imageFinish {} { variable ImageNames set imgs [lsearch -all -inline -glob -not [lsort [image names]] ::tk::icons::indicator*] if {$imgs ne $ImageNames} { return -code error "images remaining: [image names] != $ImageNames" } imageCleanup } proc imageCleanup {} { variable ImageNames foreach img [image names] { if {$img ni $ImageNames} {image delete $img} } } proc imageNames {} { variable ImageNames 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. This happens synchronously if $w refers to the # whole screen or if the -when option to [event generate] is "now". # # 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. # proc controlPointerWarpTiming {{duration 50}} { 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]] | > > > > > | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | ([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 {![::tk::build-info no-deprecate]}] # 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]] |
︙ | ︙ | |||
212 213 214 215 216 217 218 | testConstraint testmetrics [llength [info commands testmetrics]] testConstraint testobjconfig [llength [info commands testobjconfig]] testConstraint testsend [llength [info commands testsend]] testConstraint testtext [llength [info commands testtext]] testConstraint testwinevent [llength [info commands testwinevent]] testConstraint testwrapper [llength [info commands testwrapper]] | | > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > | | 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 | testConstraint testmetrics [llength [info commands testmetrics]] testConstraint testobjconfig [llength [info commands testobjconfig]] testConstraint testsend [llength [info commands testsend]] testConstraint testtext [llength [info commands testtext]] testConstraint testwinevent [llength [info commands testwinevent]] testConstraint testwrapper [llength [info commands testwrapper]] # constraints about what sort of fonts are available testConstraint fonts 1 destroy .e entry .e -width 0 -font {Helvetica -12} -bd 1 -highlightthickness 1 .e insert end a.bcd if {([winfo reqwidth .e] != 37) || ([winfo reqheight .e] != 20)} { testConstraint fonts 0 } destroy .e destroy .t text .t -width 80 -height 20 -font {Times -14} -bd 1 pack .t .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 } # Although unexpected, some systems may have a very limited set of fonts available. # The following constraints happen to evaluate to false at least on one system: the # Github CI runner for Linux with --disable-xft, which has exactly ONE single font # ([font families] returns a single element: "fixed"), for which [font actual] # returns: # -family fixed -size 9 -weight normal -slant roman -underline 0 # and [font metrics] returns: # -ascent 11 -descent 2 -linespace 13 -fixed 1 # The following constraints are hence tailored to check exactly what is needed in the # tests they constrain (that is: availability of any font having the given font # attributes), so that these constrained tests will in fact run on all systems having # reasonable font dotation. testConstraint haveTimes12Font [expr { [font actual {times 12} -size] == 12 }] testConstraint haveCourier37Font [expr { [font actual {-family courier -size 37} -size] == 37 }] testConstraint haveTimes14BoldFont [expr { ([font actual {times 14 bold} -size] == 14) && ([font actual {times 14 bold} -weight] eq "bold") }] testConstraint haveTimes12BoldItalicUnderlineOverstrikeFont [expr { ([font actual {times 12 bold italic overstrike underline} -weight] eq "bold") && ([font actual {times 12 bold italic overstrike underline} -slant] eq "italic") && ([font actual {times 12 bold italic overstrike underline} -underline] eq "1") && ([font actual {times 12 bold italic overstrike underline} -overstrike] eq "1") }] set fixedFont {Courier 12} ; # warning: must be consistent with the files using the constraint below! set bigFont {Helvetica 24} ; # ditto testConstraint haveBigFontTwiceLargerThanTextFont [expr { [font actual $fixedFont -size] * 2 <= [font actual $bigFont -size] }] unset fixedFont bigFont # constraints for the visuals available testConstraint pseudocolor8 [expr { ([catch { toplevel .t -visual {pseudocolor 8} -colormap new }] == 0) && ([winfo depth .t] == 8) }] destroy .t testConstraint haveTruecolor24 [expr { |
︙ | ︙ | |||
279 280 281 282 283 284 285 | namespace import -force tcltest::interpreter namespace import -force tcltest::testsDirectory namespace import -force tcltest::cleanupTests deleteWindows wm geometry . {} raise . | < | 384 385 386 387 388 389 390 | namespace import -force tcltest::interpreter namespace import -force tcltest::testsDirectory namespace import -force tcltest::cleanupTests deleteWindows wm geometry . {} raise . |
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 12 13 14 15 16 17 18 19 20 | # 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 test embed-1.1 {Tk_UseWindow procedure, bad window identifier} -setup { deleteWindows } -body { toplevel .t -use xyz } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "xyz"} |
︙ | ︙ | |||
32 33 34 35 36 37 38 | toplevel .container -container 1 toplevel .t -use [winfo id .container] -container 1 } -cleanup { deleteWindows } -returnCodes error -result {windows cannot have both the -use and the -container option set} # testing window embedding for win platforms | | | | | | 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 | toplevel .container -container 1 toplevel .t -use [winfo id .container] -container 1 } -cleanup { deleteWindows } -returnCodes error -result {windows cannot have both the -use and the -container option set} # testing window embedding for win platforms test embed-1.4.win {Tk_UseWindow procedure, -container must be set} -constraints { win } -setup { deleteWindows } -body { toplevel .container toplevel .embd -use [winfo id .container] } -cleanup { deleteWindows } -returnCodes error -result {the window to use is not a Tk container} # testing window embedding for win platforms test embed-1.5.win {Tk_UseWindow procedure, -container must be set} -constraints { win } -setup { deleteWindows } -body { frame .container toplevel .embd -use [winfo id .container] } -cleanup { deleteWindows } -returnCodes error -result {the window to use is not a Tk container} # testing window embedding for other than win platforms test embed-1.4.nonwin {Tk_UseWindow procedure, -container must be set} -constraints { nonwin } -setup { deleteWindows } -body { toplevel .container toplevel .embd -use [winfo id .container] } -cleanup { deleteWindows } -returnCodes error -result {window ".container" doesn't have -container option set} # testing window embedding for other than win platforms test embed-1.5.nonwin {Tk_UseWindow procedure, -container must be set} -constraints { nonwin } -setup { deleteWindows } -body { frame .container toplevel .embd -use [winfo id .container] } -cleanup { |
︙ | ︙ |
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 22 23 24 25 26 27 | # 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 # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo set scrollInfo $args } # For trace add variable proc override args { global x set x 12345 } # Procedures used in widget VALIDATION tests proc doval {W d i P s S v V} { |
︙ | ︙ | |||
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} | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | } 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 {expected screen distance but got "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 {expected screen distance but got "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 {expected screen distance but got "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 {expected screen distance but got "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 {expected screen distance but got "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 | | | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | 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 | | | | | | | | | | | | 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 | } -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 | | | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | .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 | | | | | | | 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 | } -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 | | | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | } -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 | | | | | | | | | | | 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 | } -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 | | | 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | .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 | | | | | 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 | } -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 | | | | 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 | } -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 | | | | | | | | | | | | | | | | | | | | | | | | 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 | .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 | | | | 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 | 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 |
︙ | ︙ | |||
1626 1627 1628 1629 1630 1631 1632 | } -cleanup { destroy .e } -result {Some text} test entry-5.4 {ConfigureEntry procedure, -textvariable} -setup { unset -nocomplain x entry .e } -body { | | | | | | | | | | < | | | | | | | | | | | | | | | | | | 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 | } -cleanup { destroy .e } -result {Some text} test entry-5.4 {ConfigureEntry procedure, -textvariable} -setup { unset -nocomplain x entry .e } -body { trace add variable x write override .e insert 0 "Some text" .e configure -textvariable x list $x [.e get] } -cleanup { destroy .e trace remove variable x write override unset x; } -result {12345 12345} test entry-5.5 {ConfigureEntry procedure} -setup { 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 } -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 | | | > | < > < | > | < > < | | | | | | | | | | > | < > < | > | | < > < | > | < > < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | 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} -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") # in the widget. For that purpose we have to mirror the code in tkEntry.c # for computation of the reqwidth # note: XPAD corresponds to the hardcoded #define XPAD 1 set XPAD 1 set expected [expr { [font measure [.e cget -font] "xyy"] \ + 2 * ( [.e cget -borderwidth] + \ [.e cget -highlightthickness] + $XPAD ) } ] expr {[winfo reqwidth .e] == $expected} } -cleanup { destroy .e unset XPAD expected } -result {1} test entry-9.1 {EntryValueChanged procedure} -setup { unset -nocomplain x } -body { trace add variable x write override entry .e -textvariable x -width 0 .e insert 0 foo list $x [.e get] } -cleanup { destroy .e trace remove variable x write override unset x } -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 | | | | | | | | 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 | } -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 | | | | | | | | | 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 | 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} | | | | | | | | | | | | | | 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 | } -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} | | | | | | | < > | < > < > | < > < | > | | 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 | } -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 | | | | | | | | | | | | | | | | | 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 | 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 | | | 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 | 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 | | | | | 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 | 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 | | | 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 | 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 | | | 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 | ## 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 \ | | | 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 | 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 |
︙ | ︙ | |||
3552 3553 3554 3555 3556 3557 3558 | {can't set "::test::foo": parent namespace doesn't exist} \ {can't set "::test::foo": parent namespace doesn't exist} \ {can't read "::test::foo": no such variable}] test entry-23.1 {error in trace proc attached to the textvariable} -setup { destroy .e } -body { | | | 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 | {can't set "::test::foo": parent namespace doesn't exist} \ {can't set "::test::foo": parent namespace doesn't exist} \ {can't read "::test::foo": no such variable}] test entry-23.1 {error in trace proc attached to the textvariable} -setup { destroy .e } -body { trace add variable myvar write traceit proc traceit args {error "Intentional error here!"} entry .e -textvariable myvar catch {.e insert end mystring} result1 catch {.e delete 0} result2 list $result1 $result2 } -cleanup { destroy .e |
︙ | ︙ | |||
3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 | }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} # Gathered comments about lacks # XXX Still need to write tests for EntryBlinkProc, EntryFocusProc, # and EntryTextVarProc. # No tests for DisplayEntry. # XXX Still need to write tests for EntryScanTo and EntrySelectTo. | > > > > > > > > > > > > > > > > > > > | 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 | }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} test entry-25.3 {Bug [2a32225cd1] - Navigation in a password made of several words} -setup { destroy .e pack [entry .e -show *] update set res {} } -body { .e insert end "A sample password made of several words" .e icursor end event generate .e <<PrevWord>> ; # shall move insert to index 0 .e delete insert end lappend res [.e get] .e insert end "A sample password made of several words" .e icursor 2 event generate .e <<NextWord>> ; # shall move insert to index end .e delete 0 insert lappend res [.e get] } -cleanup { destroy .e } -result {{} {}} # Gathered comments about lacks # XXX Still need to write tests for EntryBlinkProc, EntryFocusProc, # and EntryTextVarProc. # No tests for DisplayEntry. # XXX Still need to write tests for EntryScanTo and EntrySelectTo. |
︙ | ︙ |
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 | 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.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}] update idletasks wm deiconify .top2 update idletasks 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 update idletasks _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}] _pause 200 wm deiconify .top2 update idletasks 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} { |
︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 | if {[testConstraint altDisplay]} { focusSetupAlt } test focus-1.1 {Tk_FocusCmd procedure} -constraints unix -body { focusClear focus } -result {} test focus-1.2 {Tk_FocusCmd procedure} -constraints { unix altDisplay } -body { focus .alt.b focus | > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | if {[testConstraint altDisplay]} { focusSetupAlt } test focus-1.1 {Tk_FocusCmd procedure} -constraints unix -body { focusClear after 100 focus } -result {} test focus-1.2 {Tk_FocusCmd procedure} -constraints { unix altDisplay } -body { focus .alt.b focus |
︙ | ︙ | |||
750 751 752 753 754 755 756 757 758 759 760 761 762 | focus -force .top.s3 update focus } -cleanup { destroy .top } -result {.top.s3} deleteWindows # cleanup cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > | 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 | focus -force .top.s3 update focus } -cleanup { destroy .top } -result {.top.s3} test focus-8.1 {fdc0ed342d - segfault on focus -force} -body { pack [button .b0] toplevel .one update event generate .one <Motion> -warp 1 -x 175 -y 175 update idletasks destroy {*}[winfo children .] toplevel .t pack [canvas .t.c] update destroy .t.c pack [label .t.l] update destroy .t.l destroy {*}[winfo children .] proc crashit {} { pack [listbox .l] update focus -force .l; # This line segfaulted *with xvfb* set res Reached } crashit } -result {Reached} deleteWindows # cleanup cleanupTests return |
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)]}] set defaultfontlist [font names] proc getnondefaultfonts {} { global defaultfontlist set nondeffonts [list ] foreach afont [font names] { |
︙ | ︙ | |||
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 {*} | | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | } -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 | | | | 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 | 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] | | | | | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | } -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 |
︙ | ︙ | |||
593 594 595 596 597 598 599 | test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { testfont } -setup { destroy .b1 .b2 } -body { | | | > | | | > | | | > | 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 | test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { testfont } -setup { destroy .b1 .b2 } -body { set x [font create font-15.1_font -family Times -size 16] lindex $x 0 button .b1 -font $x lindex $x 0 testfont counts $x } -cleanup { font delete font-15.1_font destroy .b1 .b2 } -result {{1 0}} test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { testfont } -setup { destroy .b1 .b2 set result {} } -body { set x [font create font-15.2_font -family Times -size 16] button .b1 -font $x destroy .b1 lappend result [testfont counts $x] button .b2 -font $x lappend result [testfont counts $x] } -cleanup { font delete font-15.2_font destroy .b2 } -result {{} {{1 1}}} test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { testfont } -setup { destroy .b1 .b2 set result {} } -body { set x [font create font-15.3_font -family Times -size 16] button .b1 -font $x lappend result [testfont counts $x] button .b2 -font $x pack .b1 .b2 -side top lappend result [testfont counts $x] } -cleanup { font delete font-15.3_font destroy .b1 .b2 } -result {{{1 1}} {{2 1}}} test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup { destroy .t.f pack [label .t.f] update } -body { |
︙ | ︙ | |||
744 745 746 747 748 749 750 | .t.f cget -font } -cleanup { destroy .t.f } -result {-family fixed} test font-17.1 {Tk_FreeFontFromObj - reference counts} -constraints { | | | | | | | > > | 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 | .t.f cget -font } -cleanup { destroy .t.f } -result {-family fixed} test font-17.1 {Tk_FreeFontFromObj - reference counts} -constraints { testfont } -setup { destroy .b1 .b2 .b3 set result {} } -body { set x [font create font-17.1_font -family Courier -size 12] button .b1 -font $x button .b3 -font $x button .b2 -font $x lappend result [testfont counts $x] destroy .b1 lappend result [testfont counts $x] destroy .b2 lappend result [testfont counts $x] destroy .b3 lappend result [testfont counts $x] } -cleanup { font delete font-17.1_font } -result {{{3 1}} {{2 1}} {{1 1}} {}} test font-17.2 {Tk_FreeFont procedure: one ref} -setup { destroy .t.f pack [label .t.f] update } -body { # (fontPtr->refCount == 0) |
︙ | ︙ | |||
831 832 833 834 835 836 837 | } -result {-family -family} test font-18.1 {FreeFontObjProc} -constraints testfont -setup { destroy .b1 set result {} } -body { | > | | | | | | | > > | 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 | } -result {-family -family} test font-18.1 {FreeFontObjProc} -constraints testfont -setup { destroy .b1 set result {} } -body { set f [font create font-18.1_font -family Courier -size 12] set x [join [list $f 50] { }] button .b1 -font $x set y [join [list $f 50] { }] .b1 configure -font $y set z [join [list $f 50] { }] .b1 configure -font $z lappend result [testfont counts [list $f 50]] set x red lappend result [testfont counts [list $f 50]] set z 32 lappend result [testfont counts [list $f 50]] destroy .b1 lappend result [testfont counts [list $f 50]] set y bogus return $result } -cleanup { font delete font-18.1_font } -result {{{1 3}} {{1 2}} {{1 1}} {}} test font-19.1 {Tk_FontId} -setup { destroy .t.f pack [label .t.f] update |
︙ | ︙ | |||
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 { | | | | 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 | 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 { | | | 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 | # 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 {} |
︙ | ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | test font-38.9 {ParseFontNameObj procedure: arguments} -body { font actual {times 20 xyz xyz} } -returnCodes error -result {unknown font style "xyz"} test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { | | | 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 | test font-38.9 {ParseFontNameObj procedure: arguments} -body { font actual {times 20 xyz xyz} } -returnCodes error -result {unknown font style "xyz"} test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { unixOrWin haveTimes12BoldItalicUnderlineOverstrikeFont } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} test font-38.12 {ParseFontNameObj procedure: stylelist error} -body { font actual {times 12 bold xyz} } -returnCodes error -result {unknown font style "xyz"} test font-38.13 "ParseFontNameObj: options with hyphenated family: bug #2791352" -body { |
︙ | ︙ | |||
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] | | > | | | | | 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 | 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} -setup { set oldscale [tk scaling] } -body { set oldsize [expr {-(-12.0 / $oldscale)}] tk scaling 0.5 expr {round([font actual {times -12} -size] / $oldscale * 0.5) - round($oldsize) == 0} } -cleanup { tk scaling $oldscale } -result 1 test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { set oldscale [tk scaling] } -body { tk scaling 0.5 font actual {times 12} -size } -cleanup { tk scaling $oldscale } -result 12 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 | # Test the "tk::fontchooser" command # # Copyright © 2008 Pat Thoyts package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands # 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} { |
︙ | ︙ | |||
178 179 180 181 182 183 184 | } then { Click ok } expr {$::testfont ne {}} } -result 1 | | > > > > > > | 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 | } then { Click ok } expr {$::testfont ne {}} } -result 1 test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl haveTimes14BoldFont} -body { start { tk::fontchooser::Configure -command ApplyFont -font {times 14 bold} 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 |
︙ | ︙ | |||
72 73 74 75 76 77 78 | # Returns the option names out of a list of option details. # # Arguments: # options - The option detail list. proc optnames {options} { lsort [lmap desc $options {lindex $desc 0}] } | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # Returns the option names out of a list of option details. # # Arguments: # options - The option detail list. proc optnames {options} { lsort [lmap desc $options {lindex $desc 0}] } test frame-1.1 {frame configuration options} -setup { deleteWindows } -body { frame .f -class NewFrame .f configure -class } -cleanup { deleteWindows |
︙ | ︙ | |||
194 195 196 197 198 199 200 | .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result 4 test frame-1.16 {frame configuration options} -body { .f configure -bd badValue | | | | | 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 | .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result 4 test frame-1.16 {frame configuration options} -body { .f configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-1.17 {frame configuration options} -body { .f configure -bg #00ff00 lindex [.f configure -bg] 4 } -cleanup { .f configure -bg [lindex [.f configure -bg] 3] } -result "#00ff00" test frame-1.18 {frame configuration options} -body { .f configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-1.19 {frame configuration options} -body { .f configure -borderwidth 1.3 lindex [.f configure -borderwidth] 4 } -cleanup { .f configure -borderwidth [lindex [.f configure -borderwidth] 3] } -result 1 test frame-1.20 {frame configuration options} -body { .f configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-1.21 {frame configuration options} -body { .f configure -cursor arrow lindex [.f configure -cursor] 4 } -cleanup { .f configure -cursor [lindex [.f configure -cursor] 3] } -result {arrow} test frame-1.22 {frame configuration options} -body { .f configure -cursor badValue } -returnCodes error -result {bad cursor spec "badValue"} test frame-1.23 {frame configuration options} -body { .f configure -height 100 lindex [.f configure -height] 4 } -cleanup { .f configure -height [lindex [.f configure -height] 3] } -result 100 test frame-1.24 {frame configuration options} -body { .f configure -height not_a_number } -returnCodes error -result {expected screen distance but got "not_a_number"} test frame-1.25 {frame configuration options} -body { .f configure -highlightbackground #112233 lindex [.f configure -highlightbackground] 4 } -cleanup { .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3] } -result "#112233" test frame-1.26 {frame configuration options} -body { |
︙ | ︙ | |||
257 258 259 260 261 262 263 | .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3] } -result 6 test frame-1.30 {frame configuration options} -body { .f configure -highlightthickness badValue | | | | | 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 | .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3] } -result 6 test frame-1.30 {frame configuration options} -body { .f configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-1.31 {frame configuration options} -body { .f configure -padx 3 lindex [.f configure -padx] 4 } -cleanup { .f configure -padx [lindex [.f configure -padx] 3] } -result 3 test frame-1.32 {frame configuration options} -body { .f configure -padx badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-1.33 {frame configuration options} -body { .f configure -pady 4 lindex [.f configure -pady] 4 } -cleanup { .f configure -pady [lindex [.f configure -pady] 3] } -result 4 test frame-1.34 {frame configuration options} -body { .f configure -pady badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-1.35 {frame configuration options} -body { .f configure -relief ridge lindex [.f configure -relief] 4 } -cleanup { .f configure -relief [lindex [.f configure -relief] 3] } -result {ridge} test frame-1.36 {frame configuration options} -returnCodes error -body { |
︙ | ︙ | |||
299 300 301 302 303 304 305 | .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result 32 test frame-1.39 {frame configuration options} -body { .f configure -width badValue | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result 32 test frame-1.39 {frame configuration options} -body { .f configure -width badValue } -returnCodes error -result {expected screen distance but got "badValue"} destroy .f test frame-2.1 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -class NewClass wm geometry .t +0+0 |
︙ | ︙ | |||
499 500 501 502 503 504 505 | } -returnCodes error -result {unknown color name "non-existent"} test frame-2.22 {toplevel configuration options} -body { .t configure -bd 4 lindex [.t configure -bd] 4 } -result 4 test frame-2.23 {toplevel configuration options} -body { .t configure -bd badValue | | | | | | | | | 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 | } -returnCodes error -result {unknown color name "non-existent"} test frame-2.22 {toplevel configuration options} -body { .t configure -bd 4 lindex [.t configure -bd] 4 } -result 4 test frame-2.23 {toplevel configuration options} -body { .t configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-2.24 {toplevel configuration options} -body { .t configure -bg #00ff00 lindex [.t configure -bg] 4 } -result "#00ff00" test frame-2.25 {toplevel configuration options} -body { .t configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-2.26 {toplevel configuration options} -body { .t configure -borderwidth 1.3 lindex [.t configure -borderwidth] 4 } -result 1 test frame-2.27 {toplevel configuration options} -body { .t configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-2.28 {toplevel configuration options} -body { .t configure -cursor arrow lindex [.t configure -cursor] 4 } -result {arrow} test frame-2.29 {toplevel configuration options} -body { .t configure -cursor badValue } -returnCodes error -result {bad cursor spec "badValue"} test frame-2.30 {toplevel configuration options} -body { .t configure -height 100 lindex [.t configure -height] 4 } -result 100 test frame-2.31 {toplevel configuration options} -body { .t configure -height not_a_number } -returnCodes error -result {expected screen distance but got "not_a_number"} test frame-2.32 {toplevel configuration options} -body { .t configure -highlightcolor #123456 lindex [.t configure -highlightcolor] 4 } -result "#123456" test frame-2.33 {toplevel configuration options} -body { .t configure -highlightcolor non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-2.34 {toplevel configuration options} -body { .t configure -highlightthickness 3 lindex [.t configure -highlightthickness] 4 } -result 3 test frame-2.35 {toplevel configuration options} -body { .t configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-2.36 {toplevel configuration options} -body { .t configure -padx 3 lindex [.t configure -padx] 4 } -result 3 test frame-2.37 {toplevel configuration options} -body { .t configure -padx badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-2.38 {toplevel configuration options} -body { .t configure -pady 4 lindex [.t configure -pady] 4 } -result 4 test frame-2.39 {toplevel configuration options} -body { .t configure -pady badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-2.40 {toplevel configuration options} -body { .t configure -relief ridge lindex [.t configure -relief] 4 } -result {ridge} test frame-2.41 {toplevel configuration options} -returnCodes error -body { .t configure -relief badValue } -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test frame-2.42 {toplevel configuration options} -body { .t configure -width 32 lindex [.t configure -width] 4 } -result 32 test frame-2.43 {toplevel configuration options} -body { .t configure -width badValue } -returnCodes error -result {expected screen distance but got "badValue"} destroy .t test frame-3.1 {TkCreateFrame procedure} -returnCodes error -body { frame } -result {wrong # args: should be "frame pathName ?-option value ...?"} test frame-3.2 {TkCreateFrame procedure} -setup { deleteWindows |
︙ | ︙ | |||
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 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | 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 { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 update option add *x.use [winfo id .t] toplevel .x -width 140 -height 300 -bg green tkwait visibility .x update list [expr {[winfo rootx .x] - [winfo rootx .t]}] \ [expr {[winfo rooty .x] - [winfo rooty .t]}] \ [winfo width .t] [winfo height .t] } -cleanup { destroy .t option clear } -result {0 0 140 300} |
︙ | ︙ | |||
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] | | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | 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 | | | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | 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 | < < < < | < < | < | < | 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 | } 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 |
︙ | ︙ | |||
1251 1252 1253 1254 1255 1256 1257 | .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result 4 test frame-13.13 {labelframe configuration options} -body { .f configure -bd badValue | | | | 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 | .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result 4 test frame-13.13 {labelframe configuration options} -body { .f configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-13.14 {labelframe configuration options} -body { .f configure -bg #00ff00 lindex [.f configure -bg] 4 } -cleanup { .f configure -bg [lindex [.f configure -bg] 3] } -result "#00ff00" test frame-13.15 {labelframe configuration options} -body { .f configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.16 {labelframe configuration options} -body { .f configure -borderwidth 1.3 lindex [.f configure -borderwidth] 4 } -cleanup { .f configure -borderwidth [lindex [.f configure -borderwidth] 3] } -result 1 test frame-13.17 {labelframe configuration options} -body { .f configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-13.18 {labelframe configuration options} -body { .f configure -cursor arrow lindex [.f configure -cursor] 4 } -cleanup { .f configure -cursor [lindex [.f configure -cursor] 3] } -result {arrow} test frame-13.19 {labelframe configuration options} -body { |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | .f configure -height 100 lindex [.f configure -height] 4 } -cleanup { .f configure -height [lindex [.f configure -height] 3] } -result 100 test frame-13.26 {labelframe configuration options} -body { .f configure -height not_a_number | | | 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | .f configure -height 100 lindex [.f configure -height] 4 } -cleanup { .f configure -height [lindex [.f configure -height] 3] } -result 100 test frame-13.26 {labelframe configuration options} -body { .f configure -height not_a_number } -returnCodes error -result {expected screen distance but got "not_a_number"} test frame-13.27 {labelframe configuration options} -body { .f configure -highlightbackground #112233 lindex [.f configure -highlightbackground] 4 } -cleanup { .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3] } -result "#112233" test frame-13.28 {labelframe configuration options} -body { |
︙ | ︙ | |||
1338 1339 1340 1341 1342 1343 1344 | .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3] } -result 6 test frame-13.32 {labelframe configuration options} -body { .f configure -highlightthickness badValue | | | | | 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 | .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3] } -result 6 test frame-13.32 {labelframe configuration options} -body { .f configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-13.33 {labelframe configuration options} -body { .f configure -labelanchor se lindex [.f configure -labelanchor] 4 } -cleanup { .f configure -labelanchor [lindex [.f configure -labelanchor] 3] } -result {se} test frame-13.34 {labelframe configuration options} -returnCodes error -body { .f configure -labelanchor badValue } -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws} test frame-13.35 {labelframe configuration options} -body { .f configure -padx 3 lindex [.f configure -padx] 4 } -cleanup { .f configure -padx [lindex [.f configure -padx] 3] } -result 3 test frame-13.36 {labelframe configuration options} -body { .f configure -padx badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-13.37 {labelframe configuration options} -body { .f configure -pady 4 lindex [.f configure -pady] 4 } -cleanup { .f configure -pady [lindex [.f configure -pady] 3] } -result 4 test frame-13.38 {labelframe configuration options} -body { .f configure -pady badValue } -returnCodes error -result {expected screen distance but got "badValue"} test frame-13.39 {labelframe configuration options} -body { .f configure -relief ridge lindex [.f configure -relief] 4 } -cleanup { .f configure -relief [lindex [.f configure -relief] 3] } -result {ridge} test frame-13.40 {labelframe configuration options} -returnCodes error -body { |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result 32 test frame-13.44 {labelframe configuration options} -body { .f configure -width badValue | | | 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result 32 test frame-13.44 {labelframe configuration options} -body { .f configure -width badValue } -returnCodes error -result {expected screen distance but got "badValue"} destroy .f test frame-14.1 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test that label is moved in stacking order label .l -text Mupp -font {helvetica 8} |
︙ | ︙ |
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 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 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 # helper routine to return "." to a sane state after a test. # The variable GRID_VERBOSE can be used to "look" at the result of one or all # of the tests proc grid_reset {{test ?} {top .}} { global GRID_VERBOSE if {[info exists GRID_VERBOSE]} { if {$GRID_VERBOSE eq "" || $GRID_VERBOSE eq $test} { puts -nonewline "grid test $test: " flush stdout gets stdin } } destroy {*}[winfo children $top] update foreach {cols rows} [grid size .] {} for {set i 0} {$i <= $cols} {incr i} { grid columnconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform "" } for {set i 0} {$i <= $rows} {incr i} { grid rowconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform "" |
︙ | ︙ | |||
295 296 297 298 299 300 301 | grid location . } -returnCodes error -result {wrong # args: should be "grid location window x y"} test grid-6.2 {location: basic argument checking} -body { grid location .bad 0 0 } -returnCodes error -result {bad window path name ".bad"} test grid-6.3 {location: basic argument checking} -body { grid location . x y | | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | grid location . } -returnCodes error -result {wrong # args: should be "grid location window x y"} test grid-6.2 {location: basic argument checking} -body { grid location .bad 0 0 } -returnCodes error -result {bad window path name ".bad"} test grid-6.3 {location: basic argument checking} -body { grid location . x y } -returnCodes error -result {expected screen distance but got "x"} test grid-6.4 {location: basic argument checking} -body { grid location . 1c y } -returnCodes error -result {expected screen distance but got "y"} test grid-6.5 {location: basic argument checking} -body { frame .f grid location .f 10 10 } -cleanup { grid_reset 6.5 } -result {-1 -1} test grid-6.6 {location (x)} -body { |
︙ | ︙ | |||
362 363 364 365 366 367 368 | set got $a } } return $result } -cleanup { grid_reset 6.8 } -result {{-10->-1 -1} {0->0 0} {16->0 1} {201->1 1}} | | < < | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | set got $a } } return $result } -cleanup { grid_reset 6.8 } -result {{-10->-1 -1} {0->0 0} {16->0 1} {201->1 1}} test grid-6.9 {location: check updates pending} -body { set a "" foreach i {0 1 2} { frame .$i -width 120 -height 75 -bg red lappend a [grid location . 150 90] grid .$i -row $i -column $i } return $a |
︙ | ︙ | |||
607 608 609 610 611 612 613 | } -cleanup { grid_reset 10.7 } -returnCodes error -result {bad option "-foo": must be -minsize, -pad, -uniform, or -weight} test grid-10.8 {column/row configure} -body { grid columnconfigure . 0 -minsize foo } -cleanup { grid_reset 10.8 | | | | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | } -cleanup { grid_reset 10.7 } -returnCodes error -result {bad option "-foo": must be -minsize, -pad, -uniform, or -weight} test grid-10.8 {column/row configure} -body { grid columnconfigure . 0 -minsize foo } -cleanup { grid_reset 10.8 } -returnCodes error -result {expected screen distance but got "foo"} test grid-10.9 {column/row configure} -body { grid columnconfigure . 0 -minsize foo } -cleanup { grid_reset 10.9 } -returnCodes error -result {expected screen distance but got "foo"} test grid-10.10 {column/row configure} -body { grid columnconfigure . 0 -minsize 10 grid columnconfigure . 0 -minsize } -cleanup { grid_reset 10.10 } -result 10 test grid-10.11 {column/row configure} -body { |
︙ | ︙ | |||
639 640 641 642 643 644 645 | } -cleanup { grid_reset 10.13 } -result 3 test grid-10.14 {column/row configure} -body { grid columnconfigure . 0 -pad foo } -cleanup { grid_reset 10.14 | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | } -cleanup { grid_reset 10.13 } -result 3 test grid-10.14 {column/row configure} -body { grid columnconfigure . 0 -pad foo } -cleanup { grid_reset 10.14 } -returnCodes error -result {expected screen distance but got "foo"} test grid-10.15 {column/row configure} -body { grid columnconfigure . 0 -pad -3 } -cleanup { grid_reset 10.15 } -returnCodes error -result {invalid arg "-pad": should be non-negative} test grid-10.16 {column/row configure} -body { grid columnconfigure . 0 -pad 3 |
︙ | ︙ |
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 |
︙ | ︙ | |||
47 48 49 50 51 52 53 | # Tk_PhotoExpand: no tests # Tk_PhotoGetSize: no tests # Tk_PhotoSetSize: no tests # TkGetPhotoValidRegion: no tests # ImgGetPhoto: no tests # Tk_PhotoGetImage no tests # ImgPostscriptPhoto no tests | | < < < < | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # Tk_PhotoExpand: no tests # Tk_PhotoGetSize: no tests # Tk_PhotoSetSize: no tests # TkGetPhotoValidRegion: no tests # ImgGetPhoto: no tests # Tk_PhotoGetImage no tests # ImgPostscriptPhoto no tests # Tk_PhotoGetMetadata: imgPhoto-21.* # Tk_PhotoSetMetadata: imgPhoto-22.* #-------------------------------------------------------------------------- # # # Some tests are not specific to a function in tkImgPhoto.c. They are: # |
︙ | ︙ | |||
78 79 80 81 82 83 84 | # - which does not exist. # package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # - which does not exist. # package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands # # Used for imgPhoto-4.65 - imgPhoto-4.73 # proc foreachPixel {img xVar yVar script} { upvar 1 $xVar x $yVar y set width [image width $img] set height [image height $img] |
︙ | ︙ | |||
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 {} | > > > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | 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 {} |
︙ | ︙ | |||
215 216 217 218 219 220 221 | # test imgPhoto-2.3 {ImgPhotoCreate procedure: creation failure} { # image create photo photo1 # image create photo photo2 -width 10 -height 10 # catch {image create photo photo2 -file bogus.img} msg # photo1 copy photo2 # set msg # } {couldn't open "bogus.img": no such file or directory} | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | # test imgPhoto-2.3 {ImgPhotoCreate procedure: creation failure} { # image create photo photo1 # image create photo photo2 -width 10 -height 10 # catch {image create photo photo2 -file bogus.img} msg # photo1 copy photo2 # set msg # } {couldn't open "bogus.img": no such file or directory} test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -constraints { hasTeapotPhoto } -body { image create photo photo1 -file $teapotPhotoFile photo1 configure -file $teapotPhotoFile } -cleanup { image delete photo1 |
︙ | ︙ | |||
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 | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | } -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 | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | 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 \ | | | | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | 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 \ | | | | 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | 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 \ |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | .c delete i1.2 photo1 configure -height 1 update image delete photo1 } -cleanup { destroy .c } -result {} | | | | 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 | .c delete i1.2 photo1 configure -height 1 update image delete photo1 } -cleanup { destroy .c } -result {} test imgPhoto-6.1 {ImgPhotoDisplay procedure, blank display} -setup { destroy .c pack [canvas .c] imageCleanup } -body { image create photo photo1 -width 10 -height 10 photo1 blank .c create image 10 10 -image photo1 update } -cleanup { destroy .c image delete photo1 } -result {} test imgPhoto-7.1 {ImgPhotoFree procedure, resource freeing} -constraints { hasTeapotPhoto } -setup { destroy .c pack [canvas .c] imageCleanup } -body { |
︙ | ︙ | |||
1464 1465 1466 1467 1468 1469 1470 | destroy .b1 update .f.b2 configure -image {} update destroy .f image delete photo1 } -result {} | | | 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 | destroy .b1 update .f.b2 configure -image {} update destroy .f image delete photo1 } -result {} test imgPhoto-8.1 {ImgPhotoDelete procedure} -constraints hasTeapotPhoto -body { image create photo photo2 -file $teapotPhotoFile image delete photo2 } -result {} test imgPhoto-8.2 {ImgPhotoDelete procedure} -constraints { hasTeapotPhoto } -setup { |
︙ | ︙ | |||
1488 1489 1490 1491 1492 1493 1494 | image create photo photo1 image create photo photo2 -width 10 -height 10 image delete photo2 photo1 copy photo2 } -returnCodes error -cleanup { imageCleanup } -result {image "photo2" doesn't exist or is not a photo image} | | | | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | image create photo photo1 image create photo photo2 -width 10 -height 10 image delete photo2 photo1 copy photo2 } -returnCodes error -cleanup { imageCleanup } -result {image "photo2" doesn't exist or is not a photo image} test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints { hasTeapotPhoto } -body { image create photo photo2 -file $teapotPhotoFile rename photo2 {} list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg } -result {0 1 {invalid command name "photo2"}} test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup { imageCleanup } -body { image create photo photo1 photo1 put "{#ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000}" -to 0 0 photo1 put "{#00ff00 #00ff00}" -to 2 0 list [photo1 get 2 0] [photo1 get 3 0] [photo1 get 4 0] |
︙ | ︙ | |||
1542 1543 1544 1545 1546 1547 1548 | } -body { image create photo photo1 photo1 copy photo1 -to 0 5 10 20 list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {0 0} | < | | 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | } -body { image create photo photo1 photo1 copy photo1 -to 0 5 10 20 list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {0 0} test imgPhoto-11.1 {Tk_FindPhoto} -setup { imageCleanup } -body { image create bitmap i1 image create photo photo1 photo1 copy i1 } -cleanup { imageCleanup } -returnCodes error -result {image "i1" doesn't exist or is not a photo image} test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} -constraints hasTeapotPhoto -body { image create photo p3 -file $teapotPhotoFile set result [list [p3 get 50 50] [p3 get 100 100]] p3 copy p3 -zoom 2 lappend result [image width p3] [image height p3] [p3 get 100 100] } -cleanup { image delete p3 |
︙ | ︙ | |||
1641 1642 1643 1644 1645 1646 1647 | } -body { x1 eval [list image create photo T1_data -data $data] x2 eval [list image create photo T1_data -data $data] } -cleanup { interp delete x1 interp delete x2 } -result T1_data | | | 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 | } -body { x1 eval [list image create photo T1_data -data $data] x2 eval [list image create photo T1_data -data $data] } -cleanup { interp delete x1 interp delete x2 } -result T1_data test imgPhoto-14.1 {GIF writes work correctly} -setup { set data { R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM hASs3MTcjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
︙ | ︙ | |||
1785 1786 1787 1788 1789 1790 1791 | test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constraints { nonPortable } -body { # This is not portable to very large machines with more than around 3GB of # free memory available... image create photo -width 32000 -height 32000 } -returnCodes error -result {not enough free memory for image buffer} | | | | 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 | test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constraints { nonPortable } -body { # This is not portable to very large machines with more than around 3GB of # free memory available... image create photo -width 32000 -height 32000 } -returnCodes error -result {not enough free memory for image buffer} test imgPhoto-16.1 {copying to self doesn't access freed memory} -setup { set i [image create photo] } -body { # Bug 877950 makes this crash when trying to copy out of a deallocated # area. $i put red -to 0 0 1000 1000 $i copy $i -from 0 0 1000 1000 -to 500 0 } -cleanup { image delete $i } -result {} # Check that we can guess our supported output formats [Bug 2983824] test imgPhoto-17.1 {photo write: format guessing from filename} -setup { set i [image create photo -width 3 -height 3] } -body { set f [makeFile {} test.png] $i write $f set fd [open $f] |
︙ | ︙ | |||
1857 1858 1859 1860 1861 1862 1863 | photo1 write $f } -cleanup { imageCleanup catch {removeFile $f} unset f } -returnCodes error -result \ {image file format "default" has no file writing capability} | | | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | photo1 write $f } -cleanup { imageCleanup catch {removeFile $f} unset f } -returnCodes error -result \ {image file format "default" has no file writing capability} test imgPhoto-18.1 {MatchFileFormat: "default" format not supported} -setup { image create photo photo1 set f [makeFile {} test.txt] } -body { photo1 read $f -format default } -cleanup { imageCleanup |
︙ | ︙ | |||
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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 {} test imgPhoto-21.4 {bug daa10097: only 3 metadata list items on configure} -setup { image create photo photo1 } -body { set a {} foreach line [photo1 configure] { if {[lindex $line 0] eq {-metadata}} { set a $line } } set a } -cleanup { catch {image delete photo1} } -result {-metadata {} {} {} {}} # 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.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-23.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-23.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-23.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-23.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-23.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-23.28 {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-23.29 {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 |
︙ | ︙ | |||
190 191 192 193 194 195 196 | foo configure -format "svg -scale 2" lappend res [image width foo] [image height foo] } -cleanup { rename foo "" unset res } -result {100 100 200 200} | < < | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | 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 { foo configure -format "svg -scale 2" } -cleanup { rename foo "" } -returnCodes error -match glob -result {couldn't open "*/tmpplus.svg": no such file or directory} # Special images test imgSVGnano-5.0 {image without any of "width", "height" and "viewbox"} -body { image create photo foo -data\ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\ "-//W3C//DTD SVG 1.0//EN\"\ |
︙ | ︙ | |||
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: | > > > > > > > > > > > > > | 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 | "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} tcltest::removeFile plus.svg tcltest::removeFile bad.svg };# 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 |
︙ | ︙ | |||
88 89 90 91 92 93 94 | .l configure -bd 4 list [lindex [.l configure -bd] 4] [.l cget -bd] } -cleanup { .l configure -bd [lindex [.l configure -bd] 3] } -result {4 4} test listbox-1.6 {configuration options} -body { .l configure -bd badValue | | | | 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 | .l configure -bd 4 list [lindex [.l configure -bd] 4] [.l cget -bd] } -cleanup { .l configure -bd [lindex [.l configure -bd] 3] } -result {4 4} test listbox-1.6 {configuration options} -body { .l configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test listbox-1.7 {configuration options} -body { .l configure -bg #ff0000 list [lindex [.l configure -bg] 4] [.l cget -bg] } -cleanup { .l configure -bg [lindex [.l configure -bg] 3] } -result {{#ff0000} #ff0000} test listbox-1.8 {configuration options} -body { .l configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test listbox-1.9 {configuration options} -body { .l configure -borderwidth 1.3 list [lindex [.l configure -borderwidth] 4] [.l cget -borderwidth] } -cleanup { .l configure -borderwidth [lindex [.l configure -borderwidth] 3] } -result {1 1} test listbox-1.10 {configuration options} -body { .l configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test listbox-1.11 {configuration options} -body { .l configure -cursor arrow list [lindex [.l configure -cursor] 4] [.l cget -cursor] } -cleanup { .l configure -cursor [lindex [.l configure -cursor] 3] } -result {arrow arrow} test listbox-1.12 {configuration options} -body { |
︙ | ︙ | |||
193 194 195 196 197 198 199 | .l configure -highlightthickness 6 list [lindex [.l configure -highlightthickness] 4] [.l cget -highlightthickness] } -cleanup { .l configure -highlightthickness [lindex [.l configure -highlightthickness] 3] } -result {6 6} test listbox-1.30 {configuration options} -body { .l configure -highlightthickness bogus | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | .l configure -highlightthickness 6 list [lindex [.l configure -highlightthickness] 4] [.l cget -highlightthickness] } -cleanup { .l configure -highlightthickness [lindex [.l configure -highlightthickness] 3] } -result {6 6} test listbox-1.30 {configuration options} -body { .l configure -highlightthickness bogus } -returnCodes error -result {expected screen distance but got "bogus"} test listbox-1.31 {configuration options} -body { .l configure -highlightthickness -2 list [lindex [.l configure -highlightthickness] 4] [.l cget -highlightthickness] } -cleanup { .l configure -highlightthickness [lindex [.l configure -highlightthickness] 3] } -result {0 0} test listbox-1.32.1 {configuration options} -setup { |
︙ | ︙ | |||
241 242 243 244 245 246 247 | .l configure -selectborderwidth 1.3 list [lindex [.l configure -selectborderwidth] 4] [.l cget -selectborderwidth] } -cleanup { .l configure -selectborderwidth [lindex [.l configure -selectborderwidth] 3] } -result {1 1} test listbox-1.38 {configuration options} -body { .l configure -selectborderwidth badValue | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | .l configure -selectborderwidth 1.3 list [lindex [.l configure -selectborderwidth] 4] [.l cget -selectborderwidth] } -cleanup { .l configure -selectborderwidth [lindex [.l configure -selectborderwidth] 3] } -result {1 1} test listbox-1.38 {configuration options} -body { .l configure -selectborderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test listbox-1.39 {configuration options} -body { .l configure -selectforeground #654321 list [lindex [.l configure -selectforeground] 4] [.l cget -selectforeground] } -cleanup { .l configure -selectforeground [lindex [.l configure -selectforeground] 3] } -result {{#654321} #654321} test listbox-1.40 {configuration options} -body { |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
2826 2827 2828 2829 2830 2831 2832 | destroy .l } -body { listbox .l .l insert end a b c d .l itemconfigure 0 } -cleanup { destroy .l | | | | | | | 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 | destroy .l } -body { listbox .l .l insert end a b c d .l itemconfigure 0 } -cleanup { destroy .l } -result [list {-background {} {} {} {}} \ {-bg -background} \ {-fg -foreground} \ {-foreground {} {} {} {}} \ {-selectbackground {} {} {} {}} \ {-selectforeground {} {} {} {}}] test listbox-23.3 {ConfigureListboxItem, itemco shortcut} -setup { destroy .l } -body { listbox .l .l insert end a b c d .l itemco 0 -background } -cleanup { destroy .l } -result {-background {} {} {} {}} test listbox-23.4 {ConfigureListboxItem, wrong num args} -setup { destroy .l } -body { listbox .l .l insert end a catch {.l itemco} result set result |
︙ | ︙ |
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 13 14 15 16 17 18 19 20 21 22 23 24 25 | # 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 # find the earth.gif file for use in these tests (tests 2.*) set earthPhotoFile [file join [file dirname [info script]] earth.gif] testConstraint hasEarthPhoto [file exists $earthPhotoFile] testConstraint pressbutton [llength [info commands pressbutton]] testConstraint movemouse [llength [info commands movemouse]] test menu-1.1 {Tk_MenuCmd procedure} -body { menu } -returnCodes error -result {wrong # args: should be "menu pathName ?-option value ...?"} test menu-1.2 {Tk_MenuCmd procedure} -body { menu bogus } -returnCodes error -result {bad window path name "bogus"} |
︙ | ︙ | |||
161 162 163 164 165 166 167 | test menu-2.3 {configuration options -activeborderwidth 1.3} -body { .m1 configure -activeborderwidth 1.3 .m1 cget -activeborderwidth } -result {1.3} test menu-2.4 {configuration options -activeborderwidth badValue} -body { .m1 configure -activeborderwidth badValue | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | test menu-2.3 {configuration options -activeborderwidth 1.3} -body { .m1 configure -activeborderwidth 1.3 .m1 cget -activeborderwidth } -result {1.3} test menu-2.4 {configuration options -activeborderwidth badValue} -body { .m1 configure -activeborderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test menu-2.5 {configuration options -activeforeground #ff0000} -body { .m1 configure -activeforeground #ff0000 .m1 cget -activeforeground } -result {#ff0000} test menu-2.6 {configuration options -activeforeground non-existent} -body { .m1 configure -activeforeground non-existent |
︙ | ︙ | |||
201 202 203 204 205 206 207 | test menu-2.11 {configuration options -borderwidth 1.3} -body { .m1 configure -borderwidth 1.3 .m1 cget -borderwidth } -result {1.3} test menu-2.12 {configuration options -borderwidth badValue} -body { .m1 configure -borderwidth badValue | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | test menu-2.11 {configuration options -borderwidth 1.3} -body { .m1 configure -borderwidth 1.3 .m1 cget -borderwidth } -result {1.3} test menu-2.12 {configuration options -borderwidth badValue} -body { .m1 configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test menu-2.13 {configuration options -cursor arrow} -body { .m1 configure -cursor arrow .m1 cget -cursor } -result {arrow} test menu-2.14 {configuration options -cursor badValue} -body { .m1 configure -cursor badValue |
︙ | ︙ | |||
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 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | 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 {e001} 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, id, 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 set c2 .t.c2 |
︙ | ︙ | |||
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 | | | | | | | 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 | } -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 { | | | | | | | | | | 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 | 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 | | | | | | | | 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 | } -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 |
︙ | ︙ | |||
2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 | toplevel .t3 wm geometry .t3 +0+0 . configure -menu .m1 .t2 configure -menu .m1 .t3 configure -menu .m1 list [destroy .m1] [destroy .t2] [destroy .t3] [. configure -menu ""] } -result {{} {} {} {}} test menu-7.1 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" destroy .m1 | > > > > > > > > | 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 | toplevel .t3 wm geometry .t3 +0+0 . configure -menu .m1 .t2 configure -menu .m1 .t3 configure -menu .m1 list [destroy .m1] [destroy .t2] [destroy .t3] [. configure -menu ""] } -result {{} {} {} {}} test menu-6.17 {TkDestroyMenu - bug 14a9b62e1d} -setup { deleteWindows } -body { menu .m1 .m1 add command -command {destroy .m1} .m1 invoke end winfo exists .m1 } -result {0} test menu-7.1 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" destroy .m1 |
︙ | ︙ | |||
2643 2644 2645 2646 2647 2648 2649 | test menu-11.15 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable] } -cleanup { deleteWindows | | | | 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 | test menu-11.15 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable] } -cleanup { deleteWindows } -result {e001 test} test menu-11.16 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add radiobutton -label "test" } -cleanup { deleteWindows } -result {e001} test menu-11.17 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add checkbutton list [.m1 entryconfigure 1 -onvalue "test"] [.m1 entrycget 1 -onvalue] } -cleanup { |
︙ | ︙ | |||
2814 2815 2816 2817 2818 2819 2820 | deleteWindows } -body { menu .m1 .m1 add command -label "test" list [.m1 insert last command -label "test2"] [.m1 entrycget last -label] } -cleanup { deleteWindows | | | | | 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 | deleteWindows } -body { menu .m1 .m1 add command -label "test" list [.m1 insert last command -label "test2"] [.m1 entrycget last -label] } -cleanup { deleteWindows } -result {e002 test2} test menu-13.5 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" list [.m1 insert end command -label "test2"] [.m1 entrycget end -label] } -cleanup { deleteWindows } -result {e002 test2} test menu-13.6 {TkGetMenuIndex} -setup { 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 { |
︙ | ︙ | |||
2920 2921 2922 2923 2924 2925 2926 | test menu-15.1 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" } -cleanup { deleteWindows | | | | | | | 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 | test menu-15.1 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" } -cleanup { deleteWindows } -result {e001} test menu-15.2 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test3" .m1 insert 2 command -label "test2" } -cleanup { deleteWindows } -result {e003} test menu-15.3 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" } -cleanup { deleteWindows } -result {e002} test menu-15.4 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" } -cleanup { deleteWindows } -result {e001} test menu-16.1 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 insert foo command -label "test" } -returnCodes error -result {bad menu entry index "foo"} test menu-16.2 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 insert test command -label "foo" } -cleanup { deleteWindows } -result {e002} test menu-16.3 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 insert -1 command -label "test" } -returnCodes error -result {bad menu entry index "-1"} test menu-16.4 {MenuAddOrInsert} -setup { |
︙ | ︙ | |||
2987 2988 2989 2990 2991 2992 2993 | test menu-16.5 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add cascade } -cleanup { deleteWindows | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | test menu-16.5 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add cascade } -cleanup { deleteWindows } -result {e001} test menu-16.6 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add checkbutton } -cleanup { deleteWindows } -result {e001} test menu-16.7 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {e001} test menu-16.8 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add radiobutton } -cleanup { deleteWindows } -result {e001} test menu-16.9 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add separator } -cleanup { deleteWindows } -result {e001} test menu-16.10 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add blork } -returnCodes error -result {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator} test menu-16.11 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {e001} test menu-16.12 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m2 clone .m3 list [.m2 add command -label "test"] [.m1 entrycget 1 -label] [.m3 entrycget 1 -label] } -cleanup { deleteWindows } -result {e001 test test} test menu-16.13 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m2 clone .m3 list [.m3 add command -label "test"] [.m1 entrycget 1 -label] [.m2 entrycget 1 -label] } -cleanup { deleteWindows } -result {e001 test test} test menu-16.14 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -blork fish } -returnCodes error -result {unknown option "-blork"} test menu-16.15 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "File" menu .container . configure -menu .container list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {e001 {}} test menu-16.16 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .m2 set tearoff [tk::TearOffMenu .m2] list [.m2 add cascade -menu .m1] [$tearoff unpost] } -cleanup { deleteWindows } -result {e001 {}} test menu-16.17 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .container . configure -menu .container set tearoff [tk::TearOffMenu .container] list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {e001 {}} test menu-16.18 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .container .container add cascade -menu .m1 . configure -menu .container list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {e002 {}} test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup { deleteWindows } -body { 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 {e001 {}} # 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 {e001 {}} 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 {e001 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 {e001 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 {e001 goodbye {}} test menu-17.6 {MenuVarProc [5d991b822e]} -setup { deleteWindows } -body { # Want this not to crash menu .b set var INIT .b add checkbutton -variable var |
︙ | ︙ | |||
3301 3302 3303 3304 3305 3306 3307 | deleteWindows } -result {} test menu-20.5 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 foo | | | 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 | 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 |
︙ | ︙ | |||
3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 | test menu-20.11 {CloneMenu} -setup { deleteWindows } -body { menu .m1 menu .m2 .m1 clone .m2 } -returnCodes error -result {window name "m2" already exists in parent} test menu-21.1 {MenuDoYPosition} -setup { deleteWindows } -body { menu .m1 .m1 yposition glorp } -returnCodes error -result {bad menu entry index "glorp"} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | test menu-20.11 {CloneMenu} -setup { deleteWindows } -body { menu .m1 menu .m2 .m1 clone .m2 } -returnCodes error -result {window name "m2" already exists in parent} test menu-20.12 {CloneMenu - copied bindings on empty menu} -setup { deleteWindows set x {} } -body { menu .m1 -tearoff 0 bind .m1 <<Test>> {append x <<Test>>} .m1 clone .m2 tearoff .m2 post 100 100 event generate .m2 <<Test>> return $x } -result {<<Test>>} test menu-20.13 {CloneMenu - copied bindings on non-empty menu} -setup { deleteWindows set x {} } -body { menu .m1 -tearoff 1 bind .m1 <<Test>> {append x <<Test>>} .m1 clone .m2 tearoff .m2 post 100 100 event generate .m2 <<Test>> return $x } -result {<<Test>>} test menu-20.14 {CloneMenu - new binding on empty menu} -setup { deleteWindows set x {} } -body { menu .m1 -tearoff 0 .m1 clone .m2 tearoff .m2 post 100 100 bind .m1 <<Test>> {append x <<Test>>} event generate .m2 <<Test>> return $x } -result {<<Test>>} test menu-20.15 {CloneMenu - new binding on non-empty menu} -setup { deleteWindows set x {} } -body { menu .m1 -tearoff 1 .m1 clone .m2 tearoff .m2 post 100 100 bind .m1 <<Test>> {append x <<Test>>} event generate .m2 <<Test>> return $x } -result {<<Test>>} test menu-20.16 {CloneMenu - bindtags} -setup { deleteWindows } -body { menu .m1 bindtags .m1 [linsert [bindtags .m1] 1 .m1.sub1] .m1 clone .m2 bindtags .m2 } -result {.m2 .m1 .m1.sub1 Menu all} test menu-21.1 {MenuDoYPosition} -setup { deleteWindows } -body { menu .m1 .m1 yposition glorp } -returnCodes error -result {bad menu entry index "glorp"} |
︙ | ︙ | |||
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 "" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 {GetIndexFromCoords: syntax error in @x,y indices} -setup { deleteWindows } -body { menu .m .m add command -label "First entry" .m add command -label "Second entry" .m add command -label "Last entry" .m index @4bogus } -cleanup { deleteWindows } -returnCodes error -result {bad menu entry index "@4bogus"} test menu-22.7 {GetIndexFromCoords: syntax error in @x,y indices} -setup { deleteWindows } -body { menu .m .m add command -label "First entry" .m add command -label "Second entry" .m add command -label "Last entry" .m index @10,4bogus } -cleanup { deleteWindows } -returnCodes error -result {bad menu entry index "@10,4bogus"} test menu-22.8 {GetIndexFromCoords: syntax error in @x,y indices} -setup { deleteWindows } -body { menu .m .m add command -label "First entry" .m add command -label "Second entry" .m add command -label "Last entry" .m index @10,bogus } -cleanup { deleteWindows } -returnCodes error -result {bad menu entry index "@10,bogus"} test menu-22.9 {GetIndexFromCoords: index type pecedence} -setup { deleteWindows } -body { menu .m -tearoff 0 .m add command -label "First entry" .m add command -label "@42nd street" .m add command -label "Last entry" .m index "@42nd*" ; # shall be interpreted as a pattern, not as @42 } -cleanup { deleteWindows } -result {1} test menu-22.10 {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] \ | | | | | | | | | | | | | | | | | | | 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 | } -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 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.2 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.3 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" destroy .m1 menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.4 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 menu .m2 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.5 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 .m1 clone .m2 menu .m3 list [. configure -menu .m3] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.6 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 .m1 clone .m2 . configure -menu .m2 menu .m3 list [. configure -menu .m3] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.7 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 .t2 configure -menu .m1 list [.t2 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.8 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 wm geometry .t2 +0+0 .t2 configure -menu .m1 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.9 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [.t3 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.10 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [.t2 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.11 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.12 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.13 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.14 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.15 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.16 {Tk_SetWindowMenubar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 list [toplevel .t2 -menu m1] [. configure -menu ""] } -cleanup { |
︙ | ︙ | |||
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 \ | | | 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 | 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} { | | | | 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 | } -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 { | | | | | 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 | 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 { | | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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} test menu-39.2 {use-after-free fix - bug 1797555fff} -setup { toplevel .t menu .t.menubar -type menubar menu .t.menubar.select -title Select menu .t.menubar.select.chain -title Chain .t.menubar.select insert 1 cascade -menu .t.menubar.select.chain -label Chain .t.menubar add cascade -menu .t.menubar.select -label Select .t configure -menu .t.menubar .t.menubar.select.chain insert 1 command update idletasks } -body { # The following two lines caused Tk to read from and write to freed memory destroy .t.menubar.select.chain .t.menubar.select delete 1 } -cleanup { destroy .t } -result {} test menu-40.1 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { } -constraints {pressbutton} -body { set done false event generate {} <Motion> -x 100 -y 100 toplevel .t menu .t.m .t.m add command -command {puts Marco} -label Marco .t.m add command -command {puts Polo} -label Polo after 1000 {.t.m post 500 500} after 2000 {destroy .t} after 2500 {pressbutton 530 510} after 3000 {set done true} tkwait variable done } test menu-40.2 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { } -constraints {movemouse} -body { set done false event generate {} <Motion> -x 100 -y 100 toplevel .t menu .t.m .t.m add command -command {puts Marco} -label Marco .t.m add command -command {puts Polo} -label Polo after 1000 {.t.m post 500 500} after 2000 {movemouse 530 510} after 3000 {destroy .t} after 3500 {movemouse 530 530} after 4000 pressbutton 530 530 after 4500 {set done true} tkwait variable done pressbutton 530 510 } test menu-41.1 {identifiers - auto generated} -setup { destroy .m } -body { menu .m list [.m add command -label 1] [.m add command -label 2] [.m add command -label 3] } -cleanup { destroy .m } -result {e001 e002 e003} test menu-41.2 {identifiers - out of sequence} -setup { destroy .m } -body { menu .m -tearoff 0 .m add command -label 1 .m insert 0 command -label 2 .m add command -label 3 list [.m index e001] [.m index e002] [.m index e003] } -cleanup { destroy .m } -result {1 0 2} test menu-41.3 {identifiers - out of sequence with tearoff} -setup { destroy .m } -body { menu .m -tearoff 1 .m add command -label 1 .m insert 0 command -label 2 .m add command -label 3 list [.m index e001] [.m index e002] [.m index e003] } -cleanup { destroy .m } -result {2 1 3} test menu-41.4 {identifiers - entry id} -setup { destroy .m } -body { menu .m -tearoff 1 .m add command -label 1 .m insert 0 command -label 2 .m add command -label 3 list [.m id 0] [.m id 1] [.m id 2] [.m id 3] } -cleanup { destroy .m } -result {{} e002 e001 e003} test menu-41.5 {identifiers - assigned} -setup { destroy .m } -body { menu .m list [.m add command cmd1 -label 1] [.m insert 0 command cmd2 -label 2] [.m add command cmd3 -label 3] } -cleanup { destroy .m } -result {cmd1 cmd2 cmd3} test menu-41.6 {identifiers - mixed} -setup { destroy .m } -body { menu .m list [.m add command -label 1] [.m insert 0 command cmd2 -label 2] [.m add command -label 3] } -cleanup { destroy .m } -result {e001 cmd2 e002} test menu-41.7 {identifiers - conflict} -setup { destroy .m } -body { menu .m list [.m add command e002 -label 1] [.m add command -label 2] [.m add command -label 3] } -cleanup { destroy .m } -result {e002 e001 e003} test menu-41.8 {identifiers - clone of complete menu} -setup { destroy .m1 .m2 } -body { menu .m1 -tearoff 0 .m1 add command -label 1 .m1 insert 0 command -label 2 .m1 add command cmd3 -label 3 .m1 clone .m2 list [.m2 index e001] [.m2 index e002] [.m2 index cmd3] } -cleanup { destroy .m1 .m2 } -result {1 0 2} test menu-41.9 {identifiers - modify after cloning} -setup { destroy .m1 .m2 } -body { menu .m1 -tearoff 0 .m1 clone .m2 .m1 add command -label 1 .m1 insert 0 command -label 2 .m1 add command cmd3 -label 3 list [.m2 index e001] [.m2 index e002] [.m2 index cmd3] } -cleanup { destroy .m1 .m2 } -result {1 0 2} test menu-41.10 {identifiers - modify clone} -setup { destroy .m1 .m2 } -body { menu .m1 -tearoff 0 .m1 clone .m2 .m2 add command -label 1 .m2 insert 0 command -label 2 .m2 add command cmd3 -label 3 list [.m1 index e001] [.m1 index e002] [.m1 index cmd3] } -cleanup { destroy .m1 .m2 } -result {1 0 2} test menu-41.11 {identifiers - entrycget by id} -setup { destroy .m } -body { menu .m .m add command -label 1 .m add command -label 2 .m add command cmd3 -label 3 list [.m entrycget e001 -label] [.m entrycget e002 -label] [.m entrycget cmd3 -label] } -cleanup { destroy .m } -result {1 2 3} test menu-41.12 {identifiers - delete by id} -setup { destroy .m } -body { menu .m .m add command -label 1 .m add command -label 2 .m add command -label 3 .m add command -label 4 .m add command -label 5 .m add command -label 6 .m add command -label 7 .m add command cmd8 -label 8 .m add command cmd9 -label 9 .m delete e003 cmd8 list [.m id 0] [.m id 1] [.m id 2] } -cleanup { destroy .m } -result {e001 e002 cmd9} test menu-41.13 {identifiers - duplicate} -setup { destroy .m } -body { menu .m .m add command foo -label 1 .m add command bar -label 2 .m add command foo -label 3 } -cleanup { destroy .m } -returnCodes error -result {entry "foo" already exists} test menu-41.14 {identifiers - reserved word} -setup { destroy .m } -body { menu .m -tearoff 0 .m add command last -label 1 .m add command -label 2 .m add command -label 3 .m index last } -cleanup { destroy .m } -result {2} # 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 |
︙ | ︙ | |||
23 24 25 26 27 28 29 | test menuDraw-2.1 {TkInitializeMenuEntryDrawingFields} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | test menuDraw-2.1 {TkInitializeMenuEntryDrawingFields} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {e001} test menuDraw-3.1 {TkMenuFreeDrawOptions} -setup { deleteWindows } -body { menu .m1 destroy .m1 |
︙ | ︙ | |||
82 83 84 85 86 87 88 | test menuDraw-6.1 {TkMenuConfigureEntryDrawOptions - no tkfont specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" } -cleanup { deleteWindows | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | test menuDraw-6.1 {TkMenuConfigureEntryDrawOptions - no tkfont specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.2 {TkMenuConfigureEntryDrawOptions - tkfont specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -font "Courier 12" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.3 {TkMenuConfigureEntryDrawOptions - active state - wrong entry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" .m1 entryconfigure 1 -state active } -cleanup { |
︙ | ︙ | |||
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 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 | 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 } -result {e001} test menuDraw-6.8 {TkMenuConfigureEntryDrawOptions - border specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -background "red" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.9 {TkMenuConfigureEntryDrawOptions - foreground specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -foreground "red" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.10 {TkMenuConfigureEntryDrawOptions - activeBorder specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -activebackground "red" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.11 {TkMenuConfigureEntryDrawOptions - activeforeground specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -activeforeground "red" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.12 {TkMenuConfigureEntryDrawOptions - selectcolor specified} -setup { deleteWindows } -body { menu .m1 .m1 add radiobutton -label "foo" -selectcolor "red" } -cleanup { deleteWindows } -result {e001} test menuDraw-6.13 {TkMenuConfigureEntryDrawOptions - textGC disposal} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" -font "Helvetica 12" .m1 entryconfigure 1 -font "Courier 12" } -cleanup { |
︙ | ︙ | |||
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 |
︙ | ︙ | |||
70 71 72 73 74 75 76 | .mb configure -bd 4 .mb cget -bd } -cleanup { .mb configure -bd [lindex [.mb configure -bd] 3] } -result 4 test menubutton-1.10 {configuration options} -body { .mb configure -bd badValue | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | .mb configure -bd 4 .mb cget -bd } -cleanup { .mb configure -bd [lindex [.mb configure -bd] 3] } -result 4 test menubutton-1.10 {configuration options} -body { .mb configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test menubutton-1.11 {configuration options} -body { .mb configure -bg #ff0000 .mb cget -bg } -cleanup { .mb configure -bg [lindex [.mb configure -bg] 3] } -result {#ff0000} test menubutton-1.12 {configuration options} -body { |
︙ | ︙ | |||
97 98 99 100 101 102 103 | .mb configure -borderwidth 1.3 .mb cget -borderwidth } -cleanup { .mb configure -borderwidth [lindex [.mb configure -borderwidth] 3] } -result 1 test menubutton-1.16 {configuration options} -body { .mb configure -borderwidth badValue | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | .mb configure -borderwidth 1.3 .mb cget -borderwidth } -cleanup { .mb configure -borderwidth [lindex [.mb configure -borderwidth] 3] } -result 1 test menubutton-1.16 {configuration options} -body { .mb configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test menubutton-1.17 {configuration options} -body { .mb configure -cursor arrow .mb cget -cursor } -cleanup { .mb configure -cursor [lindex [.mb configure -cursor] 3] } -result {arrow} test menubutton-1.18 {configuration options} -body { |
︙ | ︙ | |||
184 185 186 187 188 189 190 | .mb configure -highlightthickness 18 .mb cget -highlightthickness } -cleanup { .mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3] } -result 18 test menubutton-1.35 {configuration options} -body { .mb configure -highlightthickness badValue | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | .mb configure -highlightthickness 18 .mb cget -highlightthickness } -cleanup { .mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3] } -result 18 test menubutton-1.35 {configuration options} -body { .mb configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test menubutton-1.36 {configuration options} -constraints { testImageType } -setup { catch {image delete image1} image create test image1 } -body { .mb configure -image image1 |
︙ | ︙ | |||
236 237 238 239 240 241 242 | .mb configure -padx 12 .mb cget -padx } -cleanup { .mb configure -padx [lindex [.mb configure -padx] 3] } -result 12 test menubutton-1.44 {configuration options} -body { .mb configure -padx 420x | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | .mb configure -padx 12 .mb cget -padx } -cleanup { .mb configure -padx [lindex [.mb configure -padx] 3] } -result 12 test menubutton-1.44 {configuration options} -body { .mb configure -padx 420x } -returnCodes error -result {expected screen distance but got "420x"} test menubutton-1.45 {configuration options} -body { .mb configure -pady 12 .mb cget -pady } -cleanup { .mb configure -pady [lindex [.mb configure -pady] 3] } -result 12 test menubutton-1.46 {configuration options} -body { .mb configure -pady 420x } -returnCodes error -result {expected screen distance but got "420x"} test menubutton-1.47 {configuration options} -body { .mb configure -relief groove .mb cget -relief } -cleanup { .mb configure -relief [lindex [.mb configure -relief] 3] } -result {groove} test menubutton-1.48 {configuration options} -body { |
︙ | ︙ | |||
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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | .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 { .mb configure -width 3p } -returnCodes error -result {expected integer but got "3p"} test menubutton-1.58 {configuration options} -body { .mb configure -wraplength 100 .mb cget -wraplength } -cleanup { .mb configure -wraplength [lindex [.mb configure -wraplength] 3] } -result 100 test menubutton-1.59 {configuration options} -body { .mb configure -wraplength 6x } -returnCodes error -result {expected screen distance but got "6x"} deleteWindows menubutton .mb -text "Test" pack .mb update test menubutton-2.1 {Tk_MenubuttonCmd procedure} -body { |
︙ | ︙ | |||
432 433 434 435 436 437 438 | test menubutton-4.5 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -bitmap questhead .mb1 configure -width abc } -cleanup { deleteWindows | | | | | | 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 | test menubutton-4.5 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -bitmap questhead .mb1 configure -width abc } -cleanup { deleteWindows } -returnCodes error -result {expected screen distance but got "abc"} test menubutton-4.6 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -bitmap questhead catch {.mb1 configure -width abc} return $errorInfo } -cleanup { deleteWindows } -result {expected screen distance but got "abc" (processing -width option) invoked from within ".mb1 configure -width abc"} test menubutton-4.7 {ConfigureMenuButton procedure} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 button .mb1 -image image1 .mb1 configure -height 0.5x } -cleanup { deleteWindows imageCleanup } -returnCodes error -result {expected screen distance but got "0.5x"} test menubutton-4.8 {ConfigureMenuButton procedure} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 button .mb1 -image image1 catch {.mb1 configure -height 0.5x} return $errorInfo } -cleanup { deleteWindows imageCleanup } -result {expected screen distance but got "0.5x" (processing -height option) invoked from within ".mb1 configure -height 0.5x"} test menubutton-4.9 {ConfigureMenuButton procedure} -constraints { nonPortable fonts } -setup { |
︙ | ︙ | |||
538 539 540 541 542 543 544 | menubutton .mb1 rename .mb1 {} list [info command .mb*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} | | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | menubutton .mb1 rename .mb1 {} list [info command .mb*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} if {[tk windowingsystem] eq "aqua"} { set extraWidth 36 } else { set extraWidth 0 } test menubutton-7.1 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { |
︙ | ︙ |
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 |
︙ | ︙ | |||
86 87 88 89 90 91 92 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bd badValue } -cleanup { destroy .m | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bd badValue } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance but got "badValue"} test message-1.9 {configuration option: "bg"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bg #ff0000 |
︙ | ︙ | |||
117 118 119 120 121 122 123 | pack .m update } -body { .m configure -borderwidth 1.3 .m cget -borderwidth } -cleanup { destroy .m | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | pack .m update } -body { .m configure -borderwidth 1.3 .m cget -borderwidth } -cleanup { destroy .m } -result 1.3 test message-1.12 {configuration option: "borderwidth"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -borderwidth badValue } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance but got "badValue"} test message-1.13 {configuration option: "cursor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -cursor arrow |
︙ | ︙ | |||
266 267 268 269 270 271 272 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightthickness badValue } -cleanup { destroy .m | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightthickness badValue } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance but got "badValue"} test message-1.27 {configuration option: "justify"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -justify right |
︙ | ︙ | |||
306 307 308 309 310 311 312 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -padx 420x } -cleanup { destroy .m | | | | 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 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -padx 420x } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance or "" but got "420x"} test message-1.31 {configuration option: "pady"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -pady 12m .m cget -pady } -cleanup { destroy .m } -result {12m} test message-1.32 {configuration option: "pady"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -pady 420x } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance or "" but got "420x"} test message-1.33 {configuration option: "relief"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -relief ridge |
︙ | ︙ | |||
388 389 390 391 392 393 394 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -width badValue } -cleanup { destroy .m | | | | | 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 | message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -width badValue } -cleanup { destroy .m } -returnCodes {error} -result {expected screen distance but got "badValue"} test message-2.1 {Tk_MessageObjCmd procedure} -body { message } -returnCodes {error} -result {wrong # args: should be "message pathName ?-option value ...?"} test message-2.2 {Tk_MessageObjCmd procedure} -body { message foo } -returnCodes {error} -result {bad window path name "foo"} test message-2.3 {Tk_MessageObjCmd procedure} -body { catch {message foo} winfo children . } -result {} test message-2.4 {Tk_MessageObjCmd procedure} -body { message .s -gorp dump } -returnCodes {error} -result {unknown option "-gorp"} test message-2.5 {Tk_MessageObjCmd procedure} -body { catch {message .s -gorp dump} winfo children . } -result {} test message-3.1 {MessageWidgetObjCmd procedure} -setup { message .m } -body { .m |
︙ | ︙ |
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 |
︙ | ︙ |
Deleted tests/oldpack.test.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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 |
︙ | ︙ | |||
357 358 359 360 361 362 363 | test option-14.12 {error conditions} -body { option get .gorp.gorp a A } -returnCodes error -result {bad window path name ".gorp.gorp"} set option1 [file join [testsDirectory] option.file1] test option-15.1 {database files} -body { | | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | test option-14.12 {error conditions} -body { option get .gorp.gorp a A } -returnCodes error -result {bad window path name ".gorp.gorp"} set option1 [file join [testsDirectory] option.file1] test option-15.1 {database files} -body { list [catch {option read non-existent} msg] [string tolower $msg] } -result {1 {couldn't open "non-existent": no such file or directory}} test option-15.2 {database files} -body { option read $option1 option get . x1 color } -result blue test option-15.3 {database files} -constraints appNameIsTktest -body { option read $option1 option get . x2 color |
︙ | ︙ | |||
400 401 402 403 404 405 406 | option read $option2 } -returnCodes error -result {missing colon on line 2} set option3 [file join [testsDirectory] option.file3] option read $option3 test option-15.11 {database files} {option get . {x 4} color} brówn test option-16.1 {ReadOptionFile} -body { | | | | > > | | 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 | option read $option2 } -returnCodes error -result {missing colon on line 2} set option3 [file join [testsDirectory] option.file3] option read $option3 test option-15.11 {database files} {option get . {x 4} color} brówn test option-16.1 {ReadOptionFile} -body { set option4 [makeFile {} option.file4] set file [open $option4 w] fconfigure $file -translation crlf puts $file "*x7: true\n*x8: false" close $file option read $option4 userDefault list [option get . x7 color] [option get . x8 color] } -cleanup { removeFile $option4 } -result {true false} set opt162val {label { foo bar } } set opt162list [split $opt162val \n] test option-16.2 {ticket 766ef52f3} -body { set option5 [makeFile {} option.file5] set file [open $option5 w] fconfigure $file -translation crlf puts $file "*notok: $opt162list" close $file option read $option5 userDefault option get . notok notok } -cleanup { removeFile $option5 } -result $opt162list deleteWindows # cleanup cleanupTests return |
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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # 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 wm minsize .pack 1 1 update idletasks foreach i {a b c d} { frame .pack.$i label .pack.$i.label -text $i -relief raised place .pack.$i.label -relwidth 1.0 -relheight 1.0 } .pack.a config -width 20 -height 40 .pack.b config -width 50 -height 30 .pack.c config -width 80 -height 80 .pack.d config -width 40 -height 30 test pack-1.1 {-side option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] |
︙ | ︙ | |||
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 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 | 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} # Tests pack-18.1.1 and pack-18.2 are constrained with failsOnUbuntu # because they are failing in the GitHub CI environment, using Linux Ubuntu. # These tests are also constrained with failsOnXQuarz because they fail # on macOS when building with clang --disable-aqua (which uses XQuartz) # (this is the case both at GitHub CI and on a real Mac). # Analysis shows that, on both cases, WaitForMapNotify is giving up on # waiting for the MapNotify event that should show up when running # 'wm iconify'. The timeout delay (2s) is exceeded without the unmapping # having happened. The cause for this is unknown (see comments in WaitForMapNotify). # Tests pack-18.1.* are constrained because on Windows, when the width/height # is configured while the window is unmapped, the changes don't take # effect until the window is remapped. This is apparently by design of the # OS, and Tk accommodates this behavior (see UpdateGeometryInfo() and # ConfigureTopLevel() in tkWinWm.c). # pack-18.1.1 checks that, on Linux or macOS, width/height changes are taken # into account while the window is unmapped. # pack-18.1.2 checks that, on Windows, width/height changes are taken into # account on window remapping. test pack-18.1.1 {unmap content when container unmapped} -constraints { macOrUnix failsOnUbuntu failsOnXQuarz } -setup { destroy {*}[winfo children .pack] # adjust the position of .pack before test to avoid a screen switch # that occurs with window managers that have desktops four times as big # as the screen (screen switch causes scale and other tests to fail). wm geometry .pack +100+100 } -body { frame .pack.a -width 100 -height 50 -relief raised -bd 2 pack .pack.a update set result [winfo ismapped .pack.a] wm iconify .pack lappend result [winfo ismapped .pack.a] .pack.a configure -width 200 -height 75 update lappend result [winfo width .pack.a] [winfo height .pack.a] \ [winfo ismapped .pack.a] wm deiconify .pack update lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} test pack-18.1.2 {unmap content when container unmapped} -constraints { win } -setup { destroy {*}[winfo children .pack] # adjust the position of .pack before test to avoid a screen switch # that occurs with window managers that have desktops four times as big # as the screen (screen switch causes scale and other tests to fail). wm geometry .pack +100+100 } -body { frame .pack.a -width 100 -height 50 -relief raised -bd 2 pack .pack.a update set result [winfo ismapped .pack.a] wm iconify .pack lappend result [winfo ismapped .pack.a] .pack.a configure -width 200 -height 75 update wm deiconify .pack update lappend result [winfo width .pack.a] [winfo height .pack.a] lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 1} test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup { destroy {*}[winfo children .pack] # adjust the position of .pack before test to avoid a screen switch # that occurs with window managers that have desktops four times as big # as the screen (screen switch causes scale and other tests to fail). wm geometry .pack +100+100 } -body { frame .pack.a -relief raised -bd 2 frame .pack.b -width 70 -height 30 -relief sunken -bd 2 pack .pack.a pack .pack.b -in .pack.a update set result [winfo ismapped .pack.b] wm iconify .pack lappend result [winfo ismapped .pack.b] .pack.b configure -width 100 -height 30 update lappend result [winfo width .pack.b] [winfo height .pack.b] \ [winfo ismapped .pack.b] wm deiconify .pack update lappend result [winfo ismapped .pack.b] } -result {1 0 100 30 0 1} test pack-19.1 {test respect for internalborder} -setup { catch {pack forget {*}[pack content .pack]} destroy .pack.l .pack.lf } -body { wm geometry .pack 200x200 frame .pack.l -width 15 -height 10 labelframe .pack.lf -labelwidget .pack.l pack .pack.lf -fill both -expand 1 frame .pack.lf.f pack .pack.lf.f -fill both -expand 1 update set res [list [winfo geometry .pack.lf.f]] .pack.lf configure -labelanchor e -padx 3 -pady 5 update lappend res [winfo geometry .pack.lf.f] } -cleanup { destroy .pack.l .pack.lf } -result {196x188+2+10 177x186+5+7} test pack-19.2 {test support for minreqsize} -setup { catch {pack forget {*}[pack content .pack]} destroy .pack.l .pack.lf } -body { wm geometry .pack {} frame .pack.l -width 150 -height 100 labelframe .pack.lf -labelwidget .pack.l pack .pack.lf -fill both -expand 1 frame .pack.lf.f -width 20 -height 25 |
︙ | ︙ |
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 |
︙ | ︙ | |||
30 31 32 33 34 35 36 | .p configure -bd 4 list [lindex [.p configure -bd] 4] [.p cget -bd] } -cleanup { .p configure -bd [lindex [.p configure -bd] 3] } -result {4 4} test panedwindow-1.4 {configuration options: -bd (bad)} -body { .p configure -bd badValue | | | | | | 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 | .p configure -bd 4 list [lindex [.p configure -bd] 4] [.p cget -bd] } -cleanup { .p configure -bd [lindex [.p configure -bd] 3] } -result {4 4} test panedwindow-1.4 {configuration options: -bd (bad)} -body { .p configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.5 {configuration options: -bg (good)} -body { .p configure -bg #ff0000 list [lindex [.p configure -bg] 4] [.p cget -bg] } -cleanup { .p configure -bg [lindex [.p configure -bg] 3] } -result {{#ff0000} #ff0000} test panedwindow-1.6 {configuration options: -bg (bad)} -body { .p configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test panedwindow-1.7 {configuration options: -borderwidth (good)} -body { .p configure -borderwidth 1.3 list [lindex [.p configure -borderwidth] 4] [.p cget -borderwidth] } -cleanup { .p configure -borderwidth [lindex [.p configure -borderwidth] 3] } -result {1 1} test panedwindow-1.8 {configuration options: -borderwidth (bad)} -body { .p configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.9 {configuration options: -cursor (good)} -body { .p configure -cursor arrow list [lindex [.p configure -cursor] 4] [.p cget -cursor] } -cleanup { .p configure -cursor [lindex [.p configure -cursor] 3] } -result {arrow arrow} test panedwindow-1.10 {configuration options: -cursor (bad)} -body { .p configure -cursor badValue } -returnCodes error -result {bad cursor spec "badValue"} test panedwindow-1.11 {configuration options: -handlesize (good)} -body { .p configure -handlesize 20 list [lindex [.p configure -handlesize] 4] [.p cget -handlesize] } -cleanup { .p configure -handlesize [lindex [.p configure -handlesize] 3] } -result {20 20} test panedwindow-1.12 {configuration options: -handlesize (bad)} -body { .p configure -handlesize badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.13 {configuration options: -height (good)} -body { .p configure -height 20 list [lindex [.p configure -height] 4] [.p cget -height] } -cleanup { .p configure -height [lindex [.p configure -height] 3] } -result {20 20} test panedwindow-1.14 {configuration options: -height (bad)} -body { .p configure -height badValue } -returnCodes error -result {expected screen distance or "" but got "badValue"} test panedwindow-1.15 {configuration options: -opaqueresize (good)} -body { .p configure -opaqueresize true list [lindex [.p configure -opaqueresize] 4] [.p cget -opaqueresize] } -cleanup { .p configure -opaqueresize [lindex [.p configure -opaqueresize] 3] } -result {1 1} test panedwindow-1.16 {configuration options: -opaqueresize (bad)} -body { |
︙ | ︙ | |||
111 112 113 114 115 116 117 | .p configure -proxyborderwidth 1.3 list [lindex [.p configure -proxyborderwidth] 4] [.p cget -proxyborderwidth] } -cleanup { .p configure -proxyborderwidth [lindex [.p configure -proxyborderwidth] 3] } -result {1.3 1.3} test panedwindow-1.22 {configuration options: -proxyborderwidth (bad)} -body { .p configure -proxyborderwidth badValue | | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | .p configure -proxyborderwidth 1.3 list [lindex [.p configure -proxyborderwidth] 4] [.p cget -proxyborderwidth] } -cleanup { .p configure -proxyborderwidth [lindex [.p configure -proxyborderwidth] 3] } -result {1.3 1.3} test panedwindow-1.22 {configuration options: -proxyborderwidth (bad)} -body { .p configure -proxyborderwidth badValue } -returnCodes error -result {expected screen distance but got "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)} -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 { |
︙ | ︙ | |||
147 148 149 150 151 152 153 | .p configure -sashpad 1.3 list [lindex [.p configure -sashpad] 4] [.p cget -sashpad] } -cleanup { .p configure -sashpad [lindex [.p configure -sashpad] 3] } -result {1 1} test panedwindow-1.30 {configuration options: -sashpad (bad)} -body { .p configure -sashpad badValue | | | | | 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 | .p configure -sashpad 1.3 list [lindex [.p configure -sashpad] 4] [.p cget -sashpad] } -cleanup { .p configure -sashpad [lindex [.p configure -sashpad] 3] } -result {1 1} test panedwindow-1.30 {configuration options: -sashpad (bad)} -body { .p configure -sashpad badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.31 {configuration options: -sashrelief (good)} -body { .p configure -sashrelief groove list [lindex [.p configure -sashrelief] 4] [.p cget -sashrelief] } -cleanup { .p configure -sashrelief [lindex [.p configure -sashrelief] 3] } -result {groove groove} test panedwindow-1.32 {configuration options: -sashrelief (bad)} -body { .p configure -sashrelief 1.5 } -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} test panedwindow-1.33 {configuration options: -sashwidth (good)} -body { .p configure -sashwidth 10 list [lindex [.p configure -sashwidth] 4] [.p cget -sashwidth] } -cleanup { .p configure -sashwidth [lindex [.p configure -sashwidth] 3] } -result {10 10} test panedwindow-1.34 {configuration options: -sashwidth (bad)} -body { .p configure -sashwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.35 {configuration options: -showhandle (good)} -body { .p configure -showhandle true list [lindex [.p configure -showhandle] 4] [.p cget -showhandle] } -cleanup { .p configure -showhandle [lindex [.p configure -showhandle] 3] } -result {1 1} test panedwindow-1.36 {configuration options: -showhandle (bad)} -body { .p configure -showhandle foo } -returnCodes error -result {expected boolean value but got "foo"} test panedwindow-1.37 {configuration options: -width (good)} -body { .p configure -width 402 list [lindex [.p configure -width] 4] [.p cget -width] } -cleanup { .p configure -width [lindex [.p configure -width] 3] } -result {402 402} test panedwindow-1.38 {configuration options: -width (bad)} -body { .p configure -width badValue } -returnCodes error -result {expected screen distance or "" but got "badValue"} test panedwindow-1.39 {configuration options: -after (good)} -body { .p paneconfigure .b -after .c list [lindex [.p paneconfigure .b -after] 4] \ [.p panecget .b -after] } -cleanup { .p paneconfig .b -after [lindex [.p paneconfig .b -after] 3] |
︙ | ︙ | |||
214 215 216 217 218 219 220 | list [lindex [.p paneconfigure .b -height] 4] \ [.p panecget .b -height] } -cleanup { .p paneconfig .b -height [lindex [.p paneconfig .b -height] 3] } -result {10 10} test panedwindow-1.44 {configuration options: -height (bad)} -body { .p paneconfigure .b -height badValue | | | | | | 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 | list [lindex [.p paneconfigure .b -height] 4] \ [.p panecget .b -height] } -cleanup { .p paneconfig .b -height [lindex [.p paneconfig .b -height] 3] } -result {10 10} test panedwindow-1.44 {configuration options: -height (bad)} -body { .p paneconfigure .b -height badValue } -returnCodes error -result {expected screen distance or "" but got "badValue"} test panedwindow-1.45 {configuration options: -hide (good)} -body { .p paneconfigure .b -hide false list [lindex [.p paneconfigure .b -hide] 4] \ [.p panecget .b -hide] } -cleanup { .p paneconfig .b -hide [lindex [.p paneconfig .b -hide] 3] } -result {0 0} test panedwindow-1.46 {configuration options: -hide (bad)} -body { .p paneconfigure .b -hide foo } -returnCodes error -result {expected boolean value but got "foo"} test panedwindow-1.47 {configuration options: -minsize (good)} -body { .p paneconfigure .b -minsize 10 list [lindex [.p paneconfigure .b -minsize] 4] \ [.p panecget .b -minsize] } -cleanup { .p paneconfig .b -minsize [lindex [.p paneconfig .b -minsize] 3] } -result {10 10} test panedwindow-1.48 {configuration options: -minsize (bad)} -body { .p paneconfigure .b -minsize badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.49 {configuration options: -padx (good)} -body { .p paneconfigure .b -padx 1.3 list [lindex [.p paneconfigure .b -padx] 4] \ [.p panecget .b -padx] } -cleanup { .p paneconfig .b -padx [lindex [.p paneconfig .b -padx] 3] } -result {1 1} test panedwindow-1.50 {configuration options: -padx (bad)} -body { .p paneconfigure .b -padx badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.51 {configuration options: -pady (good)} -body { .p paneconfigure .b -pady 1.3 list [lindex [.p paneconfigure .b -pady] 4] \ [.p panecget .b -pady] } -cleanup { .p paneconfig .b -pady [lindex [.p paneconfig .b -pady] 3] } -result {1 1} test panedwindow-1.52 {configuration options: -pady (bad)} -body { .p paneconfigure .b -pady badValue } -returnCodes error -result {expected screen distance but got "badValue"} test panedwindow-1.53 {configuration options: -sticky (good)} -body { .p paneconfigure .b -sticky nsew list [lindex [.p paneconfigure .b -sticky] 4] \ [.p panecget .b -sticky] } -cleanup { .p paneconfig .b -sticky [lindex [.p paneconfig .b -sticky] 3] } -result {nesw nesw} |
︙ | ︙ | |||
284 285 286 287 288 289 290 | list [lindex [.p paneconfigure .b -width] 4] \ [.p panecget .b -width] } -cleanup { .p paneconfig .b -width [lindex [.p paneconfig .b -width] 3] } -result {10 10} test panedwindow-1.58 {configuration options: -width (bad)} -body { .p paneconfigure .b -width badValue | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | 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 | list [lindex [.p paneconfigure .b -width] 4] \ [.p panecget .b -width] } -cleanup { .p paneconfig .b -width [lindex [.p paneconfig .b -width] 3] } -result {10 10} test panedwindow-1.58 {configuration options: -width (bad)} -body { .p paneconfigure .b -width badValue } -returnCodes error -result {expected screen distance or "" but got "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 |
︙ | ︙ | |||
54 55 56 57 58 59 60 | } -cleanup { destroy ".t.a.b" } -result {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore} test place-2.1 {ConfigureContent procedure, -height option} -body { place .t.f2 -height abcd | | | | 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 | } -cleanup { destroy ".t.a.b" } -result {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore} test place-2.1 {ConfigureContent procedure, -height option} -body { place .t.f2 -height abcd } -returnCodes error -result {expected screen distance or "" but got "abcd"} test place-2.2 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 40 update winfo height .t.f2 } -result 40 test place-2.3 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 120 update place .t.f2 -height {} 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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | 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 test place-5.3 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .8 update place .t.f2 -relwidth {} update winfo width .t.f2 } -result 30 test place-6.1 {ConfigureContent procedure, -width option} -body { place .t.f2 -width abcd } -returnCodes error -result {expected screen distance or "" but got "abcd"} test place-6.2 {ConfigureContent procedure, -width option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -width 100 update winfo width .t.f2 } -result 100 |
︙ | ︙ | |||
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 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 | } -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} # Tests place-8.1 and place-8.2 are constrained with failsOnUbuntu # because they are failing in the GitHub CI environment, using Linux Ubuntu. # These tests are also constrained with failsOnXQuarz because they fail # on macOS when building with clang --disable-aqua (which uses XQuartz) # (this is the case both at GitHub CI and on a real Mac). # Analysis shows that, on both cases, WaitForMapNotify is giving up on # waiting for the MapNotify event that should show up when running # 'wm iconify'. The timeout delay (2s) is exceeded without the unmapping # having happened. The cause for this is unknown (see comments in WaitForMapNotify). test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f } -body { place .t.f2 -relx 1.0 -rely 1.0 -anchor sw update set result [winfo ismapped .t.f2] wm iconify .t lappend result [winfo ismapped .t.f2] place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw update lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2] wm deiconify .t update lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f } -body { place .t.f -x 0 -y 0 -width 200 -height 100 place .t.f2 -in .t.f -relx 1.0 -rely 1.0 -anchor sw -width 50 -height 20 update set result [winfo ismapped .t.f2] wm iconify .t lappend result [winfo ismapped .t.f2] place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw update lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2] wm deiconify .t update lappend result [winfo ismapped .t.f2] } -result {1 0 42 32 0 1} destroy .t test place-9.1 {PlaceObjCmd} -body { place |
︙ | ︙ | |||
353 354 355 356 357 358 359 | destroy .foo } -body { frame .foo place .foo -x 0 -y 0 place configure .foo } -cleanup { destroy .foo | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | destroy .foo } -body { frame .foo place .foo -x 0 -y 0 place configure .foo } -cleanup { destroy .foo } -result [list {-anchor {} {} nw nw} {-bordermode {} {} inside inside} {-height {} {} {} {}} {-in {} {} {} .} {-relheight {} {} {} {}} {-relwidth {} {} {} {}} {-relx {} {} 0.0 0.0} {-rely {} {} 0.0 0.0} {-width {} {} {} {}} {-x {} {} 0 0} {-y {} {} 0 0}] test place-9.9 {PlaceObjCmd, configure} -setup { destroy .foo } -body { frame .foo place .foo -x 0 -y 0 place configure .foo -x } -cleanup { |
︙ | ︙ | |||
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 | # 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 {} { destroy {*}[winfo children .raise] 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 |
︙ | ︙ | |||
137 138 139 140 141 142 143 | } -result {ok {appname not accessible in a safe interpreter}} test safe-2.4 {Unsafe subcommands not available} -setup { catch {safe::interpDelete a} } -body { safe::interpCreate a safe::loadTk a set status broken | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | } -result {ok {appname not accessible in a safe interpreter}} test safe-2.4 {Unsafe subcommands not available} -setup { catch {safe::interpDelete a} } -body { safe::interpCreate a safe::loadTk a set status broken if {[catch {interp eval a {tk scaling 1}} msg]} { set status ok } list $status $msg } -cleanup { safe::interpDelete a } -result {ok {setting the scaling not accessible in a safe interpreter}} test safe-3.1 {Unsafe commands are available hidden} -setup { catch {safe::interpDelete a} } -body { safe::interpCreate a safe::loadTk a set status ok |
︙ | ︙ |
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 |
︙ | ︙ | |||
45 46 47 48 49 50 51 | .s configure -bd 4 .s cget -bd } -cleanup { .s configure -bd [lindex [.s configure -bd] 3] } -result 4 test scale-1.6 {configuration options} -body { .s configure -bd badValue | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | .s configure -bd 4 .s cget -bd } -cleanup { .s configure -bd [lindex [.s configure -bd] 3] } -result 4 test scale-1.6 {configuration options} -body { .s configure -bd badValue } -returnCodes error -result {expected screen distance but got "badValue"} test scale-1.7 {configuration options} -body { .s configure -bigincrement 12.5 .s cget -bigincrement } -cleanup { .s configure -bigincrement [lindex [.s configure -bigincrement] 3] } -result {12.5} test scale-1.8 {configuration options} -body { |
︙ | ︙ | |||
72 73 74 75 76 77 78 | .s configure -borderwidth 1.3 .s cget -borderwidth } -cleanup { .s configure -borderwidth [lindex [.s configure -borderwidth] 3] } -result 1 test scale-1.12 {configuration options} -body { .s configure -borderwidth badValue | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | .s configure -borderwidth 1.3 .s cget -borderwidth } -cleanup { .s configure -borderwidth [lindex [.s configure -borderwidth] 3] } -result 1 test scale-1.12 {configuration options} -body { .s configure -borderwidth badValue } -returnCodes error -result {expected screen distance but got "badValue"} test scale-1.13 {configuration options} -body { .s configure -command {set x} .s cget -command } -cleanup { .s configure -command [lindex [.s configure -command] 3] } -result {set x} test scale-1.15 {configuration options} -body { |
︙ | ︙ | |||
156 157 158 159 160 161 162 | .s configure -highlightthickness 2 .s cget -highlightthickness } -cleanup { .s configure -highlightthickness [lindex [.s configure -highlightthickness] 3] } -result 2 test scale-1.32 {configuration options} -body { .s configure -highlightthickness badValue | | | | 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 | .s configure -highlightthickness 2 .s cget -highlightthickness } -cleanup { .s configure -highlightthickness [lindex [.s configure -highlightthickness] 3] } -result 2 test scale-1.32 {configuration options} -body { .s configure -highlightthickness badValue } -returnCodes error -result {expected screen distance but got "badValue"} test scale-1.33 {configuration options} -body { .s configure -label {Some text} .s cget -label } -cleanup { .s configure -label [lindex [.s configure -label] 3] } -result {Some text} test scale-1.35 {configuration options} -body { .s configure -length 130 .s cget -length } -cleanup { .s configure -length [lindex [.s configure -length] 3] } -result 130 test scale-1.36 {configuration options} -body { .s configure -length badValue } -returnCodes error -result {expected screen distance but got "badValue"} test scale-1.37 {configuration options} -body { .s configure -orient horizontal .s cget -orient } -cleanup { .s configure -orient [lindex [.s configure -orient] 3] } -result {horizontal} test scale-1.38 {configuration options} -body { |
︙ | ︙ | |||
240 241 242 243 244 245 246 | .s configure -sliderlength 86 .s cget -sliderlength } -cleanup { .s configure -sliderlength [lindex [.s configure -sliderlength] 3] } -result 86 test scale-1.52 {configuration options} -body { .s configure -sliderlength badValue | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | .s configure -sliderlength 86 .s cget -sliderlength } -cleanup { .s configure -sliderlength [lindex [.s configure -sliderlength] 3] } -result 86 test scale-1.52 {configuration options} -body { .s configure -sliderlength badValue } -returnCodes error -result {expected screen distance but got "badValue"} test scale-1.53 {configuration options} -body { .s configure -sliderrelief raised .s cget -sliderrelief } -cleanup { .s configure -sliderrelief [lindex [.s configure -sliderrelief] 3] } -result {raised} test scale-1.54 {configuration options} -body { |
︙ | ︙ | |||
312 313 314 315 316 317 318 | .s configure -width 32 .s cget -width } -cleanup { .s configure -width [lindex [.s configure -width] 3] } -result 32 test scale-1.70 {configuration options} -body { .s configure -width badValue | | | | | 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 | .s configure -width 32 .s cget -width } -cleanup { .s configure -width [lindex [.s configure -width] 3] } -result 32 test scale-1.70 {configuration options} -body { .s configure -width badValue } -returnCodes error -result {expected screen distance but got "badValue"} destroy .s test scale-2.1 {Tk_ScaleCmd procedure} -body { scale } -returnCodes error -result {wrong # args: should be "scale pathName ?-option value ...?"} test scale-2.2 {Tk_ScaleCmd procedure} -body { scale foo } -returnCodes error -result {bad window path name "foo"} test scale-2.3 {Tk_ScaleCmd procedure} -body { catch {scale foo} winfo children . } -result {} test scale-2.4 {Tk_ScaleCmd procedure} -body { scale .s -gorp dumb } -returnCodes error -result {unknown option "-gorp"} test scale-2.5 {Tk_ScaleCmd procedure} -body { catch {scale .s -gorp dumb} winfo children . } -result {} # Widget used in 3.* tests destroy .s scale .s -from 100 -to 200 pack .s |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | set traceInfo $args } .s configure -from 0 -to 100 -command {set x} -variable y update .s set 50 update | | | 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 | set traceInfo $args } .s configure -from 0 -to 100 -command {set x} -variable y update .s set 50 update trace add variable y write varTrace set traceInfo empty set x untouched .s set 50 update list $x $traceInfo } -result {untouched empty} |
︙ | ︙ | |||
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 | # 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 proc scroll args { global scrollInfo set scrollInfo $args } proc getTroughSize {w} { if {[testConstraint testmetrics]} { |
︙ | ︙ | |||
75 76 77 78 79 80 81 | foreach test { {-activebackground #ff0000 #ff0000 non-existent {unknown color name "non-existent"}} {-activerelief sunken sunken non-existent {bad relief "non-existent": must be flat, groove, raised, ridge, solid, or sunken}} {-background #ff0000 #ff0000 non-existent {unknown color name "non-existent"}} | | | | | | | 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 | foreach test { {-activebackground #ff0000 #ff0000 non-existent {unknown color name "non-existent"}} {-activerelief sunken sunken non-existent {bad relief "non-existent": must be flat, groove, raised, ridge, solid, or sunken}} {-background #ff0000 #ff0000 non-existent {unknown color name "non-existent"}} {-bd 4 4 badValue {expected screen distance but got "badValue"}} {-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}} {-borderwidth 1.3 1 badValue {expected screen distance but got "badValue"}} {-command "set x" {set x} {} {}} {-elementborderwidth 4 4 badValue {expected screen distance but got "badValue"}} {-cursor arrow arrow badValue {bad cursor spec "badValue"}} {-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}} {-highlightcolor #123456 #123456 bogus {unknown color name "bogus"}} {-highlightthickness 6 6 bogus {expected screen distance but got "bogus"}} {-highlightthickness -2 0 {} {}} {-jump true 1 silly {expected boolean value but got "silly"}} {-orient horizontal horizontal badValue {bad orientation "badValue": must be vertical or horizontal}} {-orient horizontal horizontal bogus {bad orientation "bogus": must be vertical or horizontal}} {-relief ridge ridge badValue {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}} {-repeatdelay 140 140 129.3 {expected integer but got "129.3"}} {-repeatinterval 140 140 129.3 {expected integer but got "129.3"}} {-takefocus "any string" "any string" {} {}} {-troughcolor #432 #432 lousy {unknown color name "lousy"}} {-width 32 32 badValue {expected screen distance but got "badValue"}} } { lassign $test name value okResult badValue badResult # Assume $name is plain; true of all our in-use options! test scrollbar-1.$i {configuration options} \ ".s configure $name [list $value]; .s cget $name" $okResult incr i if {$badValue ne ""} { |
︙ | ︙ | |||
270 271 272 273 274 275 276 | test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 0 1000] } 1 test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] | | > | | | > | 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 | test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 0 1000] } 1 test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 179] } [format %.6g [expr {(179.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]] } 1 test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 178] } [format %.6g [expr {(178.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { expr { [format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s] - 2}]]] == [format %g [expr {(200.0 - [testmetrics cyvscroll .s]*2 - 2) / ($height - 1 - [testmetrics cyvscroll .s]*2)}]]} } 1 |
︙ | ︙ | |||
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"}} | < < < < | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | 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.45 {ScrollbarWidgetCmd procedure, "get" option} { .s set 0.6 0.8 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result |
︙ | ︙ | |||
342 343 344 345 346 347 348 | test scrollbar-3.49 {ScrollbarWidgetCmd procedure, "identify" option} { list [catch {.s identify -1 bogus} msg] $msg } {1 {expected integer but got "bogus"}} test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} notAqua { .s identify 5 5 } {arrow1} test scrollbar-3.50.2 {ScrollbarWidgetCmd procedure, "identify" option} aqua { | | | | 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 | test scrollbar-3.49 {ScrollbarWidgetCmd procedure, "identify" option} { list [catch {.s identify -1 bogus} msg] $msg } {1 {expected integer but got "bogus"}} test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} notAqua { .s identify 5 5 } {arrow1} test scrollbar-3.50.2 {ScrollbarWidgetCmd procedure, "identify" option} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 5 5 } {trough1} test scrollbar-3.51 {ScrollbarWidgetCmd procedure, "identify" option} { .s identify 5 35 } {trough1} test scrollbar-3.52 {ScrollbarWidgetCmd procedure, "identify" option} { .s set .3 .6 .s identify 5 80 } {slider} test scrollbar-3.53 {ScrollbarWidgetCmd procedure, "identify" option} { .s identify 5 145 } {trough2} test scrollbar-3.54.1 {ScrollbarWidgetCmd procedure, "identify" option} notAqua { .s identify 5 195 } {arrow2} test scrollbar-3.54.2 {ScrollbarWidgetCmd procedure, "identify" option} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 5 195 } {trough2} test scrollbar-3.56 {ScrollbarWidgetCmd procedure, "identify" option} unix { .s identify 0 0 } {} test scrollbar-3.57 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set abc def} msg] $msg |
︙ | ︙ | |||
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} | < < < < < < < < < < < < < < < < < < < < < < < < | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | .s set .4 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result } {0.4 0.4} 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} { list [catch {.s set 1 2 3 4 5} msg] $msg } {1 {wrong # args: should be ".s set firstFraction lastFraction"}} test scrollbar-3.73 {ScrollbarWidgetCmd procedure} { |
︙ | ︙ | |||
488 489 490 491 492 493 494 | test scrollbar-6.10 {ScrollbarPosition procedure} { .s identify [winfo width .s] [expr {[winfo height .s] / 2}] } {} test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 { .s identify 8 4 } {arrow1} test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { | | | > > | | | | 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 | test scrollbar-6.10 {ScrollbarPosition procedure} { .s identify [winfo width .s] [expr {[winfo height .s] / 2}] } {} test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 { .s identify 8 4 } {arrow1} test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 8 4 } {trough1} test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 { # x11 scrollbars have arrows 19 pixels height, # but on XQuartz they are 15 pixels height .s identify 8 15 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 8 15 } {trough1} test scrollbar-6.14 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] / 2}] 0 } {arrow1} test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}] } {arrow1} |
︙ | ︙ | |||
549 550 551 552 553 554 555 | .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1]) + [testmetrics cyvscroll .s]}] } {trough2} test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} | | > > | | | | | > > > | | | | > > > | | 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 | .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1]) + [testmetrics cyvscroll .s]}] } {trough2} test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 { # x11 scrollbars have arrows at least 19 pixels height # but on XQuartz they are 15 pixels height .s identify 8 184 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 8 184 } {trough2} test scrollbar-6.30.1 {ScrollbarPosition procedure} x11 { .s identify 8 195 } {arrow2} test scrollbar-6.30.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .s identify 8 195 } {trough2} test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s]}] } {arrow2} test scrollbar-6.33 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - 1}] } {arrow2} test scrollbar-6.34 {ScrollbarPosition procedure} unix { .s identify 4 100 } {trough2} test scrollbar-6.35 {ScrollbarPosition procedure} unix { # Linux x11 scrollbars have arrows 18 pixels width # macOS XQuartz scrollbars have arrows 14 pixels width # macOS aqua scrollbars have no arrows nowadays .s identify 14 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { .s identify 0 100 } {trough2} test scrollbar-6.38 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] - 1}] 100 } {trough2} catch {destroy .t} toplevel .t -width 250 -height 150 wm geometry .t +0+0 scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2 place .t.s -width 200 .t.s set .2 .4 update test scrollbar-6.39.1 {ScrollbarPosition procedure} x11 { .t.s identify 4 8 } {arrow1} test scrollbar-6.39.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .t.s identify 4 8 } {trough1} test scrollbar-6.40 {ScrollbarPosition procedure} win { .t.s identify 0 [expr {[winfo height .t.s] / 2}] } {arrow1} test scrollbar-6.41.1 {ScrollbarPosition procedure} x11 { .t.s identify 82 8 } {slider} test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua { # macOS aqua scrollbars have no arrows nowadays .t.s identify 82 8 } {trough2} test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - 1}] [expr {[winfo height .t.s] / 2}] } {slider} test scrollbar-6.44 {ScrollbarPosition procedure} unix { # Linux x11 scrollbars have arrows 18 pixels height # macOS XQuartz scrollbars have arrows 14 pixels height # macOS aqua scrollbars have no arrows nowadays .t.s identify 100 14 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { .t.s identify 100 [expr {[winfo height .t.s] - 1}] } {trough2} test scrollbar-7.1 {EventuallyRedraw} { .s configure -orient horizontal |
︙ | ︙ | |||
693 694 695 696 697 698 699 700 701 702 703 704 | destroy .t .s } -body { pack [text .t -yscrollcommand {.s set}] -side left for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left 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 | > | > | | > | | 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 | destroy .t .s } -body { pack [text .t -yscrollcommand {.s set}] -side left for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left update focus -force .s event generate .s <Enter> 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 <Enter> 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 <Enter> 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 |
︙ | ︙ | |||
220 221 222 223 224 225 226 | set a altDisplay tk appname xyzgorp list \[send xyzgorp set a\] \[send -displayof .t xyzgorp set a\] "] cleanupbg set result } {altDisplay homeDisplay} | | | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | set a altDisplay tk appname xyzgorp list \[send xyzgorp set a\] \[send -displayof .t xyzgorp set a\] "] cleanupbg set result } {altDisplay homeDisplay} # Since macOS has no registry of interpreters, 8.3 and 8.10 will fail. test send-8.3 {Tk_SendCmd procedure, options} {secureserver notAqua} { list [catch {send -- -async foo bar baz} msg] $msg } {1 {no application named "-async"}} test send-8.4 {Tk_SendCmd procedure, options} {secureserver} { list [catch {send -gorp foo bar baz} msg] $msg } {1 {bad option "-gorp": must be -async, -displayof, or --}} test send-8.5 {Tk_SendCmd procedure, options} {secureserver} { list [catch {send -async foo} msg] $msg } {1 {wrong # args: should be "send ?-option value ...? interpName arg ?arg ...?"}} test send-8.6 {Tk_SendCmd procedure, options} {secureserver} { list [catch {send foo} msg] $msg } {1 {wrong # args: should be "send ?-option value ...? interpName arg ?arg ...?"}} test send-8.7 {Tk_SendCmd procedure, local execution} {secureserver} { |
︙ | ︙ | |||
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"}} |
︙ | ︙ | |||
437 438 439 440 441 442 443 | } test send-10.8 {SendEventProc procedure, exceptional return} {secureserver testsend} { testsend prop [winfo id .f] Comm {} testsend prop comm Comm \ "c\n-n tktest\n-r $id 62\n-s break\n" update testsend prop [winfo id .f] Comm | < < | < < < < < | < < | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | } test send-10.8 {SendEventProc procedure, exceptional return} {secureserver testsend} { testsend prop [winfo id .f] Comm {} testsend prop comm Comm \ "c\n-n tktest\n-r $id 62\n-s break\n" update testsend prop [winfo id .f] Comm } "\nr\n-s 62\n-r \n-c 3\n" test send-10.9 {SendEventProc procedure, empty return} {secureserver testsend} { testsend prop [winfo id .f] Comm {} testsend prop comm Comm \ "c\n-n tktest\n-r $id 62\n-s concat\n" update testsend prop [winfo id .f] Comm } "\nr\n-s 62\n-r \n" test send-10.10 {SendEventProc procedure, asynchronous calls} {secureserver testsend} { testsend prop [winfo id .f] Comm {} testsend prop comm Comm \ "c\n-n tktest\n-s foreach i {1 2 3} {error {test error} {Initial errorInfo} {test code}}\n" update testsend prop [winfo id .f] Comm } {} |
︙ | ︙ | |||
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}} | | | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | 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 22 23 24 25 26 27 | # 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 # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo set scrollInfo $args } # For trace add variable proc override args { global x set x 12345 } # Procedures used in widget VALIDATION tests proc doval {W d i P s S v V} { |
︙ | ︙ | |||
103 104 105 106 107 108 109 | -relief sunken pack .e update } -body { .e configure -bd badValue } -cleanup { destroy .e | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | -relief sunken pack .e update } -body { .e configure -bd badValue } -cleanup { destroy .e } -returnCodes {error} -result {expected screen distance but got "badValue"} test spinbox-1.7 {configuration option: "bg"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { |
︙ | ︙ | |||
147 148 149 150 151 152 153 | -relief sunken pack .e update } -body { .e configure -borderwidth badValue } -cleanup { destroy .e | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | -relief sunken pack .e update } -body { .e configure -borderwidth badValue } -cleanup { destroy .e } -returnCodes {error} -result {expected screen distance but got "badValue"} test spinbox-1.11 {configuration option: "buttonbackground"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { |
︙ | ︙ | |||
467 468 469 470 471 472 473 | -relief sunken pack .e update } -body { .e configure -highlightthickness bogus } -cleanup { destroy .e | | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | -relief sunken pack .e update } -body { .e configure -highlightthickness bogus } -cleanup { destroy .e } -returnCodes {error} -result {expected screen distance but got "bogus"} test spinbox-1.40 {configuration option: "highlightthickness"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { |
︙ | ︙ | |||
545 546 547 548 549 550 551 | -relief sunken pack .e update } -body { .e configure -insertborderwidth 2.6x } -cleanup { destroy .e | | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | -relief sunken pack .e update } -body { .e configure -insertborderwidth 2.6x } -cleanup { destroy .e } -returnCodes {error} -result {expected screen distance but got "2.6x"} test spinbox-1.47 {configuration option: "insertofftime"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { |
︙ | ︙ | |||
767 768 769 770 771 772 773 | -relief sunken pack .e update } -body { .e configure -selectborderwidth badValue } -cleanup { destroy .e | | | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | -relief sunken pack .e update } -body { .e configure -selectborderwidth badValue } -cleanup { destroy .e } -returnCodes {error} -result {expected screen distance but got "badValue"} test spinbox-1.67 {configuration option: "selectforeground"} -setup { spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \ -relief sunken pack .e update } -body { |
︙ | ︙ | |||
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} | | | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | 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 | | | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 | 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 | | | 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 | 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 |
︙ | ︙ | |||
1951 1952 1953 1954 1955 1956 1957 | } -cleanup { destroy .e } -result {Some text} test spinbox-5.4 {ConfigureSpinbox procedure, -textvariable} -setup { unset -nocomplain x spinbox .e } -body { | | | | 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | } -cleanup { destroy .e } -result {Some text} test spinbox-5.4 {ConfigureSpinbox procedure, -textvariable} -setup { unset -nocomplain x spinbox .e } -body { trace add variable x write override .e insert 0 "Some text" .e configure -textvariable x list $x [.e get] } -cleanup { destroy .e trace remove variable x write override } -result {12345 12345} test spinbox-5.5 {ConfigureSpinbox procedure} -setup { set x {} spinbox .e1 spinbox .e2 } -body { |
︙ | ︙ | |||
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" | | | | < | | 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | 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 | | | | < | | | < | 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 | 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 | | | | < | | | | < | | | < | 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 | 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 |
︙ | ︙ | |||
2617 2618 2619 2620 2621 2622 2623 | .e xview 4 .e delete 4 6 update .e index @0 } -cleanup { destroy .e } -result 4 | | | 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 | .e xview 4 .e delete 4 6 update .e index @0 } -cleanup { destroy .e } -result 4 test spinbox-8.18 {DeleteChars procedure} -setup { spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "xyzzy" update .e delete 2 4 |
︙ | ︙ | |||
2643 2644 2645 2646 2647 2648 2649 | + 2 * ( [.e cget -borderwidth] + \ [.e cget -highlightthickness] + $XPAD ) \ + $buttonWidth } ] expr {[winfo reqwidth .e] == $expected} } -cleanup { destroy .e unset XPAD buttonWidth expected | | | | | 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 | + 2 * ( [.e cget -borderwidth] + \ [.e cget -highlightthickness] + $XPAD ) \ + $buttonWidth } ] expr {[winfo reqwidth .e] == $expected} } -cleanup { destroy .e unset XPAD buttonWidth expected } -result {1} test spinbox-9.1 {SpinboxValueChanged procedure} -setup { unset -nocomplain x } -body { trace add variable x write override spinbox .e -textvariable x -width 0 .e insert 0 foo list $x [.e get] } -cleanup { destroy .e trace remove variable x write override } -result {12345 12345} test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { set x abcde set y ab spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 |
︙ | ︙ | |||
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 | | | 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 | 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 | | | | < | | | < | | | < | > | | 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 | 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" |
︙ | ︙ | |||
3872 3873 3874 3875 3876 3877 3878 | } -cleanup { destroy .e } -result {1 1 345} test spinbox-24.1 {error in trace proc attached to the textvariable} -setup { destroy .s } -body { | | | 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 | } -cleanup { destroy .e } -result {1 1 345} test spinbox-24.1 {error in trace proc attached to the textvariable} -setup { destroy .s } -body { trace add variable myvar write traceit proc traceit args {error "Intentional error here!"} spinbox .s -textvariable myvar -from 1 -to 10 catch {.s set mystring} result1 catch {.s insert 0 mystring} result2 catch {.s delete 0} result3 catch {.s invoke buttonup} result4 list $result1 $result2 $result3 $result4 |
︙ | ︙ | |||
3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 | destroy .s } -body { catch {spinbox .s -textvariable thisnsdoesntexist::myvar} result1 set result1 } -cleanup { destroy .s } -result {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist} # Collected comments about lacks from the test # XXX Still need to write tests for SpinboxBlinkProc, SpinboxFocusProc, # and SpinboxTextVarProc. # No tests for DisplaySpinbox. # XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo. # No tests for EventuallyRedraw | > > > > > > > > > > > > > > > > > > > > | 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 | destroy .s } -body { catch {spinbox .s -textvariable thisnsdoesntexist::myvar} result1 set result1 } -cleanup { destroy .s } -result {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist} test spinbox-25.3 {Bugs [2a32225cd1] and [9fa3e08243]} -setup { destroy .s pack [spinbox .s] update set res {} } -body { .s insert end "A sample text" .s icursor end event generate .s <<PrevWord>> ; # shall move insert to index 9 .s delete insert end lappend res [.s get] .s delete 0 end .s insert end "A sample text" .s icursor 2 event generate .s <<NextWord>> ; # shall move insert to index 9 .s delete 0 insert lappend res [.s get] } -cleanup { destroy .s } -result {{A sample } text} # Collected comments about lacks from the test # XXX Still need to write tests for SpinboxBlinkProc, SpinboxFocusProc, # and SpinboxTextVarProc. # No tests for DisplaySpinbox. # XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo. # No tests for EventuallyRedraw |
︙ | ︙ |
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 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | # 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 systray-17 {systray icon existence check} -setup { catch {tk systray destroy} } -body { tk systray exists } -result {0} test systray-18 {systray icon existence check} -setup { catch {tk systray destroy} image create photo _book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== } -body { tk systray create -image _book -text "Systray test" tk systray exists } -cleanup { tk systray destroy image delete _book } -result {1} 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 |
︙ | ︙ | |||
3385 3386 3387 3388 3389 3390 3391 | } -result {} test text-14.11 {ConfigureText procedure} -setup { text .t } -body { .t configure -selectborderwidth foo } -cleanup { destroy .t | | | 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 | } -result {} test text-14.11 {ConfigureText procedure} -setup { text .t } -body { .t configure -selectborderwidth foo } -cleanup { destroy .t } -returnCodes {error} -result {expected screen distance or "" but got "foo"} test text-14.12 {ConfigureText procedure} -body { text .t entry .t.e .t.e insert end abcdefg .t.e select from 0 .t.e select to 2 text .t2 -exportselection 1 |
︙ | ︙ | |||
3483 3484 3485 3486 3487 3488 3489 | destroy .top } -result {150x140+} # This test was failing Windows because the title bar on .t was a certain # minimum size and it was interfering with the size requested by the -setgrid. # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink # to the appropriate size. # On macOS, however, there is no way to make the window overlap the menubar. | | | 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 | destroy .top } -result {150x140+} # This test was failing Windows because the title bar on .t was a certain # minimum size and it was interfering with the size requested by the -setgrid. # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink # to the appropriate size. # On macOS, however, there is no way to make the window overlap the menubar. if {[tk windowingsystem] eq "aqua"} { set minY [expr [menubarheight] + 1] } else { set minY 0 } test text-14.19 {ConfigureText procedure} -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 |
︙ | ︙ | |||
6106 6107 6108 6109 6110 6111 6112 | lappend res [.t search -backwards a end] ; # works lappend res [.t search -backwards -all a end] ; # used to hang } -cleanup { destroy .t } -result {1.1 1.0 1.0} test text-23.1 {TkTextGetTabs procedure} -setup { | | | | | | | | | | | 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 | lappend res [.t search -backwards a end] ; # works lappend res [.t search -backwards -all a end] ; # used to hang } -cleanup { destroy .t } -result {1.1 1.0 1.0} test text-23.1 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs "\{{}" } -cleanup { destroy .t } -returnCodes {error} -result {unmatched open brace in list} test text-23.2 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs xyz } -cleanup { destroy .t } -returnCodes {error} -result {expected screen distance but got "xyz"} test text-23.3 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 200} update idletasks list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] } -cleanup { destroy .t } -result {100 200} test text-23.4 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 right 200 left 300 center 400 numeric} update idletasks list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \ [lindex [.t bbox 1.4] 0] \ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \ [lindex [.t bbox 1.10] 0] } -cleanup { destroy .t } -result {100 200 300 400} test text-23.5 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {105 r 205 l 305 c 405 n} update idletasks list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \ [lindex [.t bbox 1.4] 0] \ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \ [lindex [.t bbox 1.10] 0] } -cleanup { destroy .t } -result {105 205 305 405} test text-23.6 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 left 200 lork} } -cleanup { destroy .t } -returnCodes {error} -result {bad tab alignment "lork": must be left, right, center, or numeric} test text-23.7 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 150 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 !44 200 lork} } -cleanup { destroy .t } -returnCodes {error} -result {expected screen distance but got "!44"} test text-24.1 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump |
︙ | ︙ | |||
6572 6573 6574 6575 6576 6577 6578 | } -result 1 test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup { text .t pack .t # Make sure the Text is mapped before we start update set ::retval {} | < | 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 | } -result 1 test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup { text .t pack .t # Make sure the Text is mapped before we start update set ::retval {} } -body { bind .t <<Modified>> "lappend ::retval modified" # Shouldn't require [update idle] to trigger event [Bug 1809538] lappend ::retval [.t edit modified] .t edit modified 1 update lappend ::retval [.t edit modified] |
︙ | ︙ | |||
6671 6672 6673 6674 6675 6676 6677 | .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <<PasteSelection>> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired | | | | 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 | .t insert end "There is a selection in this text widget,\n" .t insert end "and it will be impacted by the <<PasteSelection>> event received.\n" .t insert end "Therefore a <<Selection>> event must fire back." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<PasteSelection>> -x 15 -y [lindex [.t dlineinfo 1.0] 1] update set ::retval } -cleanup { destroy .t } -result {<<Selection>>_fired} test text-27.15c {No <<Selection>> virtual event on <<PasteSelection>> outside widget selection} -body { pack [text .t] .t insert end "There is a selection in this text widget,\n" .t insert end "but it will not be impacted by the <<PasteSelection>> event received." .t tag add sel 1.0 1.28 bind .t <<Selection>> "set ::retval <<Selection>>_fired" update set ::retval no_<<Selection>>_event_fired event generate .t <<PasteSelection>> -x 15 -y [lindex [.t dlineinfo 2.0] 1] update set ::retval } -cleanup { destroy .t } -result {no_<<Selection>>_event_fired} test text-27.15d {<<Selection>> virtual event on <Delete> with cursor inside selection} -body { pack [text .t] |
︙ | ︙ | |||
7036 7037 7038 7039 7040 7041 7042 | .t edit undo lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}] .t edit redo lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}] } -cleanup { destroy .t } -result {1 1} | | > > > > > > > > > > > > > > | 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 | .t edit undo lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}] .t edit redo lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}] } -cleanup { destroy .t } -result {1 1} test text-27.29 {bug ab839efc5f - .text edit undo inserts separators} -setup { destroy .t } -body { text .t -undo 1 .t insert 1.0 "1. 123 5 789012 LINE-1\n2.\n3. 123 5 789012 LINE-3\n" .t tag add sel 3.0 3.end .t delete sel.first sel.last .t edit undo .t tag add sel 3.0 3.end .t delete sel.first sel.last .t edit undo .t get 3.0 3.end } -cleanup { destroy .t } -result {3. 123 5 789012 LINE-3} test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body { pack [text .t -wrap none] .t insert end [string repeat "\1" 500] } -cleanup { destroy .t } -result {} |
︙ | ︙ | |||
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) | | | | 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 | .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 |
︙ | ︙ | |||
7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 | set ::my_error } -cleanup { destroy .t rename returnerror-37.1 "" interp bgerror {} $save unset -nocomplain save ::my_error } -result {} # cleanup cleanupTests return # Local Variables: # mode: tcl # End: | > > > > > > > > > > > > > > > > | 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 | set ::my_error } -cleanup { destroy .t rename returnerror-37.1 "" interp bgerror {} $save unset -nocomplain save ::my_error } -result {} test text-38.1 {Extending selection with mouse going outside the widget - Bug a9cf210a42} -setup { pack [text .t -width 40 -height 10] for {set n 1} {$n <= 5} {incr n} { .t insert end "This is line $i of text\n" } update } -body { event generate .t <Button-1> -x 50 -y 50 event generate .t <B1-Motion> -x 50 -y -50 .t index sel.first } -cleanup { destroy .t } -result {1.0} # cleanup cleanupTests return # Local Variables: # mode: tcl # End: |
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 | # 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 set fixedFont {Courier -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 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} | | | | | 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 | 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] | | | | | > > | > | | > | | > | | > | > | > > | | > | | > > > | < > | | | | > > | | > > | | > > | | > | | > > > | | > > > | > > | > | | > > > | | > > > | | > > > | | > | > > > > | > > > > | < > | | > > > | | > > | | 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 | 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 | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | 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 | | | | > > | > | | > | > > > | | | | | | | | | | | | | > > > > | | | | | > > > > | | | | | > > > > | | | | > > > | | > > > | | | | | > > > | | | | | | < | > > | < < < < | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | > > > | | | | > | | | | > | | | | > | | | | | | > | | > > | | | | > > > < | | | | | | | | | | | > | | | > > | | | | | | | | | | | | | < < < < | > | | | > | | | | > | | | | > | | | | > | | | > | | | > | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | > > | | > > | | > > | | | | | | | | | | > > | > | | | > > > | | | | | | | | | > > | | > > | | > > < < | > > > > | | | | | | | | | | | | | 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 | 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} haveBigFontTwiceLargerThanTextFont { .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] eq "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] eq "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] eq "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] eq "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} haveBigFontTwiceLargerThanTextFont { .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} -constraints { haveBigFontTwiceLargerThanTextFont } -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} -constraints { haveBigFontTwiceLargerThanTextFont } -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} haveBigFontTwiceLargerThanTextFont { .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} haveBigFontTwiceLargerThanTextFont { .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} -constraints { haveBigFontTwiceLargerThanTextFont } -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} haveBigFontTwiceLargerThanTextFont { .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} haveBigFontTwiceLargerThanTextFont { .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} -constraints { haveBigFontTwiceLargerThanTextFont } -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} -constraints { haveBigFontTwiceLargerThanTextFont } -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} haveBigFontTwiceLargerThanTextFont { .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} haveBigFontTwiceLargerThanTextFont { .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" | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | 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}] | | > > > > > > > > > > > > > > > | | | | | | | | | | | 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 | 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 | | | | | | | > > > | | | > > > > > > > > | | | > > > > > > > > | | < | | | | | | | | | | | | | | 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 | } {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 | | | | | | | | | 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 | .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" } | | | | | > > > > > > | | | > | > > > > > > > > > | | | > | > > > > > > > > > > | | | < < > | > > > > > > > > > > | | | > | | | | | | > > > > > | | | > > | | | | | > > > > > | < < < < | | | | | | | 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 | .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} haveBigFontTwiceLargerThanTextFont { # constrained because text tagged with the big font plays a role .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} haveBigFontTwiceLargerThanTextFont { # constrained because text tagged with the big font plays a role .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} { |
︙ | ︙ | |||
2253 2254 2255 2256 2257 2258 2259 | lappend res [expr {[lindex [.t yview] 0] * [.t count -ypixels 1.0 end]}] } {0.0 0.0} test textDisp-16.37 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3 pixels} msg] $msg } {0 {}} test textDisp-16.38 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3blah pixels} msg] $msg | | | | | 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 | lappend res [expr {[lindex [.t yview] 0] * [.t count -ypixels 1.0 end]}] } {0.0 0.0} test textDisp-16.37 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3 pixels} msg] $msg } {0 {}} test textDisp-16.38 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3blah pixels} msg] $msg } {1 {expected screen distance but got "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 | | | | | | 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 | .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 | | | > > > | | | > | > > > > | > > > > > > > > > > > | > | | | > > > > | | | > > > > > > > > | | | > > > > > | > | | > | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | 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 | 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. | | | | | | | | | | | | 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 | 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. | | | | < | > > > | > > | | > | | | > > > > > > > | | > | | | | | | > > > > > | < > > | | > > | | > > | | > > | > | | | | > | > > | | > | | 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 | .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" | | | | > > > > | | > > | > > > | > > | < > | > > > | > > | < > | > > | | | | > > > | > > > | < > | | | | > | | > > > > > | | | > > > > > | | | | | | | > > > > | | | | | | | > | > > > | > > | < > | > > > | > > | < > | | | | > > | | > > | | > | > > > > > > > > | | > > | < > | > > > | > > | < > | | > | > | > > > | | > | > | | | > | > > > > > > > > | | > > | < > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | > > | | < | > > | > > > | > > | < > | | | | > > > | > > | < > | > > > | > > | < > | | > > | | > | > | | | | > | | | > | > > | | | > > | | > > > | > > | | | | | | | | | | > > > | | > | | > > > | | | | | | > > | | | | > > | | > > | 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 | .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} haveBigFontTwiceLargerThanTextFont { 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} haveBigFontTwiceLargerThanTextFont { .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] eq "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] eq "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 | | | > > > > | > | | > | | > > > > | > | | | | | | | | | > > | | > > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | > > > | > > | < > | | | > | | | | > | | < | | | | < | | | | | | | > | | | > | | | > | | | > | > | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | < > > > | > | | | < < < < < < < < < < < < < < < < < | < < < < < < | < < < < < < < < > | < < < < < < < < < < < < < | < < < < < | < < < < | < < < < < < < < < < | > | < > > | | > | | > > > | > > > | | > > > > > | | > | | > > | > > > > > | | > | | > > | | | | | | | | | > | | > | | > > | | > | | | > | | > > | | > | > > | | > | > > > > > | | | | | | | | | | | | | 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 4717 4718 4719 4720 | .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 | | > > > > > > > > > > > > > > | | | | > | < | | < < < < | < | | 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 | .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 | < | | > > > > > > > > > > > > > > > > > > > > > > | 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 | 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 |
︙ | ︙ | |||
264 265 266 267 268 269 270 | .t image create end -image small -name small .t image create end -image small -name small#6342 .t image create end -image small -name small lsort [.t image names] } -cleanup { destroy .t image delete small | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | .t image create end -image small -name small .t image create end -image small -name small#6342 .t image create end -image small -name small lsort [.t image names] } -cleanup { destroy .t image delete small } -result {small small#1 small#2 small#6342} test textImage-2.1 {debug} -setup { destroy .t } -body { catch { image create photo small -width 5 -height 5 small put red -to 0 0 4 4 |
︙ | ︙ | |||
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"] |
︙ | ︙ | |||
924 925 926 927 928 929 930 931 932 933 934 935 936 937 | lappend res [.t index "2.16 wordstart"] [.t index "2.15 wordstart"] } {1.18 2.13 2.13} test textIndex-22.15 {text index display wordstart} { catch {destroy .t} text .t .t index "1.0 display wordstart" ; # used to crash } 1.0 test textIndex-23.1 {text paragraph start} { pack [text .t2] .t2 insert end " Text" set res 2.0 for {set i 0} {$i < 2} {incr i} { lappend res [::tk::TextPrevPara .t2 [lindex $res end]] | > > > > > > > > > > | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | lappend res [.t index "2.16 wordstart"] [.t index "2.15 wordstart"] } {1.18 2.13 2.13} test textIndex-22.15 {text index display wordstart} { catch {destroy .t} text .t .t index "1.0 display wordstart" ; # used to crash } 1.0 test textIndex-22.16 {text index wordstart, bug [57b821d2db]} { catch {destroy .t} text .t .t insert 1.0 " 123 5 789012 LINE-1\n\n 123 5 789000 LINE-3\n\n0123 5 789012 LINE-5" set res [.t index "1.1 wordstart"] lappend res [.t index "5.0 wordstart"] .t mark set insert 1.1 lappend res [.t index "insert wordstart"] lappend res [.t index "5.1 wordstart"] } {1.1 5.0 1.1 5.0} test textIndex-23.1 {text paragraph start} { pack [text .t2] .t2 insert end " Text" set res 2.0 for {set i 0} {$i < 2} {incr i} { lappend res [::tk::TextPrevPara .t2 [lindex $res end]] |
︙ | ︙ | |||
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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .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 -startline/-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 -startline/-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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # 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 set fixedFont {Courier 12} set bigFont {Helvetica 24} # Warn the user if the actual font 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." } destroy .t text .t -width 20 -height 10 -font $fixedFont pack .t -expand 1 -fill both update .t debug on wm geometry . {} |
︙ | ︙ | |||
77 78 79 80 81 82 83 | .t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3] } -returnCodes error -result {bitmap "badStipple" not defined} test textTag-1.5 {tag configuration options} -body { .t tag configure x -borderwidth 2 .t tag cget x -borderwidth } -cleanup { .t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3] | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | .t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3] } -returnCodes error -result {bitmap "badStipple" not defined} test textTag-1.5 {tag configuration options} -body { .t tag configure x -borderwidth 2 .t tag cget x -borderwidth } -cleanup { .t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3] } -result {2} test textTag-1.6 {configuration options} -body { .t tag configure x -borderwidth 46q } -cleanup { .t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3] } -returnCodes error -result {expected screen distance or "" but got "46q"} test textTag-1.7 {tag configuration options} -body { .t tag configure x -fgstipple gray25 .t tag cget x -fgstipple } -cleanup { .t tag configure x -fgstipple [lindex [.t tag configure x -fgstipple] 3] } -result {gray25} test textTag-1.8 {configuration options} -body { |
︙ | ︙ | |||
117 118 119 120 121 122 123 | } -returnCodes error -result {unknown color name "silly color"} test textTag-1.12 {tag configuration options} -body { .t tag configure x -justify left .t tag cget x -justify } -cleanup { .t tag configure x -justify [lindex [.t tag configure x -justify] 3] } -result {left} | | | > > | | | | | | | | | | 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 | } -returnCodes error -result {unknown color name "silly color"} test textTag-1.12 {tag configuration options} -body { .t tag configure x -justify left .t tag cget x -justify } -cleanup { .t tag configure x -justify [lindex [.t tag configure x -justify] 3] } -result {left} test textTag-1.13 {configuration options, bug [026e2bb685]} -body { .t tag configure x -justify right catch {.t tag configure x -justify middle} msg list $msg [.t tag configure x -justify] } -cleanup { .t tag configure x -justify [lindex [.t tag configure x -justify] 3] } -result {{bad justification "middle": must be left, right, center, or ""} {-justify {} {} {} right}} test textTag-1.14 {tag configuration options} -body { .t tag configure x -lmargin1 10 .t tag cget x -lmargin1 } -cleanup { .t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3] } -result {10} test textTag-1.15 {configuration options} -body { .t tag configure x -lmargin1 bad } -cleanup { .t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3] } -returnCodes error -result {expected screen distance or "" but got "bad"} test textTag-1.16 {tag configuration options} -body { .t tag configure x -lmargin2 10 .t tag cget x -lmargin2 } -cleanup { .t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3] } -result {10} test textTag-1.17 {configuration options} -body { .t tag configure x -lmargin2 bad } -cleanup { .t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3] } -returnCodes error -result {expected screen distance or "" but got "bad"} test textTag-1.17a {tag configuration options} -body { .t tag configure x -lmargincolor lightgreen .t tag cget x -lmargincolor } -cleanup { .t tag configure x -lmargincolor [lindex [.t tag configure x -lmargincolor] 3] } -result {lightgreen} test textTag-1.17b {configuration options} -body { .t tag configure x -lmargincolor non-existent } -cleanup { .t tag configure x -lmargincolor [lindex [.t tag configure x -lmargincolor] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.18 {tag configuration options} -body { .t tag configure x -offset 2 .t tag cget x -offset } -cleanup { .t tag configure x -offset [lindex [.t tag configure x -offset] 3] } -result {2} test textTag-1.19 {configuration options} -body { .t tag configure x -offset 100xyz } -cleanup { .t tag configure x -offset [lindex [.t tag configure x -offset] 3] } -returnCodes error -result {expected screen distance or "" but got "100xyz"} test textTag-1.20 {tag configuration options} -body { .t tag configure x -overstrike on .t tag cget x -overstrike } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -result 1 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 { |
︙ | ︙ | |||
198 199 200 201 202 203 204 | } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] } -result {raised} test textTag-1.23 {configuration options} -body { .t tag configure x -relief stupid } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] | | | | | 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 | } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] } -result {raised} test textTag-1.23 {configuration options} -body { .t tag configure x -relief stupid } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] } -returnCodes error -result {bad relief "stupid": must be flat, groove, raised, ridge, solid, sunken, or ""} test textTag-1.24 {tag configuration options} -body { .t tag configure x -rmargin 10 .t tag cget x -rmargin } -cleanup { .t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3] } -result {10} test textTag-1.25 {configuration options} -body { .t tag configure x -rmargin bad } -cleanup { .t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3] } -returnCodes error -result {expected screen distance or "" but got "bad"} test textTag-1.25a {tag configuration options} -body { .t tag configure x -rmargincolor darkblue .t tag cget x -rmargincolor } -cleanup { .t tag configure x -rmargincolor [lindex [.t tag configure x -rmargincolor] 3] } -result {darkblue} test textTag-1.25b {configuration options} -body { |
︙ | ︙ | |||
248 249 250 251 252 253 254 | .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.26 {tag configuration options} -body { .t tag configure x -spacing1 10 .t tag cget x -spacing1 } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] | | | | | | > | | | | | | | 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 | .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.26 {tag configuration options} -body { .t tag configure x -spacing1 10 .t tag cget x -spacing1 } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] } -result {10} test textTag-1.27 {configuration options} -body { .t tag configure x -spacing1 bad } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] } -returnCodes error -result {expected screen distance or "" but got "bad"} test textTag-1.28 {tag configuration options} -body { .t tag configure x -spacing2 10 .t tag cget x -spacing2 } -cleanup { .t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3] } -result {10} test textTag-1.29 {configuration options, bug [026e2bb685]} -body { catch {.t tag configure x -spacing3 5 -spacing2 bad -spacing1 morebad} msg list $msg [.t tag configure x -spacing1] [.t tag configure x -spacing2] [.t tag configure x -spacing3] } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] -spacing2 [lindex [.t tag configure x -spacing2] 3] -spacing3 [lindex [.t tag configure x -spacing3] 3] } -result {{expected screen distance or "" but got "bad"} {-spacing1 {} {} {} {}} {-spacing2 {} {} {} {}} {-spacing3 {} {} {} 5}} test textTag-1.30 {tag configuration options} -body { .t tag configure x -spacing3 10 .t tag cget x -spacing3 } -cleanup { .t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3] } -result {10} test textTag-1.31 {configuration options} -body { .t tag configure x -spacing3 bad } -cleanup { .t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3] } -returnCodes error -result {expected screen distance or "" but got "bad"} test textTag-1.32 {tag configuration options} -body { .t tag configure x -tabs {10 20 30} .t tag cget x -tabs } -cleanup { .t tag configure x -tabs [lindex [.t tag configure x -tabs] 3] } -result {10 20 30} test textTag-1.33 {configuration options} -body { .t tag configure x -tabs {10 fork} } -cleanup { .t tag configure x -tabs [lindex [.t tag configure x -tabs] 3] } -returnCodes error -result {bad tab alignment "fork": must be left, right, center, or numeric} test textTag-1.34 {tag configuration options} -body { .t tag configure x -underline no .t tag cget x -underline } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -result 0 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 { |
︙ | ︙ | |||
391 392 393 394 395 396 397 | .t tag remove sel 1.0 end } -result {1.1 1.5 2.4 2.5} test textTag-2.14 {tag add before -startline - Bug 1615425} -body { text .tt for {set i 1} {$i <10} {incr i} { .tt insert end "Line $i\n" } | | | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | .t tag remove sel 1.0 end } -result {1.1 1.5 2.4 2.5} test textTag-2.14 {tag add before -startline - Bug 1615425} -body { text .tt for {set i 1} {$i <10} {incr i} { .tt insert end "Line $i\n" } .tt tag configure mytag -offset 2 .tt peer create .ptt .ptt configure -startline 3 -endline 7 # the test succeeds if next line does not crash .tt tag add mytag 1.0 1.end destroy .ptt .tt set res 1 } -result {1} test textTag-3.1 {TkTextTagCmd - "bind" option} -body { .t tag bind } -returnCodes error -result {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"} test textTag-3.2 {TkTextTagCmd - "bind" option} -body { .t tag bind 1 2 3 4 |
︙ | ︙ | |||
502 503 504 505 506 507 508 | } -returnCodes error -result {value for "-underline" missing} test textTag-5.4 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline yes .t tag configure x -underline } -cleanup { .t tag delete x | | | | | | | | > | | | | | | | | | | 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 | } -returnCodes error -result {value for "-underline" missing} test textTag-5.4 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline yes .t tag configure x -underline } -cleanup { .t tag delete x } -result {-underline {} {} {} 1} test textTag-5.4a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underlinefg lightgreen .t tag configure x -underlinefg } -cleanup { .t tag delete x } -result {-underlinefg {} {} {} lightgreen} test textTag-5.5 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -overstrike on .t tag cget x -overstrike } -cleanup { .t tag delete x } -result 1 test textTag-5.5a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -overstrikefg lightgreen .t tag configure x -overstrikefg } -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} test textTag-5.9 {TkTextTagCmd - "configure" option, bug [026e2bb685]} -body { .t tag delete x catch {.t tag configure x -justify bogus} msg list $msg [.t tag configure x -justify] } -cleanup { .t tag delete x } -result {{bad justification "bogus": must be left, right, center, or ""} {-justify {} {} {} {}}} test textTag-5.10 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify fill } -cleanup { .t tag delete x } -returnCodes error -result {bad justification "fill": must be left, right, center, or ""} test textTag-5.11 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -offset 2 .t tag configure x -offset } -cleanup { .t tag delete x } -result {-offset {} {} {} 2} test textTag-5.12 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -offset 1.0q } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "1.0q"} test textTag-5.13 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin1 2 -lmargin2 4 -rmargin 5 \ -lmargincolor darkblue -rmargincolor lightgreen list [.t tag configure x -lmargin1] [.t tag configure x -lmargin2] \ [.t tag configure x -rmargin] [.t tag configure x -lmargincolor] \ [.t tag configure x -rmargincolor] } -cleanup { .t tag delete x } -result [list {-lmargin1 {} {} {} 2} {-lmargin2 {} {} {} 4} \ {-rmargin {} {} {} 5} \ {-lmargincolor {} {} {} darkblue} {-rmargincolor {} {} {} lightgreen} \ ] test textTag-5.14 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin1 2.0x } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "2.0x"} test textTag-5.15 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin2 gorp } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "gorp"} test textTag-5.15a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargincolor rainbow } -cleanup { .t tag delete x } -returnCodes error -result {unknown color name "rainbow"} test textTag-5.16 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -rmargin 140.1.1 } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "140.1.1"} test textTag-5.16a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -rmargincolor rainbow } -cleanup { .t tag delete x } -returnCodes error -result {unknown color name "rainbow"} .t tag delete x test textTag-5.17 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 2 -spacing2 4 -spacing3 6 list [.t tag configure x -spacing1] [.t tag configure x -spacing2] \ [.t tag configure x -spacing3] } -cleanup { .t tag delete x } -result {{-spacing1 {} {} {} 2} {-spacing2 {} {} {} 4} {-spacing3 {} {} {} 6}} test textTag-5.18 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 2.0x } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "2.0x"} test textTag-5.19 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 lousy } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "lousy"} test textTag-5.20 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 4.2.3 } -cleanup { .t tag delete x } -returnCodes error -result {expected screen distance or "" but got "4.2.3"} test textTag-5.21 {TkTextTagCmd - "configure" option} -body { .t configure -selectborderwidth 2 -selectforeground blue \ -selectbackground black .t tag configure sel -borderwidth 4 -foreground green -background yellow set x {} foreach i {-selectborderwidth -selectforeground -selectbackground} { lappend x [lindex [.t configure $i] 4] |
︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | .t tag add x$i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete {*}[.t tag names] } -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29} | < < < < < < < < < < < < | > | 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 | .t tag add x$i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete {*}[.t tag names] } -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29} set c [.t bbox 2.1] set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}] set c [.t bbox 3.2] set x2 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y2 [expr {[lindex $c 1] + [lindex $c 3]/2}] set c [.t bbox 4.3] set x3 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}] 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 | | > | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | .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 | | > | 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | } -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 | > > > > > > > > > > > > > > > > > > | > | | | > > | | < | > | 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 | 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] event gen .t <Motion> -x $x3 -y $y3 -state 0x100 lappend x [.t index current] event gen .t <Button-3> -state 0x100 -x $x3 -y $y3 lappend x [.t index current] event gen .t <ButtonRelease-3> -state 0x300 -x $x3 -y $y3 lappend x [.t index current] event gen .t <ButtonRelease-1> -state 0x100 -x $x3 -y $y3 lappend x [.t index current] } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { haveBigFontTwiceLargerThanTextFont } -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update event generate {} <Motion> -warp 1 -x 5 -y 5 controlPointerWarpTiming } -body { .t tag configure big -font $bigFont # update needed here to stabilize the test update event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1 event gen .t <Motion> -x $x2 -y $y2 set x [.t index current] .t tag add big 3.0 update lappend x [.t index current] } -cleanup { .t tag delete big } -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 | | > | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 | } -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 |
︙ | ︙ | |||
1415 1416 1417 1418 1419 1420 1421 | .t tag lower c event gen .t <Motion> -x $x2 -y $y2 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b enter-c | leave-c leave-b} | | < < | < > | | < | | | | | < | | | | | < | > > > > > | | 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 | .t tag lower c event gen .t <Motion> -x $x2 -y $y2 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b enter-c | leave-c leave-b} test textTag-16.5 {TkTextPickCurrent procedure} -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 } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x1 -y $y1 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x2 -y $y2 .t index current } -cleanup { .t tag delete a big } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { haveBigFontTwiceLargerThanTextFont } -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 } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x1 -y $y1 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x2 -y $y2 update .t index current } -cleanup { .t tag delete a big } -result {3.1} test textTag-16.7 {TkTextPickCurrent procedure} -constraints { haveBigFontTwiceLargerThanTextFont } -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 } -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 $x1 -y $y1 .t tag bind a <Leave> {.t tag add big 3.0 3.2} .t tag add a 2.1 event gen .t <Motion> -x $x2 -y $y2 update .t index current } -cleanup { .t tag delete a big } -result {3.1} test textTag-17.1 {insert procedure inserts tags} -setup { .t delete 1.0 end } -body { # Objectification of the text widget had a problem # with inserting tags when using 'end'. Check that # bug has been fixed. .t insert end abcd {x} \n {} efgh {y} \n {} .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 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 | # 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] # 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 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." } # Widget used in almost all tests # Option -width 30 (characters) below is a fundamental assumption of many # upcoming tests when wrapping enters in play # Also -height 6 (lines) is an important assumption # Moreover the widget must have the same padding in x and y (see proc bo) # However the tests are not sensitive to -borderwidth and -highlightthickness text .t -font $fixedFont -width 30 -height 6 -borderwidth 2 -highlightthickness 2 pack .t -expand 1 -fill both update .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]}] } # 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}] } set color [expr {[winfo depth .t] > 1 ? "green" : "black"}] # 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 . # This update is needed on MacOS to make sure that the window is mapped # when the tests begin. update # ---------------------------------------------------------------------- test textWind-1.1 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" frame .f -width 3 -height 3 -bg $color .t window create 2.2 -window .f update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \ [.t window configure .f -window] } -result [list \ 1 \ 3x3+[xchar 2]+[expr {[yline 2]+($fixedHeight-3)/2}] \ [list [xchar 2] [expr {[yline 2]+($fixedHeight-3)/2}] 3 3] \ {-window {} {} {} .f}] test textWind-1.2 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" frame .f -width 3 -height 3 -bg $color .t window create 2.2 -window .f -align top update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \ [.t window configure .f -align] } -result [list \ 1 \ 3x3+[xchar 2]+[yline 2] \ [list [xchar 2] [yline 2] 3 3] \ {-align {} {} center top}] test textWind-1.3 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" |
︙ | ︙ | |||
103 104 105 106 107 108 109 | .t insert end "\nAnd this is a second line, which wraps around" # the window .f should be wider than the fixed width frame .f -width 10 -height 20 -bg $color .t window create 2.2 -window .f -padx 5 update list [winfo geom .f] [.t window configure .f -padx] [.t bbox 2.3] } -result [list \ | | | | | | < | 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 | .t insert end "\nAnd this is a second line, which wraps around" # the window .f should be wider than the fixed width frame .f -width 10 -height 20 -bg $color .t window create 2.2 -window .f -padx 5 update list [winfo geom .f] [.t window configure .f -padx] [.t bbox 2.3] } -result [list \ 10x20+[expr {[xchar 2]+5}]+[yline 2] \ {-padx {} {} 0 5} \ [list [expr {[xchar 2]+10+2*5}] [expr {[yline 2]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight]] test textWind-1.5 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" frame .f -width 10 -height 20 -bg $color .t window create 2.2 -window .f -pady 4 update list [winfo geom .f] [.t window configure .f -pady] [.t bbox 2.31] } -result [list \ 10x20+[xchar 2]+[expr {[yline 2]+4}] \ {-pady {} {} 0 4} \ [list [xchar 2] [expr {[yline 2]+20+2*4}] $fixedWidth $fixedHeight]] test textWind-1.6 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" frame .f -width 5 -height 5 -bg $color .t window create 2.2 -window .f -stretch 1 update list [winfo geom .f] [.t window configure .f -stretch] } -result [list \ 5x$fixedHeight+[xchar 2]+[yline 2] \ {-stretch {} {} 0 1}] .t delete 1.0 end .t insert end "This is the first line" test textWind-2.1 {TkTextWindowCmd procedure} -body { .t window } -returnCodes error -result {wrong # args: should be ".t window option ?arg ...?"} test textWind-2.2 {TkTextWindowCmd procedure, "cget" option} -body { |
︙ | ︙ | |||
197 198 199 200 201 202 203 | .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo update .t window configure .f } -cleanup { destroy .f } -result {{-align {} {} center baseline} {-create {} {} {} foo} {-padx {} {} 0 1} {-pady {} {} 0 2} {-stretch {} {} 0 0} {-window {} {} {} .f}} test textWind-2.12 {TkTextWindowCmd procedure} -setup { | < < | 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 | .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo update .t window configure .f } -cleanup { destroy .f } -result {{-align {} {} center baseline} {-create {} {} {} foo} {-padx {} {} 0 1} {-pady {} {} 0 2} {-stretch {} {} 0 0} {-window {} {} {} .f}} test textWind-2.12 {TkTextWindowCmd procedure} -setup { destroy .f frame .f -width 10 -height 6 -bg $color .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" frame .f -width 10 -height 6 -bg $color .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo update list [.t window configure .f -padx 33] [.t window configure .f -padx] } -cleanup { destroy .f } -result {{} {-padx {} {} 0 33}} test textWind-2.13 {TkTextWindowCmd procedure} -setup { destroy .f frame .f -width 10 -height 6 -bg $color .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" |
︙ | ︙ | |||
240 241 242 243 244 245 246 | } -returnCodes error -result {wrong # args: should be ".t window create index ?-option value ...?"} test textWind-2.15 {TkTextWindowCmd procedure} -setup { .t delete 1.0 end } -body { .t window create gorp } -returnCodes error -result {bad text index "gorp"} test textWind-2.16 {TkTextWindowCmd procedure, don't insert after end} -setup { | < < < | 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 | } -returnCodes error -result {wrong # args: should be ".t window create index ?-option value ...?"} test textWind-2.15 {TkTextWindowCmd procedure} -setup { .t delete 1.0 end } -body { .t window create gorp } -returnCodes error -result {bad text index "gorp"} test textWind-2.16 {TkTextWindowCmd procedure, don't insert after end} -setup { destroy .f frame .f -width 10 -height 6 -bg $color .t window create 2.2 -window .f -align baseline -padx 1 -pady 2 .t delete 1.0 end } -body { .t insert end "Line 1\nLine 2" frame .f -width 20 -height 10 -bg $color .t window create end -window .f .t index .f } -result {2.6} test textWind-2.17 {TkTextWindowCmd procedure} -setup { .t delete 1.0 end } -body { list [catch {.t window create 1.0} msg] $msg [.t window configure 1.0] } -result {0 {} {{-align {} {} center center} {-create {} {} {} {}} {-padx {} {} 0 0} {-pady {} {} 0 0} {-stretch {} {} 0 0} {-window {} {} {} {}}}} test textWind-2.18 {TkTextWindowCmd procedure} -setup { destroy .f frame .f -width 20 -height 10 -bg $color .t window create end -window .f .t delete 1.0 end } -body { frame .f -width 10 -height 6 -bg $color .t window create 1.0 -window .f -gorp stupid } -returnCodes error -result {unknown option "-gorp"} test textWind-2.19 {TkTextWindowCmd procedure} -setup { destroy .f frame .f -width 20 -height 10 -bg $color .t window create end -window .f .t delete 1.0 end } -body { frame .f -width 10 -height 6 -bg $color catch {.t window create 1.0 -window .f -gorp stupid} |
︙ | ︙ | |||
321 322 323 324 325 326 327 | .t window create end -window $i } lsort [.t window names] } -cleanup { destroy .f .f2 .t.f .t.f2 } -result {.f .f2 .t.f .t.f2} | < | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | .t window create end -window $i } lsort [.t window names] } -cleanup { destroy .f .f2 .t.f .t.f2 } -result {.f .f2 .t.f .t.f2} test textWind-3.1 {EmbWinConfigure procedure} -setup { destroy .f } -body { frame .f -width 10 -height 6 -bg $color .t window create 1.0 -window .f .t window configure 1.0 -foo bar } -cleanup { |
︙ | ︙ | |||
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 | > < | | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | 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 [xchar 3] [yline 1] $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 .t window create 1.3 -window .t.f |
︙ | ︙ | |||
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 | > < | | | | > > > > < > | 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 | 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 [xchar 3] [yline 1] $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 .t window create 1.3 update .t window configure 1.3 -window .f update list [catch {.t index .f} msg] $msg [winfo ismapped .f] [.t bbox 1.4] } -cleanup { destroy .f } -result [list 0 1.3 1 \ [list [expr {[xchar 3]+10}] [expr {[yline 1]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight]] test textWind-3.7 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" 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!" .t window create 1.4 -window .t.b .t window create 1.6 -window .t.b update .t index .t.b } -result {1.6} .t delete 1.0 end frame .f -width 10 -height 20 -bg $color .t window create 1.0 -window .f test textWind-4.1 {AlignParseProc and AlignPrintProc procedures} -body { .t window configure 1.0 -align baseline .t window configure 1.0 -align } -result {-align {} {} center baseline} test textWind-4.2 {AlignParseProc and AlignPrintProc procedures} -body { .t window configure 1.0 -align bottom .t window configure 1.0 -align |
︙ | ︙ | |||
513 514 515 516 517 518 519 | frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f update destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] } -result [list \ | | | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f update destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] } -result [list \ [list [xchar 2] [expr {[yline 1]+$fixedHeight/2}] 0 0] \ [list [xchar 2] [yline 1] $fixedWidth $fixedHeight]] test textWind-5.3 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color |
︙ | ︙ | |||
541 542 543 544 545 546 547 | .t window create 1.2 -align bottom .t window configure 1.2 -window .f update destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] } -result [list \ | | | | | < | | | < | | | | | | | < < | 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 | .t window create 1.2 -align bottom .t window configure 1.2 -window .f update destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] } -result [list \ [list [xchar 2] [yline 2] 0 0] \ [list [xchar 2] [yline 1] $fixedWidth $fixedHeight]] test textWind-5.5 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" .t window create 1.2 -create {frame .f -width 10 -height 20 -bg $color} update .t window configure 1.2 -create {frame .f -width 20 -height 10 -bg $color} destroy .f update list [catch {.t index .f} msg] $msg [.t bbox 1.2] [.t bbox 1.3] } -result [list 0 1.2 \ [list [xchar 2] [expr {[yline 1]+($fixedHeight-10)/2}] 20 10] \ [list [expr {[xchar 2]+20}] [yline 1] $fixedWidth $fixedHeight]] test textWind-6.1 {EmbWinRequestProc procedure} -setup { .t delete 1.0 end destroy .f set result {} } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f lappend result [.t bbox 1.2] [.t bbox 1.3] .f configure -width 25 -height 30 lappend result [.t bbox 1.2] [.t bbox 1.3] } -cleanup { destroy .f } -result [list \ [list [xchar 2] [yline 1] 10 20] \ [list [expr {[xchar 2]+10}] [expr {[yline 1]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight] \ [list [xchar 2] [yline 1] 25 30] \ [list [expr {[xchar 2]+25}] [expr {[yline 1]+(30-$fixedHeight)/2}] $fixedWidth $fixedHeight]] test textWind-7.1 {EmbWinLostContentProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f update place .f -in .t -x 100 -y 50 update list [winfo geom .f] [.t bbox 1.2] } -cleanup { destroy .f } -result [list \ 10x20+[expr {[bo]+100}]+[expr {[bo]+50}] \ [list [xchar 2] [expr {[yline 1]+$fixedHeight/2}] 0 0]] test textWind-7.2 {EmbWinLostContentProc procedure} -setup { .t delete 1.0 end destroy .t.f } -body { .t insert 1.0 "Some sample text" frame .t.f -width 10 -height 20 -bg $color .t window create 1.2 -window .t.f update place .t.f -x 100 -y 50 update list [winfo geom .t.f] [.t bbox 1.2] } -cleanup { destroy .t.f } -result [list \ 10x20+[expr {[bo]+100}]+[expr {[bo]+50}] \ [list [xchar 2] [expr {[yline 1]+$fixedHeight/2}] 0 0]] test textWind-8.1 {EmbWinDeleteProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f bind .f <Destroy> {set x destroyed} set x XXX .t delete 1.2 list $x [.t bbox 1.2] [.t bbox 1.3] [winfo exists .f] } -result [list destroyed \ [list [xchar 2] [yline 1] $fixedWidth $fixedHeight] \ [list [xchar 3] [yline 1] $fixedWidth $fixedHeight] \ 0] test textWind-8.2 {EmbWinDeleteProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color .t window create 1.2 -window .f bind .f <Destroy> {set x destroyed} set x XXX .t delete 1.2 .t index .f } -returnCodes error -result {bad text index ".f"} test textWind-9.1 {EmbWinCleanupProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text\nA second line." frame .f -width 10 -height 20 -bg $color .t window create 2.3 -window .f .t delete 1.5 2.1 .t index .f } -cleanup { destroy .f } -result {1.7} test textWind-10.1 {EmbWinLayoutProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" .t window create 1.5 -create { |
︙ | ︙ | |||
690 691 692 693 694 695 696 | set msg xyzzy update list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{couldn't create window}} \ | | | | 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 | set msg xyzzy update list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{couldn't create window}} \ [list [xchar 5] [expr {[yline 1]+$fixedHeight/2}] 0 0]] test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end proc bgerror args { global msg set msg $args } } -body { .t insert 1.0 "Some sample text" .t window create 1.5 -create { concat gorp } set msg xyzzy update list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{bad window path name "gorp"}} \ [list [xchar 5] [expr {[yline 1]+$fixedHeight/2}] 0 0]] test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t.f proc bgerror args { global msg lappend msg $args |
︙ | ︙ | |||
741 742 743 744 745 746 747 | } lappend msg [.t bbox 1.5] [winfo exists .t.f.f] } -cleanup { destroy .t.f rename bgerror {} } -result [list \ {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} \ | | | | 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 | } lappend msg [.t bbox 1.5] [winfo exists .t.f.f] } -cleanup { destroy .t.f rename bgerror {} } -result [list \ {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} \ [list [xchar 5] [expr {[yline 1]+$fixedHeight/2}] 0 0] \ 1] test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t.f proc bgerror args { global msg if {$msg == ""} { lappend msg $args } } } -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 { |
︙ | ︙ | |||
788 789 790 791 792 793 794 | set msg {} update lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{can't embed .t relative to .t}} \ | | | | | | 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 | set msg {} update lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} } -result [list \ {{can't embed .t relative to .t}} \ [list [xchar 5] [expr {[yline 1]+$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 [xchar 5] [expr {[yline 1]+$fixedHeight/2}] 0 0]] test textWind-10.8 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t2 proc bgerror args { global msg lappend msg $args |
︙ | ︙ | |||
858 859 860 861 862 863 864 | test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap char .t insert 1.0 "Some sample text" | | | | | | | | | | | | | | | | > | | | > | | | | 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 | test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap char .t insert 1.0 "Some sample text" frame .f -width [expr {([.t cget -width]-12)*$fixedWidth-1}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 12] [yline 1] [xw [expr {[.t cget -width]-12}]] 20] \ [list [xchar 0] [expr {[yline 1]+20}] $fixedWidth $fixedHeight]] test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap char .t insert 1.0 "Some sample text" frame .f -width [expr {([.t cget -width]-12)*$fixedWidth}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 12] [yline 1] [xw [expr {[.t cget -width]-12}]] 20] \ [list [xchar 0] [expr {[yline 1]+20}] $fixedWidth $fixedHeight]] test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap char .t insert 1.0 "Some sample text" frame .f -width [expr {([.t cget -width]-12)*$fixedWidth+1}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 0] [yline 2] [expr {[xw [expr {[.t cget -width]-12}]]+1}] 20] \ [list [expr {[xchar 0]+[expr {[xw [expr {[.t cget -width]-12}]]+1}]}] [expr {[yline 2]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight]] test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap none .t insert 1.0 "Some sample text" frame .f -width [expr {([.t cget -width]-12)*$fixedWidth+5}] -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 12] [yline 1] [xw [expr {[.t cget -width]-12}]] 20] \ {}] test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap none .t insert 1.0 "Some sample text" frame .f -width [expr {([.t cget -width]-12)*$fixedWidth+5}] -height 220 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 12] [yline 1] [xw [expr {[.t cget -width]-12}]] [expr {[.t cget -height]*$fixedHeight}]] \ {}] test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap char .t insert 1.0 "Some sample text" frame .f -width 250 -height 220 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f update list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f } -result [list \ [list [xchar 0] [yline 2] [xw [.t cget -width]] [expr {([.t cget -height]-1)*$fixedHeight}]] \ {}] 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 {[xchar 12]+30}]+[expr {[yline 1]+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+[xchar 12]+[yline 1]] 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"} |
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | .t xview moveto 0 .t xview scroll 5 units update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] [winfo ismapped .f2] } -cleanup { destroy .f .f2 } -result [list 1 \ | | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | .t xview moveto 0 .t xview scroll 5 units update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] [winfo ismapped .f2] } -cleanup { destroy .f .f2 } -result [list 1 \ 30x20+[xchar 14]+[yline 2] \ [list [xchar 14] [yline 2] 30 20] \ 0] test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -setup { .t delete 1.0 end destroy .f .f2 } -body { .t insert 1.0 "xyzzy\nFirst window here: " |
︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | .t xview scroll 25 units update list [winfo ismapped .f] [winfo ismapped .f2] [winfo geom .f2] [.t bbox .f2] } -cleanup { destroy .f .f2 .t configure -wrap char } -result [list 0 1 \ | | | > < | | | | | | | | | | | | | | | | | | < | 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 | .t xview scroll 25 units update list [winfo ismapped .f] [winfo ismapped .f2] [winfo geom .f2] [.t bbox .f2] } -cleanup { destroy .f .f2 .t configure -wrap char } -result [list 0 1 \ 40x10+[expr {[xchar [expr {37-25}]]+30}]+[expr {[yline 2]+(20-10)/2}] \ [list [expr {[xchar [expr {37-25}]]+30}] [expr {[yline 2]+(20-10)/2}] 40 10]] test textWind-12.1 {EmbWinUndisplayProc procedure, mapping/unmapping} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 30 -height 20 -bg $color .t window create 1.2 -window .f bind .f <Map> {lappend x mapped} bind .f <Unmap> {lappend x unmapped} set x created 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 } -cleanup { destroy .f } -result {created mapped modified replaced unmapped mapped off-screen unmapped} test textWind-13.1 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align top -padx 2 -pady 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x5+[expr {[xchar 2]+2}]+[expr {[yline 1]+1}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1}] 5 5]] test textWind-13.2 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align center -padx 2 -pady 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x5+[expr {[xchar 2]+2}]+[expr {[yline 1]+1+(($fixedHeight-7)/2)}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1+(($fixedHeight-7)/2)}] 5 5]] test textWind-13.3 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align baseline -padx 2 -pady 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x5+[expr {[xchar 2]+2}]+[expr {[yline 1]+1+($fixedAscent-6)}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1+($fixedAscent-6)}] 5 5]] test textWind-13.4 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align bottom -padx 2 -pady 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x5+[expr {[xchar 2]+2}]+[expr {[yline 1]+1+($fixedHeight-7)}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1+($fixedHeight-7)}] 5 5]] test textWind-13.5 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align top -padx 2 -pady 1 -stretch 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x[expr {$fixedHeight-2}]+[expr {[xchar 2]+2}]+[expr {[yline 1]+1}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1}] 5 [expr {$fixedHeight-2}]]] test textWind-13.6 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align center -padx 2 -pady 1 -stretch 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x[expr {$fixedHeight-2}]+[expr {[xchar 2]+2}]+[expr {[yline 1]+1}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1}] 5 [expr {$fixedHeight-2}]]] test textWind-13.7 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align baseline -padx 2 -pady 1 -stretch 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x[expr {$fixedAscent-1}]+[expr {[xchar 2]+2}]+[expr {[yline 1]+1}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1}] 5 [expr {$fixedAscent-1}]]] test textWind-13.8 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align bottom -padx 2 -pady 1 -stretch 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f } -result [list \ 5x[expr {$fixedHeight-2}]+[expr {[xchar 2]+2}]+[expr {[yline 1]+1}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+1}] 5 [expr {$fixedHeight-2}]]] test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -setup { .t delete 1.0 end destroy .f } -body { .t configure -spacing1 5 -spacing3 2 .t delete 1.0 end .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align center -padx 2 -pady 1 update list [winfo geom .f] [.t bbox .f] } -cleanup { .t configure -spacing1 0 -spacing3 0 destroy .f } -result [list \ 5x5+[expr {[xchar 2]+2}]+[expr {[yline 1]+5+(($fixedHeight-5)/2)}] \ [list [expr {[xchar 2]+2}] [expr {[yline 1]+5+(($fixedHeight-5)/2)}] 5 5]] test textWind-14.1 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" frame .f -width 30 -height 20 -bg $color |
︙ | ︙ | |||
1320 1321 1322 1323 1324 1325 1326 | .t window create 1.6 -window .f .t tag add a 1.1 .t tag add a 1.3 list [.t index .f] [.t bbox 1.7] } -cleanup { destroy .f } -result [list 1.6 \ | < | | 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 | .t window create 1.6 -window .f .t tag add a 1.1 .t tag add a 1.3 list [.t index .f] [.t bbox 1.7] } -cleanup { destroy .f } -result [list 1.6 \ [list [expr {[xchar 6]+30}] [expr {[yline 1]+(20-$fixedHeight)/2}] $fixedWidth $fixedHeight]] test textWind-16.1 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { .t configure -wrap none .t insert 1.0 "Some sample text" |
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 | frame .f2 -width 150 -height 30 -bd 2 -relief raised pack .f2 -before .t update lappend result [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f .f2 } -result [list \ | | | | | | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | frame .f2 -width 150 -height 30 -bd 2 -relief raised pack .f2 -before .t update lappend result [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f .f2 } -result [list \ 30x20+[expr {[xchar 6]}]+[yline 1] \ [list [expr {[xchar 6]}] [yline 1] 30 20] \ 30x20+[expr {[xchar 6]}]+[expr {[yline 1]+30}] \ [list [expr {[xchar 6]}] [yline 1] 30 20]] test textWind-16.3 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end } -body { .t configure -wrap none .t insert 1.0 "Some sample text" .t window create 1.6 |
︙ | ︙ | |||
1390 1391 1392 1393 1394 1395 1396 | .t window create 1.6 -window .t.f update pack forget .t update list [winfo ismapped .t.f] [.t bbox .t.f] } -cleanup { pack .t | | < | | | | | | | | | > > > > > > > > > | | > > > > > > > > > | > > | | > | | > | | > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .t window create 1.6 -window .t.f update pack forget .t update list [winfo ismapped .t.f] [.t bbox .t.f] } -cleanup { pack .t } -result [list 1 [list [expr {[xchar 6]}] [yline 1] 30 20]] test textWind-17.1 {peer widgets and embedded windows} -setup { destroy .t .tt .f } -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 | # # Tile package: entry widget tests # package require tk package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands variable scrollInfo proc scroll args { global scrollInfo set scrollInfo $args } # Some of the tests raise background errors; |
︙ | ︙ | |||
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]] \ | > > > > > > | | | > | | | 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 | 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" -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" -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" focus -force .te ; # needed on some systems such as Ubuntu (see ticket [3c2a3a988f]) 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"}] |
︙ | ︙ | |||
104 105 106 107 108 109 110 | # Bounding box / scrolling tests. test entry-3.0 "Series 3 setup" -body { ttk::style theme use default variable fixed TkFixedFont variable cw [font measure $fixed a] variable ch [font metrics $fixed -linespace] | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | # Bounding box / scrolling tests. test entry-3.0 "Series 3 setup" -body { ttk::style theme use default variable fixed TkFixedFont variable cw [font measure $fixed a] variable ch [font metrics $fixed -linespace] variable bd 3 ;# border + padding + extra space for focus ring variable ux [font measure $fixed 乎] pack [ttk::entry .e -font $fixed -width 20] update } test entry-3.1 "bbox widget command" -body { |
︙ | ︙ | |||
235 236 237 238 239 240 241 | test entry-6.1 {Update linked variable in write trace} -body { proc override args { global x set x "Overridden!" } catch {destroy .e} set x "" | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | test entry-6.1 {Update linked variable in write trace} -body { proc override args { global x set x "Overridden!" } catch {destroy .e} set x "" trace add variable x write override ttk::entry .e -textvariable x .e insert 0 "Some text" set result [list $x [.e get]] set result } -result {Overridden! Overridden!} -cleanup { unset x rename override {} |
︙ | ︙ | |||
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} { | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | .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] |
︙ | ︙ | |||
364 365 366 367 368 369 370 371 372 | .e state invalid set res [.e state] event generate .e <FocusOut> lappend res [.e state] } -result {invalid invalid} -cleanup { destroy .e } tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .e state invalid set res [.e state] event generate .e <FocusOut> lappend res [.e state] } -result {invalid invalid} -cleanup { destroy .e } test entry-11.2 {Bug [2a32225cd1] - Navigation in a password made of several words} -setup { destroy .e pack [ttk::entry .e -show *] update set res {} } -body { .e insert end "A sample password made of several words" .e icursor end event generate .e <<PrevWord>> ; # shall move insert to index 0 .e delete insert end lappend res [.e get] .e insert end "A sample password made of several words" .e icursor 2 event generate .e <<NextWord>> ; # shall move insert to index end .e delete 0 insert lappend res [.e get] } -cleanup { destroy .e } -result {{} {}} 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" |
︙ | ︙ | |||
507 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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-198376af5a {moving tab position to a different edge} -body { destroy .nb ttk::notebook .nb -width 200 -height 100 -padding 0 ttk::frame .nb.f1 ttk::frame .nb.f2 .nb add .nb.f1 -text "One" .nb add .nb.f2 -text "Two" pack .nb update ttk::style configure TNotebook -tabposition s update expr {[winfo y .nb.f1] < 10} } -result 1 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 |
Added tests/ttk/pb_image.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 76 | <?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://creativecommons.org/ns#" 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="30" height="14" viewBox="0 0 30 14" version="1.1" id="svg8" sodipodi:docname="slider-hn.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)" style="shape-rendering:crispEdges"> <defs id="defs2" /> <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="24.766586" inkscape:cx="15.000049" inkscape:cy="7.0000477" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1315" inkscape:window-height="617" inkscape:window-x="155" inkscape:window-y="185" inkscape:window-maximized="0" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" units="px" showguides="false" showborder="false" inkscape:pagecheckerboard="true" /> <metadata id="metadata5"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-97.353746,-141.48839)"> <rect style="opacity:1;fill:#0044ff;fill-opacity:1;stroke:#222222;stroke-width:0.7;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect815" width="13.3" height="29.3" x="141.98839" y="-126.85384" ry="0" transform="rotate(90)" /> </g> </svg> |
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 |
︙ | ︙ | |||
70 71 72 73 74 75 76 | .pb configure -variable PB ;# @@@ set PB 5 .pb step set PB } -result 6.0 test progressbar-2.5 "error in write trace" -body { | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | .pb configure -variable PB ;# @@@ set PB 5 .pb step set PB } -result 6.0 test progressbar-2.5 "error in write trace" -body { trace add variable PB write { error "YIPES!" ;# } .pb step set PB ;# NOTREACHED } -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!" test progressbar-end "Cleanup" -body { destroy .pb } |
︙ | ︙ | |||
92 93 94 95 96 97 98 | -length -maximum -mode -orient -phase -value -variable} { lappend res [.defaultpb cget $option] } set res } -cleanup { unset res destroy .defaultpb | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | -length -maximum -mode -orient -phase -value -variable} { lappend res [.defaultpb cget $option] } set res } -cleanup { unset res destroy .defaultpb } -result {w black left {} {} 0 75p 100.0 determinate horizontal 0 0.0 {}} test progressbar-3.2 "TIP #442 options are taken into account" -setup { set res {} pack [ttk::progressbar .p -value 0 -maximum 50 -orient horizontal -mode determinate -length 500] set thefont [font actual {Arial 10}] } -body { .p configure -anchor c -foreground blue -justify right \ |
︙ | ︙ | |||
117 118 119 120 121 122 123 124 125 | lappend res [list $option [.p cget $option]] } set res } -cleanup { unset res thefont destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | lappend res [list $option [.p cget $option]] } set res } -cleanup { unset res thefont destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} test progressbar-3.3 {horizontal progressbar height with no -text (TIP #442) specified - Bug [8bee4b2009]} -setup { set res {} set oldTheme [ttk::style theme use] } -body { ttk::style theme use default set imga [image create photo -file [file join [file dirname [info script]] pb_image.svg] -format {svg -scale 0.8}] ::ttk::style element create Horizontal.Progressbar.pbar image $imga # -text "": progressbar height does not depend on font height pack [ttk::progressbar .p -orient horizontal -font {TkDefaultFont 24}] .p step 25 update set res [expr {[winfo reqheight .p] == [image height $imga] + 2}] # -text "something": progressbar height adjusts to contain the font height .p configure -text Hello -font {TkDefaultFont 24} update lappend res [expr {[winfo reqheight .p] == [font metrics [.p cget -font] -linespace] + 2}] } -cleanup { destroy .p ttk::style theme use $oldTheme # there's no way I know to undo '::ttk::style element create...' } -result {1 1} 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 add variable v write { 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 { |
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 | destroy .t .s } -body { pack [text .t -yscrollcommand {.s set}] -side left for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left 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 | > | > | > | < | < | < < | < < < | > | < | > | < < < < < < | < < < < < < > | | < | | 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 | destroy .t .s } -body { pack [text .t -yscrollcommand {.s set}] -side left for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left update focus -force .s event generate .s <Enter> 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 <Enter> 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 <Enter> 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 { |
︙ | ︙ | |||
279 280 281 282 283 284 285 286 287 288 289 290 291 292 | } set ::spinbox_test } -cleanup { destroy .sb unset -nocomplain ::spinbox_test max } -result {one two three 4 5 two six six six two 5 4 three two one one one one} # nostomp: NB intentional difference between ttk::spinbox and tk::spinbox; # see also #1439266 # test spinbox-nostomp-1 "don't stomp on -variable (init; -from/to)" -body { set SBV 55 ttk::spinbox .sb -textvariable SBV -from 0 -to 100 -increment 5 | > > > > > > > > > > > > > > > > > > > > > | 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 | } set ::spinbox_test } -cleanup { destroy .sb unset -nocomplain ::spinbox_test max } -result {one two three 4 5 two six six six two 5 4 three two one one one one} test spinbox-11.2 {Bugs [2a32225cd1] and [9fa3e08243]} -setup { destroy .s pack [ttk::spinbox .s] update set res {} } -body { .s insert end "A sample text" .s icursor end event generate .s <<PrevWord>> ; # shall move insert to index 9 .s delete insert end lappend res [.s get] .s delete 0 end .s insert end "A sample text" .s icursor 2 event generate .s <<NextWord>> ; # shall move insert to index 9 .s delete 0 insert lappend res [.s get] } -cleanup { destroy .s } -result {{A sample } text} # nostomp: NB intentional difference between ttk::spinbox and tk::spinbox; # see also #1439266 # test spinbox-nostomp-1 "don't stomp on -variable (init; -from/to)" -body { set SBV 55 ttk::spinbox .sb -textvariable SBV -from 0 -to 100 -increment 5 |
︙ | ︙ | |||
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: | > > > > > > > > > > > > > > | 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 | 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 -text "nn" .tv insert nn end -id nn.n1 -text "nn.1" .tv insert nn end -id nn.n2 -text "nn.3" .tv insert nn end -id nn.n3 -text "nn.3" for {set t 2} {$t < 100} {incr t} { .tv insert {} end -id nn$t -text "nn$t" if {$t % 3 == 0} { .tv insert nn$t end -id nn$t.n1 -text "nn$t.n1" .tv insert nn$t end -id nn$t.n2 -text "nn$t.n2" .tv insert nn$t end -id nn$t.n3 -text "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 { |
︙ | ︙ | |||
164 165 166 167 168 169 170 171 172 | foreach item [.tv children {}] { lappend result [.tv index $item] } set result } -result [list 0 1 2 3 4 5 6] test treeview-3.6 "detach" -body { .tv detach newnode consistencyCheck .tv | > | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | foreach item [.tv children {}] { lappend result [.tv index $item] } set result } -result [list 0 1 2 3 4 5 6] test treeview-3.6 "detach" -body { set before [.tv detached newnode] .tv detach newnode consistencyCheck .tv list [.tv children {}] [.tv detached] $before [.tv detached newnode] } -result {{newfirstone firstnode anotherone onemore lastnode newlastone} newnode 0 1} # XREF: treeview-2.13 test treeview-3.7 "detach didn't screw up internal links" -body { consistencyCheck .tv set result [list] foreach item [.tv children {}] { lappend result [.tv index $item] |
︙ | ︙ | |||
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" | > < > | | > | | | 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 | .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 { set before [.tv detached newnode] .tv move newnode {} end consistencyCheck .tv list [.tv children {}] $before [.tv detached newnode] [.tv detached] } -result {{newfirstone firstnode anotherone onemore lastnode newlastone newnode} 1 0 {}} # Bug # ????? test treeview-3.13 "Re-reattach" -body { set before [.tv detached newnode] .tv move newnode {} end consistencyCheck .tv list [.tv children {}] $before [.tv detached newnode] } -result {{newfirstone firstnode anotherone onemore lastnode newlastone newnode} 0 0} catch { .tv insert newfirstone end -id x1 .tv insert newfirstone end -id x2 .tv insert newfirstone end -id x3 } |
︙ | ︙ | |||
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 | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | 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]] | > > > > > > > > > > > > < < | 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 | 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] | < | | > | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | # 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 *} | | > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > | | | | | | | | > > > > > > > > > > > > > > > | > > > > | > | > > > > > > > > > > > | > > > > | | 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 | .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] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .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 | > > | > | | | | > > > > > | | | | | | | | | | | | < > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | } return $result } test treeview-identify-setup "identify series - setup" -body { destroy .tv ttk::setTheme default ttk::style configure Treeview -rowheight 10m ttk::style configure Treeview.Heading -font {Arial 10} 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 200 ;# 0-200 .tv column A -width 200 ;# 200-400 .tv column B -width 200 ;# 400-600 .tv column C -width 200 ;# 600-800 (plus slop for margins) wm geometry . {} ; pack .tv ; update } # treeview-identify-setup sets heading row font to Arial with size 10 points, # so the heading line center y-coordinate is (in pixels): set yHLC [expr {([font metrics {Arial 10} -linespace] + 2) / 2.0}] # which makes the following in millimeters: set yHLC [expr {$yHLC / [winfo screenwidth .] * [winfo screenmmwidth .]}] test treeview-identify-1 "identify heading" -body { .tv configure -show {headings tree} update idletasks identify* .tv {region column} 10 ${yHLC}m } -result [list heading #0] test treeview-identify-2 "identify columns" -body { .tv configure -displaycolumns #all update idletasks columnids .tv [identify* .tv column 100 ${yHLC}m 300 ${yHLC}m 500 ${yHLC}m 700 ${yHLC}m] } -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 100 ${yHLC}m 300 ${yHLC}m 500 ${yHLC}m 700 ${yHLC}m] } -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} 100 ${yHLC}m 300 ${yHLC}m 500 ${yHLC}m 700 ${yHLC}m } -result [list heading #1 heading #2 heading #3 nothing {}] # Item height (-rowheight) is 10 millimeters (set in treeview-identify-setup) test treeview-identify-5 "vertical scan - no headings" -body { .tv configure -displaycolumns #all -show {tree} update idletasks identify* .tv {region item} 100 5m 100 15m 100 35m 100 45m 100 55m 100 65m } -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} 100 ${yHLC}m 100 [expr {$yHLC+5}]m 100 [expr {$yHLC+15}]m 100 [expr {$yHLC+35}]m 100 [expr {$yHLC+45}]m } -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} 100 ${yHLC}m 100 [expr {$yHLC+5}]m 100 [expr {$yHLC+15}]m 300 [expr {$yHLC+35}]m 100 [expr {$yHLC+45}]m } -result [list heading {} {} cell branch {branch #1} cell item1 {item1 #1} cell item2 {item2 #2} cell item3 {item3 #1}] # 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 ttk::style configure Treeview -indent 8m update idletasks identify* .tv {item element} 4m 5m 12m 15m 20m 25m } -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 40 ${yHLC}m 10m [expr {$yHLC+6}]m # Heading elements are currently not reported } -result [list {} {} text] ttk::style configure Treeview -rowheight 20 # 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 } -cleanup { ttk::style configure Treeview -rowheight {} } -result 25 test treeview-rowheight-3 "rowheight adapts to font" -constraints haveBigFontTwiceLargerThanTextFont -body { ttk::style configure Treeview -font "Courier 12" update set baseline [lindex [.tv bbox nn a] 3] ttk::style configure Treeview -font "Helvetica 24" 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" -constraints haveBigFontTwiceLargerThanTextFont -body { font create __tf -family Courier -size 12 ttk::style configure Treeview -font __tf update set baseline [lindex [.tv bbox nn a] 3] font configure __tf -family Helvetica -size 24 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}] } -cleanup { ttk::style configure Item -padding {} } -result [expr {3-2 + 5-2}] 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}] } -cleanup { ttk::style configure Cell -padding {} } -result [expr {8-5 + 9-5}] ### 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .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-6ee162c3d9 "style configure Treeview -rowheight 0" -setup { tvSetupWithItems } -body { ttk::style configure Treeview -rowheight 0 ; # shall not crash update } -result {} 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 } |
︙ | ︙ | |||
25 26 27 28 29 30 31 | # Do these early, so any memory corruption has a longer time to cause a crash. # proc selfdestruct {w args} { destroy $w } test ttk-6.1 "Self-destructing checkbutton" -body { pack [ttk::checkbutton .sd -text "Self-destruction" -variable ::sd] | | | | 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 | # Do these early, so any memory corruption has a longer time to cause a crash. # proc selfdestruct {w args} { destroy $w } test ttk-6.1 "Self-destructing checkbutton" -body { pack [ttk::checkbutton .sd -text "Self-destruction" -variable ::sd] trace add variable sd write [list selfdestruct .sd] update .sd invoke } -returnCodes error test ttk-6.2 "Checkbutton self-destructed" -body { winfo exists .sd } -result 0 # test ttk-6.3 not applicable [see #2175411] test ttk-6.4 "Destroy widget in configure" -setup { set OUCH ouch trace add variable OUCH read { kill.b } proc kill.b {args} { destroy .b } } -cleanup { unset OUCH } -body { pack [ttk::checkbutton .b] set rc [catch { .b configure -variable OUCH } msg] list $rc $msg [winfo exists .b] [info commands .b] |
︙ | ︙ | |||
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> |
︙ | ︙ | |||
107 108 109 110 111 112 113 | } -body { catch {ttk::label .l} errmsg list $errmsg [info commands .l] [winfo exists .l] } -result [list {bad cursor spec "badCursor"} {} 0] test ttk-construction-failure-2 "Destroy widget in constructor" -setup { set OUCH ouch | | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | } -body { catch {ttk::label .l} errmsg list $errmsg [info commands .l] [winfo exists .l] } -result [list {bad cursor spec "badCursor"} {} 0] test ttk-construction-failure-2 "Destroy widget in constructor" -setup { set OUCH ouch trace add variable OUCH read { kill.b } 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. |
︙ | ︙ | |||
587 588 589 590 591 592 593 | -match glob -cleanup { destroy .tw } test ttk-15.1 {Bug 3062331} -setup { destroy .b } -body { set Y {} ttk::button .b -textvariable Y | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | -match glob -cleanup { destroy .tw } test ttk-15.1 {Bug 3062331} -setup { destroy .b } -body { set Y {} ttk::button .b -textvariable Y trace add variable Y unset "destroy .b; #" unset Y } -cleanup { destroy .b } -result {} test ttk-15.2 {Bug 3341056} -setup { proc foo {} { |
︙ | ︙ | |||
651 652 653 654 655 656 657 | 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 "" | > > > > > > > > > > > | | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | 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 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 # ------------------------------------------------------------------------------ |
︙ | ︙ | |||
86 87 88 89 90 91 92 | set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]] expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \ && ([lindex $vals 2]/256 == $blue) } testConstraint pressbutton [llength [info commands pressbutton]] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | > | | | > | | | > | | | > | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]] 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 {Tk_UseWindow 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 {Tk_UseWindow 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 {Tk_UseWindow 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 {Tk_UseWindow 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 {Tk_UseWindow 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 { destroy {*}[winfo children .] toplevel .t -use $w list [testembed] [expr [lindex [lindex [testembed all] 0] 0] - $w] } } -cleanup { deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.5a {Tk_UseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 child alias w winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t -use [w] list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}] } } -cleanup { interp delete child deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.6 {Tk_UseWindow 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 { destroy {*}[winfo children .] toplevel .t1 -use $w1 toplevel .t2 -use $w2 testembed } } -cleanup { deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.6a {Tk_UseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 child alias w1 winfo id .f1 child alias w2 winfo id .f2 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] toplevel .t2 -use [w2] testembed } } -cleanup { interp delete child deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.7 {Tk_UseWindow 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] testembed } destroy .f1 update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] testembed destroy .t1 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 { destroy {*}[winfo children .] 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 } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 set x [testembed] child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] wm withdraw .t1 } 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] -bd 2 -relief raised update wm geometry .t1 +30+40 update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] update wm geometry .t1 300x100+30+40 update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] .t1 configure -width 300 -height 80 update } 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] set x unmapped bind .t1 <Map> {set x mapped} update after 100 update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 bind .f1 <Destroy> {set x dead} set x alive child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] update destroy .t1 } update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] update .t1 configure -width 180 -height 100 update 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 { destroy {*}[winfo children .] 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 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 children .] toplevel .t1 -use [w1] } set x [testembed] destroy .f1 list $x [testembed] } -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 { destroy {*}[winfo children .] 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 children .] 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 { destroy {*}[winfo children .] 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 children .] 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 { destroy {*}[winfo children .] 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 children .] toplevel .t1 -use [w1] set x {} bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} update } focus -force .f1 update set x [child eval {update; set x }] focus . update list $x [child eval {update; set x}] } -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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] update bind .t1 <Configure> {set x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 place .f1 -width 200 -height 200 update child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] update bind .t1 <Configure> {set x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { interp delete child deleteWindows } -result {{configure .t1 200 200} 200x200+0+0} # Can't think up any tests for Tk_GetOtherWindow 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 { destroy {*}[winfo children .] 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 { deleteWindows catch {interp delete child} ::_test_tmp::testInterp child load {} Tktest child } -body { deleteWindows frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] } focus -force . bind . <Key> {lappend x {key %A %E}} set x {} set y [child eval { update bind .t1 <Key> {lappend y {key %A}} set y {} event generate .t1 <Key> -keysym a set y }] update 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 { destroy {*}[winfo children .] 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} ::_test_tmp::testInterp child load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] } update focus -force .f1 update bind . <Key> {lappend x {key %A}} set x {} |
︙ | ︙ | |||
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 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 | 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 { destroy {*}[winfo children .] 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 { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 update child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken } # This should clear focus from the application embedded in .f1 focus -force .f2 update list [child eval { set x [list [focus]] |
︙ | ︙ | |||
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 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 | 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 { destroy {*}[winfo children .] 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 load {} Tktest child } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 child alias w1 winfo id .f1 child eval { destroy {*}[winfo children .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken set x {} lappend x [testembed] destroy .t1 lappend x [testembed] } } -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 failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] } foreach {constraint font} { hasArial arial |
︙ | ︙ | |||
114 115 116 117 118 119 120 | } {} test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | } {} test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 haveCourier37Font} { lindex [font actual {-family courier -size 37}] 3 } 37 test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { # On Linux, XListFonts() was returning names for fonts that do not # actually exist, causing the subsequent XLoadQueryFont() to fail # unexpectedly. Now falls back to another font if that happens. |
︙ | ︙ | |||
233 234 235 236 237 238 239 | test unixfont-7.3 {DrawChars procedure: overstrike} x11 { set f [.b.l cget -font] .b.l config -text "abc" -font "courier 10 overstrike" update .b.l config -font $f } {} | | | | | | | | | | | | | 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 | test unixfont-7.3 {DrawChars procedure: overstrike} x11 { set f [.b.l cget -font] .b.l config -text "abc" -font "courier 10 overstrike" update .b.l config -font $f } {} test unixfont-8.1 {InitFont procedure: use old font} x11 { font create xyz button .c -font xyz font configure xyz -family times update destroy .c font delete xyz } {} test unixfont-8.2 {InitFont procedure: parse information from XLFD} x11 { expr {[lindex [font actual {-family times -size 0}] 3] == 0} } 0 test unixfont-8.3 {InitFont procedure: can't parse info from name} x11 { catch {unset fontArray} # check that font actual returns the correct attributes. # the values of those attributes are system dependent. array set fontArray [font actual a12biluc] set result [lsort [array names fontArray]] catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} test unixfont-8.4 {InitFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} { set x 0 incr x [font measure $courier "䀀"] ;# 6 incr x [font measure $courier "\002"] ;# 4 incr x [font measure $courier "\012"] ;# 2 incr x [font measure $courier "\101"] ;# 1 set x } [expr $cx*13] test unixfont-8.5 {InitFont procedure: setup widths of normal chars} x11 { font metrics $courier -fixed } 1 test unixfont-8.6 {InitFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 incr x [font measure $courier "\012"] ;# 2 set x } [expr $cx*10] test unixfont-8.7 {InitFont procedure: XA_UNDERLINE_POSITION} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-8.8 {InitFont procedure: no XA_UNDERLINE_POSITION} x11 { catch {font actual --symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific} set x {} } {} test unixfont-8.9 {InitFont procedure: XA_UNDERLINE_THICKNESS} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-8.10 {InitFont procedure: no XA_UNDERLINE_THICKNESS} x11 { catch {font actual --symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific} set x {} } {} test unixfont-8.11 {InitFont procedure: XA_UNDERLINE_POSITION was 0} x11 { catch {font actual -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1} set x {} } {} test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu failsOnXQuarz} { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" |
︙ | ︙ |
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 |
︙ | ︙ | |||
71 72 73 74 75 76 77 | } -body { menu .m1 .m1 add cascade -label foo list [. configure -menu .m1] [. configure -menu ""] [destroy .m1] } -returnCodes ok -result {{} {} {}} | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | } -body { menu .m1 .m1 add cascade -label foo list [. configure -menu .m1] [. configure -menu ""] [destroy .m1] } -returnCodes ok -result {{} {} {}} test unixMenu-7.1 {Tk_SetMainMenubar - nothing to do} -constraints unix -body {} test unixMenu-8.1 {GetMenuIndicatorGeometry - indicator off} -constraints { unix } -setup { destroy .m1 } -body { |
︙ | ︙ |
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 75 | # 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] eq "aqua"} { proc restackDelay {} { after 200; update idletasks } } 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 | | | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 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 sleep 10 wm geom .t $geom update idletasks wm deiconify .t sleep 10 wm geom .t } 100x150$geom incr i } test unixWm-5.1 {compounded state changes} {unix nonPortable} { destroy .t |
︙ | ︙ | |||
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 | | | | | | 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 | 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 |
︙ | ︙ | |||
228 229 230 231 232 233 234 | set w2 [winfo width .t] set h2 [winfo height .t] .t config -width 114 -height 261 update list $width $height $w2 $h2 [wm geom .t] } {0 0 230 110 114x261+10+10} | < < < < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | set w2 [winfo width .t] set h2 [winfo height .t] .t config -width 114 -height 261 update list $width $height $w2 $h2 [wm geom .t] } {0 0 230 110 114x261+10+10} test unixWm-6.5 {window initially iconic} {unix nonPortable} { destroy .t toplevel .t -width 100 -height 30 wm geometry .t +0+0 wm title .t 2 wm iconify .t update idletasks |
︙ | ︙ | |||
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?"}} | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | 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}} | | | 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | 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} |
︙ | ︙ | |||
811 812 813 814 815 816 817 | WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit wm iconbitmap .t {} set bit [format 0x%x [expr 0x4 & [lindex [testprop [testwrapper .t] \ WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit wm iconbitmap .t {} set bit [format 0x%x [expr 0x4 & [lindex [testprop [testwrapper .t] \ WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} if {[tk windowingsystem] eq "aqua"} { set result_22_3 {0 {}} } else { set result_22_3 {1 {bitmap "bad-bitmap" not defined}} } test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \ unix { list [catch {wm iconbitmap .t bad-bitmap} msg] $msg |
︙ | ︙ | |||
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"}} | | | | 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 | 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 | | | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | } {{} 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, 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 |
︙ | ︙ | |||
1222 1223 1224 1225 1226 1227 1228 | set bit [format 0x%x [expr 0xa & [lindex [testprop [testwrapper .t] \ 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}} | | | | | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 | set bit [format 0x%x [expr 0xa & [lindex [testprop [testwrapper .t] \ 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] eq "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 | | | | | 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 | 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, 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. | | | 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 | 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"} |
︙ | ︙ | |||
1549 1550 1551 1552 1553 1554 1555 | tkwait visibility .t wm geometry .t 20x1 update list [winfo width .t] [winfo height .t] } {100 1} destroy .t toplevel .t -width 80 -height 60 | | < > | < > | 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 | tkwait visibility .t wm geometry .t 20x1 update list [winfo width .t] [winfo height .t] } {100 1} destroy .t toplevel .t -width 80 -height 60 test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} {unix} { wm overrideredirect .t 1 tkwait visibility .t update wm geometry .t +5-10 update list [winfo x .t] [winfo y .t] } [list 5 [expr [winfo screenheight .t] - 70]] destroy .t toplevel .t -width 80 -height 60 test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} {unix} { wm overrideredirect .t 1 tkwait visibility .t update wm geometry .t -30+$Y2 update list [winfo x .t] [winfo y .t] } [list [expr [winfo screenwidth .t] - 110] $Y2] destroy .t |
︙ | ︙ | |||
1609 1610 1611 1612 1613 1614 1615 | wm geometry .t +0+0 tkwait visibility .t set property [testprop [testwrapper .t] WM_NORMAL_HINTS] list [expr [lindex $property 5]] [expr [lindex $property 6]] \ [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {40 30 320 210 10 5} | | | 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | wm geometry .t +0+0 tkwait visibility .t set property [testprop [testwrapper .t] WM_NORMAL_HINTS] list [expr [lindex $property 5]] [expr [lindex $property 6]] \ [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {40 30 320 210 10 5} test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} { destroy .t toplevel .t -width 80 -height 60 wm minsize .t 30 40 wm maxsize .t 200 500 wm geometry .t +0+0 tkwait visibility .t set property [testprop [testwrapper .t] WM_NORMAL_HINTS] |
︙ | ︙ | |||
1637 1638 1639 1640 1641 1642 1643 | tkwait visibility .t set property [testprop [testwrapper .t] WM_NORMAL_HINTS] list [winfo height .t] \ [expr [lindex $property 5]] [expr [lindex $property 6]] \ [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {60 40 53 320 233 10 5} | | | 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 | tkwait visibility .t set property [testprop [testwrapper .t] WM_NORMAL_HINTS] list [winfo height .t] \ [expr [lindex $property 5]] [expr [lindex $property 6]] \ [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {60 40 53 320 233 10 5} test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper} { destroy .t toplevel .t -width 80 -height 60 frame .t.menu -height 23 -width 50 testmenubar window .t .t.menu wm resizable .t 0 0 wm geometry .t +0+0 tkwait visibility .t |
︙ | ︙ | |||
1784 1785 1786 1787 1788 1789 1790 | update list [expr [winfo rootx .t.m.f] - $x] [expr [winfo rooty .t.m.f] - $y] \ [expr [winfo rootx .t.f] - $x] [expr [winfo rooty .t.f] - $y] } {52 7 12 62} deleteWindows wm withdraw . | | | 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 | update list [expr [winfo rootx .t.m.f] - $x] [expr [winfo rooty .t.m.f] - $y] \ [expr [winfo rootx .t.f] - $x] [expr [winfo rooty .t.f] - $y] } {52 7 12 62} deleteWindows wm withdraw . if {[tk windowingsystem] eq "aqua"} { # Modern mac windows have no border. set result_50_1 {{} {} .t .t .t2 {} .t2 .t .t} } else { # Windows are assumed to have a border (invisible in Gnome 3). set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t} } test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu failsOnXQuarz} { |
︙ | ︙ | |||
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 | < > > > < > > > | 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 | [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 wm overrideredirect .t2 1 tkwait visibility .t2 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]}] \ | | < > | > | 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 | 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 {}} | | < > > > < > > > > | | 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 | 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 |
︙ | ︙ | |||
2039 2040 2041 2042 2043 2044 2045 2046 2047 | [winfo rooty .raise1]] destroy .raise1 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 | > > < > > > < > < > | > > | > > | > > > | > > | | 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 | [winfo rooty .raise1]] destroy .raise1 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 { wm geometry . +300+300 destroy .t update idletasks 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 tkwait visibility $w wm geometry $w +100+100 update } raise .t .t2 restackDelay update set result [list [winfo containing 200 200]] lower .t3 restackDelay sleep 10 lappend result [winfo containing 200 200] } {.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] eq "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] eq "aqua"} { wm deiconify . } test unixWm-51.10 {TkWmRestackToplevel procedure, don't move window that's already in the right place} unix { makeToplevels raise .raise1 set time [lindex [time {raise .raise1}] 0] expr {$time < 2000000} |
︙ | ︙ | |||
2492 2493 2494 2495 2496 2497 2498 | # # wm attributes tests: # # NOTE: since [wm attributes] is not guaranteed to have any effect, # the only thing we can really test here is the syntax. # | | | | < > | | | 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 | # # wm attributes tests: # # NOTE: since [wm attributes] is not guaranteed to have any effect, # the only thing we can really test here is the syntax. # if {[tk windowingsystem] eq "aqua"} { set match_60_1 glob set result_60_1 {-alpha 1.0 -appearance auto -buttons {close miniaturize zoom} -fullscreen 0 -isdark [01] -modified 0 -notify 0 -titlepath {} -topmost 0 -transparent 0 -stylemask {titled closable miniaturizable resizable} -class nswindow -tabbingid .t -tabbingmode auto -type unsupported} } else { set match_60_1 exact 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 } -match $match_60_1 -result $result_60_1 test unixWm-60.2 {wm attributes - test} -constraints unix -body { destroy .t toplevel .t wm attributes .t -topmost } -result 0 |
︙ | ︙ |
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/visual_bb.test.
︙ | ︙ | |||
19 20 21 22 23 24 25 | # Each menu entry invokes a visual test file proc runTest {file} { global testNum test "2.$testNum" "testing $file" {userInteraction} { | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Each menu entry invokes a visual test file proc runTest {file} { global testNum test "2.$testNum" "testing $file" {userInteraction} { uplevel #0 [list source [file join [testsDirectory] $file]] concat "" } {} incr testNum } # The following procedure is invoked to print the contents of a canvas: |
︙ | ︙ |
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 15 16 17 18 19 20 21 22 23 24 25 26 | # -*- 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 if {[testConstraint testwinevent]} { catch {testwinevent debug 1} } testConstraint tcl8 [package vsatisfies [package provide Tcl] 8] # Locale identifier LANG_ENGLISH is 0x09 testConstraint english [expr { [llength [info commands testwinlocale]] && (([testwinlocale] & 0xff) == 9) }] |
︙ | ︙ | |||
477 478 479 480 481 482 483 | then { Click ok } return $x } -result [file join [initialdir] "12x 455"] test winDialog-5.12 {GetFileName: initial directory: Tcl_TranslateFilename()} -constraints { | | < < | | | 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 | then { Click ok } return $x } -result [file join [initialdir] "12x 455"] test winDialog-5.12 {GetFileName: initial directory: Tcl_TranslateFilename()} -constraints { nt tcl8 } -body { tk_getOpenFile -initialdir ~12x/455 } -returnCodes error -result {user "12x" doesn't exist} test winDialog-5.12.1 {tk_getSaveFile: initial directory: ~} -constraints { nt testwinevent tcl8 } -body { unset -nocomplain x start {set x [tk_getSaveFile \ -initialdir ~ \ -initialfile "5 12 1" -title Foo]} then { Click ok } return $x } -result [file normalize [file join ~ "5 12 1"]] test winDialog-5.12.2 {tk_getSaveFile: initial directory: ~user} -constraints { nt testwinevent tcl8 } -body { # Note: this test will fail on Tcl versions 8.6.4 and earlier due # to a bug in file normalize for names of the form ~xxx that # returns the wrong dir on Windows. In particular (in Win8 at # least) it returned /users/Default instead of /users/USERNAME... |
︙ | ︙ | |||
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 tcl8 } -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 |
︙ | ︙ | |||
688 689 690 691 692 693 694 | start {set x [tk_getSaveFile -initialfile "12x 456" -title Foo]} then { Click ok } file tail $x } -result "12x 456" test winDialog-5.14 {GetFileName: initial file: Tcl_TranslateFileName()} -constraints { | | | 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | start {set x [tk_getSaveFile -initialfile "12x 456" -title Foo]} then { Click ok } file tail $x } -result "12x 456" test winDialog-5.14 {GetFileName: initial file: Tcl_TranslateFileName()} -constraints { nt tcl8 } -body { # if (Tcl_TranslateFileName(interp, string, &ds) == NULL) tk_getOpenFile -initialfile ~12x/455 } -returnCodes error -result {user "12x" doesn't exist} if {![vista?]} { # XXX - disabled for Vista because the new dialogs allow long file # names to be specified but force the user to change it. |
︙ | ︙ | |||
919 920 921 922 923 924 925 | start {set x [tk_chooseDirectory -initialdir [initialdir] -title Foo]} then { Click ok } string tolower [set x] } -result [string tolower [initialdir]] test winDialog-9.8 {Tk_ChooseDirectoryObjCmd: initial directory: Tcl_TranslateFilename()} -constraints { | | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | start {set x [tk_chooseDirectory -initialdir [initialdir] -title Foo]} then { Click ok } string tolower [set x] } -result [string tolower [initialdir]] test winDialog-9.8 {Tk_ChooseDirectoryObjCmd: initial directory: Tcl_TranslateFilename()} -constraints { nt tcl8 } -body { # if (Tcl_TranslateFileName(interp, string, # &utfDirString) == NULL) tk_chooseDirectory -initialdir ~12x/455 } -returnCodes error -result {user "12x" doesn't exist} |
︙ | ︙ |
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 |
︙ | ︙ | |||
350 351 352 353 354 355 356 | .t.l config -text "a" update } -cleanup { destroy .t.l } -result {} | | | | | | 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 | .t.l config -text "a" update } -cleanup { destroy .t.l } -result {} test winfont-7.1 {InitFont procedure: use old font} -constraints win -setup { destroy .c } -setup { catch {font delete xyz} } -body { font create xyz button .c -font xyz font configure xyz -family times update destroy .c font delete xyz } -result {} test winfont-7.2 {InitFont procedure: extract info from logfont} -constraints { win } -body { font actual {arial 10 bold italic underline overstrike} } -result {-family Arial -size 10 -weight bold -slant italic -underline 1 -overstrike 1} test winfont-7.3 {InitFont procedure: extract info from textmetric} -constraints { win } -body { font metric {arial 10 bold italic underline overstrike} -fixed } -result 0 test winfont-7.4 {InitFont procedure: extract info from textmetric} -constraints { win } -body { font metric systemfixed -fixed } -result 1 # cleanup cleanupTests return # Local variables: # mode: tcl # End: |
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 |
︙ | ︙ | |||
89 90 91 92 93 94 95 | } -setup { destroy .m1 } -body { catch {image delete image1} menu .m1 image create test image1 list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1] | | | | | | | | | | | | | | | | | 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 | } -setup { destroy .m1 } -body { catch {image delete image1} menu .m1 image create test image1 list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1] } -result {0 e001 {} {}} test winMenu-6.3 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -bitmap questhead} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.4 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.5 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "foo"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.6 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "This string has one & in it"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.7 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The & should be underlined." -underline 4} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.8 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The * should be underlined." -underline 4} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.9 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "foo" -accel "bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.10 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "This string has one & in it" -accel "bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.11 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The & should be underlined." -underline 4 -accel "bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.12 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The * should be underlined." -underline 4 -accel "bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.13 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "foo" -accel "&bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.14 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "This string has one & in it" -accel "&bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.15 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The & should be underlined." -underline 4 -accel "&bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-6.16 {GetEntryText} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command -label "The * should be underlined." -underline 4 -accel "&bar"} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-7.1 {ReconfigureWindowsMenu - system menu item removal} -constraints { win } -setup { destroy .m1 } -body { menu .m1 |
︙ | ︙ | |||
423 424 425 426 427 428 429 | test winMenu-9.1 {TkpMenuNewEntry} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command} msg] $msg [destroy .m1] | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | test winMenu-9.1 {TkpMenuNewEntry} -constraints win -setup { destroy .m1 } -body { menu .m1 list [catch {.m1 add command} msg] $msg [destroy .m1] } -result {0 e001 {}} test winMenu-10.1 {TkwinMenuProc} -constraints { win userInteraction } -setup { destroy .m1 } -body { |
︙ | ︙ | |||
558 559 560 561 562 563 564 | menu .m1 -tearoff 0 .m1 add command -label foo update idletasks list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1] } -result {0 {} {} {}} | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | menu .m1 -tearoff 0 .m1 add command -label foo update idletasks list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1] } -result {0 {} {} {}} test winMenu-13.1 {Tk_SetMainMenubar - nothing to do} -constraints { emptyTest win } -body {} test winMenu-14.1 {GetMenuIndicatorGeometry} -constraints win -setup { destroy .m1 } -body { |
︙ | ︙ | |||
855 856 857 858 859 860 861 | win } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label Hello list [catch {.m1 add command -label Two} msg] $msg [destroy .m1] | | | | 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 | win } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label Hello list [catch {.m1 add command -label Two} msg] $msg [destroy .m1] } -result {0 e002 {}} test winMenu-28.2 {TkpConfigureMenuEntry - update not pending} -constraints { win } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label One update idletasks list [catch {.m1 add command -label Two} msg] $msg [destroy .m1] } -result {0 e002 {}} test winMenu-29.1 {TkpDrawMenuEntry - gc for active and not strict motif} -constraints { win } -setup { destroy .m1 } -body { |
︙ | ︙ |
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 |
︙ | ︙ | |||
395 396 397 398 399 400 401 | rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}] } -cleanup { deleteWindows } -result {rootx 1 rooty 1} # Windows does not destroy the container when an embedded window is # destroyed. Unix and macOS do destroy it. See ticket [67384bce7d]. | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}] } -cleanup { deleteWindows } -result {rootx 1 rooty 1} # Windows does not destroy the container when an embedded window is # destroyed. Unix and macOS do destroy it. See ticket [67384bce7d]. if {[tk windowingsystem] eq "win32"} { set result_13_2 {embedded 0 container 1} } else { set result_13_2 {embedded 0 container 0} } test winfo-13.2 {destroying embedded toplevel} -setup { deleteWindows } -body { |
︙ | ︙ |
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 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 | # 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. # proc raiseDelay {} { after 250; update idletasks update } # How to carry out a small delay while processing events proc eventDelay {{delay 200}} { after $delay "set done 1" ; vwait done } deleteWindows ############################################################################## stdWindow 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, 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 214 215 216 217 218 219 | ### 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} if {[tk windowingsystem] eq "aqua"} { set result_1_2_5 {bad attribute "_": must be -alpha, -appearance, -buttons, -fullscreen, -isdark, -modified, -notify, -titlepath, -topmost, -transparent, -stylemask, -class, -tabbingid, -tabbingmode, or -type} } else {set result_1_2_5 {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type}} test wm-attributes-1.2.5 {usage} -constraints aqua -returnCodes error -body { wm attributes . _ } -result $result_1_2_5 ### wm client ### test wm-client-1.1 {usage} -returnCodes error -body { wm client } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-client-1.2 {usage} -returnCodes error -body { wm client . _ _ |
︙ | ︙ | |||
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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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} | | | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | 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 | > | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | } -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 |
︙ | ︙ | |||
968 969 970 971 972 973 974 | wm maxsize . a } -result {wrong # args: should be "wm maxsize window ?width height?"} test wm-maxsize-1.3 {usage} -returnCodes error -body { wm maxsize . a b c } -result {wrong # args: should be "wm maxsize window ?width height?"} test wm-maxsize-1.4 {usage} -returnCodes error -body { wm maxsize . x 100 | | | | 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | wm maxsize . a } -result {wrong # args: should be "wm maxsize window ?width height?"} test wm-maxsize-1.3 {usage} -returnCodes error -body { wm maxsize . a b c } -result {wrong # args: should be "wm maxsize window ?width height?"} test wm-maxsize-1.4 {usage} -returnCodes error -body { wm maxsize . x 100 } -result {expected screen distance but got "x"} test wm-maxsize-1.5 {usage} -returnCodes error -body { wm maxsize . 100 bogus } -result {expected screen distance but got "bogus"} test wm-maxsize-1.6 {usage} -setup { destroy .t2 } -body { toplevel .t2 wm maxsize .t2 300 200 wm maxsize .t2 } -cleanup { |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | wm minsize . a } -result {wrong # args: should be "wm minsize window ?width height?"} test wm-minsize-1.3 {usage} -returnCodes error -body { wm minsize . a b c } -result {wrong # args: should be "wm minsize window ?width height?"} test wm-minsize-1.4 {usage} -returnCodes error -body { wm minsize . x 100 | | | | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | wm minsize . a } -result {wrong # args: should be "wm minsize window ?width height?"} test wm-minsize-1.3 {usage} -returnCodes error -body { wm minsize . a b c } -result {wrong # args: should be "wm minsize window ?width height?"} test wm-minsize-1.4 {usage} -returnCodes error -body { wm minsize . x 100 } -result {expected screen distance but got "x"} test wm-minsize-1.5 {usage} -returnCodes error -body { wm minsize . 100 bogus } -result {expected screen distance but got "bogus"} test wm-minsize-1.6 {usage} -setup { destroy .t2 } -body { toplevel .t2 wm minsize .t2 300 200 wm minsize .t2 } -cleanup { |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | } -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 . raiseDelay wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-2.3 {stacking order} -body { | > | > | > | 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 | } -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 . raiseDelay wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-2.3 {stacking order} -body { toplevel .t tkwait visibility .t toplevel .t2 tkwait visibility .t2 raise . raiseDelay raise .t2 raiseDelay wm stackorder . } -cleanup { destroy .t .t2 |
︙ | ︙ | |||
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 | > | > > | 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 | 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 |
︙ | ︙ | |||
1455 1456 1457 1458 1459 1460 1461 | toplevel .t1.t2 ; update wm withdraw .t1 wm stackorder .t1 } -cleanup { destroy .t1 } -result {.t1.t2} test wm-stackorder-3.6 {unmapped toplevel} -body { | | > | > | > > | 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 | toplevel .t1.t2 ; update wm withdraw .t1 wm stackorder .t1 } -cleanup { destroy .t1 } -result {.t1.t2} test wm-stackorder-3.6 {unmapped toplevel} -body { toplevel .t1 tkwait visibility .t1 toplevel .t1.t2 tkwait visibility .t1.t2 toplevel .t1.t2.t3 tkwait visibility .t1.t2.t3 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 |
︙ | ︙ | |||
1494 1495 1496 1497 1498 1499 1500 | toplevel .t ; update raise .t wm stackorder . isbelow .t } -cleanup { destroy .t } -result 1 test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body { | | > | | 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | toplevel .t ; update raise .t wm stackorder . isbelow .t } -cleanup { destroy .t } -result 1 test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body { toplevel .t tkwait visibility .t raise . raiseDelay wm stackorder .t isabove . } -cleanup { destroy .t } -result 0 test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body { toplevel .t ; update raise . raiseDelay |
︙ | ︙ | |||
1526 1527 1528 1529 1530 1531 1532 | wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu failsOnXQuarz} -body { toplevel .t | < > < > | < > | > | | 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 | wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu failsOnXQuarz} -body { toplevel .t wm overrideredirect .t 1 tkwait visibility .t raise . update raiseDelay wm stackorder . isabove .t } -cleanup { destroy .t } -result 0 test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body { toplevel .t wm overrideredirect .t 1 tkwait visibility .t raise . update raiseDelay wm stackorder . isabove .t } -cleanup { destroy .t } -result 1 test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t wm overrideredirect .t 1 tkwait visibility .t lower .t update 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 | | | | 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 | 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] | | | 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 | # 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} | | | | 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 | 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} |
︙ | ︙ | |||
2311 2312 2313 2314 2315 2316 2317 | } -cleanup { deleteWindows } -result {} test wm-forget-2 {bug [e9112ef96e] - [wm forget] doesn't completely} -setup { catch {destroy .l .f.b .f} set res {} | < < < < < | | | | 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 | } -cleanup { deleteWindows } -result {} test wm-forget-2 {bug [e9112ef96e] - [wm forget] doesn't completely} -setup { catch {destroy .l .f.b .f} set res {} } -body { label .l -text "Top Dot" frame .f button .f.b -text Hello -command "puts Hello!" pack .l -side top pack .f.b pack .f -side bottom set res [winfo manager .f] pack forget .f update lappend res [winfo manager .f] wm manage .f update lappend res [winfo manager .f] wm forget .f update lappend res [winfo manager .f] } -cleanup { destroy .l .f.b .f unset res } -result {pack {} wm {}} # FIXME: |
︙ | ︙ |
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: -ltcl9.0) 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 |
︙ | ︙ | |||
215 216 217 218 219 220 221 | TKTEST_EXE = tktest${EXE_SUFFIX} # 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 # with the distribution, which is slower but guaranteed to work. | | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | TKTEST_EXE = tktest${EXE_SUFFIX} # 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 # with the distribution, which is slower but guaranteed to work. INSTALL_STRIP_PROGRAM = strip INSTALL_STRIP_LIBRARY = strip -x INSTALL = $(SHELL) $(UNIX_DIR)/install-sh -c INSTALL_PROGRAM = ${INSTALL} INSTALL_LIBRARY = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_DATA_DIR = ${INSTALL} -d -m 755 |
︙ | ︙ | |||
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 346 347 348 349 350 351 352 353 354 355 356 357 358 | 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=4 @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} \ -I${TCL_PLATFORM_DIR} ${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} \ ${MEM_DEBUG_FLAGS} ${KEYSYM_FLAGS} @EXTRA_CC_SWITCHES@ WISH_OBJS = tkAppInit.o TKTEST_OBJS = tkTestInit.o tkTest.o tkSquare.o \ $(@TK_WINDOWINGSYSTEM@_TKTEST_OBJS) WIDG_OBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \ tkMenu.o tkMenubutton.o tkMenuDraw.o tkMessage.o \ tkPanedWindow.o tkScale.o tkScrollbar.o CANV_OBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvImg.o \ |
︙ | ︙ | |||
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@ |
︙ | ︙ | |||
457 458 459 460 461 462 463 | $(GENERIC_DIR)/tkImgSVGnano.c $(GENERIC_DIR)/tkImgSVGnano.c \ $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \ $(GENERIC_DIR)/tkImgListFormat.c $(GENERIC_DIR)/tkText.c \ $(GENERIC_DIR)/tkTextBTree.c $(GENERIC_DIR)/tkTextDisp.c \ $(GENERIC_DIR)/tkTextImage.c \ $(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \ $(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \ | | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | $(GENERIC_DIR)/tkImgSVGnano.c $(GENERIC_DIR)/tkImgSVGnano.c \ $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \ $(GENERIC_DIR)/tkImgListFormat.c $(GENERIC_DIR)/tkText.c \ $(GENERIC_DIR)/tkTextBTree.c $(GENERIC_DIR)/tkTextDisp.c \ $(GENERIC_DIR)/tkTextImage.c \ $(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \ $(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \ $(GENERIC_DIR)/tkOldConfig.c \ $(GENERIC_DIR)/tkSquare.c $(GENERIC_DIR)/tkTest.c \ $(GENERIC_DIR)/tkStubInit.c TTK_SRCS = \ $(TTK_DIR)/ttkBlink.c \ $(TTK_DIR)/ttkButton.c \ $(TTK_DIR)/ttkCache.c \ |
︙ | ︙ | |||
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 657 658 659 660 661 | 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}" = "xlibtcl9tk${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \ (cd ${TOP_DIR}/win; ${MAKE} tcl9tk${MAJOR_VERSION}${MINOR_VERSION}.dll); \ cp "${TOP_DIR}/win/tcl9tk${MAJOR_VERSION}${MINOR_VERSION}.dll" .; \ fi rm -f $@ @MAKE_STUB_LIB@ # Build Aqua resource files ${TK_RSRC_FILE}: $(AQUA_RESOURCES) rm -f $@ |
︙ | ︙ | |||
615 616 617 618 619 620 621 | @echo ${OBJS} # This targets actually build the objects needed for the lib in the above # case objs: ${OBJS} ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ | | > > > > > > > > > | | | | 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 | @echo ${OBJS} # This targets actually build the objects needed for the lib in the above # case objs: ${OBJS} ${WISH_EXE}: $(TK_STUB_LIB_FILE) $(WISH_OBJS) $(TK_LIB_FILE) @APP_RSRC_FILE@ ${CC} ${CFLAGS} $(WISH_OBJS) @TK_BUILD_LIB_SPEC@ ${LDFLAGS} \ $(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. $(TKTEST_EXE): $(TKTEST_OBJS) $(TK_LIB_FILE) $(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)" tktest-real: ${TK_STUB_LIB_FILE} ${CC} ${CFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ ${LDFLAGS} $(WISH_LIBS) \ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE) # # FIXME: This xttest rule seems to be broken in a number of ways. It should # # use CC_SEARCH_FLAGS, it does not include the shared lib location logic from # # tktest, and it is not clear where this test.o object file comes from. # # xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) ${TK_STUB_LIB_FILE} # ${CC} ${CFLAGS} test.o tkTest.o tkSquare.o \ # @TK_BUILD_LIB_SPEC@ ${LDFLAGS} ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} \ # $(WISH_LIBS) $(LD_SEARCH_FLAGS) -lXt -o xttest # Note, in the target below TCL_LIBRARY needs to be set or else # "make test" won't work in the case where the compilation directory # isn't the same as the source directory. # Specifying TESTFLAGS on the command line is the standard way to pass # args to tcltest, ie: |
︙ | ︙ | |||
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 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 | 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) install: $(INSTALL_TARGETS) install-strip: $(MAKE) $(INSTALL_TARGETS) \ INSTALL_PROGRAM="STRIPPROG='${INSTALL_STRIP_PROGRAM}' $(INSTALL_PROGRAM) -s" \ INSTALL_LIBRARY="STRIPPROG='${INSTALL_STRIP_LIBRARY}' $(INSTALL_LIBRARY) -s" install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE} @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \ "$(PKG_INSTALL_DIR)" "$(CONFIG_INSTALL_DIR)" ; \ do \ if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ $(INSTALL_DATA_DIR) "$$i"; \ 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.7-]} 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";\ 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 | Makefile: $(UNIX_DIR)/Makefile.in $(SHELL) config.status #tkConfig.h: $(UNIX_DIR)/tkConfig.h.in # $(SHELL) config.status clean: | > | | > | | 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | 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* libtcl9tk* 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 tkUuid.h depend: makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) # Test binaries. The rule for tkTestInit.o is complicated because # it is is compiled from tkAppInit.c. Can't use the "-o" option # because this doesn't work on some strange compilers (e.g. UnixWare). |
︙ | ︙ | |||
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 | > | | | 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 | -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 | > > > | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | 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 |
︙ | ︙ | |||
1152 1153 1154 1155 1156 1157 1158 | tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c | < < < | | 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.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 | | | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 | 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 | > > > > > > | 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 | 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 | > > > | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | 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 | > > > | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 | 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 | > > > | 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | 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 | | | 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | 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. # | > > > > > | 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | $(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. # |
︙ | ︙ | |||
1565 1566 1567 1568 1569 1570 1571 | # to put the distribution. DISTDIR must be an absolute path name. # DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) | | | | | | | 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 | # to put the distribution. DISTDIR must be an absolute path name. # DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) DIST_INSTALL_DATA = $(INSTALL) -p -m 644 DIST_INSTALL_SCRIPT = $(INSTALL) -p -m 755 $(UNIX_DIR)/configure: $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tcl.m4 \ $(UNIX_DIR)/aclocal.m4 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 \ |
︙ | ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | $$i > $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.decls $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/README $(DISTDIR)/generic | | < | < > > > < < < < < | < < < < | | 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 | $$i > $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.decls $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/README $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(TOP_DIR)/changes.md $(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} $(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/stdbool.h $(DISTDIR)/compat $(INSTALL_DATA_DIR) $(DISTDIR)/xlib $(DIST_INSTALL_DATA) $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib $(INSTALL_DATA_DIR) $(DISTDIR)/xlib/X11 $(DIST_INSTALL_DATA) $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11 $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib/X11 |
︙ | ︙ | |||
1695 1696 1697 1698 1699 1700 1701 | $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ $(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 | | > > | 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 | $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ $(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/*.{svg,test,tcl} $(DISTDIR)/tests/ttk 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/README.
︙ | ︙ | |||
47 48 49 50 51 52 53 | --with-tcl=DIR Specifies the directory containing the Tcl binaries and Tcl's platform-dependent configuration information. By default the Tcl directory is assumed to be in the location given by (a) above. --with-x=DIR Tells configure where to find an installation of the X Window System. Not normally needed. | < < | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | --with-tcl=DIR Specifies the directory containing the Tcl binaries and Tcl's platform-dependent configuration information. By default the Tcl directory is assumed to be in the location given by (a) above. --with-x=DIR Tells configure where to find an installation of the X Window System. Not normally needed. --enable-shared If this switch is specified, Tk will compile itself as a shared library if it can figure out how to do that on this platform. This is the default on platforms where we know how to build shared libraries. --disable-shared If this switch is specified, Tk will compile itself as a static library. |
︙ | ︙ |
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 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 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.72 for tk 9.0. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 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 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 case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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 # 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 # 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="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 case e in #( e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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 case e in #( e) exitcode=1; echo positional parameters were not saved. ;; esac 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 case e in #( e) as_have_required=no ;; esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else case e in #( e) 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 case e in #( e) 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 ;; esac 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 ;; esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # 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 |
︙ | ︙ | |||
318 319 320 321 322 323 324 | 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 #( | | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | 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. | | > | | | > | > | | | > | | | 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 | } # 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 case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac 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 case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith # 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 || | | | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | 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 |
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || | > > | > > > > > > > > > > | | | | 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 | test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' t clear :clear s/[$]LINENO.*/&-/ t lineno b :lineno 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi |
︙ | ︙ | |||
544 545 546 547 548 549 550 | as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. | | > | > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, |
︙ | ︙ | |||
573 574 575 576 577 578 579 | subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tk' PACKAGE_TARNAME='tk' | | | | | | | < < < < < < < < < < < < < < > > > > > > > > > > | 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 | subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tk' PACKAGE_TARNAME='tk' PACKAGE_VERSION='9.0' PACKAGE_STRING='tk 9.0' 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 | > > > > > > > > > > > > > > > < < < | 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 | 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 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 | > | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | 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 | > | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | 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}' | > | 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | 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 | < < | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | 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 && | | | | 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | | --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 && | | | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | -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 ;; | > > > > > > > > > | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | 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 && | | | | | | 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 | -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 |
︙ | ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; | | | | | | | | | | 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 | -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: '$ac_option' Try '$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) 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;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. |
︙ | ︙ | |||
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 || | | | 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | 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 |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi | | | 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi |
︙ | ︙ | |||
1327 1328 1329 1330 1331 1332 1333 | # # 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 | | | | | | | | | > | 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 | # # 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 9.0 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. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, 'make install' will install all the files in '$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify an installation prefix other than '$ac_default_prefix' using '--prefix', for instance '--prefix=\$HOME'. For better control, use the options below. 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] |
︙ | ︙ | |||
1392 1393 1394 1395 1396 1397 1398 | --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in | | | 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 | --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of tk 9.0:";; 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] |
︙ | ︙ | |||
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) | > | < | | | | 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 | 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> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { 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; } | | > | | | | | | | | > | | | > | | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > | | | | | | > | | > | | > | | > | | > > > > > > > > > > > > > > > > > > > > | | | | 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 | 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 9.0 generated by GNU Autoconf 2.72 Copyright (C) 2023 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 case e in #( e) 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 case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 (void); 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 (void); /* 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 case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 case e in #( e) 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 case e in #( e) eval "$3=yes" ;; esac 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 ;; esac 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 9.0, which was generated by GNU Autoconf 2.72. 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 | > | > > > | | 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | _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 ;; *\'*) | | | 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 | 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 | > > | | | | 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 | # 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 | | | | | | | | | | | < | < < | < < | < < | < < | < < | < < < < | < < < < | < | < > | | > > > > > | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | > | | | | | | > | | | > | | | | | | 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 | 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 (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; } /* C89 style stringification. */ #define noexpand_stringify(a) #a const char *stringified = noexpand_stringify(arbitrary+token=sequence); /* C89 style token pasting. Exercises some of the corner cases that e.g. old MSVC gets wrong, but not very hard. */ #define noexpand_concat(a,b) a##b #define expand_concat(a,b) noexpand_concat(a,b) extern int vA; extern int vbee; #define aye A #define bee B int *pvA = &expand_concat(v,aye); int *pvbee = &noexpand_concat(v,bee); /* 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 // See if C++-style comments work. #include <stdbool.h> extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); extern void free (void *); // 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) { // 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; // Work around memory leak warnings. free (ia); // 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=9.0 TK_MAJOR_VERSION=9 TK_MINOR_VERSION=0 TK_PATCH_LEVEL="b2" 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 case e in #( e) # 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 |
︙ | ︙ | |||
2372 2373 2374 2375 2376 2377 2378 | if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ | | | | | 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 | if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib/tcl9.0 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tcl9.0 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
2398 2399 2400 2401 2402 2403 2404 | `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi | | > | | | | | | | | | 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 | `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi ;; esac fi 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 |
︙ | ︙ | |||
2474 2475 2476 2477 2478 2479 2480 | if test "${TCL_MAJOR_VERSION}" -lt 9 ; then | < < < < | | | | | > | | | | > | | | | | | | | | 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 | if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MINOR_VERSION}" -lt 7 ; then as_fn_error $? "${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.7+ 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 case e in #( e) 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 ;; esac 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? #------------------------------------------------------------------------ | | | | > | | > | | | | | > | | > | | | | | | | | | > | | > | | > > > > > > > > > | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | > | | | | | | > | > | | | | | | | | | > | | | | | | | | | > | | | | | | | | > | | | > > | | | | | | | | | | | | | | > | | | > | | | | | | | > | | | | | > | > | | | | | > | | | | | > | | > | | > | | > > | | | | > | | | | | > | | | | > | | | | > | > | > | | > | | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | > | | | | | < < < | | | < > | > > > > | | > > | | > > | | | > | | | | | | > | | > | | | 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 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 4002 4003 4004 4005 4006 4007 4008 | 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 case e in #( e) enableval="no" ;; esac 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 case e in #( e) enableval="no" ;; esac 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 case e in #( e) enableval="no" ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) ac_file='' ;; esac 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 case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; esac 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 case e in #( e) { { 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; } ;; esac 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"); if (!f) return 1; 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.o conftest.obj 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 case e in #( e) 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 case e in #( e) 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; } ;; esac fi rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu ;; esac 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 case e in #( e) 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 case e in #( e) 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 case e in #( e) 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 ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 ;; esac 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 case e in #( e) 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 ;; esac 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 | | | | > | | | | | > | | > | | > | | | > < | < | | | | > | | < | < < < < < < | | | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < | < < | | < < | | < < < < < < < < < < < < < < < < < | < < < < < < | < < | < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < | | | > | | > | | | | | > | | > | | | > | | | > | | | | | > | | > | | > | | | > | | | | | > | | > | | | | | > | | | | | | > | | | | | > | | | | > > > | | | > | | > | | > | | | > | | > | 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 | #------------------------------------------------------------------------ # 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_pipe=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 case e in #( e) tcl_ok=yes ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) do64bit=no ;; esac 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 case e in #( e) do64bitVIS=no ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_visibility_hidden=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 case e in #( e) doRpath=yes ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char dlopen (void); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else case e in #( e) ac_cv_lib_dl_dlopen=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) have_dl=no ;; esac 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 | | > | | | | > | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | > | > | | | > | > | | | | | > | > | > | | | > | | | > | | | > | > | | | > | | | | > > > | | | > | | > | | > | | | > | 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 | # 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 case e in #( e) CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" ;; esac 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 case e in #( e) CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' ;; esac fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else case e in #( e) if test "$GCC" = yes then : SHLIB_LD='${CC} -shared -Wl,-bexpall' else case e in #( e) SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry" LDFLAGS="$LDFLAGS -brtl" ;; esac fi SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; esac fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (void); 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 case e in #( e) ac_cv_lib_bind_inet_ntoa=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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="" ;; | | < < < | | | > | | | | | > | | > | | > | | | | | 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 | 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="" { 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 case e in #( e) 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 case e in #( e) ac_cv_cygwin=yes ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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" | | | | > | | | | > > > | | | > | | > | | > | | | > | | | > | | | > | | | > | | | | > > > | | | > | | > | | > | | | > | | > | > | > | | | > | > | > | > | | | | | > | | | > | | | | > > > | | | > | | > | | > | | | > | | > | > | 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 | 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (void); 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 case e in #( e) ac_cv_lib_network_inet_ntoa=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) SHLIB_SUFFIX=".sl" ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char shl_load (void); 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 case e in #( e) ac_cv_lib_dld_shl_load=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) tcl_ok=no ;; esac 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 case e in #( e) CFLAGS="$CFLAGS -z" ;; esac 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 case e in #( e) do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char shl_load (void); 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 case e in #( e) ac_cv_lib_dld_shl_load=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) tcl_ok=no ;; esac 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 | | > | > | > | | | > | > | > | > | | | | | > | > > > > > > > > > > | > | > | > | | | > | | | | | > | | > | | > | | | > | > | > | > | 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 | 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 case e in #( e) case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" ;; esac fi ;; IRIX64-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 # 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 case e in #( e) do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" ;; esac 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-*) # 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 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_m64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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" | | > < < < < < < < < < < < < < < < < < < < < < < < < < < | | > | | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | | | > | | > | | | > | | | | | > | | | | | | > | | | > | | > | | | > | | | | | | | > | > | | | > | | | | | > | | > | | > | | | > | | | > | | | | | > | | > | | > | | | > | > | | | | | | > | | > | | | > | | | > | | | | > | | > | | > | | > | > | | | > | | | > | > | | | > | | | | | > | | > | | > | | | > | | | > | | | | | > | > | > | | | > | > | | | > | > | | | > | | | > | | | > | | | > | > | > | > | | | | | > | | | > | | | > | > | | > | > | | | | | > | | | > | > | > | | | | | > | | | | > < | | | | | > | > | > | > | > | | > | > | | | > | | > | > | | | > | | | | | > | | > | | > | | | > | > | | | > | | > | | > | > | > | | | | | > | > | | | | > | | > | > | > | > | | | | > | | | > | | | > | > | > | | | > | > | | | | | | > | | | | | | | > | | > | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > | > > > > > > > > > | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 5927 5928 5929 5930 5931 5932 5933 5934 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 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 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 | # 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_arch_ppc64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_arch_x86_64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch arm64 flag" >&5 printf %s "checking if compiler accepts -arch arm64 flag... " >&6; } if test ${tcl_cv_cc_arch_arm64+y} then : printf %s "(cached) " >&6 else case e in #( e) hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch arm64" 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_arm64=yes else case e in #( e) tcl_cv_cc_arch_arm64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_arm64" >&5 printf "%s\n" "$tcl_cv_cc_arch_arm64" >&6; } if test $tcl_cv_cc_arch_arm64 = yes then : CFLAGS="$CFLAGS -arch arm64" 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 case e in #( e) # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) ' then : fat_32_64=yes fi ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_ld_single_module=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_ld_search_paths_first=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags ;; esac 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_FALLBACK_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 case e in #( e) tcl_corefoundation=yes ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_lib_corefoundation=no ;; esac 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 ;; esac 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 case e in #( e) tcl_corefoundation=no ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_lib_corefoundation_64=no ;; esac 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 ;; esac 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 case e in #( e) SHLIB_LD='${CC} -non_shared' ;; esac 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 case e in #( e) CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" ;; esac 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 case e in #( e) CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; esac fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" 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 case e in #( e) SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" ;; esac 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 case e in #( e) SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; esac 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 case e in #( e) do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" ;; esac fi else case e in #( e) do64bit_ok=yes if test "$do64bitVIS" = yes then : CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else case e in #( e) CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" ;; esac fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" ;; esac fi else case e in #( e) 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 case e in #( e) 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 ;; esac fi else case e in #( e) { 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;} ;; esac fi ;; esac 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 case e in #( e) 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 case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } use_sunmath=no ;; esac fi ;; esac 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 case e in #( e) if test "$arch" = "amd64 i386" then : SHLIB_LD="$SHLIB_LD -m64 -static-libgcc" fi ;; esac fi fi else case e in #( e) if test "$use_sunmath" = yes then : textmode=textoff else case e in #( e) textmode=text ;; esac 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";; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' ;; esac fi ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" 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 case e in #( e) 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 case e in #( e) tcl_cv_ld_Bexport=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags ;; esac 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 case e in #( e) tcl_ok=yes ;; esac fi if test "$tcl_ok" = no then : DL_OBJS="" fi if test "x$DL_OBJS" != x then : BUILD_DLTEST="\$(DLTEST_TARGETS)" else case e in #( e) { 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="" ;; esac 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)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" else case e in #( e) INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' ;; esac fi else case e in #( e) LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} if test "$RANLIB" = "" then : MAKE_LIB='$(STLIB_LD) $@ ${OBJS}' else case e in #( e) MAKE_LIB='${STLIB_LD} $@ ${OBJS} ; ${RANLIB} $@' ;; esac fi INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' ;; esac fi # Stub lib does not depend on shared/static configuration if test "$RANLIB" = "" then : MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}' else case e in #( e) MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS} ; ${RANLIB} $@' ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cast_to_union=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) ac_cv_nolto=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_input_charset=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 # Check for vfork, posix_spawnp() and friends unconditionally ac_fn_c_check_func "$LINENO" "vfork" "ac_cv_func_vfork" if test "x$ac_cv_func_vfork" = xyes then : printf "%s\n" "#define HAVE_VFORK 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "posix_spawnp" "ac_cv_func_posix_spawnp" if test "x$ac_cv_func_posix_spawnp" = xyes then : printf "%s\n" "#define HAVE_POSIX_SPAWNP 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "posix_spawn_file_actions_adddup2" "ac_cv_func_posix_spawn_file_actions_adddup2" if test "x$ac_cv_func_posix_spawn_file_actions_adddup2" = xyes then : printf "%s\n" "#define HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "posix_spawnattr_setflags" "ac_cv_func_posix_spawnattr_setflags" if test "x$ac_cv_func_posix_spawnattr_setflags" = xyes then : printf "%s\n" "#define HAVE_POSIX_SPAWNATTR_SETFLAGS 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 |
| | | < | | | > | | > | | | | | | | | | | | | | | > | | | | | > | | | | > | | > | > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | > | | | | > | | > | > | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | > | | | < < < < < < < < < < < < < < < < < < | | | > | | > | | | < < < < < | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | | | | | > | | > | > | | | | | | > | | | | | > | | > | > | | | | < < < < | < < < < | < < | | < < < < < < < > > > > < < < < < < < | < < < < < < < < < < < < | | | > | | | | | > | | > | > | | | | | | | | > | | | | > | 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 6749 6750 6751 6752 6753 6754 6755 6756 6757 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 | 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 case e in #( e) tcl_ok=no ;; esac 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 case e in #( e) 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 case e in #( e) 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 case e in #( e) tcl_cv_flag__isoc99_source=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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__file_offset_bits+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/stat.h> int main (void) { switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__file_offset_bits=no else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include <sys/stat.h> int main (void) { switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_flag__file_offset_bits=yes else case e in #( e) tcl_cv_flag__file_offset_bits=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi if test "x${tcl_cv_flag__file_offset_bits}" = "xyes" ; then printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h tcl_flags="$tcl_flags _FILE_OFFSET_BITS" fi if test ${tcl_cv_flag__largefile64_source+y} then : printf %s "(cached) " >&6 else case e in #( e) 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 case e in #( e) 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 case e in #( e) tcl_cv_flag__largefile64_source=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 "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 if 'long' and 'long long' have the same size (64-bit)?" >&5 printf %s "checking if 'long' and 'long long' have the same size (64-bit)?... " >&6; } if test ${tcl_cv_type_64bit+y} then : printf %s "(cached) " >&6 else case e in #( e) 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 ;; esac 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } # Now check for auxiliary declarations { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit time_t" >&5 printf %s "checking for 64-bit time_t... " >&6; } if test ${tcl_cv_time_t_64+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> int main (void) { switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;} ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv_time_t_64=yes else case e in #( e) tcl_cv_time_t_64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_time_t_64" >&5 printf "%s\n" "$tcl_cv_time_t_64" >&6; } if test "x${tcl_cv_time_t_64}" = "xno" ; then # Note that _TIME_BITS=64 requires _FILE_OFFSET_BITS=64 # which SC_TCL_EARLY_FLAGS has defined if necessary. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if _TIME_BITS=64 enables 64-bit time_t" >&5 printf %s "checking if _TIME_BITS=64 enables 64-bit time_t... " >&6; } if test ${tcl_cv__time_bits+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _TIME_BITS 64 #include <sys/types.h> int main (void) { switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;} ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : tcl_cv__time_bits=yes else case e in #( e) tcl_cv__time_bits=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv__time_bits" >&5 printf "%s\n" "$tcl_cv__time_bits" >&6; } if test "x${tcl_cv__time_bits}" = "xyes" ; then printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h fi fi { 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 case e in #( e) 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 case e in #( e) tcl_cv_struct_dirent64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_DIR64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 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 case e in #( e) 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 case e in #( e) tcl_cv_type_off64_t=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 | | | | | | > | | > | | > | | | | > | | > | | > | | | > | | | | < < | | | > > > | < > | | | > | | | > | | | | > | | > | > | > | | | | < < | | | | | | | > | | | | | > | | > | > | | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > | | > | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > | | < | < | > > | > | > | > > > > > | > > > | > > > > > > > > > > > > > > > > > | | < < < < < < < < < < < | < < < | < < < < < < < < | < < < < | < | < < < | < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | | | < < < < < < < | < | < < | < < | < < < | < < < < < < < < < < < < < < | | | < < < | | | > | | | | | > | | > | > | | | | | | > | | > | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < | | | < < < < < < < < < < < | | | > | | | | | > | | > | | > | | < < | | < > | < < < | | | > | | | | | > | | > | | > | | | | | | > | | | | | > | | > | | > | | | | | > > > > > > | | | | | > | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 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 | 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 case e in #( e) ac_cv_c_bigendian=no ;; esac 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 case e in #( e) ac_cv_c_bigendian=no ;; esac 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]; } int main (int argc, char **argv) { /* Intimidate the compiler so that it does not optimize the arrays away. */ char *p = argv[0]; ascii_mm[1] = *p++; ebcdic_mm[1] = *p++; ascii_ii[1] = *p++; ebcdic_ii[1] = *p++; return use_ascii (argc) == use_ebcdic (*p); } _ACEOF if ac_fn_c_try_link "$LINENO" then : if grep BIGenDianSyS conftest$ac_exeext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest$ac_exeext >/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_exeext conftest.$ac_ext else case e in #( e) 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 case e in #( e) ac_cv_c_bigendian=yes ;; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi fi ;; esac 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) # ;; #( *) 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 case e in #( e) 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 case e in #( e) tcl_cv_type_fd_set=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) # 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 case e in #( e) # Broken: fails on valid input. continue ;; esac 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 case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac 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 ;; esac 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 case e in #( e) # Broken: fails on valid input. continue ;; esac 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 case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac 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 case e in #( e) { { 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; } ;; esac 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 egrep -e" >&5 printf %s "checking for egrep -e... " >&6; } if test ${ac_cv_path_EGREP_TRADITIONAL+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_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_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "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_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then : fi else ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL fi if test "$ac_cv_path_EGREP_TRADITIONAL" then : ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_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_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "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_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; 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_TRADITIONAL=$EGREP_TRADITIONAL fi ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; } EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL { 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 case e in #( e) 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_TRADITIONAL "fd_mask" >/dev/null 2>&1 then : tcl_cv_grep_fd_mask=present else case e in #( e) tcl_cv_grep_fd_mask=missing ;; esac fi rm -rf conftest* ;; esac 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 case e in #( e) printf "%s\n" "#define mode_t int" >>confdefs.h ;; esac 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 case e in #( e) 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 case e in #( e) ac_pid_type='__int64' ;; esac 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 ;; esac 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 case e in #( e) printf "%s\n" "#define size_t unsigned int" >>confdefs.h ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_pwd_pw_gecos=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) tk_aqua=no ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_ld_weak_l=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_weak_import=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_darwin_c_source=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 -framework CoreGraphics" 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 -weak_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 case e in #( e) # 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 | | | 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 | *) 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 | > > | 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 | /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 | | > | | | > | | > | | | | > | > > | | | | > | | | | | > | | > | | | > | | > | | | | | | | | | | | > | | | | > > > | | | > | | > | | > | | | > | | | 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 | 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 ;; 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 case e in #( e) not_really_there="yes" ;; esac 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 case e in #( e) found_xincludes="no" ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char XCreateWindow (void); int main (void) { return XCreateWindow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xwindow_XCreateWindow=yes else case e in #( e) ac_cv_lib_Xwindow_XCreateWindow=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 | | | | > | | | | | > | | > | | > | | | > | | | | > | | | | | > | | | | > | | > | | | | | > | | | > < | | | > | | | | > > > | | | > | | > | | > | | | < > | < | | | > | | | > | | | | > > > | | | > | | > | | > | | | > | | | | 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 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 8469 8470 8471 8472 8473 8474 8475 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 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 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 | # 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 case e in #( e) 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 case e in #( e) ac_cv_lib_Xbsd_main=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac 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 case e in #( e) enable_xft="default" ;; esac 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 case e in #( e) found_xft=no ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char XftFontOpen (void); int main (void) { return XftFontOpen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xft_XftFontOpen=yes else case e in #( e) ac_cv_lib_Xft_XftFontOpen=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) found_xft=no ;; esac 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char FcFontSort (void); int main (void) { return FcFontSort (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_fontconfig_FcFontSort=yes else case e in #( e) ac_cv_lib_fontconfig_FcFontSort=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 | | | | > | | > | | | | | > < | > | | | | | > | | | | > > > | | | > | | > | | > | | | > | | | | | > | | | | > > > | | | > | | > | | > | | | > | > | > | | | | > | | | | | > | | > | > | | | | > > > > > > | 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 | 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 case e in #( e) enable_xss=yes ;; esac 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 case e in #( e) { 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char XScreenSaverQueryInfo (void); int main (void) { return XScreenSaverQueryInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xext_XScreenSaverQueryInfo=yes else case e in #( e) ac_cv_lib_Xext_XScreenSaverQueryInfo=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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 case e in #( e) { 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 case e in #( e) 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. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char XScreenSaverQueryInfo (void); int main (void) { return XScreenSaverQueryInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_Xss_XScreenSaverQueryInfo=yes else case e in #( e) ac_cv_lib_Xss_XScreenSaverQueryInfo=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac 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" fi xss_lib_found=yes fi ;; esac fi ;; esac 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 case e in #( e) 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 case e in #( e) ac_cv_c_char_unsigned=yes ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 | | | | > | | > | | | | | | | | | | > > | > | | > | > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | < | < | > | 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 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 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 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 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 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 9158 9159 9160 9161 9162 9163 9164 9165 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 | # 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 case e in #( e) enable_framework=no ;; esac 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 case e in #( e) tcl_ok=yes ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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} TK_STUB_LIB_FILE="libtkstub.a" TK_STUB_LIB_FLAG="-ltkstub" eval "TK_STUB_LIB_DIR=\"${libdir}\"" TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" # 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 '()' '{}'`\"" |
︙ | ︙ | |||
8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 | ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # | > > | | | | | | | | | | | | 9304 9305 9306 9307 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 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 | ac_config_files="$ac_config_files Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # 'ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # 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 done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; 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}' |
︙ | ︙ | |||
8357 8358 8359 8360 8361 8362 8363 | :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote | | < < | < | | | 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 | :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` 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 | | > | | > > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | | < < < < < < < < < < < < < < < < < < < < | | | 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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 case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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. |
︙ | ︙ | |||
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. | > | > | | | > | > | | | > | 9623 9624 9625 9626 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 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 | # --------------- # 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 case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac 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 case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else |
︙ | ︙ | |||
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 || | | | 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 | 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 8690 8691 8692 8693 8694 | # 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: | > > > > > > > > > > | | | | 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 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 | # 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi |
︙ | ︙ | |||
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 #( | | | | 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 | 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 |
︙ | ︙ | |||
8771 8772 8773 8774 8775 8776 8777 | { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. | | > | > | | | 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 | { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF 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 9.0, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
︙ | ︙ | |||
8818 8819 8820 8821 8822 8823 8824 | config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ | | | 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 | config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ '$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit |
︙ | ︙ | |||
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 | > > | | | | | 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 | 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 9.0 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" Copyright (C) 2023 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 ) | | | | | | | | | > | | | | | 9946 9947 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 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 | 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." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" 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: # after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 |
︙ | ︙ | |||
9011 9012 9013 9014 9015 9016 9017 | tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. | | | 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 | tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. |
︙ | ︙ | |||
9177 9178 9179 9180 9181 9182 9183 | for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; | | | 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 | for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS |
︙ | ︙ | |||
9199 9200 9201 9202 9203 9204 9205 | ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, | | | | | | | | | | | 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 | ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain ':'. 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= ;; *) | | | | 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 | 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@*) | | | | | 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 | /@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 s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 |
︙ | ︙ | |||
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"; } && | | | | | | 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 | 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 | | | > | 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 | $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 37 38 39 40 41 42 43 44 45 46 47 48 49 | ! /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],[9.0]) 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=9.0 TK_MAJOR_VERSION=9 TK_MINOR_VERSION=0 TK_PATCH_LEVEL="b2" 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 #-------------------------------------------------------------------- SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MINOR_VERSION}" -lt 7 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.7+ Found config for Tcl ${TCL_VERSION}]) fi fi SC_PROG_TCLSH SC_BUILD_TCLSH |
︙ | ︙ | |||
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" | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # 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 #------------------------------------------------------------------------ |
︙ | ︙ | |||
125 126 127 128 129 130 131 | SC_TCL_64BIT_FLAGS #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- | | | | < | < < | < < < < < < < < < < < < < < | < < < < < < < < < < < < < < | < | < | < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | > > > > > > | | 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 | SC_TCL_64BIT_FLAGS #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- AC_C_BIGENDIAN(,,,[#]) #------------------------------------------------------------------------ # 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 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 -framework CoreGraphics" 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 -weak_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" | | | | | | | 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 | 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, | | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | 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 | > > > > > > | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | #-------------------------------------------------------------------- # 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' | > > | > | | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | 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 | > | > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < | < | < | 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 | 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} TK_STUB_LIB_FILE="libtkstub.a" TK_STUB_LIB_FLAG="-ltkstub" eval "TK_STUB_LIB_DIR=\"${libdir}\"" TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" # Install time header dir can be set via --includedir |
︙ | ︙ | |||
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) | > > | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | 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/install-sh.
1 2 3 | #!/bin/sh # install - install a program, script, or datafile | | | 1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # |
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= | > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= |
︙ | ︙ | |||
99 100 101 102 103 104 105 | In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) | | > < > > > > > > > > > | 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 | In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to [email protected]. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; |
︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 | exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; | > > | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 | > > > > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 |
︙ | ︙ | |||
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || | > > > > > > > | | | 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 | set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. |
︙ | ︙ |
Changes to unix/installManPage.
1 2 3 4 5 6 7 | #!/bin/sh ######################################################################## ### Parse Options ### Gzip=: | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/sh ######################################################################## ### Parse Options ### Gzip=: Sym="" Loc="" Gz="" Suffix="" while true; do case $1 in -s | --symlinks ) Sym="-s " ;; -z | --compress ) Gzip=$2; shift ;; -e | --extension ) Gz=$2; shift ;; -x | --suffix ) Suffix=$2; shift ;; -*) cat <<EOF Unknown option "$1". Supported options: -s Use symbolic links for manpages with multiple names. -z PROG Use PROG to compress manual pages. |
︙ | ︙ | |||
43 44 45 46 47 48 49 | echo "source manual page file must exist" exit 1 fi if test -d "$Dir" ; then : ; else echo "target directory must exist" exit 1 fi | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | echo "source manual page file must exist" exit 1 fi if test -d "$Dir" ; then : ; else echo "target directory must exist" exit 1 fi test -z "$Sym" && Loc="$Dir/" ######################################################################## ### Extract Target Names from Manual Page ### # A sed script to parse the alternative names out of a man page. # |
︙ | ︙ | |||
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 | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 | 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 $Sym"$Loc$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 ) |
︙ | ︙ | |||
89 90 91 92 93 94 95 | if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ | | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib/tcl9.0 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tcl9.0 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl9.0 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
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 ) |
︙ | ︙ | |||
222 223 224 225 226 227 228 | if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ | | | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | if test x"${ac_cv_c_tkconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib/tk9.0 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tk9.0 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk9.0 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
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 | 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="" 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" ]) ]) ;; | | > > > > > > > > > > > | | 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 | 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-*) # 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" ;; | < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | > > > > > > > > > > > > | > | > | | | | | | | | | | | | | 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 | 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) AC_CACHE_CHECK([if compiler accepts -arch arm64 flag], tcl_cv_cc_arch_arm64, [ hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch arm64" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [tcl_cv_cc_arch_arm64=yes],[tcl_cv_cc_arch_arm64=no]) CFLAGS=$hold_cflags]) AS_IF([test $tcl_cv_cc_arch_arm64 = yes], [ CFLAGS="$CFLAGS -arch arm64" 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|arm64) ' \ && 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_FALLBACK_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], [ | | | | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | 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" | | | 1717 1718 1719 1720 1721 1722 1723 1724 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" 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, | | | 1744 1745 1746 1747 1748 1749 1750 1751 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, 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*) ;; | | | | | | 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 | # 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]) ]) AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [ SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}']) AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [ UNSHARED_LIB_SUFFIX='${VERSION}.a']) DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)" AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [ 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}' AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" ], [ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' ]) ], [ LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} |
︙ | ︙ | |||
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) | | | | | | | < | | | | | | | | | | > > > > > > | > > > > > > > > > > > > > > > > > > > | 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 | # 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>?])],) # Check for vfork, posix_spawnp() and friends unconditionally AC_CHECK_FUNCS(vfork posix_spawnp posix_spawn_file_actions_adddup2 posix_spawnattr_setflags) # 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) |
︙ | ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | # # Arguments: # none # # Results: # # Defines some of the following vars: | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 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 | # # Arguments: # none # # Results: # # Defines some of the following vars: # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_SYS_PARAM_H # HAVE_STRING_H ? # #-------------------------------------------------------------------- AC_DEFUN([SC_MISSING_POSIX_HEADERS], [ AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then 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 | | | | 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 | #-------------------------------------------------------------------- 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) | | | | > | | > | > | | | | > | | | | > | | 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 | # 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: |
︙ | ︙ | |||
2302 2303 2304 2305 2306 2307 2308 | # Arguments: # None # # Results: # # Might define the following vars: # _ISOC99_SOURCE | | | > | < | | | | > > < < < < > | < < < | | | < < | < > > > > > > > > > > > > > > > > > | | | | | | | < < < < < < < < | | | | 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 | # Arguments: # None # # Results: # # Might define the following vars: # _ISOC99_SOURCE # _FILE_OFFSET_BITS # _LARGEFILE64_SOURCE # #-------------------------------------------------------------------- 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[ ]m4_default([$4],[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, m4_default([$4],[1]), [Add the ]$1[ flag when building]) tcl_flags="$tcl_flags $1" fi ]) AC_DEFUN([SC_TCL_EARLY_FLAGS],[ AC_MSG_CHECKING([for required early compiler flags]) tcl_flags="" SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>], [char *p = (char *)strtoll; char *q = (char *)strtoull;]) SC_TCL_EARLY_FLAG(_FILE_OFFSET_BITS,[#include <sys/stat.h>], [switch (0) { case 0: case (sizeof(off_t)==sizeof(long long)): ; }],64) SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>], [struct stat64 buf; int i = stat64("/", &buf);]) if test "x${tcl_flags}" = "x" ; then AC_MSG_RESULT([none]) else AC_MSG_RESULT([${tcl_flags}]) fi ]) #-------------------------------------------------------------------- # SC_TCL_64BIT_FLAGS # # Check for what is defined in the way of 64-bit features. # # Arguments: # None # # Results: # # Might define the following vars: # TCL_WIDE_INT_IS_LONG # HAVE_STRUCT_DIRENT64, HAVE_DIR64 # HAVE_TYPE_OFF64_T # _TIME_BITS # #-------------------------------------------------------------------- AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([if 'long' and 'long long' have the same size (64-bit)?]) 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 AC_MSG_RESULT([no]) # Now check for auxiliary declarations AC_CACHE_CHECK([for 64-bit time_t], tcl_cv_time_t_64,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])], [tcl_cv_time_t_64=yes],[tcl_cv_time_t_64=no])]) if test "x${tcl_cv_time_t_64}" = "xno" ; then # Note that _TIME_BITS=64 requires _FILE_OFFSET_BITS=64 # which SC_TCL_EARLY_FLAGS has defined if necessary. AC_CACHE_CHECK([if _TIME_BITS=64 enables 64-bit time_t], tcl_cv__time_bits,[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _TIME_BITS 64 #include <sys/types.h>]], [[switch (0) {case 0: case (sizeof(time_t)==sizeof(long long)): ;}]])], [tcl_cv__time_bits=yes],[tcl_cv__time_bits=no])]) if test "x${tcl_cv__time_bits}" = "xyes" ; then AC_DEFINE(_TIME_BITS, 64, [_TIME_BITS=64 enables 64-bit time_t.]) fi fi 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_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, | | | | | | 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | # 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], | | | | | 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 | # #-------------------------------------------------------------------- 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, [ | | | | | | | | 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 | 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, [ | | | | | | | | | | | 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 | 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, [ | | | | | | | | 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 | # 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, [ | | | | | | | | 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 | # 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, [ | | | | | | | | 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 | # 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, [ | | | | | | | | 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 | # 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: | > | > > > > > > > > > > > > > > > > > > > > > | 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 | # 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: | > | 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 | # 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 15 16 17 18 19 20 21 22 | # 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: 9.0b2 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.7.0 Requires: tcl >= 8.7.0 %description The Tcl (Tool Command Language) provides a powerful platform for creating integration applications that tie together diverse applications, protocols, devices, and frameworks. When paired with the Tk toolkit, Tcl provides the fastest and most powerful way to create GUI applications that run on PCs, Unix, and Mac OS X. Tcl |
︙ | ︙ |
Changes to unix/tkAppInit.c.
1 2 3 4 5 6 | /* * tkAppInit.c -- * * Provides a default version of the main program and Tcl_AppInit * procedure for wish and other Tk-based applications. * | | | | > > > > > > > > > > > > > > > > > > > > > > > | > > > | > | 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 | /* * tkAppInit.c -- * * Provides a default version of the main program and Tcl_AppInit * procedure for wish and other Tk-based applications. * * Copyright © 1993 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. */ /* * Explanation on following undef USE_TCL_STUBS by JN 2023-12-19 on the core list: * What's going on is related to TIP #596: * Stubs support for Embedding Tcl in other applications * * If an application using Tcl_Main() is compiled with USE_TCL_STUBS, * Tcl_Main() will be replaced by a stub function, which loads * libtcl9.0.so/tcl90.dll and then calls its Tcl_MainEx(). If * libtcl9.0.so/tcl90.dll is not present (at runtime), a crash is what happens. * * So ... tkAppInit.c should not be compiled with USE_TCL_STUBS * (unless you want to use the TIP #596 functionality) * * The proper solution is to make sure that Makefile.in doesn't use * TCL_USE_STUBS when compiling tkAppInit.c. But that's a * quite big re-organization just before a b1 release. Simpler * is just to #undef'ine USE_TCL_STUBS, it has the same effect. */ #undef USE_TCL_STUBS #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; } | | < | | | 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 | 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.
1 2 3 4 5 6 | /* ../unix/tkConfig.h.in. Generated from configure.ac by autoheader. */ #ifndef _TKCONFIG #define _TKCONFIG | < < < | | | > > > | | > > > > > > < < < | > > > | 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 | /* ../unix/tkConfig.h.in. Generated from configure.ac by autoheader. */ #ifndef _TKCONFIG #define _TKCONFIG /* Define to 1 if you have the <AvailabilityMacros.h> header file. */ #undef HAVE_AVAILABILITYMACROS_H /* Defined when compiler supports casting to union type. */ #undef HAVE_CAST_TO_UNION /* Do we have access to Darwin CoreFoundation.framework? */ #undef HAVE_COREFOUNDATION /* 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 /* Define to 1 if you have the `posix_spawnattr_setflags' function. */ #undef HAVE_POSIX_SPAWNATTR_SETFLAGS /* Define to 1 if you have the `posix_spawnp' function. */ #undef HAVE_POSIX_SPAWNP /* Define to 1 if you have the `posix_spawn_file_actions_adddup2' function. */ #undef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2 /* 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 /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H /* Is 'struct dirent64' in <sys/types.h>? */ #undef HAVE_STRUCT_DIRENT64 /* Should we include <sys/select.h>? */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H /* 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 /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Is weak import available? */ #undef HAVE_WEAK_IMPORT /* Have we turned on XFT (antialiased fonts)? */ #undef HAVE_XFT |
︙ | ︙ | |||
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 | | > > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /* 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 | < < < < < < > > > > > > < < < > > > | > < < < < < < | < < < < < < | | > | 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 | /* 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 _FILE_OFFSET_BITS flag when building */ #undef _FILE_OFFSET_BITS /* Add the _ISOC99_SOURCE flag when building */ #undef _ISOC99_SOURCE /* Add the _LARGEFILE64_SOURCE flag when building */ #undef _LARGEFILE64_SOURCE /* # needed in sys/socket.h Should OS/390 do the right thing with sockets? */ #undef _OE_SOCKETS /* Do we really want to follow the standard? Yes we do! */ #undef _POSIX_PTHREAD_SEMANTICS /* Do we want the reentrant OS API? */ #undef _REENTRANT /* _TIME_BITS=64 enables 64-bit time_t. */ #undef _TIME_BITS /* 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/tkConfig.sh.in.
︙ | ︙ | |||
18 19 20 21 22 23 24 | TK_PATCH_LEVEL='@TK_PATCH_LEVEL@' # -D flags for use with the C compiler. TK_DEFS='@DEFS@' # Flag, 1: we built a shared lib, 0 we didn't TK_SHARED_BUILD=@TK_SHARED_BUILD@ | < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | TK_PATCH_LEVEL='@TK_PATCH_LEVEL@' # -D flags for use with the C compiler. TK_DEFS='@DEFS@' # Flag, 1: we built a shared lib, 0 we didn't TK_SHARED_BUILD=@TK_SHARED_BUILD@ # TK_DBGX used to be used to distinguish debug vs. non-debug builds. # This was a righteous pain so the core doesn't do that any more. TK_DBGX= # The name of the Tk library (may be either a .a file or a shared library): TK_LIB_FILE='@TK_LIB_FILE@' |
︙ | ︙ |
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 |
︙ | ︙ | |||
117 118 119 120 121 122 123 124 125 126 127 128 129 130 | * This function intentionally left blank */ } /* *---------------------------------------------------------------------- * * TkpBuildRegionFromAlphaData -- * * Set up a rectangle of the given region based on the supplied alpha * data. * * Results: * None | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * This function intentionally left blank */ } /* *---------------------------------------------------------------------- * * TkpCopyRegion -- * * Makes the destination region a copy of the source region. * Currently unused on X11. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void TkpCopyRegion( TkRegion dst, TkRegion src) { /* XUnionRegion() in Xlib is optimized to detect copying */ XUnionRegion((Region)src, (Region)src, (Region)dst); } /* *---------------------------------------------------------------------- * * TkpBuildRegionFromAlphaData -- * * Set up a rectangle of the given region based on the supplied alpha * data. * * Results: * None |
︙ | ︙ | |||
200 201 202 203 204 205 206 | * Side effects: * None. *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( | > | > > > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | * 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" |
︙ | ︙ | |||
34 35 36 37 38 39 40 | /* * The class function table for the button widgets. */ const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > | | | | | | | | > > > > > | | < < < | > | < < | | < < | < | < < | | < < | < > < < < | < < < < | < < < < < < < < < < < > | > | | < > | > > | < | > > | | | < | > | | | | > | > > > > > > > > > > > > > | < > > | < < < < > > > > > > | < | | | | | | > | > > | > > > > > > > > > | > > > | > > > > | > > > | > > > > > | > > > < > | > > | < | 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 | /* * The class function table for the button widgets. */ const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* * Indicator draw modes */ #define CHECK_BUTTON 0 #define CHECK_MENU 1 #define RADIO_BUTTON 2 #define RADIO_MENU 3 /* * Indicator sizes */ #define CHECK_BUTTON_DIM 16 #define CHECK_MENU_DIM 8 #define RADIO_BUTTON_DIM 16 #define RADIO_MENU_DIM 8 /* * Data of the SVG images used for drawing the indicators */ static const char checkbtnOffData[] = "<svg id='checkbutton' width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <path id='borderdark' d='m0 0v16l1-1v-14h14l1-1h-16z' fill='#DARKKK'/>\n" " <path id='borderlight' d='m16 0-1 1v14h-14l-1 1h16v-16z' fill='#LIGHTT'/>\n" " <rect id='rectbackdrop' x='2' y='2' width='12' height='12' fill='#INTROR'/>\n" "</svg>"; static const char checkbtnOnData[] = "<svg id='checkbutton' width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <path id='borderdark' d='m0 0v16l1-1v-14h14l1-1h-16z' fill='#DARKKK'/>\n" " <path id='borderlight' d='m16 0-1 1v14h-14l-1 1h16v-16z' fill='#LIGHTT'/>\n" " <rect id='rectbackdrop' x='2' y='2' width='12' height='12' fill='#INTROR'/>\n" " <path id='indicator' d='m4.5 8 3 3 4-6' fill='none' stroke='#INDCTR' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/>\n" "</svg>"; static const char radiobtnOffData[] = "<svg id='radiobutton' width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <defs>\n" " <linearGradient id='gradient' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n" " <stop stop-color='#DARKKK' offset='0'/>\n" " <stop stop-color='#LIGHTT' offset='1' stop-opacity='0'/>\n" " </linearGradient>\n" " </defs>\n" " <circle cx='8' cy='8' r='8' fill='url(#gradient)'/>\n" " <circle cx='8' cy='8' r='6.5' fill='#INTROR'/>\n" "</svg>"; static const char radiobtnOnData[] = "<svg id='radiobutton' width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <defs>\n" " <linearGradient id='gradient' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n" " <stop stop-color='#DARKKK' offset='0'/>\n" " <stop stop-color='#LIGHTT' offset='1' stop-opacity='0'/>\n" " </linearGradient>\n" " </defs>\n" " <circle cx='8' cy='8' r='8' fill='url(#gradient)'/>\n" " <circle cx='8' cy='8' r='7' fill='#INTROR'/>\n" " <circle cx='8' cy='8' r='4' fill='#INDCTR'/>\n" "</svg>"; static const char menuOffData[] = "<svg width='8' height='8' version='1.1' xmlns='http://www.w3.org/2000/svg'></svg>"; static const char checkmenuOnData[] = "<svg width='8' height='8' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <path id='indicator' d='m1 3.5 2.5 3 3.5-5' fill='none' stroke='#INDCTR' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.975'/>\n" "</svg>"; static const char radiomenuOnData[] = "<svg width='8' height='8' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n" " <circle cx='4' cy='4' r='3' fill='#INDCTR'/>\n" "</svg>"; /* *---------------------------------------------------------------------- * * TkpDrawCheckIndicator - * * Draws the checkbox image in the drawable at the (x,y) location, value, * and state given. This routine is used by the button and menu widgets. * * Results: * None. * * Side effects: * An image is drawn in the drawable at the location given. * *---------------------------------------------------------------------- */ static void ColorToStr( const XColor *colorPtr, /* specifies a color */ char *colorStr) /* memory area to which the color is to be output in the format "RRGGBB" */ { snprintf(colorStr, 7, "%02x%02x%02x", colorPtr->red >> 8, colorPtr->green >> 8, colorPtr->blue >> 8); } static void ImageChanged( /* to be passed to Tk_GetImage() */ void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { (void)clientData; (void)x; (void)y; (void)width; (void)height; (void)imageWidth; (void)imageHeight; } void TkpDrawCheckIndicator( Tk_Window tkwin, /* handle for resource alloc */ Display *display, Drawable d, /* what to draw on */ int x, int y, /* where to draw */ Tk_3DBorder bgBorder, /* colors of the border */ XColor *indicatorColor, /* color of the indicator */ XColor *selectColor, /* color when selected */ XColor *disableColor, /* color when disabled */ int on, /* are we on? */ int disabled, /* are we disabled? */ int mode) /* kind of indicator to draw */ { const char *svgDataPtr; int hasBorder, hasInterior, dim; double scalingLevel = TkScalingLevel(tkwin); TkBorder *bg_brdr = (TkBorder*)bgBorder; char darkColorStr[7], lightColorStr[7], interiorColorStr[7], indicatorColorStr[7]; Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[60]; Tk_Image img; size_t svgDataLen; char *svgDataCopy; char *darkColorPtr, *lightColorPtr, *interiorColorPtr, *indicatorColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; /* * Sanity check */ if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL || indicatorColor == NULL) { return; } if (disableColor == NULL) { disableColor = bg_brdr->bgColorPtr; } if (selectColor == NULL) { selectColor = bg_brdr->bgColorPtr; } /* * Determine the SVG data to use for the * photo image and the latter's dimensions */ switch (mode) { default: case CHECK_BUTTON: svgDataPtr = (on == 0 ? checkbtnOffData : checkbtnOnData); hasBorder = 1; hasInterior = 1; dim = CHECK_BUTTON_DIM; break; case CHECK_MENU: svgDataPtr = (on == 0 ? menuOffData : checkmenuOnData); hasBorder = 0; hasInterior = 0; dim = CHECK_MENU_DIM; break; case RADIO_BUTTON: svgDataPtr = (on == 0 ? radiobtnOffData : radiobtnOnData); hasBorder = 1; hasInterior = 1; dim = RADIO_BUTTON_DIM; break; case RADIO_MENU: svgDataPtr = (on == 0 ? menuOffData : radiomenuOnData); hasBorder = 0; hasInterior = 0; dim = RADIO_MENU_DIM; break; } dim = (int)(dim * scalingLevel); /* * Construct the color strings darkColorStr, lightColorStr, * interiorColorStr, and indicatorColorStr */ TkpGetShadows(bg_brdr, tkwin); if (bg_brdr->darkColorPtr == NULL) { strcpy(darkColorStr, "000000"); } else { ColorToStr(Tk_GetColorByValue(tkwin, bg_brdr->darkColorPtr), darkColorStr); } if (bg_brdr->lightColorPtr == NULL) { strcpy(lightColorStr, "ffffff"); } else { ColorToStr(Tk_GetColorByValue(tkwin, bg_brdr->lightColorPtr), lightColorStr); } if (on == 2 || disabled) { /* tri-state or disabled */ ColorToStr(Tk_GetColorByValue(tkwin, bg_brdr->bgColorPtr), interiorColorStr); ColorToStr(Tk_GetColorByValue(tkwin, disableColor), indicatorColorStr); } else { ColorToStr(Tk_GetColorByValue(tkwin, selectColor), interiorColorStr); ColorToStr(Tk_GetColorByValue(tkwin, indicatorColor), indicatorColorStr); } /* * Check whether there is an SVG image of this size * for the value of mode and these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::indicator%d_%d_%s_%s_%s_%s", dim, mode, hasBorder ? darkColorStr : "XXXXXX", hasBorder ? lightColorStr : "XXXXXX", hasInterior ? interiorColorStr : "XXXXXX", on ? indicatorColorStr : "XXXXXX"); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ darkColorPtr = strstr(svgDataCopy, "DARKKK"); lightColorPtr = strstr(svgDataCopy, "LIGHTT"); interiorColorPtr = strstr(svgDataCopy, "INTROR"); indicatorColorPtr = strstr(svgDataCopy, "INDCTR"); if (darkColorPtr != NULL) { memcpy(darkColorPtr, darkColorStr, 6); } if (lightColorPtr != NULL) { memcpy(lightColorPtr, lightColorStr, 6); } if (interiorColorPtr != NULL) { memcpy(interiorColorPtr, interiorColorStr, 6); } if (indicatorColorPtr != NULL) { memcpy(indicatorColorPtr, indicatorColorStr, 6); } /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Adjust the image's coordinates in the drawable and display the image */ x -= dim/2; y -= dim/2; Tk_RedrawImage(img, 0, 0, dim, dim, d, x, y); Tk_FreeImage(img); } /* *---------------------------------------------------------------------- * * TkpCreateButton -- * |
︙ | ︙ | |||
388 389 390 391 392 393 394 | *x += shiftX; *y += shiftY; } } void TkpDisplayButton( | | | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | *x += shiftX; *y += shiftY; } } void TkpDisplayButton( void *clientData) /* Information about widget. */ { TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ |
︙ | ︙ | |||
679 680 681 682 683 684 685 | } /* * Draw the indicator for check buttons and radio buttons. At this point, * x and y refer to the top-left corner of the text or image or bitmap. */ | | < < < < < < < | < < < < < < < < | | | > > | | | | | | | | | | < | 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 | } /* * Draw the indicator for check buttons and radio buttons. At this point, * x and y refer to the top-left corner of the text or image or bitmap. */ if ((butPtr->type == TYPE_CHECK_BUTTON || butPtr->type == TYPE_RADIO_BUTTON) && butPtr->indicatorOn && butPtr->indicatorDiameter > 2*butPtr->borderWidth) { TkBorder *selBorder = (TkBorder *) butPtr->selectBorder; XColor *selColor = NULL; int btype = (butPtr->type == TYPE_CHECK_BUTTON ? CHECK_BUTTON : RADIO_BUTTON); if (selBorder != NULL) { selColor = selBorder->bgColorPtr; } x -= butPtr->indicatorSpace/2; y = Tk_Height(tkwin)/2; TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y, border, butPtr->normalFg, selColor, butPtr->disabledFg, ((butPtr->flags & SELECTED) ? 1 : (butPtr->flags & TRISTATED) ? 2 : 0), (butPtr->state == STATE_DISABLED), btype); } /* * If the button is disabled with a stipple rather than a special * foreground color, generate the stippled effect. If the widget is * selected and we use a different background color when selected, must * temporarily modify the GC so the stippling is the right color. |
︙ | ︙ | |||
887 888 889 890 891 892 893 | haveImage = 1; } if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, | | | 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | haveImage = 1; } if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth; txtHeight = butPtr->textHeight; avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); Tk_GetFontMetrics(butPtr->tkfont, &fm); haveText = (txtWidth != 0 && txtHeight != 0); |
︙ | ︙ | |||
982 983 984 985 986 987 988 | width = butPtr->width * avgWidth; } if (butPtr->height > 0) { height = butPtr->height * fm.linespace; } if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) { butPtr->indicatorDiameter = fm.linespace; | < < < < | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | width = butPtr->width * avgWidth; } if (butPtr->height > 0) { height = butPtr->height * fm.linespace; } if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) { butPtr->indicatorDiameter = fm.linespace; butPtr->indicatorSpace = butPtr->indicatorDiameter + avgWidth; } } } /* * When issuing the geometry request, add extra space for the indicator, |
︙ | ︙ |
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" |
︙ | ︙ | |||
285 286 287 288 289 290 291 | visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualIDMask, &templ, &numFound); if (numFound < 1) { Tcl_Panic("FindClosestColor couldn't lookup visual"); } stressPtr->numColors = visInfoPtr->colormap_size; | | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualIDMask, &templ, &numFound); if (numFound < 1) { Tcl_Panic("FindClosestColor couldn't lookup visual"); } stressPtr->numColors = visInfoPtr->colormap_size; XFree(visInfoPtr); stressPtr->colorPtr = (XColor *) ckalloc((size_t)stressPtr->numColors * sizeof(XColor)); for (i = 0; i < stressPtr->numColors; i++) { stressPtr->colorPtr[i].pixel = (unsigned long) i; } XQueryColors(dispPtr->display, colormap, stressPtr->colorPtr, stressPtr->numColors); |
︙ | ︙ | |||
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 Tcl_Obj* with 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, Tcl_Size 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; Tcl_Size 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; |
︙ | ︙ | |||
292 293 294 295 296 297 298 | } } dispPtr = ((TkWindow *) tkwin)->dispPtr; if (dispPtr->cursorFont == None) { dispPtr->cursorFont = XLoadFont(display, CURSORFONT); if (dispPtr->cursorFont == None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 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 | } } dispPtr = ((TkWindow *) tkwin)->dispPtr; if (dispPtr->cursorFont == None) { dispPtr->cursorFont = XLoadFont(display, CURSORFONT); if (dispPtr->cursorFont == None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't load cursor font", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CURSOR", "FONT", NULL); goto cleanup; } } cursor = XCreateGlyphCursor(display, dispPtr->cursorFont, dispPtr->cursorFont, namePtr->shape, maskIndex, &fg, &bg); } else { /* * Prevent file system access in safe interpreters. */ if (!inTkTable && Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get cursor from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL); cursorPtr = NULL; goto cleanup; } /* * If the cursor is to be created from bitmap files, then there should |
︙ | ︙ | |||
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. */ Tcl_Size 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; |
︙ | ︙ | |||
428 429 430 431 432 433 434 | if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap data for \"%s\"", argv[0])); Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_DATA", NULL); goto cleanup; } | | | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap data for \"%s\"", argv[0])); Tcl_SetErrorCode(interp, "TK", "CURSOR", "BITMAP_DATA", NULL); goto cleanup; } source = XCreateBitmapFromData(display, drawable, data, (unsigned)width, (unsigned)height); ckfree(data); } else { if (TkReadBitmapFile(display, drawable, &argv[0][1], (unsigned *) &width, (unsigned *) &height, &source, &xHot, &yHot) != BitmapSuccess) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cleanup reading bitmap file \"%s\"", &argv[0][1])); |
︙ | ︙ | |||
526 527 528 529 530 531 532 | if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap mask data for \"%s\"", argv[0])); Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_DATA", NULL); goto cleanup; } | | | | | 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 | if (data == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading bitmap mask data for \"%s\"", argv[0])); Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_DATA", NULL); goto cleanup; } mask = XCreateBitmapFromData(display, drawable, data, (unsigned)maskWidth, (unsigned)maskHeight); ckfree(data); } else { if (TkReadBitmapFile(display, drawable, argv[1], (unsigned int *) &maskWidth, (unsigned int *) &maskHeight, &mask, &dummy1, &dummy2) != BitmapSuccess) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cleanup reading bitmap file \"%s\"", argv[1])); Tcl_SetErrorCode(interp, "TK", "CURSOR", "MASK_FILE", NULL); goto cleanup; } } if ((maskWidth != width) || (maskHeight != height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "source and mask bitmaps have different sizes", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CURSOR", "SIZE_MATCH", NULL); goto cleanup; } cursor = XCreatePixmapCursor(display, source, mask, &fg, &bg, (unsigned) xHot, (unsigned) yHot); |
︙ | ︙ |
Changes to unix/tkUnixDefault.h.
1 2 3 4 5 6 | /* * tkUnixDefault.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * tkUnixDefault.h -- * * This file defines the defaults for all options for all of * the Tk 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. */ #ifndef _TKUNIXDEFAULT #define _TKUNIXDEFAULT |
︙ | ︙ | |||
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 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | #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: */ #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 BLACK #define DEF_MESSAGE_FONT "TkDefaultFont" #define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG #define DEF_MESSAGE_HIGHLIGHT BLACK #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX NULL #define DEF_MESSAGE_PADY NULL #define DEF_MESSAGE_RELIEF "flat" #define DEF_MESSAGE_TAKE_FOCUS "0" #define DEF_MESSAGE_TEXT "" #define DEF_MESSAGE_TEXT_VARIABLE "" #define DEF_MESSAGE_WIDTH "0" /* |
︙ | ︙ | |||
402 403 404 405 406 407 408 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE | | | | | | | 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 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE #define DEF_SCALE_BIG_INCREMENT "0.0" #define DEF_SCALE_BORDER_WIDTH "1" #define DEF_SCALE_COMMAND "" #define DEF_SCALE_CURSOR "" #define DEF_SCALE_DIGITS "0" #define DEF_SCALE_FONT "TkDefaultFont" #define DEF_SCALE_FG_COLOR BLACK #define DEF_SCALE_FG_MONO BLACK #define DEF_SCALE_FROM "0.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 BLACK #define DEF_SCALE_HIGHLIGHT_WIDTH "1" #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" #define DEF_SCALE_RESOLUTION "1.0" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" #define DEF_SCALE_TAKE_FOCUS NULL #define DEF_SCALE_TICK_INTERVAL "0.0" #define DEF_SCALE_TO "100.0" #define DEF_SCALE_VARIABLE "" #define DEF_SCALE_WIDTH "15" /* * Defaults for scrollbars: */ |
︙ | ︙ |
Deleted unix/tkUnixDialog.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
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" |
︙ | ︙ | |||
60 61 62 63 64 65 66 | GC gc, /* GC for window to be scrolled. */ int x, int y, int width, int height, /* Position rectangle to be scrolled. */ int dx, int dy, /* Distance rectangle should be moved. */ Region damageRgn) /* Region to accumulate damage in. */ { Tk_RestrictProc *prevProc; | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | GC gc, /* GC for window to be scrolled. */ int x, int y, int width, int height, /* Position rectangle to be scrolled. */ int dx, int dy, /* Distance rectangle should be moved. */ Region damageRgn) /* Region to accumulate damage in. */ { Tk_RestrictProc *prevProc; void *prevArg; ScrollInfo info; XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin), gc, x, y, (unsigned) width, (unsigned) height, x+dx, y+dy); info.done = 0; info.window = Tk_WindowId(tkwin); |
︙ | ︙ | |||
115 116 117 118 119 120 121 | * for a particular window. * *---------------------------------------------------------------------- */ static Tk_RestrictAction ScrollRestrictProc( | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | * for a particular window. * *---------------------------------------------------------------------- */ static Tk_RestrictAction ScrollRestrictProc( void *arg, XEvent *eventPtr) { ScrollInfo *info = (ScrollInfo *) arg; XRectangle rect; /* * Defer events which aren't for the specified window. |
︙ | ︙ | |||
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" |
︙ | ︙ | |||
49 50 51 52 53 54 55 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for static functions defined in this file: */ | | | | | | | | | | 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 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for static functions defined in this file: */ static void ContainerEventProc(void *clientData, XEvent *eventPtr); static void EmbeddedEventProc(void *clientData, XEvent *eventPtr); static int EmbedErrorProc(void *clientData, XErrorEvent *errEventPtr); static void EmbedFocusProc(void *clientData, XEvent *eventPtr); static void EmbedGeometryRequest(Container *containerPtr, int width, int height); static void EmbedSendConfigure(Container *containerPtr); static void EmbedStructureProc(void *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. */ { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *usePtr; int anyError; Window parent; Tk_ErrorHandler handler; Container *containerPtr; XWindowAttributes parentAtts; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window != None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't modify container after widget is created", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL); return TCL_ERROR; } if (TkpScanWindowId(interp, string, &parent) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
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)); |
︙ | ︙ | |||
324 325 326 327 328 329 330 | * The integer pointed to by the clientData argument is set to 1. * *---------------------------------------------------------------------- */ static int EmbedErrorProc( | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | * The integer pointed to by the clientData argument is set to 1. * *---------------------------------------------------------------------- */ static int EmbedErrorProc( void *clientData, /* Points to integer to set. */ XErrorEvent *errEventPtr) /* Points to information about error (not * used). */ { int *iPtr = (int *)clientData; (void)errEventPtr; *iPtr = 1; |
︙ | ︙ | |||
356 357 358 359 360 361 362 | * destroyed. * *---------------------------------------------------------------------- */ static void EmbeddedEventProc( | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | * destroyed. * *---------------------------------------------------------------------- */ static void EmbeddedEventProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); } |
︙ | ︙ | |||
388 389 390 391 392 393 394 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { TkWindow *winPtr = (TkWindow *)clientData; Container *containerPtr; Tk_ErrorHandler errHandler; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
493 494 495 496 497 498 499 | * The embedded window gets resized to match the container. * *---------------------------------------------------------------------- */ static void EmbedStructureProc( | | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | * The embedded window gets resized to match the container. * *---------------------------------------------------------------------- */ static void EmbedStructureProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { /* |
︙ | ︙ | |||
548 549 550 551 552 553 554 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedFocusProc( | | | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | * The X focus may change. * *---------------------------------------------------------------------- */ static void EmbedFocusProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; Display *display; display = Tk_Display(containerPtr->parentPtr); |
︙ | ︙ | |||
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; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
869 870 871 872 873 874 875 | * None. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( | | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | * None. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( void *dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; |
︙ | ︙ | |||
905 906 907 908 909 910 911 | continue; } Tcl_DStringStartSublist(&dString); /* Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { | | | | 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 | continue; } Tcl_DStringStartSublist(&dString); /* Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { snprintf(buffer, sizeof(buffer), "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->parent); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* Parent pathName */ if (containerPtr->parentPtr == NULL || parentInterp != interp) { Tcl_DStringAppendElement(&dString, ""); } else { Tcl_DStringAppendElement(&dString, containerPtr->parentPtr->pathName); } /* Wrapper */ if (containerPtr->wrapper == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { snprintf(buffer, sizeof(buffer), "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->wrapper); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* Embedded window pathName */ if (containerPtr->embeddedPtr == NULL || embeddedInterp != interp) { |
︙ | ︙ | |||
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> |
︙ | ︙ | |||
27 28 29 30 31 32 33 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for functions that are referenced only in this file: */ | | | | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for functions that are referenced only in this file: */ static void DisplayCheckProc(void *clientData, int flags); static void DisplayExitHandler(void *clientData); static void DisplayFileProc(void *clientData, int flags); static void DisplaySetupProc(void *clientData, int flags); static void TransferXEventsToTcl(Display *display); #ifdef TK_USE_INPUT_METHODS static void InstantiateIMCallback(Display *, XPointer client_data, XPointer call_data); static void DestroyIMCallback(XIM im, XPointer client_data, XPointer call_data); static void OpenIM(TkDisplay *dispPtr); #endif |
︙ | ︙ | |||
87 88 89 90 91 92 93 | * None. * *---------------------------------------------------------------------- */ static void DisplayExitHandler( | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | * None. * *---------------------------------------------------------------------- */ static void DisplayExitHandler( void *dummy) /* Not used. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); (void)dummy; Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL); tsdPtr->initialized = 0; |
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 | if (display == NULL) { return NULL; } dispPtr = (TkDisplay *)ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; #ifdef TK_USE_INPUT_METHODS OpenIM(dispPtr); XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL, InstantiateIMCallback, (XPointer) dispPtr); #endif Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE, DisplayFileProc, dispPtr); | > | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | if (display == NULL) { return NULL; } dispPtr = (TkDisplay *)ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; #ifdef TK_USE_INPUT_METHODS XSetLocaleModifiers(""); OpenIM(dispPtr); XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL, InstantiateIMCallback, (XPointer) dispPtr); #endif Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE, DisplayFileProc, dispPtr); |
︙ | ︙ | |||
294 295 296 297 298 299 300 | * Tcl even if there is no more data on the X connection. * *---------------------------------------------------------------------- */ static void DisplaySetupProc( | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | * Tcl even if there is no more data on the X connection. * *---------------------------------------------------------------------- */ static void DisplaySetupProc( void *dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; static Tcl_Time blockTime = { 0, 0 }; (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { |
︙ | ︙ | |||
361 362 363 364 365 366 367 | * until Tk_HandleEvent then many input methods actually cease to work * correctly. Most of the time, Tk processes its event queue fast enough * for this to not be an issue anyway. [Bug 1924761] */ while (QLength(display) > 0) { XNextEvent(display, &event.x); | | > > | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | * until Tk_HandleEvent then many input methods actually cease to work * correctly. Most of the time, Tk processes its event queue fast enough * for this to not be an issue anyway. [Bug 1924761] */ while (QLength(display) > 0) { XNextEvent(display, &event.x); if ((event.type >= VirtualEvent) && (event.type <= MouseWheelEvent)) { /* See [fe87e9af39]. Those are internal Tk event types, if they come * from an external source they most likely would be totally mis-interpreted */ continue; } w = None; if (event.type == KeyPress || event.type == KeyRelease) { for (dispPtr = TkGetDisplayList(); ; dispPtr = dispPtr->nextPtr) { if (dispPtr == NULL) { break; |
︙ | ︙ | |||
427 428 429 430 431 432 433 | * Moves queued events onto the Tcl event queue. * *---------------------------------------------------------------------- */ static void DisplayCheckProc( | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | * Moves queued events onto the Tcl event queue. * *---------------------------------------------------------------------- */ static void DisplayCheckProc( void *dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { return; |
︙ | ︙ | |||
463 464 465 466 467 468 469 | * all the displays. * *---------------------------------------------------------------------- */ static void DisplayFileProc( | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | * all the displays. * *---------------------------------------------------------------------- */ static void DisplayFileProc( void *clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { TkDisplay *dispPtr = (TkDisplay *)clientData; Display *display = dispPtr->display; int numFound; (void)flags; |
︙ | ︙ | |||
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); /* | > | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | * * Side effects: * Places new events on the Tk event queue. * *---------------------------------------------------------------------- */ #undef TkpSync void TkpSync( Display *display) /* Display to sync. */ { XSync(display, False); /* |
︙ | ︙ | |||
731 732 733 734 735 736 737 | OpenIM( TkDisplay *dispPtr) /* Tk's structure for the display. */ { int i; XIMStyles *stylePtr; XIMStyle bestStyle = 0; | < < < < | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | OpenIM( TkDisplay *dispPtr) /* Tk's structure for the display. */ { int i; XIMStyles *stylePtr; XIMStyle bestStyle = 0; ++dispPtr->ximGeneration; dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL); if (dispPtr->inputMethod == NULL) { return; } /* Require X11R6 */ |
︙ | ︙ |
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" |
︙ | ︙ | |||
101 102 103 104 105 106 107 | /* Builtin space for a limited number of * SubFonts. */ int numSubFonts; /* Length of following array. */ SubFont *subFontArray; /* Array of SubFonts that have been loaded in * order to draw/measure all the characters * encountered by this font so far. All fonts * start off with one SubFont initialized by | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /* Builtin space for a limited number of * SubFonts. */ int numSubFonts; /* Length of following array. */ SubFont *subFontArray; /* Array of SubFonts that have been loaded in * order to draw/measure all the characters * encountered by this font so far. All fonts * start off with one SubFont initialized by * InitFont() from the original set of font * attributes. Usually points to * staticSubFonts, but may point to malloced * space if there are lots of SubFonts. */ SubFont controlSubFont; /* Font to use to display control-character * expansions. */ Display *display; /* Display that owns font. */ |
︙ | ︙ | |||
234 235 236 237 238 239 240 | 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); | < < < < < < < < | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | 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); /* *------------------------------------------------------------------------- * * FontPkgCleanup -- * * This function is called when an application is created. It initializes |
︙ | ︙ | |||
308 309 310 311 312 313 314 | TkpFontPkgInit( TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; | < < < < < < < < | 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 | TkpFontPkgInit( TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; 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. */ Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL); } } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
405 406 407 408 409 410 411 | dstEnd = dst + dstLen - 6; for ( ; src < srcEnd; ) { if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | dstEnd = dst + dstLen - 6; for ( ; src < srcEnd; ) { if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } src += Tcl_UtfToUniChar(src, &ch); dst[0] = '\\'; if (((size_t)ch < sizeof(mapChars)) && (mapChars[ch] != 0)) { dst[1] = mapChars[ch]; dst += 2; } else if ((size_t)ch < 256) { dst[1] = 'x'; dst[2] = hexChars[(ch >> 4) & 0xF]; |
︙ | ︙ | |||
437 438 439 440 441 442 443 | } } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = dst - dstStart; return result; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | } } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = dst - dstStart; return result; } /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. |
︙ | ︙ | |||
871 872 873 874 875 876 877 | Tcl_CreateHashEntry(&familyTable, family, &isNew); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { | | | 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | Tcl_CreateHashEntry(&familyTable, family, &isNew); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } Tcl_SetObjResult(interp, resultPtr); Tcl_DeleteHashTable(&familyTable); } |
︙ | ︙ | |||
912 913 914 915 916 917 918 | UnixFont *fontPtr; FontFamily *familyPtr; resultPtr = Tcl_NewObj(); fontPtr = (UnixFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; | | | | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | UnixFont *fontPtr; FontFamily *familyPtr; resultPtr = Tcl_NewObj(); fontPtr = (UnixFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; objv[0] = Tcl_NewStringObj(familyPtr->faceName, TCL_INDEX_NONE); objv[1] = Tcl_NewStringObj(familyPtr->foundry, TCL_INDEX_NONE); objv[2] = Tcl_NewStringObj( Tcl_GetEncodingName(familyPtr->encoding), TCL_INDEX_NONE); listPtr = Tcl_NewListObj(3, objv); Tcl_ListObjAppendElement(NULL, resultPtr, listPtr); } Tcl_SetObjResult(interp, resultPtr); } /* |
︙ | ︙ | |||
987 988 989 990 991 992 993 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | > | | 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 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ Tcl_Size numBytes, /* Maximum number of bytes to consider from * source string. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length in pixels; don't * consider any character that would cross * this x-position. If < 0, then line length * is unbounded and the flags argument is * ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char * which only partially fit on this line. * TK_WHOLE_WORDS means stop on a word * boundary, if possible. TK_AT_LEAST_ONE * means return at least one character even if * no characters fit. */ int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { UnixFont *fontPtr; SubFont *lastSubFontPtr; Tcl_Size curByte; int curX, ch; /* * Unix does not use kerning or fractional character widths when * displaying text on the screen. So that means we can safely measure * individual characters or spans of characters and add up the widths w/o * any "off-by-one-pixel" errors. */ |
︙ | ︙ | |||
1040 1041 1042 1043 1044 1045 1046 | * 2. Convert those chars to the encoding of that font. * 3. Measure converted chars. */ curX = 0; end = source + numBytes; for (p = source; p < end; ) { | | | | | 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 | * 2. Convert those chars to the encoding of that font. * 3. Measure converted chars. */ curX = 0; end = source + numBytes; for (p = source; p < end; ) { next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &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_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); if (familyPtr->isTwoByteFont) { curX += XTextWidth16(lastSubFontPtr->fontStructPtr, (XChar2b *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> 1); } else { curX += XTextWidth(lastSubFontPtr->fontStructPtr, |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | /* * How many chars will fit in the space allotted? This first version * may be inefficient because it measures every character * individually. */ | | | | | 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 | /* * How many chars will fit in the space allotted? This first version * may be inefficient because it measures every character * individually. */ next = source + Tcl_UtfToUniChar(source, &ch); newX = curX = termX = 0; term = source; end = source + numBytes; sawNonSpace = (ch > 255) || !isspace(ch); familyPtr = lastSubFontPtr->familyPtr; for (p = source; ; ) { if ((ch < BASE_CHARS) && (fontPtr->widths[ch] != 0)) { newX += fontPtr->widths[ch]; } else { lastSubFontPtr = FindSubFontForChar(fontPtr, ch, NULL); familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternal(NULL, familyPtr->encoding, p, next - p, TCL_ENCODING_PROFILE_TCL8, NULL, (char *)&buf[0].byte1, sizeof(buf), NULL, &dstWrote, NULL); if (familyPtr->isTwoByteFont) { newX += XTextWidth16(lastSubFontPtr->fontStructPtr, buf, dstWrote >> 1); } else { newX += XTextWidth(lastSubFontPtr->fontStructPtr, (char *)&buf[0].byte1, dstWrote); } } if (newX > maxLength) { break; } curX = newX; p = next; if (p >= end) { term = end; termX = curX; break; } next += Tcl_UtfToUniChar(next, &ch); if ((ch < 256) && isspace(ch)) { if (sawNonSpace) { term = p; termX = curX; sawNonSpace = 0; } } else { |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | /* * Include the first character that didn't quite fit in the * desired span. The width returned will include the width of that * extra character. */ curX = newX; | | | | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | /* * Include the first character that didn't quite fit in the * desired span. The width returned will include the width of that * extra character. */ curX = newX; p += Tcl_UtfToUniChar(p, &ch); } if ((flags & TK_AT_LEAST_ONE) && (term == source) && (p < end)) { term = p; termX = curX; if (term == source) { term += Tcl_UtfToUniChar(term, &ch); termX = newX; } } else if ((p >= end) || !(flags & TK_WHOLE_WORDS)) { term = p; termX = curX; } |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | | | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ TCL_UNUSED(Tcl_Size), /* Maximum number of bytes to consider from * source string in all. */ Tcl_Size rangeStart, /* Index of first byte to measure. */ Tcl_Size rangeLength, /* Length of range to measure in bytes. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length; don't consider any * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char |
︙ | ︙ | |||
1256 1257 1258 1259 1260 1261 1262 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { UnixFont *fontPtr = (UnixFont *) tkfont; SubFont *thisSubFontPtr, *lastSubFontPtr; Tcl_DString runString; const char *p, *end, *next; |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | window_width = 32768; #endif end = source + numBytes; needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike; for (p = source; p <= end; ) { if (p < end) { | | | | 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 | window_width = 32768; #endif end = source + numBytes; needWidth = fontPtr->font.fa.underline + fontPtr->font.fa.overstrike; for (p = source; p <= end; ) { if (p < end) { next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); } else { next = p + 1; thisSubFontPtr = lastSubFontPtr; } if ((thisSubFontPtr != lastSubFontPtr) || (p == end) || (p-source > 200)) { if (p > source) { do_width = (needWidth || (p != end)) ? 1 : 0; familyPtr = lastSubFontPtr->familyPtr; (void)Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &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, |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | | 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size 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. */ { int widthUntilStart; Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); |
︙ | ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | > < < | 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 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size rangeLength1, /* Length of range to draw in bytes. */ double x, double y, /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ double angle) /* What angle to put text at, in degrees. */ { int rangeLength = rangeLength1; int widthUntilStart; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart, rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle); } /* *------------------------------------------------------------------------- |
︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | const char *const *const *fontFallbacks; SubFont *subFontPtr; Tcl_DString ds; if (ch < 0 || ch >= FONTMAP_NUMCHARS) { ch = 0xFFFD; } for (i = 0; i < fontPtr->numSubFonts; i++) { if (FontMapLookup(&fontPtr->subFontArray[i], ch)) { return &fontPtr->subFontArray[i]; } } | > > > > < < < < | 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 | const char *const *const *fontFallbacks; SubFont *subFontPtr; Tcl_DString ds; if (ch < 0 || ch >= FONTMAP_NUMCHARS) { ch = 0xFFFD; } if (FontMapLookup(&fontPtr->controlSubFont, ch)) { return &fontPtr->controlSubFont; } for (i = 0; i < fontPtr->numSubFonts; i++) { if (FontMapLookup(&fontPtr->subFontArray[i], ch)) { return &fontPtr->subFontArray[i]; } } /* * Keep track of all face names that we check, so we don't check some name * multiple times if it can be reached by multiple paths. */ Tcl_DStringInit(&ds); |
︙ | ︙ | |||
2105 2106 2107 2108 2109 2110 2111 | /* * Try all face names available in the whole system until we find one that * can be used. */ nameList = ListFonts(fontPtr->display, "*", &numNames); for (i = 0; i < numNames; i++) { | | | | | | 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 | /* * Try all face names available in the whole system until we find one that * can be used. */ nameList = ListFonts(fontPtr->display, "*", &numNames); for (i = 0; i < numNames; i++) { fallback = strchr(nameList[i] + 1, '-') + 1; strchr(fallback, '-')[0] = '\0'; if (SeenName(fallback, &ds) == 0) { subFontPtr = CanUseFallback(fontPtr, fallback, ch, fixSubFontPtrPtr); if (subFontPtr != NULL) { XFreeFontNames(nameList); goto end; } } } |
︙ | ︙ | |||
2277 2278 2279 2280 2281 2282 2283 | } } end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { int hi, lo; | | | | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 | } } end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { int hi, lo; if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src), TCL_ENCODING_PROFILE_STRICT, NULL, buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) { continue; } if (isTwoByteFont) { hi = ((unsigned char *) buf)[0]; lo = ((unsigned char *) buf)[1]; } else { |
︙ | ︙ | |||
2473 2474 2475 2476 2477 2478 2479 | display = fontPtr->display; nameList = ListFonts(display, faceName, &numNames); if (numNames == 0) { return NULL; } nameListOrig = nameList; | | | 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 | display = fontPtr->display; nameList = ListFonts(display, faceName, &numNames); if (numNames == 0) { return NULL; } nameListOrig = nameList; srcLen = Tcl_UniCharToUtf(ch, src); want.fa = fontPtr->font.fa; want.xa = fontPtr->xa; want.fa.family = Tk_GetUid(faceName); want.fa.size = (double)-fontPtr->pixelSize; |
︙ | ︙ | |||
2552 2553 2554 2555 2556 2557 2558 | } Tcl_DStringAppend(&dsEncodings, (char *) &encoding, sizeof(encoding)); numEncodings++; } Tcl_UtfToExternal(NULL, encoding, src, srcLen, | | | 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 | } Tcl_DStringAppend(&dsEncodings, (char *) &encoding, sizeof(encoding)); numEncodings++; } Tcl_UtfToExternal(NULL, encoding, src, srcLen, TCL_ENCODING_PROFILE_STRICT, NULL, dst, sizeof(dst), &srcRead, &dstWrote, NULL); if (dstWrote == 0) { goto crossout; } /* * D. Rank each name and pick the best match. |
︙ | ︙ | |||
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. */ | | | | 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 | 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; |
︙ | ︙ | |||
2798 2799 2800 2801 2802 2803 2804 | str = strchr(str + 1, '-'); } rest = str; for (i = XLFD_PIXEL_SIZE; i < XLFD_CHARSET; i++) { rest = strchr(rest + 1, '-'); } *str = '\0'; | | | 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 | str = strchr(str + 1, '-'); } rest = str; for (i = XLFD_PIXEL_SIZE; i < XLFD_CHARSET; i++) { rest = strchr(rest + 1, '-'); } *str = '\0'; snprintf(buf, sizeof(buf), "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]], (int)(-wantPtr->fa.size+0.5), rest); *str = '-'; fontStructPtr = XLoadQueryFont(display, buf); bestScore[1] = INT_MAX; } if (fontStructPtr == NULL) { fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]); |
︙ | ︙ | |||
2936 2937 2938 2939 2940 2941 2942 | Display *display, /* Display to query. */ const char *faceName, /* Desired face name, or "*" for all. */ int *numNamesPtr) /* Filled with length of returned array, or 0 * if no names were found. */ { char buf[256]; | | | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 | Display *display, /* Display to query. */ const char *faceName, /* Desired face name, or "*" for all. */ int *numNamesPtr) /* Filled with length of returned array, or 0 * if no names were found. */ { char buf[256]; snprintf(buf, sizeof(buf), "-*-%.80s-*-*-*-*-*-*-*-*-*-*-*-*", faceName); return XListFonts(display, buf, 10000, numNamesPtr); } static char ** ListFontOrAlias( Display *display, /* Display to query. */ const char *faceName, /* Desired face name, or "*" for all. */ |
︙ | ︙ | |||
3086 3087 3088 3089 3090 3091 3092 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ int *realWidthPtr, int *realHeightPtr) { int width, height; TkFont *fontPtr = (TkFont *) tkfont; Pixmap bitmap; GC bitmapGC; XGCValues values; |
︙ | ︙ | |||
3168 3169 3170 3171 3172 3173 3174 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ double x, double y, double angle) { if (angle == 0.0) { Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y); } else { double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); |
︙ | ︙ |
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 -- |
︙ | ︙ | |||
74 75 76 77 78 79 80 | name = "tk"; } else { p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | name = "tk"; } else { p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } Tcl_DStringAppend(namePtr, name, TCL_INDEX_NONE); } /* *---------------------------------------------------------------------- * * TkpDisplayWarning -- * |
︙ | ︙ | |||
102 103 104 105 106 107 108 | TkpDisplayWarning( const char *msg, /* Message to be displayed. */ const char *title) /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { | | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | TkpDisplayWarning( const char *msg, /* Message to be displayed. */ const char *title) /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); if (errChannel) { Tcl_WriteChars(errChannel, title, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, ": ", 2); Tcl_WriteChars(errChannel, msg, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, "\n", 1); } } #ifdef HAVE_COREFOUNDATION /* |
︙ | ︙ |
Changes to unix/tkUnixInt.h.
1 2 3 4 5 6 | /* * tkUnixInt.h -- * * This file contains declarations that are shared among the * UNIX-specific parts of Tk but aren't used by the rest of 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 | /* * tkUnixInt.h -- * * This file contains declarations that are shared among the * UNIX-specific parts of Tk but aren't used by the rest 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. */ #ifndef _TKUNIXINT #define _TKUNIXINT #ifndef _TKINT #include "tkInt.h" #endif /* * 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" |
︙ | ︙ | |||
96 97 98 99 100 101 102 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { Tcl_Size len; Tcl_DString buf; TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr; /* * If we have the value cached already, use it now. [Bug 1373712] */ |
︙ | ︙ | |||
129 130 131 132 133 134 135 | #ifdef TK_USE_INPUT_METHODS if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) && (winPtr->inputContext != NULL)) { Status status; #if X_HAVE_UTF8_STRING Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-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 | #ifdef TK_USE_INPUT_METHODS if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) && (winPtr->inputContext != NULL)) { Status status; #if X_HAVE_UTF8_STRING Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1); len = (Tcl_Size)Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(dsPtr), (int)Tcl_DStringLength(dsPtr), &kePtr->keysym, &status); if (status == XBufferOverflow) { /* * Expand buffer and try again. */ Tcl_DStringSetLength(dsPtr, len); len =(Tcl_Size) Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(dsPtr), (int)Tcl_DStringLength(dsPtr), &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; } Tcl_DStringSetLength(dsPtr, len); #else /* !X_HAVE_UTF8_STRING */ |
︙ | ︙ | |||
187 188 189 190 191 192 193 | * * Note: XLookupString() normally returns a single ISO Latin 1 or * ASCII control character. */ Tcl_DStringInit(&buf); Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); | | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | * * Note: XLookupString() normally returns a single ISO Latin 1 or * ASCII control character. */ Tcl_DStringInit(&buf); Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); len = (Tcl_Size)XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf), TCL_DSTRING_STATIC_SIZE, &kePtr->keysym, 0); Tcl_DStringValue(&buf)[len] = '\0'; if (len == 1) { len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0], Tcl_DStringValue(dsPtr)); Tcl_DStringSetLength(dsPtr, len); } else { /* * len > 1 should only happen if someone has called XRebindKeysym. * Assume UTF-8. */ |
︙ | ︙ | |||
417 418 419 420 421 422 423 | TkpInitKeymapInfo( TkDisplay *dispPtr) /* Display for which to recompute keymap * information. */ { XModifierKeymap *modMapPtr; KeyCode *codePtr; KeySym keysym; | | > | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | TkpInitKeymapInfo( TkDisplay *dispPtr) /* Display for which to recompute keymap * information. */ { XModifierKeymap *modMapPtr; KeyCode *codePtr; KeySym keysym; int count, i, max; Tcl_Size j, arraySize; #define KEYCODE_ARRAY_SIZE 20 dispPtr->bindInfoStale = 0; modMapPtr = XGetModifierMapping(dispPtr->display); /* * Check the keycodes associated with the Lock modifier. If any of them is |
︙ | ︙ |
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. */ |
︙ | ︙ | |||
316 317 318 319 320 321 322 | * None. * *---------------------------------------------------------------------- */ static void GetMenuIndicatorGeometry( | | | | | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | * None. * *---------------------------------------------------------------------- */ static void GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are drawing. */ TkMenuEntry *mePtr, /* The entry we are interested in. */ TCL_UNUSED(Tk_Font), /* The precalculated font */ TCL_UNUSED(const Tk_FontMetrics *), /* The precalculated metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { int borderWidth; if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { if (!mePtr->hideMargin && mePtr->indicatorOn) { if ((mePtr->image != NULL) || (mePtr->bitmapPtr != NULL)) { |
︙ | ︙ | |||
387 388 389 390 391 392 393 394 395 | TkMenu *menuPtr, /* The menu was are drawing */ TkMenuEntry *mePtr, /* The entry we are getting the geometry for */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The width of the acclerator area */ int *heightPtr) /* The height of the accelerator area */ { *heightPtr = fmPtr->linespace; if (mePtr->type == CASCADE_ENTRY) { | > > | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | TkMenu *menuPtr, /* The menu was are drawing */ TkMenuEntry *mePtr, /* The entry we are getting the geometry for */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The width of the acclerator area */ int *heightPtr) /* The height of the accelerator area */ { double scalingLevel = TkScalingLevel(menuPtr->tkwin); *heightPtr = fmPtr->linespace; if (mePtr->type == CASCADE_ENTRY) { *widthPtr = 2 * CASCADE_ARROW_WIDTH * scalingLevel; } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) { const char *accel = Tcl_GetString(mePtr->accelPtr); *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength); } else { *widthPtr = 0; } |
︙ | ︙ | |||
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | int y, /* Top coordinate of entry rect */ int width, /* Width of entry */ int height, /* Height of entry */ int drawArrow) /* Whether or not to draw arrow. */ { XPoint points[3]; int borderWidth, activeBorderWidth; /* * Draw accelerator or cascade arrow. */ if (menuPtr->menuType == MENUBAR) { return; } Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); if ((mePtr->type == CASCADE_ENTRY) && drawArrow) { | > > > > > | < | | | | | | | 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 | int y, /* Top coordinate of entry rect */ int width, /* Width of entry */ int height, /* Height of entry */ int drawArrow) /* Whether or not to draw arrow. */ { XPoint points[3]; int borderWidth, activeBorderWidth; int arrowWidth = CASCADE_ARROW_WIDTH, arrowHeight = CASCADE_ARROW_HEIGHT; double scalingLevel = TkScalingLevel(menuPtr->tkwin); /* * Draw accelerator or cascade arrow. */ if (menuPtr->menuType == MENUBAR) { return; } Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); if ((mePtr->type == CASCADE_ENTRY) && drawArrow) { arrowWidth *= scalingLevel; arrowHeight *= scalingLevel; points[0].x = x + width - borderWidth - activeBorderWidth - arrowWidth; points[0].y = y + (height - arrowHeight)/2; points[1].x = points[0].x; points[1].y = points[0].y + arrowHeight; points[2].x = points[0].x + arrowWidth; points[2].y = points[0].y + arrowHeight/2; Tk_Fill3DPolygon(menuPtr->tkwin, d, (mePtr->state == ENTRY_ACTIVE) ? activeBorder : bgBorder, points, 3, DECORATION_BORDER_WIDTH, (menuPtr->postedCascade == mePtr) ? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED); } else if (mePtr->accelPtr != NULL) { const char *accel = Tcl_GetString(mePtr->accelPtr); int left = x + mePtr->labelWidth + activeBorderWidth + mePtr->indicatorSpace; if (menuPtr->menuType == MENUBAR) { left += 5; |
︙ | ︙ | |||
542 543 544 545 546 547 548 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawMenuEntryIndicator( | | | | | | | | | | | | 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 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawMenuEntryIndicator( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* The drawable to draw into */ Tk_3DBorder border, /* The background color */ XColor *indicatorColor, /* The color to draw indicators with */ XColor *disableColor, /* The color use use when disabled */ TCL_UNUSED(Tk_Font), /* The font to draw with */ TCL_UNUSED(const Tk_FontMetrics *), /* The font metrics of the font */ int x, /* The left of the entry rect */ int y, /* The top of the entry rect */ TCL_UNUSED(int), /* Width of menu entry */ int height) /* Height of menu entry */ { /* * Draw check-button indicator. */ if ((mePtr->type == CHECK_BUTTON_ENTRY) && mePtr->indicatorOn) { int top, left, activeBorderWidth; |
︙ | ︙ | |||
616 617 618 619 620 621 622 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawMenuSeparator( | | | | | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawMenuSeparator( TkMenu *menuPtr, /* The menu we are drawing */ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are using */ TCL_UNUSED(GC), /* The gc to draw into */ TCL_UNUSED(Tk_Font), /* The font to draw with */ TCL_UNUSED(const Tk_FontMetrics *), /* The font metrics from the font */ int x, int y, int width, int height) { XPoint points[2]; Tk_3DBorder border; if (menuPtr->menuType == MENUBAR) { return; |
︙ | ︙ | |||
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) { | | | | | | 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 | 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 + Tcl_UtfToUniChar(start, &ch); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); leftEdge = x + mePtr->indicatorSpace + activeBorderWidth; if (menuPtr->menuType == MENUBAR) { leftEdge += 5; } |
︙ | ︙ | |||
896 897 898 899 900 901 902 | *---------------------------------------------------------------------- */ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, | | | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | *---------------------------------------------------------------------- */ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, Tcl_Size index) { return TkpPostTearoffMenu(interp, menuPtr, x, y, index); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
924 925 926 927 928 929 930 | * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( | | | < < < < < < < | > > > > > > > > > > > > | 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 | * 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, Tcl_Size index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); 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 >= 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 |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | */ static void GetMenuSeparatorGeometry( TCL_UNUSED(TkMenu *), /* The menu we are measuring */ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ TCL_UNUSED(Tk_Font), /* The precalculated font */ | | | | | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | */ static void GetMenuSeparatorGeometry( TCL_UNUSED(TkMenu *), /* The menu we are measuring */ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ TCL_UNUSED(Tk_Font), /* The precalculated font */ const Tk_FontMetrics *fmPtr, /* The precalcualted font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { *widthPtr = 0; *heightPtr = fmPtr->linespace; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1043 1044 1045 1046 1047 1048 1049 | * None. * *---------------------------------------------------------------------- */ static void GetTearoffEntryGeometry( | | | | | | | 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | * None. * *---------------------------------------------------------------------- */ static void GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are drawing */ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr, /* The precalculated font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; *widthPtr = 0; } else { *heightPtr = fmPtr->linespace; *widthPtr = Tk_TextWidth(tkfont, "W", 1); |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | void TkpComputeMenubarGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; | | > | | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | void TkpComputeMenubarGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int width, height, x, y, currentRowHeight, maxWidth; Tcl_Size i, j, lastRowBreak; int maxWindowWidth, lastEntry; int activeBorderWidth, helpMenuIndex = -1; TkMenuEntry *mePtr; if (menuPtr->tkwin == NULL) { return; } |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); | | | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); for (i = 0; i < menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; mePtr->entryFlags &= ~ENTRY_LAST_COLUMN; if (mePtr->fontPtr != NULL) { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); fmPtr = &entryMetrics; } else { |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | lastEntry--; } if ((lastEntry >= 0) && (x + menuPtr->entries[lastEntry]->width + borderWidth > maxWidth)) { maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth; } x = borderWidth; | | | 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | lastEntry--; } if ((lastEntry >= 0) && (x + menuPtr->entries[lastEntry]->width + borderWidth > maxWidth)) { maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth; } x = borderWidth; for (j = lastRowBreak; j < menuPtr->numEntries; j++) { if (j == helpMenuIndex) { continue; } menuPtr->entries[j]->y = y + currentRowHeight - menuPtr->entries[j]->height; menuPtr->entries[j]->x = x; x += menuPtr->entries[j]->width; |
︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawTearoffEntry( | | | | | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | * Commands are output to X to display the menu in its current mode. * *---------------------------------------------------------------------- */ static void DrawTearoffEntry( TkMenu *menuPtr, /* The menu we are drawing */ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are drawing into */ TCL_UNUSED(GC), /* The gc we are drawing with */ TCL_UNUSED(Tk_Font), /* The font we are drawing with */ TCL_UNUSED(const Tk_FontMetrics *), /* The metrics we are drawing with */ int x, int y, int width, int height) { XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; |
︙ | ︙ | |||
1316 1317 1318 1319 1320 1321 1322 | * *-------------------------------------------------------------- */ void TkpInitializeMenuBindings( TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ | | < | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | * *-------------------------------------------------------------- */ void TkpInitializeMenuBindings( TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { /* * Nothing to do. */ } /* |
︙ | ︙ | |||
1671 1672 1673 1674 1675 1676 1677 | void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int x, y, height, width, indicatorSpace, labelWidth, accelWidth; | | > | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 | void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int x, y, height, width, indicatorSpace, labelWidth, accelWidth; int windowWidth, windowHeight, accelSpace; Tcl_Size i, j, lastColumnBreak = 0; TkMenuEntry *mePtr; int borderWidth, activeBorderWidth; if (menuPtr->tkwin == NULL) { return; } |
︙ | ︙ | |||
1701 1702 1703 1704 1705 1706 1707 | * and give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); | | | 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 | * and give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); for (i = 0; i < menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->fontPtr == NULL) { tkfont = menuFont; fmPtr = &menuMetrics; } else { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } | | | 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } for (j = lastColumnBreak; j < menuPtr->numEntries; j++) { menuPtr->entries[j]->indicatorSpace = indicatorSpace; menuPtr->entries[j]->labelWidth = labelWidth; menuPtr->entries[j]->width = indicatorSpace + labelWidth + accelWidth + 2 * activeBorderWidth; menuPtr->entries[j]->x = x; menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN; } |
︙ | ︙ |
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" |
︙ | ︙ | |||
52 53 54 55 56 57 58 | * mode. * *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * mode. * *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( void *clientData) /* Information about widget. */ { TkMenuButton *mbPtr = (TkMenuButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization needed only to stop compiler * warning. */ |
︙ | ︙ | |||
313 314 315 316 317 318 319 | * Restores the default control state. * *---------------------------------------------------------------------- */ void TkpDestroyMenuButton( | | < | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | * Restores the default control state. * *---------------------------------------------------------------------- */ void TkpDestroyMenuButton( TCL_UNUSED(TkMenuButton *)) { } /* *---------------------------------------------------------------------- * * TkpComputeMenuButtonGeometry -- * |
︙ | ︙ | |||
365 366 367 368 369 370 371 | haveImage = 1; } if (haveImage == 0 || mbPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(mbPtr->textLayout); mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text, | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | haveImage = 1; } if (haveImage == 0 || mbPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(mbPtr->textLayout); mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text, TCL_INDEX_NONE, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth, &mbPtr->textHeight); txtWidth = mbPtr->textWidth; txtHeight = mbPtr->textHeight; avgWidth = Tk_TextWidth(mbPtr->tkfont, "0", 1); Tk_GetFontMetrics(mbPtr->tkfont, &fm); haveText = (txtWidth != 0 && txtHeight != 0); } |
︙ | ︙ |
Changes to unix/tkUnixPort.h.
1 2 3 4 5 6 7 | /* * tkUnixPort.h -- * * This file is included by all of the Tk C files. It contains * information that may be configuration-dependent, such as * #includes for system include files and a few other things. * | | | < < < < < | < < < | | < | 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 | /* * tkUnixPort.h -- * * This file is included by all of the Tk C files. It contains * information that may be configuration-dependent, such as * #includes for system include files and a few other things. * * Copyright © 1991-1993 The Regents of the University of California. * Copyright © 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. */ #ifndef _UNIXPORT #define _UNIXPORT #define __UNIX__ 1 #include <stdio.h> #include <pwd.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <ctype.h> #include <math.h> #include <string.h> #include <limits.h> #include <sys/types.h> #include <sys/file.h> #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> #include <inttypes.h> #include <unistd.h> #if defined(__GNUC__) && !defined(__cplusplus) # pragma GCC diagnostic ignored "-Wc++-compat" #endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> |
︙ | ︙ | |||
150 151 152 153 154 155 156 | #define TkpButtonSetDefaults() {} #define TkpDestroyButton(butPtr) {} #define TkSelUpdateClipboard(a,b) {} #ifndef __CYGWIN__ #define TkSetPixmapColormap(p,c) {} #endif | < < < < < < < < < | < < < < < < | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | #define TkpButtonSetDefaults() {} #define TkpDestroyButton(butPtr) {} #define TkSelUpdateClipboard(a,b) {} #ifndef __CYGWIN__ #define TkSetPixmapColormap(p,c) {} #endif /* * 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) \ snprintf((buf), TCL_INTEGER_SPACE, "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 64 65 66 67 68 69 70 71 72 73 74 75 76 | * 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 * initializes all the structures that are used by the * platform-dependant code on a per application basis. * Note that this is called before TkpInit() ! * * Results: * None. * * Side effects: * None. * *------------------------------------------------------------------------- */ | > > > > < | | | < | 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 | * 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 * initializes all the structures that are used by the * platform-dependant code on a per application basis. * Note that this is called before TkpInit() ! * * Results: * None. * * Side effects: * None. * *------------------------------------------------------------------------- */ static Tcl_Size utf8ToUcs4(const char *source, FcChar32 *c, Tcl_Size numBytes) { if (numBytes >= 6) { return Tcl_UtfToUniChar(source, (int *)c); } return FcUtf8ToUcs4((const FcChar8 *)source, c, numBytes); } void TkpFontPkgInit( TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { } static XftFont * GetFont( UnixFtFont *fontPtr, FcChar32 ucs4, double angle) |
︙ | ︙ | |||
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 | 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); } /* *--------------------------------------------------------------------------- * * GetTkFontAttributes -- * Fill in TkFontAttributes from an XftFont. */ static void GetTkFontAttributes( XftFont *ftFont, TkFontAttributes *faPtr) { const char *family = "Unknown"; const char *const *familyPtr = &family; int weight, slant, pxsize; double size, ptsize; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); | > > > > > > > | | | | | 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 | 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); } /* *--------------------------------------------------------------------------- * * GetTkFontAttributes -- * Fill in TkFontAttributes from an XftFont. */ static void GetTkFontAttributes( Tk_Window tkwin, XftFont *ftFont, TkFontAttributes *faPtr) { const char *family = "Unknown"; const char *const *familyPtr = &family; int weight, slant, pxsize; double size, ptsize; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, &ptsize) == XftResultMatch) { size = -ptsize; } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { size = (double)-pxsize; } else { size = 12.0; } if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0, |
︙ | ︙ | |||
210 211 212 213 214 215 216 | #ifdef DEBUG_FONTSEL printf("family %s size %d weight %d slant %d\n", family, (int)size, weight, slant); #endif /* DEBUG_FONTSEL */ faPtr->family = Tk_GetUid(family); | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | #ifdef DEBUG_FONTSEL printf("family %s size %d weight %d slant %d\n", family, (int)size, weight, slant); #endif /* DEBUG_FONTSEL */ faPtr->family = Tk_GetUid(family); faPtr->size = TkFontGetPoints(tkwin, size); faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN; faPtr->underline = 0; faPtr->overstrike = 0; } /* |
︙ | ︙ | |||
262 263 264 265 266 267 268 | static void FinishedWithFont( UnixFtFont *fontPtr); static int InitFontErrorProc( | | | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | static void FinishedWithFont( UnixFtFont *fontPtr); static int InitFontErrorProc( void *clientData, TCL_UNUSED(XErrorEvent *)) { int *errorFlagPtr = (int *)clientData; if (errorFlagPtr != NULL) { *errorFlagPtr = 1; } |
︙ | ︙ | |||
337 338 339 340 341 342 343 | /* * Fill in platform-specific fields of TkFont. */ errorFlag = 0; handler = Tk_CreateErrorHandler(Tk_Display(tkwin), | | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | /* * Fill in platform-specific fields of TkFont. */ errorFlag = 0; handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1, InitFontErrorProc, (void *) &errorFlag); ftFont = GetFont(fontPtr, 0, 0.0); if ((ftFont == NULL) || errorFlag) { Tk_DeleteErrorHandler(handler); FinishedWithFont(fontPtr); ckfree(fontPtr); return NULL; } fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed"); GetTkFontAttributes(tkwin, ftFont, &fontPtr->font.fa); GetTkFontMetrics(ftFont, &fontPtr->font.fm); Tk_DeleteErrorHandler(handler); if (errorFlag) { FinishedWithFont(fontPtr); ckfree(fontPtr); return NULL; } |
︙ | ︙ | |||
379 380 381 382 383 384 385 | */ { TkFont *fPtr = &fontPtr->font; fPtr->underlinePos = fPtr->fm.descent / 2; handler = Tk_CreateErrorHandler(Tk_Display(tkwin), | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | */ { TkFont *fPtr = &fontPtr->font; fPtr->underlinePos = fPtr->fm.descent / 2; handler = Tk_CreateErrorHandler(Tk_Display(tkwin), -1, -1, -1, InitFontErrorProc, (void *) &errorFlag); errorFlag = 0; Tk_MeasureChars((Tk_Font) fPtr, "I", 1, -1, 0, &iWidth); Tk_DeleteErrorHandler(handler); if (errorFlag) { FinishedWithFont(fontPtr); ckfree(fontPtr); return NULL; |
︙ | ︙ | |||
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); | > > > > | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | 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); |
︙ | ︙ | |||
489 490 491 492 493 494 495 | { XftPattern *pattern; int weight, slant; UnixFtFont *fontPtr; #ifdef DEBUG_FONTSEL printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family, | | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | { XftPattern *pattern; int weight, slant; UnixFtFont *fontPtr; #ifdef DEBUG_FONTSEL printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family, (int)faPtr->size, faPtr->weight, faPtr->slant); #endif /* DEBUG_FONTSEL */ pattern = XftPatternCreate(); if (faPtr->family) { XftPatternAddString(pattern, XFT_FAMILY, faPtr->family); } if (faPtr->size > 0.0) { XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size); } else if (faPtr->size < 0.0) { XftPatternAddDouble(pattern, XFT_PIXEL_SIZE, -faPtr->size); } else { XftPatternAddDouble(pattern, XFT_SIZE, 12.0); } switch (faPtr->weight) { case TK_FW_NORMAL: default: weight = XFT_WEIGHT_MEDIUM; |
︙ | ︙ | |||
597 598 599 600 601 602 603 | (char *) 0, /* pattern elements */ XFT_FAMILY, (char*) 0); /* fields */ for (i = 0; i < list->nfont; i++) { char *family, **familyPtr = &family; if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr) == XftResultMatch) { | | | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | (char *) 0, /* pattern elements */ XFT_FAMILY, (char*) 0); /* fields */ for (i = 0; i < list->nfont; i++) { char *family, **familyPtr = &family; if (XftPatternGetString(list->fonts[i], XFT_FAMILY, 0, familyPtr) == XftResultMatch) { Tcl_Obj *strPtr = Tcl_NewStringObj(family, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } } XftFontSetDestroy(list); Tcl_SetObjResult(interp, resultPtr); |
︙ | ︙ | |||
645 646 647 648 649 650 651 | for (i = 0; i < fontPtr->nfaces ; ++i) { pattern = FcFontRenderPrepare(0, fontPtr->pattern, fontPtr->faces[i].source); XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr); XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr); XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr); | | | | | | | | 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 | for (i = 0; i < fontPtr->nfaces ; ++i) { pattern = FcFontRenderPrepare(0, fontPtr->pattern, fontPtr->faces[i].source); XftPatternGetString(pattern, XFT_FAMILY, 0, familyPtr); XftPatternGetString(pattern, XFT_FOUNDRY, 0, foundryPtr); XftPatternGetString(pattern, XFT_ENCODING, 0, encodingPtr); objv[0] = Tcl_NewStringObj(family, TCL_INDEX_NONE); objv[1] = Tcl_NewStringObj(foundry, TCL_INDEX_NONE); objv[2] = Tcl_NewStringObj(encoding, TCL_INDEX_NONE); listPtr = Tcl_NewListObj(3, objv); Tcl_ListObjAppendElement(NULL, resultPtr, listPtr); } Tcl_SetObjResult(interp, resultPtr); } /* *---------------------------------------------------------------------- * * TkpGetFontAttrsForChar -- * * Retrieve the font attributes of the actual font used to render a given * character. * *---------------------------------------------------------------------- */ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { UnixFtFont *fontPtr = (UnixFtFont *) tkfont; /* Structure describing the logical font */ FcChar32 ucs4 = (FcChar32) c; /* UCS-4 character to map */ XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); /* Actual font used to render the character */ GetTkFontAttributes(tkwin, ftFont, faPtr); faPtr->underline = fontPtr->font.fa.underline; faPtr->overstrike = fontPtr->font.fa.overstrike; } int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ Tcl_Size numBytes, /* Maximum number of bytes to consider from * source string. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length in pixels; don't * consider any character that would cross * this x-position. If < 0, then line length * is unbounded and the flags argument is * ignored. */ |
︙ | ︙ | |||
711 712 713 714 715 716 717 | int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { UnixFtFont *fontPtr = (UnixFtFont *) tkfont; XftFont *ftFont; FcChar32 c; XGlyphInfo extents; | > | | < | > > | 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 | int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { UnixFtFont *fontPtr = (UnixFtFont *) tkfont; XftFont *ftFont; FcChar32 c; XGlyphInfo extents; Tcl_Size clen; int curX, newX, curByte, newByte, sawNonSpace; int termByte = 0, termX = 0, errorFlag = 0; Tk_ErrorHandler handler; #ifdef DEBUG_FONTSEL char string[256]; int len = 0; #endif /* DEBUG_FONTSEL */ handler = Tk_CreateErrorHandler(fontPtr->display, -1, -1, -1, InitFontErrorProc, &errorFlag); curX = 0; curByte = 0; sawNonSpace = 0; while (numBytes > 0) { int unichar; clen = Tcl_UtfToUniChar(source, &unichar); c = (FcChar32) unichar; if (clen <= 0) { /* * This can't happen (but see #1185640) */ goto measureCharsEnd; } source += clen; numBytes -= clen; if (c < 256 && isspace(c)) { /* I18N: ??? */ if (sawNonSpace) { termByte = curByte; termX = curX; sawNonSpace = 0; } } else { sawNonSpace = 1; } #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; |
︙ | ︙ | |||
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | } break; } curX = newX; curByte = newByte; } Tk_DeleteErrorHandler(handler); #ifdef DEBUG_FONTSEL string[len] = '\0'; printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte); #endif /* DEBUG_FONTSEL */ *lengthPtr = curX; return curByte; } int TkpMeasureCharsInContext( Tk_Font tkfont, const char *source, | > | | | < < | 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 | } break; } curX = newX; curByte = newByte; } measureCharsEnd: Tk_DeleteErrorHandler(handler); #ifdef DEBUG_FONTSEL string[len] = '\0'; printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte); #endif /* DEBUG_FONTSEL */ *lengthPtr = curX; return curByte; } int TkpMeasureCharsInContext( Tk_Font tkfont, const char *source, TCL_UNUSED(Tcl_Size), Tcl_Size rangeStart, Tcl_Size rangeLength, int maxLength, int flags, int *lengthPtr) { return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength, maxLength, flags, lengthPtr); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
915 916 917 918 919 920 921 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | 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 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */ const int minCoord = -maxCoord-1; UnixFtFont *fontPtr = (UnixFtFont *) tkfont; XGCValues values; XftColor *xftcolor; int clen, nspec, xStart = x; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (fontPtr->ftDraw == 0) { #ifdef DEBUG_FONTSEL printf("Switch to drawable 0x%lx\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), DefaultColormap(display, fontPtr->screen)); } else { Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL); |
︙ | ︙ | |||
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) { | > > > > > > | 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 | } 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) { |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) /* What angle to put text at, in degrees. */ { const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */ const int minCoord = -maxCoord-1; UnixFtFont *fontPtr = (UnixFtFont *) tkfont; |
︙ | ︙ | |||
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) { | > > > | 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | /* * 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 | * 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 */ | > > > > > > > | | | 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 | * 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 */ Tcl_Size clen; int nspec; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); if (fontPtr->ftDraw == 0) { #ifdef DEBUG_FONTSEL printf("Switch to drawable 0x%lx\n", drawable); #endif /* DEBUG_FONTSEL */ fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), DefaultColormap(display, fontPtr->screen)); } else { Tk_ErrorHandler handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL); |
︙ | ︙ | |||
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); } | > > > > > > | 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 | 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); } |
︙ | ︙ | |||
1336 1337 1338 1339 1340 1341 1342 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | < < | | | < < | 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 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size 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. */ { int widthUntilStart; Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart, rangeLength, x+widthUntilStart, y); } void TkpDrawAngledCharsInContext( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size rangeLength, /* Length of range to draw in bytes. */ double x, double y, /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ double angle) /* What angle to put text at, in degrees. */ { int widthUntilStart; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart, rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle); } void TkUnixSetXftClipRegion( |
︙ | ︙ |
Changes to unix/tkUnixScale.c.
1 2 3 | /* * tkUnixScale.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 | /* * tkUnixScale.c -- * * This file implements the X specific portion of the scale 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" #ifdef _WIN32 #include "tkWinInt.h" #endif /* * Forward declarations for functions defined later in this file: */ static void DisplayHorizontalScale(TkScale *scalePtr, |
︙ | ︙ | |||
264 265 266 267 268 269 270 | * specified in application coords, not in * pixels (we'll compute pixels). */ int rightEdge, /* X-coordinate of right edge of text, * specified in pixels. */ const char *format) /* Format string to use for the value */ { Tk_Window tkwin = scalePtr->tkwin; | | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | * specified in application coords, not in * pixels (we'll compute pixels). */ int rightEdge, /* X-coordinate of right edge of text, * specified in pixels. */ const char *format) /* Format string to use for the value */ { Tk_Window tkwin = scalePtr->tkwin; int y, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2; if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_Size length = strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the y-coordinate if necessary to keep the text entirely inside * the window. */ |
︙ | ︙ | |||
487 488 489 490 491 492 493 | * specified in application coords, not in * pixels (we'll compute pixels). */ int top, /* Y-coordinate of top edge of text, specified * in pixels. */ const char *format) /* Format string to use for the value */ { Tk_Window tkwin = scalePtr->tkwin; | | | | 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 | * specified in application coords, not in * pixels (we'll compute pixels). */ int top, /* Y-coordinate of top edge of text, specified * in pixels. */ const char *format) /* Format string to use for the value */ { Tk_Window tkwin = scalePtr->tkwin; int x, y, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = top + fm.ascent; if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_Size length = strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the x-coordinate if necessary to keep the text entirely inside * the window. */ |
︙ | ︙ | |||
540 541 542 543 544 545 546 | * The scale gets redisplayed. * *---------------------------------------------------------------------- */ void TkpDisplayScale( | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | * The scale gets redisplayed. * *---------------------------------------------------------------------- */ void TkpDisplayScale( void *clientData) /* Widget record for scale. */ { TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; int result; char string[TCL_DOUBLE_SPACE]; |
︙ | ︙ | |||
568 569 570 571 572 573 574 | if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); | | | | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command executed by scale)"); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); } |
︙ | ︙ |
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" |
︙ | ︙ | |||
91 92 93 94 95 96 97 | * Information appears on the screen. * *-------------------------------------------------------------- */ void TkpDisplayScrollbar( | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | * Information appears on the screen. * *-------------------------------------------------------------- */ void TkpDisplayScrollbar( void *clientData) /* Information about window. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; int relief, width, elementBorderWidth; Pixmap pixmap; |
︙ | ︙ |
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" |
︙ | ︙ | |||
86 87 88 89 90 91 92 | /* * Forward declarations for functions defined in this file: */ static void ConvertSelection(TkWindow *winPtr, XSelectionRequestEvent *eventPtr); | | | | | | | | 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 | /* * Forward declarations for functions defined in this file: */ static void ConvertSelection(TkWindow *winPtr, XSelectionRequestEvent *eventPtr); static void IncrTimeoutProc(void *clientData); static void SelCvtFromX32(long *propPtr, unsigned long numValues, Atom type, Tk_Window tkwin, Tcl_DString *dsPtr); static void SelCvtFromX8(char *propPtr, unsigned long numValues, Atom type, Tk_Window tkwin, Tcl_DString *dsPtr); static long * SelCvtToX(char *string, Atom type, Tk_Window tkwin, Tcl_Size *numLongsPtr); static int SelectionSize(TkSelHandler *selPtr); static void SelRcvIncrProc(void *clientData, XEvent *eventPtr); static void SelTimeoutProc(void *clientData); /* *---------------------------------------------------------------------- * * TkSelGetSelection -- * * Retrieve the specified selection from another process. |
︙ | ︙ | |||
127 128 129 130 131 132 133 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Function to call to process the selection, * once it has been retrieved. */ | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Function to call to process the selection, * once it has been retrieved. */ void *clientData) /* Arbitrary value to pass to proc. */ { TkSelRetrievalInfo retr; TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; /* * The selection is owned by some other process. To retrieve it, first |
︙ | ︙ | |||
240 241 242 243 244 245 246 | void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { IncrInfo *incrPtr; TkSelHandler *selPtr; | | > | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { IncrInfo *incrPtr; TkSelHandler *selPtr; int length; Tcl_Size numItems; unsigned long i; Atom target, formatType; long buffer[TK_SEL_WORDS_AT_ONCE]; TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display); Tk_ErrorHandler errorHandler; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
341 342 343 344 345 346 347 | if (ip.selPtr == NULL) { /* * The selection handler deleted itself. */ return; } | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | if (ip.selPtr == NULL) { /* * The selection handler deleted itself. */ return; } if (numItems == TCL_INDEX_NONE) { numItems = 0; } numItems += length; if (numItems > TK_SEL_BYTES_AT_ONCE) { Tcl_Panic("selection handler returned too many bytes"); } } |
︙ | ︙ | |||
372 373 374 375 376 377 378 | Tcl_Encoding encoding; /* * Set up the encoding state based on the format and whether * this is the first and/or last chunk. */ | | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | Tcl_Encoding encoding; /* * Set up the encoding state based on the format and whether * this is the first and/or last chunk. */ encodingCvtFlags = TCL_ENCODING_PROFILE_TCL8; if (incrPtr->converts[i].offset == 0) { encodingCvtFlags |= TCL_ENCODING_START; } if (numItems < TK_SEL_BYTES_AT_ONCE) { encodingCvtFlags |= TCL_ENCODING_END; } if (formatType == XA_STRING) { |
︙ | ︙ | |||
475 476 477 478 479 480 481 | /* * Compute the next offset value. If this was the last chunk, then * set the offset to -2. If this was an empty chunk, then set the * offset to -1 to indicate we are done. */ if (numItems < TK_SEL_BYTES_AT_ONCE) { | | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | /* * Compute the next offset value. If this was the last chunk, then * set the offset to -2. If this was an empty chunk, then set the * offset to -1 to indicate we are done. */ if (numItems < TK_SEL_BYTES_AT_ONCE) { if (numItems < 1) { incrPtr->converts[i].offset = -1; incrPtr->numIncrs--; } else { incrPtr->converts[i].offset = -2; } } else { /* |
︙ | ︙ | |||
577 578 579 580 581 582 583 | &type, &format, &numItems, &bytesAfter, (unsigned char **) propInfoPtr); if ((result != Success) || (type == None)) { return; } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | &type, &format, &numItems, &bytesAfter, (unsigned char **) propInfoPtr); if ((result != Success) || (type == None)) { return; } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( "selection property too large", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE",NULL); retrPtr->result = TCL_ERROR; XFree(propInfo); return; } if ((type == XA_STRING) || (type == dispPtr->textAtom) || (type == dispPtr->compoundTextAtom)) { |
︙ | ︙ | |||
616 617 618 619 620 621 622 | */ if (type == dispPtr->compoundTextAtom) { encoding = Tcl_GetEncoding(NULL, "iso2022"); } else { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } | | | < | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | */ if (type == dispPtr->compoundTextAtom) { encoding = Tcl_GetEncoding(NULL, "iso2022"); } else { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } char *str = Tcl_ExternalToUtfDString(encoding, propInfo, numItems, &ds); if (encoding) { Tcl_FreeEncoding(encoding); } retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, str); Tcl_DStringFree(&ds); Tcl_Release(interp); } else if (type == dispPtr->utf8Atom) { /* * The X selection data is in UTF-8 format already. We can't * guarantee that propInfo is NULL-terminated, so we might have to * copy the string. |
︙ | ︙ | |||
686 687 688 689 690 691 692 | Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT", NULL); retrPtr->result = TCL_ERROR; return; } Tcl_DStringInit(&ds); if (format == 32) { | | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT", NULL); retrPtr->result = TCL_ERROR; return; } Tcl_DStringInit(&ds); if (format == 32) { SelCvtFromX32((long *) propInfo, numItems, type, (Tk_Window) winPtr, &ds); } else { SelCvtFromX8((char *) propInfo, numItems, type, (Tk_Window) winPtr, &ds); } interp = retrPtr->interp; Tcl_Preserve(interp); retrPtr->result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(&ds)); Tcl_Release(interp); |
︙ | ︙ | |||
736 737 738 739 740 741 742 | * retrieval. * *---------------------------------------------------------------------- */ static void SelTimeoutProc( | | | | 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 | * retrieval. * *---------------------------------------------------------------------- */ static void SelTimeoutProc( void *clientData) /* Information about retrieval in progress. */ { TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; /* * Make sure that the retrieval is still in progress. Then see how long * it's been since any sort of response was received from the other side. */ if (retrPtr->result != -1) { return; } retrPtr->idleTime++; if (retrPtr->idleTime >= 5) { /* * Use a careful function to store the error message, because the * result could already be partially filled in with a partial * selection return. */ Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( "selection owner didn't respond", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "IGNORED", NULL); retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, retrPtr); } } |
︙ | ︙ | |||
875 876 877 878 879 880 881 | eventPtr->property, 0, MAX_PROP_WORDS, False, winPtr->dispPtr->atomPairAtom, &type, &format, &incr.numConversions, &bytesAfter, (unsigned char **) multAtomsPtr); if ((result != Success) || (bytesAfter != 0) || (format != 32) || (type == None)) { if (incr.multAtoms != NULL) { | | > | | 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 | eventPtr->property, 0, MAX_PROP_WORDS, False, winPtr->dispPtr->atomPairAtom, &type, &format, &incr.numConversions, &bytesAfter, (unsigned char **) multAtomsPtr); if ((result != Success) || (bytesAfter != 0) || (format != 32) || (type == None)) { if (incr.multAtoms != NULL) { XFree(incr.multAtoms); } goto refuse; } incr.numConversions /= 2; /* Two atoms per conversion. */ } /* * Loop through all of the requested conversions, and either return the * entire converted selection, if it can be returned in a single bunch, or * return INCR information only (the actual selection will be returned * below). */ incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo)); incr.numIncrs = 0; for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; long buffer[TK_SEL_WORDS_AT_ONCE]; TkSelHandler *selPtr; Tcl_Size numItems; int format; char *propPtr; target = incr.multAtoms[2*i]; property = incr.multAtoms[2*i + 1]; incr.converts[i].offset = -1; incr.converts[i].buffer[0] = '\0'; |
︙ | ︙ | |||
920 921 922 923 924 925 926 | * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark * the request as an error. */ numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer, TK_SEL_BYTES_AT_ONCE, &type); | | | | 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 | * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark * the request as an error. */ numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer, TK_SEL_BYTES_AT_ONCE, &type); if (numItems == TCL_INDEX_NONE) { incr.multAtoms[2*i + 1] = None; continue; } } else { ip.selPtr = selPtr; ip.nextPtr = TkSelGetInProgress(); TkSelSetInProgress(&ip); type = selPtr->format; numItems = selPtr->proc(selPtr->clientData, 0, (char *) buffer, TK_SEL_BYTES_AT_ONCE); TkSelSetInProgress(ip.nextPtr); if ((ip.selPtr == NULL) || (numItems == TCL_INDEX_NONE)) { incr.multAtoms[2*i + 1] = None; continue; } if (numItems > TK_SEL_BYTES_AT_ONCE) { Tcl_Panic("selection handler returned too many bytes"); } ((char *) buffer)[numItems] = '\0'; |
︙ | ︙ | |||
991 992 993 994 995 996 997 | */ if (type == XA_STRING) { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } else { encoding = Tcl_GetEncoding(NULL, "iso2022"); } | | > | < | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | */ if (type == XA_STRING) { encoding = Tcl_GetEncoding(NULL, "iso8859-1"); } else { encoding = Tcl_GetEncoding(NULL, "iso2022"); } unsigned char *str = (unsigned char *)Tcl_UtfToExternalDString(encoding, (char *) buffer, TCL_INDEX_NONE, &ds); XChangeProperty(reply.xsel.display, reply.xsel.requestor, property, type, 8, PropModeReplace, str, Tcl_DStringLength(&ds)); if (encoding) { Tcl_FreeEncoding(encoding); } Tcl_DStringFree(&ds); } else { propPtr = (char *) SelCvtToX((char *) buffer, |
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | incr.nextPtr = tsdPtr->pendingIncrs; tsdPtr->pendingIncrs = &incr; } if (multiple) { XChangeProperty(reply.xsel.display, reply.xsel.requestor, reply.xsel.property, winPtr->dispPtr->atomPairAtom, 32, PropModeReplace, (unsigned char *) incr.multAtoms, | | | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | incr.nextPtr = tsdPtr->pendingIncrs; tsdPtr->pendingIncrs = &incr; } if (multiple) { XChangeProperty(reply.xsel.display, reply.xsel.requestor, reply.xsel.property, winPtr->dispPtr->atomPairAtom, 32, PropModeReplace, (unsigned char *) incr.multAtoms, incr.numConversions*2); } else { /* * Not a MULTIPLE request. The first property in "multAtoms" got set * to None if there was an error in conversion. */ reply.xsel.property = incr.multAtoms[1]; |
︙ | ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | /* * All done. Cleanup and return. */ ckfree(incr.converts); if (multiple) { | | | 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | /* * All done. Cleanup and return. */ ckfree(incr.converts); if (multiple) { XFree(incr.multAtoms); } return; /* * An error occurred. Send back a refusal message. */ |
︙ | ︙ | |||
1119 1120 1121 1122 1123 1124 1125 | * the higher-level function that initiated the selection retrieval. * *---------------------------------------------------------------------- */ static void SelRcvIncrProc( | | | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | * the higher-level function that initiated the selection retrieval. * *---------------------------------------------------------------------- */ static void SelRcvIncrProc( void *clientData, /* Information about retrieval. */ XEvent *eventPtr) /* X PropertyChange event. */ { TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; unsigned long numItems, bytesAfter; |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | True, (Atom) AnyPropertyType, &type, &format, &numItems, &bytesAfter, (unsigned char **) propInfoPtr); if ((result != Success) || (type == None)) { return; } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( | | | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | True, (Atom) AnyPropertyType, &type, &format, &numItems, &bytesAfter, (unsigned char **) propInfoPtr); if ((result != Success) || (type == None)) { return; } if (bytesAfter != 0) { Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( "selection property too large", TCL_INDEX_NONE)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "SIZE", NULL); retrPtr->result = TCL_ERROR; goto done; } if ((type == XA_STRING) || (type == retrPtr->winPtr->dispPtr->textAtom) || (type == retrPtr->winPtr->dispPtr->utf8Atom) |
︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 | /* * Now convert the data, growing the destination buffer as needed. */ while (1) { result = Tcl_ExternalToUtf(NULL, encoding, src, srcLen, | | | | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | /* * Now convert the data, growing the destination buffer as needed. */ while (1) { result = Tcl_ExternalToUtf(NULL, encoding, src, srcLen, TCL_ENCODING_PROFILE_TCL8|retrPtr->encFlags, &retrPtr->encState, dst, dstLen, &srcRead, &dstWrote, NULL); soFar = dst + dstWrote - Tcl_DStringValue(dstPtr); retrPtr->encFlags &= ~TCL_ENCODING_START; src += srcRead; srcLen -= srcRead; if (result != TCL_CONVERT_NOSPACE) { Tcl_DStringSetLength(dstPtr, soFar); break; |
︙ | ︙ | |||
1275 1276 1277 1278 1279 1280 1281 | Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT", NULL); retrPtr->result = TCL_ERROR; goto done; } Tcl_DStringInit(&ds); if (format == 32) { | | | | 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "FORMAT", NULL); retrPtr->result = TCL_ERROR; goto done; } Tcl_DStringInit(&ds); if (format == 32) { SelCvtFromX32((long *) propInfo, numItems, type, (Tk_Window) retrPtr->winPtr, &ds); } else { SelCvtFromX8((char *) propInfo, numItems, type, (Tk_Window) retrPtr->winPtr, &ds); } interp = retrPtr->interp; Tcl_Preserve(interp); result = retrPtr->proc(retrPtr->clientData, interp, Tcl_DStringValue(&ds)); Tcl_Release(interp); |
︙ | ︙ | |||
1366 1367 1368 1369 1370 1371 1372 | * incrPtr is marked as "all done". * *---------------------------------------------------------------------- */ static void IncrTimeoutProc( | | | 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | * incrPtr is marked as "all done". * *---------------------------------------------------------------------- */ static void IncrTimeoutProc( void *clientData) /* Information about INCR-mode selection * retrieval for which we are selection * owner. */ { IncrInfo *incrPtr = (IncrInfo *)clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { |
︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 | SelCvtToX( char *string, /* String representation of selection. */ Atom type, /* Atom specifying the X format that is * desired for the selection. Should not be * XA_STRING (if so, don't bother calling this * function at all). */ Tk_Window tkwin, /* Window that governs atom conversion. */ | | | | 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | SelCvtToX( char *string, /* String representation of selection. */ Atom type, /* Atom specifying the X format that is * desired for the selection. Should not be * XA_STRING (if so, don't bother calling this * function at all). */ Tk_Window tkwin, /* Window that governs atom conversion. */ Tcl_Size *numLongsPtr) /* Number of 32-bit words contained in the * result. */ { const char **field; Tcl_Size numFields, i; long *propPtr; /* * The string is assumed to consist of fields separated by spaces. The * property gets generated by converting each field to an integer number, * in one of two ways: * 1. If type is XA_ATOM, convert each field to its corresponding atom. |
︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 | * *---------------------------------------------------------------------- */ static void SelCvtFromX32( long *propPtr, /* Property value from X. */ | | | 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | * *---------------------------------------------------------------------- */ static void SelCvtFromX32( long *propPtr, /* Property value from X. */ unsigned long numValues, /* Number of 32-bit values in property. */ Atom type, /* Type of property Should not be XA_STRING * (if so, don't bother calling this function * at all). */ Tk_Window tkwin, /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { /* |
︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | for ( ; numValues > 0; propPtr++, numValues--) { if (type == XA_ATOM) { Tcl_DStringAppendElement(dsPtr, Tk_GetAtomName(tkwin, (Atom) *propPtr)); } else { char buf[12]; | | | | | 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 | for ( ; numValues > 0; propPtr++, numValues--) { if (type == XA_ATOM) { Tcl_DStringAppendElement(dsPtr, Tk_GetAtomName(tkwin, (Atom) *propPtr)); } else { char buf[12]; snprintf(buf, sizeof(buf), "0x%x", (unsigned int) *propPtr); Tcl_DStringAppendElement(dsPtr, buf); } } Tcl_DStringAppend(dsPtr, " ", 1); } static void SelCvtFromX8( char *propPtr, /* Property value from X. */ unsigned long numValues, /* Number of 8-bit values in property. */ TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING * (if so, don't bother calling this function * at all). */ TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { /* * Convert each long in the property to a string value, which is a * hexadecimal string. We build the list in a Tcl_DString because this is * easier than trying to get the quoting correct ourselves. */ for ( ; numValues > 0; propPtr++, numValues--) { char buf[12]; snprintf(buf, sizeof(buf), "0x%x", (unsigned char) *propPtr); Tcl_DStringAppendElement(dsPtr, buf); } Tcl_DStringAppend(dsPtr, " ", 1); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
199 200 201 202 203 204 205 | #define MAX_PROP_WORDS 100000 /* * Forward declarations for functions defined later in this file: */ | | | | | 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 | #define MAX_PROP_WORDS 100000 /* * Forward declarations for functions defined later in this file: */ static int AppendErrorProc(void *clientData, XErrorEvent *errorPtr); static void AppendPropCarefully(Display *display, Window window, Atom property, char *value, int length, PendingCommand *pendingPtr); static Tcl_CmdDeleteProc DeleteProc; static void RegAddName(NameRegistry *regPtr, const char *name, Window commWindow); static void RegClose(NameRegistry *regPtr); static void RegDeleteName(NameRegistry *regPtr, const char *name); static Window RegFindName(NameRegistry *regPtr, const char *name); static NameRegistry * RegOpen(Tcl_Interp *interp, TkDisplay *dispPtr, int lock); static void SendEventProc(void *clientData, XEvent *eventPtr); static int SendInit(Tcl_Interp *interp, TkDisplay *dispPtr); static Tk_RestrictProc SendRestrictProc; static int ServerSecure(TkDisplay *dispPtr); static void UpdateCommWindow(TkDisplay *dispPtr); static int ValidateName(TkDisplay *dispPtr, const char *name, Window commWindow, int oldOK); |
︙ | ︙ | |||
472 473 474 475 476 477 478 | * registered. */ Window commWindow) /* X identifier for comm. window of * application. */ { char id[30], *newProp; int idLength, newBytes; | | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | * registered. */ Window commWindow) /* X identifier for comm. window of * application. */ { char id[30], *newProp; int idLength, newBytes; snprintf(id, sizeof(id), "%x ", (unsigned) commWindow); idLength = strlen(id); newBytes = idLength + strlen(name) + 1; newProp = (char *)ckalloc(regPtr->propLength + newBytes); strcpy(newProp, id); strcpy(newProp+idLength, name); if (regPtr->property != NULL) { memcpy(newProp + newBytes, regPtr->property, regPtr->propLength); |
︙ | ︙ | |||
589 590 591 592 593 594 595 | Window commWindow, /* X identifier for the application's comm. * window. */ int oldOK) /* Non-zero means that we should consider an * application to be valid even if it looks * like an old-style (pre-4.0) one; 0 means * consider these invalid. */ { | | > | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | Window commWindow, /* X identifier for the application's comm. * window. */ int oldOK) /* Non-zero means that we should consider an * application to be valid even if it looks * like an old-style (pre-4.0) one; 0 means * consider these invalid. */ { int result, actualFormat; Tcl_Size argc, i; unsigned long length, bytesAfter; Atom actualType; char *property, **propertyPtr = &property; Tk_ErrorHandler handler; const char **argv; property = NULL; |
︙ | ︙ | |||
755 756 757 758 759 760 761 | * the side of safety. */ secure = 0; #endif /* FamilyServerInterpreted */ } if (addrPtr != NULL) { | | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | * the side of safety. */ secure = 0; #endif /* FamilyServerInterpreted */ } if (addrPtr != NULL) { XFree(addrPtr); } return secure; #endif /* TK_NO_SECURITY */ } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
865 866 867 868 869 870 871 | actualName = name; offset = 0; /* Needed only to avoid "used before * set" compiler warnings. */ for (i = 1; ; i++) { if (i > 1) { if (i == 2) { Tcl_DStringInit(&dString); | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | actualName = name; offset = 0; /* Needed only to avoid "used before * set" compiler warnings. */ for (i = 1; ; i++) { if (i > 1) { if (i == 2) { Tcl_DStringInit(&dString); Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE); Tcl_DStringAppend(&dString, " #", 2); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset+TCL_INTEGER_SPACE); actualName = Tcl_DStringValue(&dString); } snprintf(Tcl_DStringValue(&dString) + offset, TCL_INTEGER_SPACE, "%d", i); } w = RegFindName(regPtr, actualName); if (w == None) { break; } /* |
︙ | ︙ | |||
951 952 953 954 955 956 957 958 959 960 961 | { enum { SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST }; static const char *const sendOptions[] = { "-async", "-displayof", "--", NULL }; TkWindow *winPtr; Window commWindow; PendingCommand pending; RegisteredInterp *riPtr; | > < | | > > > > > | > > | | | | | | | | | | | | | | > > > | | 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 | { enum { SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST }; static const char *const sendOptions[] = { "-async", "-displayof", "--", NULL }; const char *stringRep, *destName; TkWindow *winPtr; Window commWindow; PendingCommand pending; RegisteredInterp *riPtr; int result, async, i, firstArg, index; Tk_RestrictProc *prevProc; void *prevArg; TkDisplay *dispPtr; Tcl_Time timeout; NameRegistry *regPtr; Tcl_DString request; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *localInterp; /* Used when the interpreter to send the * command to is within the same process. */ /* * Process options, if any. */ async = 0; winPtr = (TkWindow *) Tk_MainWindow(interp); if (winPtr == NULL) { return TCL_ERROR; } /* * Process the command options. */ for (i = 1; i < (objc - 1); i++) { stringRep = Tcl_GetString(objv[i]); if (stringRep[0] == '-') { if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == SEND_ASYNC) { ++async; } else if (index == SEND_DISPLAYOF) { winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[++i]), (Tk_Window) winPtr); if (winPtr == NULL) { return TCL_ERROR; } } else /* if (index == SEND_LAST) */ { i++; break; } } else { break; } } if (objc < (i + 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?-option value ...? interpName arg ?arg ...?"); return TCL_ERROR; } destName = Tcl_GetString(objv[i]); firstArg = i+1; |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | || (strcmp(riPtr->name, destName) != 0)) { continue; } Tcl_Preserve(riPtr); localInterp = riPtr->interp; Tcl_Preserve(localInterp); if (firstArg == (objc-1)) { | | | | | | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | || (strcmp(riPtr->name, destName) != 0)) { continue; } Tcl_Preserve(riPtr); localInterp = riPtr->interp; Tcl_Preserve(localInterp); if (firstArg == (objc-1)) { result = Tcl_EvalEx(localInterp, Tcl_GetString(objv[firstArg]), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } else { Tcl_DStringInit(&request); Tcl_DStringAppend(&request, Tcl_GetString(objv[firstArg]), TCL_INDEX_NONE); for (i = firstArg+1; i < objc; i++) { Tcl_DStringAppend(&request, " ", 1); Tcl_DStringAppend(&request, Tcl_GetString(objv[i]), TCL_INDEX_NONE); } result = Tcl_EvalEx(localInterp, Tcl_DStringValue(&request), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&request); } if (interp != localInterp) { if (result == TCL_ERROR) { Tcl_Obj *errorObjPtr; /* |
︙ | ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | * Send the command to the target interpreter by appending it to the comm * window in the communication window. */ localData.sendSerial++; Tcl_DStringInit(&request); Tcl_DStringAppend(&request, "\0c\0-n ", 6); | | | | | | | 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 | * Send the command to the target interpreter by appending it to the comm * window in the communication window. */ localData.sendSerial++; Tcl_DStringInit(&request); Tcl_DStringAppend(&request, "\0c\0-n ", 6); Tcl_DStringAppend(&request, destName, TCL_INDEX_NONE); if (!async) { char buffer[TCL_INTEGER_SPACE * 2]; snprintf(buffer, sizeof(buffer), "%x %d", (unsigned) Tk_WindowId(dispPtr->commTkwin), localData.sendSerial); Tcl_DStringAppend(&request, "\0-r ", 4); Tcl_DStringAppend(&request, buffer, TCL_INDEX_NONE); } Tcl_DStringAppend(&request, "\0-s ", 4); Tcl_DStringAppend(&request, Tcl_GetString(objv[firstArg]), TCL_INDEX_NONE); for (i = firstArg+1; i < objc; i++) { Tcl_DStringAppend(&request, " ", 1); Tcl_DStringAppend(&request, Tcl_GetString(objv[i]), TCL_INDEX_NONE); } if (!async) { /* * Register the fact that we're waiting for a command to complete * (this is needed by SendEventProc and by AppendErrorProc to pass * back the command's results). Set up a timeout handler so that |
︙ | ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | */ Tcl_ResetResult(interp); Tcl_AddErrorInfo(interp, pending.errorInfo); ckfree(pending.errorInfo); } if (pending.errorCode != NULL) { | | | | 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | */ Tcl_ResetResult(interp); Tcl_AddErrorInfo(interp, pending.errorInfo); ckfree(pending.errorInfo); } if (pending.errorCode != NULL) { Tcl_SetObjErrorCode(interp, Tcl_NewStringObj(pending.errorCode, TCL_INDEX_NONE)); ckfree(pending.errorCode); } Tcl_SetObjResult(interp, Tcl_NewStringObj(pending.result, TCL_INDEX_NONE)); ckfree(pending.result); return pending.code; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1276 1277 1278 1279 1280 1281 1282 | p++; if (ValidateName(winPtr->dispPtr, entryName, commWindow, 1)) { /* * The application still exists; add its name to the result. */ Tcl_ListObjAppendElement(NULL, resultObj, | | | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | p++; if (ValidateName(winPtr->dispPtr, entryName, commWindow, 1)) { /* * The application still exists; add its name to the result. */ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(entryName, TCL_INDEX_NONE)); } else { int count; /* * This name is bogus (perhaps the application died without * cleaning up its entry in the registry?). Delete the name. */ |
︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 | * the (ostensibly waiting) "send" commands. The property is deleted. * *-------------------------------------------------------------- */ static void SendEventProc( | | | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | * the (ostensibly waiting) "send" commands. The property is deleted. * *-------------------------------------------------------------- */ static void SendEventProc( void *clientData, /* Display information. */ XEvent *eventPtr) /* Information about event. */ { TkDisplay *dispPtr = (TkDisplay *)clientData; char *propInfo, **propInfoPtr = &propInfo; const char *p; int result, actualFormat; unsigned long numItems, bytesAfter; |
︙ | ︙ | |||
1529 1530 1531 1532 1533 1534 1535 | * Initialize the result property, so that we're ready at any time * if we need to return an error. */ if (commWindow != None) { Tcl_DStringInit(&reply); Tcl_DStringAppend(&reply, "\0r\0-s ", 6); | | | | | | | | | | | 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 | * Initialize the result property, so that we're ready at any time * if we need to return an error. */ if (commWindow != None) { Tcl_DStringInit(&reply); Tcl_DStringAppend(&reply, "\0r\0-s ", 6); Tcl_DStringAppend(&reply, serial, TCL_INDEX_NONE); Tcl_DStringAppend(&reply, "\0-r ", 4); } if (!ServerSecure(dispPtr)) { if (commWindow != None) { Tcl_DStringAppend(&reply, "X server insecure (must use xauth-style " "authorization); command ignored", TCL_INDEX_NONE); } result = TCL_ERROR; goto returnResult; } /* * Locate the application, then execute the script. */ for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) { if (riPtr == NULL) { if (commWindow != None) { Tcl_DStringAppend(&reply, "receiver never heard of interpreter \"", TCL_INDEX_NONE); Tcl_DStringAppend(&reply, interpName, TCL_INDEX_NONE); Tcl_DStringAppend(&reply, "\"", 1); } result = TCL_ERROR; goto returnResult; } if (strcmp(riPtr->name, interpName) == 0) { break; } } Tcl_Preserve(riPtr); /* * We must protect the interpreter because the script may enter * another event loop, which might call Tcl_DeleteInterp. */ remoteInterp = riPtr->interp; Tcl_Preserve(remoteInterp); result = Tcl_EvalEx(remoteInterp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); /* * The call to Tcl_Release may have released the interpreter which * will cause the "send" command for that interpreter to be * deleted. The command deletion callback will set the * riPtr->interp field to NULL, hence the check below for NULL. */ if (commWindow != None) { Tcl_DStringAppend(&reply, Tcl_GetString(Tcl_GetObjResult(remoteInterp)), -1); if (result == TCL_ERROR) { const char *varValue; varValue = Tcl_GetVar2(remoteInterp, "errorInfo", NULL, TCL_GLOBAL_ONLY); if (varValue != NULL) { Tcl_DStringAppend(&reply, "\0-i ", 4); Tcl_DStringAppend(&reply, varValue, TCL_INDEX_NONE); } varValue = Tcl_GetVar2(remoteInterp, "errorCode", NULL, TCL_GLOBAL_ONLY); if (varValue != NULL) { Tcl_DStringAppend(&reply, "\0-e ", 4); Tcl_DStringAppend(&reply, varValue, TCL_INDEX_NONE); } } } Tcl_Release(remoteInterp); Tcl_Release(riPtr); /* * Return the result to the sender if a commWindow was specified * (if none was specified then this is an asynchronous call). * Right now reply has everything but the completion code, but it * needs the NULL to terminate the current option. */ returnResult: if (commWindow != None) { if (result != TCL_OK) { char buffer[TCL_INTEGER_SPACE]; snprintf(buffer, sizeof(buffer), "%d", result); Tcl_DStringAppend(&reply, "\0-c ", 4); Tcl_DStringAppend(&reply, buffer, TCL_INDEX_NONE); } (void) AppendPropCarefully(dispPtr->display, commWindow, dispPtr->commProperty, Tcl_DStringValue(&reply), Tcl_DStringLength(&reply) + 1, NULL); XFlush(dispPtr->display); Tcl_DStringFree(&reply); } |
︙ | ︙ | |||
1772 1773 1774 1775 1776 1777 1778 | /* * The function below is invoked if an error occurs during the XChangeProperty * operation above. */ static int AppendErrorProc( | | | | 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 | /* * The function below is invoked if an error occurs during the XChangeProperty * operation above. */ static int AppendErrorProc( void *clientData, /* Command to mark complete, or NULL. */ TCL_UNUSED(XErrorEvent *)) /* Information about error. */ { PendingCommand *pendingPtr = (PendingCommand *)clientData; PendingCommand *pcPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (pendingPtr == NULL) { return 0; } /* * Make sure this command is still pending. */ for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL; pcPtr = pcPtr->nextPtr) { if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) { pcPtr->result = (char *)ckalloc(strlen(pcPtr->target) + 50); snprintf(pcPtr->result, strlen(pcPtr->target) + 50, "no application named \"%s\"", pcPtr->target); pcPtr->code = TCL_ERROR; pcPtr->gotResponse = 1; break; } } return 0; |
︙ | ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | * The interpreter given by riPtr is unregistered. * *-------------------------------------------------------------- */ static void DeleteProc( | | < | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | * The interpreter given by riPtr is unregistered. * *-------------------------------------------------------------- */ static void DeleteProc( void *clientData) /* Info about registration */ { RegisteredInterp *riPtr = (RegisteredInterp *)clientData; RegisteredInterp *riPtr2; NameRegistry *regPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
1950 1951 1952 1953 1954 1955 1956 | * Depends on option; see below. * *---------------------------------------------------------------------- */ int TkpTestsendCmd( | | | | 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 | * Depends on option; see below. * *---------------------------------------------------------------------- */ int TkpTestsendCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { enum { TESTSEND_BOGUS, TESTSEND_PROP, TESTSEND_SERIAL }; static const char *const testsendOptions[] = { "bogus", "prop", "serial", NULL |
︙ | ︙ | |||
2016 2017 2018 2019 2020 2021 2022 | if ((result == Success) && (actualType != None) && (actualFormat == 8) && (actualType == XA_STRING)) { for (p = property; (unsigned long)(p-property) < length; p++) { if (*p == 0) { *p = '\n'; } } | | | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 | if ((result == Success) && (actualType != None) && (actualFormat == 8) && (actualType == XA_STRING)) { for (p = property; (unsigned long)(p-property) < length; p++) { if (*p == 0) { *p = '\n'; } } Tcl_SetObjResult(interp, Tcl_NewStringObj(property, TCL_INDEX_NONE)); } if (property != NULL) { XFree(property); } } else if (Tcl_GetString(objv[4])[0] == 0) { handler = Tk_CreateErrorHandler(winPtr->dispPtr->display, -1, -1, -1, NULL, NULL); |
︙ | ︙ |
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 Tcl_CmdDeleteProc SysNotifyDeleteCmd; static Tcl_ObjCmdProc SysNotifyCmd; /* *---------------------------------------------------------------------- * * 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"); char *dstStr = Tcl_UtfToExternalDString(enc, title, TCL_INDEX_NONE, &dst); char *dsmStr = Tcl_UtfToExternalDString(enc, message, TCL_INDEX_NONE, &dsm); notify_init(appname); notif = notify_notification_new(dstStr, dsmStr, 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], TCL_INDEX_NONE); 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); if (!notify_init) return TCL_OK; 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 | /* * 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 Tcl_ObjCmdProc TrayIconCreateCmd; static Tcl_ObjCmdProc TrayIconObjectCmd; static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp *interp, Tcl_Size 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 Tcl_CmdDeleteProc TrayIconDeleteProc; 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(void *cd); static void RetargetEvent(DockIcon *icon, XEvent *ev); static void TrayIconEvent(void *cd, XEvent* ev); static void UserIconEvent(void *cd, XEvent* ev); static void TrayIconWrapperEvent(void *cd, XEvent* ev); static int IconGenericHandler(void *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( void *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", TCL_INDEX_NONE)); } else { switch(QueryTrayOrientation(icon)) { case 0: Tcl_SetObjResult(interp, Tcl_NewStringObj("horizontal", TCL_INDEX_NONE)); break; case 1: Tcl_SetObjResult(interp, Tcl_NewStringObj("vertical", TCL_INDEX_NONE)); break; default: Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", TCL_INDEX_NONE)); 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]; snprintf(buf,256,"_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]; snprintf(numeric,256,"%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, 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, 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( void *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(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, icon); } } } /* *---------------------------------------------------------------------- * * DisplayIcon -- * * Main function for displaying icon. * * Results: * Icon image is displayed. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void DisplayIcon( void *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, 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( void *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( void *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, 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( void *cd, XEvent* ev) { DockIcon *icon = (DockIcon*)cd; switch (ev->type) { case DestroyNotify: Tk_DeleteGenericHandler(IconGenericHandler, icon); if(icon->drawingWin) { icon->visible = 0; Tcl_CancelIdleCall(DisplayIcon, 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( void *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, Tcl_Size 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, 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, 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( void *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( void *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", TCL_INDEX_NONE)); 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, 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, 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, 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(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. */ |
︙ | ︙ | |||
201 202 203 204 205 206 207 | * Miscellaneous information. */ WmAttributes attributes; /* Current state of [wm attributes] */ WmAttributes reqState; /* Requested state of [wm attributes] */ ProtocolHandler *protPtr; /* First in list of protocol handlers for this * window (NULL means none). */ | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | * Miscellaneous information. */ WmAttributes attributes; /* Current state of [wm attributes] */ WmAttributes reqState; /* Requested state of [wm attributes] */ ProtocolHandler *protPtr; /* First in list of protocol handlers for this * window (NULL means none). */ Tcl_Size cmdArgc; /* Number of elements in cmdArgv below. */ const char **cmdArgv; /* Array of strings to store in the WM_COMMAND * property. NULL means nothing available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE * property, or NULL. */ int flags; /* Miscellaneous flags, defined below. */ int numTransients; /* number of transients on this window */ int iconDataSize; /* size of iconphoto image data */ |
︙ | ︙ | |||
300 301 302 303 304 305 306 | */ /* * The following structures are the official type records for geometry * management of top-level and menubar windows. */ | | | | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | */ /* * The following structures are the official type records for geometry * management of top-level and menubar windows. */ static void TopLevelReqProc(void *dummy, Tk_Window tkwin); static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr); static void MenubarReqProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ NULL, /* lostContentProc */ }; |
︙ | ︙ | |||
340 341 342 343 344 345 346 | static int ComputeReparentGeometry(WmInfo *wmPtr); static void ConfigureEvent(WmInfo *wmPtr, XConfigureEvent *eventPtr); static void CreateWrapper(WmInfo *wmPtr); static void GetMaxSize(WmInfo *wmPtr, int *maxWidthPtr, int *maxHeightPtr); | | | | | | | | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | 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 | static int ComputeReparentGeometry(WmInfo *wmPtr); static void ConfigureEvent(WmInfo *wmPtr, XConfigureEvent *eventPtr); static void CreateWrapper(WmInfo *wmPtr); static void GetMaxSize(WmInfo *wmPtr, int *maxWidthPtr, int *maxHeightPtr); static void MenubarDestroyProc(void *clientData, XEvent *eventPtr); static int ParseGeometry(Tcl_Interp *interp, const char *string, TkWindow *winPtr); static void ReparentEvent(WmInfo *wmPtr, XReparentEvent *eventPtr); static void PropertyEvent(WmInfo *wmPtr, XPropertyEvent *eventPtr); static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr, Display *display, Tcl_HashTable *reparentTable); static void TopLevelReqProc(void *dummy, Tk_Window tkwin); static void RemapWindows(TkWindow *winPtr, TkWindow *parentPtr); static void UpdateCommand(TkWindow *winPtr); static void UpdateGeometryInfo(void *clientData); static void UpdateHints(TkWindow *winPtr); static void UpdateSizeHints(TkWindow *winPtr, int newWidth, int newHeight); static void UpdateTitle(TkWindow *winPtr); static void UpdatePhotoIcon(TkWindow *winPtr); static void UpdateVRootGeometry(WmInfo *wmPtr); static void UpdateWmProtocols(WmInfo *wmPtr); static int SetNetWmType(TkWindow *winPtr, Tcl_Obj *typePtr); static Tcl_Obj * GetNetWmType(TkWindow *winPtr); static void SetNetWmState(TkWindow*, const char *atomName, int on); static void CheckNetWmState(WmInfo *, Atom *atoms, int numAtoms); static void UpdateNetWmState(WmInfo *); static void WaitForConfigureNotify(TkWindow *winPtr, unsigned long serial); static int WaitForEvent(Display *display, WmInfo *wmInfoPtr, int type, XEvent *eventPtr); static void WaitForMapNotify(TkWindow *winPtr, int mapped); static Tk_RestrictProc WaitRestrictProc; static void WrapperEventProc(void *clientData, XEvent *eventPtr); static void WmWaitMapProc(void *clientData, XEvent *eventPtr); static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmOverrideredirectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); /* *-------------------------------------------------------------- * * TkWmCleanup -- |
︙ | ︙ | |||
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) { | | | | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | wmPtr->flags |= WM_UPDATE_SIZE_HINTS; UpdateHints(winPtr); UpdateWmProtocols(wmPtr); if (wmPtr->cmdArgv != NULL) { UpdateCommand(winPtr); } if (wmPtr->clientMachine != NULL) { (void)Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, TCL_INDEX_NONE, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window, &textProp); XFree(textProp.value); /* * Inform the server (and more particularly any session * manager) what our process ID is. We only do this when the * CLIENT_MACHINE property is set since the spec for * _NET_WM_PID requires that to be set too. */ |
︙ | ︙ | |||
978 979 980 981 982 983 984 | return; } if (winPtr->classUid != NULL) { XClassHint *classPtr; Tcl_DString name, ds; | | | | | | | | 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 | return; } if (winPtr->classUid != NULL) { XClassHint *classPtr; Tcl_DString name, ds; (void)Tcl_UtfToExternalDString(NULL, winPtr->nameUid, TCL_INDEX_NONE, &name); (void)Tcl_UtfToExternalDString(NULL, winPtr->classUid, TCL_INDEX_NONE, &ds); classPtr = XAllocClassHint(); classPtr->res_name = Tcl_DStringValue(&name); classPtr->res_class = Tcl_DStringValue(&ds); XSetClassHint(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window, classPtr); XFree(classPtr); Tcl_DStringFree(&name); Tcl_DStringFree(&ds); } } /* *---------------------------------------------------------------------- * * Tk_WmObjCmd -- * * This function is invoked to process the "wm" Tcl command. * *---------------------------------------------------------------------- */ 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", "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_TRANSIENT, WMOPT_WITHDRAW }; int index; const char *argv1; |
︙ | ︙ | |||
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: | > > | 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | 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: |
︙ | ︙ | |||
1180 1181 1182 1183 1184 1185 1186 | */ static int WmAspectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | */ static int WmAspectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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, |
︙ | ︙ | |||
1215 1216 1217 1218 1219 1220 1221 | || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "aspect number can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "ASPECT", NULL); return TCL_ERROR; } wmPtr->minAspect.x = numer1; wmPtr->minAspect.y = denom1; wmPtr->maxAspect.x = numer2; wmPtr->maxAspect.y = denom2; |
︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | { WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: return Tcl_NewDoubleObj(wmPtr->attributes.alpha); case WMATT_TOPMOST: | | | | | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | { WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: return Tcl_NewDoubleObj(wmPtr->attributes.alpha); case WMATT_TOPMOST: return Tcl_NewBooleanObj(wmPtr->attributes.topmost); case WMATT_ZOOMED: return Tcl_NewBooleanObj(wmPtr->attributes.zoomed); case WMATT_FULLSCREEN: return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen); case WMATT_TYPE: return GetNetWmType(winPtr); case _WMATT_LAST_ATTRIBUTE: break; } return NULL; } |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | */ static int WmAttributesCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmAttributesCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int attribute = 0; if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewListObj(0,0); for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(WmAttributeNames[attribute], TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, result, WmGetAttribute(winPtr, (WmAttribute)attribute)); } Tcl_SetObjResult(interp, result); return TCL_OK; } 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, (WmAttribute)attribute)); return TCL_OK; } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ Tcl_Size 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,interp,(WmAttribute)attribute,objv[i+1]) != TCL_OK) { |
︙ | ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | */ static int WmClientCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmClientCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; 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, TCL_INDEX_NONE)); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); |
︙ | ︙ | |||
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; | | | | 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | } 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_UtfToExternalDString(NULL, wmPtr->clientMachine, TCL_INDEX_NONE, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, &textProp) != 0) { unsigned long pid = (unsigned long) getpid(); XSetWMClientMachine(winPtr->display, wmPtr->wrapperPtr->window, &textProp); XFree(textProp.value); /* * Inform the server (and more particularly any session manager) * what our process ID is. We only do this when the CLIENT_MACHINE * property is set since the spec for _NET_WM_PID requires that to * be set too. */ |
︙ | ︙ | |||
1531 1532 1533 1534 1535 1536 1537 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | > | | | | | 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 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Window *cmapList; TkWindow *winPtr2; Tcl_Size i, windowObjc; int count, gotToplevel; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?"); return TCL_ERROR; } Tk_MakeWindowExist((Tk_Window) winPtr); if (wmPtr->wrapperPtr == NULL) { CreateWrapper(wmPtr); } if (objc == 3) { if (XGetWMColormapWindows(winPtr->display, wmPtr->wrapperPtr->window, &cmapList, &count) == 0) { return TCL_OK; } resultObj = Tcl_NewObj(); for (i = 0; i < (Tcl_Size)count; i++) { if ((i == ((Tcl_Size)count-1)) && (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) { break; } winPtr2 = (TkWindow *) Tk_IdToWindow(winPtr->display, cmapList[i]); if (winPtr2 == NULL) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_ObjPrintf("0x%lx", cmapList[i])); } else { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(winPtr2->pathName, TCL_INDEX_NONE)); } } XFree(cmapList); Tcl_SetObjResult(interp, resultObj); return TCL_OK; } if (Tcl_ListObjGetElements(interp, objv[3], &windowObjc, &windowObjv) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
1632 1633 1634 1635 1636 1637 1638 | */ static int WmCommandCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmCommandCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size 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) { char *arg = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); Tcl_SetObjResult(interp, Tcl_NewStringObj(arg, TCL_INDEX_NONE)); ckfree(arg); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (argv3[0] == 0) { if (wmPtr->cmdArgv != NULL) { |
︙ | ︙ | |||
1701 1702 1703 1704 1705 1706 1707 | */ static int WmDeiconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 | */ static int WmDeiconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; |
︙ | ︙ | |||
1751 1752 1753 1754 1755 1756 1757 | */ static int WmFocusmodelCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmFocusmodelCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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", TCL_INDEX_NONE)); return TCL_OK; } if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
1806 1807 1808 1809 1810 1811 1812 | */ 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. */ | | | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | */ 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(Tcl_Size), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); Tk_UnmapWindow(frameWin); |
︙ | ︙ | |||
1859 1860 1861 1862 1863 1864 1865 | */ static int WmFrameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmFrameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } window = wmPtr->reparent; if (window == None) { window = Tk_WindowId((Tk_Window) winPtr); } snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)window); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmGeometryCmd -- |
︙ | ︙ | |||
1901 1902 1903 1904 1905 1906 1907 | */ static int WmGeometryCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 | */ static int WmGeometryCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; |
︙ | ︙ | |||
1961 1962 1963 1964 1965 1966 1967 | */ static int WmGridCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 | */ static int WmGridCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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, |
︙ | ︙ | |||
1990 1991 1992 1993 1994 1995 1996 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ | | | | | | | 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 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; wmPtr->heightInc = 1; } else { if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) !=TCL_OK)) { return TCL_ERROR; } if (reqWidth < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "baseWidth can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (reqHeight < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "baseHeight can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (widthInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "widthInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (heightInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "heightInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc, heightInc); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; |
︙ | ︙ | |||
2060 2061 2062 2063 2064 2065 2066 | */ static int WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE)); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; if (wmPtr->leaderName != NULL) { |
︙ | ︙ | |||
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 | UpdateHints(winPtr); 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. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 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 | 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. */ Tcl_Size 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; } snprintf(cmd, sizeof(cmd), "::tk::icons::IconBadge {%s} {%s}", Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); if (Tcl_EvalEx(interp, cmd, TCL_INDEX_NONE, TCL_EVAL_DIRECT) != TCL_OK) { return TCL_ERROR; } 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPixmapHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj( Tk_NameOfBitmap(winPtr->display, wmPtr->hints.icon_pixmap), TCL_INDEX_NONE)); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (*argv3 == '\0') { if (wmPtr->hints.icon_pixmap != None) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); |
︙ | ︙ | |||
2195 2196 2197 2198 2199 2200 2201 | */ static int WmIconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 | */ static int WmIconifyCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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; |
︙ | ︙ | |||
2235 2236 2237 2238 2239 2240 2241 | "can't iconify \"%s\": it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; } if (TkpWmSetState(winPtr, IconicState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | "can't iconify \"%s\": it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; } if (TkpWmSetState(winPtr, IconicState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't send iconify message to window manager", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } return TCL_OK; } /* |
︙ | ︙ | |||
2264 2265 2266 2267 2268 2269 2270 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
2323 2324 2325 2326 2327 2328 2329 | */ static int WmIconnameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmIconnameCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->iconName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, TCL_INDEX_NONE)); } return TCL_OK; } else { if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } argv3 = Tcl_GetString(objv[3]); |
︙ | ︙ | |||
2374 2375 2376 2377 2378 2379 2380 | */ static int WmIconphotoCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | > | | 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 | */ static int WmIconphotoCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_PhotoHandle photo; Tk_PhotoImageBlock block; Tcl_Size i; int size = 0, width, height, index = 0, x, y, isDefault = 0; unsigned long *iconPropertyData; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
2437 2438 2439 2440 2441 2442 2443 | return TCL_ERROR; } memset(iconPropertyData, 0, sizeof(unsigned long) * size); for (i = 3 + isDefault; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); if (photo == NULL) { | | | 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 | return TCL_ERROR; } memset(iconPropertyData, 0, sizeof(unsigned long) * size); for (i = 3 + isDefault; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); if (photo == NULL) { ckfree(iconPropertyData); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "failed to create an iconphoto with image \"%s\"", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL); return TCL_ERROR; } Tk_PhotoGetSize(photo, &width, &height); |
︙ | ︙ | |||
2524 2525 2526 2527 2528 2529 2530 | */ static int WmIconpositionCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 | */ static int WmIconpositionCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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?"); |
︙ | ︙ | |||
2581 2582 2583 2584 2585 2586 2587 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; |
︙ | ︙ | |||
2701 2702 2703 2704 2705 2706 2707 | */ 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. */ | | | 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 | */ 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(Tcl_Size), /* 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)) { |
︙ | ︙ | |||
2760 2761 2762 2763 2764 2765 2766 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; GetMaxSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->maxWidth = width; wmPtr->maxHeight = height; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; if (width <= 0 && height <= 0) { |
︙ | ︙ | |||
2819 2820 2821 2822 2823 2824 2825 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( | | | | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; results[0] = Tcl_NewWideIntObj(wmPtr->minWidth); results[1] = Tcl_NewWideIntObj(wmPtr->minHeight); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->minWidth = width; wmPtr->minHeight = height; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; |
︙ | ︙ | |||
2873 2874 2875 2876 2877 2878 2879 | */ static int WmOverrideredirectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | | | 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 | */ static int WmOverrideredirectCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Bool boolValue, curValue; XSetWindowAttributes atts; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } if (curValue != boolValue) { /* * Only do this if we are really changing value, because it causes * some funky stuff to occur */ atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); if (winPtr->wmInfoPtr->wrapperPtr != NULL) { Tk_ChangeWindowAttributes( (Tk_Window) winPtr->wmInfoPtr->wrapperPtr, CWOverrideRedirect, &atts); } |
︙ | ︙ | |||
2931 2932 2933 2934 2935 2936 2937 | */ static int WmPositionfromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 | */ static int WmPositionfromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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 }; |
︙ | ︙ | |||
2953 2954 2955 2956 2957 2958 2959 | const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USPosition) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PPosition) { sourceStr = "program"; } | | | 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 | const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USPosition) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PPosition) { sourceStr = "program"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE)); return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USPosition|PPosition); } else { if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, sizeof(char *), "argument", 0, &index) != TCL_OK) { |
︙ | ︙ | |||
2998 2999 3000 3001 3002 3003 3004 | */ static int WmProtocolCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 | */ static int WmProtocolCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; Tcl_Size cmdLength; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } if (objc == 3) { /* |
︙ | ︙ | |||
3036 3037 3038 3039 3040 3041 3042 | * Return the command to handle a given protocol. */ for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, | | | | 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 | * Return the command to handle a given protocol. */ for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE)); return TCL_OK; } } return TCL_OK; } /* * Special case for _NET_WM_PING: that's always handled directly. */ if (strcmp(Tcl_GetString(objv[3]), "_NET_WM_PING") == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "may not alter handling of that protocol", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "PROTOCOL", "RESERVED", NULL); return TCL_ERROR; } /* * Delete any current protocol handler, then create a new one with the * specified command, unless the command is empty. |
︙ | ︙ | |||
3071 3072 3073 3074 3075 3076 3077 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | | 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 | } 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); |
︙ | ︙ | |||
3108 3109 3110 3111 3112 3113 3114 | */ static int WmResizableCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 | */ static int WmResizableCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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?"); |
︙ | ︙ | |||
3167 3168 3169 3170 3171 3172 3173 | */ static int WmSizefromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 | */ static int WmSizefromCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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 }; |
︙ | ︙ | |||
3189 3190 3191 3192 3193 3194 3195 | const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USSize) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PSize) { sourceStr = "program"; } | | | 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 | const char *sourceStr = ""; if (wmPtr->sizeHintsFlags & USSize) { sourceStr = "user"; } else if (wmPtr->sizeHintsFlags & PSize) { sourceStr = "program"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE)); return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USSize|PSize); } else { if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, |
︙ | ︙ | |||
3235 3236 3237 3238 3239 3240 3241 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkWindow **windows, **window_ptr; static const char *const optionStrings[] = { "isabove", "isbelow", NULL }; enum options { OPT_ISABOVE, OPT_ISBELOW }; |
︙ | ︙ | |||
3258 3259 3260 3261 3262 3263 3264 | windows = TkWmStackorderToplevel(winPtr); if (windows != NULL) { Tcl_Obj *resultObj = Tcl_NewObj(); /* ASSERT: true [Bug 1789819]*/ for (window_ptr = windows; *window_ptr ; window_ptr++) { Tcl_ListObjAppendElement(NULL, resultObj, | | | 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 | windows = TkWmStackorderToplevel(winPtr); if (windows != NULL) { Tcl_Obj *resultObj = Tcl_NewObj(); /* ASSERT: true [Bug 1789819]*/ for (window_ptr = windows; *window_ptr ; window_ptr++) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj((*window_ptr)->pathName, TCL_INDEX_NONE)); } ckfree(windows); Tcl_SetObjResult(interp, resultObj); return TCL_OK; } else { return TCL_ERROR; } |
︙ | ︙ | |||
3306 3307 3308 3309 3310 3311 3312 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "TkWmStackorderToplevel failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } for (window_ptr = windows; *window_ptr ; window_ptr++) { if (*window_ptr == winPtr) { index1 = (window_ptr - windows); |
︙ | ︙ | |||
3359 3360 3361 3362 3363 3364 3365 | */ static int WmStateCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 | */ static int WmStateCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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) { |
︙ | ︙ | |||
3438 3439 3440 3441 3442 3443 3444 | } else if (Tk_IsMapped((Tk_Window) winPtr) || ((wmPtr->flags & WM_NEVER_MAPPED) && (wmPtr->hints.initial_state == NormalState))) { state = "normal"; } else { state = "iconic"; } | | | 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 | } else if (Tk_IsMapped((Tk_Window) winPtr) || ((wmPtr->flags & WM_NEVER_MAPPED) && (wmPtr->hints.initial_state == NormalState))) { state = "normal"; } else { state = "iconic"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(state, TCL_INDEX_NONE)); } return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3465 3466 3467 3468 3469 3470 3471 | */ static int WmTitleCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | 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 | */ static int WmTitleCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->title) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->title, TCL_INDEX_NONE)); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, TCL_INDEX_NONE)); } } else { if (wmPtr->title != NULL) { ckfree(wmPtr->title); } argv3 = Tcl_GetString(objv[3]); wmPtr->title = (char *)ckalloc(objv[3]->length + 1); |
︙ | ︙ | |||
3518 3519 3520 3521 3522 3523 3524 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *containerPtr = wmPtr->containerPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
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; | | | 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 | "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; } |
︙ | ︙ | |||
3667 3668 3669 3670 3671 3672 3673 | */ static int WmWithdrawCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | 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 | */ static int WmWithdrawCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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( "can't withdraw %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL); return TCL_ERROR; } wmPtr->flags |= WM_WITHDRAWN; if (TkpWmSetState(winPtr, WithdrawnState) == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't send withdraw message to window manager", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } return TCL_OK; } /* |
︙ | ︙ | |||
3716 3717 3718 3719 3720 3721 3722 | /* * Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel * that is the container of a transient toplevel. */ static void WmWaitMapProc( | | | 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 | /* * Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel * that is the container of a transient toplevel. */ static void WmWaitMapProc( void *clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { TkWindow *winPtr = (TkWindow *)clientData; TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; if (containerPtr == NULL) { return; |
︙ | ︙ | |||
3811 3812 3813 3814 3815 3816 3817 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) | | < | 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) && ((wmPtr->sizeHintsFlags & PBaseSize) == PBaseSize)) { return; } /* * If gridding was previously off, then forget about any window size * requests made by the user or via "wm geometry": these are in pixel * units and there's no easy way to translate them to grid units since the |
︙ | ︙ | |||
3843 3844 3845 3846 3847 3848 3849 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; | | | 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; wmPtr->sizeHintsFlags |= PBaseSize; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; } } |
︙ | ︙ | |||
3902 3903 3904 3905 3906 3907 3908 | } if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; | | | 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 | } if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; |
︙ | ︙ | |||
4170 4171 4172 4173 4174 4175 4176 | if ((actualFormat == 32) && (numItems == 1)) { vRoot = wmPtr->vRoot = *virtualRootPtr; } else if (dispPtr->flags & TK_DISPLAY_WM_TRACING) { printf("%s format %d numItems %ld\n", "ReparentEvent got bogus VROOT property:", actualFormat, numItems); } | | | 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 | if ((actualFormat == 32) && (numItems == 1)) { vRoot = wmPtr->vRoot = *virtualRootPtr; } else if (dispPtr->flags & TK_DISPLAY_WM_TRACING) { printf("%s format %d numItems %ld\n", "ReparentEvent got bogus VROOT property:", actualFormat, numItems); } XFree(virtualRootPtr); } Tk_DeleteErrorHandler(handler); if (dispPtr->flags & TK_DISPLAY_WM_TRACING) { printf("ReparentEvent: %s (%p) reparented to 0x%x, vRoot = 0x%x\n", wmPtr->winPtr->pathName, wmPtr->winPtr, (unsigned) reparentEventPtr->parent, (unsigned) vRoot); |
︙ | ︙ | |||
4221 4222 4223 4224 4225 4226 4227 | wmPtr->reparent = reparentEventPtr->parent; while (1) { if (XQueryTree(wrapperPtr->display, wmPtr->reparent, &dummy2, &ancestor, &children, &dummy) == 0) { Tk_DeleteErrorHandler(handler); goto noReparent; } | | | 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 | wmPtr->reparent = reparentEventPtr->parent; while (1) { if (XQueryTree(wrapperPtr->display, wmPtr->reparent, &dummy2, &ancestor, &children, &dummy) == 0) { Tk_DeleteErrorHandler(handler); goto noReparent; } XFree(children); if ((ancestor == vRoot) || (ancestor == RootWindow(wrapperPtr->display, wrapperPtr->screenNum))) { break; } wmPtr->reparent = ancestor; } |
︙ | ︙ | |||
4405 4406 4407 4408 4409 4410 4411 | */ static const unsigned WrapperEventMask = (StructureNotifyMask | PropertyChangeMask); static void WrapperEventProc( | | | 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 | */ static const unsigned WrapperEventMask = (StructureNotifyMask | PropertyChangeMask); static void WrapperEventProc( void *clientData, /* Information about toplevel window. */ XEvent *eventPtr) /* Event that just happened. */ { WmInfo *wmPtr = (WmInfo *)clientData; XEvent mapEvent; TkDisplay *dispPtr = wmPtr->winPtr->dispPtr; wmPtr->flags |= WM_VROOT_OFFSET_STALE; |
︙ | ︙ | |||
4555 4556 4557 4558 4559 4560 4561 | * change, unless the WM prevents that from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( | | | 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 | * change, unless the WM prevents that from happening. * *---------------------------------------------------------------------- */ static void UpdateGeometryInfo( void *clientData) /* Pointer to the window's record. */ { TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; wmPtr->flags &= ~WM_UPDATE_PENDING; |
︙ | ︙ | |||
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)) { | | | | 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 | * 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) && |
︙ | ︙ | |||
4870 4871 4872 4873 4874 4875 4876 | hintsPtr->width_inc = wmPtr->widthInc; hintsPtr->height_inc = wmPtr->heightInc; hintsPtr->min_aspect.x = wmPtr->minAspect.x; hintsPtr->min_aspect.y = wmPtr->minAspect.y; hintsPtr->max_aspect.x = wmPtr->maxAspect.x; hintsPtr->max_aspect.y = wmPtr->maxAspect.y; hintsPtr->win_gravity = wmPtr->gravity; | | | | 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 | hintsPtr->width_inc = wmPtr->widthInc; hintsPtr->height_inc = wmPtr->heightInc; hintsPtr->min_aspect.x = wmPtr->minAspect.x; hintsPtr->min_aspect.y = wmPtr->minAspect.y; hintsPtr->max_aspect.x = wmPtr->maxAspect.x; hintsPtr->max_aspect.y = wmPtr->maxAspect.y; hintsPtr->win_gravity = wmPtr->gravity; hintsPtr->flags = wmPtr->sizeHintsFlags | PMinSize | PResizeInc; /* * If the window isn't supposed to be resizable, then set the minimum and * maximum dimensions to be the same. */ if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) { hintsPtr->max_width = hintsPtr->min_width = newWidth; hintsPtr->flags |= PMaxSize; } if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) { hintsPtr->max_height = hintsPtr->min_height = newHeight + wmPtr->menuHeight; hintsPtr->flags |= PMaxSize; } XSetWMNormalHints(winPtr->display, wmPtr->wrapperPtr->window, hintsPtr); XFree(hintsPtr); } /* *-------------------------------------------------------------- * * UpdateTitle -- * |
︙ | ︙ | |||
4928 4929 4930 4931 4932 4933 4934 | Tcl_DString ds; /* * Set window title: */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; | | | | 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 | Tcl_DString ds; /* * Set window title: */ string = (wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid; (void)Tcl_UtfToExternalDString(NULL, string, TCL_INDEX_NONE, &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_UtfToExternalDString(NULL, wmPtr->iconName, TCL_INDEX_NONE, &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)); } |
︙ | ︙ | |||
5239 5240 5241 5242 5243 5244 5245 | Display *display, /* Display event is coming from. */ WmInfo *wmInfoPtr, /* Window for which event is desired. */ int type, /* Type of event that is wanted. */ XEvent *eventPtr) /* Place to store event. */ { WaitRestrictInfo info; Tk_RestrictProc *prevProc; | | | 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 | Display *display, /* Display event is coming from. */ WmInfo *wmInfoPtr, /* Window for which event is desired. */ int type, /* Type of event that is wanted. */ XEvent *eventPtr) /* Place to store event. */ { WaitRestrictInfo info; Tk_RestrictProc *prevProc; void *prevArg; Tcl_Time timeout; /* * Set up an event filter to select just the events we want, and a timer * handler, then wait for events until we get the event we want or a * timeout happens. */ |
︙ | ︙ | |||
5293 5294 5295 5296 5297 5298 5299 | * WaitForEvent. * *---------------------------------------------------------------------- */ static Tk_RestrictAction WaitRestrictProc( | | | 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 | * WaitForEvent. * *---------------------------------------------------------------------- */ static Tk_RestrictAction WaitRestrictProc( void *clientData, /* Pointer to WaitRestrictInfo structure. */ XEvent *eventPtr) /* Event that is about to be handled. */ { WaitRestrictInfo *infoPtr = (WaitRestrictInfo *)clientData; if (eventPtr->type == ReparentNotify) { return TK_PROCESS_EVENT; } |
︙ | ︙ | |||
5439 5440 5441 5442 5443 5444 5445 | SetNetWmType( TkWindow *winPtr, Tcl_Obj *typePtr) { Atom *atoms = NULL; WmInfo *wmPtr; Tcl_Obj **objv; | | | | | | 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 | SetNetWmType( TkWindow *winPtr, Tcl_Obj *typePtr) { Atom *atoms = NULL; WmInfo *wmPtr; Tcl_Obj **objv; Tcl_Size objc, n; Tk_Window tkwin = (Tk_Window) winPtr; Tcl_Interp *interp = Tk_Interp(tkwin); if (TCL_OK != Tcl_ListObjGetElements(interp, typePtr, &objc, &objv)) { return TCL_ERROR; } if (!Tk_HasWrapper(tkwin)) { return TCL_OK; /* error?? */ } if (objc > 0) { atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { Tcl_DString ds, dsName; Tcl_Size len; char *name = Tcl_GetStringFromObj(objv[n], &len); Tcl_UtfToUpper(name); (void)Tcl_UtfToExternalDString(NULL, name, len, &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) { | | | 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 | 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_ExternalToUtfDString(NULL, name+20, TCL_INDEX_NONE, &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) { | | | | 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 | */ 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. */ | | | 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 | 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 && | | | 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 | 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. */ | | | 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 | && (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; |
︙ | ︙ | |||
6320 6321 6322 6323 6324 6325 6326 | protocolName = Tk_GetAtomName((Tk_Window) winPtr, protocol); for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protocol == protPtr->protocol) { Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); | | | 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 | protocolName = Tk_GetAtomName((Tk_Window) winPtr, protocol); for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protocol == protPtr->protocol) { Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", protocolName)); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); |
︙ | ︙ | |||
6472 6473 6474 6475 6476 6477 6478 | /* * ASSERT: window_ptr - windows == table.numEntries * (#matched toplevel windows == #children) [Bug 1789819] */ *window_ptr = NULL; if (numChildren) { | | | 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 | /* * ASSERT: window_ptr - windows == table.numEntries * (#matched toplevel windows == #children) [Bug 1789819] */ *window_ptr = NULL; if (numChildren) { XFree(children); } } done: Tcl_DeleteHashTable(&table); return windows; } |
︙ | ︙ | |||
6646 6647 6648 6649 6650 6651 6652 | } newPtr[count-1] = winPtr->window; newPtr[count] = topPtr->window; XSetWMColormapWindows(topPtr->display, wrapperPtr->window, newPtr, count+1); ckfree(newPtr); if (oldPtr != NULL) { | | | 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 | } newPtr[count-1] = winPtr->window; newPtr[count] = topPtr->window; XSetWMColormapWindows(topPtr->display, wrapperPtr->window, newPtr, count+1); ckfree(newPtr); if (oldPtr != NULL) { XFree(oldPtr); } } /* *---------------------------------------------------------------------- * * TkWmRemoveFromColormapWindows -- |
︙ | ︙ | |||
6742 6743 6744 6745 6746 6747 6748 | oldPtr[j] = oldPtr[j+1]; } XSetWMColormapWindows(topPtr->display, wrapperPtr->window, oldPtr, count-1); break; } } | | | 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 | oldPtr[j] = oldPtr[j+1]; } XSetWMColormapWindows(topPtr->display, wrapperPtr->window, oldPtr, count-1); break; } } XFree(oldPtr); } /* *---------------------------------------------------------------------- * * TkGetPointerCoords -- * |
︙ | ︙ | |||
6930 6931 6932 6933 6934 6935 6936 | if (wmPtr->wrapperPtr == NULL) { CreateWrapper(wmPtr); } wrapperPtr = wmPtr->wrapperPtr; if (typeFlag == TK_MAKE_MENU_TEAROFF) { atts.override_redirect = False; atts.save_under = False; | | | | > > | 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 | if (wmPtr->wrapperPtr == NULL) { CreateWrapper(wmPtr); } wrapperPtr = wmPtr->wrapperPtr; if (typeFlag == TK_MAKE_MENU_TEAROFF) { atts.override_redirect = False; atts.save_under = False; typeObj = Tcl_NewStringObj("menu", TCL_INDEX_NONE); TkSetTransientFor(tkwin, NULL); } else { atts.override_redirect = True; atts.save_under = True; if (typeFlag == TK_MAKE_MENU_DROPDOWN) { typeObj = Tcl_NewStringObj("dropdown_menu", TCL_INDEX_NONE); } else { typeObj = Tcl_NewStringObj("popup_menu", TCL_INDEX_NONE); } } Tcl_IncrRefCount(typeObj); SetNetWmType((TkWindow *)tkwin, typeObj); Tcl_DecrRefCount(typeObj); /* * The override-redirect and save-under bits must be set on the wrapper * window in order to have the desired effect. However, also set the * override-redirect bit on the window itself, so that the "wm * overrideredirect" command will see it. */ |
︙ | ︙ | |||
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, | | | 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 | 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, |
︙ | ︙ | |||
7208 7209 7210 7211 7212 7213 7214 | * the window is no longer considered to be a menubar. * *---------------------------------------------------------------------- */ static void MenubarDestroyProc( | | | 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 | * the window is no longer considered to be a menubar. * *---------------------------------------------------------------------- */ static void MenubarDestroyProc( void *clientData, /* TkWindow pointer for menubar. */ XEvent *eventPtr) /* Describes what just happened. */ { WmInfo *wmPtr; if (eventPtr->type != DestroyNotify) { return; } |
︙ | ︙ | |||
7245 7246 7247 7248 7249 7250 7251 | * None. * *---------------------------------------------------------------------- */ static void MenubarReqProc( | | | 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 | * None. * *---------------------------------------------------------------------- */ static void MenubarReqProc( void *clientData, /* Pointer to the window manager information * for tkwin's toplevel. */ Tk_Window tkwin) /* Handle for menubar window. */ { WmInfo *wmPtr = (WmInfo *)clientData; wmPtr->menuHeight = Tk_ReqHeight(tkwin); if (wmPtr->menuHeight <= 0) { |
︙ | ︙ | |||
7316 7317 7318 7319 7320 7321 7322 | static void UpdateCommand( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_DString cmds, ds; | > | | | 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 | static void UpdateCommand( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_DString cmds, ds; Tcl_Size i; int *offsets; char **cmdArgv; /* * Translate the argv strings into the external encoding. To avoid * allocating lots of memory, the strings are appended to a buffer with * nulls between each string. * * This code is tricky because we need to pass and array of pointers to * XSetCommand. However, we can't compute the pointers as we go because * the DString buffer space could get reallocated. So, store offsets for * each element as we go, then compute pointers from the offsets once the * 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_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], TCL_INDEX_NONE, &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 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | 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=4 -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 # with the distribution, which is slower but guaranteed to work. INSTALL = cp INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} WISH_OBJS = \ winMain.$(OBJEXT) TKTEST_OBJS = \ tkSquare.$(OBJEXT) \ tkTest.$(OBJEXT) \ tkWinTest.$(OBJEXT) XLIB_OBJS = \ xcolors.$(OBJEXT) \ xdraw.$(OBJEXT) \ xgc.$(OBJEXT) \ ximage.$(OBJEXT) \ |
︙ | ︙ | |||
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) \ | > > > | 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 | 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) \ | > | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | 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); @(\ | | > > > | > > | > > > > | 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 | 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.7-]} 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; | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > < < < > > > > > > > > > > > > > > > < | 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 | @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 winMain.$(OBJEXT): winMain.c $(CC) -c $(CC_SWITCHES) -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) testMain.$(OBJEXT): winMain.c $(CC) -c $(CC_SWITCHES) -DTK_TEST -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) tkTest.$(OBJEXT): tkTest.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) 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) | | > | | 818 819 820 821 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 tkUuid.h Makefile: $(SRC_DIR)/Makefile.in ./config.status # # Regenerate the stubs files. # |
︙ | ︙ |
Changes to win/README.
|
| | | 1 2 3 4 5 6 7 8 | Tk 9.0 for Windows Originally by Scott Stanton while at Sun Microsystems Labs This is the directory where you configure and compile the Windows version of Tk. This directory also contains source files for Tk that are specific to Microsoft Windows. The rest of this file contains information specific to the Windows version of Tk. |
︙ | ︙ |
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 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 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.72 for tk 9.0. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 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 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 case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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 # 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 # 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="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 case e in #( e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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 case e in #( e) exitcode=1; echo positional parameters were not saved. ;; esac 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 case e in #( e) as_have_required=no ;; esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else case e in #( e) 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 case e in #( e) 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 ;; esac 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 ;; esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # 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 |
︙ | ︙ | |||
318 319 320 321 322 323 324 | 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 #( | | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | 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. | | > | | | > | > | | | > | | | 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 | } # 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 case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac 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 case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith # 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 || | | | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | 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 |
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || | > > | > > > > > > > > > > | | | | 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 | test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' t clear :clear s/[$]LINENO.*/&-/ t lineno b :lineno 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi |
︙ | ︙ | |||
544 545 546 547 548 549 550 | as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. | | > | > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, |
︙ | ︙ | |||
571 572 573 574 575 576 577 | LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. | | | | | | | | | | | < < < < < < < < < < < < < < > > > > > > > > > > | 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 | LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tk' PACKAGE_TARNAME='tk' PACKAGE_VERSION='9.0' PACKAGE_STRING='tk 9.0' 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 |
︙ | ︙ | |||
657 658 659 660 661 662 663 | LDFLAGS_CONSOLE LDFLAGS_OPTIMIZE LDFLAGS_DEBUG CC_EXENAME CC_OBJNAME DEPARG EXTRA_CFLAGS | < > > > > > > > > > > > > > > < < < < | 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 | LDFLAGS_CONSOLE LDFLAGS_OPTIMIZE LDFLAGS_DEBUG CC_EXENAME CC_OBJNAME DEPARG EXTRA_CFLAGS CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_SHARED_LIB_SUFFIX TCL_PATCH_LEVEL 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 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 | > | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | 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 | > | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | 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' | > | | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | 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 | < < | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | 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 && | | | | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | | --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 && | | | | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | -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 ;; | > > > > > > > > > | 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | 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 && | | | | | | 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 | -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 |
︙ | ︙ | |||
1157 1158 1159 1160 1161 1162 1163 | -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; | | | | | | | | | | 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 | -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: '$ac_option' Try '$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) 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;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. |
︙ | ︙ | |||
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 || | | | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 | 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 |
︙ | ︙ | |||
1284 1285 1286 1287 1288 1289 1290 | else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi | | | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi |
︙ | ︙ | |||
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 | | | | | | | | | > | | > > > | | | | 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 | # # 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 9.0 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. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, 'make install' will install all the files in '$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify an installation prefix other than '$ac_default_prefix' using '--prefix', for instance '--prefix=\$HOME'. For better control, use the options below. 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 9.0:";; 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) 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> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { 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; } | | > | | | | | | | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | > | | < < < < < < < > | < < < < < > | < < < < < < | < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < | | < < < < < < < < < < < < < < < < < < < < < > | < < | < | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | 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 | 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 9.0 generated by GNU Autoconf 2.72 Copyright (C) 2023 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 case e in #( e) 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 case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) eval "$3=yes" ;; esac 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 ;; esac 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 9.0, which was generated by GNU Autoconf 2.72. 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 | > | > > > | | 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 | _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 ;; *\'*) | | | 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 | 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 | > > | | | | 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 | # 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 | | | | | | | | | | | < | < < | < < | < < | < < | < < | < < < < | < < < < | < | < > | | > > > > > | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | > | > | | | | | 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 | 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 (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; } /* C89 style stringification. */ #define noexpand_stringify(a) #a const char *stringified = noexpand_stringify(arbitrary+token=sequence); /* C89 style token pasting. Exercises some of the corner cases that e.g. old MSVC gets wrong, but not very hard. */ #define noexpand_concat(a,b) a##b #define expand_concat(a,b) noexpand_concat(a,b) extern int vA; extern int vbee; #define aye A #define bee B int *pvA = &expand_concat(v,aye); int *pvbee = &noexpand_concat(v,bee); /* 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 // See if C++-style comments work. #include <stdbool.h> extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); extern void free (void *); // 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) { // 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; // Work around memory leak warnings. free (ia); // 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=9.0 TK_MAJOR_VERSION=9 TK_MINOR_VERSION=0 TK_PATCH_LEVEL="b2" 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 | > > > > > > > > > | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | > | | | | | | > | > | | | | | | | | | > | | | | | | | | | > | | | | | | | | > | | | > > | | | | | | | | | | | | | | > | | | > | | | | | | | > | | | | | > | > | | | | | > | | | | | > | | > | | > | | > > | | | | > | | | | | > | | | | > | | | | > | > | > | | > | | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | > | | | | | < < < | | | < > | > > > > | | > > | | > > | | | > | | | | | | > | | > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < | < < < < < < < < < < < < < < < | < < < < | < < < < < | | < < < < < | | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < < < < < < | < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | | | > | | | | > | | | | | | | > | | < | < < < < < < | | | | | | | 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 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 | #------------------------------------------------------------------------ # 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) ac_file='' ;; esac 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 case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; esac 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 case e in #( e) { { 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; } ;; esac 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"); if (!f) return 1; 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.o conftest.obj 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 case e in #( e) 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 case e in #( e) 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; } ;; esac fi rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu ;; esac 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 case e in #( e) 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 case e in #( e) 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 case e in #( e) 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 ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) { 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" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) tcl_ok=yes ;; esac 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. | | > | | | > | | | | | | 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 | # 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 case e in #( e) # 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 |
︙ | ︙ | |||
3772 3773 3774 3775 3776 3777 3778 | `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi done fi | | > | | | | | | | | | 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 | `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi done fi ;; esac fi 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 |
| < < < < < < | | | < < < < < < < < < < < < < < < < < | | | > | | > | | | | | | > | | | > | > > > | | | > | | | | | | | > | | | > | > > > | | | > | | | | | | | | > | | | | | > | | > | | > | | > > > > > > > | 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 | if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MINOR_VERSION}" -lt 7; then as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.7+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.7 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 case e in #( e) do64bit=no ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 case e in #( e) ac_cv_cross=yes ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 | | | | | | | | | | | > | | | | | > | | > | | > | | > > > | | | > | | | | | | > | | | | > | | > | | > | | > | | > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | 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 | 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 case e in #( e) 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 case e in #( e) ac_cv_win32=yes ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) # 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 case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac 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 case e in #( e) ac_cv_municode=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) ac_cv_nolto=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_cc_input_charset=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags ;; esac 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 case e in #( e) 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 case e in #( e) ac_cv_enable_auto_image_base=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 | | | > > > > > | | | | > | | | > | | | | | | | | | | 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 | #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 case e in #( e) tcl_win_64bit=no ;; esac 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 | > > > | | < | | | 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 | 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 | | | | | > | | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | > | > | > | | | | | | > | | | | | > | | > | | > | | < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < | < < < < < < < < < < | | > | < | | | > | | | | | > | | > | | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | > < | | | > | | | | | > | | > | | > | | | < > > | | < > | > > > > > | > > > > > > > > > > > > > > | | > > > > > > | > > > > > > > > | > > | > > > > > > > > | < > | > > > > > | > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > | | | > | | > | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | | > | > | | | | | | | | | | | > | | | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | > > > > | > > > > > > > > > > > | > > > > | | > > > | > | | < | > | 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 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 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 | 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 case e in #( e) if test "$cross_compiling" = yes then : tcl_cv_seh=no else case e in #( e) # 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 case e in #( e) 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 ;; esac 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 case e in #( e) tcl_cv_seh=no ;; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_eh_disposition=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 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 case e in #( e) 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 case e in #( e) tcl_cv_cast_to_union=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac 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 case e in #( e) MAN2TCLFLAGS="-DNO_ERRNO_H" ;; esac 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 case e in #( e) 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 case e in #( e) tcl_cv_strtoi64=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac 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 case e in #( e) { 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 case e in #( e) 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 case e in #( e) tcl_ok=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$tcl_ok" = yes && break; fi done ;; esac 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 ;; esac 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 case e in #( e) { 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 case e in #( e) 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 case e in #( e) tcl_ok=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$tcl_ok" = yes && break; fi done ;; esac 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 ;; esac 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 case e in #( e) tcl_ok=no ;; esac 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 case e in #( e) # 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 case e in #( e) # Broken: fails on valid input. continue ;; esac 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 case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac 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 ;; esac 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 case e in #( e) # Broken: fails on valid input. continue ;; esac 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 case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac 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 case e in #( e) { { 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; } ;; esac 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 egrep -e" >&5 printf %s "checking for egrep -e... " >&6; } if test ${ac_cv_path_EGREP_TRADITIONAL+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_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_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "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_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then : fi else ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL fi if test "$ac_cv_path_EGREP_TRADITIONAL" then : ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_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_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "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_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_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_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; 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_TRADITIONAL=$EGREP_TRADITIONAL fi ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; } EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL { 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 case e in #( e) embed_ok=yes ;; esac 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_TRADITIONAL "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 case e in #( e) 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 ;; esac 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 case e in #( e) tcl_ok=yes ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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 case e in #( e) 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 ;; esac 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}" 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${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}\"" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then eval "TK_STUB_LIB_FLAG=\"-ltkstub${LIBFLAGSUFFIX}\"" else eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\"" fi 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} CFG_TK_UNSHARED_LIB_SUFFIX=${TK_UNSHARED_LIB_SUFFIX} #-------------------------------------------------------------------- # Adjust the defines for how the resources are built depending # on symbols and static vs. shared. #-------------------------------------------------------------------- if test ${SHARED_BUILD} = 0; then RC_DEFINES="${RC_DEFINE} STATIC_BUILD" TK_RES="" else RC_DEFINES="" TK_RES='tk.$(RES)' fi # The wish.exe.manifest requires these # TK_WIN_VERSION is the 4 dotted pair Windows version format which needs # the release level, and must account for interim release versioning case "$TK_PATCH_LEVEL" in *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 |
︙ | ︙ | |||
5041 5042 5043 5044 5045 5046 5047 | # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # | | | | | | | | | | | | | 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 | # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # 'ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # 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 done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; 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}' |
︙ | ︙ | |||
5143 5144 5145 5146 5147 5148 5149 | :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote | | < < | | | | 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 | :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` 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 | | > | | > > > > > > > > > < < < < < < < < | | < | | < < < < < < | < < < < < < < | > > | < < > | | > > > > > > > > > | > > > > | < < < < < < < > | > > > | | | < < < < < < < < < < < < < < < < < < < < | | | 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 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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 case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; 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. |
︙ | ︙ | |||
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. | > | > | | | > | > | | | > | 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 | # --------------- # 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 case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac 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 case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else |
︙ | ︙ | |||
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 || | | | 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 | 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 5474 5475 5476 5477 5478 | # 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: | > > > > > > > > > > | | | | 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 | # 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 fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi |
︙ | ︙ | |||
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 #( | | | | 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 | 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 |
︙ | ︙ | |||
5555 5556 5557 5558 5559 5560 5561 | { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. | | > | > | | | 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 | { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF 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 9.0, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
︙ | ︙ | |||
5601 5602 5603 5604 5605 5606 5607 | # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ | | | 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 | # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ '$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit |
︙ | ︙ | |||
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 | > > | | | | | 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 | 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 9.0 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" Copyright (C) 2023 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 ) | | | | | | | | | | | | | 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 6749 6750 6751 6752 6753 6754 6755 6756 6757 | 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." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" 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 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;; "wish.exe.manifest") CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;; *) 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 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: # after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 |
︙ | ︙ | |||
5782 5783 5784 5785 5786 5787 5788 | tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. | | | 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 | tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. |
︙ | ︙ | |||
5948 5949 5950 5951 5952 5953 5954 | for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; | | | 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 | for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS |
︙ | ︙ | |||
5970 5971 5972 5973 5974 5975 5976 | ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, | | | | | | | | | | | 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 | ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain ':'. 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= ;; *) | | | | 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 | 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@*) | | | | | 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 | /@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 s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 |
︙ | ︙ | |||
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"; } && | | | | 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 | 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 | | | > | 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 | $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],[9.0]) 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=9.0 TK_MAJOR_VERSION=9 TK_MINOR_VERSION=0 TK_PATCH_LEVEL="b2" 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. |
︙ | ︙ | |||
72 73 74 75 76 77 78 | # Locate and source the tclConfig.sh file. #-------------------------------------------------------------------- SC_PATH_TCLCONFIG($TK_PATCH_LEVEL) SC_LOAD_TCLCONFIG if test "${TCL_MAJOR_VERSION}" -lt 9 ; then | < < < < < | | | > > > > | | < < > > > > > > > > > > > > | < | > | | > > > > > > > > | > | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | > > > > | > > > > > > > > > > > | > > > > | | > > > | > | | < | | 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 | # Locate and source the tclConfig.sh file. #-------------------------------------------------------------------- SC_PATH_TCLCONFIG($TK_PATCH_LEVEL) SC_LOAD_TCLCONFIG if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MINOR_VERSION}" -lt 7; then AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.7+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.7 or better.]) 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. #-------------------------------------------------------------------- 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 ]) #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- SC_ENABLE_SYMBOLS #-------------------------------------------------------------------- # 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}" 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${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}\"" if test "${TCL_MAJOR_VERSION}" -gt 8 ; then eval "TK_STUB_LIB_FLAG=\"-ltkstub${LIBFLAGSUFFIX}\"" else eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\"" fi 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} CFG_TK_UNSHARED_LIB_SUFFIX=${TK_UNSHARED_LIB_SUFFIX} #-------------------------------------------------------------------- # Adjust the defines for how the resources are built depending # on symbols and static vs. shared. #-------------------------------------------------------------------- if test ${SHARED_BUILD} = 0; then RC_DEFINES="${RC_DEFINE} STATIC_BUILD" TK_RES="" else RC_DEFINES="" TK_RES='tk.$(RES)' fi |
︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | 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) AC_SUBST(TCL_MAJOR_VERSION) AC_SUBST(TCL_MINOR_VERSION) AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX) | > > < | 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 | 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) AC_SUBST(TCL_MAJOR_VERSION) AC_SUBST(TCL_MINOR_VERSION) AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX) AC_SUBST(CFLAGS_DEFAULT) AC_SUBST(EXTRA_CFLAGS) AC_SUBST(CYGPATH) AC_SUBST(DEPARG) AC_SUBST(CC_OBJNAME) AC_SUBST(CC_EXENAME) |
︙ | ︙ | |||
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) | | > | | 375 376 377 378 379 380 381 382 383 384 385 386 387 | 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.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # Copyright (c) 2003-2008 Pat Thoyts. # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ # General usage: # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # | | | | > | | | 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 | # Copyright (c) 2003-2008 Pat Thoyts. # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ # General usage: # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # # For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) # or examine Sections 7-9 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. # 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. # shell -- Just builds the shell and the core. # core -- Only builds the core [tkXX.(dll|lib)]. # all -- Builds everything. # test -- Builds and runs the test suite. # tktest -- Just builds the test shell. # install -- Installs the built binaries and libraries to $(INSTALLDIR) # as the root of the install tree. # cwish -- Builds a console version of wish. # tidy/clean/hose -- varying levels of cleaning. # genstubs -- Rebuilds the Stubs table and support files (dev only). # depend -- Generates an accurate set of source dependancies for this # makefile. Helpful to avoid problems when the sources are |
︙ | ︙ | |||
80 81 82 83 84 85 86 | # Default target to build if no target is specified. If unspecified, the # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release # We have a custom resource file RCFILE = tk.rc | < < > > > > > > < < < < | < < > > > > > > > > > > > | | | | | 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 | # Default target to build if no target is specified. If unspecified, the # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release # We have a custom resource file RCFILE = tk.rc # 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"] TTK_SQUARE_WIDGET = 0 TK_EMBED_SCRIPTS = 1 !else !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 = 1 !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$(VERSION)$(SUFX).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 \ $(TMP_DIR)\tkSquare.obj \ $(TMP_DIR)\tkTest.obj \ $(TMP_DIR)\tkWinTest.obj \ $(TMP_DIR)\tktest.res XLIBOBJS = \ $(TMP_DIR)\xcolors.obj \ $(TMP_DIR)\xdraw.obj \ $(TMP_DIR)\xgc.obj \ $(TMP_DIR)\ximage.obj \ $(TMP_DIR)\xutil.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 \ | > > > | 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 | $(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 \ | > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | $(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)" | > > > > > > | | < < < < | < > > > > > > > > > > > > > > > > > | 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 | $(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=4 \ !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 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)\ $? | > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | $(_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)" @$(TCLSH) << cd {$(OUT_DIR)} 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" @$(TCLSH) << cd {$(OUT_DIR)} file delete -force {$@} zipfs mount "$(TCLSCRIPTZIP:\=/)" mnt 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 \ | > | | > > | > > | > | > > > > > > > > | 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 | @$(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)\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$@ $? |
︙ | ︙ | |||
606 607 608 609 610 611 612 | !endif #--------------------------------------------------------------------- # Dependency rules #--------------------------------------------------------------------- $(TMP_DIR)\tk.res: \ | < | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | !endif #--------------------------------------------------------------------- # Dependency rules #--------------------------------------------------------------------- $(TMP_DIR)\tk.res: \ $(RCDIR)\cursor*.cur \ $(RCDIR)\tk.ico !if exist("$(OUT_DIR)\depend.mk") !include "$(OUT_DIR)\depend.mk" !message *** Dependency rules in use. !else |
︙ | ︙ | |||
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 | {$(ROOT)\unix}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << $(TMP_DIR)\tk.res: $(TMP_DIR)\wish.exe.manifest $(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest .SUFFIXES: .SUFFIXES:.c .rc #--------------------------------------------------------------------- # Installation. #--------------------------------------------------------------------- install-binaries: @echo installing binaries @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\" !if "$(TKLIB)" != "$(TKIMPLIB)" @$(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 | > | > > > | > > | > > | > > > > > > > | 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 | {$(ROOT)\unix}.c{$(TMP_DIR)}.obj:: $(CCPKGCMD) @<< $< << $(TMP_DIR)\tk.res: $(TMP_DIR)\wish.exe.manifest $(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest $(TMP_DIR)\tktest.res: $(TMP_DIR)\wish.exe.manifest .SUFFIXES: .SUFFIXES:.c .rc #--------------------------------------------------------------------- # Installation. #--------------------------------------------------------------------- install-binaries: @echo installing binaries @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\" !if "$(TKLIB)" != "$(TKIMPLIB)" @$(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.7-]} 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) | > > > > > | 803 804 805 806 807 808 809 810 811 812 813 814 | @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 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 | /* * ---------------------------------------------------------------------------- * 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) #if _MSC_VER >= 1400 && _MSC_VER < 1500 #pragma comment(lib, "bufferoverflowU") #endif #endif /* ISO hack for dumb VC++ */ #if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1900 #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); |
︙ | ︙ | |||
206 207 208 209 210 211 212 | char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; char cmdline[100]; hProcess = GetCurrentProcess(); | | | | | | | 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 | char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; char cmdline[100]; hProcess = GetCurrentProcess(); memset(&pi, 0, sizeof(PROCESS_INFORMATION)); memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = INVALID_HANDLE_VALUE; memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES)); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = FALSE; /* * Create a non-inheritable pipe. */ CreatePipe(&Out.pipe, &h, &sa, 0); /* * Dupe the write side, make it inheritable, and close the original. */ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Same as above, but for the error side. |
︙ | ︙ | |||
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 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 | || 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]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; int i; char cmdline[255]; hProcess = GetCurrentProcess(); memset(&pi, 0, sizeof(PROCESS_INFORMATION)); memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = INVALID_HANDLE_VALUE; memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES)); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; /* * Create a non-inheritible pipe. */ CreatePipe(&Out.pipe, &h, &sa, 0); /* * Dupe the write side, make it inheritable, and close the original. */ DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* * Same as above, but for the error side. |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
594 595 596 597 598 599 600 | } } /* * SubstituteFile -- * As windows doesn't provide anything useful like sed and it's unreliable * to use the tclsh you are building against (consider x-platform builds - | | < < | | | | | > > > > > > > > > > > | < < | < < < > | | 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 | } } /* * SubstituteFile -- * As windows doesn't provide anything useful like sed and it's unreliable * to use the tclsh you are building against (consider x-platform builds - * e.g. compiling AMD64 target from IX86) we provide a simple substitution * option here to handle autoconf style substitutions. * The substitution file is whitespace and line delimited. The file should * consist of lines matching the regular expression: * \s*\S+\s+\S*$ * * Usage is something like: * nmakehlp -S << $** > $@ * @PACKAGE_NAME@ $(PACKAGE_NAME) * @PACKAGE_VERSION@ $(PACKAGE_VERSION) * << */ 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 substitutions 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; |
︙ | ︙ |
Deleted win/rc/buttons.bmp.
cannot compute difference between binary files
Deleted win/rc/lamp.bmp.
cannot compute difference between binary files
Changes to win/rc/tk.rc.
︙ | ︙ | |||
32 33 34 35 36 37 38 | BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tk DLL\0" VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0" | < | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tk DLL\0" VALUE "OriginalFilename", "tk" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".dll\0" VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 1987-2022 Regents of the University of California and other parties\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/tk_base.rc.
︙ | ︙ | |||
45 46 47 48 49 50 51 | COMBOBOX cmb1,8,253,135,21,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL END | < < < < < < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | COMBOBOX cmb1,8,253,135,21,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL END // // Cursors // X_cursor CURSOR DISCARDABLE "cursor00.cur" arrow CURSOR DISCARDABLE "cursor02.cur" based_arrow_down CURSOR DISCARDABLE "cursor04.cur" |
︙ | ︙ |
Added win/rc/tktest.rc.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | // // Version Resource Script // #include <windows.h> #include <tk.h> // // build-up the name suffix that defines the type of build this is. // #if STATIC_BUILD #define SUFFIX_STATIC "s" #else #define SUFFIX_STATIC "" #endif #if DEBUG && !UNCHECKED #define SUFFIX_DEBUG "g" #else #define SUFFIX_DEBUG "" #endif #define SUFFIX SUFFIX_STATIC SUFFIX_DEBUG VS_VERSION_INFO VERSIONINFO FILEVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL PRODUCTVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL FILEFLAGSMASK 0x3fL #ifdef DEBUG FILEFLAGS VS_FF_DEBUG #else FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_APP FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Tktest Application\0" VALUE "OriginalFilename", "tktest" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0" VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 1987-2022 Regents of the University of California and other parties\0" VALUE "ProductName", "Tk " TK_VERSION " for Windows\0" VALUE "ProductVersion", TK_PATCH_LEVEL END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END // // Icon // // The icon whose name or resource ID is lexigraphically first, is used // as the application's icon. // app ICON DISCARDABLE "wish.ico" #if STATIC_BUILD #include "tk_base.rc" #endif // // This enables themed scrollbars in XP by trying to use comctl32 v6. // #ifndef RT_MANIFEST #define RT_MANIFEST 24 #endif #ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #endif CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "wish.exe.manifest" |
Changes to win/rc/wish.rc.
︙ | ︙ | |||
38 39 40 41 42 43 44 | BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Wish Application\0" VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0" | < | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "Wish Application\0" VALUE "OriginalFilename", "wish" STRINGIFY(TK_MAJOR_VERSION) STRINGIFY(TK_MINOR_VERSION) SUFFIX ".exe\0" VALUE "FileVersion", TK_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 1987-2022 Regents of the University of California and other parties\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 = 11 # 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)" == "" |
︙ | ︙ | |||
75 76 77 78 79 80 81 | # 1. First define the external tools used for compiling, copying etc. # as this is independent of everything else. # 2. Figure out our build structure in terms of the directory, whether # we are building Tcl or an extension, etc. # 3. Determine the compiler and linker versions # 4. Build the nmakehlp helper application # 5. Determine the supported compiler options and features | > > | | | < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | # 1. First define the external tools used for compiling, copying etc. # as this is independent of everything else. # 2. Figure out our build structure in terms of the directory, whether # we are building Tcl or an extension, etc. # 3. Determine the compiler and linker versions # 4. Build the nmakehlp helper application # 5. Determine the supported compiler options and features # 6. Extract Tcl, Tk, and possibly extensions, version numbers from the # headers # 7. Parse the OPTS macro value for user-specified build configuration # 8. Parse the STATS macro value for statistics instrumentation # 9. Parse the CHECKS macro for additional compilation checks # 10. Based on this selected configuration, construct the output # directory and file paths # 11. Construct the paths where the package is to be installed # 12. Set up the actual options passed to compiler and linker based # on the information gathered above. # 13. Define some standard build targets and implicit rules. These may # be optionally disabled by the parent makefile. |
︙ | ︙ | |||
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. | | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | # 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 | > > | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | _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 | > > > > > > > | 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 | #---------------------------------------------------------------- # 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: | > > > > > | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | !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 ######################################################################## | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | < < | 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) "define 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) # 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 896 | !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 [nmakehlp -f $(OPTS) "tcl8"] !message *** Build for Tcl8 TCL_BUILD_FOR = 8 !endif !if $(TCL_MAJOR_VERSION) == 8 !if [nmakehlp -f $(OPTS) "time64bit"] !message *** Force 64-bit time_t _USE_64BIT_TIME_T = 1 !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 DEBUG = 1 |
︙ | ︙ | |||
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., # |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | SUFX = $(SUFX:s=) EXT = dll TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !else TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) EXT = lib | | | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | SUFX = $(SUFX:s=) EXT = dll TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !else TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) EXT = lib !if $(MSVCRT) && $(TCL_VERSION) > 86 || !$(MSVCRT) && $(TCL_VERSION) < 87 TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif !if !$(TCL_THREADS) || $(TCL_VERSION) > 86 TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) |
︙ | ︙ | |||
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 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 | !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) !if $(TCL_MAJOR_VERSION) == 8 TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib !else TCLSTUBLIBNAME = $(STUBPREFIX).lib !endif TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)" !else # !$(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl # When building extensions, we need to locate tclsh. Depending on version # of Tcl we are building against, this may or may not have a "t" suffix. # Try various possibilities in turn. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist("$(TCLSH)") TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif !if $(TCL_MAJOR_VERSION) == 8 TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib !else TCLSTUBLIB = $(_TCLDIR)\lib\tclstub.lib !endif TCLIMPLIB = $(_TCLDIR)\lib\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)\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 !if $(TCL_MAJOR_VERSION) == 8 TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib !else TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub.lib !endif 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 !if !$(STATIC_BUILD) && "$(TCL_BUILD_FOR)" == "8" tcllibs = "$(TCLSTUBLIB)" !else tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" !endif !endif # $(DOING_TCL) # We need a tclsh that will run on the host machine as part of the build. # IX86 runs on all architectures. !ifndef TCLSH_NATIVE !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" TCLSH_NATIVE = $(TCLSH) !else !error You must explicitly set TCLSH_NATIVE for cross-compilation !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 || "$(TCL_BUILD_FOR)" == "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 !if $(TK_MAJOR_VERSION) == 8 TKSTUBLIBNAME = tkstub$(TK_VERSION).lib !else TKSTUBLIBNAME = tkstub.lib !endif !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 || "$(TCL_BUILD_FOR)" == "8" PRJLIBNAME = $(PRJLIBNAME8) !else PRJLIBNAME = $(PRJLIBNAME9) !endif PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) !if $(TCL_MAJOR_VERSION) == 8 PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib !else PRJSTUBLIBNAME = $(STUBPREFIX).lib !endif PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. !if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) !ifdef RCFILE RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res) |
︙ | ︙ | |||
1268 1269 1270 1271 1272 1273 1274 | # 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main # makefile should use these in combination with whatever other flags # and switches are specific to it. # The following macros are defined, names are for historical compatibility: # OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS | | | | | 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 | # 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main # makefile should use these in combination with whatever other flags # and switches are specific to it. # The following macros are defined, names are for historical compatibility: # OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS # COMPILERFLAGS - /Dxxx C macro flags independent of any configuration options # crt - Compiler switch that selects the appropriate C runtime # cdebug - Compiler switches related to debug AND optimizations # cwarn - Compiler switches that set warning levels # cflags - complete compiler switches (subsumes cdebug and cwarn) # ldebug - Linker switches controlling debug information and optimization # 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 | | | 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | 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 | | | < < < > > > | 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 | !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_BUILD_FOR)" == "8" OPTDEFINES = $(OPTDEFINES) /DTCL_MAJOR_VERSION=8 !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) | | | | > > > > > > > > > | 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 | 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) !if !$(DOING_TCL) && !$(DOING_TK) INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WIN_DIR)" -I"$(COMPATDIR)" !endif # These flags are defined roughly in the order of the pre-reform # rules.vc/makefile.vc to help visually compare that the pre- and # post-reform build logs # cflags contains generic flags used for building practically all object files cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) !if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 cflags = $(cflags) -DTcl_Size=int !endif # appcflags contains $(cflags) and flags for building the application # object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus # flags used for building shared object files The two differ in the # BUILD_$(PROJECT) macro which should be defined only for the shared # library *implementation* and not for its caller interface |
︙ | ︙ | |||
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. | | | 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | # 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 | < < < < < < < < < < < < | 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 | !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. |
︙ | ︙ | |||
1528 1529 1530 1531 1532 1533 1534 | LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ | | > | > > > > > | > > > > > > | 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 | LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) /DSTATIC_BUILD=$(STATIC_BUILD) \ /DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ /DCOMMAVERSION=$(RCCOMMAVERSION) \ /DDOTVERSION=\"$(DOTVERSION)\" \ /DVERSION=\"$(VERSION)\" \ /DSUFX=\"$(SUFX)\" \ /DPROJECT=\"$(PROJECT)\" \ /DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET 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: | > > | 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 | @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 | | | | 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 | !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) |
︙ | ︙ |
Changes to win/stubs.c.
1 2 3 4 5 6 7 8 | #include "tkInt.h" /* * Undocumented Xlib internal function */ int _XInitImageFuncPtrs( | | < < | | | < < < | | | < < < < | | | | | | | | < < < < < < < < < | < | | | < < < < | | < < < | | < < < | | < < < | < < | | < < < | | | < < < < | | | | < < < < < | | | < < < < | | | < < < < | | | | | < < < < < < | | < < < | | < < < | | | | < < < < < | | | | | | < < < < < < < | < < | | < < < | | | < < < < | | | | | < < < < < < | | | | < < < < < | < < | | | < < < < | | | < < < < | | | < < < < | | | < < < < | | | < < < < | | | < < < < | | | < < < < | | | | | | | | < < < < < < < < < | | | | < < < < < | | | < < < < | | | | | | < < < < < < < | | | | | | | < < < < < < < < | < < | < < | < < | | | < | < | < | < | | | < < < < | 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 | #include "tkInt.h" /* * Undocumented Xlib internal function */ int _XInitImageFuncPtrs( TCL_UNUSED(XImage *)) { return Success; } /* * From Xutil.h */ void XSetWMClientMachine( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(XTextProperty *)) { } Status XStringListToTextProperty( TCL_UNUSED(char **), TCL_UNUSED(int), TCL_UNUSED(XTextProperty *)) { return Success; } /* * From Xlib.h */ int XChangeProperty( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Atom), TCL_UNUSED(Atom), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(_Xconst unsigned char *), TCL_UNUSED(int)) { return Success; } XIC XCreateIC(TCL_UNUSED(XIM), ...) { return NULL; } int XDeleteProperty( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Atom)) { return Success; } Bool XFilterEvent( TCL_UNUSED(XEvent *), TCL_UNUSED(Window)) { return 0; } int XForceScreenSaver( TCL_UNUSED(Display *), TCL_UNUSED(int)) { return Success; } int XFreeCursor( TCL_UNUSED(Display *), TCL_UNUSED(Cursor)) { return Success; } GContext XGContextFromGC( TCL_UNUSED(GC)) { return (GContext) NULL; } char * XGetAtomName( TCL_UNUSED(Display *), TCL_UNUSED(Atom)) { return NULL; } int XGetWindowAttributes( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(XWindowAttributes *)) { return Success; } Status XGetWMColormapWindows( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Window **), TCL_UNUSED(int *)) { return Success; } int XIconifyWindow( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(int)) { return Success; } XHostAddress * XListHosts( TCL_UNUSED(Display *), TCL_UNUSED(int *), TCL_UNUSED(Bool *)) { return NULL; } int XLookupColor( TCL_UNUSED(Display *), TCL_UNUSED(Colormap), TCL_UNUSED(_Xconst char *), TCL_UNUSED(XColor *), TCL_UNUSED(XColor *)) { return Success; } int XNextEvent( TCL_UNUSED(Display *), TCL_UNUSED(XEvent *)) { return Success; } int XPutBackEvent( TCL_UNUSED(Display *), TCL_UNUSED(XEvent *)) { return Success; } int XQueryColors( TCL_UNUSED(Display *), TCL_UNUSED(Colormap), TCL_UNUSED(XColor *), TCL_UNUSED(int)) { return Success; } int XQueryTree( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Window *), TCL_UNUSED(Window *), TCL_UNUSED(Window **), TCL_UNUSED(unsigned int *)) { return Success; } int XRefreshKeyboardMapping( TCL_UNUSED(XMappingEvent *)) { return Success; } Window XRootWindow( TCL_UNUSED(Display *), TCL_UNUSED(int)) { return (Window) NULL; } int XSelectInput( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(long)) { return Success; } int XSendEvent( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Bool), TCL_UNUSED(long), TCL_UNUSED(XEvent *)) { return Success; } int XSetCommand( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(char **), TCL_UNUSED(int)) { return Success; } XErrorHandler XSetErrorHandler( TCL_UNUSED(XErrorHandler)) { return NULL; } int XSetIconName( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(_Xconst char *)) { return Success; } int XSetWindowBackground( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBackgroundPixmap( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorder( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBorderPixmap( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorderWidth( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(unsigned int)) { return Success; } int XSetWindowColormap( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Colormap)) { return Success; } Bool XTranslateCoordinates( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Window), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(int *), TCL_UNUSED(int *), TCL_UNUSED(Window *)) { return 0; } int XWindowEvent( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(long), TCL_UNUSED(XEvent *)) { return Success; } int XWithdrawWindow( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(int)) { return Success; } int XmbLookupString( TCL_UNUSED(XIC), TCL_UNUSED(XKeyPressedEvent *), TCL_UNUSED(char *), TCL_UNUSED(int), TCL_UNUSED(KeySym *), TCL_UNUSED(Status *)) { return Success; } int XGetWindowProperty( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Atom), TCL_UNUSED(long), TCL_UNUSED(long), TCL_UNUSED(Bool), TCL_UNUSED(Atom), Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **prop_return) { *actual_type_return = None; *actual_format_return = 0; *nitems_return = 0; *bytes_after_return = 0; *prop_return = NULL; return BadValue; } /* * The following functions were implemented as macros under Windows. */ int XFlush( TCL_UNUSED(Display *)) { return 0; } int XGrabServer( TCL_UNUSED(Display *)) { return 0; } int XUngrabServer( TCL_UNUSED(Display *)) { return 0; } int XFree( void *data) { if (data != NULL) { ckfree(data); } return 0; } int XNoOp( Display *display) { LastKnownRequestProcessed(display)++; return 0; } XAfterFunction XSynchronize( Display *display, TCL_UNUSED(Bool)) { LastKnownRequestProcessed(display)++; return NULL; } int XSync( Display *display, TCL_UNUSED(Bool)) { LastKnownRequestProcessed(display)++; return 0; } VisualID XVisualIDFromVisual( Visual *visual) { return visual->visualid; } int XOffsetRegion( TCL_UNUSED(Region), TCL_UNUSED(int), TCL_UNUSED(int)) { return 0; } |
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 999 1000 1001 | 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 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. # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the tcl build dir. #------------------------------------------------------------------------ AC_DEFUN([SC_WITH_TCL], [ if test -d ../../tcl9.0$1/win; then TCL_BIN_DEFAULT=../../tcl9.0$1/win else TCL_BIN_DEFAULT=../../tcl9.0/win fi AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 9.0 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) if test ! -d $TCL_BIN_DIR; then AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) fi if test ! -f $TCL_BIN_DIR/Makefile; then AC_MSG_ERROR(There is no Makefile in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) else |
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | # extension can't assume that an executable Tcl shell exists at # build time. # # Arguments # none # # Results | | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | # extension can't assume that an executable Tcl shell exists at # build time. # # Arguments # none # # Results # Substitutes the following values: # TCLSH_PROG #------------------------------------------------------------------------ AC_DEFUN([SC_PROG_TCLSH], [ AC_MSG_CHECKING([for tclsh]) AC_CACHE_VAL(ac_cv_path_tclsh, [ |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | # when running tests from an extension build directory. It is not # correct to use the TCLSH_PROG in cases like this. # # Arguments # none # # Results | | | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | # when running tests from an extension build directory. It is not # correct to use the TCLSH_PROG in cases like this. # # Arguments # none # # Results # Substitutes 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 | < | | 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | 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, | | | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | # 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" \ |
︙ | ︙ |
Changes to win/tkConfig.sh.in.
︙ | ︙ | |||
31 32 33 34 35 36 37 | # The name of the Tk library (may be either a .a file or a shared library): TK_LIB_FILE='@TK_LIB_FILE@' # Additional libraries to use when linking Tk. TK_LIBS='@LIBS@ @LIBS_GUI@' | | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # The name of the Tk library (may be either a .a file or a shared library): TK_LIB_FILE='@TK_LIB_FILE@' # Additional libraries to use when linking Tk. TK_LIBS='@LIBS@ @LIBS_GUI@' # Top-level directory in which Tk's platform-independent files are # installed. TK_PREFIX='@prefix@' # Top-level directory in which Tk's platform-specific files (e.g. # executables) are installed. TK_EXEC_PREFIX='@exec_prefix@' # -l flag to pass to the linker to pick up the Tk library TK_LIB_FLAG='@TK_LIB_FLAG@' # String to pass to linker to pick up the Tk library from its # build directory. TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@' # String to pass to linker to pick up the Tk library from its |
︙ | ︙ |
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 © 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" |
︙ | ︙ | |||
32 33 34 35 36 37 38 | WNDPROC oldProc; /* Old window procedure. */ HWND hwnd; /* Current window handle. */ Pixmap pixmap; /* Bitmap for rendering the button. */ DWORD style; /* Window style flags. */ } WinButton; /* | < < < < < < < < < < < < < < < < < < < < < < | < < < < < < > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > | | | < < < < < | | < < < < < < < < < | < < < < < < < | | < < < | < < < < < < < < < < < < < < < < < | 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 | WNDPROC oldProc; /* Old window procedure. */ HWND hwnd; /* Current window handle. */ Pixmap pixmap; /* Bitmap for rendering the button. */ DWORD style; /* Window style flags. */ } WinButton; /* * Cached information about the checkbutton and radiobutton indicator boxes */ typedef struct { BOOLEAN initialized; int boxSize; /* Width & height of the box. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Data of the SVG images used for drawing the indicators */ static const char checkbtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v15h1v-14h14v-1z' fill='#a0a0a0'/>\n\ <path d='m1 1v13h1v-12h12v-1z' fill='#696969'/>\n\ <path d='m14 1v13h-13v1h14v-14z' fill='#e3e3e3'/>\n\ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\ </svg>"; static const char checkbtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <path d='m0 0v15h1v-14h14v-1z' fill='#a0a0a0'/>\n\ <path d='m1 1v13h1v-12h12v-1z' fill='#696969'/>\n\ <path d='m14 1v13h-13v1h14v-14z' fill='#e3e3e3'/>\n\ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\ <path d='m4.5 8 3 3 4-6' fill='none' stroke='#000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/>\n\ </svg>"; static const char radiobtnOffData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#a0a0a0' offset='0'/>\n\ <stop stop-color='#eeeeee' offset='1'/>\n\ </linearGradient>\n\ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#696969' offset='0'/>\n\ <stop stop-color='#e3e3e3' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\ </svg>"; static const char radiobtnOnData[] = "\ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\ <defs>\n\ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#a0a0a0' offset='0'/>\n\ <stop stop-color='#eeeeee' offset='1'/>\n\ </linearGradient>\n\ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\ <stop stop-color='#696969' offset='0'/>\n\ <stop stop-color='#e3e3e3' offset='1'/>\n\ </linearGradient>\n\ </defs>\n\ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\ <circle cx='8' cy='8' r='3' fill='#000000'/>\n\ </svg>"; /* * Declarations for functions defined in this file. */ static LRESULT CALLBACK ButtonProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static Window CreateProc(Tk_Window tkwin, Window parent, void *instanceData); static void InitBoxes(Tk_Window tkwin); static void ColorToStr(COLORREF color, char *colorStr); static void ImageChanged(void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); static void TkpDrawIndicator(TkButton *butPtr, Drawable d, Tk_3DBorder border, GC gc, int dim, int x, int y); /* * The class procedure table for the button widgets. */ const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ CreateProc, /* createProc */ NULL /* modalProc */ }; /* *---------------------------------------------------------------------- * * InitBoxes -- * * This function computes the size of the checkbutton and radiobutton * indicator boxes, according to the display's scaling percentage. * * Results: * None. * * Side effects: * Populates the thread-private data. * *---------------------------------------------------------------------- */ static void InitBoxes(Tk_Window tkwin) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); double scalingLevel = TkScalingLevel(tkwin); tsdPtr->boxSize = (int)(16.0 * scalingLevel); tsdPtr->initialized = TRUE; } /* *---------------------------------------------------------------------- * * TkpButtonSetDefaults -- * |
︙ | ︙ | |||
182 183 184 185 186 187 188 | */ void TkpButtonSetDefaults(void) { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | */ void TkpButtonSetDefaults(void) { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { snprintf(tkDefButtonBorderWidth, sizeof(tkDefButtonBorderWidth), "%d", width); } } /* *---------------------------------------------------------------------- * * TkpCreateButton -- |
︙ | ︙ | |||
204 205 206 207 208 209 210 | * Registers an event handler for the widget. * *---------------------------------------------------------------------- */ TkButton * TkpCreateButton( | | < | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | * Registers an event handler for the widget. * *---------------------------------------------------------------------- */ TkButton * TkpCreateButton( TCL_UNUSED(Tk_Window)) { WinButton *butPtr; butPtr = (WinButton *)ckalloc(sizeof(WinButton)); butPtr->hwnd = NULL; return (TkButton *) butPtr; } /* |
︙ | ︙ | |||
235 236 237 238 239 240 241 | *---------------------------------------------------------------------- */ static Window CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | *---------------------------------------------------------------------- */ static Window CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ void *instanceData) /* Button instance data. */ { Window window; HWND parent; LPCWSTR windowClass; WinButton *butPtr = (WinButton *)instanceData; parent = Tk_GetHWND(parentWin); |
︙ | ︙ | |||
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); } } /* *---------------------------------------------------------------------- * * TkpDisplayButton -- * * This procedure is invoked to display a button widget. It is normally * invoked as an idle handler. * * Results: * None. * * Side effects: * Information appears on the screen. The REDRAW_PENDING flag is cleared. * *---------------------------------------------------------------------- */ void TkpDisplayButton( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR) winButPtr->oldProc); } } /* *---------------------------------------------------------------------- * * ColorToStr -- * * Writes a given color to a string, in the format "RRGGBB". * * Results: * None. * * Side effects: * Changes the content of the memory area pointed to by the 2nd argument. * *---------------------------------------------------------------------- */ static void ColorToStr( COLORREF color, /* specifies a color */ char *colorStr) /* memory area to which the color is to be output in the format "RRGGBB" */ { snprintf(colorStr, 7, "%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color)); } /* *---------------------------------------------------------------------- * * ImageChanged -- * * Dummy function to be passed to Tk_GetImage(). * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void ImageChanged( void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { (void)clientData; (void)x; (void)y; (void)width; (void)height; (void)imageWidth; (void)imageHeight; } /* *---------------------------------------------------------------------- * * TkpDrawIndicator - * * Draws the indicator image in the drawable at the (x,y) location. * * Results: * None. * * Side effects: * An image is drawn in the drawable at the given location. * *---------------------------------------------------------------------- */ static void TkpDrawIndicator( TkButton *butPtr, /* checkbutton or radiobutton */ Drawable d, /* what to draw on */ Tk_3DBorder border, /* colors of the border */ GC gc, /* graphics context */ int dim, /* width & height of the indicator */ int x, int y) /* where to draw */ { Tk_Window tkwin = butPtr->tkwin; char topOuterColorStr[7], btmOuterColorStr[7], topInnerColorStr[7], btmInnerColorStr[7], interiorColorStr[7], checkColorStr[7]; Tcl_Interp *interp = Tk_Interp(tkwin); char imgName[80]; Tk_Image img; const char *svgDataPtr; size_t svgDataLen; char *svgDataCopy; char *topOuterColorPtr, *btmOuterColorPtr, *topInnerColorPtr, *btmInnerColorPtr, *interiorColorPtr, *checkColorPtr; const char *cmdFmt; size_t scriptSize; char *script; int code; /* * Construct the color strings topOuterColorStr, btmOuterColorStr, * topInnerColorStr, btmInnerColorStr, interiorColorStr, and checkColorStr */ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK_GC), topOuterColorStr); ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT_GC), btmOuterColorStr); ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK2), topInnerColorStr); ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT2), btmInnerColorStr); if (butPtr->state == STATE_ACTIVE) { ColorToStr(TkWinGetBorderPixels(tkwin, butPtr->activeBorder, TK_3D_FLAT_GC), interiorColorStr); } else if (butPtr->state == STATE_DISABLED || (butPtr->flags & TRISTATED)) { ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT2), interiorColorStr); } else if (butPtr->selectBorder != NULL) { ColorToStr(TkWinGetBorderPixels(tkwin, butPtr->selectBorder, TK_3D_FLAT_GC), interiorColorStr); } else { ColorToStr(GetSysColor(COLOR_WINDOW), interiorColorStr); } if (butPtr->state == STATE_DISABLED && butPtr->disabledFg == NULL) { ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK_GC), checkColorStr); } else { ColorToStr(gc->foreground, checkColorStr); } /* * Check whether there is an SVG image of this size for the indicator's * type (0 = checkbtn, 1 = radiobtn) and these color strings */ snprintf(imgName, sizeof(imgName), "::tk::icons::indicator%d_%d_%s_%s_%s_%s_%s_%s", dim, butPtr->type == TYPE_RADIO_BUTTON, topOuterColorStr, btmOuterColorStr, topInnerColorStr, btmInnerColorStr, interiorColorStr, (butPtr->flags & (SELECTED|TRISTATED)) ? checkColorStr : "XXXXXX"); img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); if (img == NULL) { /* * Determine the SVG data to use for the photo image */ if (butPtr->type == TYPE_CHECK_BUTTON) { svgDataPtr = ((butPtr->flags & (SELECTED|TRISTATED)) ? checkbtnOnData : checkbtnOffData); } else { svgDataPtr = ((butPtr->flags & (SELECTED|TRISTATED)) ? radiobtnOnData : radiobtnOffData); } /* * Copy the string pointed to by svgDataPtr to * a newly allocated memory area svgDataCopy */ svgDataLen = strlen(svgDataPtr); svgDataCopy = (char *)attemptckalloc(svgDataLen + 1); if (svgDataCopy == NULL) { return; } memcpy(svgDataCopy, svgDataPtr, svgDataLen); svgDataCopy[svgDataLen] = '\0'; /* * Update the colors within svgDataCopy */ topOuterColorPtr = strstr(svgDataCopy, "a0a0a0"); btmOuterColorPtr = strstr(svgDataCopy, "eeeeee"); topInnerColorPtr = strstr(svgDataCopy, "696969"); btmInnerColorPtr = strstr(svgDataCopy, "e3e3e3"); interiorColorPtr = strstr(svgDataCopy, "ffffff"); checkColorPtr = strstr(svgDataCopy, "000000"); assert(topOuterColorPtr); assert(btmOuterColorPtr); assert(topInnerColorPtr); assert(btmInnerColorPtr); assert(interiorColorPtr); memcpy(topOuterColorPtr, topOuterColorStr, 6); memcpy(btmOuterColorPtr, btmOuterColorStr, 6); memcpy(topInnerColorPtr, topInnerColorStr, 6); memcpy(btmInnerColorPtr, btmInnerColorStr, 6); memcpy(interiorColorPtr, interiorColorStr, 6); if (checkColorPtr != NULL) { memcpy(checkColorPtr, checkColorStr, 6); } /* * Create an SVG photo image from svgDataCopy */ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}"; scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen; script = (char *)attemptckalloc(scriptSize); if (script == NULL) { ckfree(svgDataCopy); return; } snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy); ckfree(svgDataCopy); code = Tcl_EvalEx(interp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); ckfree(script); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); return; } img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL); } /* * Display the image */ Tk_RedrawImage(img, 0, 0, dim, dim, d, x, y); Tk_FreeImage(img); } /* *---------------------------------------------------------------------- * * TkpDisplayButton -- * * This procedure is invoked to display a button widget. It is normally * invoked as an idle handler. * * Results: * None. * * Side effects: * Information appears on the screen. The REDRAW_PENDING flag is cleared. * *---------------------------------------------------------------------- */ void TkpDisplayButton( void *clientData) /* Information about widget. */ { TkWinDCState state; HDC dc; TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; |
︙ | ︙ | |||
335 336 337 338 339 340 341 | int textXOffset = 0, textYOffset = 0; /* Text offsets for use with compound buttons * and focus ring. */ int imageWidth, imageHeight; int imageXOffset = 0, imageYOffset = 0; /* Image information that will be used to * restrict disabled pixmap as well. */ | < < | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | int textXOffset = 0, textYOffset = 0; /* Text offsets for use with compound buttons * and focus ring. */ int imageWidth, imageHeight; int imageXOffset = 0, imageYOffset = 0; /* Image information that will be used to * restrict disabled pixmap as well. */ ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } border = butPtr->normalBorder; if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) { |
︙ | ︙ | |||
650 651 652 653 654 655 656 | DrawFocusRect(dc, &rect); TkWinReleaseDrawableDC(pixmap, dc, &state); } y += height/2; /* | | | | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | DrawFocusRect(dc, &rect); TkWinReleaseDrawableDC(pixmap, dc, &state); } y += height/2; /* * Draw the indicator for check buttons and radio buttons. At this point * x and y refer to the top-left corner of the text or image or bitmap. */ if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn && tsdPtr->initialized) { x -= butPtr->indicatorSpace; y -= butPtr->indicatorDiameter / 2; TkpDrawIndicator(butPtr, pixmap, border, gc, tsdPtr->boxSize, x, y + 1); } /* * If the button is disabled with a stipple rather than a special * foreground color, generate the stippled effect. If the widget is * selected and we use a different background color when selected, must * temporarily modify the GC so the stippling is the right color. |
︙ | ︙ | |||
836 837 838 839 840 841 842 | if (butPtr->highlightWidth < 0) { butPtr->highlightWidth = 0; } butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth; butPtr->indicatorSpace = 0; | | | | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | if (butPtr->highlightWidth < 0) { butPtr->highlightWidth = 0; } butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth; butPtr->indicatorSpace = 0; if (!tsdPtr->initialized) { InitBoxes(butPtr->tkwin); } /* * Figure out image metrics. */ if (butPtr->image != NULL) { |
︙ | ︙ | |||
864 865 866 867 868 869 870 | /* * Figure out font metrics (even if we don't have text because we need * DLUs (based on font, not text) for some spacing calculations below). */ Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, | | | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | /* * Figure out font metrics (even if we don't have text because we need * DLUs (based on font, not text) for some spacing calculations below). */ Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth; txtHeight = butPtr->textHeight; haveText = (*(Tcl_GetString(butPtr->textPtr)) != '\0'); avgWidth = (Tk_TextWidth(butPtr->tkfont, "abcdefghijklmnopqurstuvwzyABCDEFGHIJKLMNOPQURSTUVWZY", |
︙ | ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | /* * Fix up width and height for indicator sizing and spacing. */ if (butPtr->type == TYPE_RADIO_BUTTON || butPtr->type == TYPE_CHECK_BUTTON) { if (butPtr->indicatorOn) { | | | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 | /* * Fix up width and height for indicator sizing and spacing. */ if (butPtr->type == TYPE_RADIO_BUTTON || butPtr->type == TYPE_CHECK_BUTTON) { if (butPtr->indicatorOn) { butPtr->indicatorDiameter = tsdPtr->boxSize; /* * Make sure we can see the whole indicator, even if the text or * image is very small. */ if (height < butPtr->indicatorDiameter) { |
︙ | ︙ | |||
1199 1200 1201 1202 1203 1204 1205 | } /* *---------------------------------------------------------------------- * * ButtonProc -- * | | | | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | } /* *---------------------------------------------------------------------- * * ButtonProc -- * * This function is called by Windows whenever an event occurs on a * button control created by Tk. * * Results: * Standard Windows return value. * * Side effects: * May generate events. * |
︙ | ︙ |
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" |
︙ | ︙ | |||
43 44 45 46 47 48 49 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ | | > > > > < < < < | 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 | * selection (determines display from which to * retrieve). */ Atom selection, /* Selection to retrieve. */ Atom target, /* Desired form in which selection is to be * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ void *clientData) /* Arbitrary value to pass to proc. */ { 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; |
︙ | ︙ | |||
96 97 98 99 100 101 102 | /* * Get the locale identifier, determine the proper code page to * use, and find the corresponding encoding. */ Tcl_DStringInit(&ds); | | | | | 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 | /* * Get the locale identifier, determine the proper code page to * use, and find the corresponding encoding. */ Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "cp######", TCL_INDEX_NONE); data = (char *)GlobalLock(handle); /* * Even though the documentation claims that GetLocaleInfo expects * an LCID, on Windows 9x it really seems to expect a LanguageID. */ locale = LANGIDFROMLCID(*((int*)data)); GetLocaleInfoA((ULONG)locale, LOCALE_IDEFAULTANSICODEPAGE, Tcl_DStringValue(&ds)+2, (int)Tcl_DStringLength(&ds)-2); GlobalUnlock(handle); encoding = Tcl_GetEncoding(NULL, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); } else { encoding = NULL; } |
︙ | ︙ | |||
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_ExternalToUtfDString(encoding, data, TCL_INDEX_NONE, &ds); GlobalUnlock(handle); if (encoding) { Tcl_FreeEncoding(encoding); } } else if (IsClipboardFormatAvailable(CF_HDROP)) { DROPFILES *drop; |
︙ | ︙ | |||
223 224 225 226 227 228 229 | * Empties the system clipboard, and claims ownership. * *---------------------------------------------------------------------- */ int XSetSelectionOwner( | | | < < | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | * Empties the system clipboard, and claims ownership. * *---------------------------------------------------------------------- */ int XSetSelectionOwner( TCL_UNUSED(Display *), Atom selection, Window owner, TCL_UNUSED(Time)) { HWND hwnd = owner ? TkWinGetHWND(owner) : NULL; Tk_Window tkwin; /* * This is a gross hack because the Tk_InternAtom interface is broken. It * expects a Tk_Window, even though it only needs a Tk_Display. */ tkwin = (Tk_Window) TkGetMainInfoList()->winPtr; |
︙ | ︙ | |||
273 274 275 276 277 278 279 | * *---------------------------------------------------------------------- */ void TkWinClipboardRender( TkDisplay *dispPtr, | | | < | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | * *---------------------------------------------------------------------- */ void TkWinClipboardRender( TkDisplay *dispPtr, TCL_UNUSED(UINT)) { TkClipboardTarget *targetPtr; TkClipboardBuffer *cbPtr; HGLOBAL handle; char *buffer, *p, *rawText, *endPtr; size_t length; Tcl_DString ds; for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL; targetPtr = targetPtr->nextPtr) { if (targetPtr->type == XA_STRING) { break; } } |
︙ | ︙ | |||
329 330 331 332 333 334 335 | *buffer++ = *p; } } } *buffer = '\0'; Tcl_DStringInit(&ds); | | | | | 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 | *buffer++ = *p; } } } *buffer = '\0'; Tcl_DStringInit(&ds); Tcl_UtfToWCharDString(rawText, TCL_INDEX_NONE, &ds); ckfree(rawText); handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, Tcl_DStringLength(&ds) + 2); if (!handle) { Tcl_DStringFree(&ds); return; } buffer = (char *)GlobalLock(handle); memcpy(buffer, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds) + 2); GlobalUnlock(handle); Tcl_DStringFree(&ds); SetClipboardData(CF_UNICODETEXT, handle); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
365 366 367 368 369 370 371 | * *---------------------------------------------------------------------- */ void TkSelUpdateClipboard( TkWindow *winPtr, | | < | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | * *---------------------------------------------------------------------- */ void TkSelUpdateClipboard( TkWindow *winPtr, TCL_UNUSED(TkClipboardTarget *)) { HWND hwnd = TkWinGetHWND(winPtr->window); UpdateClipboard(hwnd); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
449 450 451 452 453 454 455 | * None. * *---------------------------------------------------------------------- */ void TkSelPropProc( | | < | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | * None. * *---------------------------------------------------------------------- */ void TkSelPropProc( TCL_UNUSED(XEvent *)) /* X PropertyChange event. */ { } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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 318 319 320 321 322 323 324 325 | * 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 = (BYTE)((color->red) >> 8); entry.peGreen = (BYTE)((color->green) >> 8); entry.peBlue = (BYTE)((color->blue) >> 8); entry.peFlags = 0; if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { unsigned long sizePalette = (unsigned long)GetDeviceCaps(dc, SIZEPALETTE); UINT newPixel, closePixel; int isNew; size_t refCount; Tcl_HashEntry *entryPtr; UINT index; /* |
︙ | ︙ | |||
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 Tcl_Obj* with 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; Tcl_Size 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; |
︙ | ︙ | |||
128 129 130 131 132 133 134 | * -cursor {@C:/Program\ Files/Cursors/bart.ani} * -cursor {{@C:/Program Files/Cursors/bart.ani}} * -cursor [list @[file join "C:/Program Files" Cursors bart.ani]] */ if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | * -cursor {@C:/Program\ Files/Cursors/bart.ani} * -cursor {{@C:/Program Files/Cursors/bart.ani}} * -cursor [list @[file join "C:/Program Files" Cursors bart.ani]] */ if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get cursor from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL); ckfree(argv); ckfree(cursorPtr); return NULL; } cursorPtr->winCursor = LoadCursorFromFileA(&(argv[0][1])); } else { |
︙ | ︙ |
Changes to win/tkWinDefault.h.
1 2 3 4 5 6 | /* * tkWinDefault.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * tkWinDefault.h -- * * This file defines the defaults for all options for all of * the Tk widgets. * * 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. */ #ifndef _TKWINDEFAULT #define _TKWINDEFAULT |
︙ | ︙ | |||
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 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | #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: */ #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 HIGHLIGHT #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX NULL #define DEF_MESSAGE_PADY NULL #define DEF_MESSAGE_RELIEF "flat" #define DEF_MESSAGE_TAKE_FOCUS "0" #define DEF_MESSAGE_TEXT "" #define DEF_MESSAGE_TEXT_VARIABLE "" #define DEF_MESSAGE_WIDTH "0" /* |
︙ | ︙ | |||
404 405 406 407 408 409 410 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE | | | | | | | 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 | * Defaults for scales: */ #define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_SCALE_ACTIVE_BG_MONO BLACK #define DEF_SCALE_BG_COLOR NORMAL_BG #define DEF_SCALE_BG_MONO WHITE #define DEF_SCALE_BIG_INCREMENT "0.0" #define DEF_SCALE_BORDER_WIDTH "1" #define DEF_SCALE_COMMAND "" #define DEF_SCALE_CURSOR "" #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.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 HIGHLIGHT #define DEF_SCALE_HIGHLIGHT_WIDTH "2" #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" #define DEF_SCALE_RESOLUTION "1.0" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" #define DEF_SCALE_TAKE_FOCUS NULL #define DEF_SCALE_TICK_INTERVAL "0.0" #define DEF_SCALE_TO "100.0" #define DEF_SCALE_VARIABLE "" #define DEF_SCALE_WIDTH "15" /* * Defaults for scrollbars: */ |
︙ | ︙ |
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" |
︙ | ︙ | |||
564 565 566 567 568 569 570 | */ static UINT APIENTRY ChooseDirectoryValidateProc(HWND hdlg, UINT uMsg, LPARAM wParam, LPARAM lParam); static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static void CleanupOFNOptions(OFNOpts *optsPtr); | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | */ static UINT APIENTRY ChooseDirectoryValidateProc(HWND hdlg, UINT uMsg, LPARAM wParam, LPARAM lParam); static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static void CleanupOFNOptions(OFNOpts *optsPtr); static int ParseOFNOptions(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], enum OFNOper oper, OFNOpts *optsPtr); static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper); static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper); static int GetFileName(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], enum OFNOper oper); static int MakeFilterVista(Tcl_Interp *interp, OFNOpts *optsPtr, DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr, DWORD *defaultFilterIndexPtr); static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr); static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr, 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(void *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 |
︙ | ︙ | |||
742 743 744 745 746 747 748 | * application invokes the "tk_chooseColor" command. * *------------------------------------------------------------------------- */ int Tk_ChooseColorObjCmd( | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | * application invokes the "tk_chooseColor" command. * *------------------------------------------------------------------------- */ int Tk_ChooseColorObjCmd( 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, parent; HWND hWnd; int i, oldMode, winCode, result; |
︙ | ︙ | |||
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; |
︙ | ︙ | |||
898 899 900 901 902 903 904 | *---------------------------------------------------------------------- */ static UINT CALLBACK ColorDlgHookProc( HWND hDlg, /* Handle to the color dialog. */ UINT uMsg, /* Type of message. */ | | | < | | | | | | | | | | 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 | *---------------------------------------------------------------------- */ static UINT CALLBACK ColorDlgHookProc( HWND hDlg, /* Handle to the color dialog. */ UINT uMsg, /* Type of message. */ TCL_UNUSED(WPARAM), /* First message parameter. */ LPARAM lParam) /* Second message parameter. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; CHOOSECOLORW *ccPtr; 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, TCL_INDEX_NONE, &ds)); Tcl_DStringFree(&ds); } if (tsdPtr->debugFlag) { tsdPtr->debugInterp = (Tcl_Interp *) ccPtr->lpTemplateName; Tcl_DoWhenIdle(SetTkDialog, hDlg); } return TRUE; } return FALSE; } /* *---------------------------------------------------------------------- * * Tk_GetOpenFileObjCmd -- * * This function implements the "open file" dialog box for the Windows * platform. See the user documentation for details on what it does. * * Results: * See user documentation. * * Side effects: * A dialog window is created the first this function is called. * *---------------------------------------------------------------------- */ int Tk_GetOpenFileObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { return GetFileName(clientData, interp, objc, objv, OFN_FILE_OPEN); } /* *---------------------------------------------------------------------- * * Tk_GetSaveFileObjCmd -- * * Same as Tk_GetOpenFileObjCmd but opens a "save file" dialog box * instead * * Results: * Same as Tk_GetOpenFileObjCmd. * * Side effects: * Same as Tk_GetOpenFileObjCmd. * *---------------------------------------------------------------------- */ int Tk_GetSaveFileObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { return GetFileName(clientData, interp, objc, objv, OFN_FILE_SAVE); } |
︙ | ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | * Returns option values in *optsPtr. Note these may include string * pointers into objv[] *---------------------------------------------------------------------- */ static int ParseOFNOptions( | | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | * Returns option values in *optsPtr. Note these may include string * pointers into objv[] *---------------------------------------------------------------------- */ static int ParseOFNOptions( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ enum OFNOper oper, /* 1 for Open, 0 for Save */ OFNOpts *optsPtr) /* Output, uninitialized on entry */ { int i; |
︙ | ︙ | |||
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}, | | | | | | 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 | {"-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; } memset(optsPtr, 0, 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; const char *string; Tcl_Obj *valuePtr; if (Tcl_GetIndexFromObjStruct(interp, objv[i], options, sizeof(struct Options), "option", 0, &index) != TCL_OK) { /* * XXX -xpstyle is explicitly checked for as it is undocumented * and we do not want it to show in option error messages. */ if (strcmp(Tcl_GetString(objv[i]), "-xpstyle")) goto error_return; if (i + 1 == objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj("value for \"-xpstyle\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL); goto error_return; } if (Tcl_GetBooleanFromObj(interp, objv[i+1], &optsPtr->forceXPStyle) != TCL_OK) goto error_return; |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | &optsPtr->utfDirString) == NULL) goto error_return; break; case FILE_INITFILE: if (Tcl_TranslateFileName(interp, string, &ds) == NULL) goto error_return; Tcl_UtfToExternal(NULL, TkWinGetUnicodeEncoding(), | | | | | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | &optsPtr->utfDirString) == NULL) goto error_return; break; case FILE_INITFILE: if (Tcl_TranslateFileName(interp, string, &ds) == NULL) goto error_return; Tcl_UtfToExternal(NULL, TkWinGetUnicodeEncoding(), Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), TCL_ENCODING_PROFILE_TCL8, NULL, (char *)&optsPtr->file[0], sizeof(optsPtr->file), NULL, NULL, NULL); Tcl_DStringFree(&ds); break; case FILE_PARENT: optsPtr->tkwin = Tk_NameToWindow(interp, string, (Tk_Window)clientData); if (optsPtr->tkwin == NULL) goto error_return; break; |
︙ | ︙ | |||
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) { | | < < | | | | | | | | | | < | | | | | | | < | 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 | { 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); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file); if (FAILED(hr)) goto vamoose; } if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') { Tcl_Obj *normPath, *iniDirPath; | | | | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file); if (FAILED(hr)) goto vamoose; } if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') { Tcl_Obj *normPath, *iniDirPath; iniDirPath = Tcl_NewStringObj(Tcl_DStringValue(&optsPtr->utfDirString), TCL_INDEX_NONE); Tcl_IncrRefCount(iniDirPath); 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 */ } } |
︙ | ︙ | |||
1577 1578 1579 1580 1581 1582 1583 | HWND hWnd; Tcl_DString utfFilterString, ds; Tcl_DString extString, filterString, dirString, titleString; const char *str; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | | 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 | HWND hWnd; Tcl_DString utfFilterString, ds; Tcl_DString extString, filterString, dirString, titleString; const char *str; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); memset(&ofnData, 0, sizeof(OFNData)); Tcl_DStringInit(&utfFilterString); Tcl_DStringInit(&dirString); /* XXX - original code was missing this leaving dirString uninitialized for the unlikely code path where cwd failed */ if (MakeFilter(interp, optsPtr->filterObj, &utfFilterString, optsPtr->initialTypeObj, &filterIndex) != TCL_OK) { goto end; } Tk_MakeWindowExist(optsPtr->tkwin); hWnd = Tk_GetHWND(Tk_WindowId(optsPtr->tkwin)); memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner); ofn.lpstrFile = optsPtr->file; ofn.nMaxFile = TK_MULTI_MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_EXPLORER| OFN_ENABLEHOOK| OFN_ENABLESIZING; |
︙ | ︙ | |||
1628 1629 1630 1631 1632 1633 1634 | if (optsPtr->extObj != NULL) { str = Tcl_GetString(optsPtr->extObj); if (str[0] == '.') { ++str; } Tcl_DStringInit(&extString); | | | 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | if (optsPtr->extObj != NULL) { str = Tcl_GetString(optsPtr->extObj); if (str[0] == '.') { ++str; } Tcl_DStringInit(&extString); ofn.lpstrDefExt = Tcl_UtfToWCharDString(str, TCL_INDEX_NONE, &extString); } Tcl_DStringInit(&filterString); ofn.lpstrFilter = Tcl_UtfToWCharDString(Tcl_DStringValue(&utfFilterString), Tcl_DStringLength(&utfFilterString), &filterString); ofn.nFilterIndex = filterIndex; |
︙ | ︙ | |||
1664 1665 1666 1667 1668 1669 1670 | } Tcl_DStringFree(&cwd); } ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString); if (optsPtr->titleObj != NULL) { Tcl_DStringInit(&titleString); | | | 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 | } Tcl_DStringFree(&cwd); } ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString); if (optsPtr->titleObj != NULL) { Tcl_DStringInit(&titleString); ofn.lpstrTitle = Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), TCL_INDEX_NONE, &titleString); } /* * Popup the dialog. */ oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); |
︙ | ︙ | |||
1753 1754 1755 1756 1757 1758 1759 | Tcl_DString filenameBuf; count++; ConvertExternalFilename(files, &filenameBuf); fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); | | | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | Tcl_DString filenameBuf; count++; ConvertExternalFilename(files, &filenameBuf); fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_AppendToObj(fullnameObj, "/", TCL_INDEX_NONE); Tcl_AppendToObj(fullnameObj, Tcl_DStringValue(&filenameBuf), Tcl_DStringLength(&filenameBuf)); gotFilename = 1; Tcl_DStringFree(&filenameBuf); Tcl_ListObjAppendElement(NULL, returnList, fullnameObj); } } |
︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 | Tcl_DStringLength(&ds))); gotFilename |= (Tcl_DStringLength(&ds) > 0); } Tcl_SetObjResult(interp, returnList); Tcl_DStringFree(&ds); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | Tcl_DStringLength(&ds))); gotFilename |= (Tcl_DStringLength(&ds) > 0); } Tcl_SetObjResult(interp, returnList); Tcl_DStringFree(&ds); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( ConvertExternalFilename(ofn.lpstrFile, &ds), TCL_INDEX_NONE)); gotFilename = (Tcl_DStringLength(&ds) > 0); Tcl_DStringFree(&ds); } result = TCL_OK; if ((ofn.nFilterIndex > 0) && gotFilename && optsPtr->typeVariableObj && optsPtr->filterObj) { Tcl_Size listObjc, count; Tcl_Obj **listObjv = NULL; Tcl_Obj **typeInfo = NULL; if (Tcl_ListObjGetElements(interp, optsPtr->filterObj, &listObjc, &listObjv) != TCL_OK) { result = TCL_ERROR; } else if (Tcl_ListObjGetElements(interp, |
︙ | ︙ | |||
1867 1868 1869 1870 1871 1872 1873 | * See user documentation. * *---------------------------------------------------------------------- */ static int GetFileName( | | | 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 | * See user documentation. * *---------------------------------------------------------------------- */ static int GetFileName( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ enum OFNOper oper) /* 1 to call GetOpenFileName(), 0 to call * GetSaveFileName(). */ { OFNOpts ofnOpts; |
︙ | ︙ | |||
1896 1897 1898 1899 1900 1901 1902 | /* *------------------------------------------------------------------------- * * OFNHookProc -- * | | | < | 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 | /* *------------------------------------------------------------------------- * * 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. * * Side effects: * None. * *------------------------------------------------------------------------- */ static UINT APIENTRY OFNHookProc( HWND hdlg, /* Handle to child dialog window. */ UINT uMsg, /* Message identifier */ TCL_UNUSED(WPARAM), /* Message parameter */ LPARAM lParam) /* Message parameter */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); OPENFILENAME *ofnPtr; OFNData *ofnData; if (uMsg == WM_INITDIALOG) { TkWinSetUserData(hdlg, lParam); } else if (uMsg == WM_NOTIFY) { OFNOTIFY *notifyPtr = (OFNOTIFY *) lParam; /* |
︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 | *p++ = '.'; *p++ = '*'; *p++ = '\0'; *p++ = '\0'; *p = '\0'; } else { | | | | 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 | *p++ = '.'; *p++ = '*'; *p++ = '\0'; *p++ = '\0'; *p = '\0'; } else { Tcl_Size 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" * |
︙ | ︙ | |||
2203 2204 2205 2206 2207 2208 2209 | * characters. */ *p++ = '\0'; *p = '\0'; } | | | | | 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 | * characters. */ *p++ = '\0'; *p = '\0'; } Tcl_DStringAppend(dsPtr, filterStr, p - filterStr); ckfree(filterStr); TkFreeFileFilters(&flist); return TCL_OK; } /* *---------------------------------------------------------------------- * * FreeFilterVista * * Frees storage previously allocated by MakeFilterVista. * count is the number of elements in dlgFilterPtr[] */ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr) { if (dlgFilterPtr != NULL) { DWORD dw; for (dw = 0; dw < count; ++dw) { if (dlgFilterPtr[dw].pszName != NULL) ckfree((void *)dlgFilterPtr[dw].pszName); if (dlgFilterPtr[dw].pszSpec != NULL) ckfree((void *)dlgFilterPtr[dw].pszSpec); } ckfree(dlgFilterPtr); } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2294 2295 2296 2297 2298 2299 2300 | dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); for (i = 0, filterPtr = flist.filters; filterPtr; filterPtr = filterPtr->next, ++i) { const char *sep; FileFilterClause *clausePtr; | | | | | | | 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 | dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); for (i = 0, filterPtr = flist.filters; filterPtr; filterPtr = filterPtr->next, ++i) { const char *sep; FileFilterClause *clausePtr; size_t nbytes; /* Check if this entry should be shown as the default */ if (initial && strcmp(initial, filterPtr->name) == 0) initialIndex = i+1; /* Windows filter indices are 1-based */ /* First stash away the text description of the pattern */ Tcl_DStringInit(&ds); Tcl_UtfToWCharDString(filterPtr->name, TCL_INDEX_NONE, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes); memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); /* * Loop through and join patterns with a ";" Each "clause" * corresponds to a single textual description (called typename) * in the tk_getOpenFile docs. Each such typename may occur * multiple times and all these form a single filter entry * with one clause per occurence. Further each clause may specify * multiple patterns. Hence the nested loop here. */ sep = ""; for (clausePtr=filterPtr->clauses ; clausePtr; clausePtr=clausePtr->next) { GlobPattern *globPtr; for (globPtr = clausePtr->patterns; globPtr; globPtr = globPtr->next) { Tcl_DStringAppend(&patterns, sep, TCL_INDEX_NONE); Tcl_DStringAppend(&patterns, globPtr->pattern, TCL_INDEX_NONE); sep = ";"; } } /* Again we need a Unicode form of the string */ Tcl_DStringInit(&ds); Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), TCL_INDEX_NONE, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes); memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); Tcl_DStringSetLength(&patterns, 0); } |
︙ | ︙ | |||
2425 2426 2427 2428 2429 2430 2431 | * - -title is really -message. * *---------------------------------------------------------------------- */ int Tk_ChooseDirectoryObjCmd( | | | 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 | * - -title is really -message. * *---------------------------------------------------------------------- */ int Tk_ChooseDirectoryObjCmd( void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WCHAR path[MAX_PATH]; int oldMode, result; LPCITEMIDLIST pidl; /* Returned by browser */ |
︙ | ︙ | |||
2459 2460 2461 2462 2463 2464 2465 | CleanupOFNOptions(&ofnOpts); return result; } /* Older dialogs */ path[0] = '\0'; | | | | 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 | CleanupOFNOptions(&ofnOpts); return result; } /* Older dialogs */ path[0] = '\0'; memset(&cdCBData, 0, sizeof(ChooseDir)); cdCBData.interp = interp; cdCBData.mustExist = ofnOpts.mustExist; utfDir = Tcl_DStringValue(&ofnOpts.utfDirString); if (utfDir[0] != '\0') { LPCWSTR uniStr; Tcl_DStringInit(&tempString); Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), TCL_INDEX_NONE, &tempString); uniStr = (WCHAR *) Tcl_DStringValue(&tempString); /* Convert possible relative path to full path to keep dialog happy. */ GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL); wcsncpy(cdCBData.initDir, saveDir, MAX_PATH); |
︙ | ︙ | |||
2501 2502 2503 2504 2505 2506 2507 | if (wcslen(cdCBData.initDir) == 0) { GetCurrentDirectoryW(MAX_PATH, cdCBData.initDir); } bInfo.lParam = (LPARAM) &cdCBData; if (ofnOpts.titleObj != NULL) { Tcl_DStringInit(&titleString); | | | 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | if (wcslen(cdCBData.initDir) == 0) { GetCurrentDirectoryW(MAX_PATH, cdCBData.initDir); } bInfo.lParam = (LPARAM) &cdCBData; if (ofnOpts.titleObj != NULL) { Tcl_DStringInit(&titleString); bInfo.lpszTitle = Tcl_UtfToWCharDString(Tcl_GetString(ofnOpts.titleObj), TCL_INDEX_NONE, &titleString); } else { bInfo.lpszTitle = L"Please choose a directory, then select OK."; } /* * Set flags to add edit box, status text line and use the new ui. Allow * override with magic variable (ignore errors in retrieval). See |
︙ | ︙ | |||
2559 2560 2561 2562 2563 2564 2565 | /* * Null for cancel button or invalid dir, otherwise valid. */ if (pidl != NULL) { if (!SHGetPathFromIDListW(pidl, path)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 | /* * Null for cancel button or invalid dir, otherwise valid. */ if (pidl != NULL) { if (!SHGetPathFromIDListW(pidl, path)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error: not a file system folder", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "PSEUDO", NULL); } pMalloc->lpVtbl->Free(pMalloc, (void *) pidl); } else if (wcslen(cdCBData.retDir) > 0) { wcscpy(path, cdCBData.retDir); } pMalloc->lpVtbl->Release(pMalloc); |
︙ | ︙ | |||
2589 2590 2591 2592 2593 2594 2595 | */ Tcl_ResetResult(interp); if (*path) { Tcl_DString ds; Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 | */ Tcl_ResetResult(interp); if (*path) { Tcl_DString ds; Tcl_SetObjResult(interp, Tcl_NewStringObj( ConvertExternalFilename(path, &ds), TCL_INDEX_NONE)); Tcl_DStringFree(&ds); } CleanupOFNOptions(&ofnOpts); return TCL_OK; } |
︙ | ︙ | |||
2657 2658 2659 2660 2661 2662 2663 | * at this point? */ chooseDirSharedData->retDir[0] = '\0'; return 1; } Tcl_DStringSetLength(&initDirString, 0); | | | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 | * at this point? */ chooseDirSharedData->retDir[0] = '\0'; return 1; } Tcl_DStringSetLength(&initDirString, 0); wcsncpy(string, Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), TCL_INDEX_NONE, &initDirString), MAX_PATH); Tcl_DStringFree(&initDirString); Tcl_DStringFree(&tempString); if (SetCurrentDirectoryW(string) == 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); | | | | 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 | * -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: | | | | 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 | * 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( 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, parent; HWND hWnd; Tcl_Obj *messageObj, *titleObj, *detailObj, *tmpObj; |
︙ | ︙ | |||
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]; | | | | 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 | 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; |
︙ | ︙ | |||
2962 2963 2964 2965 2966 2967 2968 | * (Windows loses sync). */ EnableWindow(hWnd, 1); Tcl_DecrRefCount(tmpObj); Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 | * (Windows loses sync). */ EnableWindow(hWnd, 1); Tcl_DecrRefCount(tmpObj); Tcl_SetObjResult(interp, Tcl_NewStringObj( TkFindStateString(buttonMap, winCode), TCL_INDEX_NONE)); return TCL_OK; } static LRESULT CALLBACK MsgBoxCBTProc( int nCode, WPARAM wParam, |
︙ | ︙ | |||
3017 3018 3019 3020 3021 3022 3023 | * the test command 'tkwinevent debug 1'. * * ---------------------------------------------------------------------- */ static void SetTkDialog( | | | | 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 | * the test command 'tkwinevent debug 1'. * * ---------------------------------------------------------------------- */ static void SetTkDialog( void *clientData) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); char buf[32]; snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)clientData); Tcl_SetVar2(tsdPtr->debugInterp, "tk_dialog", NULL, buf, TCL_GLOBAL_ONLY); } /* * Factored out a common pattern in use in this file. */ |
︙ | ︙ | |||
3079 3080 3081 3082 3083 3084 3085 | Tcl_Obj *resObj; int pt = 0; resObj = Tcl_NewListObj(0, NULL); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(plf->lfFaceName, wcslen(plf->lfFaceName), &ds); Tcl_ListObjAppendElement(NULL, resObj, | | | | | | | | 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 | Tcl_Obj *resObj; int pt = 0; resObj = Tcl_NewListObj(0, NULL); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(plf->lfFaceName, wcslen(plf->lfFaceName), &ds); Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj(Tcl_DStringValue(&ds), TCL_INDEX_NONE)); Tcl_DStringFree(&ds); pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewWideIntObj(pt)); if (plf->lfWeight >= 700) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("bold", TCL_INDEX_NONE)); } if (plf->lfItalic) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("italic", TCL_INDEX_NONE)); } if (plf->lfUnderline) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("underline", TCL_INDEX_NONE)); } if (plf->lfStrikeOut) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("overstrike", TCL_INDEX_NONE)); } return resObj; } static void ApplyLogfont( Tcl_Interp *interp, Tcl_Obj *cmdObj, HDC hdc, LOGFONTW *logfontPtr) { Tcl_Size objc; Tcl_Obj **objv, **tmpv; Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv); tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = GetFontObj(hdc, logfontPtr); TkBackgroundEvalObjv(interp, objc+1, tmpv, TCL_EVAL_GLOBAL); |
︙ | ︙ | |||
3147 3148 3149 3150 3151 3152 3153 | static UINT_PTR CALLBACK HookProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { | | | | 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 | 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; phd->hwnd = hwndDlg; if (tsdPtr->debugFlag) { tsdPtr->debugInterp = phd->interp; Tcl_DoWhenIdle(SetTkDialog, hwndDlg); } if (phd->titleObj != NULL) { Tcl_DString title; Tcl_DStringInit(&title); Tcl_UtfToWCharDString(Tcl_GetString(phd->titleObj), TCL_INDEX_NONE, &title); if (Tcl_DStringLength(&title) > 0) { SetWindowTextW(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title)); } Tcl_DStringFree(&title); } /* |
︙ | ︙ | |||
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 { | | | 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 | /* * 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) |
︙ | ︙ | |||
3261 3262 3263 3264 3265 3266 3267 | if (hdPtr->cmdObj) { resObj = hdPtr->cmdObj; } else { resObj = Tcl_NewStringObj("", 0); } break; case FontchooserVisible: | | | 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 | if (hdPtr->cmdObj) { resObj = hdPtr->cmdObj; } else { resObj = Tcl_NewStringObj("", 0); } break; case FontchooserVisible: resObj = Tcl_NewBooleanObj((hdPtr->hwnd != NULL) && IsWindow(hdPtr->hwnd)); break; default: resObj = Tcl_NewStringObj("", 0); } return resObj; } |
︙ | ︙ | |||
3288 3289 3290 3291 3292 3293 3294 | * Per-interp data structure may be modified * * ---------------------------------------------------------------------- */ static int FontchooserConfigureCmd( | | | > | | | | | | 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 | * Per-interp data structure may be modified * * ---------------------------------------------------------------------- */ static int FontchooserConfigureCmd( void *clientData, /* Main window */ Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; HookData *hdPtr = NULL; Tcl_Size i; int 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. */ if (objc == 1) { Tcl_Obj *keyObj, *valueObj; Tcl_Obj *dictObj = Tcl_NewDictObj(); for (i = 0; r == TCL_OK && optionStrings[i] != NULL; ++i) { keyObj = Tcl_NewStringObj(optionStrings[i], TCL_INDEX_NONE); valueObj = FontchooserCget(hdPtr, i); r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj); } if (r == TCL_OK) { Tcl_SetObjResult(interp, dictObj); } 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. */ |
︙ | ︙ | |||
3347 3348 3349 3350 3351 3352 3353 | return TCL_ERROR; } switch (optionIndex) { case FontchooserVisible: { static const char *msg = "cannot change read-only option " "\"-visible\": use the show or hide command"; | | | 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 | return TCL_ERROR; } switch (optionIndex) { case FontchooserVisible: { static const char *msg = "cannot change read-only option " "\"-visible\": use the show or hide command"; Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "FONTDIALOG", "READONLY", NULL); return TCL_ERROR; } case FontchooserParent: { Tk_Window parent = Tk_NameToWindow(interp, Tcl_GetString(objv[i+1]), tkwin); |
︙ | ︙ | |||
3431 3432 3433 3434 3435 3436 3437 | * additional state. * * ---------------------------------------------------------------------- */ static int FontchooserShowCmd( | | | | < < | | | | 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 | * additional state. * * ---------------------------------------------------------------------- */ static int FontchooserShowCmd( void *clientData, /* Main window */ Tcl_Interp *interp, TCL_UNUSED(Tcl_Size), TCL_UNUSED(Tcl_Obj *const *)) { Tcl_DString ds; Tk_Window tkwin = (Tk_Window)clientData, parent; CHOOSEFONTW cf; LOGFONTW lf; HDC hdc; HookData *hdPtr; int r = TCL_OK, oldMode = 0; hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); parent = tkwin; if (hdPtr->parentObj) { parent = Tk_NameToWindow(interp, Tcl_GetString(hdPtr->parentObj), tkwin); if (parent == NULL) { return TCL_ERROR; } } Tk_MakeWindowExist(parent); memset(&cf, 0, sizeof(CHOOSEFONTW)); memset(&lf, 0, 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; |
︙ | ︙ | |||
3484 3485 3486 3487 3488 3489 3490 | if (f == NULL) { return TCL_ERROR; } fontPtr = (TkFont *) f; cf.Flags |= CF_INITTOLOGFONTSTRUCT; Tcl_DStringInit(&ds); | | | 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 | if (f == NULL) { return TCL_ERROR; } fontPtr = (TkFont *) f; cf.Flags |= CF_INITTOLOGFONTSTRUCT; Tcl_DStringInit(&ds); wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(fontPtr->fa.family, TCL_INDEX_NONE, &ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; lf.lfHeight = -MulDiv((int)(TkFontGetPoints(tkwin, fontPtr->fa.size) + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 72); if (fontPtr->fa.weight == TK_FW_BOLD) { lf.lfWeight = FW_BOLD; |
︙ | ︙ | |||
3506 3507 3508 3509 3510 3511 3512 | if (fontPtr->fa.overstrike) { lf.lfStrikeOut = TRUE; } Tk_FreeFont(f); } if (TCL_OK == r && hdPtr->cmdObj != NULL) { | | | 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 | if (fontPtr->fa.overstrike) { lf.lfStrikeOut = TRUE; } Tk_FreeFont(f); } if (TCL_OK == r && hdPtr->cmdObj != NULL) { Tcl_Size len = 0; r = Tcl_ListObjLength(interp, hdPtr->cmdObj, &len); if (len > 0) { cf.Flags |= CF_APPLY; } } |
︙ | ︙ | |||
3547 3548 3549 3550 3551 3552 3553 | * destroy the dialog * * ---------------------------------------------------------------------- */ static int FontchooserHideCmd( | | | | < < < | > > < | 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 | * destroy the dialog * * ---------------------------------------------------------------------- */ static int FontchooserHideCmd( TCL_UNUSED(void *), Tcl_Interp *interp, TCL_UNUSED(Tcl_Size), TCL_UNUSED(Tcl_Obj *const *)) { HookData *hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); if (hdPtr->hwnd && IsWindow(hdPtr->hwnd)) { EndDialog(hdPtr->hwnd, 0); } return TCL_OK; } /* * ---------------------------------------------------------------------- * * DeleteHookData -- * * Clean up the font chooser configuration data when the interp is * destroyed. * * ---------------------------------------------------------------------- */ static void DeleteHookData( void *clientData, TCL_UNUSED(Tcl_Interp *)) { HookData *hdPtr = (HookData *)clientData; if (hdPtr->parentObj) { Tcl_DecrRefCount(hdPtr->parentObj); } if (hdPtr->fontObj) { Tcl_DecrRefCount(hdPtr->fontObj); } |
︙ | ︙ | |||
3615 3616 3617 3618 3619 3620 3621 | { "configure", FontchooserConfigureCmd, NULL }, { "show", FontchooserShowCmd, NULL }, { "hide", FontchooserHideCmd, NULL }, { NULL, NULL, NULL } }; int | | > > < | 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 | { "configure", FontchooserConfigureCmd, NULL }, { "show", FontchooserShowCmd, NULL }, { "hide", FontchooserHideCmd, NULL }, { NULL, NULL, NULL } }; int TkInitFontchooser( Tcl_Interp *interp, TCL_UNUSED(void *)) { HookData *hdPtr = (HookData *)ckalloc(sizeof(HookData)); memset(hdPtr, 0, sizeof(HookData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteHookData, hdPtr); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
240 241 242 243 244 245 246 | * the last array if it is large enough. */ if (npoints > tsdPtr->nWinPoints) { if (tsdPtr->winPoints != NULL) { ckfree(tsdPtr->winPoints); } | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | * the last array if it is large enough. */ if (npoints > tsdPtr->nWinPoints) { if (tsdPtr->winPoints != NULL) { ckfree(tsdPtr->winPoints); } tsdPtr->winPoints = (POINT *)ckalloc(sizeof(POINT) * (size_t)npoints); if (tsdPtr->winPoints == NULL) { tsdPtr->nWinPoints = -1; return NULL; } tsdPtr->nWinPoints = npoints; } |
︙ | ︙ | |||
365 366 367 368 369 370 371 | unsigned long plane) { HDC srcDC, destDC; TkWinDCState srcState, destState; HBRUSH bgBrush, fgBrush, oldBrush; TkpClipMask *clipPtr = (TkpClipMask*)gc->clip_mask; | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | unsigned long plane) { HDC srcDC, destDC; TkWinDCState srcState, destState; HBRUSH bgBrush, fgBrush, oldBrush; TkpClipMask *clipPtr = (TkpClipMask*)gc->clip_mask; LastKnownRequestProcessed(display)++; if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } srcDC = TkWinGetDrawableDC(display, src, &srcState); |
︙ | ︙ | |||
484 485 486 487 488 489 490 | } /* *---------------------------------------------------------------------- * * TkPutImage, XPutImage -- * | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | } /* *---------------------------------------------------------------------- * * TkPutImage, XPutImage -- * * Copies a subimage from an in-memory image to a rectangle of the * specified drawable. * * Results: * None. * * Side effects: * Draws the image on the specified drawable. |
︙ | ︙ | |||
516 517 518 519 520 521 522 | { HDC dc, dcMem; TkWinDCState state; BITMAPINFO *infoPtr; HBITMAP bitmap; char *data; | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | { HDC dc, dcMem; TkWinDCState state; BITMAPINFO *infoPtr; HBITMAP bitmap; char *data; LastKnownRequestProcessed(display)++; dc = TkWinGetDrawableDC(display, d, &state); SetROP2(dc, tkpWinRopModes[gc->function]); dcMem = CreateCompatibleDC(dc); if (image->bits_per_pixel == 1) { /* |
︙ | ︙ | |||
550 551 552 553 554 555 556 | * Do not use a palette for TrueColor images. */ usePalette = (image->bits_per_pixel < 16); if (usePalette) { infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER) | | | | < | | 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 | * Do not use a palette for TrueColor images. */ usePalette = (image->bits_per_pixel < 16); if (usePalette) { infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*(size_t)ncolors); } else { infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER)); } infoPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); infoPtr->bmiHeader.biWidth = image->width; infoPtr->bmiHeader.biHeight = -image->height; /* Top-down order */ infoPtr->bmiHeader.biPlanes = 1; infoPtr->bmiHeader.biBitCount = (WORD)image->bits_per_pixel; infoPtr->bmiHeader.biCompression = BI_RGB; infoPtr->bmiHeader.biSizeImage = 0; infoPtr->bmiHeader.biXPelsPerMeter = 0; infoPtr->bmiHeader.biYPelsPerMeter = 0; infoPtr->bmiHeader.biClrImportant = 0; if (usePalette) { infoPtr->bmiHeader.biClrUsed = (DWORD)ncolors; for (i = 0; i < ncolors; i++) { infoPtr->bmiColors[i].rgbBlue = GetBValue(colors[i]); infoPtr->bmiColors[i].rgbGreen = GetGValue(colors[i]); infoPtr->bmiColors[i].rgbRed = GetRValue(colors[i]); infoPtr->bmiColors[i].rgbReserved = 0; } } else { 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); |
︙ | ︙ | |||
761 762 763 764 765 766 767 | HDC dc, POINT *winPoints, int npoints, WinDrawFunc func) /* Name of the Windows GDI drawing function: this is either Polyline or Polygon. */ { BeginPath(dc); | | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | HDC dc, POINT *winPoints, int npoints, WinDrawFunc func) /* Name of the Windows GDI drawing function: this is either Polyline or Polygon. */ { BeginPath(dc); func(dc, winPoints, (int)npoints); /* * In the case of closed polylines, the first and last points * are the same. We want miter or bevel join be rendered also * at this point, this needs telling the Windows GDI that the * path is closed. */ if (func == Polyline) { |
︙ | ︙ | |||
977 978 979 980 981 982 983 | int XFillPolygon( Display *display, Drawable d, GC gc, XPoint *points, int npoints, | | < | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | int XFillPolygon( Display *display, Drawable d, GC gc, XPoint *points, int npoints, TCL_UNUSED(int), int mode) { HPEN pen; TkWinDCState state; HDC dc; if (d == None) { return BadDrawable; } dc = TkWinGetDrawableDC(display, d, &state); |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | pen = SetUpGraphicsPort(gc); SetBkMode(dc, TRANSPARENT); oldPen = (HPEN)SelectObject(dc, pen); oldBrush = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH)); SetROP2(dc, tkpWinRopModes[gc->function]); | | | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | pen = SetUpGraphicsPort(gc); SetBkMode(dc, TRANSPARENT); oldPen = (HPEN)SelectObject(dc, pen); oldBrush = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH)); SetROP2(dc, tkpWinRopModes[gc->function]); Rectangle(dc, x, y, x + (int)width + 1, y + (int)height + 1); DeleteObject(SelectObject(dc, oldPen)); SelectObject(dc, oldBrush); TkWinReleaseDrawableDC(d, dc, &state); return Success; } |
︙ | ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height, int start, int extent) { | | | | 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 | Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height, int start, int extent) { LastKnownRequestProcessed(display)++; return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 0); } int XDrawArcs( Display *display, Drawable d, GC gc, XArc *arcs, int narcs) { int ret = Success; LastKnownRequestProcessed(display)++; while (narcs-- > 0) { ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y, arcs[0].width, arcs[0].height, arcs[0].angle1, arcs[0].angle2, 0); if (ret != Success) { break; |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height, int start, int extent) { | | | | 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 | Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height, int start, int extent) { LastKnownRequestProcessed(display)++; return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 1); } int XFillArcs( Display *display, Drawable d, GC gc, XArc *arcs, int narcs) { int ret = Success; LastKnownRequestProcessed(display)++; while (narcs-- > 0) { ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y, arcs[0].width, arcs[0].height, arcs[0].angle1, arcs[0].angle2, 1); if (ret != Success) { break; |
︙ | ︙ | |||
1270 1271 1272 1273 1274 1275 1276 | /* * Note that this call will leave a gap of one pixel at the end of the * arc for thin arcs. We can't use ArcTo because it's only supported * under Windows NT. */ SetBkMode(dc, TRANSPARENT); | | | | | 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | /* * Note that this call will leave a gap of one pixel at the end of the * arc for thin arcs. We can't use ArcTo because it's only supported * under Windows NT. */ SetBkMode(dc, TRANSPARENT); Arc(dc, x, y, x + (int)width + 1, y + (int)height + 1, xstart, ystart, xend, yend); } else { brush = CreateSolidBrush(gc->foreground); oldBrush = (HBRUSH)SelectObject(dc, brush); if (gc->arc_mode == ArcChord) { Chord(dc, x, y, x + (int)width + 1, y + (int)height + 1, xstart, ystart, xend, yend); } else if (gc->arc_mode == ArcPieSlice) { Pie(dc, x, y, x+(int)width+1, y + (int)height + 1, xstart, ystart, xend, yend); } DeleteObject(SelectObject(dc, oldBrush)); } DeleteObject(SelectObject(dc, oldPen)); TkWinReleaseDrawableDC(d, dc, &state); return Success; |
︙ | ︙ | |||
1396 1397 1398 1399 1400 1401 1402 | * *---------------------------------------------------------------------- */ int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ | | < | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | * *---------------------------------------------------------------------- */ int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ TCL_UNUSED(GC), /* GC for window to be scrolled. */ int x, int y, int width, int height, /* Position rectangle to be scrolled. */ int dx, int dy, /* Distance rectangle should be moved. */ Region damageRgn) /* Region to accumulate damage in. */ { HWND hwnd = TkWinGetHWND(Tk_WindowId(tkwin)); RECT scrollRect; scrollRect.left = x; scrollRect.top = y; scrollRect.right = x + width; scrollRect.bottom = y + height; return (ScrollWindowEx(hwnd, dx, dy, &scrollRect, NULL, (HRGN) damageRgn, NULL, 0) == NULLREGION) ? 0 : 1; |
︙ | ︙ | |||
1454 1455 1456 1457 1458 1459 1460 | ExtTextOutW(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); SetBkColor(dc, oldColor); } /* *---------------------------------------------------------------------- * | | | | < < | 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 | 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, TCL_UNUSED(GC), int highlightWidth, Drawable drawable) { TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } /* *---------------------------------------------------------------------- * * TkpDrawFrameEx -- |
︙ | ︙ |
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" |
︙ | ︙ | |||
37 38 39 40 41 42 43 | typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; static void ContainerEventProc(void *clientData, XEvent *eventPtr); static void EmbedGeometryRequest(Container *containerPtr, int width, int height); static void EmbedWindowDeleted(TkWindow *winPtr); static void Tk_MapEmbeddedWindow(TkWindow* winPtr); HWND Tk_GetEmbeddedHWnd(TkWindow* winPtr); |
︙ | ︙ | |||
94 95 96 97 98 99 100 | * Currently it does not do anything. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( | | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | * Currently it does not do anything. * *---------------------------------------------------------------------- */ int TkpTestembedCmd( void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { (void)dummy; (void)interp; (void)objc; (void)objv; |
︙ | ︙ | |||
160 161 162 163 164 165 166 | static void Tk_MapEmbeddedWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { if(!(winPtr->flags & TK_ALREADY_DEAD)) { HWND hwnd = (HWND)winPtr->privatePtr; | | | | 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 | static void Tk_MapEmbeddedWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { if(!(winPtr->flags & TK_ALREADY_DEAD)) { HWND hwnd = (HWND)winPtr->privatePtr; int state = SendMessageW(hwnd, TK_STATE, -1, (WPARAM)-1) - 1; if (state < 0 || state > 3) { state = NormalState; } while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) { /* empty body */ } TkpWmSetState(winPtr, state); TkWmMapWindow(winPtr); } 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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | * 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. */ { TkWindow *winPtr = (TkWindow *) tkwin; int id; HWND hwnd; /* ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); */ /* if (winPtr->window != None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't modify container after widget is created", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL); return TCL_ERROR; } */ if (strcmp(string, "") == 0) { if (winPtr->flags & TK_EMBEDDED) { |
︙ | ︙ | |||
287 288 289 290 291 292 293 | return TCL_ERROR; } id = SendMessageW(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0); if (id == PTR2INT(hwnd)) { if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | 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 | return TCL_ERROR; } id = SendMessageW(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0); if (id == PTR2INT(hwnd)) { if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "The container is already in use", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "IN_USE", NULL); return TCL_ERROR; } } else if (id == -PTR2INT(hwnd)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "the window to use is not a Tk container", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL); return TCL_ERROR; } else { /* * Proceed if the user decide to do so because it can be a legacy * container application. However we may have to return a TCL_ERROR in * order to avoid bug 1096074 in future. */ WCHAR msg[256]; wsprintfW(msg, L"Unable to get information of window \"%.40hs\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string); if (IDCANCEL == MessageBoxW(hwnd, msg, L"Tk Warning", MB_OKCANCEL | MB_ICONWARNING)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Operation has been canceled", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EMBED", "CANCEL", NULL); return TCL_ERROR; } } Tk_DetachEmbeddedWindow(winPtr, FALSE); |
︙ | ︙ | |||
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)); |
︙ | ︙ | |||
849 850 851 852 853 854 855 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( | | | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | * geometry information gets set for the container window. * *---------------------------------------------------------------------- */ static void ContainerEventProc( void *clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_Window tkwin = (Tk_Window)containerPtr->parentPtr; if (eventPtr->type == ConfigureNotify) { |
︙ | ︙ | |||
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" |
︙ | ︙ | |||
118 119 120 121 122 123 124 | /* Builtin space for a limited number of * SubFonts. */ int numSubFonts; /* Length of following array. */ SubFont *subFontArray; /* Array of SubFonts that have been loaded in * order to draw/measure all the characters * encountered by this font so far. All fonts * start off with one SubFont initialized by | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /* Builtin space for a limited number of * SubFonts. */ int numSubFonts; /* Length of following array. */ SubFont *subFontArray; /* Array of SubFonts that have been loaded in * order to draw/measure all the characters * encountered by this font so far. All fonts * start off with one SubFont initialized by * InitFont() from the original set of font * attributes. Usually points to * staticSubFonts, but may point to malloced * space if there are lots of SubFonts. */ HWND hwnd; /* Toplevel window of application that owns * this font, used for getting HDC for * offscreen measurements. */ int pixelSize; /* Original pixel size used when font was |
︙ | ︙ | |||
401 402 403 404 405 406 407 | /* * If this API call fails then we will fallback to setting these named * fonts from script in ttk/fonts.tcl. So far I've only seen it fail when * WINVER has been defined for a higher platform than we are running on. * (i.e. WINVER=0x0600 and running on XP). */ | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | /* * If this API call fails then we will fallback to setting these named * fonts from script in ttk/fonts.tcl. So far I've only seen it fail when * WINVER has been defined for a higher platform than we are running on. * (i.e. WINVER=0x0600 and running on XP). */ memset(&ncMetrics, 0, sizeof(ncMetrics)); ncMetrics.cbSize = sizeof(ncMetrics); if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics), &ncMetrics, 0)) { CreateNamedSystemLogFont(interp, tkwin, "TkDefaultFont", &ncMetrics.lfMessageFont); CreateNamedSystemLogFont(interp, tkwin, "TkHeadingFont", &ncMetrics.lfMessageFont); |
︙ | ︙ | |||
698 699 700 701 702 703 704 | FontFamily *familyPtr; Tcl_Obj *resultPtr, *strPtr; resultPtr = Tcl_NewObj(); fontPtr = (WinFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; | | | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | FontFamily *familyPtr; Tcl_Obj *resultPtr, *strPtr; resultPtr = Tcl_NewObj(); fontPtr = (WinFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; strPtr = Tcl_NewStringObj(familyPtr->faceName, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } Tcl_SetObjResult(interp, resultPtr); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
786 787 788 789 790 791 792 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | */ int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ Tcl_Size numBytes, /* Maximum number of bytes to consider from * source string. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length in pixels; don't * consider any character that would cross * this x-position. If < 0, then line length * is unbounded and the flags argument is * ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char |
︙ | ︙ | |||
841 842 843 844 845 846 847 | */ moretomeasure = 0; curX = 0; start = source; end = start + numBytes; for (p = start; p < end; ) { | | | | | < | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | */ moretomeasure = 0; curX = 0; start = source; end = start + numBytes; for (p = start; p < end; ) { next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, start, p - start, &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { moretomeasure = 1; break; } |
︙ | ︙ | |||
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; | | | | | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | 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; WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, start, p - start, &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { moretomeasure = 1; } else { curX += size.cx; |
︙ | ︙ | |||
903 904 905 906 907 908 909 | char buf[16]; int dstWrote; int lastSize = 0; familyPtr = lastSubFontPtr->familyPtr; Tcl_DStringInit(&runString); for (p = start; p < end; ) { | | | | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | char buf[16]; int dstWrote; int lastSize = 0; familyPtr = lastSubFontPtr->familyPtr; Tcl_DStringInit(&runString); for (p = start; p < end; ) { next = p + Tcl_UtfToUniChar(p, &ch); Tcl_UtfToExternal(NULL, familyPtr->encoding, p, (int) (next - p), TCL_ENCODING_PROFILE_TCL8, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL); Tcl_DStringAppend(&runString,buf,dstWrote); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); |
︙ | ︙ | |||
958 959 960 961 962 963 964 | const char *lastWordBreak = NULL; int ch2; end = p; p = source; ch = ' '; while (p < end) { | | | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | const char *lastWordBreak = NULL; int ch2; end = p; p = source; ch = ' '; while (p < end) { next = p + Tcl_UtfToUniChar(p, &ch2); if ((ch != ' ') && (ch2 == ' ')) { lastWordBreak = p; } p = next; ch = ch2; } |
︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ | | | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | */ int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ TCL_UNUSED(Tcl_Size), /* Maximum number of bytes to consider from * source string in all. */ Tcl_Size rangeStart, /* Index of first byte to measure. */ Tcl_Size rangeLength, /* Length of range to measure in bytes. */ int maxLength, /* If >= 0, maxLength specifies the longest * permissible line length; don't consider any * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { HDC dc; WinFont *fontPtr; TkWinDCState state; fontPtr = (WinFont *) gc->font; LastKnownRequestProcessed(display)++; if (drawable == None) { return; } dc = TkWinGetDrawableDC(display, drawable, &state); |
︙ | ︙ | |||
1215 1216 1217 1218 1219 1220 1221 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | 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 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ Tcl_Size numBytes, /* Number of bytes in string. */ double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) { HDC dc; WinFont *fontPtr; TkWinDCState state; fontPtr = (WinFont *) gc->font; LastKnownRequestProcessed(display)++; if (drawable == None) { return; } dc = TkWinGetDrawableDC(display, drawable, &state); |
︙ | ︙ | |||
1384 1385 1386 1387 1388 1389 1390 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size 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. */ { int widthUntilStart; Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); |
︙ | ︙ | |||
1412 1413 1414 1415 1416 1417 1418 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ | | | | < | 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */ Tcl_Size rangeStart, /* Index of first byte to draw. */ Tcl_Size rangeLength, /* Length of range to draw in bytes. */ double x, double y, /* Coordinates at which to place origin of the * whole (not just the range) string when * drawing. */ double angle) /* What angle to put text at, in degrees. */ { int widthUntilStart; double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart, rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle); } /* |
︙ | ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | lastSubFontPtr = &fontPtr->subFontArray[0]; oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle); GetTextMetricsW(hdc, &tm); end = source + numBytes; for (p = source; p < end; ) { | | | | | < | < | | | | < | | 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 | lastSubFontPtr = &fontPtr->subFontArray[0]; oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle); GetTextMetricsW(hdc, &tm); end = source + numBytes; for (p = source; p < end; ) { next = p + Tcl_UtfToUniChar(p, &ch); thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); /* * The drawing API has a limit of 32767 pixels in one go. * To avoid spending time on a rare case we do not measure each char, * 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; WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, wstr, 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; WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, source, p - source, &runString); familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y, wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); } SelectObject(hdc, oldFont); } static inline HFONT SelectFont( |
︙ | ︙ | |||
1814 1815 1816 1817 1818 1819 1820 | familyPtr->refCount = 2; familyPtr->segCount = LoadFontRanges(hdc, hFont, &familyPtr->startCount, &familyPtr->endCount, &familyPtr->isSymbolFont); encoding = NULL; | | | 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | familyPtr->refCount = 2; familyPtr->segCount = LoadFontRanges(hdc, hFont, &familyPtr->startCount, &familyPtr->endCount, &familyPtr->isSymbolFont); encoding = NULL; if (familyPtr->isSymbolFont) { /* * Symbol fonts are handled specially. For instance, Unicode 0393 * (GREEK CAPITAL GAMMA) must be mapped to Symbol character 0047 * (GREEK CAPITAL GAMMA), because the Symbol font doesn't have a GREEK * CAPITAL GAMMA at location 0393. If Tk interpreted the Symbol font * using the Unicode encoding, it would decide that the Symbol font * has no GREEK CAPITAL GAMMA, because the Symbol encoding (of course) |
︙ | ︙ | |||
2262 2263 2264 2265 2266 2267 2268 | * we don't know the proper Unicode -> symbol font mapping, we can * install the symbol font as the base font and access its glyphs. */ end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { if (Tcl_UtfToExternal(NULL, encoding, src, | | | 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 | * we don't know the proper Unicode -> symbol font mapping, we can * install the symbol font as the base font and access its glyphs. */ end = (row + 1) << FONTMAP_SHIFT; for (i = row << FONTMAP_SHIFT; i < end; i++) { if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src), TCL_ENCODING_PROFILE_STRICT, NULL, buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) { continue; } bitOffset = i & (FONTMAP_BITSPERPAGE - 1); subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7); } } |
︙ | ︙ | |||
2544 2545 2546 2547 2548 2549 2550 | HDC hdc, /* HDC in which font family will be used. */ const char *faceName) /* Font family to query. */ { int result; Tcl_DString faceString; Tcl_DStringInit(&faceString); | | | 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 | HDC hdc, /* HDC in which font family will be used. */ const char *faceName) /* Font family to query. */ { int result; Tcl_DString faceString; Tcl_DStringInit(&faceString); Tcl_UtfToWCharDString(faceName, TCL_INDEX_NONE, &faceString); /* * If the family exists, WinFontExistProc() will be called and * EnumFontFamilies() will return whatever WinFontExistProc() returns. If * the family doesn't exist, EnumFontFamilies() will just return a * non-zero value. */ |
︙ | ︙ | |||
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) { | > | | 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 | 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, segCount; size_t cbData, offset; 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) { | | | | | | | | | | 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 | 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 | /* * 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 <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 Tcl_ObjCmdProc GdiArc; static Tcl_ObjCmdProc GdiBitmap; static Tcl_ObjCmdProc GdiCharWidths; static Tcl_ObjCmdProc GdiImage; static Tcl_ObjCmdProc GdiPhoto; static Tcl_ObjCmdProc GdiLine; static Tcl_ObjCmdProc GdiOval; static Tcl_ObjCmdProc GdiPolygon; static Tcl_ObjCmdProc GdiRectangle; static Tcl_ObjCmdProc GdiText; static Tcl_ObjCmdProc GdiMap; static Tcl_ObjCmdProc GdiCopyBits; /* Local copies of similar routines elsewhere in Tcl/Tk. */ static int GdiGetColor(Tcl_Obj *nameObj, 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(unsigned long color, long hatch, LOGBRUSH *lb, HDC hDC, HBRUSH *oldBrush); static void GdiFreeBrush(Tcl_Interp *interp, HDC hDC, HGDIOBJ oldBrush); 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 Tcl_ObjCmdProc PrintSelectPrinter; static Tcl_ObjCmdProc PrintOpenPrinter; static Tcl_ObjCmdProc PrintClosePrinter; static Tcl_ObjCmdProc PrintOpenDoc; static Tcl_ObjCmdProc PrintCloseDoc; static Tcl_ObjCmdProc PrintOpenPage; static Tcl_ObjCmdProc PrintClosePage; /* * 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_ObjCmdProc *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, Tcl_Obj *const *objv) { 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 = NULL; LOGBRUSH lbrush; HGDIOBJ oldobj = NULL; int dodash = 0; const char *dashdata = 0; drawfunc = Pie; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } hDC = printDC; if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &x2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &y2) != TCL_OK)) { return TCL_ERROR; } argc -= 6; objv += 6; while (argc >= 2) { if (strcmp(Tcl_GetString(objv[0]), "-extent") == 0) { extent = atof(Tcl_GetString(objv[1])); } else if (strcmp(Tcl_GetString(objv[0]), "-start") == 0) { start = atof(Tcl_GetString(objv[1])); } else if (strcmp(Tcl_GetString(objv[0]), "-style") == 0) { if (strcmp(Tcl_GetString(objv[1]), "pieslice") == 0) { drawfunc = Pie; } else if (strcmp(Tcl_GetString(objv[1]), "arc") == 0) { drawfunc = Arc; } else if (strcmp(Tcl_GetString(objv[1]), "chord") == 0) { drawfunc = Chord; } } else if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) { /* Handle all args, even if we don't use them yet. */ if (GdiGetColor(objv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) { if (GdiGetColor(objv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-outlinestipple") == 0) { /* ignored */ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) { /* ignored */ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) { if (Tcl_GetIntFromObj(interp, objv[1], &width)) { return TCL_ERROR; } } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) { if (Tcl_GetString(objv[1])) { dodash = 1; dashdata = Tcl_GetString(objv[1]); } } else { /* Don't know that option! */ Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } argc -= 2; objv += 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(fillcolor, 0, &lbrush, hDC, &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 (hBrush) { 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_Obj *const *objv) { /* * Skip this for now. Should be based on common code with the copybits * command. */ Tcl_WrongNumArgs(interp, 1, objv, "hdc x y " "-anchor [center|n|e|s|w] -background color " "-bitmap bitmap -foreground color\n" "Not implemented yet. Sorry!"); 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_Obj *const *objv) { /* Skip this for now..... */ /* Should be based on common code with the copybits command. */ Tcl_WrongNumArgs(interp, 1, objv, "hdc x y -anchor [center|n|e|s|w] -image name\n" "Not implemented yet. Sorry!"); /* 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, Tcl_Obj *const *objv) { 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, (char *)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)", Tcl_GetString(objv[1]))); return TCL_ERROR; } /* Parse the command line arguments. */ for (j = 2; j < argc; j++) { if (strcmp(Tcl_GetString(objv[j]), "-destination") == 0) { double x, y, w, h; int count = 0; char dummy; if (j < argc) { count = sscanf(Tcl_GetString(objv[++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(Tcl_GetString(objv[j]), "-photo") == 0) { photoname = Tcl_GetString(objv[++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 *)attemptckalloc(sll * ny * sizeof(char)); if (pbuf == 0) { /* Memory allocation failure. */ Tcl_AppendResult(interp, "::tk::print::_gdi photo failed--out of memory", (char *)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); } ckfree(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. * *---------------------------------------------------------------------- */ static 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 *)attemptckalloc(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 *)attemptckalloc(2 * sizeof(double) * nbpoints); if (outPointList == 0) { /* TODO: unreachable */ ckfree(inPointList); return 0; } nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep, NULL, outPointList); ckfree(inPointList); bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints); if (bpoints == 0) { /* TODO: unreachable */ ckfree(outPointList); return 0; } for (n=0; n<nbpoints; n++) { bpoints[n].x = (long)outPointList[2*n]; bpoints[n].y = (long)outPointList[2*n + 1]; } ckfree(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, Tcl_Obj *const *objv) { 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 = NULL; 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, (char *)NULL); return TCL_ERROR; } hDC = printDC; polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { Tcl_AppendResult(interp, "Out of memory in GdiLine", (char *)NULL); return TCL_ERROR; } if ((Tcl_GetIntFromObj(interp, objv[2], (int *)&polypoints[0].x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK) ) { return TCL_ERROR; } argc -= 6; objv += 6; npoly = 2; while (argc >= 2) { /* Check for a number. */ x = strtoul(Tcl_GetString(objv[0]), &strend, 0); if (strend > Tcl_GetString(objv[0])) { /* One number.... */ y = strtoul(Tcl_GetString(objv[1]), &strend, 0); if (strend > Tcl_GetString(objv[1])) { /* TWO numbers!. */ polypoints[npoly].x = x; polypoints[npoly].y = y; npoly++; argc -= 2; objv += 2; } else { /* Only one number... Assume a usage error. */ ckfree(polypoints); Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } } else { if (strcmp(Tcl_GetString(*objv), "-arrow") == 0) { if (strcmp(Tcl_GetString(objv[1]), "none") == 0) { doarrow = 0; } else if (strcmp(Tcl_GetString(objv[1]), "both") == 0) { doarrow = 3; } else if (strcmp(Tcl_GetString(objv[1]), "first") == 0) { doarrow = 2; } else if (strcmp(Tcl_GetString(objv[1]), "last") == 0) { doarrow = 1; } objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-arrowshape") == 0) { /* List of 3 numbers--set arrowshape array. */ int a1, a2, a3; char dummy; if (sscanf(Tcl_GetString(objv[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. */ objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-capstyle") == 0) { objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-fill") == 0) { if (GdiGetColor(objv[1], &linecolor)) { dolinecolor = 1; } objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-joinstyle") == 0) { objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-smooth") == 0) { /* Argument is true/false or 1/0 or bezier. */ if (Tcl_GetString(objv[1])) { switch (Tcl_GetString(objv[1])[0]) { case 't': case 'T': case '1': case 'b': case 'B': /* bezier. */ dosmooth = 1; break; default: dosmooth = 0; break; } objv += 2; argc -= 2; } } else if (strcmp(Tcl_GetString(*objv), "-splinesteps") == 0) { if (Tcl_GetIntFromObj(interp, objv[1], &nStep) != TCL_OK) { return TCL_ERROR; } objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-dash") == 0) { if (Tcl_GetString(objv[1])) { dodash = 1; dashdata = Tcl_GetString(objv[1]); } objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-dashoffset") == 0) { objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-stipple") == 0) { objv += 2; argc -= 2; } else if (strcmp(Tcl_GetString(*objv), "-width") == 0) { if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) { return TCL_ERROR; } objv += 2; argc -= 2; } else { /* It's an unknown argument!. */ argc--; objv++; } /* 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(linecolor, 0, &lbrush, hDC, &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) { ckfree(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 (hBrush) { GdiFreeBrush(interp, hDC, hBrush); } ckfree(polypoints); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiOval -- * * Maps ovals to GDI context. * * Results: * Renders ovals. * *---------------------------------------------------------------------- */ static int GdiOval( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, Tcl_Obj *const *objv) { 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 = NULL; LOGBRUSH lbrush; HGDIOBJ oldobj = NULL; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } hDC = printDC; if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[2], &y1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &x2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &y2) != TCL_OK)) { return TCL_ERROR; } if (x1 > x2) { int x3 = x1; x1 = x2; x2 = x3; } if (y1 > y2) { int y3 = y1; y1 = y2; y2 = y3; } argc -= 6; objv += 6; while (argc > 0) { /* Now handle any other arguments that occur. */ if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) { if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) { if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) { /* Not actually implemented */ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) { if (Tcl_GetString(objv[1])) { if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) { return TCL_ERROR; } } } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) { if (Tcl_GetString(objv[1])) { dodash = 1; dashdata = Tcl_GetString(objv[1]); } } objv += 2; argc -= 2; } if (dofillcolor) { GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &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 (hBrush) { 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, Tcl_Obj *const *objv) { 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 = NULL; HGDIOBJ oldobj = NULL; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } hDC = printDC; polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { /* TODO: unreachable */ Tcl_AppendResult(interp, "Out of memory in GdiLine", (char *)NULL); return TCL_ERROR; } if ((Tcl_GetIntFromObj(interp, objv[2], (int *)&polypoints[0].x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK)) { return TCL_ERROR; } argc -= 6; objv += 6; npoly = 2; while (argc >= 2) { /* Check for a number */ x = strtoul(Tcl_GetString(objv[0]), &strend, 0); if (strend > Tcl_GetString(objv[0])) { /* One number.... */ y = strtoul(Tcl_GetString(objv[1]), &strend, 0); if (strend > Tcl_GetString(objv[1])) { /* TWO numbers!. */ polypoints[npoly].x = x; polypoints[npoly].y = y; npoly++; argc -= 2; objv += 2; } else { /* Only one number... Assume a usage error. */ ckfree(polypoints); Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } } else { /* * Check for arguments. * Most of the arguments affect the "Pen" and "Brush". */ if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) { if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) { if (GdiGetColor(objv[1], &linecolor)) { dolinecolor = 0; } } else if (strcmp(Tcl_GetString(objv[0]), "-smooth") == 0) { if (Tcl_GetString(objv[1])) { switch (Tcl_GetString(objv[1])[0]) { case 't': case 'T': case '1': case 'b': case 'B': /* bezier. */ dosmooth = 1; break; default: dosmooth = 0; break; } } } else if (strcmp(Tcl_GetString(objv[0]), "-splinesteps") == 0) { if (Tcl_GetString(objv[1])) { if (Tcl_GetIntFromObj(interp, objv[1], &nStep) != TCL_OK) { return TCL_ERROR; } } } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) { /* Not supported */ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) { if (Tcl_GetString(objv[1])) { if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) { return TCL_ERROR; } } } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) { if (Tcl_GetString(objv[1])) { dodash = 1; dashdata = Tcl_GetString(objv[1]); } } argc -= 2; objv += 2; } } if (dofillcolor) { GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &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) { ckfree(bpoints); } } else { Polygon(hDC, polypoints, npoly); } if (width || dolinecolor) { GdiFreePen(interp, hDC, hPen); } if (hBrush) { GdiFreeBrush(interp, hDC, hBrush); } else { SelectObject(hDC, oldobj); } ckfree(polypoints); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiRectangle -- * * Maps rectangles to GDI context. * * Results: * Renders rectangles. * *---------------------------------------------------------------------- */ static int GdiRectangle( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, Tcl_Obj *const *objv) { 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 = NULL; HGDIOBJ oldobj = NULL; int dodash = 0; const char *dashdata = 0; /* Verrrrrry simple for now.... */ if (argc < 6) { Tcl_AppendResult(interp, usage_message, (char *)NULL); return TCL_ERROR; } hDC = printDC; if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &x2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &y2) != TCL_OK)) { return TCL_ERROR; } if (x1 > x2) { int x3 = x1; x1 = x2; x2 = x3; } if (y1 > y2) { int y3 = y1; y1 = y2; y2 = y3; } argc -= 6; objv += 6; /* Now handle any other arguments that occur. */ while (argc > 1) { if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) { if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) { dofillcolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) { if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &linecolor)) { dolinecolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) { /* Not supported; ignored */ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) { if (Tcl_GetString(objv[1])) { if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) { return TCL_ERROR; } } } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) { if (Tcl_GetString(objv[1])) { dodash = 1; dashdata = Tcl_GetString(objv[1]); } } argc -= 2; objv += 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(fillcolor, 0, &lbrush, hDC, &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 (hBrush) { 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, Tcl_Obj *const *objv) { 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; HGDIOBJ 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, (char *)NULL); return TCL_ERROR; } hDC = printDC; argc -= 2; objv += 2; while (argc > 0) { if (strcmp(Tcl_GetString(objv[0]), "-font") == 0) { argc--; objv++; if (GdiMakeLogFont(interp, Tcl_GetString(objv[0]), &lf, hDC)) { if ((hfont = CreateFontIndirectW(&lf)) != NULL) { made_font = 1; oldfont = SelectObject(hDC, hfont); } } /* Else leave the font alone!. */ } else if (strcmp(Tcl_GetString(objv[0]), "-array") == 0) { objv++; argc--; if (argc > 0) { aryvarname = Tcl_GetString(objv[0]); } } objv++; 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, aryvarname, (char *)NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * GdiText -- * * Maps text to GDI context. * * Results: * Renders text. * *---------------------------------------------------------------------- */ int GdiText( TCL_UNUSED(void *), Tcl_Interp *interp, int argc, Tcl_Obj *const *objv) { 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 = TK_ANCHOR_N; LOGFONTW lf; HFONT hfont; HGDIOBJ 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, (char *)NULL); return TCL_ERROR; } /* Parse the command. */ hDC = printDC; if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { return TCL_ERROR; } argc -= 4; objv += 4; sizerect.left = sizerect.right = x; sizerect.top = sizerect.bottom = y; while (argc > 0) { if (strcmp(Tcl_GetString(objv[0]), "-anchor") == 0) { argc--; objv++; if (argc > 0) { Tk_GetAnchor(interp, Tcl_GetString(objv[0]), &anchor); } } else if (strcmp(Tcl_GetString(objv[0]), "-justify") == 0) { argc--; objv++; if (argc > 0) { if (strcmp(Tcl_GetString(objv[0]), "left") == 0) { format_flags |= DT_LEFT; } else if (strcmp(Tcl_GetString(objv[0]), "center") == 0) { format_flags |= DT_CENTER; } else if (strcmp(Tcl_GetString(objv[0]), "right") == 0) { format_flags |= DT_RIGHT; } } } else if (strcmp(Tcl_GetString(objv[0]), "-text") == 0) { argc--; objv++; if (argc > 0) { string = Tcl_GetString(objv[0]); } } else if (strcmp(Tcl_GetString(objv[0]), "-font") == 0) { argc--; objv++; if (GdiMakeLogFont(interp, Tcl_GetString(objv[0]), &lf, hDC)) { if ((hfont = CreateFontIndirectW(&lf)) != NULL) { made_font = 1; oldfont = SelectObject(hDC, hfont); } } /* Else leave the font alone! */ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) { argc--; objv++; /* Not implemented yet. */ } else if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) { argc--; objv++; /* Get text color. */ if (GdiGetColor(objv[0], &textcolor)) { dotextcolor = 1; } } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) { argc--; objv++; if (argc > 0) { int value; if (Tcl_GetIntFromObj(interp, objv[0], &value) != TCL_OK) { return TCL_ERROR; } sizerect.right += value; } /* If a width is specified, break at words. */ format_flags |= DT_WORDBREAK; } else if (strcmp(Tcl_GetString(objv[0]), "-single") == 0) { usesingle = 1; } else if (strcmp(Tcl_GetString(objv[0]), "-backfill") == 0) { dobgmode = 1; } argc--; objv++; } if (string == 0) { Tcl_AppendResult(interp, usage_message, (char *)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, TCL_INDEX_NONE, &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, Tcl_Obj *const *objv) { 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, (char *)NULL); return TCL_ERROR; } hdc = printDC; if ((mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent)) == 0) { /* Failed!. */ Tcl_AppendResult(interp, "Cannot get current HDC info", (char *)NULL); return TCL_ERROR; } /* Parse remaining arguments. */ for (argno = 2; argno < argc; argno++) { if (strcmp(Tcl_GetString(objv[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(Tcl_GetString(objv[argno]), "-mode") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { mapmode = GdiNameToMode(Tcl_GetString(objv[argno + 1])); use_mode = 1; argno++; } } else if (strcmp(Tcl_GetString(objv[argno]), "-offset") == 0) { if (argno + 1 >= argc) { need_usage = 1; } else { /* It would be nice if this parsed units as well.... */ if (sscanf(Tcl_GetString(objv[argno + 1]), "%ld%ld", &vorigin.x, &vorigin.y) == 2) { use_offset = 1; } else { need_usage = 1; } argno++; } } else if (strcmp(Tcl_GetString(objv[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(Tcl_GetString(objv[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(Tcl_GetString(objv[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(Tcl_GetString(objv[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, Tcl_Obj *const *objv) { /* 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", (char *)NULL); return TCL_ERROR; } /* * Parse the arguments. */ /* HDC is required. */ if (argc < 2) { Tcl_AppendResult(interp, usage_message, (char *)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(Tcl_GetString(objv[k]), "-window") == 0) { if (Tcl_GetString(objv[k+1]) && Tcl_GetString(objv[k+1])[0] == '.') { do_window = 1; workwin = Tk_NameToWindow(interp, window_spec = Tcl_GetString(objv[++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(Tcl_GetString(objv[++k]), &strend, 0)); if (strend == 0 || strend == Tcl_GetString(objv[k])) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Can't understand window id %s", Tcl_GetString(objv[k]))); return TCL_ERROR; } } } else if (strcmp(Tcl_GetString(objv[k]), "-screen") == 0) { do_screen = 1; wintype = PTScreen; } else if (strcmp(Tcl_GetString(objv[k]), "-client") == 0) { wintype = PTClient; } else if (strcmp(Tcl_GetString(objv[k]), "-source") == 0) { float a, b, c, d; int count = sscanf(Tcl_GetString(objv[++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, (char *)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(Tcl_GetString(objv[k]), "-destination") == 0) { float a, b, c, d; int count; count = sscanf(Tcl_GetString(objv[++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, (char *)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(Tcl_GetString(objv[k]), "-scale") == 0) { if (Tcl_GetString(objv[++k])) { if (Tcl_GetDouble(interp, Tcl_GetString(objv[k]), &scale) != TCL_OK) { return TCL_ERROR; } if (scale <= 0.01 || scale >= 100.0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Unreasonable scale specification %s", Tcl_GetString(objv[k]))); return TCL_ERROR; } do_scale = 1; } } else if (strcmp(Tcl_GetString(objv[k]), "-noprint") == 0 || strncmp(Tcl_GetString(objv[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, (char *)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", (char *)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", (char *)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", (char *)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", (char *)NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } if ((wid = Tk_Width(workwin)) <= 0) { Tcl_AppendResult(interp, "Can't get width of Tk window", (char *)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", (char *)NULL); ReleaseDC(hwnd,src); return TCL_ERROR; } lpDIBHdr = (LPBITMAPINFOHEADER) GlobalLock(hDib); if (!lpDIBHdr) { Tcl_AppendResult(interp, "Can't get DIB header", (char *)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; Tcl_Size 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], TCL_INDEX_NONE, &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); } ckfree(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 *) ckalloc(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) { ckfree(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( unsigned long color, long hatch, LOGBRUSH *lb, HDC hDC, HBRUSH *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 = (HBRUSH)SelectObject(hDC, hBrush); return 1; } /* *---------------------------------------------------------------------- * * GdiFreeBrush -- * * Wraps the protocol to delete a created brush. * * Results: * Deletes brush. * *---------------------------------------------------------------------- */ static void GdiFreeBrush( TCL_UNUSED(Tcl_Interp *), HDC hDC, HGDIOBJ oldBrush) { HGDIOBJ goneBrush; goneBrush = SelectObject(hDC, oldBrush); DeleteObject(goneBrush); } /* * 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 const size_t numsyscolors = sizeof(sysColors) / sizeof(SystemColorEntry); /* *---------------------------------------------------------------------- * * GdiGetColor -- * * Convert color name to color specification. * * Results: * Color name converted. * *---------------------------------------------------------------------- */ static int GdiGetColor( Tcl_Obj *nameObj, COLORREF *color) { const char *name = Tcl_GetString(nameObj); if (_strnicmp(name, "system", 6) == 0) { size_t i, l, u; int 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. */ HGDIOBJ 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)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 = (HPALETTE)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]; snprintf(buffer, sizeof(buffer), "%s::%s", gdiName, gdi_commands[i].command_string); Tcl_CreateObjCommand(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. */ memset(&pd, 0, sizeof(pd)); pd.lStructSize = sizeof(pd); pd.hwndOwner = GetDesktopWindow(); pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION; if (PrintDlgW(&pd) == TRUE) { /*Get document info.*/ memset(&di, 0, 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*)ckalloc(100 * sizeof(char)); char** varlink2 = (char**)ckalloc(sizeof(char*)); *varlink2 = varlink1; WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL); Tcl_LinkVar(interp, "::tk::print::printer_name", varlink2, TCL_LINK_STRING | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::copies", &copies, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_x", &dpi_x, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_y", &dpi_y, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_width", &paper_width, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_height", &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 objc, Tcl_Obj *const objv[]) { Tcl_DString ds; if (objc < 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", (char *)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", (char *)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", (char *)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", (char *)NULL); return TCL_ERROR; } /* * Start printing. */ output = StartDocW(printDC, &di); if (output <= 0) { Tcl_AppendResult(interp, "unable to start document", (char *)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", (char *)NULL); return TCL_ERROR; } if (EndDoc(printDC) <= 0) { Tcl_AppendResult(interp, "unable to establish close document", (char *)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", (char *)NULL); return TCL_ERROR; } /*Start an individual page.*/ if (StartPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to start page", (char *)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", (char *)NULL); return TCL_ERROR; } if (EndPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to close page", (char *)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. */ memset(&iconInfo, 0, sizeof(iconInfo)); iconInfo.fIcon = TRUE; /* * Create device-independent color bitmap. */ memset(&bmInfo, 0, 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; } memset(bgraMask.ptr, 0, 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" |
︙ | ︙ | |||
197 198 199 200 201 202 203 | * None. * *---------------------------------------------------------------------- */ XImage * XCreateImage( | | | < < | 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 | * None. * *---------------------------------------------------------------------- */ XImage * XCreateImage( TCL_UNUSED(Display *), TCL_UNUSED(Visual *), unsigned int depth, int format, int offset, char *data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage* imagePtr = (XImage*)ckalloc(sizeof(XImage)); imagePtr->width = width; imagePtr->height = height; imagePtr->xoffset = offset; imagePtr->format = format; imagePtr->data = data; imagePtr->byte_order = LSBFirst; |
︙ | ︙ | |||
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 | | | < | 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 | * 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, Drawable d, int x, int y, unsigned int width, unsigned int height, TCL_UNUSED(unsigned long), int format) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; XImage *ret_image; HDC hdc, hdcMem; HBITMAP hbmp, hbmpPrev; BITMAPINFO *bmInfo = NULL; HPALETTE hPal, hPalPrev1 = 0, hPalPrev2 = 0; int size; unsigned int n; unsigned int depth; unsigned char *data; TkWinDCState state; BOOL ret; if (format != ZPixmap) { TkpDisplayWarning("Only ZPixmap types are implemented", "XGetImageZPixmap Failure"); return NULL; } |
︙ | ︙ | |||
585 586 587 588 589 590 591 | unsigned long plane_mask, int format) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; XImage *imagePtr; HDC dc; | | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | unsigned long plane_mask, int format) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; XImage *imagePtr; HDC dc; LastKnownRequestProcessed(display)++; if (twdPtr == NULL) { /* * Avoid unmapped windows or bad drawables */ return NULL; |
︙ | ︙ | |||
615 616 617 618 619 620 621 | dc = TkWinGetDrawableDC(display, d, &state); imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL, width, height, 32, 0); size = imagePtr->bytes_per_line * imagePtr->height; imagePtr->data = (char *)ckalloc(size); | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | dc = TkWinGetDrawableDC(display, d, &state); imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL, width, height, 32, 0); size = imagePtr->bytes_per_line * imagePtr->height; imagePtr->data = (char *)ckalloc(size); memset(imagePtr->data, 0, size); for (yy = 0; yy < height; yy++) { for (xx = 0; xx < width; xx++) { pixel = GetPixel(dc, x+(int)xx, y+(int)yy); if (pixel == CLR_INVALID) { break; } |
︙ | ︙ |
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. */ { Tcl_Size 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 138 139 140 141 142 | #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, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, ": ", 2); Tcl_WriteChars(errChannel, msg, TCL_INDEX_NONE); Tcl_WriteChars(errChannel, "\n", 1); return; } } #endif /* !STATIC_BUILD */ len = MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN); |
︙ | ︙ |
Changes to win/tkWinInt.h.
1 2 3 4 5 6 | /* * 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. * | | | | 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 © 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. */ #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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | * 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_ExternalToUtfDString(TkWinGetKeyInputEncoding(), ev->trans_chars, ev->nbytes, dsPtr); } } else if (keyEv->send_event == -3) { /* * Special case for WM_UNICHAR and win2000 multilingual IME input */ len = Tcl_UniCharToUtf(keyEv->keycode, buf); Tcl_DStringAppend(dsPtr, buf, len); } else { /* * This is an event generated from generic code. It has no nchars or * trans_chars members. */ KeySym keysym = KeycodeToKeysym(keyEv->keycode, keyEv->state, 0); if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256)) || (keysym == XK_Return) || (keysym == XK_Tab)) { len = Tcl_UniCharToUtf(keysym & 255, buf); Tcl_DStringAppend(dsPtr, buf, len); } } return Tcl_DStringValue(dsPtr); } /* |
︙ | ︙ | |||
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | * None. * *---------------------------------------------------------------------- */ KeySym XKeycodeToKeysym( TCL_UNUSED(Display *), unsigned int keycode, int index) { int state = 0; if (index & 0x01) { state |= ShiftMask; } return KeycodeToKeysym(keycode, state, 0); } KeySym XkbKeycodeToKeysym( TCL_UNUSED(Display *), unsigned int keycode, TCL_UNUSED(int), int index) { int state = 0; if (index & 0x01) { state |= ShiftMask; } return KeycodeToKeysym(keycode, state, 0); } |
︙ | ︙ | |||
455 456 457 458 459 460 461 | TkpInitKeymapInfo( TkDisplay *dispPtr) /* Display for which to recompute keymap * information. */ { XModifierKeymap *modMapPtr; KeyCode *codePtr; KeySym keysym; | | > | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | TkpInitKeymapInfo( TkDisplay *dispPtr) /* Display for which to recompute keymap * information. */ { XModifierKeymap *modMapPtr; KeyCode *codePtr; KeySym keysym; int count, i, max; Tcl_Size j, arraySize; #define KEYCODE_ARRAY_SIZE 20 dispPtr->bindInfoStale = 0; modMapPtr = XGetModifierMapping(dispPtr->display); /* * Check the keycodes associated with the Lock modifier. If any of them is |
︙ | ︙ | |||
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( | | < | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | * 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( | | < | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | * 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( | | < | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | * 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( | | < < | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | * None. * *---------------------------------------------------------------------- */ KeySym XStringToKeysym( TCL_UNUSED(_Xconst char *)) { return NoSymbol; } /* *---------------------------------------------------------------------- * * XKeysymToString -- |
︙ | ︙ | |||
759 760 761 762 763 764 765 | * None. * *---------------------------------------------------------------------- */ char * XKeysymToString( | | < < | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | * 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" |
︙ | ︙ | |||
172 173 174 175 176 177 178 | const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetTearoffEntryGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static int GetNewID(TkMenuEntry *mePtr, WORD *menuIDPtr); | | < < | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetTearoffEntryGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static int GetNewID(TkMenuEntry *mePtr, WORD *menuIDPtr); static Tcl_ObjCmdProc TkWinMenuKeyObjCmd; static void MenuSelectEvent(TkMenu *menuPtr); static void ReconfigureWindowsMenu(void *clientData); static void RecursivelyClearActiveMenu(TkMenu *menuPtr); static void SetDefaults(int firstTime); static LRESULT CALLBACK TkWinMenuProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK TkWinEmbeddedMenuProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); |
︙ | ︙ | |||
330 331 332 333 334 335 336 | int newEntry; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); winMenuHdl = CreatePopupMenu(); if (winMenuHdl == NULL) { Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj( | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | int newEntry; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); winMenuHdl = CreatePopupMenu(); if (winMenuHdl == NULL) { Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj( "No more menus can be allocated.", TCL_INDEX_NONE)); Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SYSTEM_RESOURCES", NULL); return TCL_ERROR; } /* * We hash all of the HMENU's so that we can get their menu ptrs back when * dispatch messages. |
︙ | ︙ | |||
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; | | | > | | 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 | 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); |
︙ | ︙ | |||
564 565 566 567 568 569 570 | * if any need it. * *---------------------------------------------------------------------- */ static void ReconfigureWindowsMenu( | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | * if any need it. * *---------------------------------------------------------------------- */ static void ReconfigureWindowsMenu( void *clientData) /* The menu we are rebuilding */ { TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; LPCWSTR lpNewItem; UINT flags; |
︙ | ︙ | |||
607 608 609 610 611 612 613 | continue; } itemText = GetEntryText(menuPtr, mePtr); if ((menuPtr->menuType == MENUBAR) || (menuPtr->menuFlags & MENU_SYSTEM_MENU)) { Tcl_DStringInit(&translatedText); | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | continue; } itemText = GetEntryText(menuPtr, mePtr); if ((menuPtr->menuType == MENUBAR) || (menuPtr->menuFlags & MENU_SYSTEM_MENU)) { Tcl_DStringInit(&translatedText); Tcl_UtfToWCharDString(itemText, TCL_INDEX_NONE, &translatedText); lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText); flags |= MF_STRING; } else { lpNewItem = (LPCWSTR) mePtr; flags |= MF_OWNERDRAW; } |
︙ | ︙ | |||
681 682 683 684 685 686 687 | & MENU_SYSTEM_MENU)) { Tcl_DString ds; TkMenuReferences *menuRefPtr; TkMenu *systemMenuPtr = mePtr->childMenuRefPtr->menuPtr; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, | | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | & MENU_SYSTEM_MENU)) { Tcl_DString ds; TkMenuReferences *menuRefPtr; TkMenu *systemMenuPtr = mePtr->childMenuRefPtr->menuPtr; Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->mainMenuPtr->tkwin), TCL_INDEX_NONE); Tcl_DStringAppend(&ds, ".system", 7); menuRefPtr = TkFindMenuReferences(menuPtr->interp, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); |
︙ | ︙ | |||
757 758 759 760 761 762 763 | * The menu is posted and handled. * *---------------------------------------------------------------------- */ int TkpPostMenu( | | | < | | 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 | * The menu is posted and handled. * *---------------------------------------------------------------------- */ int TkpPostMenu( TCL_UNUSED(Tcl_Interp *), TkMenu *menuPtr, int x, int y, Tcl_Size index) { HMENU winMenuHdl = (HMENU) menuPtr->platformData; int result, flags; RECT noGoawayRect; POINT point; Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin); int oldServiceMode = Tcl_GetServiceMode(); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->inPostMenu++; CallPendingReconfigureImmediately(menuPtr); result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { tsdPtr->inPostMenu--; return result; } if (index >= menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } /* |
︙ | ︙ | |||
868 869 870 871 872 873 874 | * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( | | | < < < < < < < < | | > > > > > > > > > > > > | 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 | * 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, Tcl_Size index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); 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 >= 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 |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | * Redraw the embedded menu window. * *---------------------------------------------------------------------- */ static void UpdateEmbeddedMenu( | | | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | * Redraw the embedded menu window. * *---------------------------------------------------------------------- */ static void UpdateEmbeddedMenu( void *clientData) { RECT rc; HWND hMenuWnd = (HWND)clientData; GetClientRect(hMenuWnd, &rc); InvalidateRect(hMenuWnd, &rc, FALSE); UpdateWindow(hMenuWnd); |
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch(message) { case WM_ENTERIDLE: if ((wParam == MSGF_MENU) && (nIdles < 1) && (hwnd == tsdPtr->embeddedMenuHWND)) { Tcl_CreateTimerHandler(200, UpdateEmbeddedMenu, | | | 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch(message) { case WM_ENTERIDLE: if ((wParam == MSGF_MENU) && (nIdles < 1) && (hwnd == tsdPtr->embeddedMenuHWND)) { Tcl_CreateTimerHandler(200, UpdateEmbeddedMenu, (void *) lParam); nIdles++; } break; case WM_INITMENUPOPUP: nIdles = 0; break; |
︙ | ︙ | |||
1130 1131 1132 1133 1134 1135 1136 | * should be returned to windows from this message. * *---------------------------------------------------------------------- */ int TkWinHandleMenuEvent( | | < | 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 | * should be returned to windows from this message. * *---------------------------------------------------------------------- */ int TkWinHandleMenuEvent( TCL_UNUSED(HWND *), UINT *pMessage, WPARAM *pwParam, LPARAM *plParam, LRESULT *plResult) { Tcl_HashEntry *hashEntryPtr; int returnResult = 0; TkMenu *menuPtr; TkMenuEntry *mePtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *pwParam); if (hashEntryPtr != NULL) { menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 | if ((code != TCL_OK) && (code != TCL_CONTINUE) && (code != TCL_BREAK)) { Tcl_AddErrorInfo(interp, "\n (menu preprocess)"); Tcl_BackgroundException(interp, code); } Tcl_Release(interp); } | | | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | if ((code != TCL_OK) && (code != TCL_CONTINUE) && (code != TCL_BREAK)) { Tcl_AddErrorInfo(interp, "\n (menu preprocess)"); Tcl_BackgroundException(interp, code); } Tcl_Release(interp); } TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); *plResult = 0; returnResult = 1; } else { tsdPtr->modalMenuPtr = NULL; } break; |
︙ | ︙ | |||
1248 1249 1250 1251 1252 1253 1254 | } break; case WM_MENUCHAR: { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { | | | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | } break; case WM_MENUCHAR: { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { Tcl_Size i, len; int underline; Tcl_Obj *labelPtr; WCHAR *wlabel; int menuChar; Tcl_DString ds; *plResult = 0; |
︙ | ︙ | |||
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 */ | | | | 1272 1273 1274 1275 1276 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 ((underline < len) && (menuChar == Tcl_UniCharToUpper(wlabel[underline]))) { *plResult = (2 << 16) | i; returnResult = 1; break; } } } |
︙ | ︙ | |||
1336 1337 1338 1339 1340 1341 1342 | twdPtr->type = TWD_WINDC; twdPtr->winDC.hdc = itemPtr->hDC; if (mePtr->state != ENTRY_DISABLED) { if (itemPtr->itemState & ODS_SELECTED) { TkActivateMenuEntry(menuPtr, mePtr->index); } else { | | | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | twdPtr->type = TWD_WINDC; twdPtr->winDC.hdc = itemPtr->hDC; if (mePtr->state != ENTRY_DISABLED) { if (itemPtr->itemState & ODS_SELECTED) { TkActivateMenuEntry(menuPtr, mePtr->index); } else { TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); } } else { /* * On windows, menu entries should highlight even if they are * disabled. (I know this seems dumb, but it is the way native * windows menus works so we ought to mimic it.) The * ENTRY_PLATFORM_FLAG1 flag will indicate that the entry |
︙ | ︙ | |||
1399 1400 1401 1402 1403 1404 1405 | *plParam); if (hashEntryPtr != NULL) { menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); } } if (menuPtr != NULL) { | | | | | | | | | | | | | | | 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 | *plParam); if (hashEntryPtr != NULL) { menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); } } if (menuPtr != NULL) { Tcl_Size entryIndex = LOWORD(*pwParam); if ((menuPtr->menuType == MENUBAR) && menuPtr->tearoff) { /* * Windows passes the entry index starting at 0 for * the first menu entry. However this entry #0 is the * tearoff entry for Tk (the menu has -tearoff 1), * which is ignored for MENUBAR menues on Windows. */ entryIndex++; } mePtr = NULL; if (flags != 0xFFFF) { if ((flags&MF_POPUP) && (entryIndex < menuPtr->numEntries)) { mePtr = menuPtr->entries[entryIndex]; } else { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, INT2PTR(entryIndex)); if (hashEntryPtr != NULL) { mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr); } } } if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) { TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); } else { if (mePtr->index >= (int)menuPtr->numEntries) { Tcl_Panic("Trying to activate an entry which doesn't exist"); } TkActivateMenuEntry(menuPtr, mePtr->index); } MenuSelectEvent(menuPtr); |
︙ | ︙ | |||
1464 1465 1466 1467 1468 1469 1470 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { | | | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { Tcl_Size i; TkMenuEntry *mePtr; TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); MenuSelectEvent(menuPtr); for (i = 0; i < menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->state == ENTRY_ACTIVE) { mePtr->state = ENTRY_NORMAL; } mePtr->entryFlags &= ~ENTRY_PLATFORM_FLAG1; |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | TkWinSetMenu(tkwin, NULL); } } /* *---------------------------------------------------------------------- * | | | | | | < < < < | 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 | 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_UNUSED(Tcl_Interp *), /* The interpreter of the application */ TCL_UNUSED(Tk_Window), /* The frame we are setting up */ TCL_UNUSED(const char *)) /* The name of the menu to put in front. If * NULL, use the default menu bar. */ { /* * Nothing to do. */ } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1585 1586 1587 1588 1589 1590 1591 | *---------------------------------------------------------------------- */ void GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are measuring */ TkMenuEntry *mePtr, /* The entry we are measuring */ | | | < < < < | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 | *---------------------------------------------------------------------- */ void GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are measuring */ TkMenuEntry *mePtr, /* The entry we are measuring */ TCL_UNUSED(Tk_Font), /* Precalculated font */ TCL_UNUSED(const Tk_FontMetrics *),/* Precalculated font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { *heightPtr = indicatorDimensions[0]; if (mePtr->hideMargin) { *widthPtr = 0; } else { int borderWidth; Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin, |
︙ | ︙ | |||
1677 1678 1679 1680 1681 1682 1683 | * *---------------------------------------------------------------------- */ void GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are measuring */ | | | < < < | 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 | * *---------------------------------------------------------------------- */ void GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are measuring */ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ TCL_UNUSED(Tk_Font), /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; } else { *heightPtr = fmPtr->linespace; } *widthPtr = 0; } |
︙ | ︙ | |||
1712 1713 1714 1715 1716 1717 1718 | * None. * *---------------------------------------------------------------------- */ void GetMenuSeparatorGeometry( | | | | < < < < | 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 | * None. * *---------------------------------------------------------------------- */ void GetMenuSeparatorGeometry( TCL_UNUSED(TkMenu *), /* The menu we are measuring */ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ TCL_UNUSED(Tk_Font), /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { *widthPtr = 0; *heightPtr = fmPtr->linespace - (2 * fmPtr->descent); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1829 1830 1831 1832 1833 1834 1835 | void DrawMenuEntryIndicator( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ GC indicatorGC, /* The gc for indicator objects */ | | | | | < < < < < | 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | void DrawMenuEntryIndicator( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ GC indicatorGC, /* The gc for indicator objects */ TCL_UNUSED(Tk_Font), /* The precalculated font */ TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated font metrics */ int x, /* Left edge */ int y, /* Top edge */ TCL_UNUSED(int), TCL_UNUSED(int)) { if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) { RECT rect; GC whichGC; int borderWidth, activeBorderWidth; |
︙ | ︙ | |||
1912 1913 1914 1915 1916 1917 1918 | DrawMenuEntryAccelerator( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ | | | < < < | 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 | DrawMenuEntryAccelerator( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ TCL_UNUSED(Tk_3DBorder), /* The border when an item is active */ int x, /* left edge */ int y, /* top edge */ TCL_UNUSED(int), /* Width of menu entry */ int height) /* Height of menu entry */ { int baseline; int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth; const char *accel; if (menuPtr->menuType == MENUBAR) { return; } if (mePtr->accelPtr != NULL) { accel = Tcl_GetString(mePtr->accelPtr); |
︙ | ︙ | |||
1986 1987 1988 1989 1990 1991 1992 | void DrawMenuEntryArrow( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ | | < < | 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 | void DrawMenuEntryArrow( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are drawing */ Drawable d, /* What we are drawing into */ GC gc, /* The gc we are drawing with */ TCL_UNUSED(Tk_3DBorder), /* The border when an item is active */ int x, /* left edge */ int y, /* top edge */ int width, /* Width of menu entry */ int height, /* Height of menu entry */ int drawArrow) /* For cascade menus, whether of not to draw * the arrow. I cannot figure out Windows' * algorithm for where to draw this. */ { COLORREF oldFgColor; COLORREF oldBgColor; RECT rect; if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) { return; } /* * Don't draw the arrow if a submenu is not attached to this |
︙ | ︙ | |||
2068 2069 2070 2071 2072 2073 2074 | * *---------------------------------------------------------------------- */ void DrawMenuSeparator( TkMenu *menuPtr, /* The menu we are drawing */ | | | | | < < < < | 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 | * *---------------------------------------------------------------------- */ void DrawMenuSeparator( TkMenu *menuPtr, /* The menu we are drawing */ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* What we are drawing into */ TCL_UNUSED(GC), /* The gc we are drawing with */ TCL_UNUSED(Tk_Font), /* The precalculated font */ TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated font metrics */ int x, /* left edge */ int y, /* top edge */ int width, /* width of item */ int height) /* height of item */ { XPoint points[2]; Tk_3DBorder border; points[0].x = x; points[0].y = y + height / 2; points[1].x = x + width - 1; points[1].y = points[0].y; border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1, |
︙ | ︙ | |||
2120 2121 2122 2123 2124 2125 2126 | TkMenuEntry *mePtr, /* The entry we are drawing */ 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, /* Left Edge */ int y, /* Top Edge */ | | < < < | | 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 | TkMenuEntry *mePtr, /* The entry we are drawing */ 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, /* Left Edge */ int y, /* Top Edge */ TCL_UNUSED(int), /* Width of entry */ int height) /* Height of entry */ { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { const char *label, *start, *end; int ch; label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, mePtr->underline); end = start + Tcl_UtfToUniChar(start, &ch); Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, label, x + mePtr->indicatorSpace, y + (height + fmPtr->ascent - fmPtr->descent) / 2, (int) (start - label), (int) (end - label)); } } } |
︙ | ︙ | |||
2166 2167 2168 2169 2170 2171 2172 | * The menu system may take over and process user events for menu input. * *-------------------------------------------------------------- */ static int TkWinMenuKeyObjCmd( | | < | 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 | * The menu system may take over and process user events for menu input. * *-------------------------------------------------------------- */ static int TkWinMenuKeyObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { UINT scanCode; UINT virtualKey; XEvent *eventPtr; Tk_Window tkwin; TkWindow *winPtr; KeySym keySym; int i; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "window keySym"); return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), |
︙ | ︙ | |||
2312 2313 2314 2315 2316 2317 2318 | * create a C level binding directly since we may want to modify the * binding in Tcl code. */ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey", TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL); | | | | | | | | | | 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 | * create a C level binding directly since we may want to modify the * binding in Tcl code. */ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey", TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<Alt_L>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<KeyRelease-Alt_L>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<Alt_R>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<Alt-Key>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<Key-F10>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (void *)uid, "<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0); } /* *---------------------------------------------------------------------- * * DrawMenuEntryLabel -- |
︙ | ︙ | |||
2578 2579 2580 2581 2582 2583 2584 | * *---------------------------------------------------------------------- */ void DrawTearoffEntry( TkMenu *menuPtr, /* The menu we are drawing */ | | | | | < < < < | 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 | * *---------------------------------------------------------------------- */ void DrawTearoffEntry( TkMenu *menuPtr, /* The menu we are drawing */ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are drawing into */ TCL_UNUSED(GC), /* The gc we are drawing with */ TCL_UNUSED(Tk_Font), /* The font we are drawing with */ TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */ int x, int y, int width, int height) { XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; if (menuPtr->menuType != MAIN_MENU) { return; } points[0].x = x; points[0].y = y + height/2; |
︙ | ︙ | |||
3012 3013 3014 3015 3016 3017 3018 | TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font menuFont, tkfont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int x, y, height, width, indicatorSpace, labelWidth, accelWidth; int windowWidth, windowHeight, accelSpace; | | | 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 | TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font menuFont, tkfont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int x, y, height, width, indicatorSpace, labelWidth, accelWidth; int windowWidth, windowHeight, accelSpace; Tcl_Size i, j, lastColumnBreak = 0; int activeBorderWidth, borderWidth; if (menuPtr->tkwin == NULL) { return; } Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin, |
︙ | ︙ | |||
3178 3179 3180 3181 3182 3183 3184 | TkMenu *menuPtr) /* the menu we have selected. */ { union {XEvent general; XVirtualEvent virt;} event; union {DWORD msgpos; POINTS point;} root; memset(&event, 0, sizeof(event)); event.virt.type = VirtualEvent; | | | 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 | TkMenu *menuPtr) /* the menu we have selected. */ { union {XEvent general; XVirtualEvent virt;} event; union {DWORD msgpos; POINTS point;} root; memset(&event, 0, sizeof(event)); event.virt.type = VirtualEvent; event.virt.serial = LastKnownRequestProcessed(menuPtr->display); event.virt.send_event = 0; event.virt.display = menuPtr->display; Tk_MakeWindowExist(menuPtr->tkwin); event.virt.event = Tk_WindowId(menuPtr->tkwin); event.virt.root = XRootWindow(menuPtr->display, 0); event.virt.subwindow = None; event.virt.time = TkpGetMS(); |
︙ | ︙ | |||
3257 3258 3259 3260 3261 3262 3263 | * None. * *---------------------------------------------------------------------- */ HWND Tk_GetMenuHWND( | | < | 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 | * None. * *---------------------------------------------------------------------- */ HWND Tk_GetMenuHWND( TCL_UNUSED(Tk_Window)) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); TkMenuInit(); return tsdPtr->embeddedMenuHWND; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3285 3286 3287 3288 3289 3290 3291 | * Menus have to be reinitialized next time. * *---------------------------------------------------------------------- */ static void MenuExitHandler( | | < < | 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 | * Menus have to be reinitialized next time. * *---------------------------------------------------------------------- */ static void MenuExitHandler( TCL_UNUSED(void *)) /* Not used */ { UnregisterClassW(MENU_CLASS_NAME, Tk_GetHINSTANCE()); UnregisterClassW(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE()); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3312 3313 3314 3315 3316 3317 3318 | * Menus have to be reinitialized next time. * *---------------------------------------------------------------------- */ static void MenuThreadExitHandler( | | < | 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 | * Menus have to be reinitialized next time. * *---------------------------------------------------------------------- */ static void MenuThreadExitHandler( TCL_UNUSED(void *)) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); DestroyWindow(tsdPtr->menuHWND); DestroyWindow(tsdPtr->embeddedMenuHWND); tsdPtr->menuHWND = NULL; tsdPtr->embeddedMenuHWND = NULL; Tcl_DeleteHashTable(&tsdPtr->winMenuTable); |
︙ | ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | * Storage is allocated. * *---------------------------------------------------------------------- */ Tcl_Obj * TkWinGetMenuSystemDefault( | | | < < | | 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 | * Storage is allocated. * *---------------------------------------------------------------------- */ Tcl_Obj * TkWinGetMenuSystemDefault( TCL_UNUSED(Tk_Window), /* A window to use. */ const char *dbName, /* The option database name. */ TCL_UNUSED(const char *)) /* The name of the option class. */ { Tcl_Obj *valuePtr = NULL; if ((strcmp(dbName, "activeBorderWidth") == 0) || (strcmp(dbName, "borderWidth") == 0)) { valuePtr = Tcl_NewWideIntObj(defaultBorderWidth); } else if (strcmp(dbName, "font") == 0) { valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), TCL_INDEX_NONE); } return valuePtr; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3442 3443 3444 3445 3446 3447 3448 | SelectObject(scratchDC, GetStockObject(SYSTEM_FONT)); DeleteDC(scratchDC); DeleteObject(menuFont); Tcl_DStringAppendElement(&menuFontDString, faceName); | | | 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 | SelectObject(scratchDC, GetStockObject(SYSTEM_FONT)); DeleteDC(scratchDC); DeleteObject(menuFont); Tcl_DStringAppendElement(&menuFontDString, faceName); snprintf(sizeString, sizeof(sizeString), "%d", pointSize); Tcl_DStringAppendElement(&menuFontDString, sizeString); if (bold || italic) { Tcl_DString boldItalicDString; Tcl_DStringInit(&boldItalicDString); if (bold) { |
︙ | ︙ |
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" |
︙ | ︙ | |||
36 37 38 39 40 41 42 | int height, int depth) { TkWinDrawable *newTwdPtr, *twdPtr; int planes; Screen *screen; | | | | | 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 | int height, int depth) { TkWinDrawable *newTwdPtr, *twdPtr; int planes; Screen *screen; LastKnownRequestProcessed(display)++; newTwdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); newTwdPtr->type = TWD_BITMAP; newTwdPtr->bitmap.depth = depth; twdPtr = (TkWinDrawable *) d; if (twdPtr->type != TWD_BITMAP) { if (twdPtr->window.winPtr == NULL) { newTwdPtr->bitmap.colormap = DefaultColormap(display, DefaultScreen(display)); } else { newTwdPtr->bitmap.colormap = twdPtr->window.winPtr->atts.colormap; } } else { newTwdPtr->bitmap.colormap = twdPtr->bitmap.colormap; } screen = ScreenOfDisplay(display, 0); planes = 1; if (depth == DefaultDepthOfScreen(screen)) { planes = PTR2INT(screen->ext_data); depth /= planes; } newTwdPtr->bitmap.handle = CreateBitmap(width, height, (DWORD) planes, (DWORD) depth, NULL); /* |
︙ | ︙ | |||
140 141 142 143 144 145 146 | void Tk_FreePixmap( Display *display, Pixmap pixmap) { TkWinDrawable *twdPtr = (TkWinDrawable *) pixmap; | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | void Tk_FreePixmap( Display *display, Pixmap pixmap) { TkWinDrawable *twdPtr = (TkWinDrawable *) pixmap; LastKnownRequestProcessed(display)++; if (twdPtr != NULL) { DeleteObject(twdPtr->bitmap.handle); ckfree(twdPtr); } } /* |
︙ | ︙ | |||
193 194 195 196 197 198 199 | * None. * *---------------------------------------------------------------------- */ int XGetGeometry( | | | | | | | < < < < < < | 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 | * None. * *---------------------------------------------------------------------- */ int XGetGeometry( TCL_UNUSED(Display *), Drawable d, TCL_UNUSED(Window *), TCL_UNUSED(int *), TCL_UNUSED(int *), unsigned int *width_return, unsigned int *height_return, TCL_UNUSED(unsigned int *), TCL_UNUSED(unsigned int *)) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; if (twdPtr->type == TWD_BITMAP) { HDC dc; BITMAPINFO info; if (twdPtr->bitmap.handle == NULL) { Tcl_Panic("XGetGeometry: invalid pixmap"); |
︙ | ︙ |
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" |
︙ | ︙ | |||
27 28 29 30 31 32 33 | static Tcl_TimerToken mouseTimer; /* Handle to the latest mouse timer. */ static int mouseTimerSet = 0; /* 1 if the mouse timer is active. */ /* * Forward declarations of procedures used in this file. */ | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | static Tcl_TimerToken mouseTimer; /* Handle to the latest mouse timer. */ static int mouseTimerSet = 0; /* 1 if the mouse timer is active. */ /* * Forward declarations of procedures used in this file. */ static void MouseTimerProc(void *clientData); /* *---------------------------------------------------------------------- * * TkWinGetModifierState -- * * Return the modifier state as of the last message. |
︙ | ︙ | |||
231 232 233 234 235 236 237 | * May schedule a new timer and/or generate enter/leave events. * *---------------------------------------------------------------------- */ void MouseTimerProc( | | < < < < < < | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | * May schedule a new timer and/or generate enter/leave events. * *---------------------------------------------------------------------- */ void MouseTimerProc( TCL_UNUSED(void *)) { POINT pos; mouseTimerSet = 0; GetCursorPos(&pos); TkWinPointerEvent(NULL, pos.x, pos.y); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
325 326 327 328 329 330 331 | * *---------------------------------------------------------------------- */ Bool XQueryPointer( Display *display, | | | | | | < < < < < | < | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | * *---------------------------------------------------------------------- */ Bool XQueryPointer( Display *display, TCL_UNUSED(Window), TCL_UNUSED(Window *), TCL_UNUSED(Window *), int *root_x_return, int *root_y_return, TCL_UNUSED(int *), TCL_UNUSED(int *), unsigned int *mask_return) { LastKnownRequestProcessed(display)++; TkGetPointerCoords(NULL, root_x_return, root_y_return); *mask_return = TkWinGetModifierState(); return True; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
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 | > > > > > > > > > > > | 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 | 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 |
︙ | ︙ | |||
466 467 468 469 470 471 472 | Window *focus_return, int *revert_to_return) { Tk_Window tkwin = Tk_HWNDToWindow(GetFocus()); *focus_return = tkwin ? Tk_WindowId(tkwin) : 0; *revert_to_return = RevertToParent; | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | Window *focus_return, int *revert_to_return) { Tk_Window tkwin = Tk_HWNDToWindow(GetFocus()); *focus_return = tkwin ? Tk_WindowId(tkwin) : 0; *revert_to_return = RevertToParent; LastKnownRequestProcessed(display)++; return Success; } /* *---------------------------------------------------------------------- * * XSetInputFocus -- |
︙ | ︙ | |||
491 492 493 494 495 496 497 | *---------------------------------------------------------------------- */ int XSetInputFocus( Display *display, Window focus, | | | < < | < | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | *---------------------------------------------------------------------- */ int XSetInputFocus( Display *display, Window focus, TCL_UNUSED(int), TCL_UNUSED(Time)) { LastKnownRequestProcessed(display)++; if (focus != None) { SetFocus(Tk_GetHWND(focus)); } return Success; } /* |
︙ | ︙ |
Changes to win/tkWinPort.h.
1 2 3 4 5 6 7 | /* * tkWinPort.h -- * * This header file handles porting issues that occur because of * differences between Windows and Unix. It should be the only * file that contains #ifdefs to handle different flavors of OS. * | | < | 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 | /* * tkWinPort.h -- * * This header file handles porting issues that occur because of * differences between Windows and Unix. It should be the only * file that contains #ifdefs to handle different flavors of OS. * * 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. */ #ifndef _WINPORT #define _WINPORT /* *--------------------------------------------------------------------------- * The following sets of #includes and #ifdefs are required to get Tcl to * compile under the windows compilers. *--------------------------------------------------------------------------- */ #include <stdio.h> #include <wchar.h> #include <io.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <malloc.h> #include <ctype.h> #include <math.h> #include <string.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) | > | 90 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: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) | < < < < < < < < < < < < < < < | 120 121 122 123 124 125 126 127 | /* * 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) #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" |
︙ | ︙ | |||
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | TkRegion sra, TkRegion srb, TkRegion dr_return) { CombineRgn((HRGN) dr_return, (HRGN) sra, (HRGN) srb, RGN_DIFF); return Success; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | TkRegion sra, TkRegion srb, TkRegion dr_return) { CombineRgn((HRGN) dr_return, (HRGN) sra, (HRGN) srb, RGN_DIFF); return Success; } /* *---------------------------------------------------------------------- * * TkpCopyRegion -- * * Makes the destination region a copy of the source region. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void TkpCopyRegion( TkRegion dst, TkRegion src) { CombineRgn((HRGN)dst, (HRGN)src, NULL, RGN_COPY); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
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" |
︙ | ︙ | |||
57 58 59 60 61 62 63 | TCL_DECLARE_MUTEX(winScrlbrMutex) /* * Declarations for functions defined in this file. */ static Window CreateProc(Tk_Window tkwin, Window parent, | | | | 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 | TCL_DECLARE_MUTEX(winScrlbrMutex) /* * Declarations for functions defined in this file. */ static Window CreateProc(Tk_Window tkwin, Window parent, void *instanceData); static void ModalLoop(WinScrollbar *, XEvent *eventPtr); static LRESULT CALLBACK ScrollbarProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); static void UpdateScrollbar(WinScrollbar *scrollPtr); static void UpdateScrollbarMetrics(void); /* * The class procedure table for the scrollbar widget. */ const Tk_ClassProcs tkpScrollbarProcs = { sizeof(Tk_ClassProcs), /* size */ NULL, /* worldChangedProc */ CreateProc, /* createProc */ NULL /* modalProc */ }; static void WinScrollbarEventProc(void *clientData, XEvent *eventPtr) { WinScrollbar *scrollPtr = (WinScrollbar *)clientData; if (eventPtr->type == ButtonPress) { ModalLoop(scrollPtr, eventPtr); } else { TkScrollbarEventProc(clientData, eventPtr); |
︙ | ︙ | |||
201 202 203 204 205 206 207 | *---------------------------------------------------------------------- */ static Window CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | *---------------------------------------------------------------------- */ static Window CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ void *instanceData) /* Scrollbar instance data. */ { DWORD style; Window window; HWND parent; TkWindow *winPtr; WinScrollbar *scrollPtr = (WinScrollbar *)instanceData; |
︙ | ︙ | |||
269 270 271 272 273 274 275 | * Information appears on the screen. * *-------------------------------------------------------------- */ void TkpDisplayScrollbar( | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | * Information appears on the screen. * *-------------------------------------------------------------- */ void TkpDisplayScrollbar( void *clientData) /* Information about window. */ { WinScrollbar *scrollPtr = (WinScrollbar *)clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; |
︙ | ︙ | |||
356 357 358 359 360 361 362 | int arrowWidth = GetSystemMetrics(SM_CXVSCROLL); hArrowWidth = GetSystemMetrics(SM_CXHSCROLL); hThumb = GetSystemMetrics(SM_CXHTHUMB); vArrowHeight = GetSystemMetrics(SM_CYVSCROLL); vThumb = GetSystemMetrics(SM_CYVTHUMB); | | | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | int arrowWidth = GetSystemMetrics(SM_CXVSCROLL); hArrowWidth = GetSystemMetrics(SM_CXHSCROLL); hThumb = GetSystemMetrics(SM_CXHTHUMB); vArrowHeight = GetSystemMetrics(SM_CYVSCROLL); vThumb = GetSystemMetrics(SM_CYVTHUMB); snprintf(tkDefScrollbarWidth, sizeof(tkDefScrollbarWidth), "%d", arrowWidth); } /* *---------------------------------------------------------------------- * * TkpComputeScrollbarGeometry -- * |
︙ | ︙ | |||
548 549 550 551 552 553 554 | Tcl_PrintDouble(NULL, pos, valueString); Tcl_DStringAppendElement(&cmdString, "moveto"); Tcl_DStringAppendElement(&cmdString, valueString); } interp = scrollPtr->info.interp; | | | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | Tcl_PrintDouble(NULL, pos, valueString); Tcl_DStringAppendElement(&cmdString, "moveto"); Tcl_DStringAppendElement(&cmdString, valueString); } interp = scrollPtr->info.interp; code = Tcl_EvalEx(interp, cmdString.string, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (scrollbar command)"); Tcl_BackgroundException(interp, code); } Tcl_DStringFree(&cmdString); Tcl_ServiceAll(); |
︙ | ︙ | |||
587 588 589 590 591 592 593 | * None. * *---------------------------------------------------------------------- */ void TkpConfigureScrollbar( | | < | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | * None. * *---------------------------------------------------------------------- */ void TkpConfigureScrollbar( TCL_UNUSED(TkScrollbar *)) /* Information about widget; may or may not * already have values for some fields. */ { } /* *---------------------------------------------------------------------- * * ModalLoop -- * |
︙ | ︙ |
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 16 17 18 19 20 21 22 23 | /* * 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" #include "tkWinInt.h" /* * Should be defined in WTypes.h but mingw 1.0 is missing them. */ #ifndef _ROTFLAGS_DEFINED #define _ROTFLAGS_DEFINED |
︙ | ︙ | |||
58 59 60 61 62 63 64 | #endif /* TK_SEND_ENABLED_ON_WINDOWS */ /* * Functions internal to this file. */ #ifdef TK_SEND_ENABLED_ON_WINDOWS | | < < | | 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 | #endif /* TK_SEND_ENABLED_ON_WINDOWS */ /* * Functions internal to this file. */ #ifdef TK_SEND_ENABLED_ON_WINDOWS static Tcl_CmdDeleteProc CmdDeleteProc; static void RevokeObjectRegistration(RegisteredInterp *riPtr); #endif /* TK_SEND_ENABLED_ON_WINDOWS */ static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk); #ifdef TK_SEND_ENABLED_ON_WINDOWS static HRESULT RegisterInterp(const char *name, RegisteredInterp *riPtr); #endif /* TK_SEND_ENABLED_ON_WINDOWS */ static int FindInterpreterObject(Tcl_Interp *interp, const char *name, LPDISPATCH *ppdisp); static int Send(LPDISPATCH pdispInterp, Tcl_Interp *interp, int async, void *clientData, Tcl_Size objc, Tcl_Obj *const objv[]); static void SendTrace(const char *format, ...); static Tcl_EventProc SendEventProc; #if defined(DEBUG) || defined(_DEBUG) #define TRACE SendTrace #else |
︙ | ︙ | |||
143 144 145 146 147 148 149 | * Initialise the COM library for this interpreter just once. */ if (tsdPtr->initialized == 0) { hr = CoInitialize(0); if (FAILED(hr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | * Initialise the COM library for this interpreter just once. */ if (tsdPtr->initialized == 0) { hr = CoInitialize(0); if (FAILED(hr)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "failed to initialize the COM library", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SEND", "COM", NULL); return ""; } tsdPtr->initialized = 1; TRACE("Initialized COM library for interp 0x%" TCL_Z_MODIFIER "x\n", (size_t)interp); } |
︙ | ︙ | |||
207 208 209 210 211 212 213 | * *---------------------------------------------------------------------- */ int TkGetInterpNames( Tcl_Interp *interp, /* Interpreter for returning a result. */ | | < | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | * *---------------------------------------------------------------------- */ int TkGetInterpNames( Tcl_Interp *interp, /* Interpreter for returning a result. */ TCL_UNUSED(Tk_Window)) /* Window whose display is to be used for the * lookup. */ { #ifndef TK_SEND_ENABLED_ON_WINDOWS (void)interp; /* * Temporarily disabled for bug #858822 */ return TCL_OK; #else /* TK_SEND_ENABLED_ON_WINDOWS */ |
︙ | ︙ | |||
318 319 320 321 322 323 324 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SendObjCmd( | | > | < | > > | | | | | | | | | | > > > | < < < < < < < < < < < < | 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 | * See the user documentation. * *-------------------------------------------------------------- */ int Tk_SendObjCmd( void *clientData, /* Information about sender (only dispPtr * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { enum { SEND_ASYNC, SEND_DISPLAYOF, SEND_LAST }; static const char *const sendOptions[] = { "-async", "-displayof", "--", NULL }; const char *stringRep; int result = TCL_OK; int i, async = 0, index; /* * Process the command options. */ for (i = 1; i < (objc - 1); i++) { stringRep = Tcl_GetString(objv[i]); if (stringRep[0] == '-') { if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions, sizeof(char *), "option", 0, &index) != TCL_OK) { break; } if (index == SEND_ASYNC) { async = 1; } else if (index == SEND_DISPLAYOF) { i++; } else /* if (index == SEND_LAST) */ { i++; break; } } else { break; } } /* * Ensure we still have a valid command. */ if (objc < (i + 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?-async? ?-displayof? ?--? interpName arg ?arg ...?"); result = TCL_ERROR; } /* * Send the arguments to the foreign interp. */ /* FIX ME: we need to check for local interp */ if (result == TCL_OK) { LPDISPATCH pdisp; |
︙ | ︙ | |||
484 485 486 487 488 489 490 | * *-------------------------------------------------------------- */ #ifdef TK_SEND_ENABLED_ON_WINDOWS static void CmdDeleteProc( | | | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | * *-------------------------------------------------------------- */ #ifdef TK_SEND_ENABLED_ON_WINDOWS static void CmdDeleteProc( void *clientData) { RegisteredInterp *riPtr = (RegisteredInterp *)clientData; /* * Lock the package structure in memory. */ |
︙ | ︙ | |||
566 567 568 569 570 571 572 | } } #endif /* TK_SEND_ENABLED_ON_WINDOWS */ /* * ---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | } } #endif /* TK_SEND_ENABLED_ON_WINDOWS */ /* * ---------------------------------------------------------------------- * * BuildMoniker -- * * Construct a moniker from the given name. This ensures that all our * monikers have the same prefix. * * Results: * S_OK. If the name cannot be turned into a moniker then a COM error |
︙ | ︙ | |||
621 622 623 624 625 626 627 | HRESULT hr = CreateFileMoniker(TKWINSEND_REGISTRATION_BASE, &pmkClass); if (SUCCEEDED(hr)) { LPMONIKER pmkItem = NULL; Tcl_DString dString; Tcl_DStringInit(&dString); | | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | HRESULT hr = CreateFileMoniker(TKWINSEND_REGISTRATION_BASE, &pmkClass); if (SUCCEEDED(hr)) { LPMONIKER pmkItem = NULL; Tcl_DString dString; Tcl_DStringInit(&dString); Tcl_UtfToWCharDString(name, TCL_INDEX_NONE, &dString); hr = CreateFileMoniker((LPOLESTR)Tcl_DStringValue(&dString), &pmkItem); Tcl_DStringFree(&dString); if (SUCCEEDED(hr)) { hr = pmkClass->lpVtbl->ComposeWith(pmkClass, pmkItem, FALSE, ppmk); pmkItem->lpVtbl->Release(pmkItem); } pmkClass->lpVtbl->Release(pmkClass); |
︙ | ︙ | |||
673 674 675 676 677 678 679 | hr = GetRunningObjectTable(0, &pROT); if (SUCCEEDED(hr)) { offset = 0; for (i = 1; SUCCEEDED(hr); i++) { if (i > 1) { if (i == 2) { Tcl_DStringInit(&dString); | | | | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | hr = GetRunningObjectTable(0, &pROT); if (SUCCEEDED(hr)) { offset = 0; for (i = 1; SUCCEEDED(hr); i++) { if (i > 1) { if (i == 2) { Tcl_DStringInit(&dString); Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE); Tcl_DStringAppend(&dString, " #", 2); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE); actualName = Tcl_DStringValue(&dString); } snprintf(Tcl_DStringValue(&dString) + offset, TCL_INTEGER_SPACE, "%d", i); } hr = BuildMoniker(actualName, &pmk); if (SUCCEEDED(hr)) { hr = pROT->lpVtbl->Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, |
︙ | ︙ | |||
735 736 737 738 739 740 741 | static int Send( LPDISPATCH pdispInterp, /* Pointer to the remote interp's COM * object. */ Tcl_Interp *interp, /* The local interpreter. */ int async, /* Flag for the calling style. */ | < | | < | 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 | static int Send( LPDISPATCH pdispInterp, /* Pointer to the remote interp's COM * object. */ Tcl_Interp *interp, /* The local interpreter. */ int async, /* Flag for the calling style. */ TCL_UNUSED(void *), Tcl_Size objc, /* Number of arguments to be sent. */ Tcl_Obj *const objv[]) /* The arguments to be sent. */ { VARIANT vCmd, vResult; DISPPARAMS dp; EXCEPINFO ei; UINT uiErr = 0; HRESULT hr = S_OK, ehr = S_OK; Tcl_Obj *cmd = NULL; DISPID dispid; Tcl_DString ds; const char *src; cmd = Tcl_ConcatObj(objc, objv); /* * Setup the arguments for the COM method call. */ |
︙ | ︙ | |||
966 967 968 969 970 971 972 | * * ---------------------------------------------------------------------- */ static int SendEventProc( Tcl_Event *eventPtr, | | < | 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | * * ---------------------------------------------------------------------- */ static int SendEventProc( Tcl_Event *eventPtr, TCL_UNUSED(int)) { SendEvent *evPtr = (SendEvent *)eventPtr; TRACE("SendEventProc\n"); Tcl_EvalObjEx(evPtr->interp, evPtr->cmdPtr, TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL); Tcl_DecrRefCount(evPtr->cmdPtr); |
︙ | ︙ |
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" |
︙ | ︙ | |||
140 141 142 143 144 145 146 | * * ---------------------------------------------------------------------- */ static void TkWinSendCom_Destroy( LPDISPATCH pdisp) { | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | * * ---------------------------------------------------------------------- */ static void TkWinSendCom_Destroy( LPDISPATCH pdisp) { CoTaskMemFree(pdisp); } /* * ---------------------------------------------------------------------- * * IDispatch -- * |
︙ | ︙ | |||
387 388 389 390 391 392 393 | (void)puArgErr; VariantInit(&vCmd); hr = VariantChangeType(&vCmd, &Cmd, 0, VT_BSTR); if (FAILED(hr)) { Tcl_SetObjResult(obj->interp, Tcl_NewStringObj( | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | (void)puArgErr; VariantInit(&vCmd); hr = VariantChangeType(&vCmd, &Cmd, 0, VT_BSTR); if (FAILED(hr)) { Tcl_SetObjResult(obj->interp, Tcl_NewStringObj( "invalid args: Async(command)", TCL_INDEX_NONE)); TkWinSend_SetExcepInfo(obj->interp, pExcepInfo); hr = DISP_E_EXCEPTION; } if (SUCCEEDED(hr) && obj->interp) { Tcl_Obj *scriptPtr; |
︙ | ︙ |
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 | /* * 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() 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(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), TCL_INDEX_NONE, &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]; snprintf(buffer, 100, "\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( void *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(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( void *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\"", TCL_INDEX_NONE)); 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( void *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, TCL_INDEX_NONE, &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, TCL_INDEX_NONE, &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", TCL_INDEX_NONE)); 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, icoInterpPtr, NULL); Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd, icoInterpPtr, NULL); Tk_CreateEventHandler(mainWindow, StructureNotifyMask, WinIcoDestroy, 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 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 | /* * 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 #undef USE_TK_STUBS #define USE_TK_STUBS #include "tkWinInt.h" #undef TCLBOOLWARNING #define TCLBOOLWARNING(boolPtr) /* needed here because we compile with -Wc++-compat */ HWND tkWinCurrentDialog; /* * Forward declarations of functions defined later in this file: */ static Tcl_ObjCmdProc TestclipboardObjCmd; static Tcl_ObjCmdProc TestwineventObjCmd; static Tcl_ObjCmdProc TestfindwindowObjCmd; static Tcl_ObjCmdProc TestgetwindowinfoObjCmd; static Tcl_ObjCmdProc TestwinlocaleObjCmd; static Tk_GetSelProc SetSelectionResult; /* *---------------------------------------------------------------------- * * TkplatformtestInit -- * * Defines commands that test platform specific functionality for Windows |
︙ | ︙ | |||
167 168 169 170 171 172 173 | LocalFree(msgPtr); } } if (length == 0) { if (error == ERROR_CALL_NOT_IMPLEMENTED) { strcpy(msgBuf, "function not supported under Win32s"); } else { | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | LocalFree(msgPtr); } } if (length == 0) { if (error == ERROR_CALL_NOT_IMPLEMENTED) { strcpy(msgBuf, "function not supported under Win32s"); } else { snprintf(msgBuf, sizeof(msgBuf), "unknown error: %ld", error); } msg = msgBuf; } else { char *msgPtr; Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(wMsgPtr, wcslen(wMsgPtr), &ds); |
︙ | ︙ | |||
194 195 196 197 198 199 200 | if (msgPtr[length-1] == '\r') { --length; } msgPtr[length] = 0; msg = msgPtr; } | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | if (msgPtr[length-1] == '\r') { --length; } msgPtr[length] = 0; msg = msgPtr; } snprintf(id, sizeof(id), "%ld", error); Tcl_SetErrorCode(interp, "WINDOWS", id, msg, NULL); Tcl_AppendToObj(resultPtr, msg, length); Tcl_SetObjResult(interp, resultPtr); if (length != 0) { Tcl_DStringFree(&ds); } |
︙ | ︙ | |||
223 224 225 226 227 228 229 | * None. * *---------------------------------------------------------------------- */ static int SetSelectionResult( | | < < | | 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 | * None. * *---------------------------------------------------------------------- */ static int SetSelectionResult( TCL_UNUSED(void *), Tcl_Interp *interp, const char *selection) { Tcl_AppendResult(interp, selection, NULL); return TCL_OK; } static int TestclipboardObjCmd( void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_Window tkwin = (Tk_Window)clientData; if (objc != 1) { |
︙ | ︙ | |||
269 270 271 272 273 274 275 | * None. * *---------------------------------------------------------------------- */ static int TestwineventObjCmd( | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | * None. * *---------------------------------------------------------------------- */ static int TestwineventObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { HWND hwnd = 0; HWND child = 0; HWND control; |
︙ | ︙ | |||
302 303 304 305 306 307 308 | {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK"}, {WM_CHAR, "WM_CHAR"}, {WM_GETTEXT, "WM_GETTEXT"}, {WM_SETTEXT, "WM_SETTEXT"}, {WM_COMMAND, "WM_COMMAND"}, {-1, 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 | {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK"}, {WM_CHAR, "WM_CHAR"}, {WM_GETTEXT, "WM_GETTEXT"}, {WM_SETTEXT, "WM_SETTEXT"}, {WM_COMMAND, "WM_COMMAND"}, {-1, NULL} }; 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) { return TCL_ERROR; } hwnd = (HWND)INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0)); if (rest == Tcl_GetString(objv[1])) { hwnd = FindWindowA(NULL, Tcl_GetString(objv[1])); if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("no such window", TCL_INDEX_NONE)); return TCL_ERROR; } } UpdateWindow(hwnd); id = strtol(Tcl_GetString(objv[2]), &rest, 0); if (rest == Tcl_GetString(objv[2])) { |
︙ | ︙ | |||
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 | < | < | | < | | | | | | < | | | 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 | 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 Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, buf, TCL_INDEX_NONE, &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_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), TCL_INDEX_NONE, &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: ", TCL_INDEX_NONE)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; } break; } case WM_COMMAND: { char buf[TCL_INTEGER_SPACE]; if (objc < 5) { wParam = MAKEWPARAM(id, 0); lParam = (LPARAM)child; } snprintf(buf, sizeof(buf), "%d", (int) SendMessageA(hwnd, message, wParam, lParam)); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); break; } default: { char buf[TCL_INTEGER_SPACE]; snprintf(buf, sizeof(buf), "%d", (int) SendDlgItemMessageA(hwnd, id, message, wParam, lParam)); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); break; } } return TCL_OK; } /* * testfindwindow title ?class? * Find a Windows window using the FindWindow API call. This takes the window * title and optionally the window class and if found returns the HWND and * raises an error if the window is not found. * eg: testfindwindow Console TkTopLevel * Can find the console window if it is visible. * eg: testfindwindow "TkTest #10201" "#32770" * Can find a messagebox window with this title. */ static int TestfindwindowObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { LPCWSTR title = NULL, windowClass = NULL; Tcl_DString titleString, classString; HWND hwnd = NULL; int r = TCL_OK; DWORD myPid; Tcl_DStringInit(&classString); Tcl_DStringInit(&titleString); if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "title ?class?"); return TCL_ERROR; } Tcl_DStringInit(&titleString); title = Tcl_UtfToWCharDString(Tcl_GetString(objv[1]), TCL_INDEX_NONE, &titleString); if (objc == 3) { Tcl_DStringInit(&classString); windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), TCL_INDEX_NONE, &classString); } if (title[0] == 0) title = NULL; /* We want find a window the belongs to us and not some other process */ hwnd = NULL; myPid = GetCurrentProcessId(); while (1) { |
︙ | ︙ | |||
485 486 487 488 489 490 491 | break; } if (pid == myPid) break; /* Found it */ } if (hwnd == NULL) { | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | break; } if (pid == myPid) break; /* Found it */ } if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", TCL_INDEX_NONE)); AppendSystemError(interp, GetLastError()); r = TCL_ERROR; } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd))); } Tcl_DStringFree(&titleString); |
︙ | ︙ | |||
511 512 513 514 515 516 517 | Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj(PTR2INT(hwnd))); return TRUE; } static int TestgetwindowinfoObjCmd( | | < | | | | | < < | 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 | Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj(PTR2INT(hwnd))); return TRUE; } static int TestgetwindowinfoObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_WideInt hwnd; Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL; Tcl_Obj *childrenObj = NULL; WCHAR buf[512]; int cch, cchBuf = 256; Tcl_DString ds; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "hwnd"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK) return TCL_ERROR; cch = GetClassNameW((HWND)INT2PTR(hwnd), buf, cchBuf); if (cch == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", TCL_INDEX_NONE)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; } else { Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(buf, wcslen(buf), &ds); classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } dictObj = Tcl_NewDictObj(); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2), Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID))); cch = GetWindowTextW((HWND)INT2PTR(hwnd), buf, cchBuf); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(buf, cch, &ds); textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6), Tcl_NewWideIntObj(PTR2INT(GetParent((HWND)(size_t)hwnd)))); childrenObj = Tcl_NewListObj(0, NULL); EnumChildWindows((HWND)(size_t)hwnd, EnumChildrenProc, (LPARAM)childrenObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", TCL_INDEX_NONE), childrenObj); Tcl_SetObjResult(interp, dictObj); return TCL_OK; } static int TestwinlocaleObjCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(GetThreadLocale())); return TCL_OK; } |
︙ | ︙ |
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" |
︙ | ︙ | |||
166 167 168 169 170 171 172 | TkpPrintWindowId( char *buf, /* Pointer to string large enough to hold the * hex representation of a pointer. */ Window window) /* Window to be printed into buffer. */ { HWND hwnd = (window) ? Tk_GetHWND(window) : 0; | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | TkpPrintWindowId( char *buf, /* Pointer to string large enough to hold the * hex representation of a pointer. */ Window window) /* Window to be printed into buffer. */ { HWND hwnd = (window) ? Tk_GetHWND(window) : 0; snprintf(buf, TCL_INTEGER_SPACE, "0x%" TCL_Z_MODIFIER "x", (size_t)hwnd); } /* *---------------------------------------------------------------------- * * TkpScanWindowId -- * |
︙ | ︙ | |||
228 229 230 231 232 233 234 | } return TCL_OK; } /* *---------------------------------------------------------------------- * | | | | > | 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 | } return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_MakeWindow -- * * Creates a Windows window object based on the current attributes of the * specified TkWindow. * * Results: * Returns a pointer to a new TkWinDrawable cast to a Window. * * 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; |
︙ | ︙ | |||
301 302 303 304 305 306 307 | Tcl_HashEntry *entryPtr; TkWinDrawable *twdPtr = (TkWinDrawable *)w; TkWindow *winPtr = TkWinGetWinPtr(w); HWND hwnd = Tk_GetHWND(w); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | Tcl_HashEntry *entryPtr; TkWinDrawable *twdPtr = (TkWinDrawable *)w; TkWindow *winPtr = TkWinGetWinPtr(w); HWND hwnd = Tk_GetHWND(w); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); LastKnownRequestProcessed(display)++; /* * Remove references to the window in the pointer module then release the * drawable. */ TkPointerDeadWindow(winPtr); |
︙ | ︙ | |||
336 337 338 339 340 341 342 | *---------------------------------------------------------------------- * * XMapWindow -- * * Cause the given window to become visible. * * Results: | | | > > > > | | 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 | *---------------------------------------------------------------------- * * XMapWindow -- * * Cause the given window to become visible. * * Results: * Always returns Success or BadWindow. * * Side effects: * Causes the window state to change, and generates a MapNotify event. * *---------------------------------------------------------------------- */ int XMapWindow( Display *display, Window w) { XEvent event; TkWindow *parentPtr; TkWindow *winPtr; if (!w) { return BadWindow; } winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; ShowWindow(Tk_GetHWND(w), SW_SHOWNORMAL); winPtr->flags |= TK_MAPPED; /* * Check to see if this window is visible now. If all of the parent * windows up to the first toplevel are mapped, then this window and its |
︙ | ︙ | |||
376 377 378 379 380 381 382 | } if (parentPtr->flags & TK_TOP_HIERARCHY) { break; } } } else { event.type = MapNotify; | | | | 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 | } if (parentPtr->flags & TK_TOP_HIERARCHY) { break; } } } else { event.type = MapNotify; event.xmap.serial = LastKnownRequestProcessed(display); event.xmap.send_event = False; event.xmap.display = display; event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } /* * Generate VisibilityNotify events for this window and its mapped * children. */ event.type = VisibilityNotify; event.xvisibility.serial = LastKnownRequestProcessed(display); event.xvisibility.send_event = False; event.xvisibility.display = display; event.xvisibility.window = winPtr->window; event.xvisibility.state = VisibilityUnobscured; NotifyVisibility(&event, winPtr); return Success; } |
︙ | ︙ | |||
445 446 447 448 449 450 451 | *---------------------------------------------------------------------- * * XUnmapWindow -- * * Cause the given window to become invisible. * * Results: | | | > > > > | | | 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 | *---------------------------------------------------------------------- * * XUnmapWindow -- * * Cause the given window to become invisible. * * Results: * Always returns Success or BadWindow. * * Side effects: * Causes the window state to change, and generates an UnmapNotify event. * *---------------------------------------------------------------------- */ int XUnmapWindow( Display *display, Window w) { XEvent event; TkWindow *winPtr; if (!w) { return BadWindow; } winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; /* * Bug fix: Don't short circuit this routine based on TK_MAPPED because it * will be cleared before XUnmapWindow is called. */ ShowWindow(Tk_GetHWND(w), SW_HIDE); winPtr->flags &= ~TK_MAPPED; if (winPtr->flags & TK_WIN_MANAGED) { event.type = UnmapNotify; event.xunmap.serial = LastKnownRequestProcessed(display); event.xunmap.send_event = False; event.xunmap.display = display; event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; Tk_HandleEvent(&event); } |
︙ | ︙ | |||
507 508 509 510 511 512 513 | int XMoveResizeWindow( Display *display, Window w, int x, int y, /* Position relative to parent. */ unsigned int width, unsigned int height) { | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | int XMoveResizeWindow( Display *display, Window w, int x, int y, /* Position relative to parent. */ unsigned int width, unsigned int height) { LastKnownRequestProcessed(display)++; MoveWindow(Tk_GetHWND(w), x, y, (int) width, (int) height, TRUE); return Success; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
536 537 538 539 540 541 542 | XMoveWindow( Display *display, Window w, int x, int y) /* Position relative to parent */ { TkWindow *winPtr = TkWinGetWinPtr(w); | | | 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | XMoveWindow( Display *display, Window w, int x, int y) /* Position relative to parent */ { TkWindow *winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; MoveWindow(Tk_GetHWND(w), x, y, winPtr->changes.width, winPtr->changes.height, TRUE); return Success; } /* |
︙ | ︙ | |||
567 568 569 570 571 572 573 | XResizeWindow( Display *display, Window w, unsigned int width, unsigned int height) { TkWindow *winPtr = TkWinGetWinPtr(w); | | | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | XResizeWindow( Display *display, Window w, unsigned int width, unsigned int height) { TkWindow *winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; MoveWindow(Tk_GetHWND(w), winPtr->changes.x, winPtr->changes.y, (int)width, (int)height, TRUE); return Success; } /* |
︙ | ︙ | |||
597 598 599 600 601 602 603 | int XRaiseWindow( Display *display, Window w) { HWND window = Tk_GetHWND(w); | | | | 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 | int XRaiseWindow( Display *display, Window w) { HWND window = Tk_GetHWND(w); LastKnownRequestProcessed(display)++; SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); return Success; } int XLowerWindow( Display *display, Window w) { HWND window = Tk_GetHWND(w); LastKnownRequestProcessed(display)++; SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); return Success; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
643 644 645 646 647 648 649 | Window w, unsigned int valueMask, XWindowChanges *values) { TkWindow *winPtr = TkWinGetWinPtr(w); HWND hwnd = Tk_GetHWND(w); | | | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | Window w, unsigned int valueMask, XWindowChanges *values) { TkWindow *winPtr = TkWinGetWinPtr(w); HWND hwnd = Tk_GetHWND(w); LastKnownRequestProcessed(display)++; /* * Change the shape and/or position of the window. */ if (valueMask & (CWX|CWY|CWWidth|CWHeight)) { MoveWindow(hwnd, winPtr->changes.x, winPtr->changes.y, |
︙ | ︙ | |||
699 700 701 702 703 704 705 | RECT rc; HBRUSH brush; HPALETTE oldPalette, palette; TkWindow *winPtr; HWND hwnd = Tk_GetHWND(w); HDC dc = GetDC(hwnd); | | | | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | RECT rc; HBRUSH brush; HPALETTE oldPalette, palette; TkWindow *winPtr; HWND hwnd = Tk_GetHWND(w); HDC dc = GetDC(hwnd); palette = TkWinGetPalette(DefaultColormapOfScreen(ScreenOfDisplay(display, 0))); oldPalette = SelectPalette(dc, palette, FALSE); LastKnownRequestProcessed(display)++; winPtr = TkWinGetWinPtr(w); brush = CreateSolidBrush(winPtr->atts.background_pixel); GetWindowRect(hwnd, &rc); rc.right = rc.right - rc.left; rc.bottom = rc.bottom - rc.top; rc.left = rc.top = 0; |
︙ | ︙ | |||
827 828 829 830 831 832 833 | Window window; if (busyPtr->tkBusy != NULL) { Tk_MapWindow(busyPtr->tkBusy); window = Tk_WindowId(busyPtr->tkBusy); display = Tk_Display(busyPtr->tkBusy); hWnd = Tk_GetHWND(window); | | | 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | Window window; if (busyPtr->tkBusy != NULL) { Tk_MapWindow(busyPtr->tkBusy); window = Tk_WindowId(busyPtr->tkBusy); display = Tk_Display(busyPtr->tkBusy); hWnd = Tk_GetHWND(window); LastKnownRequestProcessed(display)++; SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } /* * Under Win32, cursors aren't associated with windows. Tk fakes this by * watching Motion events on its windows. So Tk will automatically change * the cursor when the pointer enters the Busy window. But Windows does |
︙ | ︙ |
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. |
︙ | ︙ | |||
255 256 257 258 259 260 261 | * transparent) .. 1.0 (opaque) */ /* * List of children of the toplevel which have private colormaps. */ TkWindow **cmapList; /* Array of window with private colormaps. */ | | | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | * transparent) .. 1.0 (opaque) */ /* * List of children of the toplevel which have private colormaps. */ TkWindow **cmapList; /* Array of window with private colormaps. */ Tcl_Size cmapCount; /* Number of windows in array. */ /* * Miscellaneous information. */ ProtocolHandler *protPtr; /* First in list of protocol handlers for this * window (NULL means none). */ Tcl_Size cmdArgc; /* Number of elements in cmdArgv below. */ const char **cmdArgv; /* Array of strings to store in the WM_COMMAND * property. NULL means nothing available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE * property, or NULL. */ int flags; /* Miscellaneous flags, defined below. */ int numTransients; /* Number of transients on this window */ WinIconPtr iconPtr; /* Pointer to titlebar icon structure for this |
︙ | ︙ | |||
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 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 | 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); static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbadgeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmOverrideredirectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); /* *---------------------------------------------------------------------- * * MakeIconOrCursorFromResource -- * * Construct an actual HICON structure from the information in a |
︙ | ︙ | |||
867 868 869 870 871 872 873 | if (!initialized) { Tcl_MutexLock(&winWmMutex); if (!initialized) { WNDCLASSW windowClass; initialized = 1; | | | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | if (!initialized) { Tcl_MutexLock(&winWmMutex); if (!initialized) { WNDCLASSW windowClass; initialized = 1; memset(&windowClass, 0, sizeof(WNDCLASSW)); windowClass.style = CS_HREDRAW | CS_VREDRAW; windowClass.hInstance = Tk_GetHINSTANCE(); windowClass.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME; windowClass.lpfnWndProc = WmProc; if (titlebaricon == NULL) { windowClass.hIcon = LoadIconW(Tk_GetHINSTANCE(), L"tk"); |
︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 | * icon. Otherwise our icon choice will be ignored moments later when * Tk finishes initialising. */ if (!initialized) { if (InitWindowClass(titlebaricon) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | * icon. Otherwise our icon choice will be ignored moments later when * Tk finishes initialising. */ if (!initialized) { if (InitWindowClass(titlebaricon) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Unable to set icon", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "FAILED", NULL); return TCL_ERROR; } } else { ThreadSpecificData *tsdPtr; /* |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | */ UpdateWrapper(wmPtr->winPtr); wmPtr = ((TkWindow *) tkw)->wmInfoPtr; hwnd = wmPtr->wrapper; if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | */ UpdateWrapper(wmPtr->winPtr); wmPtr = ((TkWindow *) tkw)->wmInfoPtr; hwnd = wmPtr->wrapper; if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Can't set icon; window has no wrapper.", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "WRAPPER", NULL); return TCL_ERROR; } } SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) GetIcon(titlebaricon, ICON_SMALL)); SendMessageW(hwnd, WM_SETICON, ICON_BIG, |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | const char *file; file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds); if (file == NULL) { return NULL; } Tcl_DStringInit(&ds2); | | | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | const char *file; file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds); if (file == NULL) { return NULL; } Tcl_DStringInit(&ds2); res = (DWORD *)SHGetFileInfoW(Tcl_UtfToWCharDString(file, TCL_INDEX_NONE, &ds2), 0, &sfiSM, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON); Tcl_DStringFree(&ds); if (res != 0) { SHFILEINFOW sfi; unsigned size; |
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | if (res != 0) { DestroyIcon(sfi.hIcon); } DestroyIcon(sfiSM.hIcon); Tcl_DStringFree(&ds2); return NULL; } | | | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | if (res != 0) { DestroyIcon(sfi.hIcon); } DestroyIcon(sfiSM.hIcon); Tcl_DStringFree(&ds2); return NULL; } memset(lpIR, 0, size); lpIR->nNumImages = ((res != 0) ? 2 : 1); lpIR->IconImages[0].Width = 16; lpIR->IconImages[0].Height = 16; lpIR->IconImages[0].Colors = 4; lpIR->IconImages[0].hIcon = sfiSM.hIcon; |
︙ | ︙ | |||
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. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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. |
︙ | ︙ | |||
1597 1598 1599 1600 1601 1602 1603 | /* * Read in the header */ lpIR->nNumImages = ReadICOHeader(channel); if (lpIR->nNumImages == -1) { | | | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | /* * Read in the header */ lpIR->nNumImages = ReadICOHeader(channel); if (lpIR->nNumImages == -1) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Invalid file header", TCL_INDEX_NONE)); Tcl_Close(NULL, channel); ckfree(lpIR); return NULL; } /* * Adjust the size of the struct to account for the images. |
︙ | ︙ | |||
1667 1668 1669 1670 1671 1672 1673 | } /* * Read it in. */ dwBytesRead = Tcl_Read(channel, (char *)lpIR->IconImages[i].lpBits, | | | | 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 | } /* * Read it in. */ dwBytesRead = Tcl_Read(channel, (char *)lpIR->IconImages[i].lpBits, lpIDE[i].dwBytesInRes); if (dwBytesRead != lpIDE[i].dwBytesInRes) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading file: %s", Tcl_PosixError(interp))); goto readError; } /* * Set the internal pointers appropriately. */ if (!AdjustIconImagePointers(&lpIR->IconImages[i])) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Error converting to internal format", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "FORMAT", NULL); goto readError; } lpIR->IconImages[i].hIcon = MakeIconOrCursorFromResource(&lpIR->IconImages[i], isIcon); } |
︙ | ︙ | |||
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 -- | > > > > > > | 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | 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 -- |
︙ | ︙ | |||
1907 1908 1909 1910 1911 1912 1913 | { WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL */ | | | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | { WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL */ memset(wmPtr, 0, sizeof(WmInfo)); winPtr->wmInfoPtr = wmPtr; wmPtr->winPtr = winPtr; wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; wmPtr->hints.icon_pixmap = None; wmPtr->hints.icon_window = None; |
︙ | ︙ | |||
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) { /* | > | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 | 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) { /* |
︙ | ︙ | |||
2119 2120 2121 2122 2123 2124 2125 | * Create the containing window, and set the user data to point to the * TkWindow. */ tsdPtr->createWindow = winPtr; Tcl_DStringInit(&titleString); Tcl_UtfToWCharDString(((wmPtr->title != NULL) ? | | | 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 | * Create the containing window, and set the user data to point to the * TkWindow. */ tsdPtr->createWindow = winPtr; Tcl_DStringInit(&titleString); Tcl_UtfToWCharDString(((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), TCL_INDEX_NONE, &titleString); wmPtr->wrapper = CreateWindowExW(wmPtr->exStyle, TK_WIN_TOPLEVEL_CLASS_NAME, (LPCWSTR) Tcl_DStringValue(&titleString), wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); |
︙ | ︙ | |||
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 -- * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | 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( | | < < | 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 | * 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( | | | | | | | | | | | 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 | * 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", "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_TRANSIENT, WMOPT_WITHDRAW }; int index; Tcl_Size 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; } if (objc == 2) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( dispPtr->flags & TK_DISPLAY_WM_TRACING)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) { return TCL_ERROR; } if (wmTracing) { 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; } |
︙ | ︙ | |||
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: | > > | 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 | 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: |
︙ | ︙ | |||
2942 2943 2944 2945 2946 2947 2948 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmAspectCmd( | | | < | 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 | * 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. */ Tcl_Size 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) { |
︙ | ︙ | |||
2980 2981 2982 2983 2984 2985 2986 | || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 | || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) { return TCL_ERROR; } if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "aspect number can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "ASPECT", NULL); return TCL_ERROR; } wmPtr->minAspect.x = numer1; wmPtr->minAspect.y = denom1; wmPtr->maxAspect.x = numer2; wmPtr->maxAspect.y = denom2; |
︙ | ︙ | |||
3016 3017 3018 3019 3020 3021 3022 | */ static int WmAttributesCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | | | | | | | | | | < < < | 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 | */ static int WmAttributesCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; int boolValue; Tcl_Size i, length; int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; if ((objc < 3) || ((objc > 5) && ((objc%2) == 0))) { configArgs: Tcl_WrongNumArgs(interp, 2, objv, "window" " ?-alpha ?double??" " ?-transparentcolor ?color??" " ?-disabled ?bool??" " ?-fullscreen ?bool??" " ?-toolwindow ?bool??" " ?-topmost ?bool??"); return TCL_ERROR; } exStyle = wmPtr->exStyleConfig; style = wmPtr->styleConfig; if (objc == 3) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-alpha", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewDoubleObj(wmPtr->alpha)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-transparentcolor", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, wmPtr->crefObj ? wmPtr->crefObj : Tcl_NewObj()); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-disabled", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewBooleanObj(style & WS_DISABLED)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-fullscreen", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-toolwindow", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewBooleanObj(exStyle & WS_EX_TOOLWINDOW)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-topmost", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewBooleanObj(exStyle & WS_EX_TOPMOST)); 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)); | > > > > > > | 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 | 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 */ | | | 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 | 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; } |
︙ | ︙ | |||
3195 3196 3197 3198 3199 3200 3201 | wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5), (unsigned) (LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0))); } } } else { if ((i < objc-1) | | | | | | 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 | wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5), (unsigned) (LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0))); } } } else { if ((i < objc-1) && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolValue) != TCL_OK) { return TCL_ERROR; } if (config_fullscreen) { if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (wmPtr->flags & WM_FULLSCREEN) != 0)); } else { fullscreen_attr_changed = 1; fullscreen_attr = boolValue; } config_fullscreen = 0; } else if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(*stylePtr & styleBit)); } else if (boolValue) { *stylePtr |= styleBit; } else { *stylePtr &= ~styleBit; } } if ((styleBit == WS_EX_TOPMOST) && (wmPtr->wrapper != NULL)) { /* |
︙ | ︙ | |||
3309 3310 3311 3312 3313 3314 3315 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmClientCmd( | | | | < | | | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size 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, TCL_INDEX_NONE)); } 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")); |
︙ | ︙ | |||
3355 3356 3357 3358 3359 3360 3361 | if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; if (XStringListToTextProperty(&wmPtr->clientMachine, 1, &textProp) != 0) { XSetWMClientMachine(winPtr->display, winPtr->window, &textProp); | | | 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 | if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; if (XStringListToTextProperty(&wmPtr->clientMachine, 1, &textProp) != 0) { XSetWMClientMachine(winPtr->display, winPtr->window, &textProp); XFree(textProp.value); } } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3383 3384 3385 3386 3387 3388 3389 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | > | | 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 | */ static int WmColormapwindowsCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2; Tcl_Size i, windowObjc; int gotToplevel; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
3474 3475 3476 3477 3478 3479 3480 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmCommandCmd( | | | | < | | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size 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) { char *merged = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); Tcl_SetObjResult(interp, Tcl_NewStringObj(merged, TCL_INDEX_NONE)); ckfree(merged); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (argv3[0] == 0) { if (wmPtr->cmdArgv != NULL) { |
︙ | ︙ | |||
3544 3545 3546 3547 3548 3549 3550 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmDeiconifyCmd( | | | < | 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 | * 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. */ Tcl_Size 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( | | | < | | | | 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 | * 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. */ Tcl_Size 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", TCL_INDEX_NONE)); 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( | | | | | < < < < | | | | | 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 | * 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(Tcl_Size), /* 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( | | | < | | | 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 | * 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. */ Tcl_Size 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); } hwnd = wmPtr->wrapper; if (hwnd == NULL) { hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr)); } snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)hwnd); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmGeometryCmd -- |
︙ | ︙ | |||
3752 3753 3754 3755 3756 3757 3758 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmGeometryCmd( | | | < | 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 | * 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. */ Tcl_Size 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( | | | < | 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 | * 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. */ Tcl_Size 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) { |
︙ | ︙ | |||
3854 3855 3856 3857 3858 3859 3860 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ | | | | | | | 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 | } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as * ungridded numbers. */ wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; wmPtr->heightInc = 1; } else { if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[6], &heightInc) != TCL_OK)) { return TCL_ERROR; } if (reqWidth < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "baseWidth can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (reqHeight < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "baseHeight can't be < 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (widthInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "widthInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } if (heightInc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "heightInc can't be <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL); return TCL_ERROR; } Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc, heightInc); } WmUpdateGeom(wmPtr, winPtr); |
︙ | ︙ | |||
3923 3924 3925 3926 3927 3928 3929 | */ static int WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | | | | 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 WmGroupCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; const char *argv3; Tcl_Size length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE)); } 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( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | 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 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 | } 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. */ Tcl_Size 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", TCL_INDEX_NONE)); 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", TCL_INDEX_NONE)); 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. */ Tcl_Size 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( | | | < | 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 | * 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. */ Tcl_Size 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)) { |
︙ | ︙ | |||
4190 4191 4192 4193 4194 4195 4196 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 | */ static int WmIconmaskCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
4245 4246 4247 4248 4249 4250 4251 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmIconnameCmd( | | | | < | | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size 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( | | | > | < < < < < | 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 | * 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. */ Tcl_Size 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; Tcl_Size i; int 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; } |
︙ | ︙ | |||
4357 4358 4359 4360 4361 4362 4363 | */ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | | > > > | | < | 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 | */ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } memset(lpIR, 0, 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. */ Tcl_Size 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) { |
︙ | ︙ | |||
4551 4552 4553 4554 4555 4556 4557 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 | */ static int WmIconwindowCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; |
︙ | ︙ | |||
4658 4659 4660 4661 4662 4663 4664 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmManageCmd( | | | | < < < | 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 | * 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(Tcl_Size), /* 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( | | | < | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMaxsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; GetMaxSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->maxWidth = width; wmPtr->maxHeight = height; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; } |
︙ | ︙ | |||
4767 4768 4769 4770 4771 4772 4773 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( | | | < | | | 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 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmMinsizeCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size 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]; GetMinSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK) || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } wmPtr->minWidth = width; wmPtr->minHeight = height; WmUpdateGeom(wmPtr, winPtr); return TCL_OK; } |
︙ | ︙ | |||
4819 4820 4821 4822 4823 4824 4825 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmOverrideredirectCmd( | | | | < | | | | | | | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; Bool boolValue, 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; if (curValue < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Container does not support overrideredirect", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } } else { curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } if (curValue != boolValue) { if (winPtr->flags & TK_EMBEDDED) { SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolValue, 0); } else { /* * Only do this if we are really changing value, because it causes * some funky stuff to occur. */ atts.override_redirect = boolValue; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); if (!(wmPtr->flags & (WM_NEVER_MAPPED)) && !(winPtr->flags & TK_EMBEDDED)) { UpdateWrapper(winPtr); } } |
︙ | ︙ | |||
4892 4893 4894 4895 4896 4897 4898 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmPositionfromCmd( | | | < | | | | 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 | * 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. */ Tcl_Size 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, TCL_INDEX_NONE)); 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( | | | | < | | | 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 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; Tcl_Size cmdLength; Tcl_Obj *resultObj; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } if (objc == 3) { /* * Return a list of all defined protocols for the window. */ resultObj = Tcl_NewObj(); for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( Tk_GetAtomName((Tk_Window)winPtr, protPtr->protocol), TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); return TCL_OK; } protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3])); if (objc == 4) { /* * Return the command to handle a given protocol. */ for (protPtr = wmPtr->protPtr; protPtr != NULL; protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { Tcl_SetObjResult(interp, Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE)); return TCL_OK; } } return TCL_OK; } /* |
︙ | ︙ | |||
5027 5028 5029 5030 5031 5032 5033 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | | 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 | } 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( | | | < | | | 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 | * 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. */ Tcl_Size 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]; 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; } |
︙ | ︙ | |||
5121 5122 5123 5124 5125 5126 5127 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmSizefromCmd( | | | < | | | | 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 | * 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. */ Tcl_Size 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, TCL_INDEX_NONE)); 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; |
︙ | ︙ | |||
5194 5195 5196 5197 5198 5199 5200 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 | */ static int WmStackorderCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkWindow **windows, **windowPtr; static const char *const optionStrings[] = { "isabove", "isbelow", NULL }; enum options { |
︙ | ︙ | |||
5265 5266 5267 5268 5269 5270 5271 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | 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 | * Lookup stacking order of all toplevels that are children of "." and * find the position of winPtr and winPtr2 in the stacking order. */ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr); if (windows == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "TkWmStackorderToplevel failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } for (windowPtr = windows; *windowPtr ; windowPtr++) { if (*windowPtr == winPtr) { index1 = (windowPtr - windows); } if (*windowPtr == winPtr2) { index2 = (windowPtr - windows); } } if (index1 == -1) { 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( | | | | | < | | | 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 | * 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. */ Tcl_Size 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) { |
︙ | ︙ | |||
5436 5437 5438 5439 5440 5441 5442 | switch (state) { case NormalState: stateStr = "normal"; break; case IconicState: stateStr = "iconic"; break; case WithdrawnState: stateStr = "withdrawn"; break; case ZoomState: stateStr = "zoomed"; break; } } | | | 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 | switch (state) { case NormalState: stateStr = "normal"; break; case IconicState: stateStr = "iconic"; break; case WithdrawnState: stateStr = "withdrawn"; break; case ZoomState: stateStr = "zoomed"; break; } } Tcl_SetObjResult(interp, Tcl_NewStringObj(stateStr, TCL_INDEX_NONE)); } return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5460 5461 5462 5463 5464 5465 5466 | * See the user documentation. * *---------------------------------------------------------------------- */ static int WmTitleCmd( | | | | < | 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 | * 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. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; Tcl_Size length; HWND wrapper; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { |
︙ | ︙ | |||
5497 5498 5499 5500 5501 5502 5503 | Tcl_WCharToUtfDString(buf, wcslen(buf), &titleString); Tcl_SetObjResult(interp, Tcl_NewStringObj( Tcl_DStringValue(&titleString), Tcl_DStringLength(&titleString))); Tcl_DStringFree(&titleString); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( | | | | | 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 | Tcl_WCharToUtfDString(buf, wcslen(buf), &titleString); Tcl_SetObjResult(interp, Tcl_NewStringObj( Tcl_DStringValue(&titleString), Tcl_DStringLength(&titleString))); Tcl_DStringFree(&titleString); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->title ? wmPtr->title : winPtr->nameUid), TCL_INDEX_NONE)); } } 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, TCL_INDEX_NONE, &titleString); SetWindowTextW(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString)); Tcl_DStringFree(&titleString); } } return TCL_OK; } |
︙ | ︙ | |||
5541 5542 5543 5544 5545 5546 5547 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ | | | 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 | */ static int WmTransientCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *containerPtr = wmPtr->containerPtr, **containerPtrPtr = &containerPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { |
︙ | ︙ | |||
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; | | | 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 | 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( | | | < | 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 | * 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. */ Tcl_Size 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( | | | 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 | 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; |
︙ | ︙ | |||
5818 5819 5820 5821 5822 5823 5824 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) | | < | 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 | return; } if ((wmPtr->reqGridWidth == reqWidth) && (wmPtr->reqGridHeight == reqHeight) && (wmPtr->widthInc == widthInc) && (wmPtr->heightInc == heightInc) && ((wmPtr->sizeHintsFlags & PBaseSize) == PBaseSize)) { return; } /* * If gridding was previously off, then forget about any window size * requests made by the user or via "wm geometry": these are in pixel * units and there's no easy way to translate them to grid units since the |
︙ | ︙ | |||
5850 5851 5852 5853 5854 5855 5856 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; | | | 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 | */ wmPtr->gridWin = tkwin; wmPtr->reqGridWidth = reqWidth; wmPtr->reqGridHeight = reqHeight; wmPtr->widthInc = widthInc; wmPtr->heightInc = heightInc; wmPtr->sizeHintsFlags |= PBaseSize; if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; } } /* |
︙ | ︙ | |||
5901 5902 5903 5904 5905 5906 5907 | } if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; | | | 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 | } if (tkwin != wmPtr->gridWin) { return; } wmPtr->gridWin = NULL; wmPtr->sizeHintsFlags &= ~PBaseSize; if (wmPtr->width != -1) { wmPtr->width = winPtr->reqWidth + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc; wmPtr->height = winPtr->reqHeight + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc; } wmPtr->widthInc = 1; |
︙ | ︙ | |||
5937 5938 5939 5940 5941 5942 5943 | * the structural change. * *---------------------------------------------------------------------- */ static void TopLevelEventProc( | | | 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 | * 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( | | < | 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 | * 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( | | | 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 | * 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( | | < < | 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 | * 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); } /* |
︙ | ︙ | |||
6649 6650 6651 6652 6653 6654 6655 | */ const char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol); Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); | | | 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 | */ const char *name = Tk_GetAtomName((Tk_Window) winPtr, protocol); Tcl_Preserve(protPtr); interp = protPtr->interp; Tcl_Preserve(interp); result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", name)); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); |
︙ | ︙ | |||
7362 7363 7364 7365 7366 7367 7368 | XEvent event; /* * Generate a ConfigureNotify event. */ event.type = ConfigureNotify; | | | 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 | XEvent event; /* * Generate a ConfigureNotify event. */ event.type = ConfigureNotify; event.xconfigure.serial = LastKnownRequestProcessed(winPtr->display); event.xconfigure.send_event = False; event.xconfigure.display = winPtr->display; event.xconfigure.event = winPtr->window; event.xconfigure.window = winPtr->window; event.xconfigure.border_width = winPtr->changes.border_width; event.xconfigure.override_redirect = winPtr->atts.override_redirect; event.xconfigure.x = winPtr->changes.x; |
︙ | ︙ | |||
7402 7403 7404 7405 7406 7407 7408 | InstallColormaps( HWND hwnd, /* Toplevel wrapper window whose colormaps * should be installed. */ int message, /* Either WM_PALETTECHANGED or * WM_QUERYNEWPALETTE */ int isForemost) /* 1 if window is foremost, else 0 */ { | | | 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 | InstallColormaps( HWND hwnd, /* Toplevel wrapper window whose colormaps * should be installed. */ int message, /* Either WM_PALETTECHANGED or * WM_QUERYNEWPALETTE */ int isForemost) /* 1 if window is foremost, else 0 */ { Tcl_Size i; HDC dc; HPALETTE oldPalette; TkWindow *winPtr = GetTopLevel(hwnd); WmInfo *wmPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
7511 7512 7513 7514 7515 7516 7517 | static void RefreshColormap( Colormap colormap, TkDisplay *dispPtr) { WmInfo *wmPtr; | | | 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 | static void RefreshColormap( Colormap colormap, TkDisplay *dispPtr) { WmInfo *wmPtr; Tcl_Size i; for (wmPtr = dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) { if (wmPtr->cmapCount > 0) { for (i = 0; i < wmPtr->cmapCount; i++) { if ((wmPtr->cmapList[i]->atts.colormap == colormap) && Tk_IsMapped(wmPtr->cmapList[i])) { InvalidateSubTree(wmPtr->cmapList[i], colormap); |
︙ | ︙ | |||
7938 7939 7940 7941 7942 7943 7944 | /* * Display and/or color resolution changed. */ winPtr = GetTopLevel(hwnd); if (winPtr) { Screen *screen = Tk_Screen(winPtr); | | | | | | | 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 | /* * Display and/or color resolution changed. */ winPtr = GetTopLevel(hwnd); if (winPtr) { Screen *screen = Tk_Screen(winPtr); if (DefaultDepthOfScreen(screen) != (int) wParam) { /* * Color resolution changed, so do extensive rebuild of * display parameters. This will affect the display for all Tk * windows. We will receive this event for each toplevel, but * this check makes us update only once, for the first * toplevel that receives the message. */ TkWinDisplayChanged(Tk_Display(winPtr)); } else { HDC dc = GetDC(NULL); WidthOfScreen(screen) = LOWORD(lParam); /* horizontal res */ HeightOfScreen(screen) = HIWORD(lParam); /* vertical res */ WidthMMOfScreen(screen) = MulDiv(WidthOfScreen(screen), 254, GetDeviceCaps(dc, LOGPIXELSX) * 10); HeightMMOfScreen(screen) = MulDiv(HeightOfScreen(screen), 254, GetDeviceCaps(dc, LOGPIXELSY) * 10); ReleaseDC(NULL, dc); } if (Tk_Depth(winPtr) != (int) wParam) { /* * Defer the window depth check to here so that each toplevel * will properly update depth info. |
︙ | ︙ | |||
8006 8007 8008 8009 8010 8011 8012 | result = 0; goto done; case WM_NCHITTEST: { winPtr = GetTopLevel(hwnd); if (winPtr && (TkGrabState(winPtr) == TK_GRAB_EXCLUDED)) { /* | | | 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 | 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 | | | 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 | 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 -- * | | | 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 | } /* *---------------------------------------------------------------------- * * 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 -- * | | | 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 | } /* *---------------------------------------------------------------------- * * 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 -- * | | | 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 | } /* *---------------------------------------------------------------------- * * 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 -- * | | | 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 | } /* *---------------------------------------------------------------------- * * 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: |
︙ | ︙ | |||
8621 8622 8623 8624 8625 8626 8627 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelDetachWindow -- * | | | 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 | } /* *---------------------------------------------------------------------- * * TkpWinToplevelDetachWindow -- * * This function is to be used for changing a toplevel's wrapper or * container. * * Results: * The window's wrapper/container is removed. * * Side effects: * None. |
︙ | ︙ |
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 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 | /* * 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. */ #define XLIB_ILLEGAL_ACCESS #include "tkWinInt.h" #include <commctrl.h> #ifdef _MSC_VER # pragma comment (lib, "comctl32.lib") # pragma comment (lib, "advapi32.lib") #endif /* * The zmouse.h file includes the definition for WM_MOUSEWHEEL. */ #include <zmouse.h> /* * WM_MOUSEHWHEEL is normally defined by Winuser.h for Vista/2008 or later, * but is also usable on 2000/XP if IntelliPoint drivers are installed. */ #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif /* A WM_MOUSEWHEEL message sent by a trackpad contains the number of pixels as * the delta value, while low precision scrollwheels always send an integer * multiple of WHEELDELTA (= 120) as the delta value. */ #define WHEELDELTA 120 /* * Our heuristic for deciding whether a WM_MOUSEWHEEL message * comes from a high resolution scrolling device is that we * assume it is high resolution unless there are two consecutive * delta values that are both multiples of 120. This is static, * rather than thread-specific, since input devices are shared * by all threads. */ static int lastMod = 0; /* * The serial field of TouchpadScroll events is a counter for * events of this type only. */ static unsigned long scrollCounter = 0; /* * imm.h is needed by HandleIMEComposition */ #include <imm.h> #ifdef _MSC_VER |
︙ | ︙ | |||
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. */ | < < < < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | */ 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. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations of functions used in this file. */ |
︙ | ︙ | |||
116 117 118 119 120 121 122 | *---------------------------------------------------------------------- */ void TkGetServerInfo( Tcl_Interp *interp, /* The server information is returned in this * interpreter's result. */ | | < < < < < < | < | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | *---------------------------------------------------------------------- */ void TkGetServerInfo( Tcl_Interp *interp, /* The server information is returned in this * interpreter's result. */ TCL_UNUSED(Tk_Window)) /* Token for window; this selects a particular * display and server. */ { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; if (!buffer[0]) { GetVersionExW(&os); /* Write the first character last, preventing multi-thread issues. */ snprintf(buffer+1, sizeof(buffer)-1, "indows %d.%d %d %s", (int)os.dwMajorVersion, (int)os.dwMinorVersion, (int)os.dwBuildNumber, #ifdef _WIN64 "Win64" #else "Win32" #endif ); |
︙ | ︙ | |||
285 286 287 288 289 290 291 | * Removes window classes from the system. * *---------------------------------------------------------------------- */ void TkWinXCleanup( | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | * Removes window classes from the system. * *---------------------------------------------------------------------- */ void TkWinXCleanup( void *clientData) { HINSTANCE hInstance = (HINSTANCE)clientData; /* * Clean up our own class. */ |
︙ | ︙ | |||
393 394 395 396 397 398 399 | * None. * *---------------------------------------------------------------------- */ const char * TkGetDefaultScreenName( | | < < | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | * None. * *---------------------------------------------------------------------- */ const char * TkGetDefaultScreenName( TCL_UNUSED(Tcl_Interp *), const char *screenName) /* If NULL, use default string. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = winScreenName; } return screenName; } /* |
︙ | ︙ | |||
428 429 430 431 432 433 434 | void TkWinDisplayChanged( Display *display) { HDC dc; Screen *screen; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | void TkWinDisplayChanged( Display *display) { HDC dc; Screen *screen; if (display == NULL || (((_XPrivDisplay)(display))->screens) == NULL) { return; } screen = (((_XPrivDisplay)(display))->screens); dc = GetDC(NULL); WidthOfScreen(screen) = GetDeviceCaps(dc, HORZRES); HeightOfScreen(screen) = GetDeviceCaps(dc, VERTRES); WidthMMOfScreen(screen) = MulDiv(WidthOfScreen(screen), 254, GetDeviceCaps(dc, LOGPIXELSX) * 10); HeightMMOfScreen(screen) = MulDiv(HeightOfScreen(screen), 254, GetDeviceCaps(dc, LOGPIXELSY) * 10); /* * On windows, when creating a color bitmap, need two pieces of * information: the number of color planes and the number of pixels per * plane. Need to remember both quantities so that when constructing an * HBITMAP for offscreen rendering, we can specify the correct value for * the number of planes. Otherwise the HBITMAP won't be compatible with * the HWND and we'll just get blank spots copied onto the screen. */ screen->ext_data = (XExtData *)INT2PTR(GetDeviceCaps(dc, PLANES)); screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data); if (screen->root_visual != NULL) { ckfree(screen->root_visual); } screen->root_visual = (Visual *)ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { DefaultVisualOfScreen(screen)->map_entries = GetDeviceCaps(dc, SIZEPALETTE); DefaultVisualOfScreen(screen)->c_class = PseudoColor; DefaultVisualOfScreen(screen)->red_mask = 0x0; DefaultVisualOfScreen(screen)->green_mask = 0x0; DefaultVisualOfScreen(screen)->blue_mask = 0x0; } else if (DefaultDepthOfScreen(screen) == 4) { DefaultVisualOfScreen(screen)->c_class = StaticColor; DefaultVisualOfScreen(screen)->map_entries = 16; } else if (DefaultDepthOfScreen(screen) == 8) { DefaultVisualOfScreen(screen)->c_class = StaticColor; DefaultVisualOfScreen(screen)->map_entries = 256; } else if (DefaultDepthOfScreen(screen) == 12) { DefaultVisualOfScreen(screen)->c_class = TrueColor; DefaultVisualOfScreen(screen)->map_entries = 32; DefaultVisualOfScreen(screen)->red_mask = 0xf0; DefaultVisualOfScreen(screen)->green_mask = 0xf000; DefaultVisualOfScreen(screen)->blue_mask = 0xf00000; } else if (DefaultDepthOfScreen(screen) == 16) { DefaultVisualOfScreen(screen)->c_class = TrueColor; DefaultVisualOfScreen(screen)->map_entries = 64; DefaultVisualOfScreen(screen)->red_mask = 0xf8; DefaultVisualOfScreen(screen)->green_mask = 0xfc00; DefaultVisualOfScreen(screen)->blue_mask = 0xf80000; } else if (DefaultDepthOfScreen(screen) >= 24) { DefaultVisualOfScreen(screen)->c_class = TrueColor; DefaultVisualOfScreen(screen)->map_entries = 256; DefaultVisualOfScreen(screen)->red_mask = 0xff; DefaultVisualOfScreen(screen)->green_mask = 0xff00; DefaultVisualOfScreen(screen)->blue_mask = 0xff0000; } DefaultVisualOfScreen(screen)->bits_per_rgb = DefaultDepthOfScreen(screen); ReleaseDC(NULL, dc); if (DefaultColormapOfScreen(screen) != None) { XFreeColormap(display, DefaultColormapOfScreen(screen)); } DefaultColormapOfScreen(screen) = XCreateColormap(display, None, DefaultVisualOfScreen(screen), AllocNone); } /* *---------------------------------------------------------------------- * * TkpOpenDisplay/XkbOpenDisplay -- |
︙ | ︙ | |||
523 524 525 526 527 528 529 | TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | < | | | < < < < < | 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 | TkDisplay * TkpOpenDisplay( const char *display_name) { Display *display; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->winDisplay != NULL) { if (!strcmp(DisplayString(tsdPtr->winDisplay->display), display_name)) { return tsdPtr->winDisplay; } else { return NULL; } } display = XkbOpenDisplay(display_name, NULL, NULL, NULL, NULL, NULL); TkWinDisplayChanged(display); tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay)); memset(tsdPtr->winDisplay, 0, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; /* * Key map info must be available immediately, because of "send event". */ TkpInitKeymapInfo(tsdPtr->winDisplay); /* |
︙ | ︙ | |||
568 569 570 571 572 573 574 | const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason) { | | | | | | | | < | | 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 | const char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason) { _XPrivDisplay display = (_XPrivDisplay)ckalloc(sizeof(Display)); Screen *screen = (Screen *)ckalloc(sizeof(Screen)); TkWinDrawable *twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); memset(screen, 0, sizeof(Screen)); memset(display, 0, sizeof(Display)); /* * Note that these pixel values are not palette relative. */ WhitePixelOfScreen(screen) = RGB(255, 255, 255); BlackPixelOfScreen(screen) = RGB(0, 0, 0); DefaultColormapOfScreen(screen) = None; display->screens = screen; display->nscreens = 1; display->default_screen = 0; twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = NULL; twdPtr->window.handle = NULL; screen->root = (Window)twdPtr; screen->display = (Display *)display; display->display_name = (char *)ckalloc(strlen(name) + 1); strcpy(display->display_name, name); display->nscreens = 1; display->request = 1; display->qlen = 0; if (ev_rtrn) *ev_rtrn = 0; if (err_rtrn) *err_rtrn = 0; if (major_rtrn) *major_rtrn = 0; if (minor_rtrn) *minor_rtrn = 0; if (reason) *reason = 0; return (Display *)display; } /* *---------------------------------------------------------------------- * * TkpCloseDisplay -- * |
︙ | ︙ | |||
631 632 633 634 635 636 637 | *---------------------------------------------------------------------- */ void TkpCloseDisplay( TkDisplay *dispPtr) { | | | | | | | | | | | 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 | *---------------------------------------------------------------------- */ void TkpCloseDisplay( TkDisplay *dispPtr) { _XPrivDisplay display = (_XPrivDisplay)dispPtr->display; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (dispPtr != tsdPtr->winDisplay) { Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on another display"); return; /* not reached */ } tsdPtr->winDisplay = NULL; if (display->display_name != NULL) { ckfree(display->display_name); } if (ScreenOfDisplay(display, 0) != NULL) { if (DefaultVisualOfScreen(ScreenOfDisplay(display, 0)) != NULL) { ckfree(DefaultVisualOfScreen(ScreenOfDisplay(display, 0))); } if (RootWindowOfScreen(ScreenOfDisplay(display, 0)) != None) { ckfree((void *)RootWindowOfScreen(ScreenOfDisplay(display, 0))); } if (DefaultColormapOfScreen(ScreenOfDisplay(display, 0)) != None) { XFreeColormap(display, DefaultColormapOfScreen(ScreenOfDisplay(display, 0))); } ckfree(ScreenOfDisplay(display, 0)); } ckfree(display); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
713 714 715 716 717 718 719 | * Plays a sounds out the system speakers. * *---------------------------------------------------------------------- */ int XBell( | | | < < < | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | * Plays a sounds out the system speakers. * *---------------------------------------------------------------------- */ int XBell( TCL_UNUSED(Display *), TCL_UNUSED(int)) { MessageBeep(MB_OK); return Success; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1004 1005 1006 1007 1008 1009 1010 | winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd); if (!winPtr || winPtr->window == None) { return; } memset(&event.x, 0, sizeof(XEvent)); | | | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd); if (!winPtr || winPtr->window == None) { return; } memset(&event.x, 0, sizeof(XEvent)); event.x.xany.serial = LastKnownRequestProcessed(winPtr->display)++; event.x.xany.send_event = False; event.x.xany.display = winPtr->display; event.x.xany.window = winPtr->window; switch (message) { case WM_PAINT: { PAINTSTRUCT ps; |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { | < < < < < < < < < < < < < < < < | > > | | > > > > > > > > > > > | | | | < > > < < < < < < < < < < < < < < < < > > > | < > | | > > > > > > > > > > > | | | | | < > > | 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 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { /* * Send an Xevent using a KeyPress struct, but with the type field * set to MouseWheelEvent for low resolution scrolls and to * TouchpadScroll for high resolution scroll events. The Y delta * is stored in the low order 16 bits of the keycode field. Set * nbytes to 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ int delta = (short) HIWORD(wParam); int mod = delta % WHEELDELTA; if ( mod != 0 || lastMod != 0) { /* High resolution. */ event.x.type = TouchpadScroll; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.state = state; event.x.xany.serial = scrollCounter++; event.x.xkey.keycode = (unsigned int) delta; } else { event.x.type = MouseWheelEvent; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.keycode = (unsigned int) delta; } lastMod = mod; break; } case WM_MOUSEHWHEEL: { /* * Send an Xevent using a KeyPress struct, but with the type field * set to MouseWheelEvent for low resolution scrolls and to * TouchpadScroll for high resolution scroll events. For low * resolution scrolls the X delta is stored in the keycode field * and For high resolution scrolls the X delta is in the high word * of the keycode. Set nbytes to 0 to prevent conversion of the * keycode to a keysym in TkpGetString. [Bug 1118340]. */ int delta = (short) HIWORD(wParam); int mod = delta % WHEELDELTA; if ( mod != 0 || lastMod != 0) { /* High resolution. */ event.x.type = TouchpadScroll; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.state = state; event.x.xany.serial = scrollCounter++; event.x.xkey.keycode = (unsigned int)(-(delta << 16)); } else { event.x.type = MouseWheelEvent; event.x.xany.send_event = -1; event.key.nbytes = 0; event.x.xkey.state |= ShiftMask; event.x.xkey.keycode = delta; } lastMod = mod; 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; | | | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 | 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); |
︙ | ︙ | |||
1515 1516 1517 1518 1519 1520 1521 | return; } if (charsetInfo.ciACP == CP_UTF8) { strcpy(codepage, "utf-8"); } else { | | | 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 | return; } if (charsetInfo.ciACP == CP_UTF8) { strcpy(codepage, "utf-8"); } else { snprintf(codepage, sizeof(codepage), "cp%d", charsetInfo.ciACP); } if ((encoding = Tcl_GetEncoding(NULL, codepage)) == NULL) { /* * The encoding is not supported by Tcl. */ |
︙ | ︙ | |||
1659 1660 1661 1662 1663 1664 1665 | * Note that the event *must* be zeroed out first; Tk plays cunning * games with the overalls structure. [Bug 2992129] */ winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd); memset(&event, 0, sizeof(XEvent)); | | | 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | * Note that the event *must* be zeroed out first; Tk plays cunning * games with the overalls structure. [Bug 2992129] */ winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd); memset(&event, 0, sizeof(XEvent)); event.xkey.serial = LastKnownRequestProcessed(winPtr->display)++; event.xkey.send_event = -3; event.xkey.display = winPtr->display; event.xkey.window = winPtr->window; event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum); event.xkey.subwindow = None; event.xkey.state = TkWinGetModifierState(); event.xkey.time = TkpGetMS(); |
︙ | ︙ | |||
1949 1950 1951 1952 1953 1954 1955 | * None. * *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( | | < | 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 | * None. * *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( TCL_UNUSED(Display *)) { LASTINPUTINFO li; li.cbSize = sizeof(li); if (!GetLastInputInfo(&li)) { return -1; } /* |
︙ | ︙ | |||
1985 1986 1987 1988 1989 1990 1991 | * to zero. * *---------------------------------------------------------------------- */ void Tk_ResetUserInactiveTime( | | < | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 | * to zero. * *---------------------------------------------------------------------- */ void Tk_ResetUserInactiveTime( TCL_UNUSED(Display *)) { INPUT inp; inp.type = INPUT_MOUSE; inp.mi.dx = 0; inp.mi.dy = 0; inp.mi.mouseData = 0; inp.mi.dwFlags = MOUSEEVENTF_MOVE; inp.mi.time = 0; |
︙ | ︙ |
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); |
︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | /* * Windows-specific platform initialization: */ MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow); TtkWinTheme_Init(interp, hwnd); TtkXPTheme_Init(interp, hwnd); return TCL_OK; } | > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /* * Windows-specific platform initialization: */ MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp); MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow); TtkWinTheme_Init(interp, hwnd); TtkXPTheme_Init(interp, hwnd); return TCL_OK; } |
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" |
︙ | ︙ | |||
92 93 94 95 96 97 98 | * +++ FrameControlElement -- * General-purpose element for things drawn with DrawFrameControl */ typedef struct { const char *name; /* element name */ int classId; /* class id for DrawFrameControl */ int partId; /* part id for DrawFrameControl */ | | | > | | | | 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 | * +++ FrameControlElement -- * General-purpose element for things drawn with DrawFrameControl */ typedef struct { const char *name; /* element name */ int classId; /* class id for DrawFrameControl */ int partId; /* part id for DrawFrameControl */ unsigned cxId; /* system metric ids for width/height... */ unsigned cyId; /* ... or size if FIXEDSIZE bit set */ const Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */ Ttk_Padding margins; /* additional placement padding */ } FrameControlElementData; #define BASE_DIM 16 #define _FIXEDSIZE 0x80000000UL #define _HALFMETRIC 0x40000000UL #define FIXEDSIZE(id) (id|_FIXEDSIZE) #define HALFMETRIC(id) (id|_HALFMETRIC) #define GETMETRIC(m) \ ((m) & _FIXEDSIZE ? (int)((m) & ~_FIXEDSIZE) : GetSystemMetrics((m)&0xFFFFFFF)) static FrameControlElementData FrameControlElements[] = { { "Checkbutton.indicator", DFC_BUTTON, DFCS_BUTTONCHECK, FIXEDSIZE(BASE_DIM), FIXEDSIZE(BASE_DIM), checkbutton_statemap, {0,0,4,0} }, { "Radiobutton.indicator", DFC_BUTTON, DFCS_BUTTONRADIO, FIXEDSIZE(BASE_DIM), FIXEDSIZE(BASE_DIM), checkbutton_statemap, {0,0,4,0} }, { "uparrow", DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, SM_CYVSCROLL, arrow_statemap, {0,0,0,0} }, { "downarrow", DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, SM_CYVSCROLL, arrow_statemap, {0,0,0,0} }, |
︙ | ︙ | |||
140 141 142 143 144 145 146 | { 0,0,0,0,0,0, {0,0,0,0} } }; /* ---------------------------------------------------------------------- */ static void FrameControlElementSize( | | > > | > > | > | > > | > > > > > > > | > > | > > < | 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 | { 0,0,0,0,0,0, {0,0,0,0} } }; /* ---------------------------------------------------------------------- */ static void FrameControlElementSize( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { FrameControlElementData *p = (FrameControlElementData *)clientData; int cx = GETMETRIC(p->cxId); int cy = GETMETRIC(p->cyId); if ((p->cxId & _FIXEDSIZE) && cx == BASE_DIM) { double scalingLevel = TkScalingLevel(tkwin); cx *= scalingLevel; cy *= scalingLevel; /* * Update the corresponding element of the array FrameControlElements */ p->cxId = FIXEDSIZE(cx); p->cyId = FIXEDSIZE(cy); } if (p->cxId & _HALFMETRIC) cx /= 2; if (p->cyId & _HALFMETRIC) cy /= 2; *widthPtr = cx + Ttk_PaddingWidth(p->margins); *heightPtr = cy + Ttk_PaddingHeight(p->margins); } static void FrameControlElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FrameControlElementData *elementData = (FrameControlElementData *)clientData; RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins)); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFrameControl(hdc, &rc, elementData->classId, elementData->partId|Ttk_StateTableLookup(elementData->stateMap, state)); TkWinReleaseDrawableDC(d, hdc, &dcState); } |
︙ | ︙ | |||
194 195 196 197 198 199 200 | static const Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void BorderElementSize( | < < < | | | | | > | > | > | > > < < | 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 | static const Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void BorderElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void BorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { BorderElement *border = (BorderElement *)elementRecord; RECT rc = BoxToRect(b); int relief = TK_RELIEF_FLAT; TkWinDCState dcState; HDC hdc; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); if (relief != TK_RELIEF_FLAT) { UINT xFlags = (relief == TK_RELIEF_SOLID) ? BF_FLAT : 0; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, ReliefToEdge(relief), BF_RECT | xFlags); |
︙ | ︙ | |||
253 254 255 256 257 258 259 | static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( | < < < | | | | | > | > | > | > > < < | 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 | static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void FieldElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; Tk_Fill3DRectangle( tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT); TkWinReleaseDrawableDC(d, hdc, &dcState); |
︙ | ︙ | |||
316 317 318 319 320 321 322 | offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void ButtonBorderElementSize( | > | > > > | < < < < | 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 | offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void ButtonBorderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_RAISED; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; short int cx, cy; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); cx = GetSystemMetrics(SM_CXEDGE); cy = GetSystemMetrics(SM_CYEDGE); /* Space for default indicator: |
︙ | ︙ | |||
348 349 350 351 352 353 354 | cx += 2; cy += 2; *paddingPtr = Ttk_MakePadding(cx,cy,cx,cy); } static void ButtonBorderElementDraw( | > | > | > > < | 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 | cx += 2; cy += 2; *paddingPtr = Ttk_MakePadding(cx,cy,cx,cy); } static void ButtonBorderElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_FLAT; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; TkWinDCState dcState; HDC hdc; RECT rc; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { XColor *highlightColor = Tk_GetColorFromObj(tkwin, bd->highlightColorObj); |
︙ | ︙ | |||
403 404 405 406 407 408 409 | /*------------------------------------------------------------------------ * +++ Focus element. * Draw dashed focus rectangle. */ static void FocusElementSize( | < < < | | | | | > | > > | | < < | > | | 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 | /*------------------------------------------------------------------------ * +++ Focus element. * Draw dashed focus rectangle. */ static void FocusElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(1); } static void FocusElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFocusRect(hdc, &rc); TkWinReleaseDrawableDC(d, hdc, &dcState); } |
︙ | ︙ | |||
455 456 457 458 459 460 461 | { "-focusfill", TK_OPTION_COLOR, offsetof(FillFocusElement,fillColorObj), "white" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; /* @@@ FIX THIS */ static void FillFocusElementDraw( | > | > | > > < | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | { "-focusfill", TK_OPTION_COLOR, offsetof(FillFocusElement,fillColorObj), "white" }, {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; /* @@@ FIX THIS */ static void FillFocusElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FillFocusElement *focus = (FillFocusElement *)elementRecord; if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; XColor *fillColor = Tk_GetColorFromObj(tkwin, focus->fillColorObj); GC gc = Tk_GCForColor(fillColor, d); HDC hdc; |
︙ | ︙ | |||
481 482 483 484 485 486 487 | /* * ComboboxFocusElement -- * Read-only comboboxes have a filled focus ring, editable ones do not. */ static void ComboboxFocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, | | | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | /* * ComboboxFocusElement -- * Read-only comboboxes have a filled focus ring, editable ones do not. */ static void ComboboxFocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { if (state & TTK_STATE_READONLY) { FillFocusElementDraw(clientData, elementRecord, tkwin, d, b, state); } } static const Ttk_ElementSpec ComboboxFocusElementSpec = { |
︙ | ︙ | |||
531 532 533 534 535 536 537 | cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern); cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap); Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc); return cd; } static void TroughElementDraw( | | > > | > > < < | 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 | cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern); cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap); Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc); return cd; } static void TroughElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { TroughClientData *cd = (TroughClientData *)clientData; TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); HBRUSH hbr; COLORREF bk, oldbk, oldtxt; hbr = (HBRUSH)SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); bk = GetSysColor(COLOR_3DHIGHLIGHT); oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE)); oldbk = SetBkColor(hdc, bk); /* WAS: if (bk (COLOR_3DHIGHLIGHT) == GetSysColor(COLOR_WINDOW)) ... */ |
︙ | ︙ | |||
582 583 584 585 586 587 588 | static const Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( | > | > | > > < < < | > > | | > > < < | 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 | static const Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { ThumbElement *thumbPtr = (ThumbElement *)elementRecord; Ttk_Orient orient; Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = GetSystemMetrics(SM_CXHTHUMB); *heightPtr = GetSystemMetrics(SM_CYHSCROLL); } else { *widthPtr = GetSystemMetrics(SM_CXVSCROLL); *heightPtr = GetSystemMetrics(SM_CYVTHUMB); } } static void ThumbElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; /* Windows doesn't show a thumb when the scrollbar is disabled */ if (state & TTK_STATE_DISABLED) return; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); |
︙ | ︙ | |||
644 645 646 647 648 649 650 | static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( | > | > | > > < < < | > > | | > > < < < > > > > > > > > > > > > > | > | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > | > > > > > > > > > > > > | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > < < < | 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 | static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), int *widthPtr, int *heightPtr, TCL_UNUSED(Ttk_Padding *)) { SliderElement *slider = (SliderElement *)elementRecord; Ttk_Orient orient; Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1; *heightPtr = GetSystemMetrics(SM_CYHSCROLL); } else { *widthPtr = GetSystemMetrics(SM_CXVSCROLL); *heightPtr = (GetSystemMetrics(SM_CYVTHUMB) / 2) | 1; } } static void SliderElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); TkWinReleaseDrawableDC(d, hdc, &dcState); } static const Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, SliderElementSize, SliderElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. */ typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; } TabElement; static const Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, offsetof(TabElement,borderWidthObj), "1" }, { "-background", TK_OPTION_BORDER, offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND }, {0,TK_OPTION_BOOLEAN,0,0} }; static void TabElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { TabElement *tab = (TabElement *)elementRecord; int borderWidth = 1; Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; Tk_GetPixelsFromObj(0, tkwin, tab->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } switch (nbTabsStickBit) { default: case TTK_STICK_S: paddingPtr->bottom = 0; break; case TTK_STICK_N: paddingPtr->top = 0; break; case TTK_STICK_E: paddingPtr->right = 0; break; case TTK_STICK_W: paddingPtr->left = 0; break; } } static void TabElementDraw( TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; TabElement *tab = (TabElement *)elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj); XPoint pts[6]; double scalingLevel = TkScalingLevel(tkwin); int cut = round(2 * scalingLevel); Display *disp = Tk_Display(tkwin); int borderWidth = 1; if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } if (state & TTK_STATE_SELECTED) { /* * Draw slightly outside of the allocated parcel, * to overwrite the client area border. */ switch (nbTabsStickBit) { default: case TTK_STICK_S: b.height += 2; break; case TTK_STICK_N: b.height += 2; b.y -= 2; break; case TTK_STICK_E: b.width += 2; break; case TTK_STICK_W: b.width += 2; b.x -= 2; break; } } switch (nbTabsStickBit) { default: case TTK_STICK_S: pts[0].x = b.x; pts[0].y = b.y + b.height-1; pts[1].x = b.x; pts[1].y = b.y + cut; pts[2].x = b.x + cut; pts[2].y = b.y; pts[3].x = b.x + b.width-1 - cut; pts[3].y = b.y; pts[4].x = b.x + b.width-1; pts[4].y = b.y + cut; pts[5].x = b.x + b.width-1; pts[5].y = b.y + b.height; break; case TTK_STICK_N: pts[0].x = b.x; pts[0].y = b.y; pts[1].x = b.x; pts[1].y = b.y + b.height-1 - cut; pts[2].x = b.x + cut; pts[2].y = b.y + b.height-1; pts[3].x = b.x + b.width-1 - cut; pts[3].y = b.y + b.height-1; pts[4].x = b.x + b.width-1; pts[4].y = b.y + b.height-1 - cut; pts[5].x = b.x + b.width-1; pts[5].y = b.y-1; break; case TTK_STICK_E: pts[0].x = b.x + b.width-1; pts[0].y = b.y; pts[1].x = b.x + cut; pts[1].y = b.y; pts[2].x = b.x; pts[2].y = b.y + cut; pts[3].x = b.x; pts[3].y = b.y + b.height-1 - cut; pts[4].x = b.x + cut; pts[4].y = b.y + b.height-1; pts[5].x = b.x + b.width; pts[5].y = b.y + b.height-1; break; case TTK_STICK_W: pts[0].x = b.x; pts[0].y = b.y; pts[1].x = b.x + b.width-1 - cut; pts[1].y = b.y; pts[2].x = b.x + b.width-1; pts[2].y = b.y + cut; pts[3].x = b.x + b.width-1; pts[3].y = b.y + b.height-1 - cut; pts[4].x = b.x + b.width-1 - cut; pts[4].y = b.y + b.height-1; pts[5].x = b.x-1; pts[5].y = b.y + b.height-1; break; } XFillPolygon(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC), pts, 6, Convex, CoordModeOrigin); Tk_GetPixelsFromObj(NULL, tkwin, tab->borderWidthObj, &borderWidth); while (borderWidth--) { XDrawLines(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC), pts, 4, CoordModeOrigin); XDrawLines(disp, d, Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC), pts+3, 3, CoordModeOrigin); switch (nbTabsStickBit) { default: case TTK_STICK_S: ++pts[0].x; ++pts[1].x; ++pts[2].y; ++pts[3].y; --pts[4].x; --pts[5].x; break; case TTK_STICK_N: ++pts[0].x; ++pts[1].x; --pts[2].y; --pts[3].y; --pts[4].x; --pts[5].x; break; case TTK_STICK_E: ++pts[0].y; ++pts[1].y; ++pts[2].x; ++pts[3].x; --pts[4].y; --pts[5].y; break; case TTK_STICK_W: ++pts[0].y; ++pts[1].y; --pts[2].x; --pts[3].x; --pts[4].y; --pts[5].y; break; } } } static const Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(TabElement), TabElementOptions, TabElementSize, TabElementDraw }; static void ClientElementSize( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ TCL_UNUSED(Tk_Window), TCL_UNUSED(int *), /* widthPtr */ TCL_UNUSED(int *), /* heightPtr */ Ttk_Padding *paddingPtr) { paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void ClientElementDraw( TCL_UNUSED(void *), /* clientData */ TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, TCL_UNUSED(Ttk_State)) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT); TkWinReleaseDrawableDC(d, hdc, &dcState); } static const Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
750 751 752 753 754 755 756 | TTK_GROUP("Combobox.focus", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE /* ---------------------------------------------------------------------- */ | | > | > < > | 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 | TTK_GROUP("Combobox.focus", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE /* ---------------------------------------------------------------------- */ MODULE_SCOPE int TtkWinTheme_Init( Tcl_Interp *interp, TCL_UNUSED(HWND)) { Ttk_Theme themePtr, parentPtr; const FrameControlElementData *fce = FrameControlElements; parentPtr = Ttk_GetTheme(interp, "alt"); themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr); if (!themePtr) { return TCL_ERROR; } Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Button.border", &ButtonBorderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "focus", &FocusElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Combobox.focus", &ComboboxFocusElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "slider", &SliderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "Scrollbar.trough", &TroughElementSpec, TroughClientDataInit(interp)); Ttk_RegisterElementSpec(themePtr, "tab", &TabElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "client", &ClientElementSpec, NULL); for (fce = FrameControlElements; fce->name != 0; ++fce) { Ttk_RegisterElementSpec(themePtr, fce->name, &FrameControlElementSpec, (void *)fce); } Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::winnative", TTK_VERSION); return TCL_OK; } |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* * 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" #include <windows.h> #include <uxtheme.h> #include <vssym32.h> #include "ttk/ttkTheme.h" typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd, LPCWSTR pszClassList); typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme); typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); typedef HRESULT (STDAPICALLTYPE DrawThemeEdgeProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pDestRect, unsigned int uEdge, unsigned int uFlags, OPTIONAL RECT *pContentRect); typedef HRESULT (STDAPICALLTYPE GetThemePartSizeProc)(HTHEME,HDC, int iPartId, int iStateId, RECT *prc, enum THEMESIZE eSize, SIZE *psz); typedef int (STDAPICALLTYPE GetThemeSysSizeProc)(HTHEME,int); /* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */ typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, |
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | typedef struct { OpenThemeDataProc *OpenThemeData; CloseThemeDataProc *CloseThemeData; GetThemePartSizeProc *GetThemePartSize; GetThemeSysSizeProc *GetThemeSysSize; DrawThemeBackgroundProc *DrawThemeBackground; DrawThemeTextProc *DrawThemeText; GetThemeTextExtentProc *GetThemeTextExtent; IsThemeActiveProc *IsThemeActive; IsAppThemedProc *IsAppThemed; HWND stubWindow; } XPThemeProcs; | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | typedef struct { OpenThemeDataProc *OpenThemeData; CloseThemeDataProc *CloseThemeData; GetThemePartSizeProc *GetThemePartSize; GetThemeSysSizeProc *GetThemeSysSize; DrawThemeBackgroundProc *DrawThemeBackground; DrawThemeEdgeProc *DrawThemeEdge; DrawThemeTextProc *DrawThemeText; GetThemeTextExtentProc *GetThemeTextExtent; IsThemeActiveProc *IsThemeActive; IsAppThemedProc *IsAppThemed; HWND stubWindow; } XPThemeProcs; |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | (0 != (procs->name = (name ## Proc *)(void *)GetProcAddress(handle, #name) )) if ( LOADPROC(OpenThemeData) && LOADPROC(CloseThemeData) && LOADPROC(GetThemePartSize) && LOADPROC(GetThemeSysSize) && LOADPROC(DrawThemeBackground) && LOADPROC(GetThemeTextExtent) && LOADPROC(DrawThemeText) && LOADPROC(IsThemeActive) && LOADPROC(IsAppThemed) ) { return procs; | > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | (0 != (procs->name = (name ## Proc *)(void *)GetProcAddress(handle, #name) )) if ( LOADPROC(OpenThemeData) && LOADPROC(CloseThemeData) && LOADPROC(GetThemePartSize) && LOADPROC(GetThemeSysSize) && LOADPROC(DrawThemeBackground) && LOADPROC(DrawThemeEdge) && LOADPROC(GetThemeTextExtent) && LOADPROC(DrawThemeText) && LOADPROC(IsThemeActive) && LOADPROC(IsAppThemed) ) { return procs; |
︙ | ︙ | |||
136 137 138 139 140 141 142 | { XPThemeData *themeData = (XPThemeData *)clientData; FreeLibrary(themeData->hlibrary); ckfree(clientData); } static int | | > > < | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | { XPThemeData *themeData = (XPThemeData *)clientData; FreeLibrary(themeData->hlibrary); ckfree(clientData); } static int XPThemeEnabled( TCL_UNUSED(Ttk_Theme), void *clientData) { XPThemeData *themeData = (XPThemeData *)clientData; int active = themeData->procs->IsThemeActive(); int themed = themeData->procs->IsAppThemed(); return (active && themed); } /* * BoxToRect -- * Helper routine. Returns a RECT data structure. |
︙ | ︙ | |||
425 426 427 428 429 430 431 | * then the info member is dynamically allocated. Otherwise it was * static data from the C object and only the ElementData needs freeing. */ static void DestroyElementData(void *clientData) { ElementData *elementData = (ElementData *)clientData; if (elementData->info->flags & HEAP_ELEMENT) { | | | | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | * then the info member is dynamically allocated. Otherwise it was * static data from the C object and only the ElementData needs freeing. */ static void DestroyElementData(void *clientData) { ElementData *elementData = (ElementData *)clientData; if (elementData->info->flags & HEAP_ELEMENT) { ckfree((void *)elementData->info->statemap); ckfree((void *)elementData->info->className); ckfree((void *)elementData->info->elementName); ckfree((void *)elementData->info); } ckfree(clientData); } /* * InitElementData -- * Looks up theme handle. If Drawable argument is non-NULL, |
︙ | ︙ | |||
488 489 490 491 492 493 494 | * +++ Generic element implementation. * * Used for elements which are handled entirely by the XP Theme API, * such as radiobutton and checkbutton indicators, scrollbar arrows, etc. */ static void GenericElementSize( | | > > | > > < | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | * +++ Generic element implementation. * * Used for elements which are handled entirely by the XP Theme API, * such as radiobutton and checkbutton indicators, scrollbar arrows, etc. */ static void GenericElementSize( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ElementData *elementData = (ElementData *)clientData; HRESULT result; SIZE size; if (!InitElementData(elementData, tkwin, 0)) return; if (!(elementData->info->flags & IGNORE_THEMESIZE)) { result = elementData->procs->GetThemePartSize( elementData->hTheme, |
︙ | ︙ | |||
525 526 527 528 529 530 531 | if (elementData->info->flags & PAD_MARGINS) { *widthPtr += Ttk_PaddingWidth(elementData->info->padding); *heightPtr += Ttk_PaddingHeight(elementData->info->padding); } } static void GenericElementDraw( | | > > | > > < | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | if (elementData->info->flags & PAD_MARGINS) { *widthPtr += Ttk_PaddingWidth(elementData->info->padding); *heightPtr += Ttk_PaddingHeight(elementData->info->padding); } } static void GenericElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ElementData *elementData = (ElementData *)clientData; RECT rc; if (!InitElementData(elementData, tkwin, d)) { return; } if (elementData->info->flags & PAD_MARGINS) { b = Ttk_PadBox(b, elementData->info->padding); |
︙ | ︙ | |||
636 637 638 639 640 641 642 | /*---------------------------------------------------------------------- * +++ Scrollbar thumb element. * Same as a GenericElement, but don't draw in the disabled state. */ static void ThumbElementDraw( | | > > | > > < | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | /*---------------------------------------------------------------------- * +++ Scrollbar thumb element. * Same as a GenericElement, but don't draw in the disabled state. */ static void ThumbElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ElementData *elementData = (ElementData *)clientData; unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state); RECT rc = BoxToRect(b); /* * Don't draw the thumb if we are disabled. */ if (state & TTK_STATE_DISABLED) return; |
︙ | ︙ | |||
715 716 717 718 719 720 721 722 | * tab is exactly at the right edge of the notebook, but * not if it's simply the rightmost tab. This information * is not available. * * The TIS_* and TILES_* definitions are identical, so * we can use the same statemap no matter what the partId. */ static void TabElementDraw( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > > | | > > > > > | | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | * tab is exactly at the right edge of the notebook, but * not if it's simply the rightmost tab. This information * is not available. * * The TIS_* and TILES_* definitions are identical, so * we can use the same statemap no matter what the partId. */ static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } GenericElementSize(clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); *paddingPtr = Ttk_UniformPadding(3); switch (nbTabsStickBit) { default: case TTK_STICK_S: paddingPtr->bottom = 0; break; case TTK_STICK_N: paddingPtr->top = 0; break; case TTK_STICK_E: paddingPtr->right = 0; break; case TTK_STICK_W: paddingPtr->left = 0; break; } } static void TabElementDraw( void *clientData, TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { Ttk_PositionSpec nbTabsStickBit = TTK_STICK_S; TkMainInfo *mainInfoPtr = ((TkWindow *) tkwin)->mainPtr; ElementData *elementData = (ElementData *)clientData; int partId = elementData->info->partId; int isSelected = (state & TTK_STATE_SELECTED); int stateId = Ttk_StateTableLookup(elementData->info->statemap, state); if (mainInfoPtr != NULL) { nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit; } /* * Correct the members of b if needed */ switch (nbTabsStickBit) { default: case TTK_STICK_S: break; case TTK_STICK_N: b.y -= isSelected ? 0 : 1; b.height -= isSelected ? 1 : 0; break; case TTK_STICK_E: b.width -= isSelected ? 1 : 0; break; case TTK_STICK_W: b.x -= isSelected ? 1 : 2; b.width -= isSelected ? 1 : 0; break; } RECT rc = BoxToRect(b); if (!InitElementData(elementData, tkwin, d)) return; if (nbTabsStickBit == TTK_STICK_S) { if (state & TTK_STATE_USER1) { partId = TABP_TABITEMLEFTEDGE; } /* * Draw the border and fill into rc */ elementData->procs->DrawThemeBackground( elementData->hTheme, elementData->hDC, partId, stateId, &rc, NULL); } else { /* * Draw the fill but no border into rc */ RECT rc2 = rc; --rc2.top; --rc2.left; ++rc2.bottom; ++rc2.right; elementData->procs->DrawThemeBackground( elementData->hTheme, elementData->hDC, partId, stateId, &rc2, &rc); } /* * Draw a flat border at 3 edges */ switch (nbTabsStickBit) { default: case TTK_STICK_S: break; case TTK_STICK_N: elementData->procs->DrawThemeEdge( elementData->hTheme, elementData->hDC, partId, stateId, &rc, BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_RIGHT|BF_BOTTOM, NULL); break; case TTK_STICK_E: elementData->procs->DrawThemeEdge( elementData->hTheme, elementData->hDC, partId, stateId, &rc, BDR_RAISEDINNER, BF_FLAT|BF_LEFT|BF_TOP|BF_BOTTOM, NULL); break; case TTK_STICK_W: elementData->procs->DrawThemeEdge( elementData->hTheme, elementData->hDC, partId, stateId, &rc, BDR_RAISEDINNER, BF_FLAT|BF_TOP|BF_RIGHT|BF_BOTTOM, NULL); break; } FreeElementData(elementData); } static const Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TabElementSize, TabElementDraw }; /*---------------------------------------------------------------------- * +++ Tree indicator element. * * Generic element, but don't display at all if TTK_STATE_LEAF (=USER2) set |
︙ | ︙ | |||
775 776 777 778 779 780 781 | { { GLPS_OPENED, TTK_STATE_OPEN, 0 }, { GLPS_CLOSED, 0,0 }, }; static void TreeIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, | | | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | { { GLPS_OPENED, TTK_STATE_OPEN, 0 }, { GLPS_CLOSED, 0,0 }, }; static void TreeIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { if (!(state & TTK_STATE_LEAF)) { GenericElementDraw(clientData,elementRecord,tkwin,d,b,state); } } static const Ttk_ElementSpec TreeIndicatorElementSpec = |
︙ | ︙ | |||
828 829 830 831 832 833 834 | int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = {0, 0}; HRESULT hr = S_OK; const char *src; | | | | | | | | | | 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 | int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = {0, 0}; HRESULT hr = S_OK; const char *src; Tcl_Size 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; } if (*widthPtr < 80) *widthPtr = 80; if (*heightPtr < 20) *heightPtr = 20; Tcl_DStringFree(&ds); FreeElementData(elementData); } static void TextElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = BoxToRect(b); HRESULT hr = S_OK; const char *src; Tcl_Size 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); } |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | SM_CXBORDER, SM_CYBORDER, SM_CXVSCROLL, SM_CYVSCROLL, SM_CXHSCROLL, SM_CYHSCROLL, SM_CXMENUCHECK, SM_CYMENUCHECK, SM_CXMENUSIZE, SM_CYMENUSIZE, SM_CXSIZE, SM_CYSIZE, SM_CXSMSIZE, SM_CYSMSIZE }; Tcl_Obj **objv; | | | | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | SM_CXBORDER, SM_CYBORDER, SM_CXVSCROLL, SM_CYVSCROLL, SM_CXHSCROLL, SM_CYHSCROLL, SM_CXMENUCHECK, SM_CYMENUCHECK, SM_CXMENUSIZE, SM_CYMENUSIZE, SM_CXSIZE, SM_CYSIZE, SM_CXSMSIZE, SM_CYSMSIZE }; Tcl_Obj **objv; Tcl_Size i, objc; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) return TCL_ERROR; if (objc != 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL); return TCL_ERROR; } for (i = 0; i < objc; ++i) { int option; if (Tcl_GetIndexFromObjStruct(interp, objv[i], names, sizeof(char *), "system constant", 0, &option) != TCL_OK) |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | static int Ttk_CreateVsapiElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, | | | | | | | | | | > | | | | 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 | static int Ttk_CreateVsapiElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, Tcl_Size objc, Tcl_Obj *const objv[]) { XPThemeData *themeData = (XPThemeData *)clientData; ElementInfo *elementPtr = NULL; void *elementData; LPCWSTR className; int partId = 0; Ttk_StateTable *stateTable; Ttk_Padding pad = {0, 0, 0, 0}; int flags = 0; Tcl_Size 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'", TCL_INDEX_NONE)); 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) { Tcl_Size i = 3; int 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; |
︙ | ︙ | |||
1211 1212 1213 1214 1215 1216 1217 | } } } /* convert a statemap into a state table */ if (objc > 2) { Tcl_Obj **specs; | > | | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 | } } } /* convert a statemap into a state table */ if (objc > 2) { Tcl_Obj **specs; Tcl_Size n, j, count; int status = TCL_OK; if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK) goto retErr; /* we over-allocate to ensure there is a terminating entry */ stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable) * (count + 1)); memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1)); for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) { Ttk_StateSpec spec = {0,0}; |
︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | elementPtr->className = wname; elementData = NewElementData(themeData->procs, elementPtr); Ttk_RegisterElementSpec( theme, elementName, elementPtr->elementSpec, elementData); Ttk_RegisterCleanup(interp, elementData, DestroyElementData); | | > | | 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 | elementPtr->className = wname; elementData = NewElementData(themeData->procs, elementPtr); Ttk_RegisterElementSpec( theme, elementName, elementPtr->elementSpec, elementData); Ttk_RegisterCleanup(interp, elementData, DestroyElementData); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, TCL_INDEX_NONE)); Tcl_DStringFree(&classBuf); return TCL_OK; retErr: Tcl_DStringFree(&classBuf); return TCL_ERROR; } /*---------------------------------------------------------------------- * +++ Initialization routine: */ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { XPThemeData *themeData; XPThemeProcs *procs; HINSTANCE hlibrary; Ttk_Theme themePtr, parentPtr, vistaPtr; const ElementInfo *infoPtr; |
︙ | ︙ | |||
1322 1323 1324 1325 1326 1327 1328 | } } /* * New elements: */ for (infoPtr = ElementInfoTable; infoPtr->elementName != 0; ++infoPtr) { | | < < | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | } } /* * New elements: */ for (infoPtr = ElementInfoTable; infoPtr->elementName != 0; ++infoPtr) { void *clientData = NewElementData(procs, infoPtr); Ttk_RegisterElementSpec( themePtr, infoPtr->elementName, infoPtr->elementSpec, clientData); Ttk_RegisterCleanup(interp, clientData, DestroyElementData); } Ttk_RegisterElementSpec(themePtr, "Scale.trough", &ttkNullElementSpec, 0); /* * Layouts: */ Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::xpnative", TTK_VERSION); return TCL_OK; } |
Changes to win/winMain.c.
1 2 3 4 5 6 | /* * winMain.c -- * * Provides a default version of the main program and Tcl_AppInit * procedure for wish and other Tk-based applications. * | | | | > > > > > > > > > > > > > > > > > > > > > > > < | | > > | > > > > > | | | | | > > > > > > | > | 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 | /* * winMain.c -- * * Provides a default version of the main program and Tcl_AppInit * procedure for wish and other Tk-based applications. * * Copyright © 1993 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. */ /* * Explanation on following undef USE_TCL_STUBS by JN 2023-12-19 on the core list: * What's going on is related to TIP #596: * Stubs support for Embedding Tcl in other applications * * If an application using Tcl_Main() is compiled with USE_TCL_STUBS, * Tcl_Main() will be replaced by a stub function, which loads * libtcl9.0.so/tcl90.dll and then calls its Tcl_MainEx(). If * libtcl9.0.so/tcl90.dll is not present (at runtime), a crash is what happens. * * So ... tkAppInit.c should not be compiled with USE_TCL_STUBS * (unless you want to use the TIP #596 functionality) * * The proper solution is to make sure that Makefile.in doesn't use * TCL_USE_STUBS when compiling tkAppInit.c. But that's a * quite big re-organization just before a b1 release. Simpler * is just to #undef'ine USE_TCL_STUBS, it has the same effect. */ #undef USE_TCL_STUBS #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; } | > > > > > > > > > > > | < < < < < < < < < < < < | | 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 | 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/DECkeysym.h.
︙ | ︙ | |||
48 49 50 51 52 53 54 | /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ | | | | | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ #define DXK_ring_accent 0x1000feb0 #define DXK_circumflex_accent 0x1000fe5e #define DXK_cedilla_accent 0x1000fe2c #define DXK_acute_accent 0x1000fe27 #define DXK_grave_accent 0x1000fe60 #define DXK_tilde 0x1000fe7e #define DXK_diaeresis 0x1000fe22 /* special keysym for LK2** "Remove" key on editing keypad */ #define DXK_Remove 0x1000ff00 /* Remove */ |
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 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 | 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. */ #ifndef _HPKEYSYM_H #define _HPKEYSYM_H #define hpXK_ClearLine 0x1000ff6f #define hpXK_InsertLine 0x1000ff70 #define hpXK_DeleteLine 0x1000ff71 #define hpXK_InsertChar 0x1000ff72 #define hpXK_DeleteChar 0x1000ff73 #define hpXK_BackTab 0x1000ff74 #define hpXK_KP_BackTab 0x1000ff75 #define hpXK_Modelock1 0x1000ff48 #define hpXK_Modelock2 0x1000ff49 #define hpXK_Reset 0x1000ff6c #define hpXK_System 0x1000ff6d #define hpXK_User 0x1000ff6e #define hpXK_mute_acute 0x100000a8 #define hpXK_mute_grave 0x100000a9 #define hpXK_mute_asciicircum 0x100000aa #define hpXK_mute_diaeresis 0x100000ab #define hpXK_mute_asciitilde 0x100000ac #define hpXK_lira 0x100000af #define hpXK_guilder 0x100000be #define hpXK_Ydiaeresis 0x100000ee #define hpXK_IO 0x100000ee /* deprecated alias for hpYdiaeresis */ #define hpXK_longminus 0x100000f6 #define hpXK_block 0x100000fc #ifndef _OSF_Keysyms #define _OSF_Keysyms #define osfXK_Copy 0x1004ff02 #define osfXK_Cut 0x1004ff03 #define osfXK_Paste 0x1004ff04 #define osfXK_BackTab 0x1004ff07 #define osfXK_BackSpace 0x1004ff08 #define osfXK_Clear 0x1004ff0b #define osfXK_Escape 0x1004ff1b #define osfXK_AddMode 0x1004ff31 #define osfXK_PrimaryPaste 0x1004ff32 #define osfXK_QuickPaste 0x1004ff33 #define osfXK_PageLeft 0x1004ff40 #define osfXK_PageUp 0x1004ff41 #define osfXK_PageDown 0x1004ff42 #define osfXK_PageRight 0x1004ff43 #define osfXK_Activate 0x1004ff44 #define osfXK_MenuBar 0x1004ff45 #define osfXK_Left 0x1004ff51 #define osfXK_Up 0x1004ff52 #define osfXK_Right 0x1004ff53 #define osfXK_Down 0x1004ff54 #define osfXK_EndLine 0x1004ff57 #define osfXK_BeginLine 0x1004ff58 #define osfXK_EndData 0x1004ff59 #define osfXK_BeginData 0x1004ff5a #define osfXK_PrevMenu 0x1004ff5b #define osfXK_NextMenu 0x1004ff5c #define osfXK_PrevField 0x1004ff5d #define osfXK_NextField 0x1004ff5e #define osfXK_Select 0x1004ff60 #define osfXK_Insert 0x1004ff63 #define osfXK_Undo 0x1004ff65 #define osfXK_Menu 0x1004ff67 #define osfXK_Cancel 0x1004ff69 #define osfXK_Help 0x1004ff6a #define osfXK_SelectAll 0x1004ff71 #define osfXK_DeselectAll 0x1004ff72 #define osfXK_Reselect 0x1004ff73 #define osfXK_Extend 0x1004ff74 #define osfXK_Restore 0x1004ff78 #define osfXK_Delete 0x1004ffff #endif /* _OSF_Keysyms */ /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ #define XK_Reset 0x1000ff6c /* deprecated alias for hpReset */ #define XK_System 0x1000ff6d /* deprecated alias for hpSystem */ #define XK_User 0x1000ff6e /* deprecated alias for hpUser */ #define XK_ClearLine 0x1000ff6f /* deprecated alias for hpClearLine */ #define XK_InsertLine 0x1000ff70 /* deprecated alias for hpInsertLine */ #define XK_DeleteLine 0x1000ff71 /* deprecated alias for hpDeleteLine */ #define XK_InsertChar 0x1000ff72 /* deprecated alias for hpInsertChar */ #define XK_DeleteChar 0x1000ff73 /* deprecated alias for hpDeleteChar */ #define XK_BackTab 0x1000ff74 /* deprecated alias for hpBackTab */ #define XK_KP_BackTab 0x1000ff75 /* deprecated alias for hpKP_BackTab */ #define XK_Ext16bit_L 0x1000ff76 /* deprecated */ #define XK_Ext16bit_R 0x1000ff77 /* deprecated */ #define XK_mute_acute 0x100000a8 /* deprecated alias for hpmute_acute */ #define XK_mute_grave 0x100000a9 /* deprecated alias for hpmute_grave */ #define XK_mute_asciicircum 0x100000aa /* deprecated alias for hpmute_asciicircum */ #define XK_mute_diaeresis 0x100000ab /* deprecated alias for hpmute_diaeresis */ #define XK_mute_asciitilde 0x100000ac /* deprecated alias for hpmute_asciitilde */ #define XK_lira 0x100000af /* deprecated alias for hplira */ #define XK_guilder 0x100000be /* deprecated alias for hpguilder */ #ifndef XK_Ydiaeresis #define XK_Ydiaeresis 0x100000ee /* deprecated */ #endif #define XK_IO 0x100000ee /* deprecated alias for hpYdiaeresis */ #define XK_longminus 0x100000f6 /* deprecated alias for hplongminus */ #define XK_block 0x100000fc /* deprecated alias for hpblock */ #endif /* _HPKEYSYM_H */ |
Changes to xlib/X11/Sunkeysym.h.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 1991, Oracle and/or its affiliates. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: |
︙ | ︙ | |||
46 47 48 49 50 51 52 | ***********************************************************/ /* * Floating Accent */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | ***********************************************************/ /* * Floating Accent */ #define SunXK_FA_Grave 0x1005ff00 #define SunXK_FA_Circum 0x1005ff01 #define SunXK_FA_Tilde 0x1005ff02 #define SunXK_FA_Acute 0x1005ff03 #define SunXK_FA_Diaeresis 0x1005ff04 #define SunXK_FA_Cedilla 0x1005ff05 /* * Miscellaneous Functions */ #define SunXK_F36 0x1005ff10 /* Labeled F11 */ #define SunXK_F37 0x1005ff11 /* Labeled F12 */ #define SunXK_Sys_Req 0x1005ff60 #define SunXK_Print_Screen 0x0000ff61 /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ #define SunXK_Compose 0x0000ff20 /* Same as XK_Multi_key */ #define SunXK_AltGraph 0x0000ff7e /* Same as XK_Mode_switch */ /* * Cursor Control */ #define SunXK_PageUp 0x0000ff55 /* Same as XK_Prior */ #define SunXK_PageDown 0x0000ff56 /* Same as XK_Next */ /* * Open Look Functions */ #define SunXK_Undo 0x0000ff65 /* Same as XK_Undo */ #define SunXK_Again 0x0000ff66 /* Same as XK_Redo */ #define SunXK_Find 0x0000ff68 /* Same as XK_Find */ #define SunXK_Stop 0x0000ff69 /* Same as XK_Cancel */ #define SunXK_Props 0x1005ff70 #define SunXK_Front 0x1005ff71 #define SunXK_Copy 0x1005ff72 #define SunXK_Open 0x1005ff73 #define SunXK_Paste 0x1005ff74 #define SunXK_Cut 0x1005ff75 #define SunXK_PowerSwitch 0x1005ff76 #define SunXK_AudioLowerVolume 0x1005ff77 #define SunXK_AudioMute 0x1005ff78 #define SunXK_AudioRaiseVolume 0x1005ff79 #define SunXK_VideoDegauss 0x1005ff7a #define SunXK_VideoLowerBrightness 0x1005ff7b #define SunXK_VideoRaiseBrightness 0x1005ff7c #define SunXK_PowerSwitchShift 0x1005ff7d |
Changes to xlib/X11/X.h.
︙ | ︙ | |||
51 52 53 54 55 56 57 | ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ | > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < | | > > | > | 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 | ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID # ifdef _WIN64 typedef unsigned long long XID; # else typedef unsigned long XID; # endif # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef unsigned long Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef unsigned long Atom; /* Also in Xdefs.h */ # endif typedef unsigned long VisualID; typedef unsigned long Time; #else # include <X11/Xmd.h> # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef CARD32 XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef CARD32 Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef CARD32 Atom; # endif typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned int KeyCode; /* In order to use IME, the Macintosh needs * to pack 3 bytes into the keyCode field in * the XEvent. In the real X.h, a KeyCode is * defined as an unsigned char, which wouldn't * be big enough. */ /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #ifndef None /* Perl-Tk expects None to be a macro. See ticket [593eb0227c] */ #define None None /* See bug [9e31fd9449] and below */ #endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window |
︙ | ︙ | |||
194 195 196 197 198 199 200 | /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) | > | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) /* Perl-Tk expects ControlMask to be a macro. See ticket [593eb0227c] */ #define ControlMask ControlMask /* See bug [9e31fd9449] and below */ #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */ enum { None = 0, ControlMask = (1<<2) }; /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 |
︙ | ︙ |
Changes to xlib/X11/XF86keysym.h.
1 2 3 | /* * XFree86 vendor specific keysyms. * | | | > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > | > > > | | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* * 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. */ /* * ModeLock * * This one is old, and not really used any more since XKB offers this * functionality. */ #define XF86XK_ModeLock 0x1008ff01 /* Mode Switch Lock */ /* Backlight controls. */ #define XF86XK_MonBrightnessUp 0x1008ff02 /* Monitor/panel brightness */ #define XF86XK_MonBrightnessDown 0x1008ff03 /* Monitor/panel brightness */ #define XF86XK_KbdLightOnOff 0x1008ff04 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessUp 0x1008ff05 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessDown 0x1008ff06 /* Keyboards may be lit */ #define XF86XK_MonBrightnessCycle 0x1008ff07 /* Monitor/panel brightness */ /* * Keys found on some "Internet" keyboards. */ #define XF86XK_Standby 0x1008ff10 /* System into standby mode */ #define XF86XK_AudioLowerVolume 0x1008ff11 /* Volume control down */ #define XF86XK_AudioMute 0x1008ff12 /* Mute sound from the system */ #define XF86XK_AudioRaiseVolume 0x1008ff13 /* Volume control up */ #define XF86XK_AudioPlay 0x1008ff14 /* Start playing of audio > */ #define XF86XK_AudioStop 0x1008ff15 /* Stop playing audio */ #define XF86XK_AudioPrev 0x1008ff16 /* Previous track */ #define XF86XK_AudioNext 0x1008ff17 /* Next track */ #define XF86XK_HomePage 0x1008ff18 /* Display user's home page */ #define XF86XK_Mail 0x1008ff19 /* Invoke user's mail program */ #define XF86XK_Start 0x1008ff1a /* Start application */ #define XF86XK_Search 0x1008ff1b /* Search */ #define XF86XK_AudioRecord 0x1008ff1c /* Record audio application */ /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ #define XF86XK_Calculator 0x1008ff1d /* Invoke calculator program */ #define XF86XK_Memo 0x1008ff1e /* Invoke Memo taking program */ #define XF86XK_ToDoList 0x1008ff1f /* Invoke To Do List program */ #define XF86XK_Calendar 0x1008ff20 /* Invoke Calendar program */ #define XF86XK_PowerDown 0x1008ff21 /* Deep sleep the system */ #define XF86XK_ContrastAdjust 0x1008ff22 /* Adjust screen contrast */ #define XF86XK_RockerUp 0x1008ff23 /* Rocker switches exist up */ #define XF86XK_RockerDown 0x1008ff24 /* and down */ #define XF86XK_RockerEnter 0x1008ff25 /* and let you press them */ /* Some more "Internet" keyboard symbols */ #define XF86XK_Back 0x1008ff26 /* Like back on a browser */ #define XF86XK_Forward 0x1008ff27 /* Like forward on a browser */ #define XF86XK_Stop 0x1008ff28 /* Stop current operation */ #define XF86XK_Refresh 0x1008ff29 /* Refresh the page */ #define XF86XK_PowerOff 0x1008ff2a /* Power off system entirely */ #define XF86XK_WakeUp 0x1008ff2b /* Wake up system from sleep */ #define XF86XK_Eject 0x1008ff2c /* Eject device (e.g. DVD) */ #define XF86XK_ScreenSaver 0x1008ff2d /* Invoke screensaver */ #define XF86XK_WWW 0x1008ff2e /* Invoke web browser */ #define XF86XK_Sleep 0x1008ff2f /* Put system to sleep */ #define XF86XK_Favorites 0x1008ff30 /* Show favorite locations */ #define XF86XK_AudioPause 0x1008ff31 /* Pause audio playing */ #define XF86XK_AudioMedia 0x1008ff32 /* Launch media collection app */ #define XF86XK_MyComputer 0x1008ff33 /* Display "My Computer" window */ #define XF86XK_VendorHome 0x1008ff34 /* Display vendor home web site */ #define XF86XK_LightBulb 0x1008ff35 /* Light bulb keys exist */ #define XF86XK_Shop 0x1008ff36 /* Display shopping web site */ #define XF86XK_History 0x1008ff37 /* Show history of web surfing */ #define XF86XK_OpenURL 0x1008ff38 /* Open selected URL */ #define XF86XK_AddFavorite 0x1008ff39 /* Add URL to favorites list */ #define XF86XK_HotLinks 0x1008ff3a /* Show "hot" links */ #define XF86XK_BrightnessAdjust 0x1008ff3b /* Invoke brightness adj. UI */ #define XF86XK_Finance 0x1008ff3c /* Display financial site */ #define XF86XK_Community 0x1008ff3d /* Display user's community */ #define XF86XK_AudioRewind 0x1008ff3e /* "rewind" audio track */ #define XF86XK_BackForward 0x1008ff3f /* ??? */ #define XF86XK_Launch0 0x1008ff40 /* Launch Application */ #define XF86XK_Launch1 0x1008ff41 /* Launch Application */ #define XF86XK_Launch2 0x1008ff42 /* Launch Application */ #define XF86XK_Launch3 0x1008ff43 /* Launch Application */ #define XF86XK_Launch4 0x1008ff44 /* Launch Application */ #define XF86XK_Launch5 0x1008ff45 /* Launch Application */ #define XF86XK_Launch6 0x1008ff46 /* Launch Application */ #define XF86XK_Launch7 0x1008ff47 /* Launch Application */ #define XF86XK_Launch8 0x1008ff48 /* Launch Application */ #define XF86XK_Launch9 0x1008ff49 /* Launch Application */ #define XF86XK_LaunchA 0x1008ff4a /* Launch Application */ #define XF86XK_LaunchB 0x1008ff4b /* Launch Application */ #define XF86XK_LaunchC 0x1008ff4c /* Launch Application */ #define XF86XK_LaunchD 0x1008ff4d /* Launch Application */ #define XF86XK_LaunchE 0x1008ff4e /* Launch Application */ #define XF86XK_LaunchF 0x1008ff4f /* Launch Application */ #define XF86XK_ApplicationLeft 0x1008ff50 /* switch to application, left */ #define XF86XK_ApplicationRight 0x1008ff51 /* switch to application, right*/ #define XF86XK_Book 0x1008ff52 /* Launch bookreader */ #define XF86XK_CD 0x1008ff53 /* Launch CD/DVD player */ #define XF86XK_Calculater 0x1008ff54 /* Launch Calculater */ #define XF86XK_Clear 0x1008ff55 /* Clear window, screen */ #define XF86XK_Close 0x1008ff56 /* Close window */ #define XF86XK_Copy 0x1008ff57 /* Copy selection */ #define XF86XK_Cut 0x1008ff58 /* Cut selection */ #define XF86XK_Display 0x1008ff59 /* Output switch key */ #define XF86XK_DOS 0x1008ff5a /* Launch DOS (emulation) */ #define XF86XK_Documents 0x1008ff5b /* Open documents window */ #define XF86XK_Excel 0x1008ff5c /* Launch spread sheet */ #define XF86XK_Explorer 0x1008ff5d /* Launch file explorer */ #define XF86XK_Game 0x1008ff5e /* Launch game */ #define XF86XK_Go 0x1008ff5f /* Go to URL */ #define XF86XK_iTouch 0x1008ff60 /* Logitech iTouch- don't use */ #define XF86XK_LogOff 0x1008ff61 /* Log off system */ #define XF86XK_Market 0x1008ff62 /* ?? */ #define XF86XK_Meeting 0x1008ff63 /* enter meeting in calendar */ #define XF86XK_MenuKB 0x1008ff65 /* distinguish keyboard from PB */ #define XF86XK_MenuPB 0x1008ff66 /* distinguish PB from keyboard */ #define XF86XK_MySites 0x1008ff67 /* Favourites */ #define XF86XK_New 0x1008ff68 /* New (folder, document... */ #define XF86XK_News 0x1008ff69 /* News */ #define XF86XK_OfficeHome 0x1008ff6a /* Office home (old Staroffice)*/ #define XF86XK_Open 0x1008ff6b /* Open */ #define XF86XK_Option 0x1008ff6c /* ?? */ #define XF86XK_Paste 0x1008ff6d /* Paste */ #define XF86XK_Phone 0x1008ff6e /* Launch phone; dial number */ #define XF86XK_Q 0x1008ff70 /* Compaq's Q - don't use */ #define XF86XK_Reply 0x1008ff72 /* Reply e.g., mail */ #define XF86XK_Reload 0x1008ff73 /* Reload web page, file, etc. */ #define XF86XK_RotateWindows 0x1008ff74 /* Rotate windows e.g. xrandr */ #define XF86XK_RotationPB 0x1008ff75 /* don't use */ #define XF86XK_RotationKB 0x1008ff76 /* don't use */ #define XF86XK_Save 0x1008ff77 /* Save (file, document, state */ #define XF86XK_ScrollUp 0x1008ff78 /* Scroll window/contents up */ #define XF86XK_ScrollDown 0x1008ff79 /* Scrool window/contentd down */ #define XF86XK_ScrollClick 0x1008ff7a /* Use XKB mousekeys instead */ #define XF86XK_Send 0x1008ff7b /* Send mail, file, object */ #define XF86XK_Spell 0x1008ff7c /* Spell checker */ #define XF86XK_SplitScreen 0x1008ff7d /* Split window or screen */ #define XF86XK_Support 0x1008ff7e /* Get support (??) */ #define XF86XK_TaskPane 0x1008ff7f /* Show tasks */ #define XF86XK_Terminal 0x1008ff80 /* Launch terminal emulator */ #define XF86XK_Tools 0x1008ff81 /* toolbox of desktop/app. */ #define XF86XK_Travel 0x1008ff82 /* ?? */ #define XF86XK_UserPB 0x1008ff84 /* ?? */ #define XF86XK_User1KB 0x1008ff85 /* ?? */ #define XF86XK_User2KB 0x1008ff86 /* ?? */ #define XF86XK_Video 0x1008ff87 /* Launch video player */ #define XF86XK_WheelButton 0x1008ff88 /* button from a mouse wheel */ #define XF86XK_Word 0x1008ff89 /* Launch word processor */ #define XF86XK_Xfer 0x1008ff8a #define XF86XK_ZoomIn 0x1008ff8b /* zoom in view, map, etc. */ #define XF86XK_ZoomOut 0x1008ff8c /* zoom out view, map, etc. */ #define XF86XK_Away 0x1008ff8d /* mark yourself as away */ #define XF86XK_Messenger 0x1008ff8e /* as in instant messaging */ #define XF86XK_WebCam 0x1008ff8f /* Launch web camera app. */ #define XF86XK_MailForward 0x1008ff90 /* Forward in mail */ #define XF86XK_Pictures 0x1008ff91 /* Show pictures */ #define XF86XK_Music 0x1008ff92 /* Launch music application */ #define XF86XK_Battery 0x1008ff93 /* Display battery information */ #define XF86XK_Bluetooth 0x1008ff94 /* Enable/disable Bluetooth */ #define XF86XK_WLAN 0x1008ff95 /* Enable/disable WLAN */ #define XF86XK_UWB 0x1008ff96 /* Enable/disable UWB */ #define XF86XK_AudioForward 0x1008ff97 /* fast-forward audio track */ #define XF86XK_AudioRepeat 0x1008ff98 /* toggle repeat mode */ #define XF86XK_AudioRandomPlay 0x1008ff99 /* toggle shuffle mode */ #define XF86XK_Subtitle 0x1008ff9a /* cycle through subtitle */ #define XF86XK_AudioCycleTrack 0x1008ff9b /* cycle through audio tracks */ #define XF86XK_CycleAngle 0x1008ff9c /* cycle through angles */ #define XF86XK_FrameBack 0x1008ff9d /* video: go one frame back */ #define XF86XK_FrameForward 0x1008ff9e /* video: go one frame forward */ #define XF86XK_Time 0x1008ff9f /* display, or shows an entry for time seeking */ #define XF86XK_Select 0x1008ffa0 /* Select button on joypads and remotes */ #define XF86XK_View 0x1008ffa1 /* Show a view options/properties */ #define XF86XK_TopMenu 0x1008ffa2 /* Go to a top-level menu in a video */ #define XF86XK_Red 0x1008ffa3 /* Red button */ #define XF86XK_Green 0x1008ffa4 /* Green button */ #define XF86XK_Yellow 0x1008ffa5 /* Yellow button */ #define XF86XK_Blue 0x1008ffa6 /* Blue button */ #define XF86XK_Suspend 0x1008ffa7 /* Sleep to RAM */ #define XF86XK_Hibernate 0x1008ffa8 /* Sleep to disk */ #define XF86XK_TouchpadToggle 0x1008ffa9 /* Toggle between touchpad/trackstick */ #define XF86XK_TouchpadOn 0x1008ffb0 /* The touchpad got switched on */ #define XF86XK_TouchpadOff 0x1008ffb1 /* The touchpad got switched off */ #define XF86XK_AudioMicMute 0x1008ffb2 /* Mute the Mic from the system */ #define XF86XK_Keyboard 0x1008ffb3 /* User defined keyboard related action */ #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 #define XF86XK_Switch_VT_6 0x1008fe06 #define XF86XK_Switch_VT_7 0x1008fe07 #define XF86XK_Switch_VT_8 0x1008fe08 #define XF86XK_Switch_VT_9 0x1008fe09 #define XF86XK_Switch_VT_10 0x1008fe0a #define XF86XK_Switch_VT_11 0x1008fe0b #define XF86XK_Switch_VT_12 0x1008fe0c #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_CameraAccessEnable _EVDEVK(0x24b) /* v6.2 KEY_CAMERA_ACCESS_ENABLE */ #define XF86XK_CameraAccessDisable _EVDEVK(0x24c) /* v6.2 KEY_CAMERA_ACCESS_DISABLE */ #define XF86XK_CameraAccessToggle _EVDEVK(0x24d) /* v6.2 KEY_CAMERA_ACCESS_TOGGLE */ #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_NextElement _EVDEVK(0x27b) /* v5.18 KEY_NEXT_ELEMENT */ #define XF86XK_PreviousElement _EVDEVK(0x27c) /* v5.18 KEY_PREVIOUS_ELEMENT */ #define XF86XK_AutopilotEngageToggle _EVDEVK(0x27d) /* v5.18 KEY_AUTOPILOT_ENGAGE_TOGGLE */ #define XF86XK_MarkWaypoint _EVDEVK(0x27e) /* v5.18 KEY_MARK_WAYPOINT */ #define XF86XK_Sos _EVDEVK(0x27f) /* v5.18 KEY_SOS */ #define XF86XK_NavChart _EVDEVK(0x280) /* v5.18 KEY_NAV_CHART */ #define XF86XK_FishingChart _EVDEVK(0x281) /* v5.18 KEY_FISHING_CHART */ #define XF86XK_SingleRangeRadar _EVDEVK(0x282) /* v5.18 KEY_SINGLE_RANGE_RADAR */ #define XF86XK_DualRangeRadar _EVDEVK(0x283) /* v5.18 KEY_DUAL_RANGE_RADAR */ #define XF86XK_RadarOverlay _EVDEVK(0x284) /* v5.18 KEY_RADAR_OVERLAY */ #define XF86XK_TraditionalSonar _EVDEVK(0x285) /* v5.18 KEY_TRADITIONAL_SONAR */ #define XF86XK_ClearvuSonar _EVDEVK(0x286) /* v5.18 KEY_CLEARVU_SONAR */ #define XF86XK_SidevuSonar _EVDEVK(0x287) /* v5.18 KEY_SIDEVU_SONAR */ #define XF86XK_NavInfo _EVDEVK(0x288) /* v5.18 KEY_NAV_INFO */ /* Use: XF86XK_BrightnessAdjust _EVDEVK(0x289) v5.18 KEY_BRIGHTNESS_MENU */ #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.
︙ | ︙ | |||
159 160 161 162 163 164 165 | #if __has_attribute(__format__) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) #else /* not gcc >= 2.3 */ # define _X_ATTRIBUTE_PRINTF(x,y) #endif | < < < < < < < < < < < < < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | #if __has_attribute(__format__) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) #else /* not gcc >= 2.3 */ # define _X_ATTRIBUTE_PRINTF(x,y) #endif /* requires xproto >= 7.0.22 */ #if __has_attribute(__unused__) \ || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) #define _X_UNUSED __attribute__((__unused__)) #else #define _X_UNUSED /* */ #endif |
︙ | ︙ | |||
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_ */ | > > > > > > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /* 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.
︙ | ︙ | |||
45 46 47 48 49 50 51 | /* applications should not depend on these two headers being included! */ #include <X11/Xfuncproto.h> #ifndef X_WCHAR #include <stddef.h> #else | < < < < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | /* applications should not depend on these two headers being included! */ #include <X11/Xfuncproto.h> #ifndef X_WCHAR #include <stddef.h> #else /* replace this with #include or typedef appropriate for your system */ typedef unsigned long wchar_t; #endif #ifndef EXTERN # define EXTERN extern TCL_STORAGE_CLASS #endif #if defined(STATIC_BUILD) || !defined(_WIN32) # ifndef TCL_STORAGE_CLASS |
︙ | ︙ | |||
101 102 103 104 105 106 107 | #define True 1 #define False 0 #define QueuedAlready 0 #define QueuedAfterReading 1 #define QueuedAfterFlush 2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | #define True 1 #define False 0 #define QueuedAlready 0 #define QueuedAfterReading 1 #define QueuedAfterFlush 2 #define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd) #define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) #define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) #define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) #define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) #define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) #define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) #define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) #define AllPlanes ((unsigned long)~0L) #define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen) #define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) #define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) #define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) #define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) #define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) #define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens) #define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor) #define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version) #define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version) #define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release) #define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name) #define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) #define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit) #define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order) #define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad) #define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order) #define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1) #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->request) /* macros for screen oriented applications (toolkit) */ #define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr]) #define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) #define DisplayOfScreen(s) ((s)->display) #define RootWindowOfScreen(s) ((s)->root) #define BlackPixelOfScreen(s) ((s)->black_pixel) #define WhitePixelOfScreen(s) ((s)->white_pixel) #define DefaultColormapOfScreen(s)((s)->cmap) #define DefaultDepthOfScreen(s) ((s)->root_depth) #define DefaultGCOfScreen(s) ((s)->default_gc) |
︙ | ︙ | |||
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, | | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 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 */ | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | 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 */ | | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | 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 */, |
︙ | ︙ | |||
488 489 490 491 492 493 494 | /* * Display datatype maintaining display specific data. * The contents of this structure are implementation dependent. * A Display should be treated as opaque by application code. */ | > | > > > > > > > > > > | 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 | /* * Display datatype maintaining display specific data. * The contents of this structure are implementation dependent. * A Display should be treated as opaque by application code. */ #ifndef XLIB_ILLEGAL_ACCESS typedef struct _XDisplay Display; #endif struct _XPrivate; /* Forward declare before use for C++ */ struct _XrmHashBucketRec; typedef struct #ifdef XLIB_ILLEGAL_ACCESS _XDisplay #endif { XExtData *ext_data; /* hook for extension to hang data */ struct _XPrivate *private1; int fd; /* Network socket. */ int private2; int proto_major_version;/* major version of server's X protocol */ int proto_minor_version;/* minor version of servers X protocol */ char *vendor; /* vendor of the server hardware */ |
︙ | ︙ | |||
536 537 538 539 540 541 542 | unsigned long private16; int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ XPointer private17; XPointer private18; int private19; char *xdefaults; /* contents of defaults from server */ | < < < < < < < | < < < < < < < < < < < < < < > > | | < < < < < < < < < < < < < < < | < < < < < | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | unsigned long private16; int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ XPointer private17; XPointer private18; int private19; char *xdefaults; /* contents of defaults from server */ /* there is more to this structure, but it is private to Xlib */ } #ifdef XLIB_ILLEGAL_ACCESS Display, #endif *_XPrivDisplay; #undef _XEVENT_ #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 */ |
︙ | ︙ | |||
1042 1043 1044 1045 1046 1047 1048 | XKeymapEvent xkeymap; XGenericEvent xgeneric; XGenericEventCookie xcookie; XID pad[24]; } XEvent; #endif | | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | XKeymapEvent xkeymap; XGenericEvent xgeneric; XGenericEventCookie xcookie; XID pad[24]; } XEvent; #endif #define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy))) /* * per character font metric information. */ typedef struct { short lbearing; /* origin to left edge of raster */ short rbearing; /* origin to right edge of raster */ |
︙ | ︙ | |||
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | ); /* multithread routines */ EXTERN Status XInitThreads( void ); EXTERN void XLockDisplay( Display* /* display */ ); EXTERN void XUnlockDisplay( Display* /* display */ | > > > > | 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | ); /* multithread routines */ EXTERN Status XInitThreads( void ); EXTERN Status XFreeThreads( void ); EXTERN void XLockDisplay( Display* /* display */ ); EXTERN void XUnlockDisplay( Display* /* display */ |
︙ | ︙ | |||
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | Display* /* display */ ); EXTERN XIOErrorHandler XSetIOErrorHandler ( XIOErrorHandler /* handler */ ); EXTERN XPixmapFormatValues *XListPixmapFormats( Display* /* display */, int* /* count_return */ ); EXTERN int *XListDepths( Display* /* display */, | > > > > > > > > > > | 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | Display* /* display */ ); EXTERN XIOErrorHandler XSetIOErrorHandler ( XIOErrorHandler /* handler */ ); typedef void (*XIOErrorExitHandler) ( /* WARNING, this type not in Xlib spec */ Display*, /* display */ void* /* user_data */ ); EXTERN void XSetIOErrorExitHandler ( Display*, /* display */ XIOErrorExitHandler, /* handler */ void* /* user_data */ ); EXTERN XPixmapFormatValues *XListPixmapFormats( Display* /* display */, int* /* count_return */ ); EXTERN int *XListDepths( Display* /* display */, |
︙ | ︙ |
Changes to xlib/X11/Xutil.h.
︙ | ︙ | |||
414 415 416 417 418 419 420 | XContext /* context */ ); EXTERN int XDestroyRegion( Region /* r */ ); | | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | XContext /* context */ ); EXTERN int XDestroyRegion( Region /* r */ ); EXTERN Bool XEmptyRegion( Region /* r */ ); EXTERN Bool XEqualRegion( Region /* r1 */, Region /* r2 */ ); EXTERN int XFindContext( Display* /* display */, XID /* rid */, |
︙ | ︙ |
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.
︙ | ︙ | |||
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 | * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus 0x01000000. The keysym values in the range * 0x01000100 to 0x0110ffff are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range 0x0100 to 0x20ff. * * Where several mnemonic names are defined for the same keysym in this | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | 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 | * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Some keysyms map to a character already mapped by another keysym, * with compatible but more precise semantics, such as the keypad- * related keysyms. In this case, none of the keysym are deprecated. * The most generic keysym is annotated as previously and more specific * keysyms have the same annotation between angle brackets: * * #define XK_space 0x0020 // U+0020 SPACE * #define XK_KP_Space 0xff80 //<U+0020 SPACE> * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus 0x01000000. The keysym values in the range * 0x01000100 to 0x0110ffff are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range 0x0100 to 0x20ff. * * Where several mnemonic names are defined for the same keysym in this * file, the first one listed is considered the "canonical" name. This * is the name that should be used when retrieving a keysym name from * its code. The next names are considered "aliases" to the canonical * name. * * Aliases are made explicit by writing in their comment "alias for", * followed by the corresponding canonical name. Example: * * #define XK_dead_tilde 0xfe53 * #define XK_dead_perispomeni 0xfe53 // alias for dead_tilde * * The rules to consider a keysym mnemonic name deprecated are: * * 1. A legacy keysym with its Unicode mapping in parentheses is * deprecated (see above). * * 2. A keysym name is *explicitly* deprecated by starting its comment * with "deprecated". Examples: * * #define XK_L1 0xffc8 // deprecated alias for F11 * #define XK_quoteleft 0x0060 // deprecated * * 3. A keysym name is *explicitly* *not* deprecated by starting its * comment with "non-deprecated alias". Examples: * * #define XK_dead_tilde 0xfe53 * #define XK_dead_perispomeni 0xfe53 // non-deprecated alias for dead_tilde * * 4. If none of the previous rules apply, an alias is *implicitly* * deprecated if there is at least one previous name for the * corresponding keysym that is *not* explicitly deprecated. * * Examples: * * // SingleCandidate is the canonical name * #define XK_SingleCandidate 0xff3c * // Hangul_SingleCandidate is deprecated because it is an alias * // and it does not start with "non-deprecated alias" * #define XK_Hangul_SingleCandidate 0xff3c // Single candidate * * // guillemotleft is the canonical name, but it is deprecated * #define XK_guillemotleft 0x00ab // deprecated alias for guillemetleft (misspelling) * // guillemetleft is not deprecated, because the keysym has no endorsed name before it. * #define XK_guillemetleft 0x00ab // U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK * // The following hypothetical name is deprecated because guillemetleft come before. * #define XK_guillemetleft2 0x00ab * * 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*\/\*\(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, |
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | * * - the mappings in src/KeyBind.c in the libX11 repo * https://gitlab.freedesktop.org/xorg/lib/libx11 * * - the protocol specification in specs/keysyms.xml in this repo * https://gitlab.freedesktop.org/xorg/proto/xorgproto * */ #define XK_VoidSymbol 0xffffff /* Void symbol */ #ifdef XK_MISCELLANY /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ | > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | 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 | * * - the mappings in src/KeyBind.c in the libX11 repo * https://gitlab.freedesktop.org/xorg/lib/libx11 * * - the protocol specification in specs/keysyms.xml in this repo * https://gitlab.freedesktop.org/xorg/proto/xorgproto * * Before removing or changing the order of the keysyms, please consider * the following: it is very difficult to know what keysyms are used and * how. * * - A sandboxed application may have incompatibilities with the host * system. For example, if new keysym name is introduced and is made * the canonical name, then an application with an older keysym parser * will not be able to parse the new name. * - Customization of keyboard layout and Compose files are two popular * use cases. Checking the standard keyboard layout database xkeyboard-config * https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config * and the standard Compose files in libx11 * https://gitlab.freedesktop.org/xorg/lib/libx11 is a mandatory * step, but may *not* be enough for a proper impact assessment for * e.g. keysyms removals. * * Therefore, it is advised to proceed to no removal and to make a new * name canonical only 10 years after its introduction. This means that * some keysyms may have their first listed name deprecated during the * period of transition. Once this period is over, the deprecated name * should be moved after the new canonical name. */ #define XK_VoidSymbol 0xffffff /* Void symbol */ #ifdef XK_MISCELLANY /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ #define XK_BackSpace 0xff08 /* U+0008 BACKSPACE */ #define XK_Tab 0xff09 /* U+0009 CHARACTER TABULATION */ #define XK_Linefeed 0xff0a /* U+000A LINE FEED */ #define XK_Clear 0xff0b /* U+000B LINE TABULATION */ #define XK_Return 0xff0d /* U+000D CARRIAGE RETURN */ #define XK_Pause 0xff13 /* Pause, hold */ #define XK_Scroll_Lock 0xff14 #define XK_Sys_Req 0xff15 #define XK_Escape 0xff1b /* U+001B ESCAPE */ #define XK_Delete 0xffff /* U+007F DELETE */ /* International & multi-key character composition */ #define XK_Multi_key 0xff20 /* Multi-key character compose */ #define XK_Codeinput 0xff37 #define XK_SingleCandidate 0xff3c #define XK_MultipleCandidate 0xff3d #define XK_PreviousCandidate 0xff3e /* Japanese keyboard support */ #define XK_Kanji 0xff21 /* Kanji, Kanji convert */ #define XK_Muhenkan 0xff22 /* Cancel Conversion */ #define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */ #define XK_Henkan 0xff23 /* non-deprecated alias for Henkan_Mode */ #define XK_Romaji 0xff24 /* to Romaji */ #define XK_Hiragana 0xff25 /* to Hiragana */ #define XK_Katakana 0xff26 /* to Katakana */ #define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */ #define XK_Zenkaku 0xff28 /* to Zenkaku */ #define XK_Hankaku 0xff29 /* to Hankaku */ #define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */ |
︙ | ︙ | |||
171 172 173 174 175 176 177 | #define XK_Home 0xff50 #define XK_Left 0xff51 /* Move left, left arrow */ #define XK_Up 0xff52 /* Move up, up arrow */ #define XK_Right 0xff53 /* Move right, right arrow */ #define XK_Down 0xff54 /* Move down, down arrow */ #define XK_Prior 0xff55 /* Prior, previous */ | | | < < < < < | | | | | | | | | | | | | | | | | | | | | | | | 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 | #define XK_Home 0xff50 #define XK_Left 0xff51 /* Move left, left arrow */ #define XK_Up 0xff52 /* Move up, up arrow */ #define XK_Right 0xff53 /* Move right, right arrow */ #define XK_Down 0xff54 /* Move down, down arrow */ #define XK_Prior 0xff55 /* Prior, previous */ #define XK_Page_Up 0xff55 /* deprecated alias for Prior */ #define XK_Next 0xff56 /* Next */ #define XK_Page_Down 0xff56 /* deprecated alias for Next */ #define XK_End 0xff57 /* EOL */ #define XK_Begin 0xff58 /* BOL */ /* 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 */ #define XK_Undo 0xff65 #define XK_Redo 0xff66 /* Redo, again */ #define XK_Menu 0xff67 #define XK_Find 0xff68 /* Find, search */ #define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */ #define XK_Help 0xff6a /* Help */ #define XK_Break 0xff6b #define XK_Mode_switch 0xff7e /* Character set switch */ #define XK_script_switch 0xff7e /* non-deprecated alias for Mode_switch */ #define XK_Num_Lock 0xff7f /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ #define XK_KP_Space 0xff80 /*<U+0020 SPACE>*/ #define XK_KP_Tab 0xff89 /*<U+0009 CHARACTER TABULATION>*/ #define XK_KP_Enter 0xff8d /*<U+000D CARRIAGE RETURN>*/ #define XK_KP_F1 0xff91 /* PF1, KP_A, ... */ #define XK_KP_F2 0xff92 #define XK_KP_F3 0xff93 #define XK_KP_F4 0xff94 #define XK_KP_Home 0xff95 #define XK_KP_Left 0xff96 #define XK_KP_Up 0xff97 #define XK_KP_Right 0xff98 #define XK_KP_Down 0xff99 #define XK_KP_Prior 0xff9a #define XK_KP_Page_Up 0xff9a /* deprecated alias for KP_Prior */ #define XK_KP_Next 0xff9b #define XK_KP_Page_Down 0xff9b /* deprecated alias for KP_Next */ #define XK_KP_End 0xff9c #define XK_KP_Begin 0xff9d #define XK_KP_Insert 0xff9e #define XK_KP_Delete 0xff9f #define XK_KP_Equal 0xffbd /*<U+003D EQUALS SIGN>*/ #define XK_KP_Multiply 0xffaa /*<U+002A ASTERISK>*/ #define XK_KP_Add 0xffab /*<U+002B PLUS SIGN>*/ #define XK_KP_Separator 0xffac /*<U+002C COMMA>*/ #define XK_KP_Subtract 0xffad /*<U+002D HYPHEN-MINUS>*/ #define XK_KP_Decimal 0xffae /*<U+002E FULL STOP>*/ #define XK_KP_Divide 0xffaf /*<U+002F SOLIDUS>*/ #define XK_KP_0 0xffb0 /*<U+0030 DIGIT ZERO>*/ #define XK_KP_1 0xffb1 /*<U+0031 DIGIT ONE>*/ #define XK_KP_2 0xffb2 /*<U+0032 DIGIT TWO>*/ #define XK_KP_3 0xffb3 /*<U+0033 DIGIT THREE>*/ #define XK_KP_4 0xffb4 /*<U+0034 DIGIT FOUR>*/ #define XK_KP_5 0xffb5 /*<U+0035 DIGIT FIVE>*/ #define XK_KP_6 0xffb6 /*<U+0036 DIGIT SIX>*/ #define XK_KP_7 0xffb7 /*<U+0037 DIGIT SEVEN>*/ #define XK_KP_8 0xffb8 /*<U+0038 DIGIT EIGHT>*/ #define XK_KP_9 0xffb9 /*<U+0039 DIGIT NINE>*/ /* * Auxiliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. |
︙ | ︙ | |||
261 262 263 264 265 266 267 | #define XK_F5 0xffc2 #define XK_F6 0xffc3 #define XK_F7 0xffc4 #define XK_F8 0xffc5 #define XK_F9 0xffc6 #define XK_F10 0xffc7 #define XK_F11 0xffc8 | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | #define XK_F5 0xffc2 #define XK_F6 0xffc3 #define XK_F7 0xffc4 #define XK_F8 0xffc5 #define XK_F9 0xffc6 #define XK_F10 0xffc7 #define XK_F11 0xffc8 #define XK_L1 0xffc8 /* deprecated alias for F11 */ #define XK_F12 0xffc9 #define XK_L2 0xffc9 /* deprecated alias for F12 */ #define XK_F13 0xffca #define XK_L3 0xffca /* deprecated alias for F13 */ #define XK_F14 0xffcb #define XK_L4 0xffcb /* deprecated alias for F14 */ #define XK_F15 0xffcc #define XK_L5 0xffcc /* deprecated alias for F15 */ #define XK_F16 0xffcd #define XK_L6 0xffcd /* deprecated alias for F16 */ #define XK_F17 0xffce #define XK_L7 0xffce /* deprecated alias for F17 */ #define XK_F18 0xffcf #define XK_L8 0xffcf /* deprecated alias for F18 */ #define XK_F19 0xffd0 #define XK_L9 0xffd0 /* deprecated alias for F19 */ #define XK_F20 0xffd1 #define XK_L10 0xffd1 /* deprecated alias for F20 */ #define XK_F21 0xffd2 #define XK_R1 0xffd2 /* deprecated alias for F21 */ #define XK_F22 0xffd3 #define XK_R2 0xffd3 /* deprecated alias for F22 */ #define XK_F23 0xffd4 #define XK_R3 0xffd4 /* deprecated alias for F23 */ #define XK_F24 0xffd5 #define XK_R4 0xffd5 /* deprecated alias for F24 */ #define XK_F25 0xffd6 #define XK_R5 0xffd6 /* deprecated alias for F25 */ #define XK_F26 0xffd7 #define XK_R6 0xffd7 /* deprecated alias for F26 */ #define XK_F27 0xffd8 #define XK_R7 0xffd8 /* deprecated alias for F27 */ #define XK_F28 0xffd9 #define XK_R8 0xffd9 /* deprecated alias for F28 */ #define XK_F29 0xffda #define XK_R9 0xffda /* deprecated alias for F29 */ #define XK_F30 0xffdb #define XK_R10 0xffdb /* deprecated alias for F30 */ #define XK_F31 0xffdc #define XK_R11 0xffdc /* deprecated alias for F31 */ #define XK_F32 0xffdd #define XK_R12 0xffdd /* deprecated alias for F32 */ #define XK_F33 0xffde #define XK_R13 0xffde /* deprecated alias for F33 */ #define XK_F34 0xffdf #define XK_R14 0xffdf /* deprecated alias for F34 */ #define XK_F35 0xffe0 #define XK_R15 0xffe0 /* deprecated alias for F35 */ /* Modifiers */ #define XK_Shift_L 0xffe1 /* Left shift */ #define XK_Shift_R 0xffe2 /* Right shift */ #define XK_Control_L 0xffe3 /* Left control */ #define XK_Control_R 0xffe4 /* Right control */ |
︙ | ︙ | |||
345 346 347 348 349 350 351 | #define XK_ISO_Level2_Latch 0xfe02 #define XK_ISO_Level3_Shift 0xfe03 #define XK_ISO_Level3_Latch 0xfe04 #define XK_ISO_Level3_Lock 0xfe05 #define XK_ISO_Level5_Shift 0xfe11 #define XK_ISO_Level5_Latch 0xfe12 #define XK_ISO_Level5_Lock 0xfe13 | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | #define XK_ISO_Level2_Latch 0xfe02 #define XK_ISO_Level3_Shift 0xfe03 #define XK_ISO_Level3_Latch 0xfe04 #define XK_ISO_Level3_Lock 0xfe05 #define XK_ISO_Level5_Shift 0xfe11 #define XK_ISO_Level5_Latch 0xfe12 #define XK_ISO_Level5_Lock 0xfe13 #define XK_ISO_Group_Shift 0xff7e /* non-deprecated alias for Mode_switch */ #define XK_ISO_Group_Latch 0xfe06 #define XK_ISO_Group_Lock 0xfe07 #define XK_ISO_Next_Group 0xfe08 #define XK_ISO_Next_Group_Lock 0xfe09 #define XK_ISO_Prev_Group 0xfe0a #define XK_ISO_Prev_Group_Lock 0xfe0b #define XK_ISO_First_Group 0xfe0c |
︙ | ︙ | |||
383 384 385 386 387 388 389 | #define XK_ISO_Center_Object 0xfe33 #define XK_ISO_Enter 0xfe34 #define XK_dead_grave 0xfe50 #define XK_dead_acute 0xfe51 #define XK_dead_circumflex 0xfe52 #define XK_dead_tilde 0xfe53 | | | | | 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 | #define XK_ISO_Center_Object 0xfe33 #define XK_ISO_Enter 0xfe34 #define XK_dead_grave 0xfe50 #define XK_dead_acute 0xfe51 #define XK_dead_circumflex 0xfe52 #define XK_dead_tilde 0xfe53 #define XK_dead_perispomeni 0xfe53 /* non-deprecated alias for dead_tilde */ #define XK_dead_macron 0xfe54 #define XK_dead_breve 0xfe55 #define XK_dead_abovedot 0xfe56 #define XK_dead_diaeresis 0xfe57 #define XK_dead_abovering 0xfe58 #define XK_dead_doubleacute 0xfe59 #define XK_dead_caron 0xfe5a #define XK_dead_cedilla 0xfe5b #define XK_dead_ogonek 0xfe5c #define XK_dead_iota 0xfe5d #define XK_dead_voiced_sound 0xfe5e #define XK_dead_semivoiced_sound 0xfe5f #define XK_dead_belowdot 0xfe60 #define XK_dead_hook 0xfe61 #define XK_dead_horn 0xfe62 #define XK_dead_stroke 0xfe63 #define XK_dead_abovecomma 0xfe64 #define XK_dead_psili 0xfe64 /* non-deprecated alias for dead_abovecomma */ #define XK_dead_abovereversedcomma 0xfe65 #define XK_dead_dasia 0xfe65 /* non-deprecated alias for dead_abovereversedcomma */ #define XK_dead_doublegrave 0xfe66 #define XK_dead_belowring 0xfe67 #define XK_dead_belowmacron 0xfe68 #define XK_dead_belowcircumflex 0xfe69 #define XK_dead_belowtilde 0xfe6a #define XK_dead_belowbreve 0xfe6b #define XK_dead_belowdiaeresis 0xfe6c |
︙ | ︙ | |||
432 433 434 435 436 437 438 | #define XK_dead_E 0xfe83 #define XK_dead_i 0xfe84 #define XK_dead_I 0xfe85 #define XK_dead_o 0xfe86 #define XK_dead_O 0xfe87 #define XK_dead_u 0xfe88 #define XK_dead_U 0xfe89 | | > | > > | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | #define XK_dead_E 0xfe83 #define XK_dead_i 0xfe84 #define XK_dead_I 0xfe85 #define XK_dead_o 0xfe86 #define XK_dead_O 0xfe87 #define XK_dead_u 0xfe88 #define XK_dead_U 0xfe89 #define XK_dead_small_schwa 0xfe8a /* deprecated alias for dead_schwa */ #define XK_dead_schwa 0xfe8a #define XK_dead_capital_schwa 0xfe8b /* deprecated alias for dead_SCHWA */ #define XK_dead_SCHWA 0xfe8b #define XK_dead_greek 0xfe8c #define XK_dead_hamza 0xfe8d #define XK_First_Virtual_Screen 0xfed0 #define XK_Prev_Virtual_Screen 0xfed1 #define XK_Next_Virtual_Screen 0xfed2 #define XK_Last_Virtual_Screen 0xfed4 #define XK_Terminate_Server 0xfed5 |
︙ | ︙ | |||
651 652 653 654 655 656 657 | #define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ #define XK_yen 0x00a5 /* U+00A5 YEN SIGN */ #define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ #define XK_section 0x00a7 /* U+00A7 SECTION SIGN */ #define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ #define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ #define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ | > | | > > | | 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 | #define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ #define XK_yen 0x00a5 /* U+00A5 YEN SIGN */ #define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ #define XK_section 0x00a7 /* U+00A7 SECTION SIGN */ #define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ #define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ #define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ #define XK_guillemotleft 0x00ab /* deprecated alias for guillemetleft (misspelling) */ #define XK_guillemetleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_notsign 0x00ac /* U+00AC NOT SIGN */ #define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */ #define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */ #define XK_macron 0x00af /* U+00AF MACRON */ #define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */ #define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ #define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ #define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ #define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */ #define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */ #define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */ #define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */ #define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */ #define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ #define XK_masculine 0x00ba /* deprecated alias for ordmasculine (inconsistent name) */ #define XK_ordmasculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ #define XK_guillemotright 0x00bb /* deprecated alias for guillemetright (misspelling) */ #define XK_guillemetright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ #define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ #define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ #define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */ #define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ #define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ #define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ |
︙ | ︙ | |||
698 699 700 701 702 703 704 | #define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ #define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ #define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ #define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ #define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ #define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ #define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | #define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ #define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ #define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ #define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ #define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ #define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ #define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XK_Ooblique 0x00d8 /* deprecated alias for Oslash */ #define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ #define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ #define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ #define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ #define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ #define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ #define XK_Thorn 0x00de /* deprecated */ |
︙ | ︙ | |||
732 733 734 735 736 737 738 | #define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ #define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ #define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ #define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ #define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ #define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */ #define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ | | | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | #define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ #define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ #define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ #define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ #define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ #define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */ #define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XK_ooblique 0x00f8 /* deprecated alias for oslash */ #define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ #define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ #define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ #define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ #define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ #define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ #define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ |
︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 | #define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ #define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ #define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ #define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ #define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ #define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ #define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ | | | 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | #define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ #define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ #define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ #define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ #define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ #define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ #define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ #define XK_kana_switch 0xff7e /* non-deprecated alias for Mode_switch */ #endif /* XK_KATAKANA */ /* * Arabic * Byte 3 = 5 */ |
︙ | ︙ | |||
1096 1097 1098 1099 1100 1101 1102 | #define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ #define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ #define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ #define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ #define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ #define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ #define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ | | | | 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | #define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ #define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ #define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ #define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ #define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ #define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ #define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XK_Arabic_farsi_yeh 0x10006cc /* deprecated alias for Farsi_yeh */ #define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ #define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ #define XK_Arabic_switch 0xff7e /* non-deprecated alias for Mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC |
︙ | ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ #define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ #define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ #define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ #define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ | | | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ #define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ #define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ #define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ #define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ #define XK_Greek_IOTAdiaeresis 0x07a5 /* deprecated (old typo) */ #define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ #define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ #define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ #define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ #define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ #define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */ #define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ |
︙ | ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | #define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ #define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ #define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ #define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ #define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ #define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ #define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ | | | 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 | #define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ #define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ #define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ #define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ #define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ #define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ #define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XK_Greek_LAMBDA 0x07cb /* non-deprecated alias for Greek_LAMDA */ #define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ #define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ #define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ #define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ #define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ #define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ #define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ |
︙ | ︙ | |||
1316 1317 1318 1319 1320 1321 1322 | #define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ #define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ #define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ #define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ #define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ #define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ #define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ | | | | 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 | #define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ #define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ #define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ #define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ #define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ #define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ #define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XK_Greek_lambda 0x07eb /* non-deprecated alias for Greek_lamda */ #define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */ #define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */ #define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */ #define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ #define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ #define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ #define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ #define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ #define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ #define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ #define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ #define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ #define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ #define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ #define XK_Greek_switch 0xff7e /* non-deprecated alias for Mode_switch */ #endif /* XK_GREEK */ /* * Technical * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) * Byte 3 = 8 */ |
︙ | ︙ | |||
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 */ | | | | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | #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)*/ |
︙ | ︙ | |||
1591 1592 1593 1594 1595 1596 1597 | #define XK_hebrew_zadi 0x0cf6 /* deprecated */ #define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ #define XK_hebrew_kuf 0x0cf7 /* deprecated */ #define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ #define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ #define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ #define XK_hebrew_taf 0x0cfa /* deprecated */ | | | 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | #define XK_hebrew_zadi 0x0cf6 /* deprecated */ #define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ #define XK_hebrew_kuf 0x0cf7 /* deprecated */ #define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ #define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ #define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ #define XK_hebrew_taf 0x0cfa /* deprecated */ #define XK_Hebrew_switch 0xff7e /* non-deprecated alias for Mode_switch */ #endif /* XK_HEBREW */ /* * Thai * Byte 3 = 0x0d */ |
︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 | #define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ #define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ #define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ #define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ #define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ #define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ #define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ | | | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | #define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ #define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ #define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ #define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ #define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ #define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ #define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ #define XK_Thai_maihanakat_maitho 0x0dde /*(U+0E3E Unassigned code point)*/ #define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ #define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ #define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ #define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ #define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ #define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ #define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ |
︙ | ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #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 */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #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 /* non-deprecated 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 */ /* * Armenian */ #ifdef XK_ARMENIAN #define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ #define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XK_Armenian_verjaket 0x1000589 /* deprecated alias for Armenian_full_stop */ #define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */ #define XK_Armenian_but 0x100055d /* deprecated alias for Armenian_separation_mark */ #define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XK_Armenian_yentamna 0x100058a /* deprecated alias for Armenian_hyphen */ #define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XK_Armenian_amanak 0x100055c /* deprecated alias for Armenian_exclam */ #define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XK_Armenian_shesht 0x100055b /* deprecated alias for Armenian_accent */ #define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XK_Armenian_paruyk 0x100055e /* deprecated alias for Armenian_question */ #define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ #define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ #define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ #define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ #define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ #define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ #define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ |
︙ | ︙ | |||
2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 | #define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ #define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ #define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ #define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ #define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ #define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ #define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ #endif /* XK_VIETNAMESE */ #ifdef XK_CURRENCY #define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ | > > > > > | 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 | #define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ #define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ #define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ #define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ #define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ #define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ #define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ #define XK_combining_tilde 0x1000303 /* U+0303 COMBINING TILDE */ #define XK_combining_grave 0x1000300 /* U+0300 COMBINING GRAVE ACCENT */ #define XK_combining_acute 0x1000301 /* U+0301 COMBINING ACUTE ACCENT */ #define XK_combining_hook 0x1000309 /* U+0309 COMBINING HOOK ABOVE */ #define XK_combining_belowdot 0x1000323 /* U+0323 COMBINING DOT BELOW */ #endif /* XK_VIETNAMESE */ #ifdef XK_CURRENCY #define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ |
︙ | ︙ | |||
2124 2125 2126 2127 2128 2129 2130 | #define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ #define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ #define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ #define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ #define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ #define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ #define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ | | | | | | | | | | | 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 | #define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ #define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ #define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ #define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ #define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ #define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ #define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ #define XK_emptyset 0x1002205 /* U+2205 EMPTY SET */ #define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */ #define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */ #define XK_containsas 0x100220b /* U+220B CONTAINS AS MEMBER */ #define XK_squareroot 0x100221a /* U+221A SQUARE ROOT */ #define XK_cuberoot 0x100221b /* U+221B CUBE ROOT */ #define XK_fourthroot 0x100221c /* U+221C FOURTH ROOT */ #define XK_dintegral 0x100222c /* U+222C DOUBLE INTEGRAL */ #define XK_tintegral 0x100222d /* U+222D TRIPLE INTEGRAL */ #define XK_because 0x1002235 /* U+2235 BECAUSE */ #define XK_approxeq 0x1002248 /*(U+2248 ALMOST EQUAL TO)*/ #define XK_notapproxeq 0x1002247 /*(U+2247 NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO)*/ #define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */ #define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ #endif /* XK_MATHEMATICAL */ #ifdef XK_BRAILLE #define XK_braille_dot_1 0xfff1 #define XK_braille_dot_2 0xfff2 |
︙ | ︙ | |||
2161 2162 2163 2164 2165 2166 2167 | #define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ #define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ #define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ #define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ #define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ #define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ #define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < > > > > > > > > | | | | | | | | | | | | < < < < < < < < < < < < > > > > > > > > > > > > | | | | | | | | < < < < < < < < < < < < < < < | 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 | #define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ #define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ #define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ #define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ #define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ #define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ #define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ #define XK_braille_dots_24 0x100280a /* U+280A BRAILLE PATTERN DOTS-24 */ #define XK_braille_dots_124 0x100280b /* U+280B BRAILLE PATTERN DOTS-124 */ #define XK_braille_dots_34 0x100280c /* U+280C BRAILLE PATTERN DOTS-34 */ #define XK_braille_dots_134 0x100280d /* U+280D BRAILLE PATTERN DOTS-134 */ #define XK_braille_dots_234 0x100280e /* U+280E BRAILLE PATTERN DOTS-234 */ #define XK_braille_dots_1234 0x100280f /* U+280F BRAILLE PATTERN DOTS-1234 */ #define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ #define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ #define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ #define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ #define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ #define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ #define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ #define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ #define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ #define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ #define XK_braille_dots_245 0x100281a /* U+281A BRAILLE PATTERN DOTS-245 */ #define XK_braille_dots_1245 0x100281b /* U+281B BRAILLE PATTERN DOTS-1245 */ #define XK_braille_dots_345 0x100281c /* U+281C BRAILLE PATTERN DOTS-345 */ #define XK_braille_dots_1345 0x100281d /* U+281D BRAILLE PATTERN DOTS-1345 */ #define XK_braille_dots_2345 0x100281e /* U+281E BRAILLE PATTERN DOTS-2345 */ #define XK_braille_dots_12345 0x100281f /* U+281F BRAILLE PATTERN DOTS-12345 */ #define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ #define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ #define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ #define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ #define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ #define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ #define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ #define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ #define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ #define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ #define XK_braille_dots_246 0x100282a /* U+282A BRAILLE PATTERN DOTS-246 */ #define XK_braille_dots_1246 0x100282b /* U+282B BRAILLE PATTERN DOTS-1246 */ #define XK_braille_dots_346 0x100282c /* U+282C BRAILLE PATTERN DOTS-346 */ #define XK_braille_dots_1346 0x100282d /* U+282D BRAILLE PATTERN DOTS-1346 */ #define XK_braille_dots_2346 0x100282e /* U+282E BRAILLE PATTERN DOTS-2346 */ #define XK_braille_dots_12346 0x100282f /* U+282F BRAILLE PATTERN DOTS-12346 */ #define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ #define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ #define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ #define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ #define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ #define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ #define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ #define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ #define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ #define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ #define XK_braille_dots_2456 0x100283a /* U+283A BRAILLE PATTERN DOTS-2456 */ #define XK_braille_dots_12456 0x100283b /* U+283B BRAILLE PATTERN DOTS-12456 */ #define XK_braille_dots_3456 0x100283c /* U+283C BRAILLE PATTERN DOTS-3456 */ #define XK_braille_dots_13456 0x100283d /* U+283D BRAILLE PATTERN DOTS-13456 */ #define XK_braille_dots_23456 0x100283e /* U+283E BRAILLE PATTERN DOTS-23456 */ #define XK_braille_dots_123456 0x100283f /* U+283F BRAILLE PATTERN DOTS-123456 */ #define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ #define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ #define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ #define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ #define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ #define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ #define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ #define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ #define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ #define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ #define XK_braille_dots_247 0x100284a /* U+284A BRAILLE PATTERN DOTS-247 */ #define XK_braille_dots_1247 0x100284b /* U+284B BRAILLE PATTERN DOTS-1247 */ #define XK_braille_dots_347 0x100284c /* U+284C BRAILLE PATTERN DOTS-347 */ #define XK_braille_dots_1347 0x100284d /* U+284D BRAILLE PATTERN DOTS-1347 */ #define XK_braille_dots_2347 0x100284e /* U+284E BRAILLE PATTERN DOTS-2347 */ #define XK_braille_dots_12347 0x100284f /* U+284F BRAILLE PATTERN DOTS-12347 */ #define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ #define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ #define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ #define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ #define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ #define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ #define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ #define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ #define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ #define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ #define XK_braille_dots_2457 0x100285a /* U+285A BRAILLE PATTERN DOTS-2457 */ #define XK_braille_dots_12457 0x100285b /* U+285B BRAILLE PATTERN DOTS-12457 */ #define XK_braille_dots_3457 0x100285c /* U+285C BRAILLE PATTERN DOTS-3457 */ #define XK_braille_dots_13457 0x100285d /* U+285D BRAILLE PATTERN DOTS-13457 */ #define XK_braille_dots_23457 0x100285e /* U+285E BRAILLE PATTERN DOTS-23457 */ #define XK_braille_dots_123457 0x100285f /* U+285F BRAILLE PATTERN DOTS-123457 */ #define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ #define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ #define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ #define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ #define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ #define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ #define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ #define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ #define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ #define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ #define XK_braille_dots_2467 0x100286a /* U+286A BRAILLE PATTERN DOTS-2467 */ #define XK_braille_dots_12467 0x100286b /* U+286B BRAILLE PATTERN DOTS-12467 */ #define XK_braille_dots_3467 0x100286c /* U+286C BRAILLE PATTERN DOTS-3467 */ #define XK_braille_dots_13467 0x100286d /* U+286D BRAILLE PATTERN DOTS-13467 */ #define XK_braille_dots_23467 0x100286e /* U+286E BRAILLE PATTERN DOTS-23467 */ #define XK_braille_dots_123467 0x100286f /* U+286F BRAILLE PATTERN DOTS-123467 */ #define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ #define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ #define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ #define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ #define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ #define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ #define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ #define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ #define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ #define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ #define XK_braille_dots_24567 0x100287a /* U+287A BRAILLE PATTERN DOTS-24567 */ #define XK_braille_dots_124567 0x100287b /* U+287B BRAILLE PATTERN DOTS-124567 */ #define XK_braille_dots_34567 0x100287c /* U+287C BRAILLE PATTERN DOTS-34567 */ #define XK_braille_dots_134567 0x100287d /* U+287D BRAILLE PATTERN DOTS-134567 */ #define XK_braille_dots_234567 0x100287e /* U+287E BRAILLE PATTERN DOTS-234567 */ #define XK_braille_dots_1234567 0x100287f /* U+287F BRAILLE PATTERN DOTS-1234567 */ #define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ #define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ #define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ #define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ #define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ #define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ #define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ #define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ #define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ #define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ #define XK_braille_dots_248 0x100288a /* U+288A BRAILLE PATTERN DOTS-248 */ #define XK_braille_dots_1248 0x100288b /* U+288B BRAILLE PATTERN DOTS-1248 */ #define XK_braille_dots_348 0x100288c /* U+288C BRAILLE PATTERN DOTS-348 */ #define XK_braille_dots_1348 0x100288d /* U+288D BRAILLE PATTERN DOTS-1348 */ #define XK_braille_dots_2348 0x100288e /* U+288E BRAILLE PATTERN DOTS-2348 */ #define XK_braille_dots_12348 0x100288f /* U+288F BRAILLE PATTERN DOTS-12348 */ #define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ #define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ #define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ #define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ #define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ #define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ #define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ #define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ #define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ #define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ #define XK_braille_dots_2458 0x100289a /* U+289A BRAILLE PATTERN DOTS-2458 */ #define XK_braille_dots_12458 0x100289b /* U+289B BRAILLE PATTERN DOTS-12458 */ #define XK_braille_dots_3458 0x100289c /* U+289C BRAILLE PATTERN DOTS-3458 */ #define XK_braille_dots_13458 0x100289d /* U+289D BRAILLE PATTERN DOTS-13458 */ #define XK_braille_dots_23458 0x100289e /* U+289E BRAILLE PATTERN DOTS-23458 */ #define XK_braille_dots_123458 0x100289f /* U+289F BRAILLE PATTERN DOTS-123458 */ #define XK_braille_dots_68 0x10028a0 /* U+28A0 BRAILLE PATTERN DOTS-68 */ #define XK_braille_dots_168 0x10028a1 /* U+28A1 BRAILLE PATTERN DOTS-168 */ #define XK_braille_dots_268 0x10028a2 /* U+28A2 BRAILLE PATTERN DOTS-268 */ #define XK_braille_dots_1268 0x10028a3 /* U+28A3 BRAILLE PATTERN DOTS-1268 */ #define XK_braille_dots_368 0x10028a4 /* U+28A4 BRAILLE PATTERN DOTS-368 */ #define XK_braille_dots_1368 0x10028a5 /* U+28A5 BRAILLE PATTERN DOTS-1368 */ #define XK_braille_dots_2368 0x10028a6 /* U+28A6 BRAILLE PATTERN DOTS-2368 */ #define XK_braille_dots_12368 0x10028a7 /* U+28A7 BRAILLE PATTERN DOTS-12368 */ #define XK_braille_dots_468 0x10028a8 /* U+28A8 BRAILLE PATTERN DOTS-468 */ #define XK_braille_dots_1468 0x10028a9 /* U+28A9 BRAILLE PATTERN DOTS-1468 */ #define XK_braille_dots_2468 0x10028aa /* U+28AA BRAILLE PATTERN DOTS-2468 */ #define XK_braille_dots_12468 0x10028ab /* U+28AB BRAILLE PATTERN DOTS-12468 */ #define XK_braille_dots_3468 0x10028ac /* U+28AC BRAILLE PATTERN DOTS-3468 */ #define XK_braille_dots_13468 0x10028ad /* U+28AD BRAILLE PATTERN DOTS-13468 */ #define XK_braille_dots_23468 0x10028ae /* U+28AE BRAILLE PATTERN DOTS-23468 */ #define XK_braille_dots_123468 0x10028af /* U+28AF BRAILLE PATTERN DOTS-123468 */ #define XK_braille_dots_568 0x10028b0 /* U+28B0 BRAILLE PATTERN DOTS-568 */ #define XK_braille_dots_1568 0x10028b1 /* U+28B1 BRAILLE PATTERN DOTS-1568 */ #define XK_braille_dots_2568 0x10028b2 /* U+28B2 BRAILLE PATTERN DOTS-2568 */ #define XK_braille_dots_12568 0x10028b3 /* U+28B3 BRAILLE PATTERN DOTS-12568 */ #define XK_braille_dots_3568 0x10028b4 /* U+28B4 BRAILLE PATTERN DOTS-3568 */ #define XK_braille_dots_13568 0x10028b5 /* U+28B5 BRAILLE PATTERN DOTS-13568 */ #define XK_braille_dots_23568 0x10028b6 /* U+28B6 BRAILLE PATTERN DOTS-23568 */ #define XK_braille_dots_123568 0x10028b7 /* U+28B7 BRAILLE PATTERN DOTS-123568 */ #define XK_braille_dots_4568 0x10028b8 /* U+28B8 BRAILLE PATTERN DOTS-4568 */ #define XK_braille_dots_14568 0x10028b9 /* U+28B9 BRAILLE PATTERN DOTS-14568 */ #define XK_braille_dots_24568 0x10028ba /* U+28BA BRAILLE PATTERN DOTS-24568 */ #define XK_braille_dots_124568 0x10028bb /* U+28BB BRAILLE PATTERN DOTS-124568 */ #define XK_braille_dots_34568 0x10028bc /* U+28BC BRAILLE PATTERN DOTS-34568 */ #define XK_braille_dots_134568 0x10028bd /* U+28BD BRAILLE PATTERN DOTS-134568 */ #define XK_braille_dots_234568 0x10028be /* U+28BE BRAILLE PATTERN DOTS-234568 */ #define XK_braille_dots_1234568 0x10028bf /* U+28BF BRAILLE PATTERN DOTS-1234568 */ #define XK_braille_dots_78 0x10028c0 /* U+28C0 BRAILLE PATTERN DOTS-78 */ #define XK_braille_dots_178 0x10028c1 /* U+28C1 BRAILLE PATTERN DOTS-178 */ #define XK_braille_dots_278 0x10028c2 /* U+28C2 BRAILLE PATTERN DOTS-278 */ #define XK_braille_dots_1278 0x10028c3 /* U+28C3 BRAILLE PATTERN DOTS-1278 */ #define XK_braille_dots_378 0x10028c4 /* U+28C4 BRAILLE PATTERN DOTS-378 */ #define XK_braille_dots_1378 0x10028c5 /* U+28C5 BRAILLE PATTERN DOTS-1378 */ #define XK_braille_dots_2378 0x10028c6 /* U+28C6 BRAILLE PATTERN DOTS-2378 */ #define XK_braille_dots_12378 0x10028c7 /* U+28C7 BRAILLE PATTERN DOTS-12378 */ #define XK_braille_dots_478 0x10028c8 /* U+28C8 BRAILLE PATTERN DOTS-478 */ #define XK_braille_dots_1478 0x10028c9 /* U+28C9 BRAILLE PATTERN DOTS-1478 */ #define XK_braille_dots_2478 0x10028ca /* U+28CA BRAILLE PATTERN DOTS-2478 */ #define XK_braille_dots_12478 0x10028cb /* U+28CB BRAILLE PATTERN DOTS-12478 */ #define XK_braille_dots_3478 0x10028cc /* U+28CC BRAILLE PATTERN DOTS-3478 */ #define XK_braille_dots_13478 0x10028cd /* U+28CD BRAILLE PATTERN DOTS-13478 */ #define XK_braille_dots_23478 0x10028ce /* U+28CE BRAILLE PATTERN DOTS-23478 */ #define XK_braille_dots_123478 0x10028cf /* U+28CF BRAILLE PATTERN DOTS-123478 */ #define XK_braille_dots_578 0x10028d0 /* U+28D0 BRAILLE PATTERN DOTS-578 */ #define XK_braille_dots_1578 0x10028d1 /* U+28D1 BRAILLE PATTERN DOTS-1578 */ #define XK_braille_dots_2578 0x10028d2 /* U+28D2 BRAILLE PATTERN DOTS-2578 */ #define XK_braille_dots_12578 0x10028d3 /* U+28D3 BRAILLE PATTERN DOTS-12578 */ #define XK_braille_dots_3578 0x10028d4 /* U+28D4 BRAILLE PATTERN DOTS-3578 */ #define XK_braille_dots_13578 0x10028d5 /* U+28D5 BRAILLE PATTERN DOTS-13578 */ #define XK_braille_dots_23578 0x10028d6 /* U+28D6 BRAILLE PATTERN DOTS-23578 */ #define XK_braille_dots_123578 0x10028d7 /* U+28D7 BRAILLE PATTERN DOTS-123578 */ #define XK_braille_dots_4578 0x10028d8 /* U+28D8 BRAILLE PATTERN DOTS-4578 */ #define XK_braille_dots_14578 0x10028d9 /* U+28D9 BRAILLE PATTERN DOTS-14578 */ #define XK_braille_dots_24578 0x10028da /* U+28DA BRAILLE PATTERN DOTS-24578 */ #define XK_braille_dots_124578 0x10028db /* U+28DB BRAILLE PATTERN DOTS-124578 */ #define XK_braille_dots_34578 0x10028dc /* U+28DC BRAILLE PATTERN DOTS-34578 */ #define XK_braille_dots_134578 0x10028dd /* U+28DD BRAILLE PATTERN DOTS-134578 */ #define XK_braille_dots_234578 0x10028de /* U+28DE BRAILLE PATTERN DOTS-234578 */ #define XK_braille_dots_1234578 0x10028df /* U+28DF BRAILLE PATTERN DOTS-1234578 */ #define XK_braille_dots_678 0x10028e0 /* U+28E0 BRAILLE PATTERN DOTS-678 */ #define XK_braille_dots_1678 0x10028e1 /* U+28E1 BRAILLE PATTERN DOTS-1678 */ #define XK_braille_dots_2678 0x10028e2 /* U+28E2 BRAILLE PATTERN DOTS-2678 */ #define XK_braille_dots_12678 0x10028e3 /* U+28E3 BRAILLE PATTERN DOTS-12678 */ #define XK_braille_dots_3678 0x10028e4 /* U+28E4 BRAILLE PATTERN DOTS-3678 */ #define XK_braille_dots_13678 0x10028e5 /* U+28E5 BRAILLE PATTERN DOTS-13678 */ #define XK_braille_dots_23678 0x10028e6 /* U+28E6 BRAILLE PATTERN DOTS-23678 */ #define XK_braille_dots_123678 0x10028e7 /* U+28E7 BRAILLE PATTERN DOTS-123678 */ #define XK_braille_dots_4678 0x10028e8 /* U+28E8 BRAILLE PATTERN DOTS-4678 */ #define XK_braille_dots_14678 0x10028e9 /* U+28E9 BRAILLE PATTERN DOTS-14678 */ #define XK_braille_dots_24678 0x10028ea /* U+28EA BRAILLE PATTERN DOTS-24678 */ #define XK_braille_dots_124678 0x10028eb /* U+28EB BRAILLE PATTERN DOTS-124678 */ #define XK_braille_dots_34678 0x10028ec /* U+28EC BRAILLE PATTERN DOTS-34678 */ #define XK_braille_dots_134678 0x10028ed /* U+28ED BRAILLE PATTERN DOTS-134678 */ #define XK_braille_dots_234678 0x10028ee /* U+28EE BRAILLE PATTERN DOTS-234678 */ #define XK_braille_dots_1234678 0x10028ef /* U+28EF BRAILLE PATTERN DOTS-1234678 */ #define XK_braille_dots_5678 0x10028f0 /* U+28F0 BRAILLE PATTERN DOTS-5678 */ #define XK_braille_dots_15678 0x10028f1 /* U+28F1 BRAILLE PATTERN DOTS-15678 */ #define XK_braille_dots_25678 0x10028f2 /* U+28F2 BRAILLE PATTERN DOTS-25678 */ #define XK_braille_dots_125678 0x10028f3 /* U+28F3 BRAILLE PATTERN DOTS-125678 */ #define XK_braille_dots_35678 0x10028f4 /* U+28F4 BRAILLE PATTERN DOTS-35678 */ #define XK_braille_dots_135678 0x10028f5 /* U+28F5 BRAILLE PATTERN DOTS-135678 */ #define XK_braille_dots_235678 0x10028f6 /* U+28F6 BRAILLE PATTERN DOTS-235678 */ #define XK_braille_dots_1235678 0x10028f7 /* U+28F7 BRAILLE PATTERN DOTS-1235678 */ #define XK_braille_dots_45678 0x10028f8 /* U+28F8 BRAILLE PATTERN DOTS-45678 */ #define XK_braille_dots_145678 0x10028f9 /* U+28F9 BRAILLE PATTERN DOTS-145678 */ #define XK_braille_dots_245678 0x10028fa /* U+28FA BRAILLE PATTERN DOTS-245678 */ #define XK_braille_dots_1245678 0x10028fb /* U+28FB BRAILLE PATTERN DOTS-1245678 */ #define XK_braille_dots_345678 0x10028fc /* U+28FC BRAILLE PATTERN DOTS-345678 */ #define XK_braille_dots_1345678 0x10028fd /* U+28FD BRAILLE PATTERN DOTS-1345678 */ #define XK_braille_dots_2345678 0x10028fe /* U+28FE BRAILLE PATTERN DOTS-2345678 */ #define XK_braille_dots_12345678 0x10028ff /* U+28FF BRAILLE PATTERN DOTS-12345678 */ #endif /* XK_BRAILLE */ /* * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html */ #ifdef XK_SINHALA #define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA SIGN ANUSVARAYA */ #define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA SIGN VISARGAYA */ #define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA LETTER AYANNA */ #define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA LETTER AAYANNA */ #define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA LETTER AEYANNA */ #define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA LETTER AEEYANNA */ #define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA LETTER IYANNA */ #define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA LETTER IIYANNA */ #define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA LETTER UYANNA */ #define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA LETTER UUYANNA */ #define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA LETTER IRUYANNA */ #define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA LETTER IRUUYANNA */ #define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA LETTER ILUYANNA */ #define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA LETTER ILUUYANNA */ #define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA LETTER EYANNA */ #define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA LETTER EEYANNA */ #define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA LETTER AIYANNA */ #define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA LETTER OYANNA */ #define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA LETTER OOYANNA */ #define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA LETTER AUYANNA */ #define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA LETTER ALPAPRAANA KAYANNA */ #define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA LETTER MAHAAPRAANA KAYANNA */ #define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA LETTER ALPAPRAANA GAYANNA */ #define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA LETTER MAHAAPRAANA GAYANNA */ #define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA LETTER KANTAJA NAASIKYAYA */ #define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA LETTER SANYAKA GAYANNA */ #define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA LETTER ALPAPRAANA CAYANNA */ #define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA LETTER MAHAAPRAANA CAYANNA */ #define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA LETTER ALPAPRAANA JAYANNA */ #define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA LETTER MAHAAPRAANA JAYANNA */ #define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA LETTER TAALUJA NAASIKYAYA */ #define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA LETTER TAALUJA SANYOOGA NAAKSIKYAYA */ #define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA LETTER SANYAKA JAYANNA */ #define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA LETTER ALPAPRAANA TTAYANNA */ #define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA LETTER MAHAAPRAANA TTAYANNA */ #define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA LETTER ALPAPRAANA DDAYANNA */ #define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA LETTER MAHAAPRAANA DDAYANNA */ #define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA LETTER MUURDHAJA NAYANNA */ #define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA LETTER SANYAKA DDAYANNA */ #define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA LETTER ALPAPRAANA TAYANNA */ #define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA LETTER MAHAAPRAANA TAYANNA */ #define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA LETTER ALPAPRAANA DAYANNA */ #define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA LETTER MAHAAPRAANA DAYANNA */ #define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA LETTER DANTAJA NAYANNA */ #define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA LETTER SANYAKA DAYANNA */ #define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA LETTER ALPAPRAANA PAYANNA */ #define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA LETTER MAHAAPRAANA PAYANNA */ #define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA LETTER ALPAPRAANA BAYANNA */ #define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA LETTER MAHAAPRAANA BAYANNA */ #define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA LETTER MAYANNA */ #define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA LETTER AMBA BAYANNA */ #define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA LETTER YAYANNA */ #define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA LETTER RAYANNA */ #define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA LETTER DANTAJA LAYANNA */ #define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA LETTER VAYANNA */ #define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA LETTER TAALUJA SAYANNA */ #define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA LETTER MUURDHAJA SAYANNA */ #define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA LETTER DANTAJA SAYANNA */ #define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA LETTER HAYANNA */ #define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA LETTER MUURDHAJA LAYANNA */ #define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA LETTER FAYANNA */ #define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA SIGN AL-LAKUNA */ #define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA VOWEL SIGN AELA-PILLA */ #define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA VOWEL SIGN KETTI AEDA-PILLA */ #define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA VOWEL SIGN DIGA AEDA-PILLA */ #define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA VOWEL SIGN KETTI IS-PILLA */ #define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA VOWEL SIGN DIGA IS-PILLA */ #define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA VOWEL SIGN KETTI PAA-PILLA */ #define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA VOWEL SIGN DIGA PAA-PILLA */ #define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA VOWEL SIGN GAETTA-PILLA */ #define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA VOWEL SIGN KOMBUVA */ #define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA VOWEL SIGN DIGA KOMBUVA */ #define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA VOWEL SIGN KOMBU DEKA */ #define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA */ #define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA */ #define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA */ #define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA VOWEL SIGN GAYANUKITTA */ #define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA VOWEL SIGN DIGA GAETTA-PILLA */ #define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA VOWEL SIGN DIGA GAYANUKITTA */ #define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA PUNCTUATION KUNDDALIYA */ #endif /* XK_SINHALA */ |
Changes to xlib/xbytes.h.
1 2 3 4 5 | /* * xbytes.h -- * * Declaration of table to reverse bit order of bytes. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * xbytes.h -- * * Declaration of table to reverse bit order of bytes. * * 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 _XBYTES #define _XBYTES |
︙ | ︙ |
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 © 1996 Sun Microsystems, Inc. * Copyright © 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" |
︙ | ︙ | |||
332 333 334 335 336 337 338 | #define RED(p) ((unsigned char) (p)[0]) #define GREEN(p) ((unsigned char) (p)[1]) #define BLUE(p) ((unsigned char) (p)[2]) #define US(expr) ((unsigned short) (expr)) Status XParseColor( | | | < < < | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | #define RED(p) ((unsigned char) (p)[0]) #define GREEN(p) ((unsigned char) (p)[1]) #define BLUE(p) ((unsigned char) (p)[2]) #define US(expr) ((unsigned short) (expr)) Status XParseColor( TCL_UNUSED(Display *), TCL_UNUSED(Colormap), const char *spec, XColor *colorPtr) { if (spec[0] == '#') { char *p; Tcl_WideInt value = parseHex64bit(++spec, &p); /* * If *p does not point to the end of the string, there were invalid * digits in the spec. Ergo, it is not a valid color string. |
︙ | ︙ |
Changes to xlib/xdraw.c.
1 2 3 4 5 | /* * xdraw.c -- * * This file contains generic procedures related to X drawing primitives. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * xdraw.c -- * * This file contains generic procedures related to X drawing primitives. * * 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 "tk.h" |
︙ | ︙ |
Changes to xlib/xgc.c.
1 2 3 4 5 6 | /* * xgc.c -- * * This file contains generic routines for manipulating X graphics * contexts. * | | | | < < | < < | < < < < < < < | | 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 | /* * xgc.c -- * * This file contains generic routines for manipulating X graphics * contexts. * * Copyright © 1995-1996 Sun Microsystems, Inc. * Copyright © 2002-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 "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. |
︙ | ︙ | |||
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 | static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; if (clip_mask == NULL) { clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; } return clip_mask; } /* *---------------------------------------------------------------------- * * FreeClipMask -- * * Static helper proc to free TkpClipMask. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void FreeClipMask(GC gc) { | > > > > | | > > | > > > | 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 | static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; if (clip_mask == NULL) { clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; } else if (clip_mask->type == TKP_CLIP_REGION) { TkDestroyRegion(clip_mask->value.region); } clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = None; return clip_mask; } /* *---------------------------------------------------------------------- * * FreeClipMask -- * * Static helper proc to free TkpClipMask. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void FreeClipMask(GC gc) { TkpClipMask * clip_mask = (TkpClipMask*)gc->clip_mask; if (clip_mask == NULL) { return; } if (clip_mask->type == TKP_CLIP_REGION) { TkDestroyRegion(clip_mask->value.region); } ckfree(clip_mask); gc->clip_mask = None; } /* *---------------------------------------------------------------------- * * XCreateGC -- * |
︙ | ︙ | |||
99 100 101 102 103 104 105 | * *---------------------------------------------------------------------- */ GC XCreateGC( Display *display, | | < | < < < | | 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 | * *---------------------------------------------------------------------- */ GC XCreateGC( Display *display, TCL_UNUSED(Drawable), unsigned long mask, XGCValues *values) { GC gp; /* * 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; } | < < < < < < < < < < < < < < < < < < < < < < < | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | 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. * |
︙ | ︙ | |||
254 255 256 257 258 259 260 | * Side effects: * None. * *---------------------------------------------------------------------- */ int XFreeGC( | | < < < | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | * Side effects: * None. * *---------------------------------------------------------------------- */ int XFreeGC( TCL_UNUSED(Display *), GC gc) { if (gc != NULL) { FreeClipMask(gc); ckfree(gc); } return Success; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
286 287 288 289 290 291 292 | * Each function sets some slot in the GC. * *---------------------------------------------------------------------- */ int XSetForeground( | | < < | < < | < | < < | < < | < < | < < | < < | < < | < < | < < | < < | | | < < | < < > > | < < > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | * Each function sets some slot in the GC. * *---------------------------------------------------------------------- */ int XSetForeground( TCL_UNUSED(Display *), GC gc, unsigned long foreground) { gc->foreground = foreground; return Success; } int XSetBackground( TCL_UNUSED(Display *), GC gc, unsigned long background) { gc->background = background; return Success; } int XSetDashes( TCL_UNUSED(Display *), GC gc, int dash_offset, _Xconst char *dash_list, int n) { char *p = &(gc->dashes); #ifdef TkWinDeleteBrush TkWinDeleteBrush(gc->fgBrush); TkWinDeletePen(gc->fgPen); TkWinDeleteBrush(gc->bgBrush); TkWinDeletePen(gc->fgExtPen); #endif gc->dash_offset = dash_offset; if (n > MAX_DASH_LIST_SIZE) n = MAX_DASH_LIST_SIZE; while (n-- > 0) { *p++ = *dash_list++; } *p = 0; return Success; } int XSetFunction( TCL_UNUSED(Display *), GC gc, int function) { gc->function = function; return Success; } int XSetFillRule( TCL_UNUSED(Display *), GC gc, int fill_rule) { gc->fill_rule = fill_rule; return Success; } int XSetFillStyle( TCL_UNUSED(Display *), GC gc, int fill_style) { gc->fill_style = fill_style; return Success; } int XSetTSOrigin( TCL_UNUSED(Display *), GC gc, int x, int y) { gc->ts_x_origin = x; gc->ts_y_origin = y; return Success; } int XSetFont( TCL_UNUSED(Display *), GC gc, Font font) { gc->font = font; return Success; } int XSetArcMode( TCL_UNUSED(Display *), GC gc, int arc_mode) { gc->arc_mode = arc_mode; return Success; } int XSetStipple( TCL_UNUSED(Display *), GC gc, Pixmap stipple) { gc->stipple = stipple; return Success; } int XSetLineAttributes( TCL_UNUSED(Display *), GC gc, unsigned int line_width, int line_style, int cap_style, int join_style) { gc->line_width = line_width; gc->line_style = line_style; gc->cap_style = cap_style; gc->join_style = join_style; return Success; } int XSetClipOrigin( TCL_UNUSED(Display *), GC gc, int clip_x_origin, int clip_y_origin) { gc->clip_x_origin = clip_x_origin; gc->clip_y_origin = clip_y_origin; return Success; } /* *---------------------------------------------------------------------- * * TkSetRegion, XSetClipMask, XSetClipRectangles -- * * Sets the clipping region/pixmap for a GC. * * Like the Xlib equivalent, it is safe to delete the * region after setting it into the GC. * * Results: * None. * * Side effects: * Allocates or deallocates a TkpClipMask. * *---------------------------------------------------------------------- */ int TkSetRegion( TCL_UNUSED(Display *), GC gc, TkRegion r) { if (r == NULL) { Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { TkpClipMask *clip_mask = AllocClipMask(gc); clip_mask->type = TKP_CLIP_REGION; clip_mask->value.region = r; clip_mask->value.region = TkCreateRegion(); TkpCopyRegion(clip_mask->value.region, r); } return Success; } int XSetClipMask( TCL_UNUSED(Display *), GC gc, Pixmap pixmap) { if (pixmap == None) { FreeClipMask(gc); } else { TkpClipMask *clip_mask = AllocClipMask(gc); clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = pixmap; } return Success; } int XSetClipRectangles( TCL_UNUSED(Display*), GC gc, int clip_x_origin, int clip_y_origin, XRectangle* rectangles, int n, TCL_UNUSED(int)) { TkRegion clipRgn = TkCreateRegion(); TkpClipMask * clip_mask = AllocClipMask(gc); clip_mask->type = TKP_CLIP_REGION; clip_mask->value.region = clipRgn; while (n--) { XRectangle rect = *rectangles; rect.x += clip_x_origin; rect.y += clip_y_origin; TkUnionRectWithRegion(&rect, clipRgn, clipRgn); rectangles++; } return 1; } /* * Some additional dummy functions (hopefully implemented soon). */ #if 0 Cursor |
︙ | ︙ | |||
554 555 556 557 558 559 560 | int XDrawPoints( Display *display, Drawable d, GC gc, XPoint *points, int npoints, | | < | | | | | < < < < < < | | | < < < < | | | < < < < | | | < < < < | | < < < | | | | | | | | < < < < < < < < < | | | | | < < < < < < | | < < < | < | < | < | < | | | | | | | | | | | | < < < < < < < < < < < < < | | | < < < < | | | < < < < | | | < < < < | < | | | | | | | < < < < < < < < | | | | | | | < < < < < < < < | | | | | < < < < < < | | < < | < | < < | | | | | | < < < < < < < | | | | | | < < < < < < < | < < | | | | < < < < < | < < | < < | 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 | int XDrawPoints( Display *display, Drawable d, GC gc, XPoint *points, int npoints, TCL_UNUSED(int)) { int res = Success; while (npoints-- > 0) { res = XDrawLine(display, d, gc, points[0].x, points[0].y, points[0].x, points[0].y); if (res != Success) break; ++points; } return res; } #if !defined(MAC_OSX_TK) int XDrawSegments( TCL_UNUSED(Display *), TCL_UNUSED(Drawable), TCL_UNUSED(GC), TCL_UNUSED(XSegment *), TCL_UNUSED(int)) { return BadDrawable; } #endif char * XFetchBuffer( TCL_UNUSED(Display *), TCL_UNUSED(int *), TCL_UNUSED(int)) { return (char *) 0; } Status XFetchName( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(char **)) { return Success; } Atom * XListProperties( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(int *)) { return (Atom *) 0; } int XMapRaised( TCL_UNUSED(Display *), TCL_UNUSED(Window)) { return Success; } int XQueryTextExtents( TCL_UNUSED(Display *), TCL_UNUSED(XID), TCL_UNUSED(_Xconst char *), TCL_UNUSED(int), TCL_UNUSED(int *), TCL_UNUSED(int *), TCL_UNUSED(int *), TCL_UNUSED(XCharStruct *)) { return Success; } int XReparentWindow( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(Window), TCL_UNUSED(int), TCL_UNUSED(int)) { return BadWindow; } int XUndefineCursor( TCL_UNUSED(Display *), TCL_UNUSED(Window)) { return Success; } XVaNestedList XVaCreateNestedList( TCL_UNUSED(int), ...) { return NULL; } char * XSetICValues( TCL_UNUSED(XIC), ...) { return NULL; } char * XGetICValues( TCL_UNUSED(XIC), ...) { return NULL; } void XSetICFocus( TCL_UNUSED(XIC)) { } Window XCreateWindow( TCL_UNUSED(Display *), TCL_UNUSED(Window), TCL_UNUSED(int), TCL_UNUSED(int), TCL_UNUSED(unsigned int), TCL_UNUSED(unsigned int), TCL_UNUSED(unsigned int), TCL_UNUSED(int), TCL_UNUSED(unsigned int), TCL_UNUSED(Visual *), TCL_UNUSED(unsigned long), TCL_UNUSED(XSetWindowAttributes *)) { return 0; } int XPointInRegion( TCL_UNUSED(Region), TCL_UNUSED(int), TCL_UNUSED(int)) { return 0; } int XUnionRegion( TCL_UNUSED(Region), TCL_UNUSED(Region), TCL_UNUSED(Region)) { return 0; } Region XPolygonRegion( TCL_UNUSED(XPoint *), TCL_UNUSED(int), TCL_UNUSED(int)) { return 0; } void XDestroyIC( TCL_UNUSED(XIC)) { } Cursor XCreatePixmapCursor( TCL_UNUSED(Display *), TCL_UNUSED(Pixmap), TCL_UNUSED(Pixmap), TCL_UNUSED(XColor *), TCL_UNUSED(XColor *), TCL_UNUSED(unsigned int), TCL_UNUSED(unsigned int)) { return (Cursor) NULL; } Cursor XCreateGlyphCursor( TCL_UNUSED(Display *), TCL_UNUSED(Font), TCL_UNUSED(Font), TCL_UNUSED(unsigned int), TCL_UNUSED(unsigned int), TCL_UNUSED(XColor _Xconst *), TCL_UNUSED(XColor _Xconst *)) { return (Cursor) NULL; } XFontSet XCreateFontSet( TCL_UNUSED(Display *) /* display */, TCL_UNUSED(_Xconst char *) /* base_font_name_list */, TCL_UNUSED(char ***) /* missing_charset_list */, TCL_UNUSED(int *) /* missing_charset_count */, TCL_UNUSED(char **) /* def_string */ ) { return (XFontSet)0; } void XFreeFontSet( TCL_UNUSED(Display *), /* display */ TCL_UNUSED(XFontSet) /* font_set */ ) { } void XFreeStringList( TCL_UNUSED(char **) /* list */ ) { } Status XCloseIM( TCL_UNUSED(XIM) /* im */ ) { return Success; } Bool XRegisterIMInstantiateCallback( TCL_UNUSED(Display *) /* dpy */, TCL_UNUSED(struct _XrmHashBucketRec *) /* rdb */, TCL_UNUSED(char *) /* res_name */, TCL_UNUSED(char *) /* res_class */, TCL_UNUSED(XIDProc) /* callback */, TCL_UNUSED(XPointer) /* client_data */ ) { return False; } Bool XUnregisterIMInstantiateCallback( TCL_UNUSED(Display *) /* dpy */, TCL_UNUSED(struct _XrmHashBucketRec *) /* rdb */, TCL_UNUSED(char *) /* res_name */, TCL_UNUSED(char *) /* res_class */, TCL_UNUSED(XIDProc) /* callback */, TCL_UNUSED(XPointer) /* client_data */ ) { return False; } char * XSetLocaleModifiers( TCL_UNUSED(const char *) /* modifier_list */ ) { return NULL; } XIM XOpenIM( TCL_UNUSED(Display *) /* dpy */, TCL_UNUSED(struct _XrmHashBucketRec *) /* rdb */, TCL_UNUSED(char *) /* res_name */, TCL_UNUSED(char *) /* res_class */ ) { return NULL; } char * XGetIMValues( TCL_UNUSED(XIM) /* im */, ... ) { return NULL; } char * XSetIMValues( TCL_UNUSED(XIM) /* im */, ... ) { return NULL; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to xlib/ximage.c.
1 2 3 4 5 | /* * ximage.c -- * * X bitmap and image routines. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * ximage.c -- * * X bitmap and image 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" |
︙ | ︙ | |||
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 68 69 70 71 | 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 * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to xlib/xutil.c.
1 2 3 4 5 | /* * xutil.c -- * * This function contains generic X emulation routines. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * xutil.c -- * * This function contains generic X emulation routines. * * 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" |
︙ | ︙ | |||
28 29 30 31 32 33 34 | * *---------------------------------------------------------------------- */ Atom XInternAtom( Display *display, | | | < < | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | * *---------------------------------------------------------------------- */ Atom XInternAtom( Display *display, TCL_UNUSED(_Xconst char *), TCL_UNUSED(Bool)) { static Atom atom = XA_LAST_PREDEFINED; LastKnownRequestProcessed(display)++; return ++atom; } /* *---------------------------------------------------------------------- * * XGetVisualInfo -- |
︙ | ︙ |