Check-in [321a6b8100]

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

Overview
Comment:Some base work.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:321a6b8100d813cf130fb83874167e3871f24b67
User & Date: stephanie.gawroriski 2019-05-17 15:30:04
Context
2019-05-17
15:46
Corrections to EnforcedDrawingAreaGraphics. check-in: 25a8f8aa02 user: stephanie.gawroriski tags: trunk
15:30
Some base work. check-in: 321a6b8100 user: stephanie.gawroriski tags: trunk
14:55
Repaint the display if fullscreen mode changed. check-in: db62efa65d user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/event/EventTranslate.java.

69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
				// Map these keys to standard keys
			case Canvas.KEY_UP:		return Canvas.UP;
			case Canvas.KEY_DOWN:	return Canvas.DOWN;
			case Canvas.KEY_LEFT:	return Canvas.LEFT;
			case Canvas.KEY_RIGHT:	return Canvas.RIGHT;
			
				// Map these character keys to specific keys

			case ' ':			return Canvas.FIRE;
			case 'a': case 'A':
			case 'h': case 'H':	return Canvas.GAME_A;
			case 's': case 'S':
			case 'j': case 'J':	return Canvas.GAME_B;
			case 'd': case 'D':
			case 'k': case 'K':	return Canvas.GAME_C;
			case 'f': case 'F':







>
|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
				// Map these keys to standard keys
			case Canvas.KEY_UP:		return Canvas.UP;
			case Canvas.KEY_DOWN:	return Canvas.DOWN;
			case Canvas.KEY_LEFT:	return Canvas.LEFT;
			case Canvas.KEY_RIGHT:	return Canvas.RIGHT;
			
				// Map these character keys to specific keys
			case ' ':
			case '\n':			return Canvas.FIRE;
			case 'a': case 'A':
			case 'h': case 'H':	return Canvas.GAME_A;
			case 's': case 'S':
			case 'j': case 'J':	return Canvas.GAME_B;
			case 'd': case 'D':
			case 'k': case 'K':	return Canvas.GAME_C;
			case 'f': case 'F':

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/ActiveDisplay.java.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
192
193
194
195
196
197
198














199
200
201
202
203
204
205
	/** The height of the display. */
	protected final int height;
	
	/** The backing buffer image. */
	protected final Image image;
	
	/** The displayable to draw. */
	private volatile Displayable _current;
	
	/** Vibrate the display? */
	private volatile boolean _invibrate;
	
	/** Vibration end time. */
	private volatile long _vibrateend;
	
................................................................................
	{
		// Get display details
		Graphics dg = this.image.getGraphics();
		int dw = this.width,
			dh = this.height;
		
		// Current displayable to draw
		Displayable current = this._current;
		
		// Get commands that are used, this is used to figure out if the
		// command bar needs to be drawn
		Command[] commands = (current == null ? new Command[0] :
			current.getCommands());
		int numcommands = commands.length;
		
................................................................................
			dg.setColor(StandardMetrics.BACKGROUND_BAR_COLOR);
			dg.fillRect(0, cy, dw, StandardMetrics.COMMAND_BAR_HEIGHT);
		}
		
		// Restore parameters
		dg.setFont(oldfont);
		dg.setColor(oldcolor);














		
		// If nothing is being shown, just show the version info
		if (current == null)
		{
			// Draw box
			ug.setColor(0x0000FF);
			ug.fillRect(0, 0, uw, uh);







|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
	/** The height of the display. */
	protected final int height;
	
	/** The backing buffer image. */
	protected final Image image;
	
	/** The displayable to draw. */
	volatile Displayable _current;
	
	/** Vibrate the display? */
	private volatile boolean _invibrate;
	
	/** Vibration end time. */
	private volatile long _vibrateend;
	
................................................................................
	{
		// Get display details
		Graphics dg = this.image.getGraphics();
		int dw = this.width,
			dh = this.height;
		
		// Current displayable to draw
		ExposedDisplayable current = (ExposedDisplayable)this._current;
		
		// Get commands that are used, this is used to figure out if the
		// command bar needs to be drawn
		Command[] commands = (current == null ? new Command[0] :
			current.getCommands());
		int numcommands = commands.length;
		
................................................................................
			dg.setColor(StandardMetrics.BACKGROUND_BAR_COLOR);
			dg.fillRect(0, cy, dw, StandardMetrics.COMMAND_BAR_HEIGHT);
		}
		
		// Restore parameters
		dg.setFont(oldfont);
		dg.setColor(oldcolor);
		
		// Send resize to the display before drawing it?
		int oldcw = this._contentwidth,
			oldch = this._contentheight;
		if (oldcw != uw || oldch != uh)
		{
			// Set new size
			this._contentwidth = uw;
			this._contentheight = uh;
			
			// And send it now
			if (current != null)
				current.sizeChanged(uw, uh);
		}
		
		// If nothing is being shown, just show the version info
		if (current == null)
		{
			// Draw box
			ug.setColor(0x0000FF);
			ug.fillRect(0, 0, uw, uh);

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/ExposedDisplayable.java.

6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22











23
24
25
26
27
28
29
..
37
38
39
40
41
42
43

































44
45
46
47
48
49
50
51
52
53
54
55
56


57










// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;

import javax.microedition.lcdui.Graphics;

/**
 * This is a base class for items which need to be exposed action wise and
 * such. All methods here by default do nothing.
 *
 * @since 2019/05/17
 */
public abstract class ExposedDisplayable
{











	/**
	 * Is this widget a full-screen one?
	 *
	 * @return If this is full-screen or not.
	 * @since 2019/05/17
	 */
	protected boolean isFullscreen()
................................................................................
	 * @return If the display is transparent.
	 * @since 2019/05/17
	 */
	protected boolean isTransparent()
	{
		return true;
	}

































	
	/**
	 * This is called when the displayable needs to be painted onto the
	 * screen.
	 *
	 * @param __g The graphics to draw into.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void paint(Graphics __g)
	{
	}
}




















>










>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












|
>
>
|
>
>
>
>
>
>
>
>
>
>
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
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.lcdui.SerializedEvent;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Graphics;

/**
 * This is a base class for items which need to be exposed action wise and
 * such. All methods here by default do nothing.
 *
 * @since 2019/05/17
 */
public abstract class ExposedDisplayable
{
	/**
	 * Gets the commands which are available to use.
	 *
	 * @return The available commands.
	 * @since 2019/05/17
	 */
	public Command[] getCommands()
	{
		return new Command[0];
	}
	
	/**
	 * Is this widget a full-screen one?
	 *
	 * @return If this is full-screen or not.
	 * @since 2019/05/17
	 */
	protected boolean isFullscreen()
................................................................................
	 * @return If the display is transparent.
	 * @since 2019/05/17
	 */
	protected boolean isTransparent()
	{
		return true;
	}
	
	/**
	 * This is called when a key has been pressed.
	 *
	 * @param __code The key code, the character is not modified by modifiers.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void keyPressed(int __code)
	{
	}
	
	/**
	 * This is called when a key has been released.
	 *
	 * @param __code The key code, the character is not modified by modifiers.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void keyReleased(int __code)
	{
	}
	
	/**
	 * This is called when a key has been repeated.
	 *
	 * @param __code The key code, the character is not modified by modifiers.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void keyRepeated(int __code)
	{
	}
	
	/**
	 * This is called when the displayable needs to be painted onto the
	 * screen.
	 *
	 * @param __g The graphics to draw into.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void paint(Graphics __g)
	{
	}
	
	/**
	 * This is called when the size of the displayable has changed.
	 *
	 * @param __w The new width of the displayable.
	 * @param __h The new heigh of the displayable.
	 * @since 2019/05/17
	 */
	@SerializedEvent
	protected void sizeChanged(int __w, int __h)
	{
	}
}

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/NativeUIBackend.java.

7
8
9
10
11
12
13

14
15


16
17
18
19
20
21
22
..
75
76
77
78
79
80
81










82
83
84
85
86
87
88
...
163
164
165
166
167
168
169
170








































171
172
173
174
175
176
177
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;

import cc.squirreljme.runtime.lcdui.gfx.AcceleratedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;


import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This is a backend which utilizes the SquirrelJME UI interface for all of
 * the related drawing applications.
 *
................................................................................
		
		// Set the active display
		this._activedisplay = __ad;
		
		// Register self for event callbacks
		NativeDisplayAccess.registerEventCallback(this);
	}










	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/16
	 */
	@Override
	public final void command(int __d, int __c)
................................................................................
	public final void keyEvent(int __d, int __ty, int __kc, int __ch,
		int __time)
	{
		// Not our display?
		if (__d != this.nid)
			return;
		
		todo.TODO.note("Implement");








































	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/16
	 */
	@Override







>


>
>







 







>
>
>
>
>
>
>
>
>
>







 







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







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.phoneui;

import cc.squirreljme.runtime.cldc.asm.NativeDisplayAccess;
import cc.squirreljme.runtime.cldc.asm.NativeDisplayEventCallback;
import cc.squirreljme.runtime.lcdui.event.NonStandardKey;
import cc.squirreljme.runtime.lcdui.gfx.AcceleratedGraphics;
import cc.squirreljme.runtime.lcdui.gfx.PixelFormat;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/**
 * This is a backend which utilizes the SquirrelJME UI interface for all of
 * the related drawing applications.
 *
................................................................................
		
		// Set the active display
		this._activedisplay = __ad;
		
		// Register self for event callbacks
		NativeDisplayAccess.registerEventCallback(this);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/17
	 */
	@Override
	public final int capabilities()
	{
		return NativeDisplayAccess.capabilities(this.nid);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/16
	 */
	@Override
	public final void command(int __d, int __c)
................................................................................
	public final void keyEvent(int __d, int __ty, int __kc, int __ch,
		int __time)
	{
		// Not our display?
		if (__d != this.nid)
			return;
		
		// No display active?
		ActiveDisplay activedisplay = this._activedisplay;
		if (activedisplay == null)
			return;
		
		// No displayable shown?
		Displayable current = activedisplay._current;
		if (current == null)
			return;
		
		// Normalize all key types to mobile cell phone format, if not
		// specified
		if (__ch == '#')
			__kc = Canvas.KEY_POUND;
		else if (__ch == '*')
			__kc = Canvas.KEY_STAR;
		else if (__ch >= '0' && __ch <= '9')
			__kc = Canvas.KEY_NUM0 + (__ch - '0');
			
		// If the key-code is not valid then ignore
		if (__kc == NonStandardKey.UNKNOWN)
			return;
		
		// Depends on the action
		switch (__ty)
		{
			case NativeDisplayEventCallback.KEY_PRESSED:
				current.keyPressed(__kc);
				break;
			
			case NativeDisplayEventCallback.KEY_REPEATED:
				current.keyRepeated(__kc);
				break;
			
			case NativeDisplayEventCallback.KEY_RELEASED:
				current.keyReleased(__kc);
				break;
			
			default:
				break;
		}
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/05/16
	 */
	@Override

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/PhoneDisplayBackend.java.

25
26
27
28
29
30
31








32
33
34
35
36
37
38
	 * @param __ad The active display to draw into.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	public abstract void activate(ActiveDisplay __ad)
		throws NullPointerException;
	








	/**
	 * Returns if the display is upside-down, this is used for orientation
	 * purposes.
	 *
	 * @return If the display is upside-down.
	 * @since 2019/05/16
	 */







>
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	 * @param __ad The active display to draw into.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/05/16
	 */
	public abstract void activate(ActiveDisplay __ad)
		throws NullPointerException;
	
	/**
	 * Returns the capabilities of the display.
	 *
	 * @return The display capabilities.
	 * @since 2019/05/17
	 */
	public abstract int capabilities();
	
	/**
	 * Returns if the display is upside-down, this is used for orientation
	 * purposes.
	 *
	 * @return If the display is upside-down.
	 * @since 2019/05/16
	 */

Changes to runt/apis/midp-lcdui/javax/microedition/lcdui/Canvas.java.

591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
	 * {@inheritDoc}
	 * @since 2017/02/10
	 */
	@Override
	@SerializedEvent
	protected void sizeChanged(int __w, int __h)
	{
		super.sizeChanged(__w, __h);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/02
	 */
	@Deprecated







<







591
592
593
594
595
596
597

598
599
600
601
602
603
604
	 * {@inheritDoc}
	 * @since 2017/02/10
	 */
	@Override
	@SerializedEvent
	protected void sizeChanged(int __w, int __h)
	{

	}
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/02
	 */
	@Deprecated

Changes to runt/apis/midp-lcdui/javax/microedition/lcdui/Display.java.

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
	 *
	 * @return A bit field where set bits indicate supported capabilities, if
	 * {@code 0} is returned then only a {@link Canvas} is supported.
	 * @since 2016/10/08
	 */
	public int getCapabilities()
	{
		throw new todo.TODO();
		/*
		// For simplicity only the first display supports input events of
		// any kind
		int mask = 0xFFFF_FFFF;
		if (this._nid != 0)
			mask &= ~(SUPPORTS_INPUT_EVENTS);
		
		// Use the capabilities of the native display, but since SquirrelJME
		// manages pretty much everything in a framebuffer every display will
		// always have certain capabilities
		return (NativeDisplayAccess.capabilities(this._nid) |
			SUPPORTS_COMMANDS | SUPPORTS_FORMS | SUPPORTS_TICKER |
			SUPPORTS_ALERTS | SUPPORTS_LISTS | SUPPORTS_TEXTBOXES |
			SUPPORTS_FILESELECTORS | SUPPORTS_TABBEDPANES |
			SUPPORTS_MENUS) & mask;
		*/
	}
	
	/**
	 * Returns the color used for the specified interface item.
	 *
	 * The value values are:
	 * {@link #COLOR_BACKGROUND},







<
<
<
<
<
<
<
<



|



|
<







333
334
335
336
337
338
339








340
341
342
343
344
345
346
347

348
349
350
351
352
353
354
	 *
	 * @return A bit field where set bits indicate supported capabilities, if
	 * {@code 0} is returned then only a {@link Canvas} is supported.
	 * @since 2016/10/08
	 */
	public int getCapabilities()
	{








		// Use the capabilities of the native display, but since SquirrelJME
		// manages pretty much everything in a framebuffer every display will
		// always have certain capabilities
		return (this._backend.capabilities() |
			SUPPORTS_COMMANDS | SUPPORTS_FORMS | SUPPORTS_TICKER |
			SUPPORTS_ALERTS | SUPPORTS_LISTS | SUPPORTS_TEXTBOXES |
			SUPPORTS_FILESELECTORS | SUPPORTS_TABBEDPANES |
			SUPPORTS_MENUS);

	}
	
	/**
	 * Returns the color used for the specified interface item.
	 *
	 * The value values are:
	 * {@link #COLOR_BACKGROUND},