Some work on the GTK debuggger gui: replace deprecated functions.

TODO: Updates to support GTK 3.0 for compatibility with wx GTK.
This commit is contained in:
Volker Ruppert 2019-11-08 17:43:14 +00:00
parent dbc8f1aa19
commit fb61d54b4b

View File

@ -8,7 +8,7 @@
//
// Modified by Bruce Ewing
//
// Copyright (C) 2008-2014 The Bochs Project
// Copyright (C) 2008-2019 The Bochs Project
#include "config.h"
@ -586,7 +586,7 @@ int GetASMTopIdx()
// calculate the number of vertical "pixels" in one row (as a fraction of the scroll range)
if (AsmLineCount == 0)
return 0;
ListLineRatio = (int) (va->upper - va->lower) / AsmLineCount;
ListLineRatio = (int) (gtk_adjustment_get_upper(va) - gtk_adjustment_get_lower(va)) / AsmLineCount;
if (ListLineRatio == 0)
return 0;
AsmPgSize = (int) va->page_size / ListLineRatio;
@ -633,11 +633,11 @@ void RepackLists(int FirstListIndex)
void MoveLists()
{
int i;
gtk_widget_ref (ScrlWin[0]); // make sure the list widgets do not get deleted
gtk_widget_ref (ScrlWin[1]); // when they are removed from their container
gtk_widget_ref (ScrlWin[2]);
gtk_widget_ref (VSepEvtBox1);
gtk_widget_ref (VSepEvtBox2);
g_object_ref(ScrlWin[0]); // make sure the list widgets do not get deleted
g_object_ref(ScrlWin[1]); // when they are removed from their container
g_object_ref(ScrlWin[2]);
g_object_ref(VSepEvtBox1);
g_object_ref(VSepEvtBox2);
gtk_container_remove (GTK_CONTAINER(LVHbox), ScrlWin[0]);
gtk_container_remove (GTK_CONTAINER(LVHbox), ScrlWin[1]);
gtk_container_remove (GTK_CONTAINER(LVHbox), ScrlWin[2]);
@ -648,11 +648,11 @@ void MoveLists()
i = (DockOrder >> 8) -1; // index of left list
RepackLists(i); // pack widgets back into container in new DockOrder
gtk_widget_unref (ScrlWin[0]);
gtk_widget_unref (ScrlWin[1]); // and get rid of the temporary "ref"s
gtk_widget_unref (ScrlWin[2]);
gtk_widget_unref (VSepEvtBox1);
gtk_widget_unref (VSepEvtBox2);
g_object_unref(ScrlWin[0]);
g_object_unref(ScrlWin[1]); // and get rid of the temporary "ref"s
g_object_unref(ScrlWin[2]);
g_object_unref(VSepEvtBox1);
g_object_unref(VSepEvtBox2);
// use DockOrder to figure out the table X-coordinates of the 2 v-separators
i = ListWidthPix[i];
@ -1147,7 +1147,6 @@ void enter_resize_mode()
// need reasonably accurate column widths in horz. limit calculations -- update widths
int width0, width1;
gint totwidth;
gint height;
EnterSizeMode = FALSE; // presize mode may never have reset this
// a GtkAllocation structure (inside every widget) is a rectangle: relative x, y, + width & height
width0 = ScrlWin[0]->allocation.width;
@ -1155,7 +1154,7 @@ void enter_resize_mode()
width1 = ScrlWin[1]->allocation.width;
ListWidthPix[1] = width1;
gdk_drawable_get_size (window->window, &totwidth, &height);
totwidth = gdk_window_get_width(window->window);
ListWidthPix[2] = totwidth - (width0 + width1);
if (Sizing < 0) // in presize mode? -- enter full resize mode
@ -1368,8 +1367,8 @@ void Close_cb(GtkWidget *widget, gpointer data)
// holding one extra reference to both ScrlWin[2] widgets
// but I "sank" PTree myself, so it is my understanding that I need to "destroy" it myself
gtk_widget_destroy(PTree);
gtk_widget_unref(PTree);
gtk_widget_unref(LV[2]);
g_object_unref(PTree);
g_object_unref(LV[2]);
gdk_cursor_unref(SizeCurs);
gdk_cursor_unref(DockCurs);
@ -1441,7 +1440,8 @@ gboolean TblSizeEvent(GtkWidget *widget, GdkEventConfigure *event, gpointer data
gint WinSizeY;
GdkWindow *TblGdk = gtk_widget_get_parent_window(TreeTbl);
gdk_drawable_get_size (TblGdk, &WinSizeX, &WinSizeY);
WinSizeX = gdk_window_get_width(TblGdk);
WinSizeY = gdk_window_get_height(TblGdk);
// don't "resize" on minimize, if window is too small, or if width is (almost) unchanged
// -- five pixels spread over 3 windows is negligible
@ -1562,7 +1562,8 @@ gboolean LvLeave(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
gint width;
gint height;
// get the width and height of the ListView hbox window
gdk_drawable_get_size (event->window, &width, &height);
width = gdk_window_get_width(event->window);
height = gdk_window_get_height(event->window);
// cursor moved outside the box (not just onto a vert. separator)?
if (absx < x_org || absx >= (x_org + width) || absy < y_org || absy >= (y_org + height))
@ -1640,7 +1641,8 @@ gboolean LEB_MouseUp(GtkWidget *widget, GdkEventButton *event, gpointer data)
int cx = (int)(event->x + 0.5);
int cy = (int)(event->y + 0.5);
heightLV = ScrlWin[0]->allocation.height;
gdk_drawable_get_size (window->window, &totwidth, &zip);
totwidth = gdk_window_get_width(window->window);
zip = gdk_window_get_height(window->window);
dest = fList = (DockOrder >> 8) -1;
if (Sizing < 10) // complete a resize operation
@ -1697,94 +1699,94 @@ void AttachSignals()
{
int i;
g_signal_connect (G_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(Close_cb), (gpointer) NULL);
g_signal_connect (G_OBJECT(CmdBtn[0]), "clicked", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) (glong) BtnLkup[0]);
g_signal_connect (G_OBJECT(CmdBtn[1]), "clicked", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) (glong) BtnLkup[1]);
g_signal_connect (G_OBJECT(CmdBtn[2]), "clicked", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) (glong) BtnLkup[2]);
g_signal_connect (G_OBJECT(CmdBtn[3]), "clicked", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) (glong) BtnLkup[3]);
g_signal_connect (G_OBJECT(CmdBtn[4]), "clicked", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) (glong) BtnLkup[4]);
G_CALLBACK(Close_cb), (gpointer) NULL);
g_signal_connect (G_OBJECT(CmdBtn[0]), "clicked", G_CALLBACK(nbCmd_cb), (gpointer) (glong) BtnLkup[0]);
g_signal_connect (G_OBJECT(CmdBtn[1]), "clicked", G_CALLBACK(nbCmd_cb), (gpointer) (glong) BtnLkup[1]);
g_signal_connect (G_OBJECT(CmdBtn[2]), "clicked", G_CALLBACK(nbCmd_cb), (gpointer) (glong) BtnLkup[2]);
g_signal_connect (G_OBJECT(CmdBtn[3]), "clicked", G_CALLBACK(Cmd_cb), (gpointer) (glong) BtnLkup[3]);
g_signal_connect (G_OBJECT(CmdBtn[4]), "clicked", G_CALLBACK(nbCmd_cb), (gpointer) (glong) BtnLkup[4]);
i = BX_SMP_PROCESSORS;
if (i > 1)
{
while (--i >= 0)
g_signal_connect (G_OBJECT(CpuBtn[i]), "clicked", GTK_SIGNAL_FUNC(CPUb_cb), (gpointer) (glong) i);
g_signal_connect (G_OBJECT(CpuBtn[i]), "clicked", G_CALLBACK(CPUb_cb), (gpointer) (glong) i);
}
// activate the menu items
g_signal_connect (G_OBJECT(ContMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_CONT);
g_signal_connect (G_OBJECT(StepMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_STEP1);
g_signal_connect (G_OBJECT(StepNMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_STEPN);
g_signal_connect (G_OBJECT(BreakMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_BREAK);
g_signal_connect (G_OBJECT(SetBrkMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_BRKPT);
g_signal_connect (G_OBJECT(ContMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_CONT);
g_signal_connect (G_OBJECT(StepMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_STEP1);
g_signal_connect (G_OBJECT(StepNMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_STEPN);
g_signal_connect (G_OBJECT(BreakMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_BREAK);
g_signal_connect (G_OBJECT(SetBrkMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_BRKPT);
Cmd2MI[CMD_BRKPT - CMD_IDX_LO + 1] = SetBrkMI;
g_signal_connect (G_OBJECT(WatchWrMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_WPTWR);
g_signal_connect (G_OBJECT(WatchWrMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_WPTWR);
Cmd2MI[CMD_WPTWR - CMD_IDX_LO + 1] = WatchWrMI;
g_signal_connect (G_OBJECT(WatchRdMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_WPTRD);
g_signal_connect (G_OBJECT(WatchRdMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_WPTRD);
Cmd2MI[CMD_WPTRD - CMD_IDX_LO + 1] = WatchRdMI;
g_signal_connect (G_OBJECT(FindMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_FIND);
g_signal_connect (G_OBJECT(RefreshMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_RFRSH);
g_signal_connect (G_OBJECT(FindMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_FIND);
g_signal_connect (G_OBJECT(RefreshMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_RFRSH);
g_signal_connect (G_OBJECT(PhyDumpMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_PHYDMP);
g_signal_connect (G_OBJECT(LinDumpMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_LINDMP);
g_signal_connect (G_OBJECT(StackMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_STACK);
g_signal_connect (G_OBJECT(GDTMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_GDTV);
g_signal_connect (G_OBJECT(IDTMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_IDTV);
g_signal_connect (G_OBJECT(PageMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_PAGEV);
g_signal_connect (G_OBJECT(PhyDumpMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_PHYDMP);
g_signal_connect (G_OBJECT(LinDumpMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_LINDMP);
g_signal_connect (G_OBJECT(StackMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_STACK);
g_signal_connect (G_OBJECT(GDTMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_GDTV);
g_signal_connect (G_OBJECT(IDTMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_IDTV);
g_signal_connect (G_OBJECT(PageMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_PAGEV);
Cmd2MI[CMD_PAGEV - CMD_IDX_LO + 1] = PageMI;
g_signal_connect (G_OBJECT(ViewBrkMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_VBRK);
g_signal_connect (G_OBJECT(MemDumpMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_CMEM);
g_signal_connect (G_OBJECT(PTreeMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_PTREE);
g_signal_connect (G_OBJECT(DisAsmMI), "activate", GTK_SIGNAL_FUNC(Cmd_cb), (gpointer) CMD_DISASM);
g_signal_connect (G_OBJECT(ViewBrkMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_VBRK);
g_signal_connect (G_OBJECT(MemDumpMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_CMEM);
g_signal_connect (G_OBJECT(PTreeMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_PTREE);
g_signal_connect (G_OBJECT(DisAsmMI), "activate", G_CALLBACK(Cmd_cb), (gpointer) CMD_DISASM);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MODEB]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_MODEB);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_ONECPU]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_ONECPU);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MODEB]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_MODEB);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_ONECPU]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_ONECPU);
Cmd2MI[CMD_ONECPU - CMD_IDX_LO + 1] = ChkMIs[CHK_CMD_ONECPU];
g_signal_connect (G_OBJECT(DefDisMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_DADEF);
g_signal_connect (G_OBJECT(SyntaxMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_ATTI);
g_signal_connect (G_OBJECT(FontMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_FONT);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_UCASE]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_UCASE);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IOWIN]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_IOWIN);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_SBTN]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_SBTN);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MHEX]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_MHEX);
g_signal_connect (G_OBJECT(DefDisMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_DADEF);
g_signal_connect (G_OBJECT(SyntaxMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_ATTI);
g_signal_connect (G_OBJECT(FontMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_FONT);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_UCASE]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_UCASE);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IOWIN]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_IOWIN);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_SBTN]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_SBTN);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MHEX]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_MHEX);
Cmd2MI[CMD_MHEX - CMD_IDX_LO + 1] = ChkMIs[CHK_CMD_MHEX];
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MASCII]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_MASCII);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_MASCII]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_MASCII);
Cmd2MI[CMD_MASCII - CMD_IDX_LO + 1] = ChkMIs[CHK_CMD_MASCII];
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_LEND]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_LEND);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IGNSA]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_IGNSA);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IGNNT]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_IGNNT);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_RCLR]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_RCLR);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_EREG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_EREG);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_LEND]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_LEND);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IGNSA]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_IGNSA);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_IGNNT]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_IGNNT);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_RCLR]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_RCLR);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_EREG]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_EREG);
Cmd2MI[CMD_EREG - CMD_IDX_LO + 1] = ChkMIs[CHK_CMD_EREG];
g_signal_connect (G_OBJECT(ChkMIs[S_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_SREG);
g_signal_connect (G_OBJECT(ChkMIs[SYS_R]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_SYSR);
g_signal_connect (G_OBJECT(ChkMIs[C_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_CREG);
g_signal_connect (G_OBJECT(ChkMIs[FPU_R]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_FPUR);
g_signal_connect (G_OBJECT(ChkMIs[S_REG]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_SREG);
g_signal_connect (G_OBJECT(ChkMIs[SYS_R]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_SYSR);
g_signal_connect (G_OBJECT(ChkMIs[C_REG]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_CREG);
g_signal_connect (G_OBJECT(ChkMIs[FPU_R]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_FPUR);
Cmd2MI[CMD_FPUR - CMD_IDX_LO + 1] = ChkMIs[FPU_R];
g_signal_connect (G_OBJECT(ChkMIs[XMM_R]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_XMMR);
g_signal_connect (G_OBJECT(ChkMIs[XMM_R]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_XMMR);
Cmd2MI[CMD_XMMR - CMD_IDX_LO + 1] = ChkMIs[XMM_R];
g_signal_connect (G_OBJECT(ChkMIs[D_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_DREG);
g_signal_connect (G_OBJECT(ChkMIs[D_REG]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_DREG);
Cmd2MI[CMD_DREG - CMD_IDX_LO + 1] = ChkMIs[D_REG];
// g_signal_connect (G_OBJECT(ChkMIs[T_REG]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_TREG);
// g_signal_connect (G_OBJECT(ChkMIs[T_REG]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_TREG);
// Cmd2MI[CMD_TREG - CMD_IDX_LO + 1] = ChkMIs[T_REG];
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_LOGVIEW]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_LOGVIEW);
g_signal_connect (G_OBJECT(ChkMIs[CHK_CMD_LOGVIEW]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_LOGVIEW);
g_signal_connect (G_OBJECT(AboutMI), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_ABOUT);
g_signal_connect (G_OBJECT(AboutMI), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_ABOUT);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_WS_1);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+1]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_WS_2);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+2]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_WS_4);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+3]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_WS_8);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+4]), "activate", GTK_SIGNAL_FUNC(nbCmd_cb), (gpointer) CMD_WS16);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_WS_1);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+1]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_WS_2);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+2]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_WS_4);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+3]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_WS_8);
g_signal_connect (G_OBJECT(ChkMIs[WSChkIdx+4]), "activate", G_CALLBACK(nbCmd_cb), (gpointer) CMD_WS16);
g_signal_connect (G_OBJECT (IEntry), "key_press_event", G_CALLBACK (keydown_event_cb), NULL);
g_signal_connect (G_OBJECT (window), "key_press_event", G_CALLBACK (redirect_keydown), NULL);
g_signal_connect (LV[0], "button_press_event", G_CALLBACK (RegMouseDown_cb), NULL);
g_signal_connect (LV[0], "row-activated", GTK_SIGNAL_FUNC(Reg_DblClick), (gpointer) 0);
g_signal_connect (LV[0], "row-activated", G_CALLBACK(Reg_DblClick), (gpointer) 0);
g_signal_connect (LV[1], "button_press_event", G_CALLBACK (AsmMouseDown_cb), NULL);
g_signal_connect (LV[1], "row-activated", GTK_SIGNAL_FUNC(Asm_DblClick), (gpointer) 1);
g_signal_connect (LV[1], "row-activated", G_CALLBACK(Asm_DblClick), (gpointer) 1);
g_signal_connect (LV[2], "button_press_event", G_CALLBACK (MemMouseDown_cb), NULL);
g_signal_connect (LV[2], "row-activated", GTK_SIGNAL_FUNC(Mem_DblClick), NULL);
g_signal_connect (LV[2], "row-activated", G_CALLBACK(Mem_DblClick), NULL);
g_signal_connect (G_OBJECT (LVEvtBox), "leave_notify_event", G_CALLBACK (LvLeave), NULL);
g_signal_connect (G_OBJECT (VSepEvtBox1), "enter_notify_event", G_CALLBACK (VsEnter), (gpointer) 0);
@ -2083,7 +2085,7 @@ void MakeList(int listnum, const char *ColNameArray[])
gtk_tree_view_set_model(GTK_TREE_VIEW(LV[listnum]), GTK_TREE_MODEL(Database));
// ListView now holds a reference to Database -- don't need the local reference anymore
g_object_unref (G_OBJECT (Database));
g_object_unref(G_OBJECT (Database));
}
// gtk version of multithreading (doesn't seem to work on some platforms?):
@ -2226,7 +2228,7 @@ bx_bool OSInit()
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrlWinOut), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
OText = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(OText), FALSE); // set it to "read only"
GTK_WIDGET_UNSET_FLAGS(OText, GTK_CAN_FOCUS);
gtk_widget_set_can_focus(OText, FALSE);
gtk_container_add (GTK_CONTAINER(ScrlWinOut), OText);
// a TextView *already has* a viewport, so DON'T add another one -- or it won't scroll properly!
// gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ScrlWinOut), OText);
@ -2253,7 +2255,7 @@ bx_bool OSInit()
sprintf (bigbuf, "<b>%s</b>",BTxt[i]); // create "bold" pango markup for buttons
gtk_label_set_markup (GTK_LABEL(tmpLbl), bigbuf);
gtk_container_add (GTK_CONTAINER(GTK_BUTTON(CmdBtn[i])), tmpLbl);
GTK_WIDGET_UNSET_FLAGS(CmdBtn[i], GTK_CAN_FOCUS);
gtk_widget_set_can_focus(CmdBtn[i], FALSE);
gtk_box_pack_start(GTK_BOX(CmdBHbox), CmdBtn[i], TRUE, TRUE, 0);
}
gtk_box_pack_start(GTK_BOX(MainVbox), CmdBHbox, FALSE, FALSE, 0);
@ -2271,7 +2273,7 @@ bx_bool OSInit()
CpuB_label[i] = tmpLbl;
gtk_label_set_markup (GTK_LABEL(tmpLbl), bigbuf);
gtk_container_add (GTK_CONTAINER(GTK_BUTTON(CpuBtn[i])), tmpLbl);
GTK_WIDGET_UNSET_FLAGS(CpuBtn[i], GTK_CAN_FOCUS);
gtk_widget_set_can_focus(CpuBtn[i], FALSE);
gtk_box_pack_start(GTK_BOX(CpuBHbox), CpuBtn[i], TRUE, TRUE, 0);
sprintf (bigbuf, "<b>cpu%d</b>",++i); // create the next CPU button label
}
@ -2291,7 +2293,7 @@ bx_bool OSInit()
// always want a horizontal scrollbar, to divide lists from Output window visually
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrlWin[i]), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
LV[i] = gtk_tree_view_new();
GTK_WIDGET_UNSET_FLAGS(LV[i], GTK_CAN_FOCUS);
gtk_widget_set_can_focus(LV[i], FALSE);
gtk_container_add (GTK_CONTAINER(ScrlWin[i]), LV[i]);
// all TreeViews *already have* a viewport, so DON'T add another one with the ScrollWindow, or it won't scroll properly!
MakeList(i, &LColNames[i*3]);
@ -2310,14 +2312,14 @@ bx_bool OSInit()
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(treecol, renderer, TRUE);
gtk_tree_view_column_add_attribute(treecol, renderer, "text", 0); // pull display text from treestore col 0
GTK_WIDGET_UNSET_FLAGS(PTree, GTK_CAN_FOCUS);
gtk_widget_set_can_focus(PTree, FALSE);
treestore = gtk_tree_store_new(1, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(PTree), GTK_TREE_MODEL(treestore));
g_object_unref(treestore); // PTree now references treestore itself
gtk_widget_ref (PTree); // keep an extra ref to both ScrlWin[2] widgets,
gtk_widget_ref (LV[2]); // so they don't get deleted when removed from their container
gtk_object_sink (GTK_OBJECT (PTree)); // the PTree reference is "floating", so "sink" it
g_object_ref(PTree); // keep an extra ref to both ScrlWin[2] widgets,
g_object_ref(LV[2]); // so they don't get deleted when removed from their container
g_object_ref_sink(GTK_OBJECT (PTree)); // the PTree reference is "floating", so "sink" it
AttachSignals(); // this must be called AFTER InitMenus()
TakeInputFocus();
@ -2335,8 +2337,8 @@ bx_bool OSInit()
// build the sizing/docking cursors
SizeCurs = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
DockCurs = gdk_cursor_new (GDK_CROSSHAIR);
gdk_cursor_ref (SizeCurs);
gdk_cursor_ref (DockCurs);
gdk_cursor_ref(SizeCurs);
gdk_cursor_ref(DockCurs);
if (!font_init) {
char *fn;
@ -2354,7 +2356,7 @@ bx_bool OSInit()
pango_layout_set_font_description (layout, fontdesc);
pango_layout_get_pixel_size (layout, &width, &i);
pango_font_description_free (fontdesc);
g_object_unref (layout);
g_object_unref(layout);
OneCharWide = width; // The "width" I'm getting is about half what I expect
// OneCharWide = width >> 1; // pretend that an average char width is half an "M"
if (OneCharWide > 12) OneCharWide = 12;