##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    14/Jan/2011  23:28:16 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\MainMenu.cpp    #
#    Command line    =  D:\pasha\elf\googlecode\MySMSYS\Mss3\MainMenu.cpp    #
#                       -D NEWSGOLD -D ELKA -D LANG_EN -lcN                  #
#                       D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \List\ -o D:\pasha\elf\googlecode\MySMSYS\Mss3\Relea #
#                       se_ELKA_EN\Obj\ -s9 --no_unroll --cpu_mode arm       #
#                       --endian little --cpu ARM926EJ-S --stack_align 4     #
#                       --interwork -e --fpu None --eec++ --dlib_config      #
#                       "D:\pasha\Embedded Workbench 4.0                     #
#                       Evaluation2\ARM\LIB\dl5tpainl8n.h" -I                #
#                       "D:\pasha\Embedded Workbench 4.0                     #
#                       Evaluation2\ARM\INC\" --inline_threshold=2           #
#    List file       =  D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \List\MainMenu.lst                                   #
#    Object file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \Obj\MainMenu.r79                                    #
#                                                                            #
#                                                                            #
##############################################################################

D:\pasha\elf\googlecode\MySMSYS\Mss3\MainMenu.cpp
      1          #include "include.h"
      2          #include "SiemensPDU.h"
      3          #include "MyIpcMessage.h"
      4          #include "File.h"
      5          #include "SmsData.h"
      6          #include "CreateMenu.h"
      7          #include "SmsListMenu.h"
      8          #include "AdrList.h"
      9          #include "NumList.h"
     10          #include "EditGUI.h"
     11          #include "OthersMenu.h"
     12          #include "MainMenu.h"
     13          
     14          
     15          SOFTKEY_DESC main_menu_sk[]=
     16          {
     17            {0x0018,0x0000,(int)LGP_NULL},
     18            {0x0001,0x0000,(int)LGP_NULL},
     19            {0x003D,0x0000,(int)LGP_DOIT_PIC}
     20          };
     21          
     22          const SOFTKEYSTAB main_menu_skt=
     23          {
     24            main_menu_sk,0
     25          };
     26          
     27          HEADER_DESC main_menuhdr={0,0,0,0,NULL,LGP_NULL,LGP_NULL};
     28          
     29          MainMenu::MainMenu()
     30          {
     31            menu.flag=8;
     32            menu.onkey=this->OnKey;
     33            menu.ghook=this->GHook;
     34            menu.proc3=NULL;
     35            menu.softkeys=softkeys;
     36            menu.softkeystab=&main_menu_skt;
     37            menu.flags2=0x11; //icon
     38            menu.itemproc=this->ItemProc;
     39            menu.items=NULL;
     40            menu.procs=NULL;
     41            menu.n_items=0;
     42          }
     43          
     44          MainMenu::~MainMenu()
     45          {
     46          }
     47          
     48          #define MAINMENU_N 6
     49          int MainMenu::CreateMainMenu(DLG_CSM *dlg_csm)
     50          {
     51            this->dlg_csm=dlg_csm;
     52            this->gui_id=CreateMenu(&this->menu, &main_menuhdr, 0, MAINMENU_N, this);
     53            return this->gui_id;
     54          }
     55          
     56          int MainMenu::OnKey(void *data, GUI_MSG *msg)
     57          {
     58            int n;
     59            MainMenu *mm=(MainMenu *)MenuGetUserPointer(data);
     60            if(msg->keys==0x1)
     61              return 1;
     62            if(msg->keys==0x18 || msg->keys==0x3D)
     63            {
     64              n=GetCurMenuItem(data);
     65            DO_ITEM:
     66              switch(n)
     67              {
     68              case 0:
     69                {
     70          	SDLIST *sdl=SMSDATA->AllocSDL();
     71          	EditGUI *edg=new EditGUI;
     72          	edg->CreateEditGUI(mm->dlg_csm, sdl, ED_REPLY, 0, 1);
     73                }
     74                break;
     75              case 1:
     76                {
     77          	SmsListMenu *slm=new SmsListMenu;
     78          	slm->CreateSmsListMenu(TYPE_IN_N, 0, mm->dlg_csm);
     79          	break;
     80                }
     81              case 2:
     82                {
     83          	SmsListMenu *slm=new SmsListMenu;
     84          	slm->CreateSmsListMenu(TYPE_IN_ALL, 0, mm->dlg_csm);
     85          	break;
     86                }
     87              case 3:
     88                {
     89          	SmsListMenu *slm=new SmsListMenu;
     90          	slm->CreateSmsListMenu(TYPE_SENT, 0, mm->dlg_csm);
     91          	break;
     92                }
     93              case 4:
     94                {
     95          	SmsListMenu *slm=new SmsListMenu;
     96          	slm->CreateSmsListMenu(TYPE_DRAFT, 0, mm->dlg_csm);
     97          	break;
     98                }
     99              case 5:
    100                {
    101          	OthMenu *oth=new OthMenu;
    102          	oth->CreateOthMenu(mm->dlg_csm);
    103                }
    104                break;
    105              default:
    106                break;
    107              }
    108              return 0;
    109            }
    110            if(msg->gbsmsg->msg==KEY_DOWN)
    111            {
    112              n=msg->gbsmsg->submess;
    113              if(n>='1' && n<='9')
    114              {
    115                n-='1';
    116                goto DO_ITEM;
    117              }
    118            }
    119            return 0;
    120          }
    121          
    122          void MainMenu::GHook(void *data, int cmd)
    123          {
    124            MainMenu *mm=(MainMenu *)MenuGetUserPointer(data);
    125            if(cmd==0x3)
    126            {
    127              delete mm;
    128            }
    129            else if(cmd==0xA)
    130            {
    131              DisableIDLETMR();
    132            }
    133            else if (cmd==0x5)
    134            {
    135              mm->UpdateCSMName(mm->dlg_csm, (int)LGP->lgp.LGP_MSS_MAINMENU);
    136            }
    137          }
    138          
    139          int MM_ITEM_LGPS[MAINMENU_N]={LGP_NULL,LGP_NULL,LGP_NULL,LGP_NULL,LGP_NULL,LGP_NULL};
    140          int MM_ITEM_ICONS[MAINMENU_N+1]={ICON_BLANK,ICON_BLANK,ICON_BLANK,ICON_BLANK,ICON_BLANK,ICON_BLANK,0};
    141          const char MM_FORMAT[]="%t%c%d";
    142          void MainMenu::ItemProc(void *data, int curitem, void *user_pointer)
    143          {
    144            void *item=AllocMenuItem(data);
    145            WSHDR *ws=AllocMenuWS(data, 150);
    146            switch(curitem)
    147            {
    148            case 0:
    149            case 5:
    150              wsprintf(ws, PERCENT_T, MM_ITEM_LGPS[curitem]);
    151              break;
    152            case 1:
    153              wsprintf(ws, MM_FORMAT, MM_ITEM_LGPS[curitem], 0xE01D, SMSDATA->GetSMSCount(TYPE_IN_N));
    154              break;
    155            case 2:
    156              wsprintf(ws, MM_FORMAT, MM_ITEM_LGPS[curitem], 0xE01D, SMSDATA->GetSMSCount(TYPE_IN_ALL));
    157              break;
    158            case 3:
    159              wsprintf(ws, MM_FORMAT, MM_ITEM_LGPS[curitem], 0xE01D, SMSDATA->GetSMSCount(TYPE_SENT));
    160              break;
    161            case 4:
    162              wsprintf(ws, MM_FORMAT, MM_ITEM_LGPS[curitem], 0xE01D, SMSDATA->GetSMSCount(TYPE_DRAFT));
    163              break;
    164            default:
    165              wsprintf(ws, PERCENT_T, LGP->lgp.LGP_ERR);
    166              break;
    167            }
    168            SetMenuItemIconArray(data, item, MM_ITEM_ICONS);
    169            SetMenuItemIcon(data, curitem, curitem);
    170            SetMenuItemText(data, item, ws, curitem);
    171          }
    172          /*
    173          void *MainMenu::GetMainMenuGUI(DLG_CSM *dlg_csm)
    174          {
    175            void *m_gui;
    176            void *ma=malloc_adr();
    177            void *mf=mfree_adr();
    178            this->dlg_csm=dlg_csm;
    179            this->gui_id=0;
    180            m_gui=GetMenuGUI(ma, mf);
    181            SetMenuToGUI(m_gui, &this->menu);
    182            SetMenuItemCount(m_gui, MAINMENU_N);
    183            MenuSetUserPointer(m_gui, this);
    184            SetCursorToMenuItem(m_gui, 0);
    185            patch_header(&main_menuhdr);
    186            SetHeaderToMenu(m_gui, &main_menuhdr, ma);
    187            return m_gui;
    188          }
    189          */
    190          
    191          
    192          
    193          
    194          void MainMenu::UpdateCSMName(DLG_CSM *dlg_csm, int lgp)
    195          {
    196            wsprintf(&((DLGCSM_DESC *)dlg_csm->csm_ram.constr)->csm_name, PERCENT_T, lgp);
    197          }
    198          
    199          void * MainMenu::GetMainMenuGUI(DLG_CSM *dlg_csm, int cur)
    200          {
    201            void *m_gui;
    202            void *ma=malloc_adr();
    203            void *mf=mfree_adr();
    204            this->dlg_csm=dlg_csm;
    205            this->gui_id=0;
    206            m_gui=GetMenuGUI(ma, mf);
    207            SetMenuToGUI(m_gui, &this->menu);
    208            SetMenuItemCount(m_gui, MAINMENU_N);
    209            MenuSetUserPointer(m_gui, this);
    210            SetCursorToMenuItem(m_gui, cur);
    211            patch_header(&main_menuhdr);
    212            SetHeaderToMenu(m_gui, &main_menuhdr, ma);
    213            return m_gui;
    214          }

   Maximum stack usage in bytes:

     Function                       CSTACK
     --------                       ------
     MainMenu::CreateMainMenu(DLG_CSM *)
                                       12
     MainMenu::GHook(void *, int)       8
     MainMenu::GetMainMenuGUI(DLG_CSM *, int)
                                       24
     MainMenu::ItemProc(void *, int, void *)
                                       36
     MainMenu::MainMenu()               0
     MainMenu::OnKey(void *, GUI_MSG *)
                                       24
     MainMenu::UpdateCSMName(DLG_CSM *, int)
                                        4
     MainMenu::delete ~MainMenu(MainMenu *)
                                        4
     MainMenu::new MainMenu()           4
     MainMenu::~MainMenu()              0


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     main_menu_sk                     24
     main_menu_skt                     8
     main_menuhdr                     20
     MainMenu::MainMenu()            100
     MainMenu::~MainMenu()             4
     MainMenu::CreateMainMenu(DLG_CSM *)
                                      40
     MainMenu::OnKey(void *, GUI_MSG *)
                                     292
     MainMenu::GHook(void *, int)     96
     MM_ITEM_LGPS                     52
     MM_FORMAT                         8
     MainMenu::ItemProc(void *, int, void *)
                                     260
     MainMenu::UpdateCSMName(DLG_CSM *, int)
                                      28
     MainMenu::GetMainMenuGUI(DLG_CSM *, int)
                                     164
     ?<Initializer for main_menu_sk>
                                      24
     ?<Initializer for main_menuhdr>
                                      20
     ?<Initializer for MM_ITEM_LGPS>
                                      52
     MainMenu::delete ~MainMenu(MainMenu *)
                                      20
     MainMenu::new MainMenu()         28
     ??DataTable4                      4
     ??DataTable5                      4
     ??DataTable6                      4
      Others                         184

 
 1 216 bytes in segment CODE
    16 bytes in segment DATA_C
    96 bytes in segment DATA_I
    96 bytes in segment DATA_ID
    12 bytes in segment INITTAB
 
 1 044 bytes of CODE  memory (+ 184 bytes shared)
   112 bytes of CONST memory
    96 bytes of DATA  memory

Errors: none
Warnings: none
