Mercurial > geeqie
comparison src/layout.c @ 1322:4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
from list to icon view etc.)
author | nadvornik |
---|---|
date | Wed, 25 Feb 2009 19:46:03 +0000 |
parents | 055ed09d5a03 |
children | 4286f08079b6 |
comparison
equal
deleted
inserted
replaced
1321:50b325a2386e | 1322:4370b90fa774 |
---|---|
1578 gint priority_location; | 1578 gint priority_location; |
1579 GtkWidget *h; | 1579 GtkWidget *h; |
1580 GtkWidget *v; | 1580 GtkWidget *v; |
1581 GtkWidget *w1, *w2, *w3; | 1581 GtkWidget *w1, *w2, *w3; |
1582 | 1582 |
1583 GtkWidget *image; | 1583 GtkWidget *image_sb; /* image together with sidebars in utility box */ |
1584 GtkWidget *tools; | 1584 GtkWidget *tools; |
1585 GtkWidget *files; | 1585 GtkWidget *files; |
1586 | 1586 |
1587 layout_actions_setup(lw); | 1587 layout_actions_setup(lw); |
1588 layout_actions_add_window(lw, lw->window); | 1588 layout_actions_add_window(lw, lw->window); |
1591 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); | 1591 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); |
1592 gtk_widget_show(lw->group_box); | 1592 gtk_widget_show(lw->group_box); |
1593 | 1593 |
1594 priority_location = layout_grid_compass(lw); | 1594 priority_location = layout_grid_compass(lw); |
1595 | 1595 |
1596 image = layout_image_setup_split(lw, lw->split_mode); | 1596 if (lw->utility_box) |
1597 | 1597 { |
1598 image_sb = lw->utility_box; | |
1599 } | |
1600 else | |
1601 { | |
1602 GtkWidget *image; /* image or split images together */ | |
1603 image = layout_image_setup_split(lw, lw->split_mode); | |
1604 image_sb = layout_bars_prepare(lw, image); | |
1605 } | |
1606 | |
1598 tools = layout_tools_new(lw); | 1607 tools = layout_tools_new(lw); |
1599 files = layout_list_new(lw); | 1608 files = layout_list_new(lw); |
1600 | 1609 |
1601 image = layout_bars_prepare(lw, image); | |
1602 | 1610 |
1603 if (lw->options.tools_float || lw->options.tools_hidden) | 1611 if (lw->options.tools_float || lw->options.tools_hidden) |
1604 { | 1612 { |
1605 gtk_box_pack_start(GTK_BOX(lw->group_box), image, TRUE, TRUE, 0); | 1613 gtk_box_pack_start(GTK_BOX(lw->group_box), image_sb, TRUE, TRUE, 0); |
1606 gtk_widget_show(image); | 1614 gtk_widget_show(image_sb); |
1607 | 1615 |
1608 layout_tools_setup(lw, tools, files); | 1616 layout_tools_setup(lw, tools, files); |
1609 | 1617 |
1610 gtk_widget_grab_focus(lw->image->widget); | 1618 gtk_widget_grab_focus(lw->image->widget); |
1611 | 1619 |
1619 lw->tools_pane = NULL; | 1627 lw->tools_pane = NULL; |
1620 } | 1628 } |
1621 | 1629 |
1622 layout_status_setup(lw, lw->group_box, FALSE); | 1630 layout_status_setup(lw, lw->group_box, FALSE); |
1623 | 1631 |
1624 layout_grid_compute(lw, image, tools, files, &w1, &w2, &w3); | 1632 layout_grid_compute(lw, image_sb, tools, files, &w1, &w2, &w3); |
1625 | 1633 |
1626 v = lw->v_pane = gtk_vpaned_new(); | 1634 v = lw->v_pane = gtk_vpaned_new(); |
1627 | 1635 |
1628 h = lw->h_pane = gtk_hpaned_new(); | 1636 h = lw->h_pane = gtk_hpaned_new(); |
1629 | 1637 |
1653 | 1661 |
1654 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE); | 1662 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE); |
1655 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE); | 1663 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE); |
1656 } | 1664 } |
1657 | 1665 |
1658 gtk_widget_show(image); | 1666 gtk_widget_show(image_sb); |
1659 gtk_widget_show(tools); | 1667 gtk_widget_show(tools); |
1660 gtk_widget_show(files); | 1668 gtk_widget_show(files); |
1661 | 1669 |
1662 gtk_widget_show(v); | 1670 gtk_widget_show(v); |
1663 gtk_widget_show(h); | 1671 gtk_widget_show(h); |
1664 | 1672 |
1665 /* fix to have image pane visible when it is left and priority widget */ | 1673 /* fix to have image pane visible when it is left and priority widget */ |
1666 if (lw->options.main_window.hdivider_pos == -1 && | 1674 if (lw->options.main_window.hdivider_pos == -1 && |
1667 w1 == image && | 1675 w1 == image_sb && |
1668 !layout_location_vertical(priority_location) && | 1676 !layout_location_vertical(priority_location) && |
1669 layout_location_first(priority_location)) | 1677 layout_location_first(priority_location)) |
1670 { | 1678 { |
1671 gtk_widget_set_size_request(image, 200, -1); | 1679 gtk_widget_set_size_request(image_sb, 200, -1); |
1672 } | 1680 } |
1673 | 1681 |
1674 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos); | 1682 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos); |
1675 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos); | 1683 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos); |
1676 | 1684 |
1678 } | 1686 } |
1679 | 1687 |
1680 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order) | 1688 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order) |
1681 { | 1689 { |
1682 FileData *dir_fd; | 1690 FileData *dir_fd; |
1683 gint i; | |
1684 | 1691 |
1685 if (!layout_valid(&lw)) return; | 1692 if (!layout_valid(&lw)) return; |
1686 | 1693 |
1687 if (style != -1) | 1694 if (style != -1) |
1688 { | 1695 { |
1705 layout_image_full_screen_stop(lw); | 1712 layout_image_full_screen_stop(lw); |
1706 | 1713 |
1707 dir_fd = lw->dir_fd; | 1714 dir_fd = lw->dir_fd; |
1708 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd); | 1715 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd); |
1709 lw->dir_fd = NULL; | 1716 lw->dir_fd = NULL; |
1710 lw->image = NULL; | 1717 |
1711 lw->utility_box = NULL; | 1718 /* lw->image is preserved together with lw->utility_box */ |
1719 if (lw->utility_box) | |
1720 { | |
1721 /* preserve utility_box (image + sidebars) to be reused later in layout_grid_setup */ | |
1722 gtk_widget_hide(lw->utility_box); | |
1723 g_object_ref(lw->utility_box); | |
1724 gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box); | |
1725 } | |
1712 | 1726 |
1713 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); | 1727 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); |
1714 | 1728 |
1715 /* clear it all */ | 1729 /* clear it all */ |
1716 | |
1717 for (i = 0; i < MAX_SPLIT_IMAGES; i++) | |
1718 { | |
1719 if (lw->split_images[i]) | |
1720 { | |
1721 gtk_widget_hide(lw->split_images[i]->widget); | |
1722 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget); | |
1723 } | |
1724 } | |
1725 | 1730 |
1726 lw->h_pane = NULL; | 1731 lw->h_pane = NULL; |
1727 lw->v_pane = NULL; | 1732 lw->v_pane = NULL; |
1728 | 1733 |
1729 lw->toolbar = NULL; | 1734 lw->toolbar = NULL; |