mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tcltklib/tcltklib.c: cannot compile for Tcl7.6/Tk4.2.
* ext/tcltklib/tcltklib.c: add nativethread consistency check. * ext/tcltklib/stubs.c: ditto. * ext/tk/lib/tk.rb: forgot to define TclTkIp.encoding and encoding= when Tcl is 7.6 or 8.0. * ext/tk/lib/tk/wm.rb: support to make some methods as options of root or toplevel widget. [ruby-talk:150336] * ext/tk/lib/tk/root.rb: ditto. * ext/tk/lib/tk/toplevel.rb: ditto. * ext/tk/lib/tkextlib/SUPPRT_STATUS: update RELEASE_DATE git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a97cf6eab
commit
31b2baaefe
8 changed files with 258 additions and 20 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
Thu Aug 4 18:38:36 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tcltklib/tcltklib.c: cannot compile for Tcl7.6/Tk4.2.
|
||||||
|
|
||||||
|
* ext/tcltklib/tcltklib.c: add nativethread consistency check.
|
||||||
|
|
||||||
|
* ext/tcltklib/stubs.c: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk.rb: forgot to define TclTkIp.encoding and encoding=
|
||||||
|
when Tcl is 7.6 or 8.0.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/wm.rb: support to make some methods as options of
|
||||||
|
root or toplevel widget. [ruby-talk:150336]
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/root.rb: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/toplevel.rb: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/SUPPRT_STATUS: update RELEASE_DATE
|
||||||
|
|
||||||
Thu Aug 4 08:03:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Aug 4 08:03:39 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/extmk.rb (extmake): should not modify $mflags for each
|
* ext/extmk.rb (extmake): should not modify $mflags for each
|
||||||
|
|
|
@ -24,6 +24,37 @@ _macinit()
|
||||||
|
|
||||||
/*------------------------------*/
|
/*------------------------------*/
|
||||||
|
|
||||||
|
static int nativethread_checked = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_nativethread_consistency_check(ip)
|
||||||
|
Tcl_Interp *ip;
|
||||||
|
{
|
||||||
|
if (nativethread_checked || ip == (Tcl_Interp *)NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Tcl_Eval(ip, "set ::tcl_platform(threaded)") == TCL_OK) {
|
||||||
|
#ifdef HAVE_NATIVETHREAD
|
||||||
|
/* consistent */
|
||||||
|
#else
|
||||||
|
rb_warn("Inconsistency. Loaded Tcl/Tk libraries are enabled nativethread-support. But `tcltklib' is not. The inconsistency causes SEGV or other troubles frequently.");
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#ifdef HAVE_NATIVETHREAD
|
||||||
|
rb_warning("Inconsistency.`tcltklib' is enabled nativethread-support. But loaded Tcl/Tk libraries are not. (Probably, the inconsistency doesn't cause any troubles.)");
|
||||||
|
#else
|
||||||
|
/* consistent */
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Tcl_ResetResult(ip);
|
||||||
|
|
||||||
|
nativethread_checked = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------------------*/
|
||||||
|
|
||||||
#if defined USE_TCL_STUBS && defined USE_TK_STUBS
|
#if defined USE_TCL_STUBS && defined USE_TK_STUBS
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
#if defined _WIN32 || defined __CYGWIN__
|
||||||
|
@ -158,14 +189,25 @@ Tcl_Interp *
|
||||||
ruby_tcl_create_ip_and_stubs_init(st)
|
ruby_tcl_create_ip_and_stubs_init(st)
|
||||||
int *st;
|
int *st;
|
||||||
{
|
{
|
||||||
|
Tcl_Interp *tcl_ip;
|
||||||
|
|
||||||
if (st) *st = 0;
|
if (st) *st = 0;
|
||||||
|
|
||||||
if (tcl_stubs_init_p()) {
|
if (tcl_stubs_init_p()) {
|
||||||
return Tcl_CreateInterp();
|
tcl_ip = Tcl_CreateInterp();
|
||||||
|
|
||||||
|
if (!tcl_ip) {
|
||||||
|
if (st) *st = FAIL_CreateInterp;
|
||||||
|
return (Tcl_Interp*)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
_nativethread_consistency_check(tcl_ip);
|
||||||
|
|
||||||
|
return tcl_ip;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Tcl_Interp *(*p_Tcl_CreateInterp)();
|
Tcl_Interp *(*p_Tcl_CreateInterp)();
|
||||||
Tcl_Interp *(*p_Tcl_DeleteInterp)();
|
Tcl_Interp *(*p_Tcl_DeleteInterp)();
|
||||||
Tcl_Interp *tcl_ip;
|
|
||||||
|
|
||||||
if (!tcl_dll) {
|
if (!tcl_dll) {
|
||||||
int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr);
|
int ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr);
|
||||||
|
@ -195,6 +237,8 @@ ruby_tcl_create_ip_and_stubs_init(st)
|
||||||
return (Tcl_Interp*)NULL;
|
return (Tcl_Interp*)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_nativethread_consistency_check(tcl_ip);
|
||||||
|
|
||||||
if (!Tcl_InitStubs(tcl_ip, "8.1", 0)) {
|
if (!Tcl_InitStubs(tcl_ip, "8.1", 0)) {
|
||||||
if (st) *st = FAIL_Tcl_InitStubs;
|
if (st) *st = FAIL_Tcl_InitStubs;
|
||||||
(*p_Tcl_DeleteInterp)(tcl_ip);
|
(*p_Tcl_DeleteInterp)(tcl_ip);
|
||||||
|
@ -401,6 +445,9 @@ ruby_tcl_create_ip_and_stubs_init(st)
|
||||||
if (st) *st = FAIL_CreateInterp;
|
if (st) *st = FAIL_CreateInterp;
|
||||||
return (Tcl_Interp*)NULL;
|
return (Tcl_Interp*)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_nativethread_consistency_check(tcl_ip);
|
||||||
|
|
||||||
return tcl_ip;
|
return tcl_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Oct. 24, 1997 Y. Matsumoto
|
* Oct. 24, 1997 Y. Matsumoto
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define TCLTKLIB_RELEASE_DATE "2005-08-01"
|
#define TCLTKLIB_RELEASE_DATE "2005-08-04"
|
||||||
|
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#include "rubysig.h"
|
#include "rubysig.h"
|
||||||
|
@ -141,6 +141,12 @@ tcl_global_eval(interp, cmd)
|
||||||
#undef Tcl_GlobalEval
|
#undef Tcl_GlobalEval
|
||||||
#define Tcl_GlobalEval tcl_global_eval
|
#define Tcl_GlobalEval tcl_global_eval
|
||||||
|
|
||||||
|
/* Tcl_{Incr|Decr}RefCount for tcl7.x or earlier */
|
||||||
|
#if TCL_MAJOR_VERSION < 8
|
||||||
|
#define Tcl_IncrRefCount(obj) (1)
|
||||||
|
#define Tcl_DecrRefCount(obj) (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Tcl_GetStringResult for tcl7.x or earlier */
|
/* Tcl_GetStringResult for tcl7.x or earlier */
|
||||||
#if TCL_MAJOR_VERSION < 8
|
#if TCL_MAJOR_VERSION < 8
|
||||||
#define Tcl_GetStringResult(interp) ((interp)->result)
|
#define Tcl_GetStringResult(interp) ((interp)->result)
|
||||||
|
@ -2992,16 +2998,16 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
char *cmd, *param;
|
char *cmd, *param;
|
||||||
|
#if TCL_MAJOR_VERSION < 8
|
||||||
|
char *endptr;
|
||||||
|
cmd = argv[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
DUMP1("start ip_RubyExitCommand");
|
DUMP1("start ip_RubyExitCommand");
|
||||||
|
|
||||||
#if TCL_MAJOR_VERSION >= 8
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
/* cmd = Tcl_GetString(argv[0]); */
|
/* cmd = Tcl_GetString(argv[0]); */
|
||||||
cmd = Tcl_GetStringFromObj(argv[0], (int*)NULL);
|
cmd = Tcl_GetStringFromObj(argv[0], (int*)NULL);
|
||||||
|
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
|
||||||
char *endptr;
|
|
||||||
cmd = argv[0];
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc < 1 || argc > 2) {
|
if (argc < 1 || argc > 2) {
|
||||||
|
@ -3129,6 +3135,7 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
|
||||||
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
|
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
|
||||||
|
|
||||||
} else if (objc == 2) {
|
} else if (objc == 2) {
|
||||||
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
|
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
|
||||||
"option", 0, &optionIndex) != TCL_OK) {
|
"option", 0, &optionIndex) != TCL_OK) {
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
|
@ -3142,6 +3149,14 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
|
||||||
rb_bug("ip_rbUpdateObjCmd: bad option index to UpdateOptions");
|
rb_bug("ip_rbUpdateObjCmd: bad option index to UpdateOptions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (strncmp(objv[1], "idletasks", strlen(objv[1])) != 0) {
|
||||||
|
Tcl_AppendResult(interp, "bad option \"", objv[1],
|
||||||
|
"\": must be idletasks", (char *) NULL);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef Tcl_WrongNumArgs
|
#ifdef Tcl_WrongNumArgs
|
||||||
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
|
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
|
||||||
|
@ -3281,6 +3296,7 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
|
||||||
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
|
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
|
||||||
|
|
||||||
} else if (objc == 2) {
|
} else if (objc == 2) {
|
||||||
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
|
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
|
||||||
"option", 0, &optionIndex) != TCL_OK) {
|
"option", 0, &optionIndex) != TCL_OK) {
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
|
@ -3294,6 +3310,14 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
|
||||||
rb_bug("ip_rb_threadUpdateObjCmd: bad option index to UpdateOptions");
|
rb_bug("ip_rb_threadUpdateObjCmd: bad option index to UpdateOptions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (strncmp(objv[1], "idletasks", strlen(objv[1])) != 0) {
|
||||||
|
Tcl_AppendResult(interp, "bad option \"", objv[1],
|
||||||
|
"\": must be idletasks", (char *) NULL);
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef Tcl_WrongNumArgs
|
#ifdef Tcl_WrongNumArgs
|
||||||
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
|
Tcl_WrongNumArgs(interp, 1, objv, "[ idletasks ]");
|
||||||
|
@ -4555,6 +4579,7 @@ ip_thread_tkwait(self, mode, target)
|
||||||
|
|
||||||
|
|
||||||
/* delete slave interpreters */
|
/* delete slave interpreters */
|
||||||
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
static void
|
static void
|
||||||
delete_slaves(ip)
|
delete_slaves(ip)
|
||||||
Tcl_Interp *ip;
|
Tcl_Interp *ip;
|
||||||
|
@ -4603,6 +4628,46 @@ delete_slaves(ip)
|
||||||
|
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
}
|
}
|
||||||
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
|
static void
|
||||||
|
delete_slaves(ip)
|
||||||
|
Tcl_Interp *ip;
|
||||||
|
{
|
||||||
|
int thr_crit_bup;
|
||||||
|
Tcl_Interp *slave;
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
char *slave_list;
|
||||||
|
char *slave_name;
|
||||||
|
int i, len;
|
||||||
|
|
||||||
|
DUMP1("delete slaves");
|
||||||
|
thr_crit_bup = rb_thread_critical;
|
||||||
|
rb_thread_critical = Qtrue;
|
||||||
|
|
||||||
|
if (!Tcl_InterpDeleted(ip) && Tcl_Eval(ip, "interp slaves") == TCL_OK) {
|
||||||
|
slave_list = ip->result;
|
||||||
|
if (Tcl_SplitList((Tcl_Interp*)NULL,
|
||||||
|
slave_list, &argc, &argv) == TCL_OK) {
|
||||||
|
for(i = 0; i < argc; i++) {
|
||||||
|
slave_name = argv[i];
|
||||||
|
|
||||||
|
DUMP2("delete slave:'%s'", slave_name);
|
||||||
|
|
||||||
|
slave = Tcl_GetSlave(ip, slave_name);
|
||||||
|
if (slave == (Tcl_Interp*)NULL) continue;
|
||||||
|
|
||||||
|
/* call ip_finalize */
|
||||||
|
ip_finalize(slave);
|
||||||
|
|
||||||
|
Tcl_DeleteInterp(slave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rb_thread_critical = thr_crit_bup;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* finalize operation */
|
/* finalize operation */
|
||||||
|
@ -4870,12 +4935,9 @@ static void
|
||||||
ip_wrap_namespace_command(interp)
|
ip_wrap_namespace_command(interp)
|
||||||
Tcl_Interp *interp;
|
Tcl_Interp *interp;
|
||||||
{
|
{
|
||||||
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
Tcl_CmdInfo orig_info;
|
Tcl_CmdInfo orig_info;
|
||||||
|
|
||||||
#if TCL_MAJOR_VERSION < 8
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!Tcl_GetCommandInfo(interp, "namespace", &(orig_info))) {
|
if (!Tcl_GetCommandInfo(interp, "namespace", &(orig_info))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4892,6 +4954,7 @@ ip_wrap_namespace_command(interp)
|
||||||
|
|
||||||
Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,
|
Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,
|
||||||
(ClientData) 0, (Tcl_CmdDeleteProc *)NULL);
|
(ClientData) 0, (Tcl_CmdDeleteProc *)NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5776,6 +5839,7 @@ tk_funcall(func, argc, argv, obj)
|
||||||
|
|
||||||
|
|
||||||
/* eval string in tcl by Tcl_Eval() */
|
/* eval string in tcl by Tcl_Eval() */
|
||||||
|
#if TCL_MAJOR_VERSION >= 8
|
||||||
struct call_eval_info {
|
struct call_eval_info {
|
||||||
struct tcltkip *ptr;
|
struct tcltkip *ptr;
|
||||||
Tcl_Obj *cmd;
|
Tcl_Obj *cmd;
|
||||||
|
@ -5791,6 +5855,7 @@ call_tcl_eval(arg)
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ip_eval_real(self, cmd_str, cmd_len)
|
ip_eval_real(self, cmd_str, cmd_len)
|
||||||
|
@ -7323,6 +7388,7 @@ ip_get_variable2_core(interp, argc, argv)
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
|
volatile VALUE strval;
|
||||||
|
|
||||||
/* ip is deleted? */
|
/* ip is deleted? */
|
||||||
if (deleted_ip(ptr)) {
|
if (deleted_ip(ptr)) {
|
||||||
|
@ -7500,6 +7566,7 @@ ip_set_variable2_core(interp, argc, argv)
|
||||||
#else /* TCL_MAJOR_VERSION < 8 */
|
#else /* TCL_MAJOR_VERSION < 8 */
|
||||||
{
|
{
|
||||||
CONST char *ret;
|
CONST char *ret;
|
||||||
|
volatile VALUE strval;
|
||||||
|
|
||||||
/* ip is deleted? */
|
/* ip is deleted? */
|
||||||
if (deleted_ip(ptr)) {
|
if (deleted_ip(ptr)) {
|
||||||
|
@ -8065,6 +8132,7 @@ tcltklib_compile_info()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---- initialization ----*/
|
/*---- initialization ----*/
|
||||||
void
|
void
|
||||||
Init_tcltklib()
|
Init_tcltklib()
|
||||||
|
@ -8286,6 +8354,12 @@ Init_tcltklib()
|
||||||
|
|
||||||
/* --------------------------------------------------------------- */
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* if ruby->nativethread-supprt and tcltklib->doen't,
|
||||||
|
the following will cause link-error. */
|
||||||
|
is_ruby_native_thread();
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr);
|
ret = ruby_open_tcl_dll(RSTRING(rb_argv0)->ptr);
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
case TCLTK_STUBS_OK:
|
case TCLTK_STUBS_OK:
|
||||||
|
|
|
@ -2288,6 +2288,8 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK)
|
||||||
else
|
else
|
||||||
# dummy methods
|
# dummy methods
|
||||||
class TclTkIp
|
class TclTkIp
|
||||||
|
attr_accessor :encoding
|
||||||
|
|
||||||
alias __eval _eval
|
alias __eval _eval
|
||||||
alias __invoke _invoke
|
alias __invoke _invoke
|
||||||
|
|
||||||
|
@ -4201,7 +4203,7 @@ end
|
||||||
#Tk.freeze
|
#Tk.freeze
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
RELEASE_DATE = '2005-08-03'.freeze
|
RELEASE_DATE = '2005-08-04'.freeze
|
||||||
|
|
||||||
autoload :AUTO_PATH, 'tk/variable'
|
autoload :AUTO_PATH, 'tk/variable'
|
||||||
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
||||||
|
|
|
@ -9,6 +9,11 @@ class TkRoot<TkWindow
|
||||||
include Wm
|
include Wm
|
||||||
include TkMenuSpec
|
include TkMenuSpec
|
||||||
|
|
||||||
|
def __methodcall_optkeys # { key=>method, ... }
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS
|
||||||
|
end
|
||||||
|
private :__methodcall_optkeys
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
ROOT = []
|
ROOT = []
|
||||||
def TkRoot.new(keys=nil)
|
def TkRoot.new(keys=nil)
|
||||||
|
@ -36,7 +41,18 @@ class TkRoot<TkWindow
|
||||||
super(:without_creating=>true, :widgetname=>'.'){}
|
super(:without_creating=>true, :widgetname=>'.'){}
|
||||||
end
|
end
|
||||||
root = TkCore::INTERP.tk_windows['.']
|
root = TkCore::INTERP.tk_windows['.']
|
||||||
if keys # wm commands
|
|
||||||
|
keys = _symbolkey2str(keys)
|
||||||
|
|
||||||
|
# wm commands
|
||||||
|
root.instance_eval{
|
||||||
|
__methodcall_optkeys.each{|key, method|
|
||||||
|
value = keys.delete(key.to_s)
|
||||||
|
self.__send__(method, value) if value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if keys # wm commands ( for backward comaptibility )
|
||||||
keys.each{|k,v|
|
keys.each{|k,v|
|
||||||
if v.kind_of? Array
|
if v.kind_of? Array
|
||||||
root.__send__(k,*v)
|
root.__send__(k,*v)
|
||||||
|
@ -45,6 +61,7 @@ class TkRoot<TkWindow
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
root.instance_eval(&b) if block_given?
|
root.instance_eval(&b) if block_given?
|
||||||
root
|
root
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,12 +45,22 @@ class TkToplevel<TkWindow
|
||||||
# end
|
# end
|
||||||
#################
|
#################
|
||||||
|
|
||||||
|
def __methodcall_optkeys # { key=>method, ... }
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS
|
||||||
|
end
|
||||||
|
private :__methodcall_optkeys
|
||||||
|
|
||||||
def _wm_command_option_chk(keys)
|
def _wm_command_option_chk(keys)
|
||||||
keys = {} unless keys
|
keys = {} unless keys
|
||||||
new_keys = {}
|
new_keys = {}
|
||||||
wm_cmds = {}
|
wm_cmds = {}
|
||||||
|
|
||||||
|
conf_methods = _symbolkey2str(__methodcall_optkeys())
|
||||||
|
|
||||||
keys.each{|k,v|
|
keys.each{|k,v|
|
||||||
if Wm.method_defined?(k)
|
if conf_methods.key?(k)
|
||||||
|
wm_cmds[conf_methods[k]] = v
|
||||||
|
elsif Wm.method_defined?(k)
|
||||||
case k
|
case k
|
||||||
when 'screen','class','colormap','container','use','visual'
|
when 'screen','class','colormap','container','use','visual'
|
||||||
new_keys[k] = v
|
new_keys[k] = v
|
||||||
|
|
|
@ -9,14 +9,18 @@ module Tk
|
||||||
|
|
||||||
TkCommandNames = ['wm'.freeze].freeze
|
TkCommandNames = ['wm'.freeze].freeze
|
||||||
|
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS = {}
|
||||||
|
|
||||||
def aspect(*args)
|
def aspect(*args)
|
||||||
if args.length == 0
|
if args.length == 0
|
||||||
list(tk_call_without_enc('wm', 'aspect', path))
|
list(tk_call_without_enc('wm', 'aspect', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call('wm', 'aspect', path, *args)
|
tk_call('wm', 'aspect', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['aspect'] = 'aspect'
|
||||||
|
|
||||||
def attributes(slot=nil,value=None)
|
def attributes(slot=nil,value=None)
|
||||||
if slot == nil
|
if slot == nil
|
||||||
|
@ -36,6 +40,7 @@ module Tk
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['attributes'] = 'attributes'
|
||||||
|
|
||||||
def client(name=None)
|
def client(name=None)
|
||||||
if name == None
|
if name == None
|
||||||
|
@ -46,15 +51,18 @@ module Tk
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['client'] = 'client'
|
||||||
|
|
||||||
def colormapwindows(*args)
|
def colormapwindows(*args)
|
||||||
if args.size == 0
|
if args.size == 0
|
||||||
list(tk_call_without_enc('wm', 'colormapwindows', path))
|
list(tk_call_without_enc('wm', 'colormapwindows', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'colormapwindows', path, *args)
|
tk_call_without_enc('wm', 'colormapwindows', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['colormapwindows'] = 'colormapwindows'
|
||||||
|
|
||||||
def wm_command(value=nil)
|
def wm_command(value=nil)
|
||||||
if value
|
if value
|
||||||
|
@ -65,9 +73,14 @@ module Tk
|
||||||
tk_call('wm', 'command', path)
|
tk_call('wm', 'command', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['wm_command'] = 'wm_command'
|
||||||
|
|
||||||
def deiconify(ex = true)
|
def deiconify(ex = true)
|
||||||
tk_call_without_enc('wm', 'deiconify', path) if ex
|
if ex
|
||||||
|
tk_call_without_enc('wm', 'deiconify', path)
|
||||||
|
else
|
||||||
|
self.iconify
|
||||||
|
end
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -79,6 +92,7 @@ module Tk
|
||||||
tk_call_without_enc('wm', 'focusmodel', path)
|
tk_call_without_enc('wm', 'focusmodel', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel'
|
||||||
|
|
||||||
def frame
|
def frame
|
||||||
tk_call_without_enc('wm', 'frame', path)
|
tk_call_without_enc('wm', 'frame', path)
|
||||||
|
@ -92,15 +106,18 @@ module Tk
|
||||||
tk_call_without_enc('wm', 'geometry', path)
|
tk_call_without_enc('wm', 'geometry', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['geometry'] = 'geometry'
|
||||||
|
|
||||||
def wm_grid(*args)
|
def wm_grid(*args)
|
||||||
if args.size == 0
|
if args.size == 0
|
||||||
list(tk_call_without_enc('wm', 'grid', path))
|
list(tk_call_without_enc('wm', 'grid', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'grid', path, *args)
|
tk_call_without_enc('wm', 'grid', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['wm_grid'] = 'wm_grid'
|
||||||
|
|
||||||
def group(leader = nil)
|
def group(leader = nil)
|
||||||
if leader
|
if leader
|
||||||
|
@ -110,6 +127,7 @@ module Tk
|
||||||
window(tk_call('wm', 'group', path))
|
window(tk_call('wm', 'group', path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['group'] = 'group'
|
||||||
|
|
||||||
def iconbitmap(bmp=nil)
|
def iconbitmap(bmp=nil)
|
||||||
if bmp
|
if bmp
|
||||||
|
@ -119,21 +137,33 @@ module Tk
|
||||||
image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
|
image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconbitmap'] = 'iconbitmap'
|
||||||
|
|
||||||
def iconphoto(*imgs)
|
def iconphoto(*imgs)
|
||||||
# Windows only
|
if imgs.empty?
|
||||||
tk_call_without_enc('wm', 'iconphoto', path, *imgs)
|
@wm_iconphoto = nil unless defined? @wm_iconphoto
|
||||||
self
|
return @wm_iconphoto
|
||||||
end
|
end
|
||||||
|
|
||||||
|
imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
|
||||||
|
tk_call_without_enc('wm', 'iconphoto', path, *imgs)
|
||||||
|
@wm_iconphoto = imgs
|
||||||
|
self
|
||||||
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconphoto'] = 'iconphoto'
|
||||||
|
|
||||||
def iconphoto_default(*imgs)
|
def iconphoto_default(*imgs)
|
||||||
# Windows only
|
imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
|
tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def iconify(ex = true)
|
def iconify(ex = true)
|
||||||
tk_call_without_enc('wm', 'iconify', path) if ex
|
if ex
|
||||||
|
tk_call_without_enc('wm', 'iconify', path)
|
||||||
|
else
|
||||||
|
self.deiconify
|
||||||
|
end
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -145,6 +175,7 @@ module Tk
|
||||||
image_obj(tk_call_without_enc('wm', 'iconmask', path))
|
image_obj(tk_call_without_enc('wm', 'iconmask', path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconmask'] = 'iconmask'
|
||||||
|
|
||||||
def iconname(name=nil)
|
def iconname(name=nil)
|
||||||
if name
|
if name
|
||||||
|
@ -154,15 +185,18 @@ module Tk
|
||||||
tk_call('wm', 'iconname', path)
|
tk_call('wm', 'iconname', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconname'] = 'iconname'
|
||||||
|
|
||||||
def iconposition(*args)
|
def iconposition(*args)
|
||||||
if args.size == 0
|
if args.size == 0
|
||||||
list(tk_call_without_enc('wm', 'iconposition', path))
|
list(tk_call_without_enc('wm', 'iconposition', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'iconposition', path, *args)
|
tk_call_without_enc('wm', 'iconposition', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconposition'] = 'iconposition'
|
||||||
|
|
||||||
def iconwindow(win = nil)
|
def iconwindow(win = nil)
|
||||||
if win
|
if win
|
||||||
|
@ -173,24 +207,29 @@ module Tk
|
||||||
(w == '')? nil: window(w)
|
(w == '')? nil: window(w)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['iconwindow'] = 'iconwindow'
|
||||||
|
|
||||||
def maxsize(*args)
|
def maxsize(*args)
|
||||||
if args.size == 0
|
if args.size == 0
|
||||||
list(tk_call_without_enc('wm', 'maxsize', path))
|
list(tk_call_without_enc('wm', 'maxsize', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'maxsize', path, *args)
|
tk_call_without_enc('wm', 'maxsize', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['maxsize'] = 'maxsize'
|
||||||
|
|
||||||
def minsize(*args)
|
def minsize(*args)
|
||||||
if args.size == 0
|
if args.size == 0
|
||||||
list(tk_call_without_enc('wm', 'minsize', path))
|
list(tk_call_without_enc('wm', 'minsize', path))
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'minsize', path, *args)
|
tk_call_without_enc('wm', 'minsize', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['minsize'] = 'minsize'
|
||||||
|
|
||||||
def overrideredirect(mode=None)
|
def overrideredirect(mode=None)
|
||||||
if mode == None
|
if mode == None
|
||||||
|
@ -200,6 +239,7 @@ module Tk
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['overrideredirect'] = 'overrideredirect'
|
||||||
|
|
||||||
def positionfrom(who=None)
|
def positionfrom(who=None)
|
||||||
if who == None
|
if who == None
|
||||||
|
@ -210,6 +250,7 @@ module Tk
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['positionfrom'] = 'positionfrom'
|
||||||
|
|
||||||
def protocol(name=nil, cmd=nil, &b)
|
def protocol(name=nil, cmd=nil, &b)
|
||||||
if cmd
|
if cmd
|
||||||
|
@ -226,14 +267,33 @@ module Tk
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def protocols(kv=nil)
|
||||||
|
unless kv
|
||||||
|
ret = {}
|
||||||
|
self.protocol.each{|name|
|
||||||
|
ret[name] = self.protocol(name)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
unless kv.kind_of?(Hash)
|
||||||
|
fail ArgumentError, 'expect a hash of protocol=>command'
|
||||||
|
end
|
||||||
|
kv.each{|k, v| self.protocol(k, v)}
|
||||||
|
self
|
||||||
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['protocols'] = 'protocols'
|
||||||
|
|
||||||
def resizable(*args)
|
def resizable(*args)
|
||||||
if args.length == 0
|
if args.length == 0
|
||||||
list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
|
list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
|
||||||
else
|
else
|
||||||
|
args = args[0] if args.length == 1 && args[0].kind_of?(Array)
|
||||||
tk_call_without_enc('wm', 'resizable', path, *args)
|
tk_call_without_enc('wm', 'resizable', path, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['resizable'] = 'resizable'
|
||||||
|
|
||||||
def sizefrom(who=None)
|
def sizefrom(who=None)
|
||||||
if who == None
|
if who == None
|
||||||
|
@ -244,6 +304,7 @@ module Tk
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['sizefrom'] = 'sizefrom'
|
||||||
|
|
||||||
def stackorder
|
def stackorder
|
||||||
list(tk_call('wm', 'stackorder', path))
|
list(tk_call('wm', 'stackorder', path))
|
||||||
|
@ -265,6 +326,7 @@ module Tk
|
||||||
tk_call_without_enc('wm', 'state', path)
|
tk_call_without_enc('wm', 'state', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['state'] = 'state'
|
||||||
|
|
||||||
def title(str=nil)
|
def title(str=nil)
|
||||||
if str
|
if str
|
||||||
|
@ -274,6 +336,7 @@ module Tk
|
||||||
tk_call('wm', 'title', path)
|
tk_call('wm', 'title', path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['title'] = 'title'
|
||||||
|
|
||||||
def transient(master=nil)
|
def transient(master=nil)
|
||||||
if master
|
if master
|
||||||
|
@ -283,9 +346,14 @@ module Tk
|
||||||
window(tk_call_without_enc('wm', 'transient', path))
|
window(tk_call_without_enc('wm', 'transient', path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
TOPLEVEL_METHODCALL_OPTKEYS['transient'] = 'transient'
|
||||||
|
|
||||||
def withdraw(ex = true)
|
def withdraw(ex = true)
|
||||||
tk_call_without_enc('wm', 'withdraw', path) if ex
|
if ex
|
||||||
|
tk_call_without_enc('wm', 'withdraw', path)
|
||||||
|
else
|
||||||
|
self.deiconify
|
||||||
|
end
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
[ current support status of Tcl/Tk extensions ]
|
[ current support status of Tcl/Tk extensions ]
|
||||||
|
|
||||||
*******<<< RELEASE_DATE of the libraries : 2005/06/16 >>>*******
|
*******<<< RELEASE_DATE of the libraries : 2005/08/04 >>>*******
|
||||||
|
|
||||||
The following list shows *CURRENT* status when this file was modifyed
|
The following list shows *CURRENT* status when this file was modifyed
|
||||||
at last. If you want to add other Tcl/Tk extensions to the planed list
|
at last. If you want to add other Tcl/Tk extensions to the planed list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue