Check-in [1929277a70]
Not logged in

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

Overview
Comment:Clipboard+color stuff
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1929277a701f9cf53a051433b270c25dfe9bd897
User & Date: bernd 2014-07-01 19:14:21.937
Context
2014-07-01
22:58
More version depending stuff, color done right check-in: 378ea8426f user: bernd tags: trunk
19:14
Clipboard+color stuff check-in: 1929277a70 user: bernd tags: trunk
2014-06-30
23:28
Clipboard words (require Andriod 4.x) check-in: 279f834ea3 user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to gl-terminal.fs.
119
120
121
122
123
124
125





126

127

128
129
130
131
132
133
134
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;






: >white White std-bg! White err-bg! Black fg! Red err-fg! ;

: >black Black std-bg! Black err-bg! White fg! Red err-fg! ;

>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!







>
>
>
>
>
|
>
|
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >extra-colors-bg ( -- ) >bg
    err-color  $F0F and over or to err-color
    info-color $F0F and over or to info-color
    warn-color $F0F and over or to warn-color drop ;

: >white White std-bg! White err-bg! Black fg! Red err-fg!
    White >extra-colors-bg ;
: >black Black std-bg! Black err-bg! White fg! Red err-fg!
    Black >extra-colors-bg ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
Changes to gles2/gl-terminal.fs.
119
120
121
122
123
124
125





126

127

128
129
130
131
132
133
134
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;






: >white White std-bg! White err-bg! Black fg! Red err-fg! ;

: >black Black std-bg! Black err-bg! White fg! Red err-fg! ;

>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!







>
>
>
>
>
|
>
|
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
    count s>f $FF fm/
    count s>f $FF fm/
    count s>f $FF fm/
    c@    s>f $FF fm/ glClearColor ;

: std-bg! ( index -- )  dup bg! dup std-bg ! bg>clear ;

: >extra-colors-bg ( -- ) >bg
    err-color  $F0F and over or to err-color
    info-color $F0F and over or to info-color
    warn-color $F0F and over or to warn-color drop ;

: >white White std-bg! White err-bg! Black fg! Red err-fg!
    White >extra-colors-bg ;
: >black Black std-bg! Black err-bg! White fg! Red err-fg!
    Black >extra-colors-bg ;
>black \ make black default

128 Value videocols
0   Value videorows

2Variable gl-xy  0 0 gl-xy 2!
2Variable gl-wh 24 80 gl-wh 2!
Changes to gles2/jni-helper.fs.
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
\ show/hide keyboard using jni tools

require jni-tools.fs

also android also jni

app obj @ Value clazz

: gforth-class: ( -- )
    clazz env tuck JNIEnv-getObjectClass() to jniclass ;





gforth-class:

\ jni-sfield: INPUT_METHOD_SERVICE INPUT_METHOD_SERVICE Ljava/lang/String;
\ jni-sfield: POWER_SERVICE POWER_SERVICE Ljava/lang/String;
: INPUT_METHOD_SERVICE js" input_method" ;
: POWER_SERVICE        js" power" ;

jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object;
jni-method: getWindow getWindow ()Landroid/view/Window;
jni-method: hideProgress hideProgress ()V
jni-method: showIME showIME ()V
jni-method: hideIME hideIME ()V
jni-field: clipboardManager clipboardManager Landroid/content/ClipboardManager;

jni-class: android/app/Activity
jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager;

jni-class: android/view/WindowManager
jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display;












>
>
>
>












|







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
\ show/hide keyboard using jni tools

require jni-tools.fs

also android also jni

app obj @ Value clazz

: gforth-class: ( -- )
    clazz env tuck JNIEnv-getObjectClass() to jniclass ;

jni-class: android/os/Build$VERSION

jni-sfield: SDK_INT SDK_INT I

gforth-class:

\ jni-sfield: INPUT_METHOD_SERVICE INPUT_METHOD_SERVICE Ljava/lang/String;
\ jni-sfield: POWER_SERVICE POWER_SERVICE Ljava/lang/String;
: INPUT_METHOD_SERVICE js" input_method" ;
: POWER_SERVICE        js" power" ;

jni-method: getSystemService getSystemService (Ljava/lang/String;)Ljava/lang/Object;
jni-method: getWindow getWindow ()Landroid/view/Window;
jni-method: hideProgress hideProgress ()V
jni-method: showIME showIME ()V
jni-method: hideIME hideIME ()V
jni-field: clipboardManager clipboardManager Landroid/text/ClipboardManager;

jni-class: android/app/Activity
jni-method: getWindowManager getWindowManager ()Landroid/view/WindowManager;

jni-class: android/view/WindowManager
jni-method: getDefaultDisplay getDefaultDisplay ()Landroid/view/Display;

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
jni-method: getPressure getPressure (I)F

jni-class: java/util/List

jni-method: l-get get (I)Ljava/lang/Object;
jni-method: l-size size ()I







jni-class: android/content/ClipboardManager

jni-method: getPrimaryClip getPrimaryClip ()Landroid/content/ClipData;
jni-method: hasPrimaryClip hasPrimaryClip ()Z

jni-class: android/content/ClipData

jni-method: getItemCount getItemCount ()I
jni-method: getItemAt getItemAt (I)Landroid/content/ClipData$Item;

jni-class: android/content/ClipData$Item

jni-method: getText getText ()Ljava/lang/CharSequence;
jni-method: getIntent getIntent ()Landroid/content/Intent;
jni-method: getHtmlText getHtmlText ()Ljava/lang/String;
jni-method: getUri getUri ()Landroid/net/Uri;
\ jni-method: coerceToText coerceToText ()Ljava/lang/CharSequence;





jni-class: java/lang/CharSequence

jni-method: toString toString ()Ljava/lang/String;

: l[] ( n list -- object )  >o l-get o> ;
: l# ( list -- n )  >o l-size o> ;

: l-map ( xt list -- )  >o { xt } ( -- )
    l-size 0 ?DO  I l-get >o xt execute ref>  LOOP o> ;

Variable kbflag kbflag on

: hidekb ( -- )  clazz >o hideIME o> kbflag off ;
: showkb ( -- )  clazz >o showIME o> kbflag on ;

: togglekb ( -- )
    kbflag @ IF  hidekb  ELSE  showkb  THEN ;


: getclip? ( addr u -- 0 0 )
    clazz .clipboardManager >o






    hasPrimaryClip IF
	getPrimaryClip >o
	getItemCount IF
	    0 getItemAt >o
	    getText dup IF
		>o toString jstring>sstring ref>
	    ELSE  0  THEN
	    ref>
	ELSE  0 0  THEN
	ref>
    ELSE 0 0 THEN o> ;

: paste ( -- )
    getclip? dup IF  inskeys  ELSE  2drop  THEN ;

0 [IF]
jni-class: android/os/PowerManager
jni-method: newWakeLock newWakeLock (ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;








>
>
>
>
>
>
|
|
|
|
|
|

|
|
|
|
|
|
|
<
|
|
>
>
>
>



















>
|
|
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|







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
jni-method: getPressure getPressure (I)F

jni-class: java/util/List

jni-method: l-get get (I)Ljava/lang/Object;
jni-method: l-size size ()I

SDK_INT 10 u<= [IF] \ 2.3.x uses a different clipboard manager
    jni-class: android/text/ClipboardManager

    jni-method: hasText hasText ()Z
    jni-method: getText getText ()Ljava/lang/CharSequence;
[ELSE]
    jni-class: android/content/ClipboardManager
    
    jni-method: getPrimaryClip getPrimaryClip ()Landroid/content/ClipData;
    jni-method: hasPrimaryClip hasPrimaryClip ()Z
    
    jni-class: android/content/ClipData

    jni-method: getItemCount getItemCount ()I
    jni-method: getItemAt getItemAt (I)Landroid/content/ClipData$Item;
    
    jni-class: android/content/ClipData$Item
    
    jni-method: getText getText ()Ljava/lang/CharSequence;
    jni-method: getIntent getIntent ()Landroid/content/Intent;

    jni-method: getUri getUri ()Landroid/net/Uri;
    jni-method: coerceToText coerceToText (Landroid/content/Context;)Ljava/lang/CharSequence;
    SDK_INT 16 u>= [IF]
	jni-method: getHtmlText getHtmlText ()Ljava/lang/String;
    [THEN]
[THEN]

jni-class: java/lang/CharSequence

jni-method: toString toString ()Ljava/lang/String;

: l[] ( n list -- object )  >o l-get o> ;
: l# ( list -- n )  >o l-size o> ;

: l-map ( xt list -- )  >o { xt } ( -- )
    l-size 0 ?DO  I l-get >o xt execute ref>  LOOP o> ;

Variable kbflag kbflag on

: hidekb ( -- )  clazz >o hideIME o> kbflag off ;
: showkb ( -- )  clazz >o showIME o> kbflag on ;

: togglekb ( -- )
    kbflag @ IF  hidekb  ELSE  showkb  THEN ;

SDK_INT 10 u<= [IF]
    : getclip? ( -- addr u / 0 0 )
	clazz .clipboardManager >o
	hasText IF
	    getText >o toString jstring>sstring ref>
	ELSE  0 0  THEN  ref> ;
[ELSE]
    : getclip? ( -- addr u / 0 0 )
	clazz .clipboardManager >o
	hasPrimaryClip IF
	    getPrimaryClip >o
	    getItemCount IF
		0 getItemAt >o
		getText dup IF
		    >o toString jstring>sstring ref>
		ELSE  0  THEN
		ref>
	    ELSE  0 0  THEN
	    ref>
	ELSE 0 0 THEN ref> ;
[THEN]
: paste ( -- )
    getclip? dup IF  inskeys  ELSE  2drop  THEN ;

0 [IF]
jni-class: android/os/PowerManager
jni-method: newWakeLock newWakeLock (ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;