📄 touchscreen.c
字号:
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_event_table[MMI_PEN_EVENT_MOVE] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_up_handler
* DESCRIPTION
* Register the Pen Up handler.
* PARAMETERS
* pen_fp [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_up_handler(mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_event_table[MMI_PEN_EVENT_UP] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_abort_handler
* DESCRIPTION
* Register the Pen Abort handler.
* PARAMETERS
* pen_fp [IN]
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_abort_handler(mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_event_table[MMI_PEN_EVENT_ABORT] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_start_capture_strokes
* DESCRIPTION
* Win32 port of mmi_pen_start_capture_strokes
* PARAMETERS
* max_points [IN] Maximum number of points can be en-queued.
* point_array [IN] Array for storing sampled points in strokes.
* num_regions [IN] Number of handwriting regions
* region_array [IN] Handwriting regions
* ext_region [IN] Handwriting region after the first stroke is generated. (NULL to ignore it)
* RETURNS
* void
*****************************************************************************/
void mmi_pen_start_capture_strokes(
kal_uint32 max_points,
mmi_pen_point_struct *point_array,
kal_uint32 num_regions,
const mmi_pen_handwriting_area_struct *region_array,
const mmi_pen_handwriting_area_struct *ext_region)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Multi-block mode does not have extended region. Otherwise, it cannot switch to another
block and multi-block feature is broken. */
// kal_print("mmi_pen_start_capture_strokes11111");
MMI_ASSERT(ext_region == NULL || num_regions == 1);
if (num_regions > MMI_PEN_MAX_HANDWRITING_REGION)
{
num_regions = MMI_PEN_MAX_HANDWRITING_REGION;
}
g_pen_num_stroke_area = num_regions;
memcpy(g_pen_stroke_areas, region_array, sizeof(mmi_pen_handwriting_area_struct) * num_regions);
if (ext_region)
{
g_pen_ext_stroke_area = *ext_region;
}
else
{
g_pen_ext_stroke_area.x1 = -1;
g_pen_ext_stroke_area.x2 = -1;
g_pen_ext_stroke_area.y1 = -1;
g_pen_ext_stroke_area.y2 = -1;
}
if (num_regions == 1)
{
g_pen_stroke_min_offset = MMI_PEN_STROKE_MIN_OFFSET;
}
else
{
g_pen_stroke_min_offset = 0;
}
g_pen_stroke_max_points = max_points;
g_pen_stroke_points = point_array;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_change_handwriting_area
* DESCRIPTION
* Win32 port of mmi_pen_change_handwriting_area
* PARAMETERS
* num_regions [IN] Number of handwriting regions
* region_array [IN] Handwriting regions
* ext_region [IN] Handwriting region after the first stroke is generated. (NULL to ignore it)
* RETURNS
* void
*****************************************************************************/
void mmi_pen_change_handwriting_area(
kal_uint32 num_regions,
const mmi_pen_handwriting_area_struct *region_array,
const mmi_pen_handwriting_area_struct *ext_region)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (g_pen_stroke_max_points == 0) /* Handwriting is not enabled */
{
/* MMI_DBG_ASSERT(0); */
return;
}
/* Multi-block mode does not have extended region */
MMI_ASSERT(ext_region == NULL || num_regions == 1);
if (num_regions > MMI_PEN_MAX_HANDWRITING_REGION)
{
num_regions = MMI_PEN_MAX_HANDWRITING_REGION;
}
g_pen_num_stroke_area = num_regions;
memcpy(g_pen_stroke_areas, region_array, sizeof(mmi_pen_handwriting_area_struct) * num_regions);
if (ext_region)
{
g_pen_ext_stroke_area = *ext_region;
}
else
{
g_pen_ext_stroke_area.x1 = -1;
g_pen_ext_stroke_area.x2 = -1;
g_pen_ext_stroke_area.y1 = -1;
g_pen_ext_stroke_area.y2 = -1;
}
if (num_regions == 1)
{
g_pen_stroke_min_offset = MMI_PEN_STROKE_MIN_OFFSET;
}
else
{
g_pen_stroke_min_offset = 0;
}
/*
* We will call mmi_pen_reset() *later* on Pen Up or Stroke Up event.
*
* There might be many pending events in driver queue if MMI task is blocked by
* other time-consuming jobs. If there are pending stroke events in driver queue,
* it is better to flush driver queue.
*
*/
if (!g_pen_cntx.is_pen_down)
{
/* Clear strokes */
// kal_print("mmi_pen_change_handwriting_area test end strokes555");
mmi_pen_end_strokes_of_character();
mmi_pen_reset();
mmi_pen_begin_strokes_of_character();
}
else
{
/*
* NOTE: we *cannot* call mmi_pen_reset().
*
* For example, assume mmi_pen_change_handwriting_area() is invoked on Button Down.
* If we invoke mmi_pen_reset() here, it will send MMI_PEN_EVENT_ABORT and reset the button.
*/
g_pen_cntx.reset_stroke_on_pen_up = 1;
}
}
/*****************************************************************************
* FUNCTION
* mmi_pen_stop_capture_strokes
* DESCRIPTION
* Stop capturing stroke
*
* Note: it should be used before mmi_pen_reset() because it does not flush driver pen queue
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_pen_stop_capture_strokes(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_num_stroke_area = 0;
g_pen_stroke_max_points = 0;
g_pen_stroke_points = NULL;
/*
* We will call mmi_pen_reset() *later* on Pen Up or Stroke Up event.
*
* There might be many pending events in driver queue if MMI task is blocked by
* other time-consuming jobs. If there are pending stroke events in driver queue,
* it is better to flush driver queue.
*
*/
if (!g_pen_cntx.is_pen_down)
{
mmi_pen_reset();
}
else
{
/*
* NOTE: we *cannot* call mmi_pen_reset().
*
* For example, assume mmi_pen_stop_capture_strokes() is invoked when scrollbar of inline editor
* is scrolled on Pen Move event and the highlighed single-line editor is un-highlighted.
* If we invoke mmi_pen_reset() here, it will send MMI_PEN_EVENT_ABORT and reset the scrolling of scrollbar.
*/
g_pen_cntx.reset_stroke_on_pen_up = 1;
}
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_stroke_down_handler
* DESCRIPTION
* Register the Stroke Down handler
* PARAMETERS
* pen_fp [IN] Callback handler
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_stroke_down_handler(mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_stroke_table[MMI_PEN_STROKE_DOWN] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_stroke_move_handler
* DESCRIPTION
* Register the Stroke Move handler
* PARAMETERS
* begin_fp [IN]
* end_fp [IN]
* pen_fp [IN] Callback handler
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_stroke_move_handler(void (*begin_fp) (void), void (*end_fp) (void), mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_stroke_pre_move = begin_fp;
g_pen_stroke_table[MMI_PEN_STROKE_MOVE] = pen_fp;
g_pen_stroke_post_move = end_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_stroke_up_handler
* DESCRIPTION
* Register the Stroke Up handler
* PARAMETERS
* pen_fp [IN] Callback handler
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_stroke_up_handler(mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_stroke_table[MMI_PEN_STROKE_UP] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_register_stroke_longtap_handler
* DESCRIPTION
* Register the Stroke Up handler
* PARAMETERS
* pen_fp [IN] Callback handler
* RETURNS
* void
*****************************************************************************/
void mmi_pen_register_stroke_longtap_handler(mmi_pen_hdlr pen_fp)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_pen_stroke_table[MMI_PEN_STROKE_LONGTAP] = pen_fp;
}
/*****************************************************************************
* FUNCTION
* mmi_pen_peek_stroke_state
* DESCRIPTION
*
* PARAMETERS
* has_unfinished_stroke [OUT] Whether there are more strokes to come
* RETURNS
* void
*****************************************************************************/
void mmi_pen_peek_stroke_state(BOOL *has_unfinished_stroke)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -