diff options
Diffstat (limited to 'mixgtk')
-rw-r--r-- | mixgtk/mixgtk.glade | 156 | ||||
-rw-r--r-- | mixgtk/mixgtk_mixal.c | 60 | ||||
-rw-r--r-- | mixgtk/mixgtk_widgets.c | 3 | ||||
-rw-r--r-- | mixgtk/mixgtk_widgets.h | 3 |
4 files changed, 218 insertions, 4 deletions
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade index 8bb2211..2e227f4 100644 --- a/mixgtk/mixgtk.glade +++ b/mixgtk/mixgtk.glade @@ -204,6 +204,24 @@ <label>_Clear breakpoints</label> <right_justify>False</right_justify> </widget> + + <widget> + <class>GtkMenuItem</class> + <name>symbols</name> + <tooltip>Show the symbol table</tooltip> + <accelerator> + <modifiers>GDK_MOD1_MASK</modifiers> + <key>GDK_Y</key> + <signal>activate</signal> + </accelerator> + <signal> + <name>activate</name> + <handler>on_symbols_activate</handler> + <last_modification_time>Mon, 18 Jun 2001 22:17:06 GMT</last_modification_time> + </signal> + <label>_Symbols...</label> + <right_justify>False</right_justify> + </widget> </widget> </widget> @@ -357,7 +375,7 @@ </signal> <label>Save on _exit</label> <active>False</active> - <always_show_toggle>True</always_show_toggle> + <always_show_toggle>False</always_show_toggle> </widget> </widget> </widget> @@ -2754,4 +2772,140 @@ </widget> </widget> +<widget> + <class>GtkDialog</class> + <name>symbols_dialog</name> + <visible>False</visible> + <signal> + <name>delete_event</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Mon, 18 Jun 2001 21:10:39 GMT</last_modification_time> + </signal> + <signal> + <name>destroy_event</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Mon, 18 Jun 2001 21:10:53 GMT</last_modification_time> + </signal> + <signal> + <name>destroy</name> + <handler>gtk_widget_hide</handler> + <last_modification_time>Mon, 18 Jun 2001 21:11:08 GMT</last_modification_time> + </signal> + <title>Symbol table</title> + <type>GTK_WINDOW_DIALOG</type> + <position>GTK_WIN_POS_CENTER</position> + <modal>False</modal> + <default_width>350</default_width> + <default_height>265</default_height> + <allow_shrink>True</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + + <widget> + <class>GtkVBox</class> + <child_name>Dialog:vbox</child_name> + <name>dialog-vbox10</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkHBox</class> + <child_name>Dialog:action_area</child_name> + <name>dialog-action_area10</name> + <border_width>10</border_width> + <homogeneous>True</homogeneous> + <spacing>5</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <width>77</width> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>on_symbol_ok_clicked</handler> + <last_modification_time>Mon, 18 Jun 2001 21:10:02 GMT</last_modification_time> + </signal> + <label>_Close</label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow26</name> + <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkCList</class> + <name>symbols_clist</name> + <can_focus>True</can_focus> + <columns>3</columns> + <column_widths>80,112,80</column_widths> + <selection_mode>GTK_SELECTION_SINGLE</selection_mode> + <show_titles>True</show_titles> + <shadow_type>GTK_SHADOW_IN</shadow_type> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>label236</name> + <label>Symbol</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>label237</name> + <label>Decimal</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>label238</name> + <label>Word</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> + </widget> + </widget> +</widget> + </GTK-Interface> diff --git a/mixgtk/mixgtk_mixal.c b/mixgtk/mixgtk_mixal.c index db2218a..ed10602 100644 --- a/mixgtk/mixgtk_mixal.c +++ b/mixgtk/mixgtk_mixal.c @@ -37,6 +37,49 @@ static GtkStatusbar *status_; static gint status_context_; static GPtrArray *tips_text_ = NULL; +static GtkWidget *symbols_dlg_ = NULL; +static GtkWidget *symbols_clist_ = NULL; +static const gchar *SYMBOLS_CLIST_NAME_ = "symbols_clist"; + +static void +init_symbols_ (void) +{ + symbols_dlg_ = mixgtk_widget_factory_get_dialog (MIXGTK_SYMBOLS_DIALOG); + g_assert (symbols_dlg_); + symbols_clist_ = mixgtk_widget_factory_get_child_by_name + (MIXGTK_SYMBOLS_DIALOG, SYMBOLS_CLIST_NAME_); + g_assert (symbols_clist_); + gtk_clist_set_sort_type (GTK_CLIST (symbols_clist_), GTK_SORT_ASCENDING); + gtk_clist_set_auto_sort (GTK_CLIST (symbols_clist_), TRUE); +} + +static void +insert_symbol_ (gpointer symbol, gpointer value, gpointer list) +{ + enum {DEC_SIZE = 25, WORD_SIZE = 20}; + static gchar DEC[DEC_SIZE], WORD[WORD_SIZE]; + + gchar *text[] = {(gchar *)symbol, DEC, WORD}; + mix_word_t w = (mix_word_t)GPOINTER_TO_INT (value); + snprintf (DEC, DEC_SIZE, "%s%ld", + mix_word_is_negative (w)? "-" : "+", + mix_word_magnitude (w)); + mix_word_print_to_buffer (w, WORD); + gtk_clist_append ((GtkCList *)list, text); +} + +static void +fill_symbols_ (const mix_symbol_table_t *table) +{ + if (symbols_clist_) + gtk_clist_clear (GTK_CLIST (symbols_clist_)); + else + init_symbols_ (); + + mix_symbol_table_foreach (((mix_symbol_table_t *)table), + insert_symbol_, (gpointer)symbols_clist_); +} + static GdkColor colors_[3][2]; static GdkColormap *colormap_ = NULL; static const char* default_colors_[3][2] = { @@ -69,7 +112,8 @@ color_to_string_ (const GdkColor *color) { enum {LEN = 100}; static gchar buffer[LEN]; - g_snprintf (buffer, LEN, "%hd %hd %hd", color->red, color->green, color->blue); + g_snprintf (buffer, LEN, "%hd %hd %hd", + color->red, color->green, color->blue); return buffer; } @@ -223,6 +267,7 @@ mixgtk_mixal_load_file (void) if (table) update_tips_ (table, line); } + if (table) fill_symbols_ (table); gtk_clist_append (clist_, NULL_TEXT); gtk_clist_set_row_data (clist_, k, GINT_TO_POINTER (MIX_VM_CELL_NO)); gtk_clist_unselect_row (clist_, 0, 0); @@ -352,3 +397,16 @@ on_mixal_motion_notify_event (GtkWidget *list, GdkEventMotion *event, } return FALSE; } + +void +on_symbol_ok_clicked () +{ + gtk_widget_hide (symbols_dlg_); +} + +void +on_symbols_activate () +{ + if (!symbols_dlg_) init_symbols_ (); + gtk_widget_show (symbols_dlg_); +} diff --git a/mixgtk/mixgtk_widgets.c b/mixgtk/mixgtk_widgets.c index d5ac7b1..d665cc6 100644 --- a/mixgtk/mixgtk_widgets.c +++ b/mixgtk/mixgtk_widgets.c @@ -38,7 +38,8 @@ static const gchar * dnames_[] = { "colorsel_dialog", "fontsel_dialog", "devform_dialog", - "external_dialog" + "external_dialog", + "symbols_dialog" }; #define DLG_NO_ (sizeof (dnames_) / sizeof(dnames_[0])) diff --git a/mixgtk/mixgtk_widgets.h b/mixgtk/mixgtk_widgets.h index ed7cf7e..b50fa10 100644 --- a/mixgtk/mixgtk_widgets.h +++ b/mixgtk/mixgtk_widgets.h @@ -38,7 +38,8 @@ typedef enum { MIXGTK_COLORSEL_DIALOG, /* color selection dialog */ MIXGTK_FONTSEL_DIALOG, /* font selection dialog */ MIXGTK_DEVFORM_DIALOG, /* device format config dialog */ - MIXGTK_EXTERNPROG_DIALOG /* external programs dialog */ + MIXGTK_EXTERNPROG_DIALOG, /* external programs dialog */ + MIXGTK_SYMBOLS_DIALOG /* symbol table dialog */ } mixgtk_dialog_id_t; /* enumeration of mixvm widget ids */ |