Skip to content

Commit 30ea3b3

Browse files
committed
ttk2 classes to tk2 classes
1 parent 7b4c26c commit 30ea3b3

7 files changed

Lines changed: 777 additions & 716 deletions

File tree

.Rbuildignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.DS_Store
2+
.gitignore
3+
.git
4+
.git/*
5+
README.md
6+
NEWS.md
7+
FAQ.md
8+
CONDUCT.md
9+
Makefile
10+
.Rprofile
11+
^\.Rproj\.user$
12+
^\.*\Rproj$
13+
^\.travis\.yml$
14+
^appveyor\.yml$
15+
^.*\.Rproj$

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# History files
2+
.Rhistory
3+
.Rapp.history
4+
5+
# Session Data files
6+
.RData
7+
.Ruserdata
8+
9+
# Example code in package build process
10+
*-Ex.R
11+
12+
# RStudio files
13+
.Rproj.user
14+
.Rproj.user/
15+
16+
# produced vignettes
17+
vignettes/*.html
18+
vignettes/*.pdf
19+
20+
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
21+
.httr-oauth
22+
23+
# Mac files
24+
.DS_Store

NEWS

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= tcltk2 news
22

3-
== Version 1.3-0
3+
== Version 1.3.0
44

55
* Message translation is completed. setLanguage()/getLanguage() work now in a
66
more robust way. getLanguage() separately reports the language used by R and
@@ -13,6 +13,8 @@
1313
configure a composer to enter such unicode character on the keyboard are added
1414
(functions tk2unicode_xxx()).
1515

16+
* All old 'ttk2xxx' widget classes are now converted into 'tk2xxx' classes.
17+
1618

1719
== Version 1.2-12
1820

@@ -30,7 +32,7 @@
3032
*not* change when the theme is changed of existing menu items (but it is for
3133
future menu items). This is due to the fact that Tk menus do not follow the
3234
ttk styling scheme.
33-
35+
3436

3537
== Version 1.2-10
3638

@@ -45,7 +47,7 @@
4547

4648
* New theme handling introduced in version 1.2-8 resulted in an invisible caret
4749
in text widget.
48-
50+
4951
* Further tweaking of color themes: now fieldbackground for entry, combobox,
5052
canvas, listbox, mclistbox, tablelist, spinbox, text and ctext widgets (build
5153
using old Tk widgets or megawidgets) now default with the correct theme color.
@@ -55,7 +57,7 @@
5557

5658
* A better handling of fonts and colors for Tk widgets according to themes used
5759
for Ttk widgets using tk2theme(). Also for menus.
58-
60+
5961
* The default font was not reset properly after switching back from radiance
6062
to another theme.
6163

@@ -67,7 +69,7 @@
6769
very simple example is also added in the document. The widget is very rich,
6870
and you will have to figure out by yourself how to access all its command from
6971
its original documentation.
70-
72+
7173
* A tk2swaplist() dialog box is added.
7274

7375

@@ -81,7 +83,7 @@
8183
tk2theme("plastik"). Note also that the 'radiance' theme permanently changes
8284
fonts used by the Ttk widgets to fonts identical, or close to those used by
8385
Ubuntu.
84-
86+
8587
* tk2theme() now tries to set the same background color for old tk widgets than
8688
the color used by ttk widgets. Suggested by Milan Bouchet-Valat.
8789

@@ -98,7 +100,7 @@
98100

99101
== Version 1.2-3
100102

101-
* The Tk configuration sequence in .onLoad() is changed.
103+
* The Tk configuration sequence in .onLoad() is changed.
102104

103105

104106
== Version 1.2-2
@@ -119,20 +121,20 @@
119121

120122
* A couple of warnings for partial argument matching in tclTaskXXX() functions
121123
under R 2.15.0 are corrected.
122-
124+
123125
* Documentation and demos for the tablelist Tk widgets are not distributed any
124126
more in the tcltk2 package, to keep its size compatible with CRAN requirements
125127
(no more than 5mb). Those are available from http://www.nemethi.de/.
126-
128+
127129

128130
== Version 1.2-0
129131

130132
* Clearlooks ttk theme added and made default theme under Linux. More modern
131133
look&feel for ttk widgets under Linux!
132-
134+
133135
* Radiance ttk theme created and added. This matches ambiance and radiance
134136
themes under Ubuntu 11.x. This is the default theme used in Ubuntu.
135-
137+
136138
* The tk widget tablelist is updated to version 5.5.
137139

138140
* tk2listbox() is completelly reworked to provide (autohide) scrollbars,
@@ -156,7 +158,7 @@
156158

157159
* Little correction in Winico.c that prevented it to compile correctly on all
158160
Windows architectures (thanks Prof. B. Ripley for the patch).
159-
161+
160162

161163
== Version 1.1-4
162164

@@ -170,7 +172,7 @@
170172

171173
* New /win/src/Makevars to make it compatible with the double compilation for
172174
Windows 32bit and 64bit. Thanks Prof. Brian Ripley.
173-
175+
174176
* Correction of the example in ?tk2reg. Thanks Tony Plate.
175177

176178
* .onload() now works inside SciViews.
@@ -187,7 +189,7 @@
187189
* A bug in tk2mclistbox, clailing for missing -state argument when selecting
188190
an item in the box is corrected, thanks to a patch provided by Christiane
189191
Raemsch (and slightly modified).
190-
192+
191193

192194
== Version 1.1-0
193195

R/tk2commands.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ tk2notetab <- function (nb, tab)
147147
w$env <- new.env()
148148
w$env$num.subwin <- 0
149149
w$env$parent <- nb
150-
class(w) <- c("ttk2notetab", "tk2container", "tkwin")
150+
class(w) <- c("tk2notetab", "tk2container", "tkwin")
151151
return(w)
152152
} else return(NULL) # Tab not found!
153153
} else stop ("'nb' must be a 'tk2notebook' object")
@@ -197,7 +197,7 @@ tk2theme <- function (theme = NULL)
197197
## First, check if the theme is already loaded... or try loading it
198198
loadedThemes <- tk2theme.list()
199199
if (!theme %in% loadedThemes) {
200-
## Could be plastik, keramik, keramik_alt, clearlooks, radiance
200+
## Could be plastik, keramik, keramik_alt, clearlooks, radiance
201201
res <- try(tclRequire(paste0("ttk::theme::", theme)), silent = TRUE)
202202
if (inherits(res, "try-error"))
203203
stop("Ttk theme ", theme, " is not found")
@@ -243,12 +243,12 @@ tk2theme <- function (theme = NULL)
243243
"throughColor", hfg),
244244
"fieldBackground",
245245
tclvalue(.Tcl("ttk::style lookup TEntry -fieldbackground")))
246-
246+
247247
## Set menu font the same as label font
248248
font <- tclvalue(.Tcl("ttk::style lookup TLabel -font"))
249249
if (!length(font) || font == "") font <- "TkDefaultFont"
250250
tk2font.set("TkMenuFont", tk2font.get(font))
251-
251+
252252
## Return the theme
253253
res <- theme
254254
}
@@ -257,10 +257,10 @@ tk2theme <- function (theme = NULL)
257257
### Note: to change a style element: .Tcl('ttk::style configure TButton -font "helvetica 24"')
258258
### Create a derived style: ttk::style configure Emergency.TButton -font "helvetica 24" -foreground red -padding 10
259259
### Changing different states:
260-
###ttk::style map TButton \
261-
### -background [list disabled #d9d9d9 active #ececec] \
262-
### -foreground [list disabled #a3a3a3] \
263-
### -relief [list {pressed !disabled} sunken] \
260+
###ttk::style map TButton \
261+
### -background [list disabled #d9d9d9 active #ececec] \
262+
### -foreground [list disabled #a3a3a3] \
263+
### -relief [list {pressed !disabled} sunken] \
264264
### ;
265265

266266
## Function to look for a ttk style
@@ -298,7 +298,7 @@ tk2style <- function (class, style, state = c("default", "active",
298298
style = paste("-", as.character(style)[1], sep = "")
299299
state = match.arg(state)
300300
if (is.null(default)) default <- ""
301-
301+
302302
## styles creates a named vector (items in even elements, labels = odd)
303303
styles <- function (x) {
304304
st <- as.character(x)
@@ -311,7 +311,7 @@ tk2style <- function (class, style, state = c("default", "active",
311311
names(st) <- stnames
312312
return(st)
313313
}
314-
314+
315315
## First look at the map for this class
316316
res <- styles(tcl("ttk::style", "map", class, style))
317317
res2 <- styles(tcl("ttk::style", "map", ".", style))
@@ -321,7 +321,7 @@ tk2style <- function (class, style, state = c("default", "active",
321321
res2 <- styles(tcl("ttk::style", "configure", ".", style))
322322
res <- c(res, res2[!names(res2) %in% names(res)])
323323
if (length(res) == 0) res <- c(default = default)
324-
324+
325325
## If state != "all", try to resolve the right state
326326
if (state != "all") {
327327
## If the given state is there, use it
@@ -384,7 +384,7 @@ tk2dataList <- function (x)
384384
tk2text = c("values", "value", "selection", "maxundo", "undo",
385385
"spacing1", "spacing2", "spacing3", "tabs", "tabstyle"),
386386
tk2tree = c("values", "value", "selection"),
387-
stop("Unknown tk2widget, provide a tk2widget object or its class")
387+
stop("Unknown tk2widget, provide a tk2widget object or its class")
388388
)
389389
## Add label, tag & tip for all
390390
res <- c(res, "label", "tag", "tip")
@@ -449,7 +449,7 @@ setLanguage <- function (lang)
449449
# If the tcl.language attribute is defined, use it
450450
tcllang <- attr(lang, "tcl.language")
451451
if (!is.null(tcllang) && tcllang[1] != "") {
452-
lang <- tcllang[1] # Use only first item
452+
lang <- tcllang[1] # Use only first item
453453
} else {
454454
# Tcl does not accept locales like en_US.UF-8: must be en_us only
455455
lang <- tolower(sub("^([^.]+)\\..*$", "\\1", lang))
@@ -469,11 +469,11 @@ getLanguage <- function ()
469469
## This is a bad hack that probably does not work all the time, but at least,
470470
## it works under Windows for getting "fr" for French language
471471
if (lang == "") lang <- tolower(substr(Sys.getlocale("LC_COLLATE"), 1, 2))
472-
472+
473473
## Try to get language information from Tcl
474474
tcllang <- try(as.character(tcl("mcpreferences")), silent = TRUE)
475475
attr(lang, "tcl.language") <- tcllang
476-
476+
477477
lang
478478
}
479479

0 commit comments

Comments
 (0)