System and method for automatically switching between writing and text input modes6833827Abstract A method and system for automatically determining when an application should switch from a writing mode to a text entry mode, and vice-versa. When a soft input panel (SIP) or input method (IM) is selected, the application is notified and enters a text entry mode. Inputting via the IM while in this mode causes a character to be sent to the application, while pen events in the application window enable text editing and the selection of text and ink data in the application widow. When the SIP is deselected, the application is notified and enters a pen (writing) mode, whereby the pen events are interpreted as digital ink strokes instead of characters. Sub-modes of the pen mode are also available, via which the pen events are used to manipulate existing ink in the application window. Visual feedback may be provided to remind the user of the current mode and/or sub-mode. Claims What is claimed is: Description TECHNICAL FIELD
Typedef struct {
DWORD cbSize
DWORD fdwFlags
RECT rcVisibleDesktop
RECT rcSipRect
DWORD dwImDataSize
Void *pvImData
} SIPINFO;
The cbSize field may be filled in by the application program 29 and indicates the size of the SIPINFO structure. This field allows for future enhancements while still maintaining backward compatibility, and indeed, the size of the SIPINFO structure may be used to indicate the version to the components of the system. The fdwFlags field represents the state information of the SIP window 50, and can be a combination of three flags. A SIPF_ON flag that is set indicates that the SIP window 50 is visible (i.e., not hidden), while a set SIPF_DOC flag indicates the SIP window 50 is docked (i.e. not floating). A set SIPF_LOCKED flag indicates that the SIP window 50 is locked, i.e., the user cannot change its visible or hidden status. Note that a given implementation may not allow floating or locked SIP windows, however the capability is present within the system. The rcVisibleDesktop field contains a rectangle, in screen coordinates, representing the area of the screen desktop 68 not obscured by the SIP window 50. If the SIP window 50 is floating (not docked), this rectangle is equivalent to the user-working area. Full-screen applications wishing to respond to SIP window 50 size changes can generally set their window rectangle data structure ("rect") values to this RECT data structure's values. If the SIP window 50 is docked and does not occupy an entire edge (top, bottom, left or right), then this rectangle represents the largest rectangle not obscured by the SIP window 50. However, the system may provide available desktop space 68 not included in the RECT data structure. Next, the rcSipRect field contains the rectangle, in screen coordinates, representing the size and location of the SIP Window 50. Applications 29 will generally not use this information, unless an application 29 wants to wrap around a floating SIP window 50 or a docked SIP window 50 that is not occupying an entire edge. The dwImDataSize field contains the size of the data pointed to by the PvImData member, which is the next field, i.e., a pointer to the Input Method-specific data. The data are defined by the Input Method 64. Whenever the state of the SIP window 50 changes, e.g., the SIP is deselected, a new Input Method has been selected and/or a visibility, docking or size change has occurred, a message, WM_SETTINGCHANGE, is sent to all top-level windows. In this manner, an application 29 can adjust itself to the new state of the SIP window 50, such as by adjusting its size in response to this message. To this end, a flag, SPI_SETSIPINFO, is sent with this message to indicate when SIP information has changed, and another flag, SPI_SETCURRENTIM, when the current Input Method has changed. The flag is tested to determine if the message is SIP-related or another type of setting change message. If SIP-related, for performance reasons, the applications that are not currently active in the foreground cache these SIP changes. If the application's window is active, the application can adjust its size and/or window. For example, as shown in FIGS. 5 and 9, when the SIP window is hidden and an active application 29 notified, the application 29 may use the additional desktop space 68 to display more information. Note that an application 29 that has cached a SIP change when inactive can query the current SIP state when activated to subsequently adjust itself in an appropriate manner in accordance with the information that is returned. To query the SIP manager 58, another function, SHSipInfo, is provided so that applications 29 can determine information about the SIP window 50 and Input Method 64. In general, if this function succeeds, the return value will be nonzero, while if this function fails, the return value will equal zero and extended error information will be available via a GetLastError( ) call. The following table sets forth the structure of this call:
SHSipInfo (
UINT uiAction
UINT uiParam
PVOID pvParam
UINT fwinIni
) ;
The uiAction parameter can include the values SIP_SETSIPINFO, SPI_GETSIPINFO, SPI_SETCURRENTIM and SPI_GETCURRENTIM. SIP_SETSIPINFO indicates that pvParam points to a SIPINFO structure (described above). The cbSize, dwImDataSize and pvImDataSize are filled in before calling the SHSipInfo function. In response to this call, the SIPINFO structure is filled in with the current SIP size, state, and visible desktop rectangle. If both dWImDataSize and pvImData are nonzero, the data size and pointer are sent to the Input Method 64. If the Input Method 64 is called but does not provide Input Method-specific data, or the format or size of the data passed in is not in a format recognized by the Input Method 64, then the SHSipInfo function call fails (returns zero). If the size and format are supported by the Input Method 64, the Input Method 64 fills in the buffer that is pointed to by pvImData with the Input Method-specific data. Typically, an application 29 will set the pvImDataSize to zero and pvImData to NULL. A uiAction of SPI_SETSIPINFO indicates that pvParam points to a SIPINFO structure. The SIP window 50 size and state are set to the values specified in the SIPINFO structure. Before changing a SIP value, the application 29 should first obtain the current SIP state by calling SHSipInfo with SPI_GETSIPINFO, then change whatever specific SIP state values it wishes to change before making the SPI_SETSIPINFO call. The cbSize field is set to the size of the SIP in the structure, and if both pvImDataSize and pvlImData are not zero, the data size and pointer are sent to the Input Method 64. The SHSipInfo call fails if the Input Method 64 is called and does not allow setting Input Method-specific data, or if the format or size of the passed data is not in a format recognized thereby. If a size and format are supported by the Input Method 64, the Input Method 64 uses the data to set Input Method-specific information. Typically, an application will set the pvImDataSize to zero and pvImData to NULL. SPI_SETCURRENTIM indicates that pvParam points to a CLSID structure which specifies the CLSID of the Input Method 64 to which the SIP will switch. If the CLSID is not valid, or if the specified Input Method 64 cannot be loaded, the call fails (return value equals zero) and a default Input Method 64 (e.g., the QWERTY-like keyboard 66) is loaded. Lastly, a uiAction of SPI_GETCURRENTIM indicates that pvParam points to a CLSID structure that receives the CLSID of the currently selected Input Method 64. The IInputMethod Interface IInputMethod is the interface implemented by the Input Method 64 components. The SIP manager 58 calls the methods of this interface to notify the Input Method 64 of state changes, and request action and information from the Input Method 64. In general, if the called method succeeds, a success is returned, and conversely, if the method fails, a failure result is returned. The following table sets forth the method calls available in this IInputMethod interface:
Interface IinputMethod : Iunknown
{
HRESULT Select( [in] HWND hwndSip );
HRESULT Deselect( void );
HRESULT Showing ( void );
HRESULT Hiding ( void );
HRESULT GetInfo ( [out] IMINFO *pimi );
HRESULT ReceiveSipInfo ( [in] SIPINFO *psi );
HRESULT RegisterCallback ( [in] IIMCallback* pIMCallback );
HRESULT GetImData ( [in] DWORD dwSize, [out]
LPVOID pvImData );
HRESULT SetImData ( [in] DWORD dwSize, [in]
LPVOID pvImData );
HRESULT UserOptionsDlg ( [in] HWND hwndParent );
}
An Input Method 64 will ordinarily receive a Select ( ), GetInfo ( ), ReceiveSipInfo ( ) and Register Callback ( ) method call, in sequence, before rendering the SIP window 50 space or responding to user actions. When the SIP window 50 is displayed (i.e., turned on), Showing ( ) will be called by the SIP manager 58, after which the Input Method 64 issues a WM_PAINT message to render the SIP window 50. The Select ( ) method is called when the Input Method 64 has been selected into the SIP. The Input Method 64 generally performs any desired initialization in response to this call. The Input Method is responsible for drawing the entire client area of the SIP window 50, and thus ordinarily creates its windows and imagelists (collections of displayable bitmaps such as customized icons) in response to this call. For example, the window handle of the SIP window 50 is provided to the Input Method 64 as a parameter accompanying this Select ( ) method call, and the Input Method normally creates a child window of this SIP window 50. The Input Method 64 is also provided with a pointer to a value, which is set to nonzero by the Input Method 64 if the method call is successful or zero if not successful. The Deselect ( ) method is called when the Input Method 64 has been selected out of the SIP. The Input Method's window should be destroyed in response to this call, and the Input Method 64 will typically perform any other cleanup at this time. The Showing ( ) method will cause the SIP window 50 to be shown upon return from the call. Note that the SIP window 50 is not visible prior to this call, and that once the SIP window 50 is shown, this window and its children will receive paint messages. Conversely, the Hiding ( ) method hides the SIP window 50 upon return from the call. Accordingly, the Showing ( ) and Hiding ( ) methods are used to toggle the SIP window 50 between its open and closed states. The GetInfo ( ) method is called when the system is requesting information about the Input Method 64. The information requested includes flags indicating any special properties of the Input Method 64, the handles of two imagelists which contain masked bitmaps that are to be displayed on the SIP button 52 when that Input Method 64 is active, indices into the specified imagelists, and a rectangle indicating the preferred size and placement of the Input Method 64. The call includes a parameter, pimi, which is a pointer to a data structure (IMINFO) that the Input Method 64 should fill in with appropriate data. The call also provides a pointer to a value that the Input Method should set to nonzero to indicate success and zero to indicate failure. More particularly, the IMINFO data structure is represented in the following table:
Typedef struct {
DWORD cbSize;
HIMAGELIST hImageNarrow;
HIMAGELIST hImageWide;
Int iNarrow;
Int iWide;
DWORD fdwFlags;
Rect rcSipRect;
} IMINFO;
The cbSize field contains the size of the IMINFO structure, and is filled in by the SIP manager 58 prior to calling GetInfo ( ). The hImageNarrow field is a handle to an imagelist containing narrow (e.g., 16.times.16) masked bitmaps for the Input Method 64. Similarly, hImageWide is a handle to the imagelist containing wide (e.g., 32.times.16) masked bitmaps. The SIP manager 58 displays one of the bitmaps (e.g., on the taskbar 56) to indicate the Input Method 64 that is currently selected. Note that the SIP manager 58 may use the narrow or wide bitmaps at various times depending on how it wishes to display the bitmap. The iNarrow field is an index into the hImageNarrow imagelist indicating which bitmap of several possible from that (narrow) imagelist should currently be displayed. Similarly, the iwide field is an index into the hImageWide imagelist indicating which bitmap from that (wide) image list should currently be displayed. Note that the Input Method 64 can initiate a change of the bitmap displayed in the SIP taskbar button 52 by calling IIMCallback::SetImages (described below). The fdwFlags field indicates the visible, docked and locked states (SIPF_ON SIPF_DOCKED and SIPF_LOCKED) of the Input Method 64, as well as any special Input Method flags that may be defined in the future. Note that the SIP state flags are ignored for the GetInfo ( ) method, but are used in the SetImInfo callback method as described below. Lastly, the rcSipRect field describes the size and placement of the SIP rectangle. The sizing and placement information returned from GetInfo ( ) may be used by the SIP when determining an initial default size and placement. When used, the SetImInfo callback method (described below) specifies the new size and placement of the SIP window 50. The ReceiveSipInfo ( ) method provides information to the Input Method 64 about the SIP window, including the current size, placement and docked status thereof. This call is made whenever the user, an application 29 or the Input Method 64 changes the SIP state. When the SIP manager 58 sends this information during Input Method initialization, the SIP manger 58 is informing the Input Method 64 of the default SIP settings. The Input Method 64 can choose to ignore these defaults, however the values given are ones that either the user has selected or values that have been recommended as expected or accepted SIP values for that platform. A pointer to the SIPINFO structure that includes this information is passed with this call. The RegisterCallback method is provided by the SIP manager 58 to pass a callback interface pointer to the Input Method 64. In other words, the RegisterCallback method call passes an IIMCallback interface pointer as a parameter to the Input Method 64, whereby the Input Method 64 can call methods on this interface to send information back to the SIP manager 58 as described below. The Input Method 64 uses the callback interface pointer to send keystrokes to applications 29 via the SIP manager 58 and to change its SIP taskbar button bitmap 52. The GetImData ( ) method is called when an application program 29 has asked the SIP for the SIPINFOdata structure and has provided a non-NULL pointer for the pvImData member of the SIPINFO structure. The application 29 will ordinarily cause this call to be made when requesting some special information from the Input Method 64. Two parameters are passed with this call, dwsize, the size of the buffer pointed to by pvImData, and pvImData, a void pointer to a block of data in the application 29. With this call, the application 29 is essentially requesting that the Input Method 64 fill the block with information, wherein the size and format of the data are defined by the Input Method 64. This call is designed for Input Methods 64 that wish to provide enhanced functionality or information to applications. By way of example, a SIP-aware application may wish to know whether a character was entered by way of the SIP or by some other means. An input method 64 can thus respond to the application's request by filling the block. The SetImData ( ) method is called when an application 29 has set the SIPINFO data structure and has provided a non-NULL pointer for the pvImData member of the SIPINFO structure. The application 29 will ordinarily cause this call to be made when requesting that the Input Method 64 set some data therein. The parameters passed with this call include dwsize, the size of the buffer pointed to by pvImData, and pvImData, a void pointer to a block of data in the application 64. The IIMCallback Interface The Input Method 64 uses the IIMCallback interface to call methods in the SIP manager 58, primarily to send keystrokes to the current application or to change the icon that the taskbar 56 is displaying in the SIP button 52. The Input Method 64 ordinarily calls the IIMCallback methods only in response to a call thereto which was received through an IInputMethod method call. In general, if the function succeeds, the return value will be a success HRESULT, while conversely, if the function fails, the return value is a failure HRESULT. The following table represents the IIMCallback Interface:
Interface IIMCallback :
Iunknown
{
Hresult SetImInfo (
IMINFO *pimi );
Hresult SendVirtualKey (
BYTE bVk,
DWORD dwFlags );
Hresult SendCharEvents (
UINT uVk,
UINT uKeyFlags,
UINT uChars,
UINT *puShift,
UINT *puChars );
Hresult SendString (
BSTR ptrzStr,
DWORD dwChars );
}
The first callback, SetImInfo ( ) is called by the Input Method 64 to change the bitmaps shown on the SIP taskbar button 52 representing the current SIP, or to change the visible/hidden state of the SIP window 50. It is also sent by the Input Method 64 to the SIP manager 58 as a notification when the Input Method 64 has changed the size, placement or docked status of the SIP window 50. By this mechanism, the various Input Methods 64 are able to alert the SIP manager 58 to these types of changes so that the two remain synchronized. By way of example, an Input Method 64 may wish to have a user interface element which allows the user to toggle between a docked state and a floating state, or between one or more subpanels (e.g. keyboard with buttons to switch to a number and/or symbol panel or international symbol panel). The Input Method 64 uses this call to inform the SIP manager 58 of each change in state. Values passed in the IMINFO structure are used by the SIP manager 58. Consequently, the Input Method 64 should first determine the current state of the SIP window 50 as provided by the SIP manager 58 in the SIPINFO structure received via a prior ReceiveSipInfo ( ) method call, described above. Then, the Input Method 64 should make changes to only those settings in which a change is desired, and pass a full set of values back in the IMINFO structure. The pimi parameter is sent as a pointer to an IMINFO structure representing the new Input Method 64 settings, including the size, placement and state of the SIP window 50 as well as the desired Input Method 64 images. In response to the SetImInfo ( ) call, the SIP manager 58 will show or hide the SIP window 50 as specified in the fdwFlags of the IMINFO structure. However, the SIP manager 58 will not resize or move the SIP window 50 if requested, but will instead update the size and placement information returned to applications 29 when queried. If the specified values represent a change from the current SIP state, the SIP manager 58 will notify applications 29 that the SIP state has changed via a WM_SETTINGCHANGE message, described above. The SendVirtualKey ( ) callback is used by an Input Method 64 to simulate a keystroke for a virtual key, e.g., a character or the like entered via the touch screen display 32 or some other Input Method 64. The key event will be sent to the window which currently has focus (i.e., the window which would have received keyboard input had a key been pressed on an external keyboard). The SendVirtualKey callback modifies the global key state for the virtual key sent, whereby, for example, an Input Method 64 can use this function to send SHIFT, CONTROL, and ALT key-up and key-down events, which will be retrieved correctly when the application 29 calls the GetKeyState ( ) API. The SendVirtualKey callback should be used to send virtual key events that do not have associated characters (i.e., keys that do not cause a WM_CHAR sent as a result of TranslateMessage. Note that WM_CHAR, TranslateMessage and other key-related messages are described in the reference "Programming Windows 95", Charles Petzold, supra). If character-producing virtual keys are sent via this function, they will be modified by the global key state. For example, a virtual key of VK.sub.-- 5 that is sent when the shift state is down will result in a `%` WM_CHAR message for certain keyboard layouts. Parameters sent with this callback include bVk, which is the virtual keycode of the key to simulate, and dwFlags. The dwFlags may be a combination of a SIPKEY_KEYUP flag, (used to generate either a WM_KEYUP or WM_KEYDOWN), a SIPKEY_SILENT flag, (the key press will not make a keyboard click even if clicks are enabled on the device), or zero. The SendCharEvent callback allows an Input Method 64 to send Unicode characters to the window having focus, while also determining what WM_KEYDOWN and WM_KEYUP messages the application 29 should receive. This allows the Input Method 64 to determine its own keyboard layout, as it can associate any virtual key with any characters and key state. Applications 29 thus see keys as if they were sent from a keyboard (i.e., they get WM_KEYDOWN, WM_CHAR, and WM_KEYUP messages). Thus, unlike the SendVirtualKey ( ) function, this function does not affect the global key state. By way of example, with the SendCharEvent callback, the Input Method 64 can determine that the shifted (virtual key) VK_C actually sent the Unicode character 0.times.5564. The shift state flag (specified in the puShift parameter, described below) that is associated with the first character to be sent determines whether a WM_KEYDOWN or WM_KEYUP is generated. Parameters include uVk, the virtual keycode sent in the WM_KEYUP or WM_KEYDOWN message generated as a result of this function, and a uKeyFlags parameter, a set of KEY state flags that are translated into the lKEYData parameter received in the WM_CHAR, WM_KEYUP or WM_KEYDOWN messages received by the application 29 as a result of this call. Only the KeyStateDownFlag, KeyStatePrevDownFlag, and KeyStateAnyAltFlag key state flags are translated into the resulting lKeyData parameter. The uChars parameter represents the number of characters corresponding to this key event, while the pushift parameter is a pointer to a buffer containing the corresponding KEY_STATE_FLAGS for each character to be sent. If the KeyStateDownFlag bit is sent, this function generates a WM_KEYDOWN message, otherwise it generates a WM_KEYUP message. Lastly, the puchars parameter is a pointer to a buffer containing the characters to be sent. An Input Method 64 may use the SendString callback to send an entire string to the window which currently has the focus, whereby a series of WM_CHAR messages are posted to the application 29. An Input Method 64 would typically use this callback after it has determined an entire character, word or sentence has been entered. For example, a handwriting recognizer or speech recognizer Input Method 64 will use the SendString callback after it has determined that a full word or sentence has been entered. Parameters of the SendString callback include ptszStr, a pointer to a string buffer containing the string to send, and dwSize, the number of characters to send. This number does not include the null-terminator, which will not be sent. Writing and Text Entry Modes In accordance with one aspect of the present invention, the selected or deselected state of the SIP window 50 is used as a basis for determining the mode for inputting user data. In general, when a SIP 50 is selected and displayed to the user, the system/application program 29 is in a text entry mode, while when deselected and not displayed, the system/application program 29 is in a writing mode. In the text entry mode, the selected input method 64 receives the user data, such as pen events or speech, and the appropriate input method 64 converts the events to text, preferably encoded as Unicode characters. The input method 64 passes the text to the application program 29 as described above (via the SendVirtualKey callback). In the writing mode, the user input is passed to the application program 29 as is, for example, as coordinate-based pen events. As shown in FIG. 5, the user may have used the text entry mode to enter text 74, and the pen mode to enter digital ink 76 such a sketch or the like, in the same application program 29 . The entered text 74 and digital ink 76 appear in a window 78 of the application program 29. In FIG. 5, wherein the pen mode is currently enabled, (text entry mode disabled), the user is made aware of the pen mode by visual feedback, including the application window 78 occupying virtually the entire device screen area for entering data therein, i.e., the absence of any SIP window. In addition, in one current preferred implementation, in the pen mode, horizontal lines 80.sub.1 -80.sub.6 are displayed across the application window 78, generally giving the user input area the appearance of lines on paper. FIG. 6 shows the text entry mode enabled wherein an input method 64 in the form of a keyboard 66 has been selected via the SIP selection button 52. For purposes of the following examples, an alphanumeric keyboard 66 and associated input method 64 will be used to illustrate the SIP-selected state for describing the text entry mode, although it is understood that another SIP/input method may be selected, such as one directed to character recognition or speech recognition. Thus, in FIG. 6, wherein the text entry mode is currently enabled (pen mode disabled), the user is made aware of the text entry mode by visual feedback, including the SIP window 50 with the bitmap image of the keyboard 66 therein. In addition, the application window 78 has been resized as described above. Moreover, in one current implementation, in the text entry mode, the horizontal lines have been removed, generally giving the user input area the appearance of a word processing application program's input area. In keeping with the invention, while in the text entry mode, a "Select" mode is automatically selected for the user. A select button 82 may be used to provide visual feedback to the user indicative of the select mode being enabled, e.g., the button may appear to the user as having been depressed. In general, user activity in the SIP window 50, presently the keyboard 66, results in text being sent to the application. Alternatively, user activity in the application window 78 results in pen events being sent to the application program 29, such as to enable text-editing operations, whereby the application program 29 appropriately interprets the events. For example, a single-tap of the pen in the application program 29 area sets a caret 84 based on the location of the tap, as shown in FIG. 6. In addition, a double-tap is interpreted as selecting a word, a triple-tap as selecting a line (or alternatively a sentence or paragraph), while another area of text may be selected by dragging the pen over it. Such editing operations are similar to those performed by conventional word processing programs. FIG. 7 shows a selection box 86 marking the selected text (word) by either the user double-tap or dragging operation. FIG. 8 shows the insertion of text, (after the deletion of the selected text in the box 86), by moving the caret 84 in front of the word "Window" and tapping keys on the keyboard 66 to enter the text "N" "e" and "w" (the caret 84 appropriately follows the entry to indicate the next insertion position). Thus, as shown in FIGS. 6-8, text may be input and edited in an intuitive manner. FIG. 9 shows the user having deselected the SIP and thereby the text entry mode, and having re-entered the pen (writing) mode to enter new digital ink and/or edit the ink in the application window 78. Note that the lines 80.sub.1 -80.sub.6 have been redisplayed, and the select mode, indicated by the button 82, is not presently enabled. At this time, any pen events entered by the user in the application window 78 are passed to the application program 29 as digital ink strokes, enabling writing operations. Such writing is visibly reflected on the screen as electronic ink. There is also a select sub-mode that can be entered while within the pen/writing mode, as shown in FIG. 10. The pen-select sub-mode is chosen by the user via a tap of the displayed select button 82. Note the horizontal lines 80.sub.1 -80.sub.6 may appear as dashed, as shown in FIG. 10, to provide additional visual feedback to the user indicative of the current pen-select mode. When in this pen-select mode, the user is able to use the pen to draw a box 88 around selected digital ink in an area of the application window 78, which may then be cut, copied, pasted, deleted, or resized, depending on subsequent user actions, (or alternatively, the user may exit the select mode without taking any action on the selected ink). For example, as shown in FIG. 11, deleting the ink in the selection box 88 clears the area bounded thereby of any digital ink. In a current preferred implementation, the pen select mode is a one-shot operation, e.g., the system returns to the regular pen mode to enable the entry of digital ink after any action (e.g., a delete or resize operation) is performed on the selected ink. Note that the horizontal lines 80.sub.1 -80.sub.6 are once again displayed as solid lines at this time, and the button 82 no longer appears depressed. The user may then enter new ink, as shown in FIG. 12, where the ink resembling "35" has been written to the approximate area where the select and delete operations took place. Another sub-mode of the pen mode is referred to as an insert space mode, or simply the space mode. The user enters the space mode by tapping a space insert button 90 (FIG. 13), which may appear as depressed to indicate the space mode. Note that the horizontal lines 80.sub.1 -80.sub.6 again appear as dashed in the present implementation, as shown in FIG. 13, to provide additional visual feedback to the user indicative of the currently active space mode. At this time, the user may use the pen to select a position for inserting space, by touching the pen to the application window 78 and dragging the pen a distance corresponding to the space to insert. FIG. 14 shows the pen having been dragged an amount to the right as indicated by the size of an arrow 92 which temporarily appears during the dragging operation to assist the user. When the pen is lifted, a space is added that corresponds to the size of the arrow, the space mode is exited, (also lines 80.sub.1 -80.sub.6 return to solid and the insert space button 90 is restored), whereby the system returns to the regular pen mode as shown in FIG. 15. At this time, the user may reenter one of the other pen sub-modes, or add additional digital ink as shown in FIG. 16, wherein the ink generally resembling a "2" has been written to the area where the space was inserted via the space mode. In accordance with one aspect of the present invention, any time that the user wishes to switch to the text entry mode while in the pen mode (including any pen sub-modes), the user simply selects a SIP via the SIP button 52 on the task bar 56, (or the button 70, which provides a pop-up window of available IMs). Conversely, while in the text entry mode, any time that the user wishes to switch to the pen mode, the user simply deselects the SIP via the SIP button 52. The SIP architecture and the application handle the resizing of the windows, the switching of the modes and the initial state of the sub-modes, and so on, whereby the user is relieved from much of the confusing manual operation. Turning to an explanation of the operation of the present invention, FIGS. 17-21 generally show how the modes are automatically switched as the user selects or deselects the SIP. In FIG. 17, the user begins in the text entry mode, either by a startup default or by having selected a SIP 50 as described above. For purposes of the following description, the selected SIP will be the keyboard 66. At step 1700, a SIP "On" message is sent whereby among other actions as described above, the system will activate the SIP window 50 and the input method will draw the keyboard 66 therein. When the application program 29 receives the message, the application program 29 resizes the application window 78 (step 1702), and then, if needed, at step 1704, restores the pen insert space mode button 90 to its popped-up position. At step 1706, the text select mode will automatically be entered for the user as described above, and the select button 82 on the display depressed to indicate the availability of the select mode. At step 1710 the caret 84 will be moved by the application program 29 to an appropriate screen location, e.g., at the end of any entered text, and the horizontal lines removed at step 1712. At this time, the system and application program 29 are ready for text entry or user editing via the select mode, and awaits further user activity, as shown in FIG. 18. At step 1800, a user event is received and action taken based thereon. It should be noted that in the present implementation, the system is event-driven. However, for purposes of simplified illustration, FIG. 18 (and similarly FIGS. 19 and 21), show the general logic for handling the user event through a series of decisions. As represented in FIG. 18 by step 1802, if the SIP has been deselected (via the button 52), the system changes to the pen mode, as described above and as represented in FIG. 20, described below. If not, steps 1804-1806 represent the action taken if the user has tapped an area in the keyboard 66, that is, typically the input method 64 converts the pen event coordinates to a corresponding key value, which is then passed as a character (e.g., Unicode) to the application. Note that in handling the user action, the input method 64 may delay or not actually send anything to the application program 29 at this time. For example, if the "CAP" key is pressed, the state of the keyboard would change to capital letters without the application program 29 ordinarily being notified. Similarly, if the input method was one that handled speech recognition, the input method would wait until one or more words were recognized or some-time-out occurred, and then send a string of characters representing those words as text to the application. In any event, after performing an action in response to the user activity in the SIP window 50 (or in the case of speech, directed thereto), step 1806 loops back to await further user input. If the pen activity was also not in the SIP window 50 (keyboard 66), step 1808 represents the detection of user activity in the application window 78, which is interpreted by the application program 29 as text-select mode activity, described below with reference to FIG. 19. If not in the application window 78, the user activity is otherwise handled, for example to close the application program 29 if the "X" box in the upper right corner is tapped and so on, events which are not particularly relevant to the present invention and is not described herein. FIG. 19 represents the detection and handling of the various pen events in the application window 78 while in the text select mode. Note that the application program 29 handles these events by receiving coordinate-based pen events over time from the operating system, and not via the input method 64. Although not necessary to the invention, a general description of how the application program 29 handles these events is provided to illustrate the direct sending of pen events to the application, to contrast the conversion of the pen events to text by an input method 64 before sending the text to the application program 29. In FIG. 19, single taps are detected and result in setting the caret (steps 1900-1902), double-taps are interpreted and used to select the word proximate the tap (steps 1904-1906), while triple taps result in a line of text being selected (steps 1908-1910). Step 1912 handles selection via the drag operation. Note that user ink such as sketches may be selected in the text entry mode via the drag operation. FIG. 20 generally shows the system operation when the pen mode is selected, such as when the SIP 50 is deselected (step 1802), as described above. At step 2000, a SIP "Off" message is sent, whereby as described above, the system will close the SIP window 50. When the application program 29 receives the "Off" message, the application program 29 resizes the application window 78 to its near-full screen rendering at step 2002, and at step 2004 restores the select mode button 90 to its popped-up position. Then, at step 2006, the pen mode will automatically be entered for the user to handle pen events directed to writing, in accordance with one aspect of the present invention and as described above. At step 2008, a pen button on the display optionally may be depressed to indicate the pen mode, (represented at step 2008 as optional by the dashed box). Note that such a pen button also may be used to manually switch between pen and text entry modes, if desired. At step 2010, the insert caret 84 or marked selection box 86, whichever is present, is removed from the application window 78 by the application program 29, and at step 2012, the horizontal lines 80.sub.1 -80.sub.6 are drawn in their solid form. At this time, the system and application program 29 are ready for and awaiting user pen activity, as shown in FIG. 21. As represented in FIG. 21 by step 2102, if the activity is the selection of a SIP/input method (via the button 52 or the button 70), the system and application program 29 automatically change to the text entry mode, in accordance with one aspect of the present invention and as described above. If not, steps 2104-2106 represent the action taken when the user's pen event or events occurred in the application window 78. At step 2106, the user activity is passed as pen events to the application, which then handles those events as shown in FIG. 22, depending on whether the pen mode is interpreting pen events as writing, or is in a writing/pen sub-mode, as described below. If the user activity was not in the application's window, step 2110 represents the detection of whether the select button 82 was tapped, and if so, toggles the select mode from off to on or on to off. Note that the appearance of the button on the display is changed by step 2112, as will the appearance of the horizontal lines 80.sub.1 -80.sub.6. Similarly, if not the select button 82, step 2114 represents the event detection of whether the space insert button 90 was tapped. If so, step 2116 toggles the space mode from off to on or on to off and also changes the appearance of the button 90 on the display and the appearance of the horizontal lines 80.sub.1 -80.sub.6. Lastly, step 2118 illustrates the handling of other pen events, such as to close the application. FIG. 22 generally shows how the application deals with pen events in the application window 78. At step 2200, if the select mode is presently active, the pen events are used to draw a box 88 (FIG. 10) around a selected area in the application window 78. Steps 2202 and 2204 draw the box 88 until the user is done, i.e., until the pen is lifted. Step 2206 the represents any action on the ink within the box 88 (such as deletion), while step 2210 exits the pen select mode since it is a one-shot operation and step 2212 restores the select button 82 and redraws the horizontal lines 80.sub.1 -80.sub.6 as solid to indicate that the select mode is no longer active. If at step 2200, the select mode was not presently active, but instead the insert space mode is active at step 2214, the pen events are used to draw the arrow 92 (FIG. 14) beginning at the pen location in the application window 78. Steps 2216 and 2218 adjust the size of the arrow 92 until the user is done, i.e., until the pen is lifted. Step 2220 then inserts the appropriate amount of space based on the size of the arrow 92, while step 2222 exits the space mode since it is a one-shot operation and step 2224 restores the insert space button 90 and redraws the horizontal lines 80.sub.1 -80.sub.6 as solid to indicate that the space mode is no longer active. Lastly, if in neither of the sub-modes, step 2228 treats the pen events as written ink, optionally parsing the ink to store it in a different form (e.g., as words). In this manner, the user is able to input writing and switch to an ink editing mode in a straightforward manner. As can be seen from the foregoing detailed description, there is provided a method and system that merge writing and text input, based on the state of an intuitively selected soft input panel. The state determines whether an application is in a text entry or ink writing/pen mode. Visual feedback is provided, and sub-modes are managed so that only straightforward and intuitive user intervention is required. While the invention is susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in the drawings and have been described above in detail. It should be understood, however, that there is no intention to limit the invention to the specific form or forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the invention.
|
Same subclass Same class Consider this |
||||||||||
