/src/im/default/ftk_handwrite_engine_dummy.c

http://ftk.googlecode.com/ · C · 122 lines · 69 code · 24 blank · 29 comment · 15 complexity · 04fe34f08fbedd52883c6252e3a905c5 MD5 · raw file

  1. /*
  2. * File: ftk_handwrite_engine_dummy.h
  3. * Author: Li XianJing <xianjimli@hotmail.com>
  4. * Brief: dummy handwrite engine
  5. *
  6. * Copyright (c) 2009 - 2010 Li XianJing <xianjimli@hotmail.com>
  7. *
  8. * Licensed under the Academic Free License version 2.1
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. /*
  25. * History:
  26. * ================================================================
  27. * 2010-02-10 Li XianJing <xianjimli@hotmail.com> created
  28. *
  29. */
  30. #include "ftk_log.h"
  31. #include "ftk_event.h"
  32. #include "ftk_allocator.h"
  33. #include "ftk_handwrite_engine.h"
  34. struct _FtkHandWriteEngine
  35. {
  36. void* on_result_ctx;
  37. FtkCommitInfo commit_info;
  38. FtkHandWriteResult on_result;
  39. };
  40. FtkHandWriteEngine* ftk_hand_write_engine_create(FtkHandWriteResult on_result, void* ctx)
  41. {
  42. FtkHandWriteEngine* thiz = NULL;
  43. return_val_if_fail(on_result != NULL, NULL);
  44. thiz = FTK_ZALLOC(sizeof(FtkHandWriteEngine));
  45. if(thiz != NULL)
  46. {
  47. thiz->on_result = on_result;
  48. thiz->on_result_ctx = ctx;
  49. }
  50. return thiz;
  51. }
  52. Ret ftk_hand_write_engine_activate(FtkHandWriteEngine* thiz)
  53. {
  54. return_val_if_fail(thiz != NULL, RET_FAIL);
  55. ftk_logd("%s\n", __func__);
  56. return RET_OK;
  57. }
  58. Ret ftk_hand_write_engine_deactivate(FtkHandWriteEngine* thiz)
  59. {
  60. return_val_if_fail(thiz != NULL, RET_FAIL);
  61. ftk_logd("%s\n", __func__);
  62. return RET_OK;
  63. }
  64. Ret ftk_hand_write_engine_reset(FtkHandWriteEngine* thiz)
  65. {
  66. return_val_if_fail(thiz != NULL, RET_FAIL);
  67. ftk_logd("%s\n", __func__);
  68. return RET_OK;
  69. }
  70. Ret ftk_hand_write_engine_set_rect(FtkHandWriteEngine* thiz, FtkRect* rect)
  71. {
  72. return_val_if_fail(thiz != NULL && rect != NULL, RET_FAIL);
  73. return RET_FAIL;
  74. }
  75. Ret ftk_hand_write_engine_add_stroke(FtkHandWriteEngine* thiz, FtkPoint* points, size_t points_nr)
  76. {
  77. return_val_if_fail(thiz != NULL && points != NULL, RET_FAIL);
  78. ftk_logd("%s\n", __func__);
  79. return RET_OK;
  80. }
  81. Ret ftk_hand_write_engine_flush(FtkHandWriteEngine* thiz)
  82. {
  83. return_val_if_fail(thiz != NULL, RET_FAIL);
  84. thiz->commit_info.candidate_nr = 1;
  85. strcpy(thiz->commit_info.candidates, "??");
  86. ftk_logd("%s\n", __func__);
  87. thiz->on_result(thiz->on_result_ctx, &(thiz->commit_info));
  88. return RET_OK;
  89. }
  90. void ftk_hand_write_engine_destroy(FtkHandWriteEngine* thiz)
  91. {
  92. if(thiz != NULL)
  93. {
  94. ftk_logd("%s\n", __func__);
  95. FTK_ZFREE(thiz, sizeof(FtkHandWriteEngine));
  96. }
  97. return;
  98. }