Mercurial > dwindows
comparison gtk3/dw.c @ 1096:5261439c7227
Fix bug with setting up container on 64bit platform.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 30 Jun 2011 09:49:07 +0000 |
parents | 0fc7387abfd1 |
children | 8e9db23a8c31 |
comparison
equal
deleted
inserted
replaced
1095:1ab93c92d3ea | 1096:5261439c7227 |
---|---|
647 attributes.event_mask = gtk_widget_get_events (widget) | | 647 attributes.event_mask = gtk_widget_get_events (widget) | |
648 GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | | 648 GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | |
649 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | | 649 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | |
650 GDK_POINTER_MOTION_HINT_MASK; | 650 GDK_POINTER_MOTION_HINT_MASK; |
651 attributes.visual = gtk_widget_get_visual (widget); | 651 attributes.visual = gtk_widget_get_visual (widget); |
652 | 652 |
653 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; | 653 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; |
654 gtk_widget_set_parent_window(widget, gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask)); | 654 gtk_widget_set_parent_window(widget, gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask)); |
655 | 655 |
656 gtk_widget_set_style(widget, gtk_style_attach (gtk_widget_get_style(widget), gtk_widget_get_window(widget))); | 656 gtk_widget_set_style(widget, gtk_style_attach (gtk_widget_get_style(widget), gtk_widget_get_window(widget))); |
657 | 657 |
971 | 971 |
972 mdi->drag_button = event->button.button; | 972 mdi->drag_button = event->button.button; |
973 if ((child->state == CHILD_MAXIMIZED) || (child->state == CHILD_ICONIFIED)) | 973 if ((child->state == CHILD_MAXIMIZED) || (child->state == CHILD_ICONIFIED)) |
974 { | 974 { |
975 GtkAllocation allocation; | 975 GtkAllocation allocation; |
976 | 976 |
977 child->state = CHILD_NORMAL; | 977 child->state = CHILD_NORMAL; |
978 gtk_widget_get_allocation(child->widget, &allocation); | 978 gtk_widget_get_allocation(child->widget, &allocation); |
979 child->x = allocation.x; | 979 child->x = allocation.x; |
980 child->y = allocation.y; | 980 child->y = allocation.y; |
981 child->width = allocation.width; | 981 child->width = allocation.width; |
1403 | 1403 |
1404 if(store) | 1404 if(store) |
1405 { | 1405 { |
1406 GtkTreeIter iter; | 1406 GtkTreeIter iter; |
1407 GtkTreePath *path; | 1407 GtkTreePath *path; |
1408 | 1408 |
1409 _dw_recursing = 1; | 1409 _dw_recursing = 1; |
1410 | 1410 |
1411 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) | 1411 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) |
1412 { | 1412 { |
1413 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); | 1413 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
1414 | 1414 |
1415 if(path) | 1415 if(path) |
1416 { | 1416 { |
1417 gint *indices = gtk_tree_path_get_indices(path); | 1417 gint *indices = gtk_tree_path_get_indices(path); |
1418 | 1418 |
1419 if(indices) | 1419 if(indices) |
1420 { | 1420 { |
1421 int (*selectfunc)(HWND, int, void *) = work.func; | 1421 int (*selectfunc)(HWND, int, void *) = work.func; |
1422 | 1422 |
1423 retval = selectfunc(work.window, indices[0], work.data); | 1423 retval = selectfunc(work.window, indices[0], work.data); |
1424 } | 1424 } |
1425 gtk_tree_path_free(path); | 1425 gtk_tree_path_free(path); |
1426 } | 1426 } |
1427 } | 1427 } |
1428 | 1428 |
1429 _dw_recursing = 0; | 1429 _dw_recursing = 0; |
1430 } | 1430 } |
1431 } | 1431 } |
1432 return retval; | 1432 return retval; |
1433 } | 1433 } |
1465 } | 1465 } |
1466 } | 1466 } |
1467 else | 1467 else |
1468 { | 1468 { |
1469 GtkTreePath *path; | 1469 GtkTreePath *path; |
1470 | 1470 |
1471 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); | 1471 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
1472 if(path) | 1472 if(path) |
1473 { | 1473 { |
1474 GtkTreeIter iter; | 1474 GtkTreeIter iter; |
1475 | 1475 |
1476 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) | 1476 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
1477 { | 1477 { |
1478 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) | 1478 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
1479 { | 1479 { |
1480 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, -1); | 1480 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, -1); |
1533 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); | 1533 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
1534 } | 1534 } |
1535 else | 1535 else |
1536 { | 1536 { |
1537 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); | 1537 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
1538 | 1538 |
1539 if(path) | 1539 if(path) |
1540 { | 1540 { |
1541 gint *indices = gtk_tree_path_get_indices(path); | 1541 gint *indices = gtk_tree_path_get_indices(path); |
1542 | 1542 |
1543 if(indices) | 1543 if(indices) |
1544 { | 1544 { |
1545 int (*selectfunc)(HWND, int, void *) = work.func; | 1545 int (*selectfunc)(HWND, int, void *) = work.func; |
1546 | 1546 |
1547 retval = selectfunc(work.window, indices[0], work.data); | 1547 retval = selectfunc(work.window, indices[0], work.data); |
1548 } | 1548 } |
1549 gtk_tree_path_free(path); | 1549 gtk_tree_path_free(path); |
1550 } | 1550 } |
1551 } | 1551 } |
1552 } | 1552 } |
1553 else | 1553 else |
1554 { | 1554 { |
1555 GtkTreePath *path; | 1555 GtkTreePath *path; |
1556 | 1556 |
1557 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); | 1557 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
1558 if(path) | 1558 if(path) |
1559 { | 1559 { |
1560 GtkTreeIter iter; | 1560 GtkTreeIter iter; |
1561 | 1561 |
1562 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) | 1562 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
1563 { | 1563 { |
1564 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) | 1564 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE)) |
1565 { | 1565 { |
1566 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1); | 1566 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1); |
1572 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); | 1572 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); |
1573 } | 1573 } |
1574 else | 1574 else |
1575 { | 1575 { |
1576 gint *indices = gtk_tree_path_get_indices(path); | 1576 gint *indices = gtk_tree_path_get_indices(path); |
1577 | 1577 |
1578 if(indices) | 1578 if(indices) |
1579 { | 1579 { |
1580 int (*selectfunc)(HWND, int, void *) = work.func; | 1580 int (*selectfunc)(HWND, int, void *) = work.func; |
1581 | 1581 |
1582 retval = selectfunc(work.window, indices[0], work.data); | 1582 retval = selectfunc(work.window, indices[0], work.data); |
1583 } | 1583 } |
1584 } | 1584 } |
1585 } | 1585 } |
1586 gtk_tree_path_free(path); | 1586 gtk_tree_path_free(path); |
1620 (event->type == GDK_KEY_PRESS && keyevent->keyval == VK_RETURN)) | 1620 (event->type == GDK_KEY_PRESS && keyevent->keyval == VK_RETURN)) |
1621 { | 1621 { |
1622 int (*contextfunc)(HWND, char *, void *) = work.func; | 1622 int (*contextfunc)(HWND, char *, void *) = work.func; |
1623 char *text = NULL; | 1623 char *text = NULL; |
1624 | 1624 |
1625 /* Prevent some double events from happening */ | 1625 /* Prevent some double events from happening */ |
1626 if(event->type == GDK_2BUTTON_PRESS) | 1626 if(event->type == GDK_2BUTTON_PRESS) |
1627 { | 1627 { |
1628 g_object_set_data(G_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(1)); | 1628 g_object_set_data(G_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(1)); |
1629 } | 1629 } |
1630 | 1630 |
1631 /* Sanity check */ | 1631 /* Sanity check */ |
1632 if(GTK_IS_TREE_VIEW(widget)) | 1632 if(GTK_IS_TREE_VIEW(widget)) |
1633 { | 1633 { |
1634 GtkTreePath *path; | 1634 GtkTreePath *path; |
1635 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | 1635 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
1636 | 1636 |
1637 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); | 1637 gtk_tree_view_get_cursor(GTK_TREE_VIEW(widget), &path, NULL); |
1638 if(path) | 1638 if(path) |
1639 { | 1639 { |
1640 GtkTreeIter iter; | 1640 GtkTreeIter iter; |
1641 | 1641 |
1642 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) | 1642 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
1643 { | 1643 { |
1644 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 1644 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
1645 { | 1645 { |
1646 gtk_tree_model_get(store, &iter, 0, &text, -1); | 1646 gtk_tree_model_get(store, &iter, 0, &text, -1); |
1692 { | 1692 { |
1693 GtkWidget *tree = data; | 1693 GtkWidget *tree = data; |
1694 gint handlerdata = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tree), "_dw_column_click_id")); | 1694 gint handlerdata = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tree), "_dw_column_click_id")); |
1695 SignalHandler work; | 1695 SignalHandler work; |
1696 int retval = FALSE; | 1696 int retval = FALSE; |
1697 | 1697 |
1698 if(handlerdata) | 1698 if(handlerdata) |
1699 { | 1699 { |
1700 work = _get_signal_handler(tree, GINT_TO_POINTER(handlerdata-1)); | 1700 work = _get_signal_handler(tree, GINT_TO_POINTER(handlerdata-1)); |
1701 | 1701 |
1702 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1702 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1781 int z, id = GPOINTER_TO_INT(icon); | 1781 int z, id = GPOINTER_TO_INT(icon); |
1782 | 1782 |
1783 if(id > 65535) | 1783 if(id > 65535) |
1784 { | 1784 { |
1785 GdkPixbuf *icon_pixbuf = icon; | 1785 GdkPixbuf *icon_pixbuf = icon; |
1786 | 1786 |
1787 if(userwidth) | 1787 if(userwidth) |
1788 *userwidth = gdk_pixbuf_get_width(icon_pixbuf); | 1788 *userwidth = gdk_pixbuf_get_width(icon_pixbuf); |
1789 if(userheight) | 1789 if(userheight) |
1790 *userheight = gdk_pixbuf_get_height(icon_pixbuf); | 1790 *userheight = gdk_pixbuf_get_height(icon_pixbuf); |
1791 | 1791 |
1792 return icon; | 1792 return icon; |
1793 } | 1793 } |
1794 | 1794 |
1795 for(z=0;z<_resources.resource_max;z++) | 1795 for(z=0;z<_resources.resource_max;z++) |
1796 { | 1796 { |
1816 } | 1816 } |
1817 | 1817 |
1818 void _init_thread(void) | 1818 void _init_thread(void) |
1819 { | 1819 { |
1820 GdkColor *foreground = malloc(sizeof(GdkColor)); | 1820 GdkColor *foreground = malloc(sizeof(GdkColor)); |
1821 | 1821 |
1822 foreground->pixel = foreground->red = foreground->green = foreground->blue = 0; | 1822 foreground->pixel = foreground->red = foreground->green = foreground->blue = 0; |
1823 pthread_setspecific(_dw_fg_color_key, foreground); | 1823 pthread_setspecific(_dw_fg_color_key, foreground); |
1824 pthread_setspecific(_dw_bg_color_key, NULL); | 1824 pthread_setspecific(_dw_bg_color_key, NULL); |
1825 } | 1825 } |
1826 | 1826 |
1946 _dw_border_height = atoi(tmp); | 1946 _dw_border_height = atoi(tmp); |
1947 | 1947 |
1948 pthread_key_create(&_dw_fg_color_key, NULL); | 1948 pthread_key_create(&_dw_fg_color_key, NULL); |
1949 pthread_key_create(&_dw_bg_color_key, NULL); | 1949 pthread_key_create(&_dw_bg_color_key, NULL); |
1950 pthread_key_create(&_dw_mutex_key, NULL); | 1950 pthread_key_create(&_dw_mutex_key, NULL); |
1951 | 1951 |
1952 _init_thread(); | 1952 _init_thread(); |
1953 | 1953 |
1954 /* Create a global object for glib activities */ | 1954 /* Create a global object for glib activities */ |
1955 _DWObject = g_object_new(G_TYPE_OBJECT, NULL); | 1955 _DWObject = g_object_new(G_TYPE_OBJECT, NULL); |
1956 | 1956 |
1957 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); | 1957 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); |
1958 | 1958 |
2201 char **xpm_data = NULL; | 2201 char **xpm_data = NULL; |
2202 int x, y, extra_width=0,text_width,text_height; | 2202 int x, y, extra_width=0,text_width,text_height; |
2203 int width,height; | 2203 int width,height; |
2204 | 2204 |
2205 va_start(args, format); | 2205 va_start(args, format); |
2206 vsnprintf(outbuf, 999, format, args); | 2206 vsnprintf(outbuf, 999, format, args); |
2207 va_end(args); | 2207 va_end(args); |
2208 | 2208 |
2209 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); | 2209 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); |
2210 mainbox = dw_box_new(DW_VERT, 10); | 2210 mainbox = dw_box_new(DW_VERT, 10); |
2211 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); | 2211 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); |
2249 text_width = 240; | 2249 text_width = 240; |
2250 text_height = 0; | 2250 text_height = 0; |
2251 stext = dw_text_new(outbuf, 0); | 2251 stext = dw_text_new(outbuf, 0); |
2252 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); | 2252 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); |
2253 dw_font_text_extents_get(stext, NULL, outbuf, &width, &height); | 2253 dw_font_text_extents_get(stext, NULL, outbuf, &width, &height); |
2254 | 2254 |
2255 text_width = min( width, dw_screen_width() - extra_width - 100 ); | 2255 text_width = min( width, dw_screen_width() - extra_width - 100 ); |
2256 text_height = min( height, dw_screen_height() ); | 2256 text_height = min( height, dw_screen_height() ); |
2257 | 2257 |
2258 dw_box_pack_start(texttargetbox, stext, text_width, text_height, TRUE, TRUE, 2); | 2258 dw_box_pack_start(texttargetbox, stext, text_width, text_height, TRUE, TRUE, 2); |
2259 | 2259 |
2260 /* Buttons */ | 2260 /* Buttons */ |
2261 buttonbox = dw_box_new(DW_HORZ, 10); | 2261 buttonbox = dw_box_new(DW_HORZ, 10); |
2262 | 2262 |
2536 { | 2536 { |
2537 GtkWidget *tmp = gtk_frame_get_label_widget(GTK_FRAME(handle)); | 2537 GtkWidget *tmp = gtk_frame_get_label_widget(GTK_FRAME(handle)); |
2538 if(tmp) | 2538 if(tmp) |
2539 handle2 = tmp; | 2539 handle2 = tmp; |
2540 } | 2540 } |
2541 | 2541 |
2542 /* Detect Dynamic Windows style font name... | 2542 /* Detect Dynamic Windows style font name... |
2543 * Format: ##.Fontname | 2543 * Format: ##.Fontname |
2544 * and convert to a Pango name | 2544 * and convert to a Pango name |
2545 */ | 2545 */ |
2546 if(name && isdigit(*font)) | 2546 if(name && isdigit(*font)) |
2547 { | 2547 { |
2582 return FALSE; | 2582 return FALSE; |
2583 | 2583 |
2584 fd = dwwait->data; | 2584 fd = dwwait->data; |
2585 fontname = gtk_font_selection_dialog_get_font_name(fd); | 2585 fontname = gtk_font_selection_dialog_get_font_name(fd); |
2586 if(fontname && (retfont = strdup(fontname))) | 2586 if(fontname && (retfont = strdup(fontname))) |
2587 { | 2587 { |
2588 len = strlen(fontname); | 2588 len = strlen(fontname); |
2589 /* Convert to Dynamic Windows format if we can... */ | 2589 /* Convert to Dynamic Windows format if we can... */ |
2590 if(len > 0 && isdigit(fontname[len-1])) | 2590 if(len > 0 && isdigit(fontname[len-1])) |
2591 { | 2591 { |
2592 int size; | 2592 int size; |
2593 | 2593 |
2594 x=len-1; | 2594 x=len-1; |
2595 while(x > 0 && fontname[x] != ' ') | 2595 while(x > 0 && fontname[x] != ' ') |
2596 { | 2596 { |
2597 x--; | 2597 x--; |
2598 } | 2598 } |
2640 char *font = currfont ? strdup(currfont) : NULL; | 2640 char *font = currfont ? strdup(currfont) : NULL; |
2641 char *name = font ? strchr(font, '.') : NULL; | 2641 char *name = font ? strchr(font, '.') : NULL; |
2642 int _locked_by_me = FALSE; | 2642 int _locked_by_me = FALSE; |
2643 char *retfont = NULL; | 2643 char *retfont = NULL; |
2644 DWDialog *dwwait; | 2644 DWDialog *dwwait; |
2645 | 2645 |
2646 /* Detect Dynamic Windows style font name... | 2646 /* Detect Dynamic Windows style font name... |
2647 * Format: ##.Fontname | 2647 * Format: ##.Fontname |
2648 * and convert to a Pango name | 2648 * and convert to a Pango name |
2649 */ | 2649 */ |
2650 if(name && isdigit(*font)) | 2650 if(name && isdigit(*font)) |
2651 { | 2651 { |
2670 if(font) | 2670 if(font) |
2671 { | 2671 { |
2672 gtk_font_selection_dialog_set_font_name(fd, font); | 2672 gtk_font_selection_dialog_set_font_name(fd, font); |
2673 free(font); | 2673 free(font); |
2674 } | 2674 } |
2675 | 2675 |
2676 _dw_font_active = 1; | 2676 _dw_font_active = 1; |
2677 | 2677 |
2678 dwwait = dw_dialog_new((void *)fd); | 2678 dwwait = dw_dialog_new((void *)fd); |
2679 | 2679 |
2680 ok_button = gtk_font_selection_dialog_get_ok_button(fd); | 2680 ok_button = gtk_font_selection_dialog_get_ok_button(fd); |
2723 { | 2723 { |
2724 pfont = pango_context_get_font_description( pcontext ); | 2724 pfont = pango_context_get_font_description( pcontext ); |
2725 if ( pfont ) | 2725 if ( pfont ) |
2726 { | 2726 { |
2727 int len, x; | 2727 int len, x; |
2728 | 2728 |
2729 font = pango_font_description_to_string( pfont ); | 2729 font = pango_font_description_to_string( pfont ); |
2730 retfont = strdup(font); | 2730 retfont = strdup(font); |
2731 len = strlen(font); | 2731 len = strlen(font); |
2732 /* Convert to Dynamic Windows format if we can... */ | 2732 /* Convert to Dynamic Windows format if we can... */ |
2733 if(len > 0 && isdigit(font[len-1])) | 2733 if(len > 0 && isdigit(font[len-1])) |
2734 { | 2734 { |
2735 int size; | 2735 int size; |
2736 | 2736 |
2737 x=len-1; | 2737 x=len-1; |
2738 while(x > 0 && font[x] != ' ') | 2738 while(x > 0 && font[x] != ' ') |
2739 { | 2739 { |
2740 x--; | 2740 x--; |
2741 } | 2741 } |
3338 else | 3338 else |
3339 { | 3339 { |
3340 if (check) | 3340 if (check) |
3341 { | 3341 { |
3342 char numbuf[10]; | 3342 char numbuf[10]; |
3343 | 3343 |
3344 tmphandle = gtk_check_menu_item_new_with_label(tempbuf); | 3344 tmphandle = gtk_check_menu_item_new_with_label(tempbuf); |
3345 if (accel && accel_group) | 3345 if (accel && accel_group) |
3346 { | 3346 { |
3347 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); | 3347 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
3348 #if 0 /* TODO: This isn't working right */ | 3348 #if 0 /* TODO: This isn't working right */ |
3353 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); | 3353 g_object_set_data(G_OBJECT(menu), numbuf, (gpointer)tmphandle); |
3354 } | 3354 } |
3355 else | 3355 else |
3356 { | 3356 { |
3357 char numbuf[10]; | 3357 char numbuf[10]; |
3358 | 3358 |
3359 tmphandle=gtk_menu_item_new_with_label(tempbuf); | 3359 tmphandle=gtk_menu_item_new_with_label(tempbuf); |
3360 if (accel && accel_group) | 3360 if (accel && accel_group) |
3361 { | 3361 { |
3362 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); | 3362 gtk_label_set_use_underline(GTK_LABEL(gtk_bin_get_child(GTK_BIN(tmphandle))), TRUE); |
3363 #if 0 /* TODO: This isn't working right */ | 3363 #if 0 /* TODO: This isn't working right */ |
4127 } | 4127 } |
4128 store = gtk_list_store_new(1, G_TYPE_STRING); | 4128 store = gtk_list_store_new(1, G_TYPE_STRING); |
4129 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); | 4129 tree = _tree_setup(tmp, GTK_TREE_MODEL(store)); |
4130 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); | 4130 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); |
4131 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); | 4131 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); |
4132 | 4132 |
4133 col = gtk_tree_view_column_new(); | 4133 col = gtk_tree_view_column_new(); |
4134 rend = gtk_cell_renderer_text_new(); | 4134 rend = gtk_cell_renderer_text_new(); |
4135 gtk_tree_view_column_pack_start(col, rend, TRUE); | 4135 gtk_tree_view_column_pack_start(col, rend, TRUE); |
4136 gtk_tree_view_column_add_attribute(col, rend, "text", 0); | 4136 gtk_tree_view_column_add_attribute(col, rend, "text", 0); |
4137 | 4137 |
4138 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); | 4138 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); |
4139 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); | 4139 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); |
4140 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); | 4140 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); |
4141 | 4141 |
4142 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); | 4142 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
4143 if(multi) | 4143 if(multi) |
4144 { | 4144 { |
4145 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); | 4145 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
4146 } | 4146 } |
4147 else | 4147 else |
4148 { | 4148 { |
4149 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | 4149 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); |
4150 } | 4150 } |
4151 gtk_widget_show(tree); | 4151 gtk_widget_show(tree); |
4152 DW_MUTEX_UNLOCK; | 4152 DW_MUTEX_UNLOCK; |
4153 return tmp; | 4153 return tmp; |
4154 } | 4154 } |
4155 | 4155 |
4156 /* | 4156 /* |
5394 GtkListStore *store; | 5394 GtkListStore *store; |
5395 GtkTreeViewColumn *col; | 5395 GtkTreeViewColumn *col; |
5396 GtkCellRenderer *rend; | 5396 GtkCellRenderer *rend; |
5397 GtkTreeSelection *sel; | 5397 GtkTreeSelection *sel; |
5398 int _locked_by_me = FALSE; | 5398 int _locked_by_me = FALSE; |
5399 GType *array = calloc(count + 2, sizeof(gint)); | 5399 GType *array = calloc(count + 2, sizeof(GType)); |
5400 | 5400 |
5401 DW_MUTEX_LOCK; | 5401 DW_MUTEX_LOCK; |
5402 /* Save some of the info so it is easily accessible */ | 5402 /* Save some of the info so it is easily accessible */ |
5403 g_object_set_data(G_OBJECT(handle), "_dw_cont_columns", GINT_TO_POINTER(count)); | 5403 g_object_set_data(G_OBJECT(handle), "_dw_cont_columns", GINT_TO_POINTER(count)); |
5404 g_object_set_data(G_OBJECT(handle), "_dw_cont_extra", GINT_TO_POINTER(extra)); | 5404 g_object_set_data(G_OBJECT(handle), "_dw_cont_extra", GINT_TO_POINTER(extra)); |
5405 | 5405 |
5406 /* First param is row title/data */ | 5406 /* First param is row title/data */ |
5407 array[0] = G_TYPE_POINTER; | 5407 array[0] = G_TYPE_POINTER; |
5408 array[1] = G_TYPE_POINTER; | 5408 array[1] = G_TYPE_POINTER; |
5409 /* First loop... create array to create the store */ | 5409 /* First loop... create array to create the store */ |
5410 for(z=0;z<count;z++) | 5410 for(z=0;z<count;z++) |
5444 { | 5444 { |
5445 sprintf(numbuf, "_dw_cont_col%d", z); | 5445 sprintf(numbuf, "_dw_cont_col%d", z); |
5446 g_object_set_data(G_OBJECT(tree), numbuf, GINT_TO_POINTER(flags[z])); | 5446 g_object_set_data(G_OBJECT(tree), numbuf, GINT_TO_POINTER(flags[z])); |
5447 col = gtk_tree_view_column_new(); | 5447 col = gtk_tree_view_column_new(); |
5448 rend = NULL; | 5448 rend = NULL; |
5449 | 5449 |
5450 if(z == 0 && flags[z] & DW_CFA_STRINGANDICON) | 5450 if(z == 0 && flags[z] & DW_CFA_STRINGANDICON) |
5451 { | 5451 { |
5452 rend = gtk_cell_renderer_pixbuf_new(); | 5452 rend = gtk_cell_renderer_pixbuf_new(); |
5453 gtk_tree_view_column_pack_start(col, rend, FALSE); | 5453 gtk_tree_view_column_pack_start(col, rend, FALSE); |
5454 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); | 5454 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); |
5665 * handle: Handle to icon returned by dw_icon_load(). | 5665 * handle: Handle to icon returned by dw_icon_load(). |
5666 */ | 5666 */ |
5667 void dw_icon_free(HICN handle) | 5667 void dw_icon_free(HICN handle) |
5668 { | 5668 { |
5669 int iicon = (int)handle; | 5669 int iicon = (int)handle; |
5670 | 5670 |
5671 if(iicon > 65535) | 5671 if(iicon > 65535) |
5672 { | 5672 { |
5673 g_object_unref(handle); | 5673 g_object_unref(handle); |
5674 } | 5674 } |
5675 } | 5675 } |
5687 GtkListStore *store = NULL; | 5687 GtkListStore *store = NULL; |
5688 int _locked_by_me = FALSE; | 5688 int _locked_by_me = FALSE; |
5689 | 5689 |
5690 DW_MUTEX_LOCK; | 5690 DW_MUTEX_LOCK; |
5691 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 5691 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5692 | 5692 |
5693 /* Make sure it is the correct tree type */ | 5693 /* Make sure it is the correct tree type */ |
5694 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 5694 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5695 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 5695 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5696 | 5696 |
5697 if(store) | 5697 if(store) |
5698 { | 5698 { |
5699 GtkTreeIter iter; | 5699 GtkTreeIter iter; |
5700 | 5700 |
5701 prevrowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); | 5701 prevrowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
5702 | 5702 |
5703 for(z=0;z<rowcount;z++) | 5703 for(z=0;z<rowcount;z++) |
5704 { | 5704 { |
5705 gtk_list_store_append(store, &iter); | 5705 gtk_list_store_append(store, &iter); |
5723 GtkListStore *store = NULL; | 5723 GtkListStore *store = NULL; |
5724 int _locked_by_me = FALSE; | 5724 int _locked_by_me = FALSE; |
5725 | 5725 |
5726 DW_MUTEX_LOCK; | 5726 DW_MUTEX_LOCK; |
5727 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 5727 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5728 | 5728 |
5729 /* Make sure it is the correct tree type */ | 5729 /* Make sure it is the correct tree type */ |
5730 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 5730 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5731 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 5731 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5732 | 5732 |
5733 if(store) | 5733 if(store) |
5734 { | 5734 { |
5735 GtkTreeIter iter; | 5735 GtkTreeIter iter; |
5736 | 5736 |
5737 sprintf(numbuf, "_dw_cont_col%d", column); | 5737 sprintf(numbuf, "_dw_cont_col%d", column); |
5738 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf)); | 5738 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf)); |
5739 if(pointer) | 5739 if(pointer) |
5740 { | 5740 { |
5741 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); | 5741 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); |
5750 char *tmp = (char *)thisdata[1]; | 5750 char *tmp = (char *)thisdata[1]; |
5751 GdkPixbuf *pixbuf = _find_pixbuf(hicon, NULL, NULL); | 5751 GdkPixbuf *pixbuf = _find_pixbuf(hicon, NULL, NULL); |
5752 | 5752 |
5753 if(pixbuf) | 5753 if(pixbuf) |
5754 gtk_list_store_set(store, &iter, 1, pixbuf, -1); | 5754 gtk_list_store_set(store, &iter, 1, pixbuf, -1); |
5755 | 5755 |
5756 gtk_list_store_set(store, &iter, 2, tmp, -1); | 5756 gtk_list_store_set(store, &iter, 2, tmp, -1); |
5757 } | 5757 } |
5758 else if(flag & DW_CFA_BITMAPORICON) | 5758 else if(flag & DW_CFA_BITMAPORICON) |
5759 { | 5759 { |
5760 HICN hicon = *((HICN *)data); | 5760 HICN hicon = *((HICN *)data); |
5871 * data: Pointer to the data to be added. | 5871 * data: Pointer to the data to be added. |
5872 */ | 5872 */ |
5873 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) | 5873 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) |
5874 { | 5874 { |
5875 void *data[2] = { (void *)&icon, (void *)filename }; | 5875 void *data[2] = { (void *)&icon, (void *)filename }; |
5876 | 5876 |
5877 _dw_container_set_item(handle, pointer, 0, row, (void *)data); | 5877 _dw_container_set_item(handle, pointer, 0, row, (void *)data); |
5878 } | 5878 } |
5879 | 5879 |
5880 /* | 5880 /* |
5881 * Sets an item in specified row and column to the given data. | 5881 * Sets an item in specified row and column to the given data. |
5954 GtkWidget *cont; | 5954 GtkWidget *cont; |
5955 int _locked_by_me = FALSE; | 5955 int _locked_by_me = FALSE; |
5956 | 5956 |
5957 DW_MUTEX_LOCK; | 5957 DW_MUTEX_LOCK; |
5958 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 5958 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
5959 | 5959 |
5960 /* Make sure it is the correct tree type */ | 5960 /* Make sure it is the correct tree type */ |
5961 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 5961 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
5962 { | 5962 { |
5963 GtkTreeViewColumn *col = gtk_tree_view_get_column(GTK_TREE_VIEW(cont), column); | 5963 GtkTreeViewColumn *col = gtk_tree_view_get_column(GTK_TREE_VIEW(cont), column); |
5964 | 5964 |
5965 if(col && GTK_IS_TREE_VIEW_COLUMN(col)) | 5965 if(col && GTK_IS_TREE_VIEW_COLUMN(col)) |
5966 { | 5966 { |
5967 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(col), width); | 5967 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(col), width); |
5968 } | 5968 } |
5969 } | 5969 } |
5983 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 5983 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
5984 | 5984 |
5985 if(store) | 5985 if(store) |
5986 { | 5986 { |
5987 GtkTreeIter iter; | 5987 GtkTreeIter iter; |
5988 | 5988 |
5989 if(pointer) | 5989 if(pointer) |
5990 { | 5990 { |
5991 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); | 5991 row += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_insertpos")); |
5992 } | 5992 } |
5993 | 5993 |
6047 GtkListStore *store = NULL; | 6047 GtkListStore *store = NULL; |
6048 int _locked_by_me = FALSE; | 6048 int _locked_by_me = FALSE; |
6049 | 6049 |
6050 DW_MUTEX_LOCK; | 6050 DW_MUTEX_LOCK; |
6051 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6051 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6052 | 6052 |
6053 /* Make sure it is the correct tree type */ | 6053 /* Make sure it is the correct tree type */ |
6054 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6054 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6055 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 6055 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
6056 | 6056 |
6057 if(store) | 6057 if(store) |
6089 GtkListStore *store = NULL; | 6089 GtkListStore *store = NULL; |
6090 int _locked_by_me = FALSE; | 6090 int _locked_by_me = FALSE; |
6091 | 6091 |
6092 DW_MUTEX_LOCK; | 6092 DW_MUTEX_LOCK; |
6093 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6093 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6094 | 6094 |
6095 /* Make sure it is the correct tree type */ | 6095 /* Make sure it is the correct tree type */ |
6096 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6096 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6097 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 6097 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
6098 | 6098 |
6099 if(store) | 6099 if(store) |
6119 GtkWidget *cont; | 6119 GtkWidget *cont; |
6120 int _locked_by_me = FALSE; | 6120 int _locked_by_me = FALSE; |
6121 | 6121 |
6122 DW_MUTEX_LOCK; | 6122 DW_MUTEX_LOCK; |
6123 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6123 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6124 | 6124 |
6125 /* Make sure it is the correct tree type */ | 6125 /* Make sure it is the correct tree type */ |
6126 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6126 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6127 { | 6127 { |
6128 GtkAdjustment *adjust = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(cont)); | 6128 GtkAdjustment *adjust = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(cont)); |
6129 | 6129 |
6130 if(adjust) | 6130 if(adjust) |
6131 { | 6131 { |
6132 gint rowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); | 6132 gint rowcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_rowcount")); |
6133 gdouble currpos = gtk_adjustment_get_value(adjust); | 6133 gdouble currpos = gtk_adjustment_get_value(adjust); |
6134 gdouble upper = gtk_adjustment_get_upper(adjust); | 6134 gdouble upper = gtk_adjustment_get_upper(adjust); |
6135 gdouble lower = gtk_adjustment_get_lower(adjust); | 6135 gdouble lower = gtk_adjustment_get_lower(adjust); |
6136 gdouble change; | 6136 gdouble change; |
6137 | 6137 |
6138 /* Safety check */ | 6138 /* Safety check */ |
6139 if(rowcount < 1) | 6139 if(rowcount < 1) |
6140 { | 6140 { |
6141 DW_MUTEX_UNLOCK; | 6141 DW_MUTEX_UNLOCK; |
6142 return; | 6142 return; |
6212 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); | 6212 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); |
6213 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); | 6213 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
6214 if(list) | 6214 if(list) |
6215 { | 6215 { |
6216 GtkTreePath *path = g_list_nth_data(list, 0); | 6216 GtkTreePath *path = g_list_nth_data(list, 0); |
6217 | 6217 |
6218 if(path) | 6218 if(path) |
6219 { | 6219 { |
6220 gint *indices = gtk_tree_path_get_indices(path); | 6220 gint *indices = gtk_tree_path_get_indices(path); |
6221 | 6221 |
6222 if(indices) | 6222 if(indices) |
6223 { | 6223 { |
6224 GtkTreeIter iter; | 6224 GtkTreeIter iter; |
6225 | 6225 |
6226 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) | 6226 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) |
6227 { | 6227 { |
6228 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); | 6228 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); |
6229 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); | 6229 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); |
6230 } | 6230 } |
6235 } | 6235 } |
6236 } | 6236 } |
6237 else if(flags & DW_CRA_CURSORED) | 6237 else if(flags & DW_CRA_CURSORED) |
6238 { | 6238 { |
6239 GtkTreePath *path; | 6239 GtkTreePath *path; |
6240 | 6240 |
6241 gtk_tree_view_get_cursor(GTK_TREE_VIEW(cont), &path, NULL); | 6241 gtk_tree_view_get_cursor(GTK_TREE_VIEW(cont), &path, NULL); |
6242 if(path) | 6242 if(path) |
6243 { | 6243 { |
6244 GtkTreeIter iter; | 6244 GtkTreeIter iter; |
6245 | 6245 |
6246 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) | 6246 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path)) |
6247 { | 6247 { |
6248 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); | 6248 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); |
6249 } | 6249 } |
6250 gtk_tree_path_free(path); | 6250 gtk_tree_path_free(path); |
6251 } | 6251 } |
6252 } | 6252 } |
6253 else | 6253 else |
6254 { | 6254 { |
6255 GtkTreeIter iter; | 6255 GtkTreeIter iter; |
6256 | 6256 |
6257 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0)) | 6257 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0)) |
6258 { | 6258 { |
6259 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); | 6259 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); |
6260 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); | 6260 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1)); |
6261 } | 6261 } |
6289 | 6289 |
6290 if(store) | 6290 if(store) |
6291 { | 6291 { |
6292 int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_querypos")); | 6292 int pos = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), "_dw_querypos")); |
6293 int count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 6293 int count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
6294 | 6294 |
6295 /* These should be separate but right now this will work */ | 6295 /* These should be separate but right now this will work */ |
6296 if(flags & DW_CRA_SELECTED) | 6296 if(flags & DW_CRA_SELECTED) |
6297 { | 6297 { |
6298 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); | 6298 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont)); |
6299 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); | 6299 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
6300 | 6300 |
6301 if(list) | 6301 if(list) |
6302 { | 6302 { |
6303 GtkTreePath *path = g_list_nth_data(list, pos); | 6303 GtkTreePath *path = g_list_nth_data(list, pos); |
6304 | 6304 |
6305 if(path) | 6305 if(path) |
6306 { | 6306 { |
6307 gint *indices = gtk_tree_path_get_indices(path); | 6307 gint *indices = gtk_tree_path_get_indices(path); |
6308 | 6308 |
6309 if(indices) | 6309 if(indices) |
6310 { | 6310 { |
6311 GtkTreeIter iter; | 6311 GtkTreeIter iter; |
6312 | 6312 |
6313 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) | 6313 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0])) |
6314 { | 6314 { |
6315 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); | 6315 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); |
6316 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); | 6316 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); |
6317 } | 6317 } |
6329 retval = NULL; | 6329 retval = NULL; |
6330 } | 6330 } |
6331 else | 6331 else |
6332 { | 6332 { |
6333 GtkTreeIter iter; | 6333 GtkTreeIter iter; |
6334 | 6334 |
6335 if(pos < count && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, pos)) | 6335 if(pos < count && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, pos)) |
6336 { | 6336 { |
6337 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); | 6337 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1); |
6338 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); | 6338 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1)); |
6339 } | 6339 } |
6345 | 6345 |
6346 int _find_iter(GtkListStore *store, GtkTreeIter *iter, char *text) | 6346 int _find_iter(GtkListStore *store, GtkTreeIter *iter, char *text) |
6347 { | 6347 { |
6348 int z, rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 6348 int z, rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
6349 char *thistext; | 6349 char *thistext; |
6350 | 6350 |
6351 for(z=0;z<rows;z++) | 6351 for(z=0;z<rows;z++) |
6352 { | 6352 { |
6353 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, NULL, z)) | 6353 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, NULL, z)) |
6354 { | 6354 { |
6355 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, 0, &thistext, -1); | 6355 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, 0, &thistext, -1); |
6374 GtkListStore *store = NULL; | 6374 GtkListStore *store = NULL; |
6375 int _locked_by_me = FALSE; | 6375 int _locked_by_me = FALSE; |
6376 | 6376 |
6377 DW_MUTEX_LOCK; | 6377 DW_MUTEX_LOCK; |
6378 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6378 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6379 | 6379 |
6380 /* Make sure it is the correct tree type */ | 6380 /* Make sure it is the correct tree type */ |
6381 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6381 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6382 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 6382 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
6383 | 6383 |
6384 if(store) | 6384 if(store) |
6386 GtkTreeIter iter; | 6386 GtkTreeIter iter; |
6387 | 6387 |
6388 if(_find_iter(store, &iter, text)) | 6388 if(_find_iter(store, &iter, text)) |
6389 { | 6389 { |
6390 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); | 6390 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
6391 | 6391 |
6392 if(path) | 6392 if(path) |
6393 { | 6393 { |
6394 gtk_tree_view_row_activated(GTK_TREE_VIEW(cont), path, NULL); | 6394 gtk_tree_view_row_activated(GTK_TREE_VIEW(cont), path, NULL); |
6395 gtk_tree_path_free(path); | 6395 gtk_tree_path_free(path); |
6396 } | 6396 } |
6411 GtkListStore *store = NULL; | 6411 GtkListStore *store = NULL; |
6412 int _locked_by_me = FALSE; | 6412 int _locked_by_me = FALSE; |
6413 | 6413 |
6414 DW_MUTEX_LOCK; | 6414 DW_MUTEX_LOCK; |
6415 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6415 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6416 | 6416 |
6417 /* Make sure it is the correct tree type */ | 6417 /* Make sure it is the correct tree type */ |
6418 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6418 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6419 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); | 6419 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont)); |
6420 | 6420 |
6421 if(store) | 6421 if(store) |
6444 GtkWidget *cont; | 6444 GtkWidget *cont; |
6445 int _locked_by_me = FALSE; | 6445 int _locked_by_me = FALSE; |
6446 | 6446 |
6447 DW_MUTEX_LOCK; | 6447 DW_MUTEX_LOCK; |
6448 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 6448 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
6449 | 6449 |
6450 /* Make sure it is the correct tree type */ | 6450 /* Make sure it is the correct tree type */ |
6451 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) | 6451 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) |
6452 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont)); | 6452 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont)); |
6453 DW_MUTEX_UNLOCK; | 6453 DW_MUTEX_UNLOCK; |
6454 } | 6454 } |
6538 * blue: blue value. | 6538 * blue: blue value. |
6539 */ | 6539 */ |
6540 void dw_color_background_set(unsigned long value) | 6540 void dw_color_background_set(unsigned long value) |
6541 { | 6541 { |
6542 GdkColor *background = pthread_getspecific(_dw_bg_color_key); | 6542 GdkColor *background = pthread_getspecific(_dw_bg_color_key); |
6543 | 6543 |
6544 if(value == DW_CLR_DEFAULT) | 6544 if(value == DW_CLR_DEFAULT) |
6545 { | 6545 { |
6546 if(background) | 6546 if(background) |
6547 { | 6547 { |
6548 pthread_setspecific(_dw_bg_color_key, NULL); | 6548 pthread_setspecific(_dw_bg_color_key, NULL); |
6674 else if(pixmap) | 6674 else if(pixmap) |
6675 cr = cairo_create(pixmap->image); | 6675 cr = cairo_create(pixmap->image); |
6676 if(cr) | 6676 if(cr) |
6677 { | 6677 { |
6678 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 6678 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
6679 | 6679 |
6680 gdk_cairo_set_source_color (cr, foreground); | 6680 gdk_cairo_set_source_color (cr, foreground); |
6681 cairo_set_line_width(cr, 1); | 6681 cairo_set_line_width(cr, 1); |
6682 cairo_move_to(cr, x, y); | 6682 cairo_move_to(cr, x, y); |
6683 cairo_stroke(cr); | 6683 cairo_stroke(cr); |
6684 cairo_destroy(cr); | 6684 cairo_destroy(cr); |
6715 else if(pixmap) | 6715 else if(pixmap) |
6716 cr = cairo_create(pixmap->image); | 6716 cr = cairo_create(pixmap->image); |
6717 if(cr) | 6717 if(cr) |
6718 { | 6718 { |
6719 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 6719 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
6720 | 6720 |
6721 gdk_cairo_set_source_color (cr, foreground); | 6721 gdk_cairo_set_source_color (cr, foreground); |
6722 cairo_set_line_width(cr, 1); | 6722 cairo_set_line_width(cr, 1); |
6723 cairo_move_to(cr, x1, y1); | 6723 cairo_move_to(cr, x1, y1); |
6724 cairo_line_to(cr, x2, y2); | 6724 cairo_line_to(cr, x2, y2); |
6725 cairo_stroke(cr); | 6725 cairo_stroke(cr); |
6758 else if(pixmap) | 6758 else if(pixmap) |
6759 cr = cairo_create(pixmap->image); | 6759 cr = cairo_create(pixmap->image); |
6760 if(cr) | 6760 if(cr) |
6761 { | 6761 { |
6762 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 6762 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
6763 | 6763 |
6764 gdk_cairo_set_source_color (cr, foreground); | 6764 gdk_cairo_set_source_color (cr, foreground); |
6765 cairo_set_line_width(cr, 1); | 6765 cairo_set_line_width(cr, 1); |
6766 cairo_move_to(cr, x[0], y[0]); | 6766 cairo_move_to(cr, x[0], y[0]); |
6767 for(z=1;z<npoints;z++) | 6767 for(z=1;z<npoints;z++) |
6768 { | 6768 { |
6806 else if(pixmap) | 6806 else if(pixmap) |
6807 cr = cairo_create(pixmap->image); | 6807 cr = cairo_create(pixmap->image); |
6808 if(cr) | 6808 if(cr) |
6809 { | 6809 { |
6810 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 6810 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
6811 | 6811 |
6812 gdk_cairo_set_source_color (cr, foreground); | 6812 gdk_cairo_set_source_color (cr, foreground); |
6813 cairo_set_line_width(cr, 1); | 6813 cairo_set_line_width(cr, 1); |
6814 cairo_move_to(cr, x, y); | 6814 cairo_move_to(cr, x, y); |
6815 cairo_line_to(cr, x, y + height); | 6815 cairo_line_to(cr, x, y + height); |
6816 cairo_line_to(cr, x + width, y + height); | 6816 cairo_line_to(cr, x + width, y + height); |
6838 PangoFontDescription *font; | 6838 PangoFontDescription *font; |
6839 char *fontname = "fixed"; | 6839 char *fontname = "fixed"; |
6840 | 6840 |
6841 if(!text) | 6841 if(!text) |
6842 return; | 6842 return; |
6843 | 6843 |
6844 DW_MUTEX_LOCK; | 6844 DW_MUTEX_LOCK; |
6845 if(handle) | 6845 if(handle) |
6846 { | 6846 { |
6847 GdkWindow *window = gtk_widget_get_window(handle); | 6847 GdkWindow *window = gtk_widget_get_window(handle); |
6848 /* Safety check for non-existant windows */ | 6848 /* Safety check for non-existant windows */ |
6894 pango_layout_set_attributes(layout, list); | 6894 pango_layout_set_attributes(layout, list); |
6895 } | 6895 } |
6896 /* Do the drawing */ | 6896 /* Do the drawing */ |
6897 cairo_move_to(cr, x, y); | 6897 cairo_move_to(cr, x, y); |
6898 pango_cairo_show_layout (cr, layout); | 6898 pango_cairo_show_layout (cr, layout); |
6899 | 6899 |
6900 g_object_unref(layout); | 6900 g_object_unref(layout); |
6901 } | 6901 } |
6902 g_object_unref(context); | 6902 g_object_unref(context); |
6903 } | 6903 } |
6904 pango_font_description_free(font); | 6904 pango_font_description_free(font); |
7212 } | 7212 } |
7213 cr = gdk_cairo_create(window); | 7213 cr = gdk_cairo_create(window); |
7214 } | 7214 } |
7215 else if(destp) | 7215 else if(destp) |
7216 cr = cairo_create(destp->image); | 7216 cr = cairo_create(destp->image); |
7217 | 7217 |
7218 if(cr) | 7218 if(cr) |
7219 { | 7219 { |
7220 if(src) | 7220 if(src) |
7221 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), xdest -xsrc, ydest - ysrc); | 7221 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), xdest -xsrc, ydest - ysrc); |
7222 else if(srcp) | 7222 else if(srcp) |
7223 cairo_set_source_surface (cr, srcp->image, xdest - xsrc, ydest - ysrc); | 7223 cairo_set_source_surface (cr, srcp->image, xdest - xsrc, ydest - ysrc); |
7224 | 7224 |
7225 cairo_rectangle(cr, xdest, ydest, width, height); | 7225 cairo_rectangle(cr, xdest, ydest, width, height); |
7226 cairo_fill(cr); | 7226 cairo_fill(cr); |
7227 cairo_destroy(cr); | 7227 cairo_destroy(cr); |
7228 } | 7228 } |
7229 DW_MUTEX_UNLOCK; | 7229 DW_MUTEX_UNLOCK; |
7835 void (*threadfunc)(void *) = NULL; | 7835 void (*threadfunc)(void *) = NULL; |
7836 void **tmp = (void **)data; | 7836 void **tmp = (void **)data; |
7837 GdkColor *foreground, *background; | 7837 GdkColor *foreground, *background; |
7838 | 7838 |
7839 threadfunc = (void (*)(void *))tmp[0]; | 7839 threadfunc = (void (*)(void *))tmp[0]; |
7840 | 7840 |
7841 /* Initialize colors */ | 7841 /* Initialize colors */ |
7842 _init_thread(); | 7842 _init_thread(); |
7843 | 7843 |
7844 threadfunc(tmp[1]); | 7844 threadfunc(tmp[1]); |
7845 free(tmp); | 7845 free(tmp); |
7846 | 7846 |
7847 /* Free colors */ | 7847 /* Free colors */ |
7848 if((foreground = pthread_getspecific(_dw_fg_color_key))) | 7848 if((foreground = pthread_getspecific(_dw_fg_color_key))) |
7849 free(foreground); | 7849 free(foreground); |
7850 if((background = pthread_getspecific(_dw_bg_color_key))) | 7850 if((background = pthread_getspecific(_dw_bg_color_key))) |
7851 free(background); | 7851 free(background); |
8018 guint oldpos; | 8018 guint oldpos; |
8019 | 8019 |
8020 /* Drop out if missing table */ | 8020 /* Drop out if missing table */ |
8021 if(!cont) | 8021 if(!cont) |
8022 return; | 8022 return; |
8023 | 8023 |
8024 /* Check orientation */ | 8024 /* Check orientation */ |
8025 if(pos < 0) | 8025 if(pos < 0) |
8026 { | 8026 { |
8027 /* Horz */ | 8027 /* Horz */ |
8028 pos = -(pos + 1); | 8028 pos = -(pos + 1); |
8029 gtk_container_child_get(cont, widget, "left-attach", &oldpos, NULL); | 8029 gtk_container_child_get(cont, widget, "left-attach", &oldpos, NULL); |
8072 item = gtk_label_new(""); | 8072 item = gtk_label_new(""); |
8073 gtk_widget_show_all(item); | 8073 gtk_widget_show_all(item); |
8074 } | 8074 } |
8075 else if((image = g_object_get_data(G_OBJECT(item), "_dw_bitmap"))) | 8075 else if((image = g_object_get_data(G_OBJECT(item), "_dw_bitmap"))) |
8076 { | 8076 { |
8077 GdkPixbuf *pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); | 8077 GdkPixbuf *pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image)); |
8078 | 8078 |
8079 if(pixbuf) | 8079 if(pixbuf) |
8080 { | 8080 { |
8081 int pwidth = gdk_pixbuf_get_width(pixbuf); | 8081 int pwidth = gdk_pixbuf_get_width(pixbuf); |
8082 int pheight = gdk_pixbuf_get_height(pixbuf); | 8082 int pheight = gdk_pixbuf_get_height(pixbuf); |
8083 | 8083 |
8128 /* Do some sanity bounds checking */ | 8128 /* Do some sanity bounds checking */ |
8129 if(index < 0) | 8129 if(index < 0) |
8130 index = 0; | 8130 index = 0; |
8131 if(index > boxcount) | 8131 if(index > boxcount) |
8132 index = boxcount; | 8132 index = boxcount; |
8133 | 8133 |
8134 if(boxtype == DW_VERT) | 8134 if(boxtype == DW_VERT) |
8135 { | 8135 { |
8136 x = 0; | 8136 x = 0; |
8137 y = index; | 8137 y = index; |
8138 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); | 8138 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
8171 } | 8171 } |
8172 } | 8172 } |
8173 else | 8173 else |
8174 { | 8174 { |
8175 GtkWidget *vbox = g_object_get_data(G_OBJECT(box), "_dw_vbox"); | 8175 GtkWidget *vbox = g_object_get_data(G_OBJECT(box), "_dw_vbox"); |
8176 | 8176 |
8177 if(!vbox) | 8177 if(!vbox) |
8178 { | 8178 { |
8179 vbox = gtk_vbox_new(FALSE, 0); | 8179 vbox = gtk_vbox_new(FALSE, 0); |
8180 g_object_set_data(G_OBJECT(box), "_dw_vbox", vbox); | 8180 g_object_set_data(G_OBJECT(box), "_dw_vbox", vbox); |
8181 gtk_container_add(GTK_CONTAINER(box), vbox); | 8181 gtk_container_add(GTK_CONTAINER(box), vbox); |
8182 gtk_widget_show(vbox); | 8182 gtk_widget_show(vbox); |
8183 } | 8183 } |
8184 | 8184 |
8185 gtk_container_set_border_width(GTK_CONTAINER(box), pad); | 8185 gtk_container_set_border_width(GTK_CONTAINER(box), pad); |
8186 | 8186 |
8187 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) | 8187 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
8188 { | 8188 { |
8189 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); | 8189 GtkWidget *eventbox = (GtkWidget *)g_object_get_data(G_OBJECT(item), "_dw_eventbox"); |
8226 /* | 8226 /* |
8227 * Pack windows (widgets) into a box at an arbitrary location. | 8227 * Pack windows (widgets) into a box at an arbitrary location. |
8228 * Parameters: | 8228 * Parameters: |
8229 * box: Window handle of the box to be packed into. | 8229 * box: Window handle of the box to be packed into. |
8230 * item: Window handle of the item to be back. | 8230 * item: Window handle of the item to be back. |
8231 * index: 0 based index of packed items. | 8231 * index: 0 based index of packed items. |
8232 * width: Width in pixels of the item or -1 to be self determined. | 8232 * width: Width in pixels of the item or -1 to be self determined. |
8233 * height: Height in pixels of the item or -1 to be self determined. | 8233 * height: Height in pixels of the item or -1 to be self determined. |
8234 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | 8234 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
8235 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | 8235 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
8236 * pad: Number of pixels of padding around the item. | 8236 * pad: Number of pixels of padding around the item. |
8251 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | 8251 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
8252 * pad: Number of pixels of padding around the item. | 8252 * pad: Number of pixels of padding around the item. |
8253 */ | 8253 */ |
8254 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | 8254 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
8255 { | 8255 { |
8256 /* 65536 is the table limit on GTK... | 8256 /* 65536 is the table limit on GTK... |
8257 * seems like a high enough value we will never hit it here either. | 8257 * seems like a high enough value we will never hit it here either. |
8258 */ | 8258 */ |
8259 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); | 8259 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
8260 } | 8260 } |
8261 | 8261 |
8293 | 8293 |
8294 DW_MUTEX_LOCK; | 8294 DW_MUTEX_LOCK; |
8295 if(GTK_IS_WINDOW(handle)) | 8295 if(GTK_IS_WINDOW(handle)) |
8296 { | 8296 { |
8297 GdkGeometry hints; | 8297 GdkGeometry hints; |
8298 | 8298 |
8299 if ( width == 0 ) | 8299 if ( width == 0 ) |
8300 default_width = -1; | 8300 default_width = -1; |
8301 if ( height == 0 ) | 8301 if ( height == 0 ) |
8302 default_height = -1; | 8302 default_height = -1; |
8303 | 8303 |
8304 hints.base_width = hints.base_height = 1; | 8304 hints.base_width = hints.base_height = 1; |
8305 hints.min_width = hints.min_height = 8; | 8305 hints.min_width = hints.min_height = 8; |
8306 hints.width_inc = hints.height_inc = 1; | 8306 hints.width_inc = hints.height_inc = 1; |
8307 | 8307 |
8308 gtk_window_set_geometry_hints(GTK_WINDOW(handle), NULL, &hints, GDK_HINT_RESIZE_INC|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE); | 8308 gtk_window_set_geometry_hints(GTK_WINDOW(handle), NULL, &hints, GDK_HINT_RESIZE_INC|GDK_HINT_MIN_SIZE|GDK_HINT_BASE_SIZE); |
8309 | 8309 |
8310 if(gtk_widget_get_window(handle) && default_width > 0 && default_height > 0) | 8310 if(gtk_widget_get_window(handle) && default_width > 0 && default_height > 0) |
8311 gdk_window_resize(gtk_widget_get_window(handle), default_width , default_height ); | 8311 gdk_window_resize(gtk_widget_get_window(handle), default_width , default_height ); |
8312 | 8312 |
8313 gtk_window_set_default_size(GTK_WINDOW(handle), default_width , default_height ); | 8313 gtk_window_set_default_size(GTK_WINDOW(handle), default_width , default_height ); |
8314 if(!g_object_get_data(G_OBJECT(handle), "_dw_size")) | 8314 if(!g_object_get_data(G_OBJECT(handle), "_dw_size")) |
8806 handle2 = tmp; | 8806 handle2 = tmp; |
8807 } | 8807 } |
8808 if(handle2) | 8808 if(handle2) |
8809 { | 8809 { |
8810 GtkTreeIter iter; | 8810 GtkTreeIter iter; |
8811 | 8811 |
8812 /* Make sure it is the correct tree type */ | 8812 /* Make sure it is the correct tree type */ |
8813 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 8813 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
8814 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 8814 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
8815 else if(GTK_IS_COMBO_BOX(handle2)) | 8815 else if(GTK_IS_COMBO_BOX(handle2)) |
8816 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 8816 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
8817 | 8817 |
8818 if(!store) | 8818 if(!store) |
8819 { | 8819 { |
8820 DW_MUTEX_UNLOCK; | 8820 DW_MUTEX_UNLOCK; |
8821 return; | 8821 return; |
8822 } | 8822 } |
8823 | 8823 |
8824 if(pos < 0) | 8824 if(pos < 0) |
8825 { | 8825 { |
8826 /* Insert an entry at the end */ | 8826 /* Insert an entry at the end */ |
8827 gtk_list_store_append(store, &iter); | 8827 gtk_list_store_append(store, &iter); |
8828 } | 8828 } |
8859 } | 8859 } |
8860 if(handle2) | 8860 if(handle2) |
8861 { | 8861 { |
8862 int z; | 8862 int z; |
8863 GtkTreeIter iter; | 8863 GtkTreeIter iter; |
8864 | 8864 |
8865 /* Make sure it is the correct tree type */ | 8865 /* Make sure it is the correct tree type */ |
8866 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 8866 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
8867 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 8867 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
8868 else if(GTK_IS_COMBO_BOX(handle2)) | 8868 else if(GTK_IS_COMBO_BOX(handle2)) |
8869 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 8869 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
8870 | 8870 |
8871 if(!store) | 8871 if(!store) |
8872 { | 8872 { |
8873 DW_MUTEX_UNLOCK; | 8873 DW_MUTEX_UNLOCK; |
8874 return; | 8874 return; |
8875 } | 8875 } |
8876 | 8876 |
8877 /* Insert entries at the end */ | 8877 /* Insert entries at the end */ |
8878 for(z=0;z<count;z++) | 8878 for(z=0;z<count;z++) |
8879 { | 8879 { |
8880 gtk_list_store_append(store, &iter); | 8880 gtk_list_store_append(store, &iter); |
8881 gtk_list_store_set (store, &iter, 0, text[z], -1); | 8881 gtk_list_store_set (store, &iter, 0, text[z], -1); |
8908 /* Make sure it is the correct tree type */ | 8908 /* Make sure it is the correct tree type */ |
8909 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 8909 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
8910 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 8910 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
8911 else if(GTK_IS_COMBO_BOX(handle2)) | 8911 else if(GTK_IS_COMBO_BOX(handle2)) |
8912 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 8912 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
8913 | 8913 |
8914 if(!store) | 8914 if(!store) |
8915 { | 8915 { |
8916 DW_MUTEX_UNLOCK; | 8916 DW_MUTEX_UNLOCK; |
8917 return; | 8917 return; |
8918 } | 8918 } |
8919 /* Clear the list */ | 8919 /* Clear the list */ |
8920 gtk_list_store_clear(store); | 8920 gtk_list_store_clear(store); |
8921 } | 8921 } |
8922 DW_MUTEX_UNLOCK; | 8922 DW_MUTEX_UNLOCK; |
8923 } | 8923 } |
8924 | 8924 |
8925 /* | 8925 /* |
8947 /* Make sure it is the correct tree type */ | 8947 /* Make sure it is the correct tree type */ |
8948 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 8948 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
8949 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 8949 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
8950 else if(GTK_IS_COMBO_BOX(handle2)) | 8950 else if(GTK_IS_COMBO_BOX(handle2)) |
8951 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 8951 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
8952 | 8952 |
8953 if(store) | 8953 if(store) |
8954 { | 8954 { |
8955 /* Get the number of children at the top level */ | 8955 /* Get the number of children at the top level */ |
8956 retval = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 8956 retval = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
8957 } | 8957 } |
8976 { | 8976 { |
8977 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 8977 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
8978 if(tmp) | 8978 if(tmp) |
8979 handle2 = tmp; | 8979 handle2 = tmp; |
8980 } | 8980 } |
8981 | 8981 |
8982 /* Make sure it is the correct tree type */ | 8982 /* Make sure it is the correct tree type */ |
8983 if(handle2 && GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 8983 if(handle2 && GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
8984 { | 8984 { |
8985 GtkAdjustment *adjust = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(handle2)); | 8985 GtkAdjustment *adjust = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(handle2)); |
8986 GtkListStore *store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 8986 GtkListStore *store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
8987 | 8987 |
8988 if(store && adjust) | 8988 if(store && adjust) |
8989 { | 8989 { |
8990 /* Get the number of children at the top level */ | 8990 /* Get the number of children at the top level */ |
8991 gint rowcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); | 8991 gint rowcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL); |
8992 gdouble upper = gtk_adjustment_get_upper(adjust); | 8992 gdouble upper = gtk_adjustment_get_upper(adjust); |
8993 gdouble lower = gtk_adjustment_get_lower(adjust); | 8993 gdouble lower = gtk_adjustment_get_lower(adjust); |
8994 gdouble change; | 8994 gdouble change; |
8995 | 8995 |
8996 /* Safety check */ | 8996 /* Safety check */ |
8997 if(rowcount < 1) | 8997 if(rowcount < 1) |
8998 { | 8998 { |
8999 DW_MUTEX_UNLOCK; | 8999 DW_MUTEX_UNLOCK; |
9000 return; | 9000 return; |
9035 /* Make sure it is the correct tree type */ | 9035 /* Make sure it is the correct tree type */ |
9036 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 9036 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
9037 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 9037 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
9038 else if(GTK_IS_COMBO_BOX(handle2)) | 9038 else if(GTK_IS_COMBO_BOX(handle2)) |
9039 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 9039 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
9040 | 9040 |
9041 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) | 9041 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
9042 { | 9042 { |
9043 GtkTreeIter iter; | 9043 GtkTreeIter iter; |
9044 | 9044 |
9045 /* Get the nth child at the top level */ | 9045 /* Get the nth child at the top level */ |
9046 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) | 9046 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
9047 { | 9047 { |
9048 /* Get the text */ | 9048 /* Get the text */ |
9049 gchar *text; | 9049 gchar *text; |
9084 /* Make sure it is the correct tree type */ | 9084 /* Make sure it is the correct tree type */ |
9085 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 9085 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
9086 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 9086 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
9087 else if(GTK_IS_COMBO_BOX(handle2)) | 9087 else if(GTK_IS_COMBO_BOX(handle2)) |
9088 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 9088 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
9089 | 9089 |
9090 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) | 9090 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
9091 { | 9091 { |
9092 GtkTreeIter iter; | 9092 GtkTreeIter iter; |
9093 | 9093 |
9094 /* Get the nth child at the top level */ | 9094 /* Get the nth child at the top level */ |
9095 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) | 9095 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
9096 { | 9096 { |
9097 /* Update the text */ | 9097 /* Update the text */ |
9098 gtk_list_store_set(store, &iter, buffer); | 9098 gtk_list_store_set(store, &iter, buffer); |
9124 | 9124 |
9125 if(store) | 9125 if(store) |
9126 { | 9126 { |
9127 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); | 9127 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
9128 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); | 9128 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
9129 | 9129 |
9130 if(list) | 9130 if(list) |
9131 { | 9131 { |
9132 int counter = 0; | 9132 int counter = 0; |
9133 GtkTreePath *path = g_list_nth_data(list, 0); | 9133 GtkTreePath *path = g_list_nth_data(list, 0); |
9134 | 9134 |
9135 while(path) | 9135 while(path) |
9136 { | 9136 { |
9137 gint *indices = gtk_tree_path_get_indices(path); | 9137 gint *indices = gtk_tree_path_get_indices(path); |
9138 | 9138 |
9139 if(indices && indices[0] > where) | 9139 if(indices && indices[0] > where) |
9140 { | 9140 { |
9141 retval = indices[0]; | 9141 retval = indices[0]; |
9142 break; | 9142 break; |
9143 } | 9143 } |
9144 | 9144 |
9145 counter++; | 9145 counter++; |
9146 path = g_list_nth_data(list, counter); | 9146 path = g_list_nth_data(list, counter); |
9147 } | 9147 } |
9148 | 9148 |
9149 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); | 9149 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
9150 g_list_free(list); | 9150 g_list_free(list); |
9151 } | 9151 } |
9152 } | 9152 } |
9153 return retval; | 9153 return retval; |
9178 /* Make sure it is the correct tree type */ | 9178 /* Make sure it is the correct tree type */ |
9179 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 9179 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
9180 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 9180 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
9181 else if(GTK_IS_COMBO_BOX(handle2)) | 9181 else if(GTK_IS_COMBO_BOX(handle2)) |
9182 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 9182 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
9183 | 9183 |
9184 if(store) | 9184 if(store) |
9185 { | 9185 { |
9186 if(GTK_IS_TREE_VIEW(handle2)) | 9186 if(GTK_IS_TREE_VIEW(handle2)) |
9187 { | 9187 { |
9188 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); | 9188 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(handle2)); |
9189 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); | 9189 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL); |
9190 if(list) | 9190 if(list) |
9191 { | 9191 { |
9192 GtkTreePath *path = g_list_nth_data(list, 0); | 9192 GtkTreePath *path = g_list_nth_data(list, 0); |
9193 gint *indices = gtk_tree_path_get_indices(path); | 9193 gint *indices = gtk_tree_path_get_indices(path); |
9194 | 9194 |
9195 if(indices) | 9195 if(indices) |
9196 { | 9196 { |
9197 retval = indices[0]; | 9197 retval = indices[0]; |
9198 } | 9198 } |
9199 | 9199 |
9200 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); | 9200 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); |
9201 g_list_free(list); | 9201 g_list_free(list); |
9202 } | 9202 } |
9203 } | 9203 } |
9204 else | 9204 else |
9205 { | 9205 { |
9206 GtkTreeIter iter; | 9206 GtkTreeIter iter; |
9207 GtkTreePath *path; | 9207 GtkTreePath *path; |
9208 | 9208 |
9209 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(handle2), &iter)) | 9209 if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(handle2), &iter)) |
9210 { | 9210 { |
9211 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); | 9211 path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
9212 if(path) | 9212 if(path) |
9213 { | 9213 { |
9214 gint *indices = gtk_tree_path_get_indices(path); | 9214 gint *indices = gtk_tree_path_get_indices(path); |
9215 | 9215 |
9216 if(indices) | 9216 if(indices) |
9217 { | 9217 { |
9218 retval = indices[0]; | 9218 retval = indices[0]; |
9219 } | 9219 } |
9220 gtk_tree_path_free(path); | 9220 gtk_tree_path_free(path); |
9253 /* Make sure it is the correct tree type */ | 9253 /* Make sure it is the correct tree type */ |
9254 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 9254 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
9255 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 9255 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
9256 else if(GTK_IS_COMBO_BOX(handle2)) | 9256 else if(GTK_IS_COMBO_BOX(handle2)) |
9257 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 9257 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
9258 | 9258 |
9259 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) | 9259 if(store && index < gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL)) |
9260 { | 9260 { |
9261 GtkTreeIter iter; | 9261 GtkTreeIter iter; |
9262 | 9262 |
9263 /* Get the nth child at the top level */ | 9263 /* Get the nth child at the top level */ |
9264 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) | 9264 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
9265 { | 9265 { |
9266 if(GTK_IS_COMBO_BOX(handle2)) | 9266 if(GTK_IS_COMBO_BOX(handle2)) |
9267 { | 9267 { |
9312 /* Make sure it is the correct tree type */ | 9312 /* Make sure it is the correct tree type */ |
9313 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) | 9313 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) |
9314 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); | 9314 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); |
9315 else if(GTK_IS_COMBO_BOX(handle2)) | 9315 else if(GTK_IS_COMBO_BOX(handle2)) |
9316 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); | 9316 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); |
9317 | 9317 |
9318 if(store) | 9318 if(store) |
9319 { | 9319 { |
9320 GtkTreeIter iter; | 9320 GtkTreeIter iter; |
9321 | 9321 |
9322 /* Get the nth child at the top level */ | 9322 /* Get the nth child at the top level */ |
9323 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) | 9323 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, index)) |
9324 { | 9324 { |
9325 gtk_list_store_remove(store, &iter); | 9325 gtk_list_store_remove(store, &iter); |
9326 } | 9326 } |
10160 char *dw_clipboard_get_text() | 10160 char *dw_clipboard_get_text() |
10161 { | 10161 { |
10162 int _locked_by_me = FALSE; | 10162 int _locked_by_me = FALSE; |
10163 GtkClipboard *clipboard_object; | 10163 GtkClipboard *clipboard_object; |
10164 char *ret = NULL; | 10164 char *ret = NULL; |
10165 | 10165 |
10166 DW_MUTEX_LOCK; | 10166 DW_MUTEX_LOCK; |
10167 if((clipboard_object = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ))) | 10167 if((clipboard_object = gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ))) |
10168 { | 10168 { |
10169 gchar *clipboard_contents; | 10169 gchar *clipboard_contents; |
10170 | 10170 |
10171 if((clipboard_contents = gtk_clipboard_wait_for_text( clipboard_object ))) | 10171 if((clipboard_contents = gtk_clipboard_wait_for_text( clipboard_object ))) |
10172 { | 10172 { |
10173 ret = strdup((char *)clipboard_contents); | 10173 ret = strdup((char *)clipboard_contents); |
10174 g_free(clipboard_contents); | 10174 g_free(clipboard_contents); |
10175 } | 10175 } |
10291 { | 10291 { |
10292 void (*sigfunc)(void *data) = NULL; | 10292 void (*sigfunc)(void *data) = NULL; |
10293 void *sdata; | 10293 void *sdata; |
10294 char tmpbuf[30]; | 10294 char tmpbuf[30]; |
10295 int *tag = data; | 10295 int *tag = data; |
10296 | 10296 |
10297 if(tag) | 10297 if(tag) |
10298 { | 10298 { |
10299 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); | 10299 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); |
10300 sigfunc = g_object_get_data(G_OBJECT(_DWObject), tmpbuf); | 10300 sigfunc = g_object_get_data(G_OBJECT(_DWObject), tmpbuf); |
10301 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); | 10301 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); |
10322 */ | 10322 */ |
10323 int API dw_timer_connect(int interval, void *sigfunc, void *data) | 10323 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
10324 { | 10324 { |
10325 int *tag, _locked_by_me = FALSE; | 10325 int *tag, _locked_by_me = FALSE; |
10326 char tmpbuf[30]; | 10326 char tmpbuf[30]; |
10327 | 10327 |
10328 tag = calloc(1, sizeof(int)); | 10328 tag = calloc(1, sizeof(int)); |
10329 | 10329 |
10330 DW_MUTEX_LOCK; | 10330 DW_MUTEX_LOCK; |
10331 *tag = g_timeout_add(interval, (GSourceFunc)_dw_timer_func, (gpointer)tag); | 10331 *tag = g_timeout_add(interval, (GSourceFunc)_dw_timer_func, (gpointer)tag); |
10332 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); | 10332 snprintf(tmpbuf, 30, "_dw_timer%d", *tag); |
10333 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, sigfunc); | 10333 g_object_set_data(G_OBJECT(_DWObject), tmpbuf, sigfunc); |
10334 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); | 10334 snprintf(tmpbuf, 30, "_dw_timerdata%d", *tag); |
10421 (GTK_IS_COMBO_BOX(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)) | 10421 (GTK_IS_COMBO_BOX(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0)) |
10422 { | 10422 { |
10423 GtkWidget *widget = thiswindow; | 10423 GtkWidget *widget = thiswindow; |
10424 | 10424 |
10425 thisname = "changed"; | 10425 thisname = "changed"; |
10426 | 10426 |
10427 sigid = _set_signal_handler(widget, window, sigfunc, data, thisfunc); | 10427 sigid = _set_signal_handler(widget, window, sigfunc, data, thisfunc); |
10428 if(GTK_IS_TREE_VIEW(thiswindow)) | 10428 if(GTK_IS_TREE_VIEW(thiswindow)) |
10429 { | 10429 { |
10430 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); | 10430 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
10431 cid = g_signal_connect(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), GINT_TO_POINTER(sigid)); | 10431 cid = g_signal_connect(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), GINT_TO_POINTER(sigid)); |