Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Anonymous
Friday, December 1st, 2006 at 7:18:44pm UTC 

  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  *
  9.  * Copyright (C) Barry Wardell 2006
  10.  *
  11.  * All files in this archive are subject to the GNU General Public License.
  12.  * See the file COPYING in the source tree root for full license agreement.
  13.  *
  14.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  15.  * KIND, either express or implied.
  16.  *
  17.  ****************************************************************************/
  18. /* Button Code Definitions for Sandisk e200 target */
  19.  
  20. #include "config.h"
  21. #include "action.h"
  22. #include "button.h"
  23. #include "settings.h"
  24.  
  25. /* {Action Code,    Button code,    Prereq button code } */
  26.  
  27. /*
  28.  * The format of the list is as follows
  29.  * { Action Code,   Button code,    Prereq button code }
  30.  * if there's no need to check the previous button's value, use BUTTON_NONE
  31.  * Insert LAST_ITEM_IN_LIST at the end of each mapping
  32.  */
  33. const struct button_mapping button_context_standard[]  = {
  34.     { ACTION_STD_PREV,        BUTTON_SCROLL_UP|BUTTON_REL,      BUTTON_NONE },
  35.     { ACTION_STD_PREVREPEAT,  BUTTON_SCROLL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  36.     { ACTION_STD_NEXT,        BUTTON_SCROLL_DOWN|BUTTON_REL,    BUTTON_NONE },
  37.     { ACTION_STD_NEXTREPEAT,  BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  38.  
  39.     { ACTION_STD_MENU,        BUTTON_POWER|BUTTON_REL,          BUTTON_POWER },
  40.  
  41.     { ACTION_STD_OK,          BUTTON_SELECT|BUTTON_REL,         BUTTON_SELECT },
  42.     { ACTION_STD_OK,          BUTTON_RIGHT,                     BUTTON_NONE },
  43.     { ACTION_STD_CANCEL,      BUTTON_LEFT,                      BUTTON_NONE },
  44.  
  45.     { ACTION_STD_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT,        BUTTON_NONE },
  46.     { ACTION_STD_CONTEXT,     BUTTON_DOWN|BUTTON_REL,           BUTTON_NONE },
  47.  
  48.     LAST_ITEM_IN_LIST
  49. }; /* button_context_standard */
  50.  
  51. const struct button_mapping button_context_wps[]  = {
  52.     { ACTION_WPS_PLAY,     BUTTON_UP|BUTTON_REL,        BUTTON_UP },
  53.     { ACTION_WPS_STOP,     BUTTON_UP|BUTTON_REPEAT,     BUTTON_UP },
  54.    
  55.     { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL,    BUTTON_LEFT },
  56.     { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
  57.     { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL,    BUTTON_LEFT|BUTTON_REPEAT },
  58.    
  59.     { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT },
  60.     { ACTION_WPS_SEEKFWD,  BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  61.     { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT|BUTTON_REPEAT },
  62.    
  63.     { ACTION_WPS_ABSETB_NEXTDIR,    BUTTON_POWER|BUTTON_RIGHT,   BUTTON_POWER },
  64.     { ACTION_WPS_ABSETA_PREVDIR,    BUTTON_POWER|BUTTON_LEFT,    BUTTON_POWER },
  65.     { ACTION_WPSAB_RESET,           BUTTON_POWER|BUTTON_UP,      BUTTON_POWER },
  66.    
  67.     { ACTION_WPS_VOLUP,     BUTTON_SCROLL_DOWN,                BUTTON_NONE },
  68.     { ACTION_WPS_VOLUP,     BUTTON_SCROLL_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  69.     { ACTION_WPS_VOLDOWN,   BUTTON_SCROLL_UP,                  BUTTON_NONE },
  70.     { ACTION_WPS_VOLDOWN,   BUTTON_SCROLL_UP|BUTTON_REPEAT,    BUTTON_NONE },
  71.    
  72.     { ACTION_WPS_BROWSE,        BUTTON_SELECT|BUTTON_REPEAT,  BUTTON_SELECT },
  73.  
  74.     { ACTION_WPS_CONTEXT,       BUTTON_DOWN|BUTTON_REL,       BUTTON_DOWN },
  75.     { ACTION_WPS_QUICKSCREEN,   BUTTON_DOWN|BUTTON_REPEAT,    BUTTON_DOWN },
  76.  
  77.     { ACTION_WPS_MENU,          BUTTON_POWER|BUTTON_REL,      BUTTON_POWER },
  78.    
  79.     { ACTION_WPS_PITCHSCREEN,   BUTTON_SELECT|BUTTON_UP,      BUTTON_SELECT },
  80.     { ACTION_WPS_ID3SCREEN,     BUTTON_SELECT|BUTTON_DOWN,    BUTTON_SELECT },
  81.    
  82.     LAST_ITEM_IN_LIST
  83. }; /* button_context_wps */
  84.  
  85. const struct button_mapping button_context_settings[] = {
  86.     { ACTION_SETTINGS_INC,      BUTTON_SCROLL_UP,                 BUTTON_NONE },
  87.     { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  88.     { ACTION_SETTINGS_DEC,      BUTTON_SCROLL_DOWN,               BUTTON_NONE },
  89.     { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  90.    
  91.     { ACTION_STD_PREV,          BUTTON_LEFT,                      BUTTON_NONE },
  92.     { ACTION_STD_PREVREPEAT,    BUTTON_LEFT|BUTTON_REPEAT,        BUTTON_NONE },
  93.     { ACTION_STD_NEXT,          BUTTON_RIGHT,                     BUTTON_NONE },
  94.     { ACTION_STD_NEXTREPEAT,    BUTTON_RIGHT|BUTTON_REPEAT,       BUTTON_NONE },
  95.     { ACTION_SETTINGS_RESET,    BUTTON_SELECT,                    BUTTON_NONE },
  96.  
  97.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  98. }; /* button_context_settings */
  99.  
  100. const struct button_mapping button_context_list[]  = {
  101.     { ACTION_LISTTREE_PGUP,   BUTTON_REC|BUTTON_SCROLL_UP,   BUTTON_REC },
  102.     { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_SCROLL_DOWN, BUTTON_REC },
  103.  
  104.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
  105. }; /* button_context_list */
  106.  
  107. const struct button_mapping button_context_tree[]  = {
  108.     { ACTION_TREE_WPS,    BUTTON_UP|BUTTON_REL,         BUTTON_UP },
  109.     { ACTION_TREE_STOP,   BUTTON_UP|BUTTON_REPEAT,      BUTTON_UP },
  110.    
  111.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
  112. }; /* button_context_tree */
  113.  
  114. const struct button_mapping button_context_listtree_scroll_without_combo[]  = {
  115.     { ACTION_NONE,              BUTTON_LEFT,                BUTTON_NONE },
  116.     { ACTION_STD_CANCEL,        BUTTON_LEFT|BUTTON_REL,     BUTTON_LEFT },
  117.     { ACTION_TREE_ROOT_INIT,    BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_LEFT },
  118.     { ACTION_TREE_PGLEFT,       BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  119.     { ACTION_TREE_PGLEFT,       BUTTON_LEFT|BUTTON_REL,     BUTTON_LEFT|BUTTON_REPEAT },
  120.     { ACTION_NONE,              BUTTON_RIGHT,               BUTTON_NONE },
  121.     { ACTION_STD_OK,            BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT },
  122.     { ACTION_TREE_PGRIGHT,      BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  123.     { ACTION_TREE_PGRIGHT,      BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT|BUTTON_REPEAT },
  124.  
  125.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
  126. }; /* button_context_listtree_scroll_without_combo */
  127.  
  128. const struct button_mapping button_context_listtree_scroll_with_combo[]  = {
  129.     { ACTION_TREE_ROOT_INIT,BUTTON_LEFT|BUTTON_REPEAT,            BUTTON_NONE },
  130.     { ACTION_TREE_PGLEFT,   BUTTON_REC|BUTTON_LEFT,               BUTTON_REC },
  131.     { ACTION_TREE_PGLEFT,   BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
  132.     { ACTION_TREE_PGRIGHT,  BUTTON_REC|BUTTON_RIGHT,              BUTTON_REC },
  133.     { ACTION_TREE_PGRIGHT,  BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
  134.  
  135.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
  136. }; /* button_context_listtree_scroll_with_combo */
  137.  
  138. const struct button_mapping button_context_yesno[]  = {
  139.     { ACTION_YESNO_ACCEPT,          BUTTON_SELECT,              BUTTON_NONE },
  140.  
  141.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  142. }; /* button_context_settings_yesno */
  143.  
  144. const struct button_mapping button_context_quickscreen[]  = {
  145.     { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL,       BUTTON_NONE },
  146.     { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REL,          BUTTON_NONE },
  147.     { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT,       BUTTON_NONE },
  148.     { ACTION_QS_DOWN,    BUTTON_DOWN|BUTTON_REL,        BUTTON_NONE },
  149.     { ACTION_QS_DOWN,    BUTTON_DOWN|BUTTON_REPEAT,     BUTTON_NONE },
  150.     { ACTION_QS_LEFT,    BUTTON_LEFT|BUTTON_REL,        BUTTON_NONE },
  151.     { ACTION_QS_LEFT,    BUTTON_LEFT|BUTTON_REPEAT,     BUTTON_NONE },
  152.     { ACTION_QS_RIGHT,   BUTTON_RIGHT|BUTTON_REL,       BUTTON_NONE },
  153.     { ACTION_QS_RIGHT,   BUTTON_RIGHT|BUTTON_REPEAT,    BUTTON_NONE },
  154.    
  155.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  156. }; /* button_context_quickscreen */
  157.  
  158. const struct button_mapping button_context_settings_right_is_inc[]  = {
  159.     { ACTION_SETTINGS_INC,       BUTTON_SCROLL_UP|BUTTON_REL,     BUTTON_NONE },
  160.     { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT,  BUTTON_NONE },
  161.     { ACTION_SETTINGS_DEC,       BUTTON_SCROLL_DOWN|BUTTON_REL,   BUTTON_NONE },
  162.     { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
  163.  
  164.     { ACTION_STD_PREV,           BUTTON_UP|BUTTON_REL,            BUTTON_NONE },
  165.     { ACTION_STD_PREVREPEAT,     BUTTON_UP|BUTTON_REPEAT,         BUTTON_NONE },
  166.     { ACTION_STD_NEXT,           BUTTON_DOWN|BUTTON_REL,          BUTTON_NONE },
  167.     { ACTION_STD_NEXTREPEAT,     BUTTON_DOWN|BUTTON_REPEAT,       BUTTON_NONE },
  168.     { ACTION_NONE,               BUTTON_SELECT,                   BUTTON_NONE },
  169.     { ACTION_STD_OK,             BUTTON_SELECT|BUTTON_REL,        BUTTON_NONE },
  170.     { ACTION_NONE,               BUTTON_LEFT|BUTTON_REL,          BUTTON_LEFT },
  171.     { ACTION_NONE,               BUTTON_POWER,                    BUTTON_NONE },
  172.     { ACTION_STD_CANCEL,         BUTTON_POWER|BUTTON_REL,         BUTTON_NONE },
  173.    
  174.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  175. }; /* button_context_settings_right_is_inc */
  176.  
  177. const struct button_mapping button_context_pitchscreen[]  = {
  178.     { ACTION_PS_INC_SMALL,      BUTTON_UP,                 BUTTON_NONE },
  179.     { ACTION_PS_INC_BIG,        BUTTON_UP|BUTTON_REPEAT,   BUTTON_NONE },
  180.     { ACTION_PS_DEC_SMALL,      BUTTON_DOWN,               BUTTON_NONE },
  181.     { ACTION_PS_DEC_BIG,        BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  182.     { ACTION_PS_NUDGE_LEFT,     BUTTON_LEFT,               BUTTON_NONE },
  183.     { ACTION_PS_NUDGE_LEFTOFF,  BUTTON_LEFT|BUTTON_REL,    BUTTON_NONE },
  184.     { ACTION_PS_NUDGE_RIGHT,    BUTTON_RIGHT,              BUTTON_NONE },
  185.     { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL,   BUTTON_NONE },
  186.     { ACTION_PS_RESET,          BUTTON_SELECT,             BUTTON_NONE },
  187.     { ACTION_PS_EXIT,           BUTTON_POWER,              BUTTON_NONE },
  188.    
  189.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  190. }; /* button_context_pitchscreen */
  191.  
  192. const struct button_mapping button_context_keyboard[]  = {
  193.     { ACTION_KBD_LEFT,         BUTTON_LEFT,                      BUTTON_NONE },
  194.     { ACTION_KBD_LEFT,         BUTTON_LEFT|BUTTON_REPEAT,        BUTTON_NONE },
  195.     { ACTION_KBD_RIGHT,        BUTTON_RIGHT,                     BUTTON_NONE },
  196.     { ACTION_KBD_RIGHT,        BUTTON_RIGHT|BUTTON_REPEAT,       BUTTON_NONE },
  197.    
  198.     { ACTION_KBD_CURSOR_LEFT,  BUTTON_REC|BUTTON_LEFT,                BUTTON_NONE },
  199.     { ACTION_KBD_CURSOR_LEFT,  BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  200.     { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT,               BUTTON_NONE },
  201.     { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  202.    
  203.     { ACTION_KBD_UP,           BUTTON_SCROLL_UP,                 BUTTON_NONE },
  204.     { ACTION_KBD_UP,           BUTTON_SCROLL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  205.     { ACTION_KBD_DOWN,         BUTTON_SCROLL_DOWN,               BUTTON_NONE },
  206.     { ACTION_KBD_DOWN,         BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  207.     { ACTION_KBD_PAGE_FLIP,    BUTTON_REC|BUTTON_SELECT,         BUTTON_REC },
  208.     { ACTION_KBD_BACKSPACE,    BUTTON_DOWN,                      BUTTON_NONE },
  209.     { ACTION_KBD_BACKSPACE,    BUTTON_DOWN|BUTTON_REPEAT,        BUTTON_NONE },
  210.     { ACTION_KBD_SELECT,       BUTTON_SELECT,                    BUTTON_NONE },
  211.     { ACTION_KBD_DONE,         BUTTON_UP,                        BUTTON_NONE },
  212.     { ACTION_KBD_ABORT,        BUTTON_POWER,                     BUTTON_NONE },
  213.  
  214.     LAST_ITEM_IN_LIST
  215. }; /* button_context_keyboard */
  216.  
  217. const struct button_mapping button_context_bmark[]  = {
  218.     { ACTION_BMS_DELETE,       BUTTON_UP,         BUTTON_NONE },
  219.     { ACTION_BMS_SELECT,       BUTTON_SELECT,     BUTTON_NONE },
  220.     { ACTION_BMS_EXIT,         BUTTON_POWER,      BUTTON_NONE },
  221.  
  222.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  223. }; /* button_context_bmark */
  224.  
  225. /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
  226. const struct button_mapping* get_context_mapping(int context)
  227. {
  228.     switch (context)
  229.     {
  230.         case CONTEXT_STD:
  231.         case CONTEXT_MAINMENU:
  232.             return button_context_standard;
  233.            
  234.         case CONTEXT_WPS:
  235.             return button_context_wps;
  236.  
  237.         case CONTEXT_LIST:
  238.             return button_context_list;
  239.         case CONTEXT_TREE:
  240.             if (global_settings.hold_lr_for_scroll_in_list)
  241.                 return button_context_listtree_scroll_without_combo;
  242.             else
  243.                 return button_context_listtree_scroll_with_combo;
  244.         case CONTEXT_CUSTOM|CONTEXT_TREE:
  245.             return button_context_tree;
  246.  
  247.         case CONTEXT_SETTINGS:
  248.             return button_context_settings;
  249.         case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
  250.         case CONTEXT_SETTINGS_COLOURCHOOSER:
  251.         case CONTEXT_SETTINGS_EQ:
  252.         case CONTEXT_SETTINGS_TIME:
  253.             return button_context_settings_right_is_inc;
  254.            
  255.         case CONTEXT_YESNOSCREEN:
  256.             return button_context_yesno;           
  257.         case CONTEXT_BOOKMARKSCREEN:
  258.             return button_context_bmark;
  259.         case CONTEXT_QUICKSCREEN:
  260.             return button_context_quickscreen;
  261.         case CONTEXT_PITCHSCREEN:
  262.             return button_context_pitchscreen;
  263.         case CONTEXT_KEYBOARD:
  264.             return button_context_keyboard;
  265.  
  266.         default:
  267.             return button_context_standard;
  268.     }
  269.     return button_context_standard;
  270. }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right