Tk Library Source Code

Changes On Branch dia-pdf
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch dia-pdf Excluding Merge-Ins

This is equivalent to a diff from a2667b5658 to 04b7108ed8

2015-01-10
18:49
* scripts/tablelistBind.tcl: Made the "handleMotion" proc more robust. check-in: 79bc7d57e3 user: csaba tags: trunk
2015-01-05
17:37
Ticket [88507dbd48]. Fixes to the canvas/pdf format, and the diagram viewer itself (error reporting). Leaf check-in: 04b7108ed8 user: andreask tags: dia-pdf
17:27
Merged latest trunk work to the diagram/pdf work. check-in: 6f2e578daa user: andreask tags: dia-pdf
2015-01-04
13:41
* CHANGES.txt: Eliminated the non-ASCII characters. check-in: a2667b5658 user: csaba tags: trunk
13:29
* CHANGES.txt: Eliminated the non-ASCII characters. check-in: aa7a445b36 user: csaba tags: trunk

Changes to apps/diagram-viewer.man.

73
74
75
76
77
78
79
80



81
82
83
84
85
86
87
the file.

[arg_def (handle) format in]

This argument specifies the image format to convert the diagrams into
when processing the input. The application recognizes all formats
supported by the [package Img] package, i.e. for which it can load a
package [package img::[var format]]




[arg_def path inputfile in]

This argument specifies the path to the diagram file to process. It
has to exist, must be readable, and written in [term diagram] format.

[list_end]







|
>
>
>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
the file.

[arg_def (handle) format in]

This argument specifies the image format to convert the diagrams into
when processing the input. The application recognizes all formats
supported by the [package Img] package, i.e. for which it can load a
package [package img::[var format]] (together with [package canvas::snap]),
and all formats for which it can load a package
[package canvas::[var format]]. These are (currently) [const mvg],
and [const pdf].

[arg_def path inputfile in]

This argument specifies the path to the diagram file to process. It
has to exist, must be readable, and written in [term diagram] format.

[list_end]

Added modules/canvas/canvas_pdf.man.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
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
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin canvas::pdf n 1]
[keywords canvas]
[keywords graphics]
[keywords imagemagick]
[keywords {portable document format}]
[keywords pdf]
[keywords {print screen}]
[keywords serialization]
[keywords {vector graphics}]
[copyright {2014 Andreas Kupries, Arjen Markus}]
[copyright {2014 Documentation, Andreas Kupries}]
[moddesc   {Variations on a canvas}]
[titledesc {Canvas to PDF}]
[require Tcl 8.5]
[require Tk 8.5]
[require canvas::pdf [opt 1]]
[require pdf4tcl]
[description]

This package provides a command to convert a canvas' contents to
Adobe's PDF vector format.

[section API]

[list_begin definitions]

[call [cmd ::canvas::pdf] [arg pathName]]

Dump the contents of the canvas [arg pathName]. The result is a string
in Adobe's PDF.

[list_end]
[vset CATEGORY canvas]
[include ../../support/devel/doc/feedback.inc]
[manpage_end]

Added modules/canvas/canvas_pdf.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
# *- tcl -*-
# ### ### ### ######### ######### #########

# Copyright (c) 2014 andreas Kupries, Arjen Markus
# OLL licensed (http://wiki.tcl.tk/10892).

# ### ### ### ######### ######### #########
## Requisites

package require Tcl 8.5
package require Tk  8.5
package require pdf4tcl
package require fileutil

namespace eval ::canvas {}

# ### ### ### ######### ######### #########
## Implementation.

proc ::canvas::pdf {canvas} {
    #raise [winfo toplevel $canvas] 
    #update

    set tmp [fileutil::tempfile canvas_pdf_]

    # Note: The paper dimensions are hardcoded. A bit less than A7,
    # looks like. This looks to be something which could be improved
    # on.

    # Note 2: We go through a temp file to write the pdf, and load it
    # back into memory for the caller to use.

    set pdf [::pdf4tcl::new %AUTO% -paper {9.5c 6.0c}]
    $pdf canvas $canvas -width 9.2c
    $pdf write -file $tmp
    $pdf destroy

    set data [fileutil::cat $tmp]
    file delete $tmp

    return $data
}

# ### ### ### ######### ######### #########
## Helper commands. Internal.

# ### ### ### ######### ######### #########
## Ready

package provide canvas::pdf 1.0.1
return

Changes to modules/canvas/pkgIndex.tcl.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded canvas::sqmap 0.3.1 [list source [file join $dir canvas_sqmap.tcl]]
package ifneeded canvas::zoom  0.2.1 [list source [file join $dir canvas_zoom.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} { return }
package ifneeded canvas::drag                0.1   [list source [file join $dir canvas_drag.tcl]]
package ifneeded canvas::edit::points        0.1   [list source [file join $dir canvas_epoints.tcl]]
package ifneeded canvas::edit::polyline      0.1   [list source [file join $dir canvas_epolyline.tcl]]
package ifneeded canvas::edit::quadrilateral 0.1   [list source [file join $dir canvas_equad.tcl]]
package ifneeded canvas::gradient            0.2   [list source [file join $dir canvas_gradient.tcl]]
package ifneeded canvas::highlight           0.1   [list source [file join $dir canvas_highlight.tcl]]
package ifneeded canvas::mvg                 1     [list source [file join $dir canvas_mvg.tcl]]

package ifneeded canvas::snap                1.0.1 [list source [file join $dir canvas_snap.tcl]]
package ifneeded canvas::tag                 0.1   [list source [file join $dir canvas_tags.tcl]]
package ifneeded canvas::track::lines        0.1   [list source [file join $dir canvas_trlines.tcl]]











>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if {![package vsatisfies [package provide Tcl] 8.4]} {return}
package ifneeded canvas::sqmap 0.3.1 [list source [file join $dir canvas_sqmap.tcl]]
package ifneeded canvas::zoom  0.2.1 [list source [file join $dir canvas_zoom.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} { return }
package ifneeded canvas::drag                0.1   [list source [file join $dir canvas_drag.tcl]]
package ifneeded canvas::edit::points        0.1   [list source [file join $dir canvas_epoints.tcl]]
package ifneeded canvas::edit::polyline      0.1   [list source [file join $dir canvas_epolyline.tcl]]
package ifneeded canvas::edit::quadrilateral 0.1   [list source [file join $dir canvas_equad.tcl]]
package ifneeded canvas::gradient            0.2   [list source [file join $dir canvas_gradient.tcl]]
package ifneeded canvas::highlight           0.1   [list source [file join $dir canvas_highlight.tcl]]
package ifneeded canvas::mvg                 1     [list source [file join $dir canvas_mvg.tcl]]
package ifneeded canvas::pdf                 1.0.1 [list source [file join $dir canvas_pdf.tcl]]
package ifneeded canvas::snap                1.0.1 [list source [file join $dir canvas_snap.tcl]]
package ifneeded canvas::tag                 0.1   [list source [file join $dir canvas_tags.tcl]]
package ifneeded canvas::track::lines        0.1   [list source [file join $dir canvas_trlines.tcl]]

Changes to modules/diagrams/application.tcl.

44
45
46
47
48
49
50

51





52
53
54
55
56
57
58
    application::ProcessCmdline $arguments
    application::Run::$mode
    return
}

proc ::diagram::application::showerror {text} {
    global argv0

    puts stderr "$argv0: $text"





    exit 1
}

# # ## ### ##### ######## ############# #####################
## Internal data and status

namespace eval ::diagram::application {







>
|
>
>
>
>
>







44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    application::ProcessCmdline $arguments
    application::Run::$mode
    return
}

proc ::diagram::application::showerror {text} {
    global argv0
    if {[catch {package present Tk}]} {
        puts stderr "$argv0: $text"
    } else {
        tk_messageBox -type ok -icon error \
	    -title "Error in application" \
	    -message "$argv0: $text"
    }
    exit 1
}

# # ## ### ##### ######## ############# #####################
## Internal data and status

namespace eval ::diagram::application {
462
463
464
465
466
467
468
469
470
    }] 0]/double(1e6)}]
    puts "... completed in $sec seconds."
    after 100
    return $dip
}

# # ## ### ##### ######## ############# #####################
package provide diagram::application 1.2
return







|

468
469
470
471
472
473
474
475
476
    }] 0]/double(1e6)}]
    puts "... completed in $sec seconds."
    after 100
    return $dip
}

# # ## ### ##### ######## ############# #####################
package provide diagram::application 1.3
return

Changes to modules/diagrams/pkgIndex.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if {![package vsatisfies [package provide Tcl] 8.5]} {
    # PRAGMA: returnok
    return
}
package ifneeded diagram::navigation  1 [list source [file join $dir navigation.tcl]]
package ifneeded diagram::direction   1 [list source [file join $dir direction.tcl]]
package ifneeded diagram::element     1 [list source [file join $dir element.tcl]]
package ifneeded diagram::attribute   1 [list source [file join $dir attributes.tcl]]
package ifneeded diagram::point       1 [list source [file join $dir point.tcl]]
package ifneeded diagram::core        1 [list source [file join $dir core.tcl]]
package ifneeded diagram::basic   1.0.1 [list source [file join $dir basic.tcl]]
package ifneeded diagram              1 [list source [file join $dir diagram.tcl]]

package ifneeded diagram::application 1.2 [list source [file join $dir application.tcl]]














|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if {![package vsatisfies [package provide Tcl] 8.5]} {
    # PRAGMA: returnok
    return
}
package ifneeded diagram::navigation  1 [list source [file join $dir navigation.tcl]]
package ifneeded diagram::direction   1 [list source [file join $dir direction.tcl]]
package ifneeded diagram::element     1 [list source [file join $dir element.tcl]]
package ifneeded diagram::attribute   1 [list source [file join $dir attributes.tcl]]
package ifneeded diagram::point       1 [list source [file join $dir point.tcl]]
package ifneeded diagram::core        1 [list source [file join $dir core.tcl]]
package ifneeded diagram::basic   1.0.1 [list source [file join $dir basic.tcl]]
package ifneeded diagram              1 [list source [file join $dir diagram.tcl]]

package ifneeded diagram::application 1.3 [list source [file join $dir application.tcl]]