/*ProfiPacket - packet radio terminal program
  Copyright (C) 1999  Alexander Feigl

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

  Author:

  Alexander Feigl
  Burachstraße 51

  D-88250 Weingarten

  Mail : Alexander.Feigl@gmx.de
*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif


#include "GUIProtos.h"
#include "global.h"


#include <strings.h>

#include <libraries/gadtools.h>

#include <exec/lists.h>
#include <exec/memory.h>



#include <clib/exec_protos.h>
#include <clib/alib_protos.h>

#ifdef __GNUC__
extern void *SysBase;
#include <inline/exec.h>
#endif

#ifdef __GNUC__
#define _storage_text_ __attribute__ ((section(".text")))
#else
#define _storage_text_
#endif

typedef const unsigned char *constr;



struct NewMenuRaw {
 int type;
 int string;
 const unsigned char *shortcut;
 void (*funptr)();; 
};

void ProgInfo(void)
 {
  GUI_DisplayEventWindow(GUI_String(106));
  MessageWindowTime=10000;
  return;
 }

_storage_text_ const static struct NewMenuRaw PP_Menu[]=
 {
  {1,197,0,0},
  {2,198,0,ProgInfo},
  {2,472,0,GUIMISC_AboutMUI},
  {2,-1,0,0},
  {2,199,(const constr)"Q",GUI_ExitProg},
 
  {1,200,0,0},
  {2,605,0,GUIFT_FileTransfer},
  {2,208,0,GUI_AbortTransmit},
  {2,-1,0,0},
  {2,447,(const constr) "B",GUIMISC_SaveBuffers},
  {2,-1,0,0},
  {2,616,0,GUIFT_FileFilter},
                        
  {1,217,0,0},
  {2,218,(const constr)"C",GUIMISC_MakeConnect},
  {2,-1,0,0},
  {2,219,(const constr)"D",GUIMISC_Disconnect},
  {2,-1,0,0},
  {2,220,(const constr)"M",GUIMISC_ConnectMsg},
  {2,-1,0,0},
  {2,221,(const constr)"P",GUI_SendPassword},
  {2,556,(const constr)"O",GUIMISC_Encryption},
  {2,-1,0,0},
  {2,222,(const constr)"U",GUIUSER_UserSettings},
  {2,-1,0,0},
  {2,338,(const constr)"3",GUIMAIL_Mailbox},
                                             
  {1,223,0,0},
  {2,224,(const constr)"H",GUIMH_MHeard},
  {2,225,(const constr)"L",GUIMH_MHeardLong},
  {2,-1,0,0},
  {2,249,(const constr)"1",GUIMISC_SetSpy},
  {2,250,(const constr)"2",GUIMISC_ClearSpy},
                                               
  {1,226,0,0},
  {2,376,(const constr)"S",GUI_Preferences},
  {2,471,0,GUIMISC_ConfigMUI},
 };
 
int PrepareMenu(void)
 {
  const struct NewMenuRaw *nmr;
  struct NewMenu *nm,*nmb;
  int elements;
  
  elements=sizeof(PP_Menu)/sizeof(PP_Menu[0]);
  nm=AllocVec((elements+1)*sizeof(struct NewMenu),1);
  if (nm==NULL) return(1);
  memset(nm,0,(elements+1)*sizeof(struct NewMenu));
  nmb=nm;
  nmr=PP_Menu;
  while (elements)
   {
    int flags;
    
    nmb->nm_Type=nmr->type;
    if (nmr->string==-1)
     {
      nmb->nm_Label=(void *) -1;
     }
     else
     {
      nmb->nm_Label=GUI_String(nmr->string);
     }
    nmb->nm_CommKey=(char *) nmr->shortcut;
    nmb->nm_MutualExclude=0;
    nmb->nm_UserData=(void *) nmr->funptr;
    flags=0;
    
    nmb->nm_Flags=flags;
    
    
    nmb++;nmr++;
    elements--; 
   }
  nmb->nm_Type=0;
  MenuBuild=nm;
  return(0);
 }