/* ':':':':':':':':':'@' '@':':':':':':':':':'@' '@':':':':':':':':':'| */
/* :':':':':':':':':':'@'@':':':':':':':':':':'@'@':':':':':':':':':':| */
/* ':':':': : :':':':':'@':':':':': : :':':':':'@':':':':': : :':':':'| */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/*                Name:           view.h                                */
/*                Version:        1.3.0                                 */
/*                Date:           26/3/2003                             */
/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

#ifndef VIEW_H
#define VIEW_H
#include <glib.h>
#include <gtk/gtk.h>
// #include "interface.h"

#define _(String) (String)
#define uchar unsigned char
#define TERMINAL_UPPER_BOUND 20

#define MEM_REP_BYTE             0
#define MEM_REP_2_BYTES          1
#define MEM_REP_4_BYTES          2
#define MEM_REP_8_BYTES          3
#define MEM_REP_16_BYTES         4
#define MEM_REP_32_BYTES         5
#define MEM_REP_HALFWORD         6
#define MEM_REP_2_HALFWORDS      7
#define MEM_REP_4_HALFWORDS      8
#define MEM_REP_8_HALFWORDS      9
#define MEM_REP_16_HALFWORDS    10
#define MEM_REP_WORD            11
#define MEM_REP_2_WORDS         12
#define MEM_REP_4_WORDS         13
#define MEM_REP_8_WORDS         14
#define MEM_REP_ASCII_MAP       15
#define MEM_REP_ASCII_MAP128    16
#define MEM_REP_RULER           -1            /* Instructions to menu builder */
#define MEM_REP_TEMINATOR       -2

#define LENGTH_OF_MEMORY_WINDOW        36

#define MEM_WINDOW_DEFAULT 0
#define MEM_WINDOW_EXPR    1

#define CURRENT                   0
#define SAVED                     1

#define MAX_ADDRESS_OR_HEX_ENTRY 40

typedef struct mem_window_name
{
  GtkWidget *clist_ptr;                            /* Pointer to the "widget" */
  GtkWidget *address_entry;
  GtkWidget *hex_entry;                                /* the hex blank entry */
  GtkWidget *ascii_entry;                            /* the ASCII blank entry */
  GtkWidget *dis_entry;                        /* the disassembly blank entry */
  GtkWidget *ascii_button;           /* the ASCII toggle button of the window */
  GtkWidget *dis_button;       /* the disassembly toggle button of the window */
  GtkWidget *elf_symbols_button;/*the ELF symbols toggle button of the window */
  GtkWidget *inc_button;/*'increment after entry' toggle button of the window */
  GtkWidget *scroll;
  int addr_type;
  char address_string[MAX_ADDRESS_OR_HEX_ENTRY + 1];             /* +1 for /0 */
  uchar *address;
  int count;                                          /* No of rows displayed */
  int width;                                       /* number of bytes per row */
  int gran;                       /* the number of bytes shown in each column */
// int wait;
// gint timer;
  GList *isa;
}
mem_window;

typedef struct mem_window_list_name
{
  mem_window *mem_data_ptr;
  struct mem_window_list_name *next;
}
mem_window_list;

typedef struct reg_window_name
{
  GtkWidget *clist_ptr;
  GtkWidget *address_entry;
  GtkWidget *hex_entry;
  int regbank_no;
  int wait;
  gint timer;
}
reg_window;

typedef struct reg_window_list_name
{
  reg_window *reg_data_ptr;
  struct reg_window_list_name *next;
}
reg_window_list;

typedef struct dat_window_name
{
  GtkWidget *clist_ptr;
  GtkWidget *address_entry;
  GtkWidget *hex_entry;
  GtkWidget *ascii_entry;
  GtkWidget *dis_entry;
  GtkWidget *scroll;
  char *address;
  int count;
  int width;
  int gran;
}
dat_window;

typedef struct dat_window_list_name
{
  mem_window *dat_data_ptr;
  struct dat_window_list_name *next;
}
dat_window_list;

// char* view_dis_arm(uchar*, uchar*);
// char* view_dis_thumb(uchar*, uchar*);
char *view_dis (uchar *, uchar *, int, GList *);

/* some prototypes */
int view_updatememwindow (mem_window *);
int view_updateregwindow (reg_window *);
mem_window *view_getmemwindowptr (GtkWidget * widget);
reg_window *view_getregwindowptr (GtkWidget * widget);
void view_create_mainwindow (void);
void create_splashwindow (void);
void print_char_in_terminal(uchar, gpointer);
void display_status (char *string);
void display_board_state (uchar);


char *view_window_display_list;
  /* a variable to hold the display list string that was derived from .komodo */

mem_window_list *view_memwindowlist;
                         /* a group of memory windows/containers that we have */
reg_window_list *view_regwindowlist;          /* as above, for register banks */
dat_window_list *view_datwindowlist;   
             /* a list of memory windows/containers data e.g. number of lines */


int view_step_number;
              /* the initial number of steps to be taken when step is pressed */
int view_step_freq;
                     /* the initial value in the second box next to muti-step */

gpointer view_console;         /* a pointer to the text in the string console */
gpointer view_comms;

/* definitions of colours and pixmaps */
// GdkColor view_greycolour;  /* defines the grey colour used in the application */
// GdkColor view_redcolour;

/* the pixmaps used: */
GdkPixmap *view_chump_pixmap;
GdkBitmap *view_chump_bitmap;
GdkPixmap *view_tick_pixmap;
GdkBitmap *view_tick_bitmap;
GdkPixmap *view_mulogo_pixmap;
GdkBitmap *view_mulogo_bitmap;
GdkPixmap *view_komodologo_pixmap;
GdkBitmap *view_komodologo_bitmap;
GdkPixmap *view_komodotitle_pixmap;
GdkBitmap *view_komodotitle_bitmap;
GdkPixmap *view_komodoicon_pixmap;
GdkBitmap *view_komodoicon_bitmap;
GdkPixmap *view_komodominiicon_pixmap;
GdkBitmap *view_komodominiicon_bitmap;

GtkTooltips *view_tooltips;  /* one to hold the tooltips of all items in turn */

// GtkWidget *console_entry; /* the entry within the console/terminal is now global */

GtkWidget *view_splashwindow;/* global referring to the splash window created */
GtkWidget *view_mainwindow;                  /* refers to our main GTK window */
GtkWidget *view_progressbar;         /* the progress bar widget which is used */
                     /* to make other local progress bar global by assignment */
GtkWidget *view_enqlabel;
       /* the labels that reports the current state of the board e.g. stopped */
GtkWidget *view_cpsr_reg_bank;                     /* handle for flag display */
GtkWidget *view_spsr_reg_bank;                     /* handle for flag display */
GtkWidget *view_breakwindow[2][4];
GtkWidget *view_fileerror;                    /* a widger for error messages, */
                          /*  will be assigned to a new gtk dialogue at times */
GtkWidget *view_refreshbutton;     /* the widget of the toggle button refresh */
GtkWidget *view_binary_load_address;  /* the address of a binary being loaded */


GtkWidget *text_in_terminal[TERMINAL_UPPER_BOUND];
GtkWidget *terminal_active_flag[TERMINAL_UPPER_BOUND];

/* caters for up to TERMINAL_UPPER_BOUND features where the highest serial    */
/*   number for a console is 20                                               */

GtkNotebook *register_notebook;     /* pointer to the register banks notebook */
GtkNotebook *flags_notebook;                 /* pointer to the flags notebook */
//  GtkWidget *splash_status_bar;                 /* the splash window status bar */

int memory_window_activated;
                          /* Boolean indicating if memory window is displayed */
int spsr_exists;    /* indicates whether spsr register is currently displayed */
int all_flag_windows_have_been_created;


#endif
/*                                                                      */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*                     end of view.h                                    */
/************************************************************************/

