Author: René Zaumseil <[email protected]>
State: Deferred
Type: Project
Vote: Done
Created: 5-Jun-2018
Post-History:
Keywords: Tk
Tcl-Version: 9.0
Tk-Branch: tip-510
Vote-Summary: Rejected 1/3/1
Votes-For: DKF
Votes-Against: KBK, JN, FV
Votes-Present: BG
Vote-Comments: code not yet ready, needs porting to macOS; alternate
might be to just co-distribute, just as TDBC is with Tcl
This tip depends on TIP #556. It is deferred until TIP #556 is accepted.
Abstract
Rbc aka "Refactored BLT Components" have graph widgets and Tk commands which are missing in Tk.
Tkpath is a 2D-canvas like widget modelled after SVG.
This TIP intends to add the following commands to Tk:
rbc::graph, rbc::stripchart and rbc::barchart as graph
To get the original functionality a -style option will be added. This option can only be set on creation time.
rbc::vector as graph::vector
The vector is currently only used inside the graph widget. The namespace hidden version leaves room for a first class command with the same name.
rbc::winop snap as tk snap
Only the snap functionality is needed here. The busy command already exists as "tk busy" :)
tkp::canvas as path
The new path widget will contain the SVG like items and an additional window item to include other windows. Support functions will be placed in the ::path namespace.
New oo::class like widgets tko::frame, tko::labelframe and tko::toplevel
The new widgets will contain the same functionalite like the original tk widgets. They are oo:class's and it is possible to add,change and delte methods and options dynamically. The widgets could also be used as oo superclass's.
New tko::widget oo base class for widgets.
The class provide the extended cget/configure tcl methods (see
tkoWidget.n.md
) and a C interface (seetkoWidget.3.md
) to build new widgets.
Rationale
Rbc commands
Tk has already adopted some of BLT/Rbc commands. Still missing are the above mentioned commands.
Rbc is available on sourceforge and github, but the development is stalled.
BLT, the orignal source, is at sourceforge. The author G. Howlett makes sporadic changes. Then there are large times without activity. It is not possible to estimate when a new version will be ready.
Modernizing Rbc and including it in Tk will give some great new widgets. There is also less risk because Rbc is already used in different projects.
Tkpath
The original developer of Tkpath passed away. There are some mirrors, but with no real development. More information could be found on https://wiki.tcl-lang.org/page/tkpath.
The intent of Tkpath was to substitute the Tk canvas. This leads to problems with advanced features (matrix transformations). Therefore the new path widget will only contain SVG like items. The only exception is the window item. This item is necessary to embed other widgets.
oo::class like widgets
Currently there is no megawidget support core package. These tip will go some steps in this direction. With widgets as oo::class's we can easyly extent existing widgets, just use it as a superclass. The provided cget/configure methods allow add, delete and changing of options. The implementation can be used in C and in Tcl.
The new widgets graph and path are also implemented as oo::class. This will make it easy to extent the functionality. As an example see the file .../library/graph.tcl
in which the method binding of the graph widget is implemented.
Implementation
A patch implementing these changes is available in the fossil repository in the tip-510 branch.
Documentation
Documentation is available in md-Format in the .../doc/ directory.
tkoWidget.3.md
C interfacetkoWidget.n.md
Tcl interfacepath.n.md
path widget documentationgraph.n.md
graph widget documentationvector.n.md
graph::vector command documentation
C interface
C-source interface files are in .../generic/tko/
. No functionality is currently exported.
tkoWidget.h
tko::widget C functions and definitions.tkoPath.h
path widgettkoGraph.h
graph widget
C sources
C-source code files are in .../generic/tko/
. The new files are added to the makefiles. The calls to the initialization functions are added in tkWindow.c
tkoFrame.c
tko::frame, tko::labelframe and tko::toplevel implementationtkoGraph*.[ch]
graph widget implementationtkoVector*.[ch]
graph::vector command implementationtkoRbc*.[ch]
Additional Rbc commands used in graph and graph::vectortkoGraph*.[ch]
path widget implementationtkoWidget.c
tko::widget base class implementation
Tcl sources
Tcl-source code is in .../library/
. The new files are added into tk.tcl
.
Tests
Test files are available in the .../tests/tko/ directory.
tkoFrame.test
tests from the tk frame.test file plus additional oo::class related teststkoGraph.test
graph widget teststkoGraph_vector.test
graph::vector command teststkoPath.test
path widget tests
Test binaries
- Linux: https://sourceforge.net/projects/kbskit/files/tip510/kbs_tip510
- Windows: https://sourceforge.net/projects/kbskit/files/tip510/kbs_tip510.exe
Discussion
See also discussion at the wiki.
A first voting was rejected, mostly because of the missing Mac implementation. See:
http://code.activestate.com/lists/tcl-core/20357/
http://code.activestate.com/lists/tcl-core/20368/
and with some analysis from Donal:
http://code.activestate.com/lists/tcl-core/20384/
Open issues
- Mac implementation of graph widget. May be borrow code from path
- Remove or change old code in
generic/tko/*
files http://code.activestate.com/lists/tcl-core/20384/ - Hardcoded usage of compiler and libraries in
win/Makefile.in
,win/makefile.vc
andunix/Makefile.in
(search for "#RZ TODO"). - Add path files in Mac implementation. It works at least in Androwish.
- Which platforms should be used in path
- SDL/AGG: platform independent, more work is needed using
tkoPath_SDLAGG.cpp
. See in Androwish - GDI+ on Windows => working with
tkoPath_WinGDIPlus.cpp
- Cairo on unix => working with
tkoPath_UnixCairo.c
- For Mac see
tkoPath_MacOSX.c
- SDL/AGG: platform independent, more work is needed using
- Provide demos
- Add more path tests
- Is it necessary to translate the documentation into man format?
- It is currently not possible to use unique abbreviations of class method names p.e. "graph .g; .g conf" A workaround would be to add all those method names. May be this can be solved in tcl::oo directly?
Any help especially with the Mac implementation would be great!
And could please look someone with configure
foo at the Makefile's
Alternatives
- Wait on new BLT.
- Develop widgets in extensions.
Copyright
This document has been placed in the public domain.