Mercurial > geeqie
comparison src/layout_image.c @ 127:271afad04d07
implemented split windows
TODO: menus and hotkeys, connected zoom, activating on drag
author | nadvornik |
---|---|
date | Fri, 29 Jun 2007 15:16:46 +0000 |
parents | e2a8b7f2165b |
children | 98e2632b5d3d |
comparison
equal
deleted
inserted
replaced
126:021a4d0de67b | 127:271afad04d07 |
---|---|
701 LayoutWindow *lw = data; | 701 LayoutWindow *lw = data; |
702 | 702 |
703 layout_tools_hide_toggle(lw); | 703 layout_tools_hide_toggle(lw); |
704 } | 704 } |
705 | 705 |
706 static void li_pop_menu_split_none_cb(GtkWidget *widget, gpointer data) | |
707 { | |
708 LayoutWindow *lw = data; | |
709 layout_split_change(lw, SPLIT_NONE); | |
710 } | |
711 | |
712 static void li_pop_menu_split_hor_cb(GtkWidget *widget, gpointer data) | |
713 { | |
714 LayoutWindow *lw = data; | |
715 layout_split_change(lw, SPLIT_HOR); | |
716 } | |
717 | |
718 static void li_pop_menu_split_vert_cb(GtkWidget *widget, gpointer data) | |
719 { | |
720 LayoutWindow *lw = data; | |
721 layout_split_change(lw, SPLIT_VERT); | |
722 } | |
723 | |
724 static void li_pop_menu_split_quad_cb(GtkWidget *widget, gpointer data) | |
725 { | |
726 LayoutWindow *lw = data; | |
727 layout_split_change(lw, SPLIT_QUAD); | |
728 } | |
729 | |
730 static void li_pop_menu_connect_scroll_cb(GtkWidget *widget, gpointer data) | |
731 { | |
732 LayoutWindow *lw = data; | |
733 lw->connect_scroll = !lw->connect_scroll; | |
734 } | |
735 | |
736 static void li_pop_menu_connect_zoom_cb(GtkWidget *widget, gpointer data) | |
737 { | |
738 LayoutWindow *lw = data; | |
739 lw->connect_zoom = !lw->connect_zoom; | |
740 } | |
741 | |
742 | |
706 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) | 743 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) |
707 { | 744 { |
708 GtkWidget *menu; | 745 GtkWidget *menu; |
709 GtkWidget *item; | 746 GtkWidget *item; |
710 GtkWidget *submenu; | 747 GtkWidget *submenu; |
719 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw); | 756 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw); |
720 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw); | 757 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw); |
721 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw); | 758 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw); |
722 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw); | 759 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw); |
723 menu_item_add_divider(menu); | 760 menu_item_add_divider(menu); |
761 if (!fullscreen) | |
762 { | |
763 menu_item_add(menu, _("No split"), G_CALLBACK(li_pop_menu_split_none_cb), lw); | |
764 menu_item_add(menu, _("Split horizontaly"), G_CALLBACK(li_pop_menu_split_hor_cb), lw); | |
765 menu_item_add(menu, _("Split verticaly"), G_CALLBACK(li_pop_menu_split_vert_cb), lw); | |
766 menu_item_add(menu, _("Split quad"), G_CALLBACK(li_pop_menu_split_quad_cb), lw); | |
767 menu_item_add_check(menu, _("Connected scroll"), lw->connect_scroll, | |
768 G_CALLBACK(li_pop_menu_connect_scroll_cb), lw); | |
769 menu_item_add_check(menu, _("Connected zoom"), lw->connect_zoom, | |
770 G_CALLBACK(li_pop_menu_connect_zoom_cb), lw); | |
771 menu_item_add_divider(menu); | |
772 } | |
724 | 773 |
725 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw); | 774 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw); |
726 if (!path) gtk_widget_set_sensitive(item, FALSE); | 775 if (!path) gtk_widget_set_sensitive(item, FALSE); |
727 menu_item_add_divider(submenu); | 776 menu_item_add_divider(submenu); |
728 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw); | 777 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw); |
813 gint x, gint y, | 862 gint x, gint y, |
814 GtkSelectionData *selection_data, guint info, | 863 GtkSelectionData *selection_data, guint info, |
815 guint time, gpointer data) | 864 guint time, gpointer data) |
816 { | 865 { |
817 LayoutWindow *lw = data; | 866 LayoutWindow *lw = data; |
867 gint i; | |
868 | |
869 | |
870 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
871 { | |
872 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
873 break; | |
874 } | |
875 if (i < MAX_SPLIT_IMAGES) | |
876 { | |
877 printf("dnd image activate %d\n", i); | |
878 layout_image_activate(lw, i); | |
879 } | |
880 | |
818 | 881 |
819 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) | 882 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) |
820 { | 883 { |
821 CollectionData *source; | 884 CollectionData *source; |
822 GList *list; | 885 GList *list; |
881 GtkSelectionData *selection_data, guint info, | 944 GtkSelectionData *selection_data, guint info, |
882 guint time, gpointer data) | 945 guint time, gpointer data) |
883 { | 946 { |
884 LayoutWindow *lw = data; | 947 LayoutWindow *lw = data; |
885 const gchar *path; | 948 const gchar *path; |
886 | 949 gint i; |
887 path = layout_image_get_path(lw); | 950 |
951 | |
952 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
953 { | |
954 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
955 break; | |
956 } | |
957 if (i < MAX_SPLIT_IMAGES) | |
958 { | |
959 printf("dnd get from %d\n", i); | |
960 path = image_get_path(lw->split_images[i]); | |
961 } | |
962 else | |
963 path = layout_image_get_path(lw); | |
888 | 964 |
889 if (path) | 965 if (path) |
890 { | 966 { |
891 gchar *text = NULL; | 967 gchar *text = NULL; |
892 gint len; | 968 gint len; |
945 } | 1021 } |
946 layout_refresh(lw); | 1022 layout_refresh(lw); |
947 } | 1023 } |
948 } | 1024 } |
949 | 1025 |
950 static void layout_image_dnd_init(LayoutWindow *lw) | 1026 static void layout_image_dnd_init(LayoutWindow *lw, gint i) |
951 { | 1027 { |
952 gtk_drag_source_set(lw->image->pr, GDK_BUTTON2_MASK, | 1028 ImageWindow *imd = lw->split_images[i]; |
1029 | |
1030 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, | |
953 dnd_file_drag_types, dnd_file_drag_types_count, | 1031 dnd_file_drag_types, dnd_file_drag_types_count, |
954 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | 1032 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); |
955 g_signal_connect(G_OBJECT(lw->image->pr), "drag_data_get", | 1033 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
956 G_CALLBACK(layout_image_dnd_get), lw); | 1034 G_CALLBACK(layout_image_dnd_get), lw); |
957 g_signal_connect(G_OBJECT(lw->image->pr), "drag_end", | 1035 g_signal_connect(G_OBJECT(imd->pr), "drag_end", |
958 G_CALLBACK(layout_image_dnd_end), lw); | 1036 G_CALLBACK(layout_image_dnd_end), lw); |
959 | 1037 |
960 gtk_drag_dest_set(lw->image->pr, | 1038 gtk_drag_dest_set(imd->pr, |
961 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, | 1039 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
962 dnd_file_drop_types, dnd_file_drop_types_count, | 1040 dnd_file_drop_types, dnd_file_drop_types_count, |
963 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | 1041 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); |
964 g_signal_connect(G_OBJECT(lw->image->pr), "drag_data_received", | 1042 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
965 G_CALLBACK(layout_image_dnd_receive), lw); | 1043 G_CALLBACK(layout_image_dnd_receive), lw); |
966 } | 1044 } |
967 | 1045 |
968 | 1046 |
969 /* | 1047 /* |
1063 | 1141 |
1064 void layout_image_set_with_ahead(LayoutWindow *lw, const gchar *path, const gchar *read_ahead_path) | 1142 void layout_image_set_with_ahead(LayoutWindow *lw, const gchar *path, const gchar *read_ahead_path) |
1065 { | 1143 { |
1066 if (!layout_valid(&lw)) return; | 1144 if (!layout_valid(&lw)) return; |
1067 | 1145 |
1068 if (path) | 1146 /* if (path) |
1069 { | 1147 { |
1070 const gchar *old_path; | 1148 const gchar *old_path; |
1071 | 1149 |
1072 old_path = layout_image_get_path(lw); | 1150 old_path = layout_image_get_path(lw); |
1073 if (old_path && strcmp(path, old_path) == 0) return; | 1151 if (old_path && strcmp(path, old_path) == 0) return; |
1074 } | 1152 } |
1075 | 1153 */ |
1076 layout_image_set_path(lw, path); | 1154 layout_image_set_path(lw, path); |
1077 if (enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_path); | 1155 if (enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_path); |
1078 } | 1156 } |
1079 | 1157 |
1080 void layout_image_set_index(LayoutWindow *lw, gint index) | 1158 void layout_image_set_index(LayoutWindow *lw, gint index) |
1337 /* | 1415 /* |
1338 *---------------------------------------------------------------------------- | 1416 *---------------------------------------------------------------------------- |
1339 * mouse callbacks | 1417 * mouse callbacks |
1340 *---------------------------------------------------------------------------- | 1418 *---------------------------------------------------------------------------- |
1341 */ | 1419 */ |
1420 | |
1421 static gint image_idx(LayoutWindow *lw, ImageWindow *imd) | |
1422 { | |
1423 gint i; | |
1424 | |
1425 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1426 { | |
1427 if (lw->split_images[i] == imd) | |
1428 break; | |
1429 } | |
1430 if (i < MAX_SPLIT_IMAGES) | |
1431 { | |
1432 return i; | |
1433 } | |
1434 return -1; | |
1435 } | |
1436 | |
1342 | 1437 |
1343 static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time, | 1438 static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time, |
1344 gdouble x, gdouble y, guint state, gpointer data) | 1439 gdouble x, gdouble y, guint state, gpointer data) |
1345 { | 1440 { |
1346 LayoutWindow *lw = data; | 1441 LayoutWindow *lw = data; |
1370 static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time, | 1465 static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time, |
1371 gdouble x, gdouble y, guint state, gpointer data) | 1466 gdouble x, gdouble y, guint state, gpointer data) |
1372 { | 1467 { |
1373 LayoutWindow *lw = data; | 1468 LayoutWindow *lw = data; |
1374 | 1469 |
1470 gint i = image_idx(lw, imd); | |
1471 | |
1472 if (i != -1) | |
1473 { | |
1474 printf("image activate scroll %d\n", i); | |
1475 layout_image_activate(lw, i); | |
1476 } | |
1477 | |
1478 | |
1375 if (state & GDK_CONTROL_MASK) | 1479 if (state & GDK_CONTROL_MASK) |
1376 { | 1480 { |
1377 switch (direction) | 1481 switch (direction) |
1378 { | 1482 { |
1379 case GDK_SCROLL_UP: | 1483 case GDK_SCROLL_UP: |
1420 break; | 1524 break; |
1421 } | 1525 } |
1422 } | 1526 } |
1423 } | 1527 } |
1424 | 1528 |
1529 static void layout_image_scroll_notify_cb(ImageWindow *imd, gint x, gint y, gint width, gint height, gpointer data) | |
1530 { | |
1531 gint i; | |
1532 printf("scroll cb %d %d %d %d\n", x,y,width, height); | |
1533 LayoutWindow *lw = data; | |
1534 | |
1535 | |
1536 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1537 { | |
1538 if (lw->split_images[i] && lw->split_images[i] != imd) | |
1539 // if (lw->connect_zoom) | |
1540 // image_sync_zoom_from_image(lw->split_images[i], imd); | |
1541 if (lw->connect_scroll) | |
1542 image_sync_scroll_from_image_absolute(lw->split_images[i], imd); | |
1543 } | |
1544 } | |
1545 | |
1546 static gint layout_image_mouse_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) | |
1547 { | |
1548 | |
1549 printf("mouse press\n"); | |
1550 | |
1551 } | |
1552 | |
1553 static void layout_image_button_inactive_cb(ImageWindow *imd, gint button, guint32 time, | |
1554 gdouble x, gdouble y, guint state, gpointer data) | |
1555 { | |
1556 LayoutWindow *lw = data; | |
1557 gint i = image_idx(lw, imd); | |
1558 | |
1559 if (i != -1) | |
1560 { | |
1561 printf("image activate %d\n", i); | |
1562 layout_image_activate(lw, i); | |
1563 } | |
1564 } | |
1565 | |
1425 static void layout_image_set_buttons(LayoutWindow *lw) | 1566 static void layout_image_set_buttons(LayoutWindow *lw) |
1426 { | 1567 { |
1427 image_set_button_func(lw->image, layout_image_button_cb, lw); | 1568 image_set_button_func(lw->image, layout_image_button_cb, lw); |
1428 image_set_scroll_func(lw->image, layout_image_scroll_cb, lw); | 1569 image_set_scroll_func(lw->image, layout_image_scroll_cb, lw); |
1429 } | 1570 } |
1430 | 1571 |
1572 static void layout_image_set_buttons_inactive(LayoutWindow *lw, gint i) | |
1573 { | |
1574 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); | |
1575 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); | |
1576 } | |
1577 | |
1431 /* | 1578 /* |
1432 *---------------------------------------------------------------------------- | 1579 *---------------------------------------------------------------------------- |
1433 * setup | 1580 * setup |
1434 *---------------------------------------------------------------------------- | 1581 *---------------------------------------------------------------------------- |
1435 */ | 1582 */ |
1438 { | 1585 { |
1439 LayoutWindow *lw = data; | 1586 LayoutWindow *lw = data; |
1440 layout_status_update_image(lw); | 1587 layout_status_update_image(lw); |
1441 } | 1588 } |
1442 | 1589 |
1443 GtkWidget *layout_image_new(LayoutWindow *lw, const gchar *path) | 1590 GtkWidget *layout_image_new(LayoutWindow *lw, gint i) |
1444 { | 1591 { |
1445 if (!lw->image) | 1592 if (!lw->split_images[i]) |
1446 { | 1593 { |
1447 lw->image = image_new( (!lw->tools_float && !lw->tools_hidden) ); | 1594 lw->split_images[i] = image_new(TRUE); |
1448 if (black_window_background) image_background_set_black(lw->image, TRUE); | 1595 |
1449 image_set_update_func(lw->image, layout_image_update_cb, lw); | 1596 gtk_widget_ref(lw->split_images[i]->widget); |
1450 layout_image_set_buttons(lw); | 1597 |
1451 layout_image_dnd_init(lw); | 1598 g_signal_connect(G_OBJECT(lw->split_images[i]->widget), "button_press_event", |
1452 | 1599 G_CALLBACK(layout_image_mouse_press_cb), lw); |
1453 image_attach_window(lw->image, lw->window, NULL, "GQview", FALSE); | 1600 |
1601 | |
1602 if (black_window_background) image_background_set_black(lw->split_images[i], TRUE); | |
1454 | 1603 |
1455 image_auto_refresh(lw->image, 0); | 1604 image_auto_refresh(lw->image, 0); |
1456 | 1605 |
1606 layout_image_dnd_init(lw, i); | |
1457 image_color_profile_set(lw->image, | 1607 image_color_profile_set(lw->image, |
1458 color_profile_input_type, color_profile_screen_type, | 1608 color_profile_input_type, color_profile_screen_type, |
1459 color_profile_use_image); | 1609 color_profile_use_image); |
1460 image_color_profile_set_use(lw->image, color_profile_enabled); | 1610 image_color_profile_set_use(lw->image, color_profile_enabled); |
1461 } | 1611 } |
1462 | 1612 |
1463 return lw->image->widget; | 1613 return lw->split_images[i]->widget; |
1464 } | 1614 } |
1615 | |
1616 void layout_image_deactivate(LayoutWindow *lw, gint i) | |
1617 { | |
1618 | |
1619 if (!lw->split_images[i]) return; | |
1620 image_set_update_func(lw->split_images[i], NULL, NULL); | |
1621 layout_image_set_buttons_inactive(lw, i); | |
1622 image_set_scroll_notify_func(lw->split_images[i], NULL, NULL); | |
1623 | |
1624 image_attach_window(lw->split_images[i], NULL, NULL, NULL, FALSE); | |
1625 image_select(lw->split_images[i], FALSE); | |
1626 } | |
1627 | |
1628 | |
1629 void layout_image_activate(LayoutWindow *lw, gint i) | |
1630 { | |
1631 const gchar *path; | |
1632 | |
1633 gchar *base; | |
1634 gint row; | |
1635 gint j; | |
1636 | |
1637 if (!lw->split_images[i]) return; | |
1638 | |
1639 /* deactivate currently active */ | |
1640 if (lw->active_split_image != i) | |
1641 layout_image_deactivate(lw, lw->active_split_image); | |
1642 | |
1643 lw->image = lw->split_images[i]; | |
1644 lw->active_split_image = i; | |
1645 | |
1646 image_set_update_func(lw->image, layout_image_update_cb, lw); | |
1647 layout_image_set_buttons(lw); | |
1648 image_set_scroll_notify_func(lw->image, layout_image_scroll_notify_cb, lw); | |
1649 | |
1650 image_attach_window(lw->image, lw->window, NULL, "GQview", FALSE); | |
1651 | |
1652 image_select(lw->split_images[i], TRUE); | |
1653 | |
1654 path = image_get_path(lw->image); | |
1655 | |
1656 if (path) | |
1657 { | |
1658 // layout_list_sync_path(lw, path); | |
1659 layout_set_path(lw, path); | |
1660 } | |
1661 } | |
1662 | |
1663 | |
1664 GtkWidget *layout_image_setup_split_none(LayoutWindow *lw) | |
1665 { | |
1666 gint i; | |
1667 | |
1668 if (!lw->split_images[0]) | |
1669 { | |
1670 layout_image_new(lw, 0); | |
1671 layout_image_activate(lw, 0); | |
1672 } | |
1673 | |
1674 for (i=1; i < MAX_SPLIT_IMAGES; i++) | |
1675 { | |
1676 if (lw->split_images[i]) | |
1677 { | |
1678 gtk_widget_unref(lw->split_images[i]->widget); | |
1679 lw->split_images[i] = NULL; | |
1680 } | |
1681 } | |
1682 | |
1683 if (!lw->image || lw->active_split_image != 0) | |
1684 { | |
1685 layout_image_activate(lw, 0); | |
1686 } | |
1687 | |
1688 lw->split_mode = SPLIT_NONE; | |
1689 | |
1690 lw->split_image_widget = lw->split_images[0]->widget; | |
1691 | |
1692 return lw->split_image_widget; | |
1693 | |
1694 } | |
1695 | |
1696 GtkWidget *layout_image_setup_split_hv(LayoutWindow *lw, gboolean horizontal) | |
1697 { | |
1698 GtkWidget *paned; | |
1699 gint i; | |
1700 | |
1701 if (!lw->split_images[0]) | |
1702 { | |
1703 layout_image_new(lw, 0); | |
1704 layout_image_activate(lw, 0); | |
1705 } | |
1706 | |
1707 if (!lw->split_images[1]) | |
1708 { | |
1709 layout_image_new(lw, 1); | |
1710 if (lw->image) | |
1711 image_change_path(lw->split_images[1], | |
1712 image_get_path(lw->image), image_zoom_get_real(lw->image)); | |
1713 layout_image_deactivate(lw, 1); | |
1714 } | |
1715 | |
1716 | |
1717 for (i=2; i < MAX_SPLIT_IMAGES; i++) | |
1718 { | |
1719 if (lw->split_images[i]) | |
1720 { | |
1721 gtk_widget_unref(lw->split_images[i]->widget); | |
1722 lw->split_images[i] = NULL; | |
1723 } | |
1724 } | |
1725 | |
1726 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 1) | |
1727 { | |
1728 layout_image_activate(lw, 0); | |
1729 } | |
1730 | |
1731 if (horizontal) | |
1732 paned = gtk_hpaned_new (); | |
1733 else | |
1734 paned = gtk_vpaned_new (); | |
1735 | |
1736 gtk_paned_pack1 (GTK_PANED (paned), lw->split_images[0]->widget, TRUE, TRUE); | |
1737 gtk_paned_pack2 (GTK_PANED (paned), lw->split_images[1]->widget, TRUE, TRUE); | |
1738 | |
1739 gtk_widget_show (lw->split_images[0]->widget); | |
1740 gtk_widget_show (lw->split_images[1]->widget); | |
1741 | |
1742 | |
1743 lw->split_mode = horizontal ? SPLIT_HOR : SPLIT_VERT; | |
1744 lw->split_image_widget = paned; | |
1745 | |
1746 return lw->split_image_widget; | |
1747 | |
1748 } | |
1749 | |
1750 GtkWidget *layout_image_setup_split_quad(LayoutWindow *lw) | |
1751 { | |
1752 GtkWidget *hpaned; | |
1753 GtkWidget *vpaned1; | |
1754 GtkWidget *vpaned2; | |
1755 gint i; | |
1756 | |
1757 if (!lw->split_images[0]) | |
1758 { | |
1759 layout_image_new(lw, 0); | |
1760 layout_image_activate(lw, 0); | |
1761 } | |
1762 | |
1763 for (i=1; i < 4; i++) | |
1764 if (!lw->split_images[i]) | |
1765 { | |
1766 layout_image_new(lw, i); | |
1767 if (lw->image) | |
1768 image_change_path(lw->split_images[i], | |
1769 image_get_path(lw->image), image_zoom_get_real(lw->image)); | |
1770 layout_image_deactivate(lw, i); | |
1771 } | |
1772 | |
1773 for (i=4; i < MAX_SPLIT_IMAGES; i++) | |
1774 { | |
1775 if (lw->split_images[i]) | |
1776 { | |
1777 gtk_widget_unref(lw->split_images[i]->widget); | |
1778 lw->split_images[i] = NULL; | |
1779 } | |
1780 } | |
1781 | |
1782 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 3) | |
1783 { | |
1784 layout_image_activate(lw, 0); | |
1785 } | |
1786 | |
1787 hpaned = gtk_hpaned_new (); | |
1788 vpaned1 = gtk_vpaned_new (); | |
1789 vpaned2 = gtk_vpaned_new (); | |
1790 | |
1791 gtk_paned_pack1 (GTK_PANED (vpaned1), lw->split_images[0]->widget, TRUE, TRUE); | |
1792 gtk_paned_pack2 (GTK_PANED (vpaned1), lw->split_images[2]->widget, TRUE, TRUE); | |
1793 | |
1794 gtk_paned_pack1 (GTK_PANED (vpaned2), lw->split_images[1]->widget, TRUE, TRUE); | |
1795 gtk_paned_pack2 (GTK_PANED (vpaned2), lw->split_images[3]->widget, TRUE, TRUE); | |
1796 | |
1797 gtk_paned_pack1 (GTK_PANED (hpaned), vpaned1, TRUE, TRUE); | |
1798 gtk_paned_pack2 (GTK_PANED (hpaned), vpaned2, TRUE, TRUE); | |
1799 | |
1800 | |
1801 for (i=0; i < 4; i++) | |
1802 gtk_widget_show (lw->split_images[i]->widget); | |
1803 gtk_widget_show (vpaned1); | |
1804 gtk_widget_show (vpaned2); | |
1805 | |
1806 | |
1807 lw->split_mode = SPLIT_QUAD; | |
1808 lw->split_image_widget = hpaned; | |
1809 | |
1810 return lw->split_image_widget; | |
1811 | |
1812 } | |
1813 | |
1814 GtkWidget *layout_image_setup_split(LayoutWindow *lw, ImageSplitMode mode) | |
1815 { | |
1816 switch (mode) | |
1817 { | |
1818 case SPLIT_HOR: | |
1819 return layout_image_setup_split_hv(lw, TRUE); | |
1820 case SPLIT_VERT: | |
1821 return layout_image_setup_split_hv(lw, FALSE); | |
1822 case SPLIT_QUAD: | |
1823 return layout_image_setup_split_quad(lw); | |
1824 case SPLIT_NONE: | |
1825 default: | |
1826 return layout_image_setup_split_none(lw); | |
1827 } | |
1828 } | |
1829 | |
1465 | 1830 |
1466 /* | 1831 /* |
1467 *----------------------------------------------------------------------------- | 1832 *----------------------------------------------------------------------------- |
1468 * maintenance (for rename, move, remove) | 1833 * maintenance (for rename, move, remove) |
1469 *----------------------------------------------------------------------------- | 1834 *----------------------------------------------------------------------------- |