1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886
|
/* gap_story_dialog.c
*
* This module handles GAP storyboard dialog editor
*/
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* revision history:
* version 2.2.1; 2006/02/07 hof: support drag&drop destination for image/videofilenames
* version 2.1.0a; 2005/01/22 hof: copy/cut/paste handling via keys (ctrl-c, ctrl-x, ctrl-v)
* version 2.1.0a; 2004/12/05 hof: added global layout properties dialog
* version 1.3.27a; 2004/03/15 hof: videothumbnails are kept in memory
* for the startframes in all MOVIE clips
* (common list for both storyboard and cliplist)
* Need define GAP_ENABLE_VIDEOAPI_SUPPORT
* to handle thumbnails for cliptype GAP_STBREC_VID_MOVIE
* version 1.3.25a; 2004/02/22 hof: created
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include <gdk/gdkkeysyms.h>
#include "gap_libgapbase.h"
#include "gap_story_main.h"
#include "gap_story_undo.h"
#include "gap_story_dialog.h"
#include "gap_story_file.h"
#include "gap_player_dialog.h"
#include "gap_pdb_calls.h"
#include "gap_pview_da.h"
#include "gap_stock.h"
#include "gap_lib.h"
#include "gap_image.h"
#include "gap_vin.h"
#include "gap_timeconv.h"
#include "gap_thumbnail.h"
#include "gap_arr_dialog.h"
#include "gap_story_att_trans_dlg.h"
#include "gap_story_vthumb.h"
#include "gap_story_section_properties.h"
#include "gap_frame_fetcher.h"
#include "images/gap-stock-pixbufs.h"
#include "gap-intl.h"
#define GAP_STB_PLAYER_HELP_ID "plug-in-gap-storyboard-player"
#define GAP_STB_MASTER_PROP_DLG_HELP_ID "plug-in-gap-storyboard-master-prop"
#define GAP_STB_GEN_OTONE_DLG_HELP_ID "plug-in-gap-storyboard-gen-otone"
extern int gap_debug; /* 1 == print debug infos , 0 dont print debug infos */
#define STB_THSIZE_LARGE 88
#define STB_THSIZE_MEDIUM 66
#define STB_THSIZE_SMALL 44
/* layout constraint check values */
#define STB_THSIZE_MAX 120
#define STB_THSIZE_MIN 33
#define CLL_MIN_COL 4
#define CLL_MAX_COL 15
#define CLL_MIN_ROW 1
#define CLL_MAX_ROW 10
#define STB_MIN_COL 10
#define STB_MAX_COL 30
#define STB_MIN_ROW 1
#define STB_MAX_ROW 5
#define STB_THIDX_LARGE 0
#define STB_THIDX_MEDIUM 1
#define STB_THIDX_SMALL 2
#define GAP_STORY_FW_PTR "gap_story_fw_ptr"
#define GAP_STORY_TABW_PTR "gap_story_tabw_ptr"
/* the file GAP_DEBUG_STORYBOARD_CONFIG_FILE
* is a debug configuration intended for development an test
* if this file exists at start of the storyboard plug-in
* it has an additional menu item that triggers debug output of internal
* memory structures to stdout.
* the content of this file selects what to print by symbolic names
* (see procedure p_is_debug_feature_item_enabled for details)
*/
#define GAP_DEBUG_STORYBOARD_CONFIG_FILE "GAP_DEBUG_STORYBOARD"
typedef void (*GapStbMenuCallbackFptr)(GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static char * p_get_gapdebug_storyboard_config_file();
static gboolean p_is_debug_menu_enabled(void);
static gboolean p_is_debug_feature_item_enabled(const char *debug_item);
static void p_get_begin_and_end_for_single_clip_playback(gint32 *begin_frame, gint32 *end_frame, GapStoryElem *stb_elem);
static void on_stb_elem_drag_begin (GtkWidget *widget,
GdkDragContext *context,
GapStbFrameWidget *fw);
static void on_stb_elem_drag_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
GapStbFrameWidget *fw);
//static void on_stb_elem_drag_delete (GtkWidget *widget,
// GdkDragContext *context,
// GapStbFrameWidget *fw);
static void on_clip_elements_dropped (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time);
static GapStoryBoard * p_get_or_auto_create_storyboard (GapStbMainGlobalParams *sgpp, GapStbTabWidgets *tabw , gboolean *auto_created);
static GapStoryBoard * p_dnd_selection_to_stb_list(const char *selection_data, gint32 vtrack);
static GapStoryElem * p_check_and_convert_uri_to_stb_elem(const char *uri, GapStoryElem *prev_elem, gint32 vtrack);
static gboolean p_check_and_merge_range_if_possible(GapStoryElem *elem, GapStoryElem *prev_elem);
static GapStoryElem * p_create_stb_elem_from_filename (const char *filename, gint32 vtrack);
static void p_frame_widget_init_dnd(GapStbFrameWidget *fw);
static void p_widget_init_dnd_drop(GtkWidget *widget, GapStbTabWidgets *tabw);
static gint32 p_thumbsize_to_index (gint32 thumbsize);
static gint32 p_index_to_thumbsize (gint32 thindex);
static GapStoryBoard * p_tabw_get_stb_ptr (GapStbTabWidgets *tabw);
static void p_set_layout_preset(GapStbMainGlobalParams *sgpp);
static GapStbTabWidgets * p_new_stb_tab_widgets(GapStbMainGlobalParams *sgpp
, GapStoryMasterType type);
static void p_render_all_frame_widgets (GapStbTabWidgets *tabw);
static void p_frame_widget_init_empty (GapStbTabWidgets *tabw, GapStbFrameWidget *fw);
static void p_frame_widget_render (GapStbFrameWidget *fw);
static void p_frame_widget_destroy(GapStbFrameWidget *fw);
static gint32 p_get_max_rowpage(gint32 act_elems, gint32 cols, gint rows);
static void p_story_set_range_cb(GapPlayerAddClip *plac_ptr);
static void gap_story_fw_abstract_properties_dialog (GapStbFrameWidget *fw);
static void p_story_call_player(GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb
, char *imagename
, gint32 imagewidth
, gint32 imageheight
, gdouble aspect_ratio
, gint32 image_id
, gint32 begin_frame
, gint32 end_frame
, gboolean play_all
, gint32 seltrack
, gdouble delace
, const char *preferred_decoder
, gint32 flip_request
, gint32 flip_status
, gint32 stb_in_track
, gboolean stb_composite
);
static void p_call_master_encoder(GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb
, const char *stb_filename
);
static void p_restore_edit_settings (GapStbTabWidgets *tabw, GapStoryBoard *stb);
static void p_tabw_process_redo(GapStbTabWidgets *tabw);
static void p_tabw_process_undo(GapStbTabWidgets *tabw);
static void p_tabw_replace_storyboard_and_widgets(GapStbTabWidgets *tabw, GapStoryBoard *stb);
static gboolean p_storyboard_reload (GapStbMainGlobalParams *sgpp);
static gboolean p_cliplist_reload (GapStbMainGlobalParams *sgpp);
static void p_player_cll_mode_cb (GtkWidget *w, GdkEventButton *bevent, GapStbMainGlobalParams *sgpp);
static void p_player_stb_mode_cb (GtkWidget *w, GdkEventButton *bevent, GapStbMainGlobalParams *sgpp);
static void p_player_img_mode_cb (GtkWidget *w, GapStbMainGlobalParams *sgpp);
static void p_cancel_button_cb (GtkWidget *w, GapStbMainGlobalParams *sgpp);
static void p_tabw_gen_otone_dialog(GapStbTabWidgets *tabw);
static gint32 p_parse_int(const char *buff);
static void p_parse_aspect_width_and_height(const char *buff, gint32 *aspect_width, gint32 *aspect_height);
static void p_tabw_master_prop_dialog(GapStbTabWidgets *tabw, gboolean new_flag);
static void p_tabw_add_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst);
static void p_tabw_add_section_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst);
static void p_tabw_add_att_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst);
static void p_tabw_new_clip_cb (GtkWidget *w, GdkEventButton *bevent, GapStbTabWidgets *tabw);
static void p_filesel_tabw_close_cb ( GtkWidget *widget, GapStbTabWidgets *tabw);
static gboolean p_filesel_tabw_ok (GtkWidget *widget, GapStbTabWidgets *tabw);
static void p_filesel_tabw_load_ok_cb (GtkWidget *widget, GapStbTabWidgets *tabw);
static void p_filesel_tabw_save_ok_cb ( GtkWidget *widget, GapStbTabWidgets *tabw);
static void p_tabw_load_file_cb ( GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_file_save_as_cb ( GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_filename_entry_cb(GtkWidget *widget, GapStbTabWidgets *tabw);
static void p_tabw_set_rowpage_and_refresh(GapStbTabWidgets *tabw, gint32 rowpage);
static void p_rowpage_spinbutton_cb(GtkEditable *editable,
GapStbTabWidgets *tabw);
static void p_vtrack_spinbutton_cb(GtkEditable *editable,
GapStbTabWidgets *tabw);
static void p_update_vscale_page(GapStbTabWidgets *tabw);
static void p_section_combo_changed_cb(GtkWidget *widget,
GapStbTabWidgets *tabw);
static void p_vscale_changed_cb(GtkObject *adj, GapStbTabWidgets *tabw);
static void p_cliptarget_togglebutton_toggled_cb (GtkToggleButton *togglebutton
, GapStoryClipTargetEnum *clip_target_ptr);
static void p_single_clip_playback(GapStbFrameWidget *fw);
static gboolean p_frame_widget_preview_events_cb (GtkWidget *widget,
GdkEvent *event,
GapStbFrameWidget *fw);
static void p_tabw_destroy_properties_dlg (GapStbTabWidgets *tabw, gboolean destroy_all);
static void p_tabw_destroy_attw_dlg (GapStbTabWidgets *tabw, gboolean destroy_all);
static void p_tabw_destroy_all_popup_dlg (GapStbTabWidgets *tabw);
static void p_tabw_section_properties_cut_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_undo_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_redo_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_edit_cut_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_edit_copy_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_edit_paste_cb (GtkWidget *w, GapStbTabWidgets *tabw);
static void p_tabw_edit_paste_at_story_id (GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb_dst
, GapStbTabWidgets *tabw
, gint32 story_id
, gboolean insert_after);
static void p_tabw_update_selection(GapStbTabWidgets *tabw);
static void p_selection_add(GapStbFrameWidget *fw);
static void p_selection_extend(GapStbFrameWidget *fw);
static void p_selection_replace(GapStbFrameWidget *fw);
static gboolean p_cut_copy_sensitive (GapStoryBoard *stb);
static gboolean p_paste_sensitive (GapStbMainGlobalParams *sgpp
,GapStoryBoard *stb
);
static void p_tabw_sensibility (GapStbMainGlobalParams *sgpp
,GapStoryBoard *stb
,GapStbTabWidgets *tabw);
static void p_tabw_set_undo_sensitivity(GapStbTabWidgets *tabw
, GtkWidget *menu_item);
static void p_tabw_set_redo_sensitivity(GapStbTabWidgets *tabw
, GtkWidget *menu_item);
static void p_undo_redo_sensibility (GapStbMainGlobalParams *sgpp);
static void p_widget_sensibility (GapStbMainGlobalParams *sgpp);
static gboolean p_close_one_or_both_lists(GapStbMainGlobalParams *sgpp
,gboolean check_cliplist
,gboolean check_storyboard
);
static gboolean p_story_save_with_edit_settings(GapStbTabWidgets *tabw
,GapStoryBoard *stb
, const char *filename);
static void p_menu_win_quit_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_win_help_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_win_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_win_vthumbs_toggle_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_win_debug_log_to_stdout_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_new_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_open_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_save_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_save_cb_as (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_playback_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_add_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_add_section_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_add_att_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_toggle_edmode (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_audio_otone_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_encode_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_undo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_redo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_cll_close_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_new_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_open_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_save_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_save_cb_as (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_playback_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_add_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_add_section_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_add_att_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_toggle_edmode (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_audio_otone_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_encode_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_undo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_redo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static void p_menu_stb_close_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp);
static GtkWidget* p_make_menu_bar_item(GtkWidget *menu_bar, gchar *label);
static GtkWidget* p_make_item_with_image(GtkWidget *parent, const gchar *stock_id,
GapStbMenuCallbackFptr fptr, GapStbMainGlobalParams *sgpp);
static GtkWidget* p_make_item_with_label(GtkWidget *parent, gchar *label,
GapStbMenuCallbackFptr fptr, GapStbMainGlobalParams *sgpp);
static GtkWidget* p_make_check_item_with_label(GtkWidget *parent, gchar *label,
GapStbMenuCallbackFptr fptr, GapStbMainGlobalParams *sgpp
,gboolean initial_value);
static void p_make_menu_global(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar);
static void p_make_menu_cliplist(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar);
static void p_make_menu_storyboard(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar);
static void p_make_menu_help(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar);
static gboolean p_check_unsaved_changes (GapStbMainGlobalParams *sgpp
, gboolean check_cliplist
, gboolean check_storyboard
);
static void p_tabw_update_frame_label_and_rowpage_limits (GapStbTabWidgets *tabw
, GapStbMainGlobalParams *sgpp
);
static void p_prefetch_vthumbs (GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb
);
static void p_optimized_prefetch_vthumbs_worker (GapStbMainGlobalParams *sgpp);
static void p_optimized_prefetch_vthumbs (GapStbMainGlobalParams *sgpp);
static void p_tabw_set_focus_to_first_fw(GapStbTabWidgets *tabw);
static gboolean p_tabw_key_press_event_cb ( GtkWidget *widget
, GdkEvent *event
, GapStbTabWidgets *tabw
);
static gboolean p_tabw_scroll_event_cb ( GtkWidget *widget
, GdkEventScroll *sevent
, GapStbTabWidgets *tabw
);
static void story_dlg_response (GtkWidget *widget,
gint response_id,
GapStbMainGlobalParams *sgpp);
static void story_dlg_destroy (GtkWidget *widget,
GapStbMainGlobalParams *sgpp);
static void p_recreate_tab_widgets(GapStoryBoard *stb
,GapStbTabWidgets *tabw
,gint32 mount_col
,gint32 mount_row
,GapStbMainGlobalParams *sgpp
);
static GapStorySection * p_find_section_by_active_index(GapStoryBoard *stb
, gint active_index);
static gint p_find_combo_index_of_section(GapStoryBoard *stb
, GapStorySection *target_section);
static void p_activate_section_by_combo_index(gint active_index
, GapStbTabWidgets *tabw);
static void p_set_strings_for_section_combo(GapStbTabWidgets *tabw);
static GtkWidget * p_create_button_bar(GapStbTabWidgets *tabw
,gint32 mount_col
,gint32 mount_row
,GapStbMainGlobalParams *sgpp
,gint32 mount_vs_col
,gint32 mount_vs_row
);
GtkWidget * p_gtk_button_new_from_stock_icon(const char *stock_id);
static gint32 p_get_gimprc_preview_size(const char *gimprc_option_name);
static void p_save_gimprc_preview_size(const char *gimprc_option_name, gint32 preview_size);
static void p_save_gimprc_int_value(const char *gimprc_option_name, gint32 value);
static void p_save_gimprc_gboolean_value(const char *gimprc_option_name, gboolean value);
static void p_save_gimprc_layout_settings(GapStbMainGlobalParams *sgpp);
static void p_get_gimprc_layout_settings(GapStbMainGlobalParams *sgpp);
static void p_reset_progress_bars(GapStbMainGlobalParams *sgpp);
static void p_call_external_image_viewer(GapStbFrameWidget *fw);
/* ---------------------------------------
* p_get_gapdebug_storyboard_config_file
* ---------------------------------------
*/
static char *
p_get_gapdebug_storyboard_config_file()
{
char *filename;
filename = g_build_filename(gimp_directory(), GAP_DEBUG_STORYBOARD_CONFIG_FILE, NULL);
return (filename);
}
/* ---------------------------------------
* p_is_debug_menu_enabled
* ---------------------------------------
* print the list of video elements
* to stdout (typical used for logging and debug purpose)
*/
static gboolean
p_is_debug_menu_enabled(void)
{
gboolean enable;
char *filename;
enable = FALSE;
if((gap_debug)
|| (g_file_test(GAP_DEBUG_STORYBOARD_CONFIG_FILE, G_FILE_TEST_EXISTS)))
{
return(TRUE);
}
filename = p_get_gapdebug_storyboard_config_file();
if(filename)
{
if(g_file_test(filename, G_FILE_TEST_EXISTS))
{
enable = TRUE;
}
g_free(filename);
}
return(enable);
} /* end p_is_debug_menu_enabled */
/* ---------------------------------------
* p_is_debug_feature_item_enabled
* ---------------------------------------
* print the list of video elements
* to stdout (typical used for logging and debug purpose)
*/
static gboolean
p_is_debug_feature_item_enabled(const char *debug_item)
{
gboolean enable;
char *filename;
enable = FALSE;
filename = p_get_gapdebug_storyboard_config_file();
if(filename)
{
if(gap_debug)
{
printf("debug feature filename:'%s'\n", filename);
}
if(g_file_test(filename, G_FILE_TEST_EXISTS))
{
FILE *l_fp;
char l_buf[400];
if(gap_debug)
{
printf("check for item:'%s'\n", debug_item);
}
l_fp = g_fopen(filename, "r");
if(l_fp)
{
while (NULL != fgets (l_buf, sizeof(l_buf)-1, l_fp))
{
l_buf[sizeof(l_buf)-1] = '\0';
gap_file_chop_trailingspace_and_nl(&l_buf[0]);
if(gap_debug)
{
printf(" CFG:'%s'\n", l_buf);
}
if (strcmp(l_buf, debug_item) == 0)
{
enable = TRUE;
break;
}
}
fclose(l_fp);
}
}
g_free(filename);
}
return(enable);
} /* end p_is_debug_feature_item_enabled */
/* ---------------------------------------------
* p_get_begin_and_end_for_single_clip_playback
* ---------------------------------------------
*/
static void
p_get_begin_and_end_for_single_clip_playback(gint32 *begin_frame, gint32 *end_frame, GapStoryElem *stb_elem)
{
*begin_frame = stb_elem->from_frame;
*end_frame = stb_elem->to_frame;
if(stb_elem->record_type == GAP_STBREC_VID_IMAGE)
{
char *l_basename;
long l_number;
l_basename = gap_lib_alloc_basename(stb_elem->orig_filename, &l_number);
g_free(l_basename);
*begin_frame = l_number;
*end_frame = l_number;
}
} /* end p_get_begin_and_end_for_single_clip_playback */
/* -----------------------------
* p_thumbsize_to_index
* -----------------------------
*/
static gint32
p_thumbsize_to_index (gint32 thumbsize)
{
if(thumbsize >= STB_THSIZE_LARGE)
{
return (STB_THIDX_LARGE);
}
if(thumbsize >= STB_THSIZE_MEDIUM)
{
return (STB_THIDX_MEDIUM);
}
return (STB_THIDX_SMALL);
} /* end p_thumbsize_to_index */
/* -----------------------------
* p_index_to_thumbsize
* -----------------------------
*/
static gint32
p_index_to_thumbsize (gint32 thindex)
{
if(thindex == STB_THIDX_LARGE)
{
return (STB_THSIZE_LARGE);
}
if(thindex == STB_THIDX_MEDIUM)
{
return (STB_THSIZE_MEDIUM);
}
return (STB_THSIZE_SMALL);
} /* end p_index_to_thumbsize */
/* -------------------------------------
* gap_story_dlg_tabw_update_frame_label
* -------------------------------------
*/
void
gap_story_dlg_tabw_update_frame_label (GapStbTabWidgets *tabw
, GapStbMainGlobalParams *sgpp
)
{
if((tabw) && (sgpp))
{
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
}
} /* end gap_story_dlg_tabw_update_frame_label */
/* -----------------------------
* gap_story_dlg_pw_render_all
* -----------------------------
*/
void
gap_story_dlg_pw_render_all(GapStbPropWidget *pw, gboolean recreate)
{
if(gap_debug)
{
printf("gap_story_dlg_pw_render_all recreate:%d\n", (int)recreate);
}
if(pw == NULL) { return; }
if(pw->tabw == NULL) { return; }
if(recreate)
{
GapStbTabWidgets *tabw;
tabw = (GapStbTabWidgets *)pw->tabw;
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( pw->stb_refptr
,tabw
,tabw->mount_col
,tabw->mount_row
,pw->sgpp
);
}
p_render_all_frame_widgets(pw->tabw);
p_tabw_update_frame_label_and_rowpage_limits(pw->tabw, pw->sgpp);
} /* end gap_story_dlg_pw_render_all */
/* --------------------------------------
* gap_story_dlg_attw_render_all
* --------------------------------------
*/
void
gap_story_dlg_attw_render_all(GapStbAttrWidget *attw)
{
if(attw == NULL) { return; }
if(attw->tabw == NULL) { return; }
p_render_all_frame_widgets(attw->tabw);
p_tabw_update_frame_label_and_rowpage_limits(attw->tabw, attw->sgpp);
} /* end gap_story_dlg_attw_render_all */
/* -----------------------------
* p_tabw_get_stb_ptr
* -----------------------------
*/
static GapStoryBoard *
p_tabw_get_stb_ptr (GapStbTabWidgets *tabw)
{
GapStoryBoard *l_stb;
GapStbMainGlobalParams *sgpp;
if(tabw == NULL) { return(NULL); }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return(NULL); }
l_stb = sgpp->stb;
if(tabw->type == GAP_STB_MASTER_TYPE_CLIPLIST)
{
l_stb = sgpp->cll;
}
return(l_stb);
} /* end p_tabw_get_stb_ptr */
/* ------------------------------
* gap_story_dlg_tabw_get_stb_ptr
* ------------------------------
*/
GapStoryBoard *
gap_story_dlg_tabw_get_stb_ptr (GapStbTabWidgets *tabw)
{
return(p_tabw_get_stb_ptr(tabw));
} /* end gap_story_dlg_tabw_get_stb_ptr */
/* -----------------------------
* p_new_stb_tab_widgets
* -----------------------------
*/
static GapStbTabWidgets *
p_new_stb_tab_widgets(GapStbMainGlobalParams *sgpp, GapStoryMasterType type)
{
GapStbTabWidgets *tabw;
tabw = g_new(GapStbTabWidgets, 1);
if(tabw)
{
tabw->sgpp = sgpp;
tabw->type = type;
if(type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
sgpp->stb_widgets = tabw;
p_set_layout_preset(sgpp);
tabw->filename_refptr = sgpp->storyboard_filename;
tabw->filename_maxlen = sizeof(sgpp->storyboard_filename);
}
else
{
sgpp->cll_widgets = tabw;
p_set_layout_preset(sgpp);
tabw->filename_refptr = sgpp->cliplist_filename;
tabw->filename_maxlen = sizeof(sgpp->cliplist_filename);
}
tabw->filesel = NULL;
tabw->filename_entry = NULL;
tabw->load_button = NULL;
tabw->save_button = NULL;
tabw->play_button = NULL;
tabw->undo_button = NULL;
tabw->redo_button = NULL;
tabw->edit_paste_button = NULL;
tabw->edit_cut_button = NULL;
tabw->edit_copy_button = NULL;
tabw->new_clip_button = NULL;
tabw->vtrack_spinbutton = NULL;
tabw->thumb_width = tabw->thumbsize;
tabw->thumb_height = tabw->thumbsize;
tabw->rowpage = 1;
tabw->vtrack = 1;
tabw->mount_table = NULL;
tabw->frame_with_name = NULL;
tabw->fw_gtk_table = NULL;
tabw->rowpage_spinbutton_adj = NULL;
tabw->rowpage_vscale_adj = NULL;
tabw->total_rows_label = NULL;
tabw->pw = NULL;
tabw->spw = NULL;
tabw->attw = NULL;
tabw->fw_tab = NULL;
tabw->fw_tab_size = 0; /* start up with empty fw table of 0 elements */
tabw->master_dlg_open = FALSE;
tabw->otone_dlg_open = FALSE;
tabw->story_id_at_prev_paste = -1;
tabw->undo_stack_list = NULL;
tabw->undo_stack_ptr = NULL;
tabw->undo_stack_group_counter = 0.0;
tabw->sgpp = sgpp;
}
return(tabw);
} /* end p_new_stb_tab_widgets */
/* -----------------------------
* p_set_layout_preset
* -----------------------------
*/
static void
p_set_layout_preset(GapStbMainGlobalParams *sgpp)
{
GapStbTabWidgets *tabw;
if(sgpp)
{
tabw = sgpp->stb_widgets;
if(tabw)
{
tabw->cols = sgpp->stb_cols;
tabw->rows = sgpp->stb_rows;
tabw->thumbsize = sgpp->stb_thumbsize;
tabw->edmode = GAP_STB_EDMO_FRAME_NUMBER;
if(tabw->thumbsize <= STB_THSIZE_SMALL)
{
/* for smaller thumbnail sizes show only the sequence number
* (there is no space for the framenumber
*/
tabw->edmode = GAP_STB_EDMO_SEQUENCE_NUMBER;
}
}
tabw = sgpp->cll_widgets;
if(tabw)
{
tabw->cols = sgpp->cll_cols;
tabw->rows = sgpp->cll_rows;
tabw->thumbsize = sgpp->cll_thumbsize;
tabw->edmode = GAP_STB_EDMO_SEQUENCE_NUMBER;
}
}
} /* end p_set_layout_preset */
/* -----------------------------
* p_render_all_frame_widgets
* -----------------------------
* assign frame_filename and stb_elem_refptr
* to all frame widgets
* according to the current rowpage setting (scroll).
*/
static void
p_render_all_frame_widgets (GapStbTabWidgets *tabw)
{
GapStoryBoard *l_stb;
GapStbMainGlobalParams *sgpp_ptr;
GapStbFrameWidget *fw;
gint32 ii;
gint32 seq_nr;
gint32 l_act_elems = 0;
if(gap_debug)
{
printf("(1) START p_render_all_frame_widgets\n");
}
if(tabw == NULL)
{
return;
}
sgpp_ptr = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp_ptr)
{
sgpp_ptr->auto_vthumb_refresh_canceled = FALSE;
if(gap_debug)
{
printf("(1.1) p_render_all_frame_widgets : vthumb_prefetch_in_progress (0 NOTACTIVE, 1 PROGRESS, 2 RESTART) value:%d\n"
,(int)sgpp_ptr->vthumb_prefetch_in_progress
);
}
if(sgpp_ptr->vthumb_prefetch_in_progress == GAP_VTHUMB_PREFETCH_IN_PROGRESS)
{
sgpp_ptr->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_RESTART_REQUEST;
}
}
l_stb = p_tabw_get_stb_ptr(tabw);
if(l_stb)
{
l_act_elems = gap_story_count_active_elements(l_stb, tabw->vtrack);
}
/* init buffers for the frame widgets */
seq_nr = (tabw->rowpage -1) * tabw->cols;
for(ii=0; ii < tabw->fw_tab_size; ii++)
{
seq_nr++;
if(gap_debug)
{
printf("(2) p_render_all_frame_widgets act_elems: %d ii:%d seq_nr: %d\n"
, (int)l_act_elems
, (int)ii
, (int)seq_nr
);
}
fw = tabw->fw_tab[ii];
if(gap_debug)
{
printf("(3) p_render_all_frame_widgets fw: %d\n", (int)fw );
printf("(4) p_render_all_frame_widgets fw->frame_filename: %d\n", (int)&fw->frame_filename );
}
if(fw->frame_filename)
{
g_free(fw->frame_filename);
fw->frame_filename = NULL;
}
fw->tabw = tabw;
fw->stb_refptr = l_stb;
fw->stb_elem_refptr = gap_story_fetch_nth_active_elem(l_stb, seq_nr, tabw->vtrack);
if(fw->stb_elem_refptr)
{
fw->frame_filename = gap_story_get_filename_from_elem(fw->stb_elem_refptr);
fw->seq_nr = seq_nr;
p_frame_widget_render(fw);
if(sgpp_ptr)
{
if(sgpp_ptr->cancel_video_api)
{
/* if user did press cancel during videoseek or videoindex creation
* we set the flag auto_vthumb_refresh_canceled TRUE
* this Flag stays TRUE until the next start of this refresh procedure.
* All further video items waiting for refresh are then rendered
* with the default icon (instead of accessing the videofile) in this refresh cycle.
* otherwise the user has to cancel each video item separately
*/
sgpp_ptr->auto_vthumb_refresh_canceled = TRUE;
}
}
}
}
/* render selection state for all displayed framewidgets */
p_tabw_update_selection(tabw);
} /* end p_render_all_frame_widgets */
/* ---------------------------------
* p_frame_widget_init_empty
* ---------------------------------
* this procedure does initialize
* the passed frame_widget, by creating all
* the gtk_widget stuff to build up the frame_widget
*/
static void
p_frame_widget_init_empty (GapStbTabWidgets *tabw, GapStbFrameWidget *fw)
{
GtkWidget *alignment;
gint32 l_check_size;
if(gap_debug) printf("p_frame_widget_init_empty START\n");
/* create all sub-widgets for the given frame widget */
fw->pv_ptr = NULL;
fw->seq_nr = 0;
fw->frame_filename = NULL;
fw->stb_elem_refptr = NULL;
fw->stb_refptr = NULL;
fw->tabw = tabw;
fw->sgpp = tabw->sgpp;
fw->vbox = gtk_vbox_new (FALSE, 0);
GTK_WIDGET_SET_FLAGS(fw->vbox, GTK_CAN_FOCUS);
/* the vox2 */
fw->vbox2 = gtk_vbox_new (FALSE, 0);
/* Create an EventBox (container for labels and the preview drawing_area)
* used to handle selection events
*/
fw->event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (fw->event_box), fw->vbox2);
gtk_widget_set_events (fw->event_box, GDK_BUTTON_PRESS_MASK);
gtk_box_pack_start (GTK_BOX (fw->vbox), fw->event_box, FALSE, FALSE, 0);
/* The frame preview */
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (fw->vbox2), alignment, FALSE, FALSE, 1);
gtk_widget_show (alignment);
l_check_size = tabw->thumbsize / 16;
fw->pv_ptr = gap_pview_new( tabw->thumb_width + 0
, tabw->thumb_height + 0
, l_check_size
, NULL /* no aspect_frame is used */
);
gtk_widget_set_events (fw->pv_ptr->da_widget, GDK_EXPOSURE_MASK);
gtk_container_add (GTK_CONTAINER (alignment), fw->pv_ptr->da_widget);
gtk_widget_show (fw->pv_ptr->da_widget);
g_signal_connect (G_OBJECT (fw->pv_ptr->da_widget), "event",
G_CALLBACK (p_frame_widget_preview_events_cb),
fw);
/* the hbox */
fw->hbox = gtk_hbox_new (FALSE, 1);
gtk_box_pack_start (GTK_BOX (fw->vbox2), fw->hbox, FALSE, FALSE, 2);
/* the key label */
fw->key_label = gtk_label_new ("key");
gtk_box_pack_start (GTK_BOX (fw->hbox), fw->key_label, FALSE, FALSE, 0);
gtk_widget_show (fw->key_label);
/* the frame timing label */
fw->val_label = gtk_label_new ("val");
gtk_box_pack_start (GTK_BOX (fw->hbox), fw->val_label, FALSE, FALSE, 2);
if(tabw->thumbsize >= STB_THSIZE_LARGE)
{
gimp_label_set_attributes (GTK_LABEL (fw->key_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_MEDIUM
,PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD
,-1);
gimp_label_set_attributes (GTK_LABEL (fw->val_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_MEDIUM
,-1);
}
else
{
if(tabw->thumbsize >= STB_THSIZE_MEDIUM)
{
gimp_label_set_attributes (GTK_LABEL (fw->key_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_SMALL
,PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD
,-1);
gimp_label_set_attributes (GTK_LABEL (fw->val_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_SMALL
,-1);
}
else
{
gimp_label_set_attributes (GTK_LABEL (fw->key_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_X_SMALL
,PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD
,-1);
gimp_label_set_attributes (GTK_LABEL (fw->val_label)
,PANGO_ATTR_SCALE, PANGO_SCALE_X_SMALL
,-1);
}
}
gtk_widget_show (fw->key_label);
gtk_widget_show (fw->val_label);
gtk_widget_show (fw->hbox);
gtk_widget_show (fw->vbox2);
gtk_widget_show (fw->event_box);
gtk_widget_show (fw->vbox);
p_frame_widget_init_dnd(fw);
g_signal_connect (G_OBJECT (fw->event_box), "button_press_event",
G_CALLBACK (p_frame_widget_preview_events_cb),
fw);
/* drag and drop also connects a signal handler on "button_press_event"
* therefore we connect a handler that runs after this handler
* (regardless if the event was hadled there or not)
*/
g_signal_connect_after (G_OBJECT (fw->pv_ptr->da_widget), "button_press_event",
G_CALLBACK (p_frame_widget_preview_events_cb),
fw);
if(gap_debug) printf("p_frame_widget_init_empty END\n");
} /* end p_frame_widget_init_empty */
/* ----------------------------------
* gap_story_dlg_render_default_icon
* ----------------------------------
* render a default icon,
* depending on the track and record_type of the
* story board elem.
* if stb_elem is passed as NULL pointer then render
* the icon for undefined mask reference.
*/
void
gap_story_dlg_render_default_icon(GapStoryElem *stb_elem, GapPView *pv_ptr)
{
GdkPixbuf *pixbuf;
if(pv_ptr == NULL)
{
return;
}
pixbuf = NULL;
if(stb_elem)
{
if(stb_elem->track == GAP_STB_MASK_TRACK_NUMBER)
{
switch(stb_elem->record_type)
{
case GAP_STBREC_VID_MOVIE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_mask_movie, FALSE, NULL);
break;
case GAP_STBREC_VID_FRAMES:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_mask_frames, FALSE, NULL);
break;
case GAP_STBREC_VID_ANIMIMAGE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_mask_animimage, FALSE, NULL);
break;
case GAP_STBREC_VID_IMAGE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_mask_image, FALSE, NULL);
break;
case GAP_STBREC_VID_COLOR:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_color, FALSE, NULL);
break;
case GAP_STBREC_ATT_TRANSITION:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_transition_attr, FALSE, NULL);
break;
default:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_default, FALSE, NULL);
break;
}
}
else
{
switch(stb_elem->record_type)
{
case GAP_STBREC_VID_MOVIE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_movie, FALSE, NULL);
break;
case GAP_STBREC_VID_FRAMES:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_frames, FALSE, NULL);
break;
case GAP_STBREC_VID_ANIMIMAGE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_animimage, FALSE, NULL);
break;
case GAP_STBREC_VID_IMAGE:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_image, FALSE, NULL);
break;
case GAP_STBREC_VID_COLOR:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_color, FALSE, NULL);
break;
case GAP_STBREC_ATT_TRANSITION:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_transition_attr, FALSE, NULL);
break;
case GAP_STBREC_VID_SECTION:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_section, FALSE, NULL);
break;
case GAP_STBREC_VID_BLACKSECTION:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_blacksection, FALSE, NULL);
break;
default:
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_default, FALSE, NULL);
break;
}
}
}
else
{
pixbuf = gdk_pixbuf_new_from_inline (-1, gap_story_icon_mask_undefined, FALSE, NULL);
}
if(pixbuf)
{
gap_pview_render_from_pixbuf (pv_ptr, pixbuf);
g_object_unref(pixbuf);
return;
}
gap_pview_render_default_icon(pv_ptr);
} /* end gap_story_dlg_render_default_icon */
/* ---------------------------------
* p_frame_widget_render
* ---------------------------------
* 1.) fetch thumbnal pixbuf data,
* 2.) if no thumbnail available
* try to load full image (and create the thumbnail for next usage)
* 3.) if neither thumbnail nor image could be fetched
* render a default icon
*
*/
static void
p_frame_widget_render (GapStbFrameWidget *fw)
{
gint32 l_th_width;
gint32 l_th_height;
gint32 l_th_bpp;
GdkPixbuf *pixbuf;
if(fw->stb_elem_refptr)
{
if(fw->stb_elem_refptr->track == GAP_STB_MASK_TRACK_NUMBER)
{
fw->pv_ptr->desaturate_request = TRUE;
}
}
if((fw->key_label) && (fw->val_label))
{
char *l_txt;
gint32 l_framenr;
GapStbTabWidgets *tabw;
char txt_buf[100];
tabw = (GapStbTabWidgets *)fw->tabw;
l_txt = g_strdup_printf("%d.", (int)fw->seq_nr);
gtk_label_set_text ( GTK_LABEL(fw->key_label), l_txt);
g_free(l_txt);
if(tabw->vtrack == GAP_STB_MASK_TRACK_NUMBER)
{
/* in the mask track always show the mask_name
* (because framenumber or timecode are not relevant for mask definitions)
*/
if(fw->stb_elem_refptr)
{
if(fw->stb_elem_refptr->mask_name)
{
if(strlen(fw->stb_elem_refptr->mask_name) > 8)
{
l_txt = g_strdup_printf("%.6s..", fw->stb_elem_refptr->mask_name);
gtk_label_set_text ( GTK_LABEL(fw->val_label), l_txt);
g_free(l_txt);
}
else
{
gtk_label_set_text ( GTK_LABEL(fw->val_label), fw->stb_elem_refptr->mask_name);
}
}
}
}
else
{
switch(tabw->edmode)
{
case GAP_STB_EDMO_FRAME_NUMBER:
if(fw->stb_refptr)
{
l_framenr = gap_story_get_framenr_by_story_id(fw->stb_refptr->active_section
,fw->stb_elem_refptr->story_id
,tabw->vtrack
);
l_txt = g_strdup_printf("%06d", (int)l_framenr);
gtk_label_set_text ( GTK_LABEL(fw->val_label), l_txt);
g_free(l_txt);
break;
}
case GAP_STB_EDMO_TIMECODE:
if(fw->stb_refptr)
{
gdouble l_framerate;
l_framerate = fw->stb_refptr->master_framerate;
if(l_framerate < 1)
{
l_framerate = GAP_STORY_DEFAULT_FRAMERATE;
}
l_framenr = gap_story_get_framenr_by_story_id(fw->stb_refptr->active_section
,fw->stb_elem_refptr->story_id
,tabw->vtrack
);
gap_timeconv_framenr_to_timestr(l_framenr
, (gdouble)l_framerate
, txt_buf
, sizeof(txt_buf)
);
gtk_label_set_text ( GTK_LABEL(fw->val_label), txt_buf);
break;
}
default:
if(fw->stb_elem_refptr)
{
g_snprintf(txt_buf, sizeof(txt_buf), "#:%d", (int)fw->stb_elem_refptr->nframes);
gtk_label_set_text ( GTK_LABEL(fw->val_label), txt_buf);
}
else
{
gtk_label_set_text ( GTK_LABEL(fw->val_label), " ");
}
break;
}
}
}
/* init preferred width and height
* (as hint for the thumbnail loader to decide
* if thumbnail is to fetch from normal or large thumbnail directory
* just for the case when both sizes are available)
*/
l_th_width = 128;
l_th_height = 128;
if((fw->stb_elem_refptr->record_type == GAP_STBREC_VID_MOVIE)
|| (fw->stb_elem_refptr->record_type == GAP_STBREC_VID_ANIMIMAGE)
|| (fw->stb_elem_refptr->record_type == GAP_STBREC_VID_SECTION))
{
guchar *l_th_data;
l_th_data = gap_story_vthumb_fetch_thdata(fw->sgpp
,fw->stb_refptr
,fw->stb_elem_refptr
,fw->stb_elem_refptr->from_frame
,fw->stb_elem_refptr->seltrack
,gap_story_get_preferred_decoder(fw->stb_refptr, fw->stb_elem_refptr)
,&l_th_bpp
,&l_th_width
,&l_th_height
);
if(l_th_data)
{
gboolean l_th_data_was_grabbed;
l_th_data_was_grabbed = gap_pview_render_f_from_buf (fw->pv_ptr
, l_th_data
, l_th_width
, l_th_height
, l_th_bpp
, TRUE /* allow_grab_src_data */
, fw->stb_elem_refptr->flip_request
, GAP_STB_FLIP_NONE /* flip_status */
);
if(!l_th_data_was_grabbed)
{
/* the gap_pview_render_f_from_buf procedure can grab the l_th_data
* instead of making a private copy for later use on repaint demands.
* if such a grab happened it returns TRUE.
* (this is done for optimal performance reasons)
* in such a case the caller must NOT free the src_data (l_th_data) !!!
*/
g_free(l_th_data);
}
l_th_data = NULL;
return;
}
}
if(fw->frame_filename == NULL)
{
/* no filename available, use default icon */
gap_story_dlg_render_default_icon(fw->stb_elem_refptr, fw->pv_ptr);
return;
}
pixbuf = gap_thumb_file_load_pixbuf_thumbnail(fw->frame_filename
, &l_th_width, &l_th_height
, &l_th_bpp
);
if(pixbuf)
{
gap_pview_render_f_from_pixbuf (fw->pv_ptr
, pixbuf
, fw->stb_elem_refptr->flip_request
, GAP_STB_FLIP_NONE /* flip_status */
);
g_object_unref(pixbuf);
}
else
{
gint32 l_image_id;
l_image_id = -1;
/* skip attempt to render thubnail from full image in case cliptype is a movie
* (attempts to load movie filetyes unsupported by the gimp core do result in annoying
* GIMP error messages since GIMP-2.6.x, and do not make sense anyway.)
*/
if((fw->stb_elem_refptr->record_type != GAP_STBREC_VID_MOVIE)
&& (fw->stb_elem_refptr->record_type != GAP_STBREC_VID_SECTION))
{
if(gap_debug)
{
printf("p_frame_widget_render: call gap_lib_load_image to get THUMBNAIL for:%s\n", fw->frame_filename);
}
l_image_id = gap_lib_load_image(fw->frame_filename);
}
if (l_image_id < 0)
{
/* could not read the image
*/
if(gap_debug)
{
printf("p_frame_widget_render: fetch failed, using DEFAULT_ICON\n");
}
gap_story_dlg_render_default_icon(fw->stb_elem_refptr, fw->pv_ptr);
}
else
{
/* there is no need for undo on this scratch image
* so we turn undo off for performance reasons
*/
gimp_image_undo_disable (l_image_id);
gap_pview_render_f_from_image (fw->pv_ptr
, l_image_id
, fw->stb_elem_refptr->flip_request
, GAP_STB_FLIP_NONE /* flip_status */
);
/* create thumbnail (to speed up acces next time) */
gap_thumb_cond_gimp_file_save_thumbnail(l_image_id, fw->frame_filename);
gimp_image_delete(l_image_id);
}
}
} /* end p_frame_widget_render */
/* ---------------------------------
* p_frame_widget_destroy
* ---------------------------------
*/
static void
p_frame_widget_destroy(GapStbFrameWidget *fw)
{
gap_pview_reset(fw->pv_ptr);
if(fw->frame_filename) { g_free(fw->frame_filename); }
fw->frame_filename = NULL;
fw->stb_elem_refptr = NULL;
fw->stb_refptr = NULL;
fw->tabw = NULL;
gtk_widget_destroy(fw->vbox);
} /* end p_frame_widget_destroy */
/* -----------------------------
* p_get_max_rowpage
* -----------------------------
*/
static gint32
p_get_max_rowpage(gint32 act_elems, gint32 cols, gint rows)
{
gint32 l_max_rowpage;
if(cols < 1)
{
l_max_rowpage = (MAX(act_elems, 1) -1);
}
else
{
l_max_rowpage = ((MAX(act_elems, 1) -1) / cols);
}
l_max_rowpage = 1 + (l_max_rowpage - (MAX(rows,1) -1));
return(MAX(l_max_rowpage,1));
} /* end p_get_max_rowpage */
/* -----------------------------
* p_story_set_range_cb
* -----------------------------
*/
static void
p_story_set_range_cb(GapPlayerAddClip *plac_ptr)
{
if(gap_debug)
{
printf("p_story_set_range_cb:\n");
printf(" FROM : %d\n", (int)plac_ptr->range_from);
printf(" TO : %d\n", (int)plac_ptr->range_to);
}
if(plac_ptr->ainfo_ptr)
{
GapStbMainGlobalParams *sgpp;
GapStbTabWidgets *tabw;
GapStbTabWidgets *tabw_1;
GapStbTabWidgets *tabw_2;
GapStoryBoard *stb_dst;
GapStoryBoard *stb_1;
GapStoryBoard *stb_2;
GapStoryElem *stb_elem;
if(gap_debug)
{
printf(" basename :%s:\n", plac_ptr->ainfo_ptr->basename);
printf(" extension :%s:\n", plac_ptr->ainfo_ptr->extension);
printf(" frame_cnt :%d\n", (int)plac_ptr->ainfo_ptr->frame_cnt);
printf(" old_filename :%s\n", plac_ptr->ainfo_ptr->old_filename);
}
sgpp = (GapStbMainGlobalParams *)plac_ptr->user_data_ptr;
if(sgpp)
{
stb_1 = (GapStoryBoard *)sgpp->cll;
stb_2 = (GapStoryBoard *)sgpp->stb;
tabw_1 = sgpp->cll_widgets;
tabw_2 = sgpp->stb_widgets;
if(sgpp->clip_target == GAP_STB_CLIPTARGET_STORYBOARD_APPEND)
{
stb_1 = (GapStoryBoard *)sgpp->stb;
stb_2 = (GapStoryBoard *)sgpp->cll;
tabw_1 = sgpp->stb_widgets;
tabw_2 = sgpp->cll_widgets;
}
stb_dst = stb_1;
tabw = tabw_1;
if(stb_dst == NULL)
{
stb_dst = stb_2;
tabw = tabw_2;
}
if(stb_dst)
{
stb_elem = gap_story_new_elem(GAP_STBREC_VID_UNKNOWN);
if(stb_elem)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_CREATE_CLIP);
gap_story_upd_elem_from_filename(stb_elem, plac_ptr->ainfo_ptr->old_filename);
stb_elem->track = tabw->vtrack;
stb_elem->from_frame = plac_ptr->range_from;
stb_elem->to_frame = plac_ptr->range_to;
gap_story_elem_calculate_nframes(stb_elem);
if(plac_ptr->ainfo_ptr)
{
if(plac_ptr->ainfo_ptr->ainfo_type == GAP_AINFO_MOVIE)
{
stb_elem->record_type = GAP_STBREC_VID_MOVIE;
stb_elem->seltrack = plac_ptr->ainfo_ptr->seltrack;
stb_elem->exact_seek = 0;
stb_elem->delace = plac_ptr->ainfo_ptr->delace;
//stb_elem->density = plac_ptr->ainfo_ptr->density;
}
}
gap_story_list_append_elem(stb_dst, stb_elem);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
gap_stb_undo_group_end(tabw);
}
}
}
}
} /* end p_story_set_range_cb */
/* ---------------------------------------
* gap_story_fw_abstract_properties_dialog
* ---------------------------------------
*/
static void
gap_story_fw_abstract_properties_dialog (GapStbFrameWidget *fw)
{
if(fw)
{
GapStbMainGlobalParams *sgpp;
sgpp = fw->sgpp;
if (sgpp == NULL)
{
return;
}
if(fw->stb_elem_refptr)
{
if(gap_story_elem_is_video(fw->stb_elem_refptr))
{
gap_story_fw_properties_dialog(fw);
return;
}
if (fw->stb_elem_refptr->record_type == GAP_STBREC_ATT_TRANSITION)
{
gap_story_att_fw_properties_dialog(fw);
return;
}
}
}
} /* end gap_story_fw_abstract_properties_dialog */
/* -----------------------------
* p_story_call_player
* -----------------------------
* IN: stb Pointer to a stroyboard list structure
* IN: imagename of one frame to playback in normal mode (NULL for storyboard playback)
* IN: image_id of one frame to playback in normal mode (use -1 for storyboard playback)
*
* IN: begin_frame use -1 to start play from 1.st frame
* IN: end_frame use -1 to start play until last frame
* IN: stb_composite true: force composite video playback (all tracks involved)
* false: play clips of the selected stb_in_track
* without calling the storyboard render processing.
*
* IN: stb_in_track specify video track number (start with 1)
* for composite video playback the stb_in_track is only relevant
* if playback shall include only selected clips. In this case
* the selection mapping is built based on the selected clips
* in the stb_in_track.
*
* stb_mode: stb != NULL, imagename == NULL, image_id == -1
* imagemode: stb == NULL, imagename != NULL, image_id == -1
* normalmode: stb == NULL, imagename == NULL, image_id >= 0
*
* Call the Player
* If it is the 1.st call or the player window has closed since last call
* create the player widget
* else
* reset the player widget
*
* Notes for the stb_mode:
* The player always gets a duplicate of the current storyboard,
* where the relevant clips are placed in the main section.
*
* The duplicate will contain only selected elements in case where
* the caller has requested this via play_all == FALSE.
*
* If the active_section in the specified original storyboard (stb)
* is NOT its main section, the active section of the original
* is copied as main section to the duplicate for playback.
* (additional the mask_section is also included in the duplicate)
*
* playback is limited to simple clips of the current video track
* in case a valid (positive) vtrack number is specified.
* (this allows quick direct frame fetch operations without
* the use of the storyboard render processor engine,
* VID_PLAY_SECTION elemnts are rendered as black frames in this
* playback mode)
*
* a negative vtrack number (-1) triggers composite video playback
* where the storyboard render processor engine is used.
*/
void
p_story_call_player(GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb
, char *imagename
, gint32 imagewidth
, gint32 imageheight
, gdouble aspect_ratio
, gint32 image_id
, gint32 begin_frame
, gint32 end_frame
, gboolean play_all
, gint32 seltrack
, gdouble delace
, const char *preferred_decoder
, gint32 flip_request
, gint32 flip_status
, gint32 stb_in_track
, gboolean stb_composite
)
{
GapStoryBoard *stb_dup;
gint32 player_stb_in_track;
if(sgpp->in_player_call)
{
/* this procedure is already active, and locked against
* calls while busy
*/
return;
}
if(sgpp->vthumb_prefetch_in_progress != GAP_VTHUMB_PREFETCH_NOT_ACTIVE)
{
/* refuse player call while vthumb prefetch is busy
*/
g_message(_("playback was blocked (video file access is busy)"));
return;
}
sgpp->in_player_call = TRUE;
gap_story_vthumb_close_videofile(sgpp);
player_stb_in_track = stb_in_track;
stb_dup = NULL;
if(stb)
{
if (stb_composite)
{
player_stb_in_track = -1; /* force composite playback in the player */
}
if(gap_debug)
{
printf("\n\n\n\n\n\n\n\n\np_story_call_player:"
" play_all:%d stb_composite:%d stb_in_track:%d begin:%d end:%d\n"
,(int)play_all
,(int)stb_composite
,(int)stb_in_track
,(int)begin_frame
,(int)end_frame
);
// printf("The original storyboard list:\n");
// gap_story_debug_print_list(stb);
// printf("==========###########========\n\n END of The original storyboard list:\n");
// fflush(stdout);
}
/* make a copy of the storyboard list
* for the internal use in the player
* (note that section clip playback is only supported
* if the main section is active and composite video playback is selectd)
*/
if(play_all)
{
if(stb->active_section == gap_story_find_main_section(stb))
{
stb_dup = gap_story_duplicate_full(stb);
}
else
{
stb_dup = gap_story_duplicate_active_and_mask_section(stb);
}
}
else
{
if ((stb_composite) || (stb_in_track < 0))
{
stb_dup = gap_story_duplicate_active_and_mask_section(stb);
if(stb->active_section == gap_story_find_main_section(stb))
{
/* for composite video playback of "only selected elements" in
* the main section, we have to copy implictely
* all referenced sub sections.
* (but we simply add all available subsection)
*/
gap_story_copy_sub_sections(stb, stb_dup);
}
/* create selection mapping from source storyboard stb
* and attach the mapping to the duplicate.
* Note that the duplicate must contain all clips of the active section
* (and not only the selected clips), so that the mapping
* can be used there too.
*/
stb_dup->mapping =
gap_story_create_new_mapping_from_selection(
stb->active_section
, MAX(1, stb_in_track));
if(gap_debug)
{
gap_story_debug_print_mapping(stb_dup->mapping);
fflush(stdout);
}
}
else
{
/* here we handle storyboard playback of selected clips
* in the current videotrack of the active_section.
* (the player will not use the render processor,
* and will be much faster in this mode.
* playback of sub section references is not supported in this case.)
*/
stb_dup = gap_story_duplicate_sel_only(stb, stb_in_track);
gap_story_enable_hidden_maskdefinitions(stb_dup);
}
}
if(stb_dup)
{
GapStorySection *dup_main_section;
if(gap_debug)
{
printf("p_story_call_player: The duplicated storyboard list:");
gap_story_debug_print_list(stb_dup);
printf("==========###########========\n\n END of The duplicated storyboard list:\n");
fflush(stdout);
}
if(TRUE == p_is_debug_feature_item_enabled("save_stb_duplicate_on_call_player"))
{
/* debug feature: save the storyboard duplicate that will be passed
* to the player.
*/
gap_story_save(stb_dup, "STB_DUPLICATE_on_call_player.txt");
}
dup_main_section = gap_story_find_main_section(stb_dup);
if(dup_main_section->stb_elem == NULL)
{
/* there was no selection, now try to playback the
* whole storyboard
*/
gap_story_free_storyboard(&stb_dup);
if(stb->active_section == gap_story_find_main_section(stb))
{
stb_dup = gap_story_duplicate_full(stb);
}
else
{
stb_dup = gap_story_duplicate_active_and_mask_section(stb);
}
}
}
if(stb_dup == NULL)
{
return; /* in case of errors: NO playback possible */
sgpp->in_player_call = FALSE;
}
}
if(sgpp->plp)
{
if(sgpp->plp->stb_ptr)
{
/* free the (old duplicate) of the storyboard list
* that was used in the previous
* player call
*/
gap_story_free_storyboard(&sgpp->plp->stb_ptr);
}
if((sgpp->plp->shell_window == NULL)
&& (sgpp->plp->docking_container == NULL))
{
/*if(gap_debug)*/ printf("Player shell has gone, force Reopen now\n");
gap_player_dlg_cleanup(sgpp->plp);
g_free(sgpp->plp);
sgpp->plp = NULL;
}
}
if(sgpp->plp == NULL)
{
if(gap_debug)
{
printf("p_story_call_player: 1.st start\n");
}
/* 1. START mode */
sgpp->plp = (GapPlayerMainGlobalParams *)g_malloc0(sizeof(GapPlayerMainGlobalParams));
if(sgpp->plp)
{
sgpp->plp->standalone_mode = FALSE; /* player acts as widget and does not call gtk_main_quit */
sgpp->plp->docking_container = sgpp->player_frame;
sgpp->plp->help_id = GAP_STB_PLAYER_HELP_ID;
if(sgpp->plp->docking_container)
{
/* the player widget is created without Help button
* when it is part of the storyboard window
*/
sgpp->plp->help_id = NULL;
}
sgpp->plp->autostart = TRUE;
sgpp->plp->caller_range_linked = FALSE;
sgpp->plp->use_thumbnails = FALSE;
sgpp->plp->exact_timing = FALSE;
sgpp->plp->play_selection_only = TRUE;
sgpp->plp->play_loop = FALSE;
sgpp->plp->play_pingpong = FALSE;
sgpp->plp->play_backward = FALSE;
sgpp->plp->stb_ptr = stb_dup;
sgpp->plp->stb_in_track = player_stb_in_track;
sgpp->plp->image_id = image_id;
sgpp->plp->imagename = NULL;
if(imagename)
{
sgpp->plp->imagename = g_strdup(imagename);
}
sgpp->plp->imagewidth = imagewidth;
sgpp->plp->imageheight = imageheight;
sgpp->plp->aspect_ratio = aspect_ratio;
sgpp->plp->play_current_framenr = 0;
sgpp->plp->begin_frame = begin_frame;
sgpp->plp->end_frame = end_frame;
sgpp->plp->fptr_set_range = p_story_set_range_cb;
sgpp->plp->user_data_ptr = sgpp;
sgpp->plp->seltrack = seltrack;
sgpp->plp->delace = delace;
sgpp->plp->preferred_decoder = g_strdup(preferred_decoder);
sgpp->plp->force_open_as_video = FALSE; /* FALSE: try video open only for known videofile extensions */
sgpp->plp->have_progress_bar = TRUE;
sgpp->plp->flip_request = flip_request;
sgpp->plp->flip_status = flip_status;
gap_player_dlg_create(sgpp->plp);
}
}
else
{
if(gap_debug)
{
printf("p_story_call_player: RE start\n");
}
sgpp->plp->aspect_ratio = aspect_ratio;
/* RESTART mode */
gap_player_dlg_restart(sgpp->plp
, TRUE /* gboolean autostart */
, image_id
, imagename
, imagewidth
, imageheight
, stb_dup
, begin_frame
, end_frame
, TRUE /* gboolean play_selection_only */
, seltrack
, delace
, preferred_decoder
, FALSE
, flip_request
, flip_status
, player_stb_in_track
);
}
sgpp->in_player_call = FALSE;
} /* end p_story_call_player */
/* -----------------------------
* p_call_master_encoder
* -----------------------------
* INTERACTIVE call of the GAP master videoencoder dialog plug-in
*/
static void
p_call_master_encoder(GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb
, const char *stb_filename
)
{
#define GAP_PLUG_IN_MASTER_ENCODER "plug_in_gap_vid_encode_master"
GimpParam* l_params;
gint l_retvals;
gint l_rc;
gint32 dummy_layer_id;
gint32 vid_width;
gint32 vid_height;
if(gap_debug)
{
printf("p_call_master_encoder\n");
}
if((sgpp == NULL)
|| (stb == NULL))
{
return;
}
l_rc = -1;
gap_story_get_master_size_respecting_aspect(stb, &vid_width, &vid_height);
gtk_window_iconify(sgpp->shell_window);
while (gtk_events_pending ())
{
gtk_main_iteration ();
}
dummy_layer_id = gap_image_get_any_layer(sgpp->image_id);
/* generic call of GAP master video encoder plugin */
l_params = gimp_run_procedure (GAP_PLUG_IN_MASTER_ENCODER,
&l_retvals,
GIMP_PDB_INT32, GIMP_RUN_INTERACTIVE,
GIMP_PDB_IMAGE, sgpp->image_id, /* pass the image where invoked from */
GIMP_PDB_DRAWABLE, dummy_layer_id,
GIMP_PDB_STRING, "video_output.avi",
GIMP_PDB_INT32, 1, /* range_from */
GIMP_PDB_INT32, 2, /* range_to */
GIMP_PDB_INT32, vid_width,
GIMP_PDB_INT32, vid_height,
GIMP_PDB_INT32, 1, /* 1 VID_FMT_PAL, 2 VID_FMT_NTSC */
GIMP_PDB_FLOAT, MAX(stb->master_framerate, 1.0),
GIMP_PDB_INT32, 44100, /* samplerate */
GIMP_PDB_STRING, NULL, /* audfile l_16bit_wav_file */
GIMP_PDB_STRING, NULL, /* vid_enc_plugin */
GIMP_PDB_STRING, NULL, /* filtermacro_file */
GIMP_PDB_STRING, stb_filename, /* storyboard_file */
GIMP_PDB_INT32, 2, /* GAP_RNGTYPE_STORYBOARD input_mode */
GIMP_PDB_END);
switch(l_params[0].data.d_status)
{
case GIMP_PDB_SUCCESS:
l_rc = 0;
break;
case GIMP_PDB_CANCEL:
break;
default:
printf("gap_story_dialog:p_call_master_encoder\n"
"PDB calling error %s\n"
"status: %d\n"
, GAP_PLUG_IN_MASTER_ENCODER
, (int)l_params[0].data.d_status
);
break;
}
g_free(l_params);
gtk_window_deiconify(sgpp->shell_window);
} /* end p_call_master_encoder */
/* -----------------------------
* p_restore_edit_settings
* -----------------------------
*/
static void
p_restore_edit_settings (GapStbTabWidgets *tabw, GapStoryBoard *stb)
{
if(stb == NULL)
{
return;
}
if (stb->edit_settings)
{
GapStorySection *section;
gint32 l_rowpage;
gint32 l_page;
section =
gap_story_find_section_by_name(stb, stb->edit_settings->section_name);
if (section == NULL)
{
section = gap_story_find_main_section(stb);
}
stb->active_section = section;
tabw->vtrack = CLAMP(stb->edit_settings->track, 0, GAP_STB_MAX_VID_TRACKS);
l_rowpage = 1;
l_page = MAX(1, stb->edit_settings->page);
/* restore scroll position, recalculate the page
* (that reprensents the scroll position)
* if(stb->layout_cols > 0) { tabw->cols = stb->layout_cols; }
* if(stb->layout_rows > 0) { tabw->rows = stb->layout_rows; }
* if(stb->layout_thumbsize > 0) { tabw->thumbsize = stb->layout_thumbsize; }
*/
if (l_page != 1)
{
gint32 l_max_rowpage = 1;
gint32 l_act_elems = 0;
if ((tabw->cols != stb->layout_cols)
&& (tabw->cols > 1)
&& (stb->layout_cols > 1))
{
gdouble new_page;
/* convert the page to current column layout */
new_page = (gdouble)(l_page -1) * (gdouble)stb->layout_cols / (gdouble)tabw->cols;
l_page = 1 + new_page;
}
l_act_elems = gap_story_count_active_elements(stb, tabw->vtrack );
l_max_rowpage = p_get_max_rowpage(l_act_elems, tabw->cols, tabw->rows);
l_rowpage = CLAMP(l_page, 1, l_max_rowpage);
}
tabw->rowpage = l_rowpage;
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->vtrack_spinbutton_adj)
, tabw->vtrack);
}
} /* end p_restore_edit_settings */
/* -----------------------------
* p_tabw_process_undo
* -----------------------------
*/
static void
p_tabw_process_undo(GapStbTabWidgets *tabw)
{
GapStoryBoard *stb;
stb = gap_stb_undo_pop(tabw);
if (stb)
{
p_tabw_replace_storyboard_and_widgets(tabw, stb);
}
} /* end p_tabw_process_undo */
/* -----------------------------
* p_tabw_process_redo
* -----------------------------
*/
static void
p_tabw_process_redo(GapStbTabWidgets *tabw)
{
GapStoryBoard *stb;
stb = gap_stb_undo_redo(tabw);
if (stb)
{
p_tabw_replace_storyboard_and_widgets(tabw, stb);
}
} /* end p_tabw_process_redo */
/* ---------------------------------------
* p_tabw_replace_storyboard_and_widgets
* ---------------------------------------
* replace the storyboard (if there is one) and
* rebuild all the widgets.
* further close all pop-up dialogs related to the old existing
* storyboard.
* This procedure is typically called at load, undo and redo
* features.
*/
static void
p_tabw_replace_storyboard_and_widgets(GapStbTabWidgets *tabw, GapStoryBoard *stb)
{
GapStoryBoard *old_stb;
GapStbMainGlobalParams *sgpp;
gint32 target_rowpage;
if ((tabw == NULL) || (stb == NULL))
{
return;
}
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
old_stb = p_tabw_get_stb_ptr(tabw);
if (old_stb)
{
p_tabw_destroy_all_popup_dlg(tabw);
}
if(tabw == sgpp->cll_widgets)
{
/* drop the old cliplist structure */
gap_story_free_storyboard(&sgpp->cll);
sgpp->cll = stb;
sgpp->cll->master_type = GAP_STB_MASTER_TYPE_CLIPLIST;
}
else
{
if(tabw == sgpp->stb_widgets)
{
/* drop the old storyboard structure */
gap_story_free_storyboard(&sgpp->stb);
sgpp->stb = stb;
sgpp->stb->master_type = GAP_STB_MASTER_TYPE_STORYBOARD;
}
}
p_restore_edit_settings(tabw, stb);
target_rowpage = tabw->rowpage;
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
/* update the combo_box to reflect active_section */
p_set_strings_for_section_combo(tabw);
/* update vscale and corresponding rowpage spinbutton */
p_update_vscale_page(tabw);
if(gap_debug)
{
printf("p_tabw_replace_storyboard_and_widgets:\n"
" >> target rowpage:%d tabw->rowpage:%d rowpage_spinbutton:%.4f\n"
,(int)target_rowpage
,(int)tabw->rowpage
,(float)GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->value
);
}
/* update the hidden rowpage_spinbutton widget
* to target_rowpage value.
*/
{
gint32 rowpage_spinbutton_value;
rowpage_spinbutton_value = GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->value;
if(rowpage_spinbutton_value != target_rowpage)
{
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)
, (gdouble)target_rowpage);
}
}
gap_story_dlg_tabw_undo_redo_sensitivity(tabw);
} /* end p_tabw_replace_storyboard_and_widgets */
/* -----------------------------
* p_storyboard_reload
* -----------------------------
* return TRUE on successful reload
*/
static gboolean
p_storyboard_reload (GapStbMainGlobalParams *sgpp)
{
gboolean l_ret;
l_ret = FALSE;
if(sgpp)
{
GapStoryBoard *stb;
/* load the new storyboard structure from file */
stb = gap_story_parse(sgpp->storyboard_filename);
if(stb)
{
if(stb->errtext != NULL)
{
g_message(_("** ERROR: Storyboard parser reported:\n%s\n"), stb->errtext);
gap_story_free_storyboard(&stb);
}
else
{
p_tabw_replace_storyboard_and_widgets(sgpp->stb_widgets, stb);
gap_stb_undo_destroy_undo_stack(sgpp->stb_widgets);
l_ret = TRUE;
}
}
}
return (l_ret);
} /* end p_storyboard_reload */
/* -----------------------------
* p_cliplist_reload
* -----------------------------
* return TRUE on successful reload
*/
static gboolean
p_cliplist_reload (GapStbMainGlobalParams *sgpp)
{
gboolean l_ret;
l_ret = FALSE;
if(sgpp)
{
GapStoryBoard *stb;
/* load the new storyboard structure from file */
stb = gap_story_parse(sgpp->cliplist_filename);
if(stb)
{
if(stb->errtext != NULL)
{
g_message(_("** ERROR: Storyboard parser reported:\n%s\n"), stb->errtext);
gap_story_free_storyboard(&stb);
}
else
{
p_tabw_replace_storyboard_and_widgets(sgpp->cll_widgets, stb);
gap_stb_undo_destroy_undo_stack(sgpp->cll_widgets);
l_ret = TRUE;
}
}
}
return (l_ret);
} /* end p_cliplist_reload */
/*
* DIALOG and callback stuff
*/
/* -----------------------------
* p_player_cll_mode_cb
* -----------------------------
*/
static void
p_player_cll_mode_cb (GtkWidget *w
, GdkEventButton *bevent
, GapStbMainGlobalParams *sgpp)
{
gint32 imagewidth;
gint32 imageheight;
gdouble aspect_ratio;
gint32 stb_in_track;
gboolean play_all;
gboolean stb_composite;
GapStbTabWidgets *tabw;
if(sgpp->cll)
{
play_all = FALSE;
stb_composite = FALSE;
tabw = sgpp->cll_widgets;
stb_in_track = 1;
if(tabw)
{
stb_in_track = tabw->vtrack;
}
if(bevent)
{
if(bevent->state & GDK_SHIFT_MASK)
{
play_all = TRUE;
}
if(bevent->state & GDK_CONTROL_MASK)
{
stb_composite = TRUE;
}
}
if(sgpp->force_stb_aspect)
{
aspect_ratio = gap_story_get_master_size_respecting_aspect(sgpp->cll
, &imagewidth
, &imageheight);
}
else
{
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
gap_story_get_master_pixelsize(sgpp->cll
, &imagewidth
, &imageheight);
}
p_story_call_player(sgpp
,sgpp->cll
,NULL /* no imagename */
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in storyboard playback mode) */
,-1 /* play from start */
,-1 /* play until end */
,play_all
,1 /* seltrack */
,0.0 /* delace */
,gap_story_get_preferred_decoder(sgpp->cll, NULL)
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,stb_in_track
,stb_composite
);
}
} /* end p_player_cll_mode_cb */
/* -----------------------------
* p_player_stb_mode_cb
* -----------------------------
*/
static void
p_player_stb_mode_cb (GtkWidget *w
, GdkEventButton *bevent
, GapStbMainGlobalParams *sgpp)
{
gint32 imagewidth;
gint32 imageheight;
gdouble aspect_ratio;
gint32 stb_in_track;
gboolean play_all;
gboolean stb_composite;
GapStbTabWidgets *tabw;
if(sgpp->stb)
{
play_all = FALSE;
stb_composite = FALSE;
tabw = sgpp->stb_widgets;
stb_in_track = 1;
if(tabw)
{
stb_in_track = tabw->vtrack;
}
if(bevent)
{
if(bevent->state & GDK_SHIFT_MASK)
{
play_all = TRUE;
}
if(bevent->state & GDK_CONTROL_MASK)
{
stb_composite = TRUE;
}
}
if(sgpp->force_stb_aspect)
{
aspect_ratio = gap_story_get_master_size_respecting_aspect(sgpp->stb
, &imagewidth
, &imageheight);
}
else
{
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
gap_story_get_master_pixelsize(sgpp->stb
, &imagewidth
, &imageheight);
}
p_story_call_player(sgpp
,sgpp->stb
,NULL /* no imagename */
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in storyboard playback mode) */
,-1 /* play from start */
,-1 /* play until end */
,play_all
,1 /* seltrack */
,0.0 /* delace */
,gap_story_get_preferred_decoder(sgpp->stb, NULL)
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,stb_in_track
,stb_composite
);
}
} /* end p_player_stb_mode_cb */
/* -----------------------------
* p_player_img_mode_cb
* -----------------------------
* this is used to init the player window
* with image where the storyboard was invoked from.
*/
static void
p_player_img_mode_cb (GtkWidget *w,
GapStbMainGlobalParams *sgpp)
{
gint32 imagewidth;
gint32 imageheight;
long framenr;
imagewidth = gimp_image_width(sgpp->image_id);
imageheight = gimp_image_height(sgpp->image_id);
if(gap_debug)
{
printf("p_player_img_mode_cb: init player from image:id:%d\n"
, sgpp->image_id
);
}
p_story_call_player(sgpp
,NULL /* Play Normal mode without storyboard */
,NULL /* no imagename mode */
,imagewidth
,imageheight
,GAP_PLAYER_DONT_FORCE_ASPECT
,sgpp->image_id
,framenr /* play from start */
,framenr /* play until end */
,FALSE /* play all */
,1 /* seltrack */
,0.0 /* delace */
,"libavformat"
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,1 /* stb_in_track (not relevant here) */
,FALSE /* stb_composite (not relevant here) */
);
} /* end p_player_img_mode_cb */
/* -----------------------------
* p_cancel_button_cb
* -----------------------------
*/
static void
p_cancel_button_cb (GtkWidget *w,
GapStbMainGlobalParams *sgpp)
{
if(gap_debug)
{
if(w != NULL)
{
printf("VIDEO-CANCEL BUTTON clicked\n");
}
else
{
printf("VIDEO-CANCEL occured implicite\n");
}
}
if(sgpp)
{
sgpp->cancel_video_api = TRUE;
sgpp->auto_vthumb_refresh_canceled = TRUE;
p_reset_progress_bars(sgpp);
if(sgpp->vthumb_prefetch_in_progress == GAP_VTHUMB_PREFETCH_NOT_ACTIVE)
{
return;
}
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_NOT_ACTIVE;
if(sgpp->menu_item_win_vthumbs != NULL)
{
/* implicite switch off auto_vthumb (by setting the relevant menu item FALSE)
*/
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(sgpp->menu_item_win_vthumbs), FALSE);
}
}
} /* end p_cancel_button_cb */
/* -----------------------------------
* p_tabw_add_elem
* -----------------------------------
*/
static void
p_tabw_add_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst)
{
GapStoryElem *stb_elem;
if(gap_debug) printf("p_tabw_add_elem\n");
if(sgpp == NULL) { return; }
if(tabw == NULL) { return; }
if(stb_dst == NULL) { return; }
stb_elem = gap_story_new_elem(GAP_STBREC_VID_IMAGE);
/* stb_elem->orig_filename = g_strdup("empty.xcf"); */
stb_elem->track = tabw->vtrack;
stb_elem->from_frame = 1;
stb_elem->to_frame = 1;
stb_elem->nloop = 1;
stb_elem->nframes = 1;
if(stb_elem)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_CREATE_CLIP);
gap_story_list_append_elem(stb_dst, stb_elem);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
gap_story_stb_elem_properties_dialog(tabw, stb_elem, stb_dst);
gap_stb_undo_group_end(tabw);
}
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
} /* end p_tabw_add_elem */
/* -----------------------------------
* p_tabw_add_section_elem
* -----------------------------------
*/
static void
p_tabw_add_section_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst)
{
GapStoryElem *stb_elem;
GapStorySection *referable_section;
gint32 l_nframes;
if(gap_debug) printf("p_tabw_add_section_elem\n");
if(sgpp == NULL) { return; }
if(tabw == NULL) { return; }
if(stb_dst == NULL) { return; }
if(stb_dst->active_section == NULL) { return; }
referable_section = gap_story_find_first_referable_subsection(stb_dst);
if(referable_section == NULL) { return; }
l_nframes = gap_story_count_total_frames_in_section(referable_section);
stb_elem = gap_story_new_elem(GAP_STBREC_VID_SECTION);
stb_elem->orig_filename = g_strdup(referable_section->section_name);
stb_elem->track = tabw->vtrack;
stb_elem->from_frame = 1;
stb_elem->to_frame = l_nframes;
stb_elem->nloop = 1;
stb_elem->nframes = l_nframes;
if(stb_elem)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_CREATE_SECTION_CLIP);
gap_story_list_append_elem(stb_dst, stb_elem);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
gap_story_stb_elem_properties_dialog(tabw, stb_elem, stb_dst);
gap_stb_undo_group_end(tabw);
}
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
} /* end p_tabw_add_section_elem */
/* -----------------------------------
* p_tabw_add_att_elem
* -----------------------------------
*/
static void
p_tabw_add_att_elem (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp, GapStoryBoard *stb_dst)
{
GapStoryElem *stb_elem;
if(gap_debug) printf("p_tabw_add_att_elem\n");
if(sgpp == NULL) { return; }
if(tabw == NULL) { return; }
if(stb_dst == NULL) { return; }
/* initial settings for creating a new attribute transition element */
stb_elem = gap_story_new_elem(GAP_STBREC_ATT_TRANSITION);
stb_elem->track = tabw->vtrack;
stb_elem->att_keep_proportions = FALSE;
stb_elem->att_fit_width = TRUE;
stb_elem->att_fit_height = TRUE;
{
gint ii;
for(ii=0; ii < GAP_STB_ATT_TYPES_ARRAY_MAX; ii++)
{
gdouble l_from;
gdouble l_to;
gboolean l_enable;
l_from = 0.0;
l_to = 0.0;
l_enable = FALSE;
if ((ii == GAP_STB_ATT_TYPE_ZOOM_X)
|| (ii == GAP_STB_ATT_TYPE_ZOOM_Y))
{
l_from = 2.0; /* from double size */
l_to = 1.0; /* to 1:1 original size */
l_enable = FALSE;
}
if ((ii == GAP_STB_ATT_TYPE_MOVE_X)
|| (ii == GAP_STB_ATT_TYPE_MOVE_Y))
{
l_from = -1.0; /* from completely left/top outside */
l_to = 0.0; /* to centered position */
l_enable = FALSE;
}
if (ii == GAP_STB_ATT_TYPE_OPACITY)
{
l_from = 1.0; /* from fully opaque */
l_to = 0.0; /* to fully transparent */
l_enable = TRUE;
}
stb_elem->att_arr_enable[ii] = l_enable;
stb_elem->att_arr_value_from[ii] = l_from;
stb_elem->att_arr_value_to[ii] = l_to;
stb_elem->att_arr_value_dur[ii] = 20;
}
}
if(stb_elem)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_CREATE_TRANSITION);
gap_story_list_append_elem(stb_dst, stb_elem);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
gap_story_att_stb_elem_properties_dialog(tabw, stb_elem, stb_dst);
gap_stb_undo_group_end(tabw);
}
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
} /* end p_tabw_add_att_elem */
/* -----------------------------
* p_tabw_new_clip_cb
* -----------------------------
* callback for the new clip button
* SHIFT: create transition (disabled in mask_section)
* CTRL: create section clip (enabled in MAIN section, disabled in all other sections)
* standard clips can be create in all section types (without any modifier key)
*/
static void
p_tabw_new_clip_cb (GtkWidget *w
, GdkEventButton *bevent
, GapStbTabWidgets *tabw)
{
GapStoryBoard *stb_dst;
if (tabw == NULL) { return; }
if (tabw->sgpp == NULL) { return; }
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst != NULL)
{
if(bevent)
{
if(bevent->state & GDK_SHIFT_MASK)
{
if (stb_dst->active_section != stb_dst->mask_section)
{
p_tabw_add_att_elem (tabw, tabw->sgpp, stb_dst);
}
return;
}
if(bevent->state & GDK_CONTROL_MASK)
{
if (stb_dst->active_section == gap_story_find_main_section(stb_dst))
{
p_tabw_add_section_elem (tabw, tabw->sgpp, stb_dst);
}
return;
}
}
p_tabw_add_elem (tabw, tabw->sgpp, stb_dst);
}
} /* end p_tabw_new_clip_cb */
/* -----------------------------
* p_filesel_tabw_close_cb
* -----------------------------
*/
static void
p_filesel_tabw_close_cb ( GtkWidget *widget
, GapStbTabWidgets *tabw)
{
if(tabw->filesel == NULL) return;
gtk_widget_destroy(GTK_WIDGET(tabw->filesel));
tabw->filesel = NULL; /* now filesel_story is closed */
} /* end p_filesel_tabw_close_cb */
/* --------------------------------
* p_filesel_tabw_ok
* --------------------------------
*/
static gboolean
p_filesel_tabw_ok (GtkWidget *widget
,GapStbTabWidgets *tabw)
{
const gchar *filename;
gboolean rc;
rc = FALSE;
if(tabw == NULL) return (rc);
if(tabw->filesel == NULL) return (rc);
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (tabw->filesel));
if(filename)
{
if(tabw->filename_refptr)
{
g_snprintf(tabw->filename_refptr
, tabw->filename_maxlen
, "%s"
, filename
);
gtk_entry_set_text(GTK_ENTRY(tabw->filename_entry), filename);
}
rc = TRUE;
}
gtk_widget_destroy(GTK_WIDGET(tabw->filesel));
tabw->filesel = NULL;
return(rc);
} /* end p_filesel_tabw_ok */
/* --------------------------------
* p_filesel_tabw_load_ok_cb
* --------------------------------
*/
static void
p_filesel_tabw_load_ok_cb (GtkWidget *widget
,GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
sgpp->auto_vthumb_refresh_canceled = FALSE;
if(p_filesel_tabw_ok(widget, tabw))
{
if(sgpp->auto_vthumb)
{
/* pending vthumb prefetch suspends video file access
* at vthumb fetching.
* The access shall be done only once and for all vthumbs after load is done.
* (when p_optimized_prefetch_vthumbs is called)
*/
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_PENDING;
}
/* (re)load storyboard from new filename */
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
p_storyboard_reload(sgpp);
}
else
{
p_cliplist_reload(sgpp);
}
if(sgpp->auto_vthumb)
{
/* video thumbnail creation */
p_optimized_prefetch_vthumbs(sgpp);
}
else
{
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_NOT_ACTIVE;
}
}
} /* end p_filesel_tabw_load_ok_cb */
/* --------------------------------
* p_filesel_tabw_save_ok_cb
* --------------------------------
*/
static void
p_filesel_tabw_save_ok_cb ( GtkWidget *widget
, GapStbTabWidgets *tabw)
{
gboolean l_wr_permission;
if(tabw)
{
if(p_filesel_tabw_ok(widget, tabw))
{
l_wr_permission = gap_arr_overwrite_file_dialog(tabw->filename_refptr);
if(l_wr_permission)
{
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
/* save storyboard filename */
p_menu_stb_save_cb(widget, tabw->sgpp);
}
else
{
/* save cliplist filename */
p_menu_cll_save_cb(widget, tabw->sgpp);
}
}
}
}
} /* end p_filesel_tabw_save_ok_cb */
/* -----------------------------
* p_tabw_load_file_cb
* -----------------------------
*/
static void
p_tabw_load_file_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
GtkWidget *filesel = NULL;
gboolean drop_unsaved_changes = TRUE;
if(tabw->filesel != NULL)
{
gtk_window_present(GTK_WINDOW(tabw->filesel));
return; /* filesel is already open */
}
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
if(sgpp->vthumb_prefetch_in_progress != GAP_VTHUMB_PREFETCH_NOT_ACTIVE)
{
/* cancel */
sgpp->cancel_video_api = TRUE;
sgpp->auto_vthumb_refresh_canceled = TRUE;
}
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
drop_unsaved_changes = p_check_unsaved_changes(tabw->sgpp
, FALSE /* check_cliplist */
, TRUE /* check_storyboard */
);
if(drop_unsaved_changes)
{
p_tabw_destroy_all_popup_dlg(tabw);
/* drop the old storyboard structure */
gap_story_free_storyboard(&sgpp->stb);
p_recreate_tab_widgets( sgpp->stb
,sgpp->stb_widgets
,sgpp->stb_widgets->mount_col
,sgpp->stb_widgets->mount_row
,sgpp
);
}
else
{
return;
}
}
else
{
drop_unsaved_changes = p_check_unsaved_changes(tabw->sgpp
, TRUE /* check_cliplist */
, FALSE /* check_storyboard */
);
if(drop_unsaved_changes)
{
p_tabw_destroy_all_popup_dlg(tabw);
/* drop the old cliplist structure */
gap_story_free_storyboard(&sgpp->cll);
p_recreate_tab_widgets( sgpp->cll
,sgpp->cll_widgets
,sgpp->cll_widgets->mount_col
,sgpp->cll_widgets->mount_row
,sgpp
);
}
else
{
return;
}
}
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
filesel = gtk_file_selection_new ( _("Load Storyboard"));
}
else
{
filesel = gtk_file_selection_new ( _("Load Cliplist"));
}
tabw->filesel = filesel;
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button,
"clicked", (GtkSignalFunc) p_filesel_tabw_load_ok_cb,
tabw);
g_signal_connect (GTK_FILE_SELECTION (filesel)->cancel_button,
"clicked", (GtkSignalFunc) p_filesel_tabw_close_cb,
tabw);
g_signal_connect (filesel, "destroy",
(GtkSignalFunc) p_filesel_tabw_close_cb,
tabw);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel),
tabw->filename_refptr);
gtk_widget_show (filesel);
} /* end p_tabw_load_file_cb */
/* -----------------------------
* p_tabw_file_save_as_cb
* -----------------------------
*/
static void
p_tabw_file_save_as_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GtkWidget *filesel;
if(tabw->filesel != NULL)
{
gtk_window_present(GTK_WINDOW(tabw->filesel));
return; /* filesel is already open */
}
filesel = gtk_file_selection_new ( _("Save Storyboard file"));
tabw->filesel = filesel;
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
g_signal_connect (GTK_FILE_SELECTION (filesel)->ok_button,
"clicked", (GtkSignalFunc) p_filesel_tabw_save_ok_cb,
tabw);
g_signal_connect (GTK_FILE_SELECTION (filesel)->cancel_button,
"clicked", (GtkSignalFunc) p_filesel_tabw_close_cb,
tabw);
g_signal_connect (filesel, "destroy",
(GtkSignalFunc) p_filesel_tabw_close_cb,
tabw);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel),
tabw->filename_refptr);
gtk_widget_show (filesel);
} /* end p_tabw_file_save_as_cb */
/* ---------------------------------
* p_tabw_filename_entry_cb
* ---------------------------------
*/
static void
p_tabw_filename_entry_cb(GtkWidget *widget, GapStbTabWidgets *tabw)
{
if(tabw)
{
if(tabw->filename_refptr)
{
g_snprintf(tabw->filename_refptr
, tabw->filename_maxlen
, "%s"
, gtk_entry_get_text(GTK_ENTRY(widget))
);
}
}
} /* end p_tabw_filename_entry_cb */
/* ------------------------------
* p_tabw_set_rowpage_and_refresh
* ------------------------------
*/
static void
p_tabw_set_rowpage_and_refresh(GapStbTabWidgets *tabw, gint32 rowpage)
{
GapStoryBoard *stb_dst;
tabw->rowpage = rowpage;
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,tabw->sgpp
);
p_render_all_frame_widgets(tabw);
}
} /* end p_tabw_set_rowpage_and_refresh */
/* -----------------------------
* p_rowpage_spinbutton_cb
* -----------------------------
*/
static void
p_rowpage_spinbutton_cb( GtkEditable *editable
, GapStbTabWidgets *tabw)
{
gint32 rowpage;
if(tabw == NULL) { return; }
rowpage = (gint32)GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->value;
if(rowpage != tabw->rowpage)
{
p_tabw_set_rowpage_and_refresh(tabw, rowpage);
}
if(rowpage != (gint32)GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->value)
{
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_vscale_adj), (gdouble)rowpage);
}
} /* end p_rowpage_spinbutton_cb */
/* -----------------------------
* p_update_vscale_page
* -----------------------------
*/
static void
p_update_vscale_page(GapStbTabWidgets *tabw)
{
if(tabw)
{
if(tabw->rowpage_vscale_adj)
{
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)
, (gdouble)tabw->rowpage);
}
}
} /* end p_update_vscale_page */
/* -----------------------------
* p_section_combo_changed_cb
* -----------------------------
*/
static void
p_section_combo_changed_cb( GtkWidget *widget
, GapStbTabWidgets *tabw)
{
gint active_index;
if(tabw == NULL) { return; }
if(tabw->sections_combo == NULL) {return;}
active_index = gtk_combo_box_get_active(GTK_COMBO_BOX (tabw->sections_combo));
if(gap_debug)
{
printf("SECTION COMBO index set to: %d\n", (int)active_index);
}
p_activate_section_by_combo_index(active_index, tabw);
if(tabw->spw != NULL)
{
GapStoryBoard *stb_dst;
stb_dst = p_tabw_get_stb_ptr(tabw);
if (stb_dst)
{
gap_story_spw_switch_to_section(tabw->spw, stb_dst);
}
}
} /* end p_section_combo_changed_cb */
/* -----------------------------
* p_vtrack_spinbutton_cb
* -----------------------------
*/
static void
p_vtrack_spinbutton_cb( GtkEditable *editable
, GapStbTabWidgets *tabw)
{
gint32 vtrack;
if(tabw == NULL) { return; }
vtrack = (gint32)GTK_ADJUSTMENT(tabw->vtrack_spinbutton_adj)->value;
if(vtrack != tabw->vtrack)
{
GapStoryBoard *stb_dst;
tabw->vtrack = vtrack;
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
tabw->rowpage = 1;
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj), 1.0);
gap_story_set_current_vtrack (stb_dst
, stb_dst->active_section
, vtrack);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,tabw->sgpp
);
p_render_all_frame_widgets(tabw);
}
}
} /* end p_vtrack_spinbutton_cb */
/* ------------------------------
* p_vscale_changed_cb
* ------------------------------
*/
static void
p_vscale_changed_cb(GtkObject *adj, GapStbTabWidgets *tabw)
{
gint32 value;
if(tabw == NULL) { return;}
if((adj) && (tabw->rowpage_spinbutton_adj))
{
value = (gint32)GTK_ADJUSTMENT(adj)->value;
if(value != tabw->rowpage)
{
if(gap_debug)
{
printf("p_vscale_changed_cb new rowpage value:%d\n",
(int)value
);
}
/* set value in the rowpage spinbutton
* (this may fire another callback for update of tabw->rowpage;
* but only in case where the tabw->rowpage_spinbutton widget is NOT hidden !)
*/
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj), (gdouble)value);
/* if the tabw->rowpage_spinbutton widget is hidden
* the tabw->rowpage does NOT change to desired value.
* in this case we must trigger the update explicitely.
*/
if (value != tabw->rowpage)
{
p_tabw_set_rowpage_and_refresh(tabw, value);
}
}
}
} /* end p_vscale_changed_cb */
/* ----------------------------------------
* p_cliptarget_togglebutton_toggled_cb
* ----------------------------------------
*/
static void
p_cliptarget_togglebutton_toggled_cb (GtkToggleButton *togglebutton
, GapStoryClipTargetEnum *clip_target_ptr)
{
GapStbMainGlobalParams *sgpp;
if(gap_debug)
{
printf("CB: p_cliptarget_togglebutton_toggled_cb: %d\n", (int)togglebutton);
}
if(clip_target_ptr)
{
if (togglebutton->active)
{
*clip_target_ptr = GAP_STB_CLIPTARGET_STORYBOARD_APPEND;
}
else
{
*clip_target_ptr = GAP_STB_CLIPTARGET_CLIPLIST_APPEND;
}
}
sgpp = (GapStbMainGlobalParams *)g_object_get_data(G_OBJECT(togglebutton), "sgpp");
if(sgpp)
{
return; /* */
}
} /* end p_cliptarget_togglebutton_toggled_cb */
/* ---------------------------------
* gap_story_pw_single_clip_playback
* ---------------------------------
*/
void
gap_story_pw_single_clip_playback(GapStbPropWidget *pw)
{
gchar *imagename;
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
gdouble aspect_ratio;
tabw = (GapStbTabWidgets *)pw->tabw;
sgpp = pw->sgpp;
if(gap_debug)
{
printf("CALLING Player from clip properties\n");
}
if((tabw) && (sgpp))
{
gint32 imagewidth;
gint32 imageheight;
gint32 l_begin_frame;
gint32 l_end_frame;
imagewidth = tabw->thumb_width;
imageheight = tabw->thumb_height;
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
if((sgpp->force_stb_aspect) && (pw->stb_refptr))
{
aspect_ratio = gap_story_adjust_size_respecting_aspect(pw->stb_refptr
, &imagewidth, &imageheight);
}
p_get_begin_and_end_for_single_clip_playback(&l_begin_frame, &l_end_frame, pw->stb_elem_refptr);
imagename = gap_story_get_filename_from_elem(pw->stb_elem_refptr);
p_story_call_player(pw->sgpp
,NULL /* No storyboard pointer */
,imagename
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in imagename based playback mode) */
,l_begin_frame /* play from */
,l_end_frame /* play until */
,TRUE /* play all */
,pw->stb_elem_refptr->seltrack
,pw->stb_elem_refptr->delace
,gap_story_get_preferred_decoder(pw->stb_refptr, pw->stb_elem_refptr)
,pw->stb_elem_refptr->flip_request
,GAP_STB_FLIP_NONE
,tabw->vtrack /* stb_in_track (not relevant here) */
,FALSE /* stb_composite (not relevant here) */
);
g_free(imagename);
}
} /* end gap_story_pw_single_clip_playback */
/* ---------------------------------
* gap_story_pw_composite_playback
* ---------------------------------
*/
void
gap_story_pw_composite_playback(GapStbPropWidget *pw)
{
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
tabw = (GapStbTabWidgets *)pw->tabw;
sgpp = pw->sgpp;
if((tabw) && (pw->sgpp))
{
GapStoryBoard *stb_duptrack;
gint32 imagewidth;
gint32 imageheight;
gdouble aspect_ratio;
gint32 begin_frame;
gint32 end_frame;
stb_duptrack = gap_story_duplicate_vtrack(pw->stb_refptr
, pw->stb_elem_refptr->track);
gap_story_copy_sub_sections(pw->stb_refptr, stb_duptrack);
if(gap_debug)
{
printf("gap_story_pw_composite_playback: START\n");
gap_story_debug_print_list(stb_duptrack);
}
if(sgpp->force_stb_aspect)
{
aspect_ratio = gap_story_get_master_size_respecting_aspect(stb_duptrack
, &imagewidth, &imageheight);
}
else
{
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
gap_story_get_master_pixelsize(stb_duptrack
, &imagewidth
, &imageheight);
}
begin_frame = gap_story_get_framenr_by_story_id(pw->stb_refptr->active_section
, pw->stb_elem_refptr->story_id
, pw->stb_elem_refptr->track);
end_frame = begin_frame + (pw->stb_elem_refptr->nframes -1);
p_story_call_player(pw->sgpp
,stb_duptrack
,NULL /* no imagename */
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in storyboard playback mode) */
,begin_frame
,end_frame
,TRUE /* play_all */
,1 /* seltrack */
,0.0 /* delace */
,gap_story_get_preferred_decoder(stb_duptrack, NULL)
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,-1 /* stb_in_track -1 for composite video */
,TRUE /* stb_composite */
);
}
} /* end gap_story_pw_composite_playback */
/* ---------------------------------
* gap_story_attw_range_playback
* ---------------------------------
* playback on a duplicate storyboard reduced to
* the relevant video track.
* playback is initiated for the specified range.
*/
void
gap_story_attw_range_playback(GapStbAttrWidget *attw, gint32 begin_frame, gint32 end_frame)
{
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
tabw = (GapStbTabWidgets *)attw->tabw;
sgpp = attw->sgpp;
if((tabw) && (attw->sgpp))
{
GapStoryBoard *stb_duptrack;
gint32 imagewidth;
gint32 imageheight;
gdouble aspect_ratio;
stb_duptrack = gap_story_duplicate_vtrack(attw->stb_refptr
, attw->stb_elem_refptr->track);
if(sgpp->force_stb_aspect)
{
aspect_ratio = gap_story_get_master_size_respecting_aspect(stb_duptrack
, &imagewidth
, &imageheight);
}
else
{
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
gap_story_get_master_pixelsize(stb_duptrack
, &imagewidth
, &imageheight);
}
p_story_call_player(attw->sgpp
,stb_duptrack
,NULL /* no imagename */
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in storyboard playback mode) */
,begin_frame
,end_frame
,TRUE /* play_all */
,1 /* seltrack */
,0.0 /* delace */
,gap_story_get_preferred_decoder(stb_duptrack, NULL)
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,-1 /* stb_in_track -1 for composite video */
,TRUE /* stb_composite */
);
}
} /* end gap_story_attw_range_playback */
/* ---------------------------------
* p_single_clip_playback
* ---------------------------------
*/
static void
p_single_clip_playback(GapStbFrameWidget *fw)
{
gchar *imagename;
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
tabw = (GapStbTabWidgets *)fw->tabw;
sgpp = fw->sgpp;
if((tabw) && (sgpp))
{
if(fw->stb_elem_refptr)
{
if(gap_story_elem_is_video(fw->stb_elem_refptr))
{
gint32 imagewidth;
gint32 imageheight;
gdouble aspect_ratio;
if(gap_debug)
{
printf("CALLING Player from single clip\n");
}
imagewidth = tabw->thumb_width;
imageheight = tabw->thumb_height;
aspect_ratio = GAP_PLAYER_DONT_FORCE_ASPECT;
if((sgpp->force_stb_aspect) && (fw->stb_refptr))
{
aspect_ratio = gap_story_adjust_size_respecting_aspect(fw->stb_refptr
, &imagewidth, &imageheight);
}
if((fw->stb_elem_refptr->record_type == GAP_STBREC_VID_SECTION)
|| (fw->stb_elem_refptr->record_type == GAP_STBREC_VID_BLACKSECTION))
{
gint32 stb_in_track;
/* select the secetion clip
* (because section playback is only possible in composite
* mode (using the storyboard render processor)
* an composite playback operates on mapping for selected clips)
*/
p_selection_replace(fw);
stb_in_track = tabw->vtrack;
p_story_call_player(sgpp
,fw->stb_refptr
,NULL /* no imagename */
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in storyboard playback mode) */
,-1 /* play from start */
,-1 /* play until end */
,FALSE /* play_all flag */
,1 /* seltrack */
,0.0 /* delace */
,gap_story_get_preferred_decoder(fw->stb_refptr, NULL)
,GAP_STB_FLIP_NONE
,GAP_STB_FLIP_NONE
,stb_in_track
,TRUE /* stb_composite */
);
}
else
{
gint32 l_begin_frame;
gint32 l_end_frame;
p_get_begin_and_end_for_single_clip_playback(&l_begin_frame, &l_end_frame, fw->stb_elem_refptr);
imagename = gap_story_get_filename_from_elem(fw->stb_elem_refptr);
if(gap_debug)
{
printf("CALLING Player from single clip imagename:%s\n from:%d (%d) to:%d (%d) type:%d\n orig_filename:%s\n\n"
, imagename
,(int)fw->stb_elem_refptr->from_frame
,(int)l_begin_frame
,(int)fw->stb_elem_refptr->to_frame
,(int)l_end_frame
,(int)fw->stb_elem_refptr->record_type
, fw->stb_elem_refptr->orig_filename
);
}
p_story_call_player(fw->sgpp
,NULL /* No storyboard pointer */
,imagename
,imagewidth
,imageheight
,aspect_ratio
,-1 /* image_id (unused in imagename based playback mode) */
,l_begin_frame /* play from */
,l_end_frame /* play until */
,TRUE /* play all */
,fw->stb_elem_refptr->seltrack
,fw->stb_elem_refptr->delace
,gap_story_get_preferred_decoder(fw->stb_refptr, fw->stb_elem_refptr)
,fw->stb_elem_refptr->flip_request
,GAP_STB_FLIP_NONE
,tabw->vtrack /* stb_in_track (not relevant here) */
,FALSE /* stb_composite (not relevant here) */
);
g_free(imagename);
}
}
}
}
} /* end p_single_clip_playback */
/* ---------------------------------
* p_frame_widget_preview_events_cb
* ---------------------------------
* handles events for all frame_widgets (in the dyn_table)
* - Expose of pview drawing_area
* - Doubleclick (goto)
* - Selections (Singleclick, and key-modifiers)
*/
static gboolean
p_frame_widget_preview_events_cb (GtkWidget *widget,
GdkEvent *event,
GapStbFrameWidget *fw)
{
GdkEventExpose *eevent;
GdkEventButton *bevent;
if(fw == NULL)
{
return FALSE;
}
if ((fw->stb_elem_refptr == NULL)
|| (fw->stb_refptr == NULL))
{
/* the frame_widget is not initialized or it is just a dummy, no action needed */
return FALSE;
}
switch (event->type)
{
case GDK_2BUTTON_PRESS:
if(gap_debug) printf("p_frame_widget_preview_events_cb GDK_2BUTTON_PRESS (doubleclick)\n");
if (event->button.state & GDK_CONTROL_MASK)
{
/* additional call external image viewer */
p_call_external_image_viewer(fw);
}
p_single_clip_playback(fw);
gtk_widget_grab_focus (fw->vbox);
return TRUE;
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
gtk_widget_grab_focus (fw->vbox);
if(gap_debug) printf("p_frame_widget_preview_events_cb GDK_BUTTON_PRESS button:%d seq_nr:%d widget:%d da_wgt:%d\n"
, (int)bevent->button
, (int)fw->seq_nr
, (int)widget
, (int)fw->pv_ptr->da_widget
);
if(fw->stb_elem_refptr == NULL)
{
/* perform no actions on dummy entries in the dyn_table */
return TRUE;
}
if (bevent->button == 3)
{
gap_story_fw_abstract_properties_dialog(fw);
return TRUE;
}
/* handle selctions, according to modifier keys */
if (event->button.state & GDK_CONTROL_MASK)
{
if(gap_debug) printf("p_frame_widget_preview_events_cb SELECTION GDK_CONTROL_MASK (ctrl modifier)\n");
p_selection_add(fw);
}
else if (event->button.state & GDK_SHIFT_MASK)
{
if(gap_debug) printf("p_frame_widget_preview_events_cb SELECTION GDK_SHIFT_MASK (shift modifier)\n");
p_selection_extend(fw);
}
else if (event->button.state & GDK_MOD1_MASK)
{
if(gap_debug) printf("p_frame_widget_preview_events_cb SELECTION GDK_MOD1_MASK (alt modifier)\n");
p_selection_add(fw);
}
else
{
if(gap_debug) printf("p_frame_widget_preview_events_cb SELECTION (no modifier)\n");
p_selection_replace(fw);
}
break;
case GDK_EXPOSE:
if(gap_debug) printf("p_frame_widget_preview_events_cb GDK_EXPOSE seq_nr:%d widget:%d da_wgt:%d\n"
, (int)fw->seq_nr
, (int)widget
, (int)fw->pv_ptr->da_widget
);
eevent = (GdkEventExpose *) event;
if(widget == fw->pv_ptr->da_widget)
{
//navi_preview_extents();
//navi_frame_widget_time_label_update(fw);
gap_pview_repaint(fw->pv_ptr);
gdk_flush ();
}
break;
default:
break;
}
return FALSE;
} /* end p_frame_widget_preview_events_cb */
/* --------------------------------------------
* gap_story_dlg_pw_update_mask_references
* --------------------------------------------
* this procedure updates mask name references
* and rendering of layermasks in all open
* clip property dialogs
*/
void
gap_story_dlg_pw_update_mask_references(GapStbTabWidgets *tabw)
{
GapStbPropWidget *pw;
GapStoryBoard *stb;
if(tabw==NULL) { return; }
stb = p_tabw_get_stb_ptr(tabw);
if(stb==NULL) { return; }
for(pw = tabw->pw; pw != NULL; pw = (GapStbPropWidget *)pw->next)
{
if ((pw->is_mask_definition) || (pw->pw_prop_dialog == NULL))
{
continue;
}
if(pw->stb_elem_refptr)
{
if(pw->stb_elem_refptr->mask_name)
{
if(gap_debug)
{
printf("\n\n\n ## gap_story_dlg_pw_update_mask_references\n");
gap_story_debug_print_elem(pw->stb_elem_refptr);
}
gap_story_pw_trigger_refresh_properties(pw);
}
}
}
} /* end gap_story_dlg_pw_update_mask_references */
/* ---------------------------------
* gap_story_dlg_spw_section_refresh
* ---------------------------------
* set specified section as new active section,
* refresh the section combo box.
* (this causes an implicite refresh in case
* where the active_section has changed)
*/
void
gap_story_dlg_spw_section_refresh(GapStbSecpropWidget *spw, GapStorySection *target_section)
{
GapStoryBoard *stb;
GapStbTabWidgets *tabw;
gint target_active_index;
if(gap_debug)
{
printf("gap_story_dlg_spw_refresh START\n");
}
if(spw == NULL) { return; }
if(spw->tabw == NULL) { return; }
tabw = spw->tabw;
stb = spw->stb_refptr;
if(stb == NULL) { return; }
/* rebuild strings in the combo box
* (The section properties dialog my have deleted a section
* or added a new section)
*/
p_set_strings_for_section_combo(spw->tabw);
target_active_index = p_find_combo_index_of_section(stb, target_section);
if (gap_debug)
{
if(target_section)
{
printf("\ngap_story_dlg_spw_section_refresh\n target_section: %d (id:%d)\n"
, (int)target_section
, (int)target_section->section_id
);
if(target_section->section_name)
{
printf(" target_section->section_name: %s\n", target_section->section_name);
}
}
printf(" target_active_index: %d\n", target_active_index);
}
if(tabw->sections_combo != NULL)
{
gtk_combo_box_set_active(GTK_COMBO_BOX (tabw->sections_combo)
, target_active_index);
}
} /* end gap_story_dlg_spw_section_refresh */
/* -----------------------------------
* p_tabw_destroy_properties_dlg
* -----------------------------------
* destroy the open property dialog(s) attached to tabw
* destroy_all == FALSE: destroy only the invalid elents
* (that are no members of the tabw->xxx list)
* destroy_all == TRUE: destroy all elements
*/
static void
p_tabw_destroy_properties_dlg (GapStbTabWidgets *tabw, gboolean destroy_all)
{
GapStbPropWidget *pw;
GapStbPropWidget *pw_prev;
GapStbPropWidget *pw_next;
GapStoryBoard *stb;
if(tabw==NULL) { return; }
stb = p_tabw_get_stb_ptr(tabw);
if(stb==NULL) { return; }
pw_prev = NULL;
for(pw = tabw->pw; pw != NULL; pw = pw_next)
{
pw_next = (GapStbPropWidget *)pw->next;
if(pw->stb_elem_refptr)
{
gboolean destroy_elem;
destroy_elem = TRUE;
if(!destroy_all)
{
GapStoryElem *stb_elem;
GapStorySection *active_section;
active_section = stb->active_section;
if (active_section != NULL)
{
for(stb_elem = active_section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if(stb_elem == pw->stb_elem_refptr)
{
destroy_elem = FALSE;
break;
}
}
}
}
if(destroy_elem)
{
if(pw->stb_elem_bck)
{
gap_story_elem_free(&pw->stb_elem_bck);
}
if(pw->pw_prop_dialog)
{
gtk_widget_destroy(pw->pw_prop_dialog);
}
if(pw_prev)
{
pw_prev->next = pw_next;
}
else
{
tabw->pw = pw_next;
}
g_free(pw);
}
else
{
pw_prev = pw;
}
}
}
} /* end p_tabw_destroy_properties_dlg */
/* -----------------------------------
* p_tabw_destroy_attw_dlg
* -----------------------------------
* destroy the open attribute dialog(s) attached to tabw
* destroy_all == FALSE: destroy only the invalid elents
* (that are no members of the tabw->xxx list)
* destroy_all == TRUE: destroy all elements
*/
static void
p_tabw_destroy_attw_dlg (GapStbTabWidgets *tabw, gboolean destroy_all)
{
GapStbAttrWidget *attw;
GapStbAttrWidget *attw_prev;
GapStbAttrWidget *attw_next;
GapStoryBoard *stb;
if(tabw==NULL) { return; }
stb = p_tabw_get_stb_ptr(tabw);
if(stb==NULL) { return; }
attw_prev = NULL;
for(attw = tabw->attw; attw != NULL; attw = attw_next)
{
attw_next = (GapStbAttrWidget *)attw->next;
if(attw->stb_elem_refptr)
{
gboolean destroy_elem;
destroy_elem = TRUE;
if(!destroy_all)
{
GapStoryElem *stb_elem;
GapStorySection *active_section;
active_section = stb->active_section;
if (active_section != NULL)
{
for(stb_elem = active_section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if(stb_elem == attw->stb_elem_refptr)
{
destroy_elem = FALSE;
break;
}
}
}
}
if(destroy_elem)
{
if(attw->stb_elem_bck)
{
gap_story_elem_free(&attw->stb_elem_bck);
}
if(attw->attw_prop_dialog)
{
gtk_widget_destroy(attw->attw_prop_dialog);
}
if(attw_prev)
{
attw_prev->next = attw_next;
}
else
{
tabw->attw = attw_next;
}
g_free(attw);
}
else
{
attw_prev = attw;
}
}
}
} /* end p_tabw_destroy_attw_dlg */
/* -----------------------------------
* p_tabw_destroy_all_popup_dlg
* -----------------------------------
* destroy all open pop up dialog(s) attached to tabw
*/
static void
p_tabw_destroy_all_popup_dlg (GapStbTabWidgets *tabw)
{
GapStoryBoard *stb;
if(tabw==NULL) { return; }
stb = p_tabw_get_stb_ptr(tabw);
if(stb==NULL) { return; }
p_tabw_destroy_properties_dlg(tabw, TRUE /* destory all */);
p_tabw_destroy_attw_dlg(tabw, TRUE /* destory all */);
if (tabw->spw != NULL)
{
if (tabw->spw->spw_prop_dialog)
{
gtk_widget_destroy(tabw->spw->spw_prop_dialog);
tabw->spw->spw_prop_dialog = NULL;
}
}
} /* end p_tabw_destroy_all_popup_dlg */
/* ---------------------------------
* p_tabw_section_properties_cut_cb
* ---------------------------------
*/
static void
p_tabw_section_properties_cut_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
if(gap_debug) printf("p_tabw_section_properties_cut_cb\n");
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
gap_story_spw_properties_dialog (stb_dst, tabw);
}
} /* end p_tabw_section_properties_cut_cb */
/* ---------------------------------
* p_tabw_undo_cb
* ---------------------------------
*/
static void
p_tabw_undo_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
if(gap_debug) printf("p_tabw_undo_cb\n");
p_tabw_process_undo(tabw);
} /* end p_tabw_undo_cb */
/* ---------------------------------
* p_tabw_redo_cb
* ---------------------------------
*/
static void
p_tabw_redo_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
if(gap_debug) printf("p_tabw_redo_cb\n");
p_tabw_process_redo(tabw);
} /* end p_tabw_redo_cb */
/* ---------------------------------
* p_tabw_edit_cut_cb
* ---------------------------------
*/
static void
p_tabw_edit_cut_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
if(gap_debug) printf("p_tabw_edit_cut_cb\n");
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
if(sgpp->curr_selection)
{
gap_story_free_storyboard(&sgpp->curr_selection);
}
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_EDIT_CUT);
sgpp->curr_selection = gap_story_duplicate_sel_only(stb_dst, tabw->vtrack);
gap_story_remove_sel_elems(stb_dst);
p_tabw_destroy_properties_dlg (tabw, FALSE /* DONT destroy_all*/ );
p_tabw_destroy_attw_dlg (tabw, FALSE /* DONT destroy_all*/ );
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
p_widget_sensibility(sgpp);
gap_stb_undo_group_end(tabw);
}
gap_story_dlg_pw_update_mask_references(tabw);
} /* end p_tabw_edit_cut_cb */
/* ---------------------------------
* p_tabw_edit_copy_cb
* ---------------------------------
* replace the current selection storyboard
* with a copy of all selected element in the
* storyboard referred by tabw.
*/
static void
p_tabw_edit_copy_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
if(gap_debug) printf("p_tabw_edit_copy_cb\n");
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
if(sgpp->curr_selection)
{
gap_story_free_storyboard(&sgpp->curr_selection);
}
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
sgpp->curr_selection = gap_story_duplicate_sel_only(stb_dst, tabw->vtrack);
}
p_widget_sensibility(sgpp);
} /* end p_tabw_edit_copy_cb */
/* ---------------------------------
* p_tabw_edit_paste_cb
* ---------------------------------
* paste after the last selected element
* (or append at end of list if there was no selection)
*/
static void
p_tabw_edit_paste_cb ( GtkWidget *w
, GapStbTabWidgets *tabw)
{
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
gint32 story_id;
if(gap_debug) printf("p_tabw_edit_paste_cb\n");
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_EDIT_PASTE);
story_id = gap_story_find_last_selected_in_track(stb_dst->active_section, tabw->vtrack);
if(story_id < 0)
{
story_id = tabw->story_id_at_prev_paste;
}
else
{
tabw->story_id_at_prev_paste = story_id;
}
p_tabw_edit_paste_at_story_id(sgpp
,stb_dst
,tabw
,story_id
,TRUE /* insert_after == TRUE */
);
gap_stb_undo_group_end(tabw);
}
} /* end p_tabw_edit_paste_cb */
/* ---------------------------------
* p_tabw_edit_paste_at_story_id
* ---------------------------------
*/
static void
p_tabw_edit_paste_at_story_id (GapStbMainGlobalParams *sgpp
, GapStoryBoard *stb_dst
, GapStbTabWidgets *tabw
, gint32 story_id
, gboolean insert_after)
{
GapStoryBoard *stb_sel_dup;
if(gap_debug) printf("p_tabw_edit_paste_cb\n");
if(sgpp == NULL) { return; }
if(sgpp->curr_selection == NULL) { return; }
stb_sel_dup = gap_story_duplicate_full(sgpp->curr_selection);
if(stb_sel_dup)
{
/* clear all selections of the destination list before pasting into it */
gap_story_selection_all_set(stb_dst, FALSE);
gap_story_lists_merge(stb_dst
, stb_sel_dup
, story_id
, insert_after
, tabw->vtrack
);
gap_story_free_storyboard(&stb_sel_dup);
}
// printf("p_tabw_edit_paste_at_story_id: TODO: check if pasted elem is off screen and scroll if TRUE\n");
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
} /* end p_tabw_edit_paste_at_story_id */
/* ---------------------------------
* p_tabw_update_selection
* ---------------------------------
*/
static void
p_tabw_update_selection(GapStbTabWidgets *tabw)
{
GapStbFrameWidget *fw;
GapStbMainGlobalParams *sgpp;
GdkColor *bg_color;
GdkColor *fg_color;
gint ii;
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
for(ii=0; ii < tabw->fw_tab_size; ii++)
{
fw = tabw->fw_tab[ii];
bg_color = &sgpp->shell_window->style->bg[GTK_STATE_NORMAL];
fg_color = &sgpp->shell_window->style->fg[GTK_STATE_NORMAL];
if(fw->stb_elem_refptr)
{
if(fw->stb_elem_refptr->selected)
{
bg_color = &sgpp->shell_window->style->bg[GTK_STATE_SELECTED];
fg_color = &sgpp->shell_window->style->fg[GTK_STATE_SELECTED];
}
}
if(gap_debug) printf("p_tabw_update_selection: GTK_STYLE_SET_BACKGROUND bg_color: %d\n", (int)bg_color);
/* Note: Gtk does not know about selcted items, since selections are handled
* external by gap_navigator_dialog code.
* using SELECTED or NORMAL color from the shell window to paint this private selection
* (must use always the NORMAL state here, because for Gtk the event_box is never selected)
*/
gtk_widget_modify_bg(fw->event_box, GTK_STATE_NORMAL, bg_color);
gtk_widget_modify_fg(fw->key_label, GTK_STATE_NORMAL, fg_color);
gtk_widget_modify_fg(fw->val_label, GTK_STATE_NORMAL, fg_color);
}
} /* end p_tabw_update_selection */
/* ---------------------------------
* p_selection_add
* ---------------------------------
*/
static void
p_selection_add(GapStbFrameWidget *fw)
{
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
tabw = (GapStbTabWidgets *)fw->tabw;
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
/* clear all selected flags in the other list */
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
gap_story_selection_all_set(sgpp->cll, FALSE);
}
else
{
gap_story_selection_all_set(sgpp->stb, FALSE);
}
if(fw->stb_elem_refptr)
{
if(fw->stb_elem_refptr->selected)
{
fw->stb_elem_refptr->selected = FALSE;
}
else
{
fw->stb_elem_refptr->selected = TRUE;
}
}
/* update both list */
p_tabw_update_selection(sgpp->cll_widgets);
p_tabw_update_selection(sgpp->stb_widgets);
p_widget_sensibility(sgpp);
} /* end p_selection_add */
/* ---------------------------------
* p_selection_extend
* ---------------------------------
* select elements in the current track that are
* between the current picked element, the first and the last
* already selected element in the same track in the active section.
* (if no selected elements exist, then select only
* the current picked element)
*/
static void
p_selection_extend(GapStbFrameWidget *fw)
{
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb;
GapStoryElem *stb_elem;
gint32 story_id;
gint32 last_sel_story_id;
gboolean sel_state;
tabw = (GapStbTabWidgets *)fw->tabw;
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
/* clear all selected flags in the other list */
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
gap_story_selection_all_set(sgpp->cll, FALSE);
}
else
{
gap_story_selection_all_set(sgpp->stb, FALSE);
}
stb = p_tabw_get_stb_ptr(tabw);
if(stb == NULL) { return; }
if(fw->stb_elem_refptr == NULL) { return; }
last_sel_story_id = gap_story_find_last_selected_in_track(stb->active_section, tabw->vtrack);
fw->stb_elem_refptr->selected = TRUE; /* always select the clicked element */
story_id = fw->stb_elem_refptr->story_id;
sel_state = FALSE;
if((last_sel_story_id >= 0)
&& (story_id != last_sel_story_id)
&& (stb->active_section != NULL))
{
for(stb_elem = stb->active_section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if((stb_elem->track != tabw->vtrack))
{
/* ignore elements of other tracks */
continue;
}
if((stb_elem->story_id == last_sel_story_id))
{
if(story_id == -1)
{
break;
}
sel_state = TRUE;
last_sel_story_id = -1;
}
if((stb_elem->story_id == story_id))
{
if(last_sel_story_id == -1)
{
break;
}
sel_state = TRUE;
story_id = -1;
}
if(stb_elem->selected)
{
/* set selected beginning at the 1.st already seleected elem
* and all further elements until element with story_id
*/
sel_state = TRUE;
}
stb_elem->selected = sel_state;
}
}
/* update both list */
p_tabw_update_selection(sgpp->cll_widgets);
p_tabw_update_selection(sgpp->stb_widgets);
p_widget_sensibility(sgpp);
} /* end p_selection_extend */
/* ---------------------------------
* p_selection_replace
* ---------------------------------
*/
static void
p_selection_replace(GapStbFrameWidget *fw)
{
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
gboolean old_selection_state;
old_selection_state = FALSE;
if(fw->stb_elem_refptr)
{
old_selection_state = fw->stb_elem_refptr->selected;
}
tabw = (GapStbTabWidgets *)fw->tabw;
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
/* clear all selected flags in both lists */
gap_story_selection_all_set(sgpp->stb, FALSE);
gap_story_selection_all_set(sgpp->cll, FALSE);
if(fw->stb_elem_refptr)
{
fw->stb_elem_refptr->selected = old_selection_state;
}
p_selection_add(fw);
} /* end p_selection_replace */
/* -----------------------------
* p_cut_copy_sensitive
* -----------------------------
*/
static gboolean
p_cut_copy_sensitive (GapStoryBoard *stb)
{
gboolean l_sensitive_cc;
l_sensitive_cc = FALSE;
if(stb)
{
GapStoryElem *stb_elem;
GapStorySection *section;
/* check if there is at least one selected element */
for(section = stb->stb_section; section != NULL; section = section->next)
{
for(stb_elem = section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if(stb_elem->selected)
{
l_sensitive_cc = TRUE;
break;
}
}
}
}
return (l_sensitive_cc);
} /* end p_cut_copy_sensitive */
/* -----------------------------
* p_paste_sensitive
* -----------------------------
*/
static gboolean
p_paste_sensitive (GapStbMainGlobalParams *sgpp
,GapStoryBoard *stb
)
{
if(stb)
{
/* check if there is at least one elem in the paste buffer */
if(sgpp->curr_selection)
{
GapStorySection *curr_selection_main_section;
curr_selection_main_section = gap_story_find_main_section(sgpp->curr_selection);
if(curr_selection_main_section)
{
if(curr_selection_main_section->stb_elem)
{
return(TRUE);
}
}
}
}
return(FALSE);
} /* end p_paste_sensitive */
/* -----------------------------
* p_tabw_sensibility
* -----------------------------
*/
static void
p_tabw_sensibility (GapStbMainGlobalParams *sgpp
,GapStoryBoard *stb
,GapStbTabWidgets *tabw)
{
gboolean l_sensitive;
gboolean l_sensitive_cc;
gboolean l_sensitive_new;
gdouble l_lower_limit;
gdouble l_upper_limit;
if(sgpp == NULL) { return; }
if(tabw == NULL) { return; }
if(sgpp->initialized == FALSE) { return; }
l_sensitive_new = FALSE;
l_sensitive = FALSE;
if(stb)
{
l_sensitive_new = TRUE;
if(stb->active_section)
{
if(stb->active_section->stb_elem)
{
l_sensitive = TRUE;
}
}
}
if(tabw->save_button) gtk_widget_set_sensitive(tabw->save_button, l_sensitive);
if(tabw->play_button) gtk_widget_set_sensitive(tabw->play_button, l_sensitive);
l_sensitive = p_paste_sensitive(sgpp, stb);
l_sensitive_cc = p_cut_copy_sensitive(stb);
if(tabw->edit_paste_button) gtk_widget_set_sensitive(tabw->edit_paste_button, l_sensitive);
if(tabw->edit_cut_button) gtk_widget_set_sensitive(tabw->edit_cut_button, l_sensitive_cc);
if(tabw->edit_copy_button) gtk_widget_set_sensitive(tabw->edit_copy_button, l_sensitive_cc);
if(tabw->new_clip_button) gtk_widget_set_sensitive(tabw->new_clip_button, l_sensitive_new);
/* handle video track sensitivity (not sensitive if stb is not present e.g. is NULL) */
l_sensitive = FALSE;
l_lower_limit = 0;
l_upper_limit = GAP_STB_MAX_VID_TRACKS -1;
if(stb)
{
if (stb->active_section != stb->mask_section)
{
l_sensitive = TRUE;
l_lower_limit = 1;
}
}
if ((tabw->vtrack_spinbutton) && (tabw->vtrack_spinbutton_adj))
{
gtk_widget_set_sensitive(tabw->vtrack_spinbutton, l_sensitive);
GTK_ADJUSTMENT(tabw->vtrack_spinbutton_adj)->lower = l_lower_limit;
GTK_ADJUSTMENT(tabw->vtrack_spinbutton_adj)->upper = l_upper_limit;
}
} /* end p_tabw_sensibility */
/* ---------------------------------------
* p_tabw_set_undo_sensitivity
* ---------------------------------------
*/
static void
p_tabw_set_undo_sensitivity(GapStbTabWidgets *tabw, GtkWidget *menu_item)
{
gboolean l_sensitive;
const char *undo_feature;
char *tooltip_help;
l_sensitive = FALSE;
tooltip_help = NULL;
undo_feature = gap_stb_undo_get_undo_feature(tabw);
if (undo_feature != NULL)
{
tooltip_help = g_strdup_printf(_("UNDO %s"), undo_feature);
l_sensitive = TRUE;
}
else
{
tooltip_help = g_strdup(_("UNDO"));
}
if (menu_item)
{
gtk_widget_set_sensitive(menu_item, l_sensitive);
}
if(tabw->undo_button)
{
gtk_widget_set_sensitive(tabw->undo_button, l_sensitive);
gimp_help_set_help_data (tabw->undo_button, tooltip_help, NULL);
}
g_free(tooltip_help);
} /* end p_tabw_set_undo_sensitivity */
/* ---------------------------------------
* p_tabw_set_redo_sensitivity
* ---------------------------------------
*/
static void
p_tabw_set_redo_sensitivity(GapStbTabWidgets *tabw, GtkWidget *menu_item)
{
gboolean l_sensitive;
const char *redo_feature;
char *tooltip_help;
l_sensitive = FALSE;
tooltip_help = NULL;
redo_feature = gap_stb_undo_get_redo_feature(tabw);
if (redo_feature != NULL)
{
tooltip_help = g_strdup_printf(_("REDO %s"), redo_feature);
l_sensitive = TRUE;
}
else
{
tooltip_help = g_strdup(_("REDO"));
}
if (menu_item)
{
gtk_widget_set_sensitive(menu_item, l_sensitive);
}
if(tabw->redo_button)
{
gtk_widget_set_sensitive(tabw->redo_button, l_sensitive);
gimp_help_set_help_data (tabw->redo_button, tooltip_help, NULL);
}
g_free(tooltip_help);
} /* end p_tabw_set_redo_sensitivity */
/* ---------------------------------------
* p_undo_redo_sensibility
* ---------------------------------------
* handle sensitivity of undo and redo widgets
* for both cliplist and storyboard.
*/
static void
p_undo_redo_sensibility (GapStbMainGlobalParams *sgpp)
{
p_tabw_set_undo_sensitivity(sgpp->cll_widgets, sgpp->menu_item_cll_undo);
p_tabw_set_redo_sensitivity(sgpp->cll_widgets, sgpp->menu_item_cll_redo);
p_tabw_set_undo_sensitivity(sgpp->stb_widgets, sgpp->menu_item_stb_undo);
p_tabw_set_redo_sensitivity(sgpp->stb_widgets, sgpp->menu_item_stb_redo);
} /* end p_undo_redo_sensibility */
/* ----------------------------------------
* gap_story_dlg_tabw_undo_redo_sensitivity
* ----------------------------------------
* handle sensitivity of undo and redo widgets
* for both cliplist and storyboard.
*/
void
gap_story_dlg_tabw_undo_redo_sensitivity(GapStbTabWidgets *tabw)
{
if(tabw != NULL)
{
if(tabw->sgpp != NULL)
{
p_undo_redo_sensibility(tabw->sgpp);
}
}
} /* end gap_story_dlg_tabw_undo_redo_sensitivity */
/* -----------------------------
* p_widget_sensibility
* -----------------------------
*/
static void
p_widget_sensibility (GapStbMainGlobalParams *sgpp)
{
gboolean l_sensitive;
gboolean l_sensitive_add;
gboolean l_sensitive_add_section;
gboolean l_sensitive_encode;
gboolean l_sensitive_att;
if(gap_debug) printf("p_widget_sensibility\n");
if(sgpp == NULL) { return; }
if(sgpp->initialized == FALSE) { return; }
l_sensitive = FALSE;
l_sensitive_add = FALSE;
l_sensitive_encode = FALSE;
if(sgpp->cll)
{
l_sensitive_add = TRUE;
if(sgpp->cll->active_section)
{
if(sgpp->cll->active_section->stb_elem)
{
l_sensitive = TRUE;
if(!sgpp->cll->unsaved_changes)
{
/* encoder call only available when saved */
l_sensitive_encode = TRUE;
}
}
}
}
l_sensitive_att = l_sensitive_add;
if(sgpp->cll_widgets->vtrack == GAP_STB_MASK_TRACK_NUMBER)
{
l_sensitive_att = FALSE;
}
if(sgpp->menu_item_cll_save) gtk_widget_set_sensitive(sgpp->menu_item_cll_save, l_sensitive);
if(sgpp->menu_item_cll_save_as) gtk_widget_set_sensitive(sgpp->menu_item_cll_save_as, l_sensitive);
if(sgpp->menu_item_cll_playback) gtk_widget_set_sensitive(sgpp->menu_item_cll_playback, l_sensitive);
if(sgpp->menu_item_cll_properties) gtk_widget_set_sensitive(sgpp->menu_item_cll_properties, l_sensitive);
if(sgpp->menu_item_cll_audio_otone) gtk_widget_set_sensitive(sgpp->menu_item_cll_audio_otone, l_sensitive);
if(sgpp->menu_item_cll_close) gtk_widget_set_sensitive(sgpp->menu_item_cll_close, l_sensitive);
if(sgpp->menu_item_cll_encode) gtk_widget_set_sensitive(sgpp->menu_item_cll_encode, l_sensitive_encode);
if(sgpp->menu_item_cll_add_clip) gtk_widget_set_sensitive(sgpp->menu_item_cll_add_clip, l_sensitive_add);
if(sgpp->menu_item_cll_att_properties) gtk_widget_set_sensitive(sgpp->menu_item_cll_att_properties, l_sensitive_att);
if(sgpp->menu_item_cll_add_section_clip)
{
l_sensitive_add_section = l_sensitive_add;
if(NULL == (gap_story_find_first_referable_subsection(sgpp->cll)))
{
l_sensitive_add_section = FALSE;
}
gtk_widget_set_sensitive(sgpp->menu_item_cll_add_section_clip, l_sensitive_add_section);
}
if(sgpp->cll_widgets)
{
p_tabw_sensibility(sgpp, sgpp->cll, sgpp->cll_widgets);
}
l_sensitive = FALSE;
l_sensitive_add = FALSE;
l_sensitive_encode = FALSE;
if(sgpp->stb)
{
l_sensitive_add = TRUE;
if(sgpp->stb->active_section)
{
if(sgpp->stb->active_section->stb_elem)
{
l_sensitive = TRUE;
if(!sgpp->stb->unsaved_changes)
{
/* encoder call only available when saved */
l_sensitive_encode = TRUE;
}
}
}
}
l_sensitive_att = l_sensitive_add;
if(sgpp->stb_widgets->vtrack == GAP_STB_MASK_TRACK_NUMBER)
{
l_sensitive_att = FALSE;
}
if(sgpp->menu_item_stb_save) gtk_widget_set_sensitive(sgpp->menu_item_stb_save, l_sensitive);
if(sgpp->menu_item_stb_save_as) gtk_widget_set_sensitive(sgpp->menu_item_stb_save_as, l_sensitive);
if(sgpp->menu_item_stb_playback) gtk_widget_set_sensitive(sgpp->menu_item_stb_playback, l_sensitive);
if(sgpp->menu_item_stb_properties) gtk_widget_set_sensitive(sgpp->menu_item_stb_properties, l_sensitive);
if(sgpp->menu_item_stb_audio_otone) gtk_widget_set_sensitive(sgpp->menu_item_stb_audio_otone, l_sensitive);
if(sgpp->menu_item_stb_close) gtk_widget_set_sensitive(sgpp->menu_item_stb_close, l_sensitive);
if(sgpp->menu_item_stb_encode) gtk_widget_set_sensitive(sgpp->menu_item_stb_encode, l_sensitive_encode);
if(sgpp->menu_item_stb_add_clip) gtk_widget_set_sensitive(sgpp->menu_item_stb_add_clip, l_sensitive_add);
if(sgpp->menu_item_stb_att_properties) gtk_widget_set_sensitive(sgpp->menu_item_stb_att_properties, l_sensitive_att);
if(sgpp->menu_item_stb_add_section_clip)
{
l_sensitive_add_section = l_sensitive_add;
if(NULL == (gap_story_find_first_referable_subsection(sgpp->stb)))
{
l_sensitive_add_section = FALSE;
}
gtk_widget_set_sensitive(sgpp->menu_item_stb_add_section_clip, l_sensitive_add_section);
}
if(sgpp->stb_widgets)
{
p_tabw_sensibility(sgpp, sgpp->stb, sgpp->stb_widgets);
}
p_undo_redo_sensibility(sgpp);
gap_base_check_tooltips(NULL);
} /* end p_widget_sensibility */
/* -----------------------------
* p_close_one_or_both_lists
* -----------------------------
* check for unsaved changes and ask for close permission if there are such changes.
*
* return: FALSE if there were unsaved changes
* AND the user has REFUSED permission to close
* (by pressing the CANCEL Button)
*
* return: TRUE if the close was performed.
*/
static gboolean
p_close_one_or_both_lists(GapStbMainGlobalParams *sgpp
,gboolean check_cliplist
,gboolean check_storyboard
)
{
gboolean l_rc;
l_rc = TRUE;
if(sgpp)
{
l_rc = p_check_unsaved_changes(sgpp
, check_cliplist
, check_storyboard
);
if(l_rc)
{
if(check_cliplist)
{
p_tabw_destroy_all_popup_dlg (sgpp->cll_widgets);
/* drop the old cliplist structure */
gap_story_free_storyboard(&sgpp->cll);
p_recreate_tab_widgets( sgpp->cll
,sgpp->cll_widgets
,sgpp->cll_widgets->mount_col
,sgpp->cll_widgets->mount_row
,sgpp
);
}
if(check_storyboard)
{
p_tabw_destroy_all_popup_dlg (sgpp->stb_widgets);
/* drop the old storyboard structure */
gap_story_free_storyboard(&sgpp->stb);
p_recreate_tab_widgets( sgpp->stb
,sgpp->stb_widgets
,sgpp->stb_widgets->mount_col
,sgpp->stb_widgets->mount_row
,sgpp
);
}
}
}
return(l_rc);
} /* end p_close_one_or_both_lists */
/* -----------------------------------
* gap_story_dlg_update_edit_settings
* -----------------------------------
*/
void
gap_story_dlg_update_edit_settings(GapStoryBoard *stb, GapStbTabWidgets *tabw)
{
if (stb->edit_settings)
{
if (stb->edit_settings->section_name != NULL)
{
g_free(stb->edit_settings->section_name);
stb->edit_settings->section_name = NULL;
}
if (stb->active_section != NULL)
{
if (stb->active_section->section_name != NULL)
{
stb->edit_settings->section_name =
g_strdup(stb->active_section->section_name);
}
}
if(tabw != NULL)
{
stb->edit_settings->track = tabw->vtrack;
stb->edit_settings->page = tabw->rowpage;
stb->layout_cols = tabw->cols;
stb->layout_rows = tabw->rows;
stb->layout_thumbsize = tabw->thumbsize;
}
}
} /* end gap_story_dlg_update_edit_settings */
/* -------------------------------
* p_story_save_with_edit_settings
* -------------------------------
* saves the specified storyboard with
* edit settings from the table widgets (tabw)
* this includes the active section
* the currently edited video track number and scroll position.
*/
static gboolean
p_story_save_with_edit_settings(GapStbTabWidgets *tabw,
GapStoryBoard *stb, const char *filename)
{
gap_stb_undo_stack_set_unsaved_changes(tabw);
gap_story_dlg_update_edit_settings(stb, tabw);
return (gap_story_save(stb, filename));
} /* end p_story_save_with_edit_settings */
/* -----------------------------
* p_menu_win_quit_cb
* -----------------------------
*/
static void
p_menu_win_quit_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_win_quit_cb\n");
if(p_close_one_or_both_lists(sgpp
, TRUE /* check_cliplist */
, TRUE /* check_storyboard */
))
{
story_dlg_response(widget, GTK_RESPONSE_CANCEL, sgpp);
}
} /* end p_menu_win_quit_cb */
/* -----------------------------
* p_menu_win_help_cb
* -----------------------------
*/
static void
p_menu_win_help_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_win_help_cb\n");
if(sgpp)
{
gimp_standard_help_func(GAP_STORYBOARD_EDIT_HELP_ID, sgpp->shell_window);
}
} /* end p_menu_win_help_cb */
/* -----------------------------
* p_menu_win_properties_cb
* -----------------------------
*/
static void
p_menu_win_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
static GapArrArg argv[10];
static char *radio_args[3];
gint l_ii;
gint l_cll_cols_idx;
gint l_cll_rows_idx;
gint l_cll_thumbsize_idx;
gint l_stb_cols_idx;
gint l_stb_rows_idx;
gint l_stb_thumbsize_idx;
gint l_stb_aspect_idx;
gboolean l_rc;
gboolean old_force_stb_aspect;
if(gap_debug) printf("p_menu_win_properties_cb\n");
if(sgpp->win_prop_dlg_open)
{
g_message(_("Global Layout Properties dialog already open"));
return;
}
sgpp->win_prop_dlg_open = TRUE;
old_force_stb_aspect = sgpp->force_stb_aspect;
radio_args[STB_THIDX_LARGE] = _("large");
radio_args[STB_THIDX_MEDIUM] = _("medium");
radio_args[STB_THIDX_SMALL] = _("small");
/* Cliplist layout settings */
l_ii = 0;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL_LEFT);
argv[l_ii].label_txt = _("Cliplist Layout:");
l_ii++;
l_cll_thumbsize_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_RADIO);
argv[l_ii].label_txt = _("Thumbnail Size:");
argv[l_ii].help_txt = _("Thumbnail size in the cliplist");
argv[l_ii].radio_argc = G_N_ELEMENTS(radio_args);
argv[l_ii].radio_argv = radio_args;
argv[l_ii].radio_ret = p_thumbsize_to_index(sgpp->cll_thumbsize);
argv[l_ii].has_default = TRUE;
argv[l_ii].radio_default = STB_THIDX_MEDIUM;
l_ii++; l_cll_cols_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Columns:");
argv[l_ii].help_txt = _("columns in the cliplist");
argv[l_ii].int_min = (gint)CLL_MIN_COL;
argv[l_ii].int_max = (gint)CLL_MAX_COL;
argv[l_ii].int_ret = (gint)sgpp->cll_cols;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)6;
l_ii++; l_cll_rows_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Rows:");
argv[l_ii].help_txt = _("rows in the cliplist");
argv[l_ii].int_min = (gint)CLL_MIN_ROW;
argv[l_ii].int_max = (gint)CLL_MAX_ROW;
argv[l_ii].int_ret = (gint)sgpp->cll_rows;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)6;
/* Storyboard layout settings */
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL_LEFT);
argv[l_ii].label_txt = _("Storyboard Layout:");
l_ii++;
l_stb_thumbsize_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_RADIO);
argv[l_ii].label_txt = _("Thumbnail Size:");
argv[l_ii].help_txt = _("Thumbnail size in the storyboard list");
argv[l_ii].radio_argc = G_N_ELEMENTS(radio_args);
argv[l_ii].radio_argv = radio_args;
argv[l_ii].radio_ret = p_thumbsize_to_index(sgpp->stb_thumbsize);
argv[l_ii].has_default = TRUE;
argv[l_ii].radio_default = STB_THIDX_MEDIUM;
l_ii++; l_stb_cols_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Columns:");
argv[l_ii].help_txt = _("columns in the storyboard list");
argv[l_ii].int_min = (gint)STB_MIN_COL;
argv[l_ii].int_max = (gint)STB_MAX_COL;
argv[l_ii].int_ret = (gint)sgpp->stb_cols;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)15;
l_ii++; l_stb_rows_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Rows:");
argv[l_ii].help_txt = _("rows in the storyboard list");
argv[l_ii].int_min = (gint)STB_MIN_ROW;
argv[l_ii].int_max = (gint)STB_MAX_ROW;
argv[l_ii].int_ret = (gint)sgpp->stb_rows;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)2;
l_ii++; l_stb_aspect_idx = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_TOGGLE);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Force Aspect:");
argv[l_ii].help_txt = _("ON: player shows clips transformed to aspect setting from the Storyboard properties."
"OFF: player shows clips according to their original pixel sizes");
argv[l_ii].int_ret = (gint)sgpp->force_stb_aspect;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)1;
/* the reset to default button */
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_DEFAULT_BUTTON);
argv[l_ii].label_txt = _("Default");
argv[l_ii].help_txt = _("Use the standard built in layout settings");
l_rc = gap_arr_ok_cancel_dialog( _("Global Layout Properties")
, _("Settings")
,G_N_ELEMENTS(argv), argv
);
sgpp->win_prop_dlg_open = FALSE;
if(l_rc == TRUE)
{
gint32 cll_thumbsize;
gint32 stb_thumbsize;
cll_thumbsize = p_index_to_thumbsize(argv[l_cll_thumbsize_idx].radio_ret);
stb_thumbsize = p_index_to_thumbsize(argv[l_stb_thumbsize_idx].radio_ret);
sgpp->force_stb_aspect = (argv[l_stb_aspect_idx].int_ret != 0);
if((sgpp->cll_thumbsize != cll_thumbsize)
|| (sgpp->stb_thumbsize != stb_thumbsize)
|| (sgpp->cll_cols != argv[l_cll_cols_idx].int_ret)
|| (sgpp->stb_cols != argv[l_stb_cols_idx].int_ret)
|| (sgpp->cll_rows != argv[l_cll_rows_idx].int_ret)
|| (sgpp->stb_rows != argv[l_stb_rows_idx].int_ret)
)
{
GapStbTabWidgets *tabw;
GapStoryBoard *stb_dst;
gint min_width;
gint min_height;
/* apply the new layout settings */
sgpp->cll_thumbsize = cll_thumbsize;
sgpp->stb_thumbsize = stb_thumbsize;
sgpp->cll_cols = argv[l_cll_cols_idx].int_ret;
sgpp->stb_cols = argv[l_stb_cols_idx].int_ret;
sgpp->cll_rows = argv[l_cll_rows_idx].int_ret;
sgpp->stb_rows = argv[l_stb_rows_idx].int_ret;
p_set_layout_preset(sgpp);
p_save_gimprc_layout_settings(sgpp);
/* refresh */
if(sgpp->stb_widgets)
{
stb_dst = (GapStoryBoard *)sgpp->stb;
tabw = sgpp->stb_widgets;
if((stb_dst) && (tabw))
{
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(sgpp->stb_widgets);
}
}
if(sgpp->cll_widgets)
{
stb_dst = (GapStoryBoard *)sgpp->cll;
tabw = sgpp->cll_widgets;
if((stb_dst) && (tabw))
{
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(sgpp->cll_widgets);
}
}
/* shrink shell window to minimal size
* note: this does not shrink downto 320 x 200 (is just a dummy size)
* but shrinks as much as possible.
*/
min_width = 320;
min_height = 200;
gtk_window_resize (GTK_WINDOW(sgpp->shell_window), min_width, min_height);
}
else
{
if (old_force_stb_aspect != sgpp->force_stb_aspect)
{
p_save_gimprc_layout_settings(sgpp);
}
}
}
} /* end p_menu_win_properties_cb */
/* -----------------------------
* p_menu_win_vthumbs_toggle_cb
* -----------------------------
*/
static void
p_menu_win_vthumbs_toggle_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug)
{
printf("p_menu_win_vthumbs_toggle_cb\n");
}
if(sgpp)
{
if(sgpp->menu_item_win_vthumbs)
{
#ifndef GAP_ENABLE_VIDEOAPI_SUPPORT
g_message(_("GIMP-GAP is compiled without videoapi support. "
"Therefore thumbnails for videoframes can not be displayed."));
return;
#else
sgpp->auto_vthumb = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(sgpp->menu_item_win_vthumbs));
sgpp->auto_vthumb_refresh_canceled = FALSE;
sgpp->cancel_video_api = FALSE;
if(sgpp->auto_vthumb)
{
p_optimized_prefetch_vthumbs(sgpp);
}
#endif
}
}
} /* end p_menu_win_vthumbs_toggle_cb */
/* ---------------------------------
* p_menu_win_debug_log_to_stdout_cb
* ---------------------------------
* check
*/
static void
p_menu_win_debug_log_to_stdout_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(sgpp)
{
gboolean selection_found;
selection_found = FALSE;
printf("\n\nDEBUG LOG_MENU START\n");
if(TRUE == p_is_debug_feature_item_enabled("dump_vthumb_list"))
{
selection_found = TRUE;
printf("\ndump_vthumb_list enabled\n");
gap_story_vthumb_debug_print_videolist(sgpp->video_list, sgpp->vthumb_list);
}
if(TRUE == p_is_debug_feature_item_enabled("dump_cliplist"))
{
selection_found = TRUE;
printf("\ndump_cliplist enabled\n");
gap_story_debug_print_list(sgpp->cll);
}
if(TRUE == p_is_debug_feature_item_enabled("dump_undostack_cliplist"))
{
selection_found = TRUE;
printf("\ndump_undostack_cliplist enabled\n");
gap_stb_undo_debug_print_stack(sgpp->cll_widgets);
}
if(TRUE == p_is_debug_feature_item_enabled("dump_stroryboard"))
{
selection_found = TRUE;
printf("\ndump_stroryboard enabled\n");
gap_story_debug_print_list(sgpp->stb);
}
if(TRUE == p_is_debug_feature_item_enabled("dump_undostack_stroryboard"))
{
selection_found = TRUE;
printf("\ndump_undostack_stroryboard enabled\n");
gap_stb_undo_debug_print_stack(sgpp->stb_widgets);
}
if (selection_found != TRUE)
{
printf("INFO p_menu_win_debug_log_to_stdout_cb:"
"The file: %s does not exist or does not contain"
"any valid selction what to print for debug purpose.\n"
, GAP_DEBUG_STORYBOARD_CONFIG_FILE);
}
printf("\n\nDEBUG LOG_MENU END\n");
fflush(stdout);
}
} /* end p_menu_win_debug_log_to_stdout_cb */
/* -----------------------------
* p_menu_cll_new_cb
* -----------------------------
*/
static void
p_menu_cll_new_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_new_cb\n");
if(p_close_one_or_both_lists(sgpp
, TRUE /* check_cliplist */
, FALSE /* check_storyboard */
))
{
sgpp->cll = gap_story_new_story_board(NULL);
sgpp->cll->master_type = GAP_STB_MASTER_TYPE_CLIPLIST;
p_tabw_master_prop_dialog(sgpp->cll_widgets, TRUE /* new_flag */);
}
} /* end p_menu_cll_new_cb */
/* -----------------------------
* p_menu_cll_open_cb
* -----------------------------
*/
static void
p_menu_cll_open_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_open_cb\n");
if(sgpp->cll_widgets)
{
p_tabw_load_file_cb (widget, sgpp->cll_widgets);
}
} /* end p_menu_cll_open_cb */
/* -----------------------------
* p_menu_cll_save_cb
* -----------------------------
*/
static void
p_menu_cll_save_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
gboolean l_save_ok;
gint l_errno;
if(gap_debug) printf("p_menu_cll_save_cb\n");
if(sgpp->cll == NULL) { return; }
if(sgpp->cll->errtext != NULL)
{
printf("p_menu_cll_save_cb: ** INTERNAL ERROR save of corrupted storyboard canceled\n");
return;
}
/* replace the internal copy of the name in the GapStoryBoard struct */
if(sgpp->cll->storyboardfile)
{
g_free(sgpp->cll->storyboardfile);
}
sgpp->cll->storyboardfile = g_strdup(sgpp->cliplist_filename);
/* save cliplist as new filename */
l_save_ok = p_story_save_with_edit_settings(sgpp->cll_widgets
, sgpp->cll
, sgpp->cliplist_filename);
l_errno = errno;
if(!l_save_ok)
{
g_message (_("Failed to write cliplistfile\n"
"filename: '%s':\n%s")
, sgpp->cliplist_filename, g_strerror (l_errno));
}
p_tabw_update_frame_label_and_rowpage_limits(sgpp->cll_widgets, sgpp);
} /* end p_menu_cll_save_cb */
/* -----------------------------
* p_menu_cll_save_cb_as
* -----------------------------
*/
static void
p_menu_cll_save_cb_as (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_save_cb_as\n");
p_tabw_file_save_as_cb(widget, sgpp->cll_widgets);
p_tabw_update_frame_label_and_rowpage_limits(sgpp->cll_widgets, sgpp);
} /* end p_menu_cll_save_cb_as */
/* -----------------------------
* p_menu_cll_playback_cb
* -----------------------------
*/
static void
p_menu_cll_playback_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_playback_cb\n");
p_player_cll_mode_cb(widget, NULL, sgpp);
} /* end p_menu_cll_playback_cb */
/* -----------------------------
* p_menu_cll_properties_cb
* -----------------------------
*/
static void
p_menu_cll_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_properties_cb\n");
p_tabw_master_prop_dialog(sgpp->cll_widgets, FALSE);
} /* end p_menu_cll_properties_cb */
/* -----------------------------
* p_menu_cll_add_elem_cb
* -----------------------------
*/
static void
p_menu_cll_add_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_add_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_elem(sgpp->cll_widgets, sgpp, sgpp->cll);
} /* end p_menu_cll_add_elem_cb */
/* -----------------------------
* p_menu_cll_add_section_elem_cb
* -----------------------------
*/
static void
p_menu_cll_add_section_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_add_section_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_section_elem(sgpp->cll_widgets, sgpp, sgpp->cll);
} /* end p_menu_cll_add_section_elem_cb */
/* -----------------------------
* p_menu_cll_add_att_elem_cb
* -----------------------------
*/
static void
p_menu_cll_add_att_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_add_att_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_att_elem(sgpp->cll_widgets, sgpp, sgpp->cll);
} /* end p_menu_cll_add_att_elem_cb */
/* -----------------------------
* p_menu_cll_toggle_edmode
* -----------------------------
*/
static void
p_menu_cll_toggle_edmode (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_close_cb\n");
if(sgpp->cll_widgets)
{
switch(sgpp->cll_widgets->edmode)
{
case GAP_STB_EDMO_SEQUENCE_NUMBER:
sgpp->cll_widgets->edmode = GAP_STB_EDMO_FRAME_NUMBER;
break;
case GAP_STB_EDMO_FRAME_NUMBER:
sgpp->cll_widgets->edmode = GAP_STB_EDMO_TIMECODE;
break;
default:
sgpp->cll_widgets->edmode = GAP_STB_EDMO_SEQUENCE_NUMBER;
break;
}
p_render_all_frame_widgets(sgpp->cll_widgets);
}
} /* end p_menu_cll_toggle_edmode */
/* -----------------------------
* p_menu_cll_audio_otone_cb
* -----------------------------
*/
static void
p_menu_cll_audio_otone_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_audio_otone_cb\n");
p_tabw_gen_otone_dialog(sgpp->cll_widgets);
} /* end p_menu_cll_audio_otone_cb */
/* -----------------------------
* p_menu_cll_encode_cb
* -----------------------------
*/
static void
p_menu_cll_encode_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_encode_cb\n");
p_call_master_encoder(sgpp, sgpp->cll, sgpp->cliplist_filename);
} /* end p_menu_cll_encode_cb */
/* -----------------------------
* p_menu_cll_undo_cb
* -----------------------------
*/
static void
p_menu_cll_undo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_undo_cb\n");
p_tabw_process_undo(sgpp->cll_widgets);
} /* end p_menu_cll_undo_cb */
/* -----------------------------
* p_menu_cll_redo_cb
* -----------------------------
*/
static void
p_menu_cll_redo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_redo_cb\n");
p_tabw_process_redo(sgpp->cll_widgets);
} /* end p_menu_cll_redo_cb */
/* -----------------------------
* p_menu_cll_close_cb
* -----------------------------
*/
static void
p_menu_cll_close_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_cll_close_cb\n");
p_close_one_or_both_lists(sgpp
, TRUE /* check_cliplist */
, FALSE /* check_storyboard */
);
} /* end p_menu_cll_close_cb */
/* -----------------------------
* p_menu_stb_new_cb
* -----------------------------
*/
static void
p_menu_stb_new_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_new_cb\n");
if(p_close_one_or_both_lists(sgpp
, FALSE /* check_cliplist */
, TRUE /* check_storyboard */
))
{
sgpp->stb = gap_story_new_story_board(NULL);
sgpp->stb->master_type = GAP_STB_MASTER_TYPE_STORYBOARD;
p_tabw_master_prop_dialog(sgpp->stb_widgets, TRUE /* new_flag */);
}
} /* end p_menu_stb_new_cb */
/* -----------------------------
* p_menu_stb_open_cb
* -----------------------------
*/
static void
p_menu_stb_open_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_open_cb\n");
if(sgpp->stb_widgets)
{
p_tabw_load_file_cb (widget, sgpp->stb_widgets);
}
} /* end p_menu_stb_open_cb */
/* -----------------------------
* p_menu_stb_save_cb
* -----------------------------
*/
static void
p_menu_stb_save_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
gboolean l_save_ok;
gint l_errno;
if(gap_debug) printf("p_menu_stb_save_cb\n");
if(sgpp->stb == NULL) { return; }
if(sgpp->stb->errtext != NULL)
{
printf("p_menu_stb_save_cb: ** INTERNAL ERROR save of corrupted storyboard canceled\n");
return;
}
/* replace the internal copy of the name in the GapStoryBoard struct */
if(sgpp->stb->storyboardfile)
{
g_free(sgpp->stb->storyboardfile);
}
sgpp->stb->storyboardfile = g_strdup(sgpp->storyboard_filename);
/* save storyboard as new filename */
l_save_ok = p_story_save_with_edit_settings(sgpp->stb_widgets
, sgpp->stb
, sgpp->storyboard_filename
);
l_errno = errno;
if(!l_save_ok)
{
g_message (_("Failed to write storyboardfile\n"
"filename: '%s':\n%s")
, sgpp->storyboard_filename, g_strerror (l_errno));
}
p_tabw_update_frame_label_and_rowpage_limits(sgpp->stb_widgets, sgpp);
} /* end p_menu_stb_save_cb */
/* -----------------------------
* p_menu_stb_save_cb_as
* -----------------------------
*/
static void
p_menu_stb_save_cb_as (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_save_cb_as\n");
p_tabw_file_save_as_cb(widget, sgpp->stb_widgets);
p_tabw_update_frame_label_and_rowpage_limits(sgpp->stb_widgets, sgpp);
} /* end p_menu_stb_save_cb_as */
/* -----------------------------
* p_menu_stb_playback_cb
* -----------------------------
*/
static void
p_menu_stb_playback_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_playback_cb\n");
p_player_stb_mode_cb(widget, NULL, sgpp);
} /* end p_menu_stb_playback_cb */
/* -----------------------------
* p_menu_stb_properties_cb
* -----------------------------
*/
static void
p_menu_stb_properties_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_properties_cb\n");
p_tabw_master_prop_dialog(sgpp->stb_widgets, FALSE);
} /* end p_menu_stb_properties_cb */
/* -----------------------------
* p_menu_stb_add_elem_cb
* -----------------------------
*/
static void
p_menu_stb_add_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_add_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_elem(sgpp->stb_widgets, sgpp, sgpp->stb);
} /* end p_menu_stb_add_elem_cb */
/* -----------------------------
* p_menu_stb_add_section_elem_cb
* -----------------------------
*/
static void
p_menu_stb_add_section_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_add_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_section_elem(sgpp->stb_widgets, sgpp, sgpp->stb);
} /* end p_menu_stb_add_section_elem_cb */
/* -----------------------------
* p_menu_stb_add_att_elem_cb
* -----------------------------
*/
static void
p_menu_stb_add_att_elem_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_add_att_elem_cb\n");
if(sgpp == NULL) { return; }
p_tabw_add_att_elem(sgpp->stb_widgets, sgpp, sgpp->stb);
} /* end p_menu_stb_add_att_elem_cb */
/* -----------------------------
* p_menu_stb_toggle_edmode
* -----------------------------
*/
static void
p_menu_stb_toggle_edmode (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_close_cb\n");
if(sgpp->stb_widgets)
{
switch(sgpp->stb_widgets->edmode)
{
case GAP_STB_EDMO_SEQUENCE_NUMBER:
sgpp->stb_widgets->edmode = GAP_STB_EDMO_FRAME_NUMBER;
break;
case GAP_STB_EDMO_FRAME_NUMBER:
sgpp->stb_widgets->edmode = GAP_STB_EDMO_TIMECODE;
break;
default:
sgpp->stb_widgets->edmode = GAP_STB_EDMO_SEQUENCE_NUMBER;
break;
}
p_render_all_frame_widgets(sgpp->stb_widgets);
}
} /* end p_menu_stb_toggle_edmode */
/* -----------------------------
* p_menu_stb_audio_otone_cb
* -----------------------------
*/
static void
p_menu_stb_audio_otone_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_audio_otone_cb\n");
p_tabw_gen_otone_dialog(sgpp->stb_widgets);
} /* end p_menu_stb_audio_otone_cb */
/* -----------------------------
* p_menu_stb_encode_cb
* -----------------------------
*/
static void
p_menu_stb_encode_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_encode_cb\n");
p_call_master_encoder(sgpp, sgpp->stb, sgpp->storyboard_filename);
} /* end p_menu_stb_encode_cb */
/* -----------------------------
* p_menu_stb_undo_cb
* -----------------------------
*/
static void
p_menu_stb_undo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_undo_cb\n");
p_tabw_process_undo(sgpp->stb_widgets);
} /* end p_menu_stb_undo_cb */
/* -----------------------------
* p_menu_stb_redo_cb
* -----------------------------
*/
static void
p_menu_stb_redo_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_undo_cb\n");
p_tabw_process_redo(sgpp->stb_widgets);
} /* end p_menu_stb_redo_cb */
/* -----------------------------
* p_menu_stb_close_cb
* -----------------------------
*/
static void
p_menu_stb_close_cb (GtkWidget *widget, GapStbMainGlobalParams *sgpp)
{
if(gap_debug) printf("p_menu_stb_close_cb\n");
p_close_one_or_both_lists(sgpp
, FALSE /* check_cliplist */
, TRUE /* check_storyboard */
);
} /* end p_menu_stb_close_cb */
/* -----------------------------
* p_make_menu_bar_item
* -----------------------------
*/
static GtkWidget*
p_make_menu_bar_item(GtkWidget *menu_bar, gchar *label)
{
GtkWidget *menu = gtk_menu_new();
GtkWidget *item = gtk_menu_item_new_with_mnemonic(label);
GtkWidget *tearoff = gtk_tearoff_menu_item_new();
gtk_menu_shell_insert(GTK_MENU_SHELL(menu), tearoff, 0);
gtk_widget_show(tearoff);
gtk_widget_show(item);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), item);
// gtk_menu_set_accel_group(GTK_MENU(menu), accelerator_group);
return menu;
} /* end p_make_menu_bar_item */
/* -----------------------------
* p_make_item_with_image
* -----------------------------
*/
static GtkWidget*
p_make_item_with_image(GtkWidget *parent, const gchar *stock_id,
GapStbMenuCallbackFptr fptr, GapStbMainGlobalParams *sgpp)
{
GtkWidget *item;
item = gtk_image_menu_item_new_from_stock(stock_id
, NULL // accelerator_group
);
gtk_menu_shell_append(GTK_MENU_SHELL(parent), item);
gtk_widget_show(item);
g_signal_connect(item, "activate", G_CALLBACK(fptr), sgpp);
return item;
} /* end p_make_item_with_image */
/* -----------------------------
* p_make_item_with_label
* -----------------------------
*/
static GtkWidget*
p_make_item_with_label(GtkWidget *parent, gchar *label,
GapStbMenuCallbackFptr fptr, GapStbMainGlobalParams *sgpp)
{
GtkWidget *item;
item = gtk_menu_item_new_with_mnemonic(label);
gtk_menu_shell_append(GTK_MENU_SHELL(parent), item);
gtk_widget_show(item);
g_signal_connect(item, "activate", G_CALLBACK(fptr), sgpp);
return item;
} /* end p_make_item_with_label */
/* -----------------------------
* p_make_check_item_with_label
* -----------------------------
*/
static GtkWidget*
p_make_check_item_with_label(GtkWidget *parent, gchar *label
, GapStbMenuCallbackFptr fptr
, GapStbMainGlobalParams *sgpp
, gboolean initial_value
)
{
GtkWidget *item;
item = gtk_check_menu_item_new_with_mnemonic(label);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), initial_value);
gtk_menu_shell_append(GTK_MENU_SHELL(parent), item);
gtk_widget_show(item);
g_signal_connect(item, "activate", G_CALLBACK(fptr), sgpp);
return item;
} /* end p_make_check_item_with_label */
/* -----------------------------
* p_make_menu_global
* -----------------------------
*/
static void
p_make_menu_global(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar)
{
GtkWidget *file_menu = p_make_menu_bar_item(menu_bar, _("Global"));
p_make_item_with_label(file_menu, _("Properties")
, p_menu_win_properties_cb
, sgpp
);
sgpp->menu_item_win_vthumbs =
p_make_check_item_with_label(file_menu, _("Videothumbnails")
, p_menu_win_vthumbs_toggle_cb
, sgpp
, sgpp->auto_vthumb
);
if(p_is_debug_menu_enabled() == TRUE)
{
p_make_item_with_label(file_menu, _("DEBUG: log to stdout")
, p_menu_win_debug_log_to_stdout_cb
, sgpp
);
}
p_make_item_with_image(file_menu, GTK_STOCK_QUIT
, p_menu_win_quit_cb
, sgpp
);
} /* end p_make_menu_global */
/* -----------------------------
* p_make_menu_help
* -----------------------------
*/
static void
p_make_menu_help(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar)
{
GtkWidget *file_menu = p_make_menu_bar_item(menu_bar, _("Help"));
p_make_item_with_image(file_menu, GTK_STOCK_HELP
, p_menu_win_help_cb
, sgpp
);
} /* end p_make_menu_help */
/* -----------------------------
* p_make_menu_cliplist
* -----------------------------
*/
static void
p_make_menu_cliplist(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar)
{
GtkWidget *file_menu = p_make_menu_bar_item(menu_bar, _("Cliplist"));
p_make_item_with_image(file_menu, GTK_STOCK_NEW
, p_menu_cll_new_cb
, sgpp
);
p_make_item_with_image(file_menu, GTK_STOCK_OPEN
, p_menu_cll_open_cb
, sgpp
);
sgpp->menu_item_cll_save =
p_make_item_with_image(file_menu, GTK_STOCK_SAVE
, p_menu_cll_save_cb
, sgpp
);
sgpp->menu_item_cll_save_as =
p_make_item_with_image(file_menu, GTK_STOCK_SAVE_AS
, p_menu_cll_save_cb_as
, sgpp
);
sgpp->menu_item_cll_playback =
p_make_item_with_label(file_menu, _("Playback")
, p_menu_cll_playback_cb
, sgpp
);
sgpp->menu_item_cll_properties =
p_make_item_with_label(file_menu, _("Properties")
, p_menu_cll_properties_cb
, sgpp
);
sgpp->menu_item_cll_add_clip =
p_make_item_with_label(file_menu, _("Create Clip")
, p_menu_cll_add_elem_cb
, sgpp
);
sgpp->menu_item_cll_add_section_clip =
p_make_item_with_label(file_menu, _("Create Section Clip")
, p_menu_cll_add_section_elem_cb
, sgpp
);
sgpp->menu_item_cll_att_properties =
p_make_item_with_label(file_menu, _("Create Transition")
, p_menu_cll_add_att_elem_cb
, sgpp
);
p_make_item_with_label(file_menu, _("Toggle Unit")
, p_menu_cll_toggle_edmode
, sgpp
);
sgpp->menu_item_cll_audio_otone =
p_make_item_with_label(file_menu, _("Add Original Audio Track")
, p_menu_cll_audio_otone_cb
, sgpp
);
sgpp->menu_item_cll_encode =
p_make_item_with_label(file_menu, _("Encode")
, p_menu_cll_encode_cb
, sgpp
);
sgpp->menu_item_cll_undo =
p_make_item_with_image(file_menu, GTK_STOCK_UNDO
, p_menu_cll_undo_cb
, sgpp
);
sgpp->menu_item_cll_redo =
p_make_item_with_image(file_menu, GTK_STOCK_REDO
, p_menu_cll_redo_cb
, sgpp
);
sgpp->menu_item_cll_close =
p_make_item_with_image(file_menu, GTK_STOCK_CLOSE
, p_menu_cll_close_cb
, sgpp
);
} /* end p_make_menu_cliplist */
/* -----------------------------
* p_make_menu_storyboard
* -----------------------------
*/
static void
p_make_menu_storyboard(GapStbMainGlobalParams *sgpp, GtkWidget *menu_bar)
{
GtkWidget *file_menu = p_make_menu_bar_item(menu_bar, _("_Storyboard"));
p_make_item_with_image(file_menu, GTK_STOCK_NEW
, p_menu_stb_new_cb
, sgpp
);
p_make_item_with_image(file_menu, GTK_STOCK_OPEN
, p_menu_stb_open_cb
, sgpp
);
sgpp->menu_item_stb_save =
p_make_item_with_image(file_menu, GTK_STOCK_SAVE
, p_menu_stb_save_cb
, sgpp
);
sgpp->menu_item_stb_save_as =
p_make_item_with_image(file_menu, GTK_STOCK_SAVE_AS
, p_menu_stb_save_cb_as
, sgpp
);
sgpp->menu_item_stb_playback =
p_make_item_with_label(file_menu, _("Playback")
, p_menu_stb_playback_cb
, sgpp
);
sgpp->menu_item_stb_properties =
p_make_item_with_label(file_menu, _("Properties")
, p_menu_stb_properties_cb
, sgpp
);
sgpp->menu_item_stb_add_clip =
p_make_item_with_label(file_menu, _("Create Clip")
, p_menu_stb_add_elem_cb
, sgpp
);
sgpp->menu_item_stb_add_section_clip =
p_make_item_with_label(file_menu, _("Create Section Clip")
, p_menu_stb_add_section_elem_cb
, sgpp
);
sgpp->menu_item_stb_att_properties =
p_make_item_with_label(file_menu, _("Create Transition")
, p_menu_stb_add_att_elem_cb
, sgpp
);
p_make_item_with_label(file_menu, _("Toggle Unit")
, p_menu_stb_toggle_edmode
, sgpp
);
sgpp->menu_item_stb_audio_otone =
p_make_item_with_label(file_menu, _("Add Original Audio Track")
, p_menu_stb_audio_otone_cb
, sgpp
);
sgpp->menu_item_stb_encode =
p_make_item_with_label(file_menu, _("Encode")
, p_menu_stb_encode_cb
, sgpp
);
sgpp->menu_item_stb_undo =
p_make_item_with_image(file_menu, GTK_STOCK_UNDO
, p_menu_stb_undo_cb
, sgpp
);
sgpp->menu_item_stb_redo =
p_make_item_with_image(file_menu, GTK_STOCK_REDO
, p_menu_stb_redo_cb
, sgpp
);
sgpp->menu_item_stb_close =
p_make_item_with_image(file_menu, GTK_STOCK_CLOSE
, p_menu_stb_close_cb
, sgpp
);
} /* end p_make_menu_storyboard */
/* -----------------------------
* p_check_unsaved_changes
* -----------------------------
*/
static gboolean
p_check_unsaved_changes (GapStbMainGlobalParams *sgpp
, gboolean check_cliplist
, gboolean check_storyboard
)
{
static GapArrButtonArg l_argv[2];
static GapArrArg argv[2];
if(sgpp)
{
gint l_rc;
gchar *l_cll_msg;
gchar *l_stb_msg;
gint l_ii;
l_cll_msg = NULL;
l_stb_msg = NULL;
l_ii = 0;
if((check_cliplist) && (sgpp->cll))
{
if(sgpp->cll->unsaved_changes)
{
l_cll_msg = g_strdup_printf(_("Unsaved cliplist changes '%s'")
, sgpp->cliplist_filename);
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL);
argv[l_ii].label_txt = l_cll_msg;
l_ii++;
}
}
if((check_storyboard) && (sgpp->stb))
{
if(sgpp->stb->unsaved_changes)
{
l_stb_msg = g_strdup_printf(_("Unsaved storyboard changes '%s'")
, sgpp->storyboard_filename);
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL);
argv[l_ii].label_txt = l_stb_msg;
l_ii++;
}
}
if(l_ii > 0)
{
if((check_storyboard) && (check_cliplist))
{
l_argv[1].but_txt = _("Quit Storyboard");
}
else
{
l_argv[1].but_txt = _("Continue");
}
l_argv[1].but_val = 0;
l_argv[0].but_txt = GTK_STOCK_CANCEL;
l_argv[0].but_val = -1;
l_rc = gap_arr_std_dialog ( _("Storyboard unsaved changes"),
_("Storyboard unsaved changes"),
l_ii, argv,
2, l_argv, -1);
if(l_cll_msg) { g_free(l_cll_msg); }
if(l_stb_msg) { g_free(l_stb_msg); }
if(l_rc < 0)
{
return (FALSE); /* CANCEL was pressed, dont overwrite */
}
}
}
return (TRUE);
} /* end p_check_unsaved_changes */
/* -------------------------------------------
* p_tabw_update_frame_label_and_rowpage_limits
* --------------------------------------------
* display frame label,
* if valid storyboard available add the filename
* and show the string "(modified)" if there are unsaved changes
*
* then calculate max_rowpage
* and set upper limit for the tabw->rowpage_spinbutton_adj widget
*/
static void
p_tabw_update_frame_label_and_rowpage_limits (GapStbTabWidgets *tabw, GapStbMainGlobalParams *sgpp)
{
gint32 l_max_rowpage;
GapStoryBoard *stb_dst;
if(tabw == NULL) { return; }
if(sgpp == NULL) { return; }
if((tabw->frame_with_name)
&& (tabw->filename_refptr))
{
gchar *l_hdr_txt = NULL;
gchar *l_fil_txt = NULL;
gchar *l_mod_txt = NULL;
gchar *l_txt = NULL;
gint l_max_chars;
l_fil_txt = g_strdup(" ");
l_mod_txt = g_strdup(" ");
l_max_chars = 70;
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
l_hdr_txt = g_strdup(_("Storyboard:"));
/* the max_chars for the cliplist header text
* is just a guess how much characters
* would fit when the default font is used.
* correct calculation would be more complex.
*/
l_max_chars = 160;
if(sgpp->stb)
{
g_free(l_fil_txt);
l_fil_txt = g_strdup(tabw->filename_refptr);
if(sgpp->stb->unsaved_changes)
{
g_free(l_mod_txt);
l_mod_txt = g_strdup(_("(modified)"));
}
}
}
else
{
l_hdr_txt = g_strdup(_("Cliplist:"));
/* the max_chars for the cliplist is just a guess
* dependent on thumbnail size and columns in the layout.
* the layout space is limited here
* because the extra space is requred for the player window.
* correct calculation would be complex
* and would have to respect current fontsize, NLS settings,
* and something more ...
*/
l_max_chars = 65;
if(sgpp->cll_cols <= 4)
{
l_max_chars = 55;
}
if(sgpp->cll)
{
g_free(l_fil_txt);
l_fil_txt = g_strdup(tabw->filename_refptr);
if(sgpp->cll->unsaved_changes)
{
g_free(l_mod_txt);
l_mod_txt = g_strdup(_("(modified)"));
}
}
}
l_txt = gap_base_shorten_filename(l_hdr_txt /* prefix */
,l_fil_txt /* filenamepart */
,l_mod_txt /* suffix */
,l_max_chars
);
gtk_frame_set_label (GTK_FRAME (tabw->frame_with_name), l_txt);
g_free(l_hdr_txt);
g_free(l_fil_txt);
g_free(l_mod_txt);
g_free(l_txt);
}
l_max_rowpage = 1;
stb_dst = p_tabw_get_stb_ptr(tabw);
if(stb_dst)
{
gint32 l_act_elems = 0;
l_act_elems = gap_story_count_active_elements(stb_dst, tabw->vtrack );
l_max_rowpage = p_get_max_rowpage(l_act_elems, tabw->cols, tabw->rows);
}
if(tabw->rowpage_spinbutton_adj)
{
GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->lower = 1;
GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->upper = l_max_rowpage;
if(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->value > l_max_rowpage)
{
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj), (gdouble)l_max_rowpage);
}
}
if(tabw->rowpage_vscale_adj)
{
gdouble upper_limit;
gdouble lower_limit;
gdouble page_increment;
gdouble page_size;
page_size = (gdouble)tabw->rows;
page_increment = (gdouble)(page_size / 2);
lower_limit = 1.0;
upper_limit = l_max_rowpage + page_size;
if(gap_debug)
{
printf("\n######rowpage_vscale_adj : %d tabw->rows:%d\n", (int)l_max_rowpage ,(int)tabw->rows);
printf("lower_limit %f\n", (float)lower_limit );
printf("upper_limit %f\n", (float)upper_limit );
printf("page_size %f\n", (float) page_size);
printf("page_increment %f\n", (float)page_increment );
printf("value %f\n", (float)GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->value );
}
GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->lower = lower_limit;
GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->upper = upper_limit;
GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->page_increment = page_increment;
GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->page_size = page_size;
if(GTK_ADJUSTMENT(tabw->rowpage_vscale_adj)->value > l_max_rowpage)
{
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_vscale_adj), (gdouble)l_max_rowpage);
}
if(lower_limit+page_size >= upper_limit)
{
gtk_widget_hide(tabw->rowpage_vscale);
}
else
{
gtk_widget_show(tabw->rowpage_vscale);
gtk_widget_queue_draw(tabw->rowpage_vscale);
}
}
if(tabw->total_rows_label)
{
char max_rowpage_txt[40];
g_snprintf(max_rowpage_txt, sizeof(max_rowpage_txt), "%d", (int)l_max_rowpage);
gtk_label_set_text(GTK_LABEL(tabw->total_rows_label), max_rowpage_txt);
}
p_widget_sensibility(sgpp);
} /* end p_tabw_update_frame_label_and_rowpage_limits */
/* ------------------------------
* gap_story_dlg_fetch_videoframe
* ------------------------------
* return thdata pointer or NULL
*/
guchar *
gap_story_dlg_fetch_videoframe(GapStbMainGlobalParams *sgpp
, const char *gva_videofile
, gint32 framenumber
, gint32 seltrack
, const char *preferred_decoder
, gdouble delace
, gint32 *th_bpp
, gint32 *th_width
, gint32 *th_height
, gboolean do_scale
)
{
guchar *th_data;
th_data = NULL;
#ifdef GAP_ENABLE_VIDEOAPI_SUPPORT
if(sgpp->gva_lock)
{
return(NULL);
}
sgpp->gva_lock = TRUE;
if((sgpp->gva_videofile) && (sgpp->gvahand))
{
if((strcmp(sgpp->gva_videofile, gva_videofile) != 0)
||(seltrack != (sgpp->gvahand->vid_track+1)))
{
//printf(" VIDFETCH (--) CALL gap_story_vthumb_close_videofile\n");
//printf(" VIDFETCH (--) sgpp->gva_videofile: %s\n", sgpp->gva_videofile);
//printf(" VIDFETCH (--) sgpp->gvahand->vid_track: %d\n", (int)sgpp->gvahand->vid_track);
//printf(" VIDFETCH (--) gva_videofile: %s\n", gva_videofile);
//printf(" VIDFETCH (--) seltrack: %d\n", (int)seltrack);
gap_story_vthumb_close_videofile(sgpp);
}
}
//printf(" VIDFETCH (-0) sgpp->gvahand: %d framenumber:%06d\n", (int)sgpp->gvahand, (int)framenumber);
if(sgpp->gvahand == NULL)
{
gap_story_vthumb_open_videofile(sgpp, gva_videofile, seltrack, preferred_decoder);
}
if(sgpp->gvahand)
{
gint32 l_deinterlace;
gdouble l_threshold;
if(sgpp->progress_bar_sub)
{
t_GVA_DecoderElem *dec_elem;
char *videoseek_msg;
videoseek_msg = NULL;
dec_elem = (t_GVA_DecoderElem *)sgpp->gvahand->dec_elem;
if(dec_elem->decoder_name)
{
videoseek_msg = g_strdup_printf(_("Videoseek (decoder: %s)"), dec_elem->decoder_name);
}
else
{
videoseek_msg = g_strdup_printf(_("Videoseek"));
}
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_sub), videoseek_msg);
g_free(videoseek_msg);
}
if(do_scale == TRUE)
{
gint32 vthumb_size;
vthumb_size = 256;
if(sgpp->gvahand->width > sgpp->gvahand->height)
{
*th_width = vthumb_size;
*th_height = (sgpp->gvahand->height * vthumb_size) / sgpp->gvahand->width;
}
else
{
*th_height = vthumb_size;
*th_width = (sgpp->gvahand->width * vthumb_size) / sgpp->gvahand->height;
}
}
else
{
*th_width = sgpp->gvahand->width;
*th_height = sgpp->gvahand->height;
}
*th_bpp = sgpp->gvahand->frame_bpp;
/* split delace value: integer part is deinterlace mode, rest is threshold */
l_deinterlace = delace;
l_threshold = delace - (gdouble)l_deinterlace;
sgpp->cancel_video_api = FALSE;
//printf(" VIDFETCH (-6) current_seek_nr:%d current_frame_nr:%d\n", (int)sgpp->gvahand->current_seek_nr ,(int)sgpp->gvahand->current_frame_nr );
/* fetch the wanted framenr */
th_data = GVA_fetch_frame_to_buffer(sgpp->gvahand
, do_scale
, framenumber
, l_deinterlace
, l_threshold
, th_bpp
, th_width
, th_height
);
//printf(" VIDFETCH (-7) current_seek_nr:%d current_frame_nr:%d\n", (int)sgpp->gvahand->current_seek_nr ,(int)sgpp->gvahand->current_frame_nr );
if(sgpp->progress_bar_sub)
{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_sub), " ");
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_sub), 0.0);
}
}
if(th_data)
{
/* throw away frame data because the fetch was cancelled
* (an empty display is better than trash or the wrong frame)
*/
if(sgpp->cancel_video_api)
{
g_free(th_data);
th_data = NULL;
}
}
sgpp->gva_lock = FALSE;
#endif
return (th_data);
} /* end gap_story_dlg_fetch_videoframe */
/* -----------------------------
* p_prefetch_vthumbs
* -----------------------------
* this procedure does a prefetch of all
* videoframes that are start frame in a storyboard_element
* with type GAP_STBREC_VID_MOVIE
* the fetch causes creation of all the vthumbs
*/
static void
p_prefetch_vthumbs (GapStbMainGlobalParams *sgpp, GapStoryBoard *stb)
{
GapStorySection *section;
GapStoryElem *stb_elem;
GapVThumbElem *vthumb;
gint32 l_total;
gint32 l_count;
if(stb == NULL)
{
return;
}
if(gap_debug)
{
printf("p_prefetch_vthumbs : stb: %d\n"
,(int)stb
);
}
l_total = 0;
for(section = stb->stb_section; section != NULL; section = section->next)
{
for(stb_elem = section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if(stb_elem->record_type == GAP_STBREC_VID_MOVIE)
{
l_total++;
}
}
}
l_count = 0;
for(section = stb->stb_section; section != NULL; section = section->next)
{
for(stb_elem = section->stb_elem; stb_elem != NULL; stb_elem = stb_elem->next)
{
if(stb_elem->record_type == GAP_STBREC_VID_MOVIE)
{
gchar *msg;
if((sgpp->cancel_video_api) || (sgpp->auto_vthumb_refresh_canceled == TRUE) || (sgpp->auto_vthumb != TRUE))
{
if(sgpp->progress_bar_master)
{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_master),
_("videothumbnail cancelled"));
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_master), 0);
}
if(gap_debug)
{
printf("p_prefetch_vthumbs : (1) videothumbnail cancelled: cancel_video_api: %d auto_vthumb_refresh_canceled:%d auto_vthumb:%d\n"
,(int)sgpp->cancel_video_api
,(int)sgpp->auto_vthumb_refresh_canceled
,(int)sgpp->auto_vthumb
);
}
return;
}
l_count++;
vthumb = gap_story_vthumb_elem_fetch(sgpp
,stb
,stb_elem
,stb_elem->from_frame
,stb_elem->seltrack
,gap_story_get_preferred_decoder(stb, stb_elem)
);
if(sgpp->progress_bar_master)
{
msg = g_strdup_printf(_("Fetching videothumbnail for clip: %d (out of %d)")
,(int)l_count
,(int)l_total
);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_master), msg);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_master)
,(gdouble)l_count / (gdouble)l_total
);
gap_story_vthumb_g_main_context_iteration(sgpp);
/* processing of the g_main_context_iteration may have changed objects
* in the storyboard or cliplist
*/
if (sgpp->vthumb_prefetch_in_progress != GAP_VTHUMB_PREFETCH_IN_PROGRESS)
{
if(gap_debug)
{
printf("p_prefetch_vthumbs: prefetch PROGRESS interrupt occured\n");
}
/* stop current prefetch of (possibly outdated) storyboard
*/
p_reset_progress_bars(sgpp);
return;
}
}
}
}
}
if(gap_debug)
{
printf("p_prefetch_vthumbs : Loop done\n");
}
p_reset_progress_bars(sgpp);
} /* end p_prefetch_vthumbs */
/* ---------------------------------
* p_optimized_prefetch_vthumbs_worker
* ---------------------------------
* this procedure does a prefetch of all
* videoframes that are start frame in a storyboard_element
* with type GAP_STBREC_VID_MOVIE
* the fetch causes creation of all the vthumbs for both storyboard and cliplist
*/
static void
p_optimized_prefetch_vthumbs_worker (GapStbMainGlobalParams *sgpp)
{
GapStoryBoard *stb;
stb = NULL;
if((sgpp->stb_widgets) && (sgpp->stb))
{
stb = gap_story_board_duplicate_distinct_sorted(stb, sgpp->stb);
}
if((sgpp->cll_widgets) && (sgpp->cll))
{
stb = gap_story_board_duplicate_distinct_sorted(stb, sgpp->cll);
}
if(stb == NULL)
{
return;
}
/* gap_story_save(stb, "zz_STB_distinct_sort.txt"); */ /* for test only */
/* operate on a copy that includes elements of both (stb + cll) storyboards
* this merged copy has groups of same resources sorted by start frame numbers
* (to mimimize both video open operations and frame seek times)
*/
p_prefetch_vthumbs(sgpp, stb);
gap_story_free_storyboard(&stb);
} /* end p_optimized_prefetch_vthumbs_worker */
/* ---------------------------------
* p_optimized_prefetch_both_vthumbs
* ---------------------------------
* this procedure does a prefetch of all
* videoframes that are start frame in a storyboard_element
* with type GAP_STBREC_VID_MOVIE
* the fetch causes creation of all the vthumbs for both storyboard and cliplist
*/
static void
p_optimized_prefetch_vthumbs (GapStbMainGlobalParams *sgpp)
{
static gboolean recreateRequired = FALSE;
static gboolean refreshRequired = FALSE;
if(gap_debug)
{
printf("p_optimized_prefetch_vthumbs\n");
}
if(sgpp)
{
sgpp->auto_vthumb_refresh_canceled = FALSE;
sgpp->cancel_video_api = FALSE;
if(sgpp->auto_vthumb)
{
gboolean option_restart;
refreshRequired = TRUE;
recreateRequired = FALSE;
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_IN_PROGRESS;
while(TRUE)
{
p_optimized_prefetch_vthumbs_worker(sgpp);
/*
* - one option is to render default icon, and restart the prefetch
* via GAP_VTHUMB_PREFETCH_RESTART_REQUEST
* (because the storyboard may have changed since prefetch was started
* note that prefetch will be very quick for all clips where vthumb is already present
* from the cancelled previous prefetch cycle)
* (currently this attempt leads to crashes that i could not locate yet)
* - the other (currently implemented) option is to cancel prefetch and implicite turn off auto_vthumb mode
*/
option_restart = TRUE;
if(gap_debug)
{
printf("p_optimized_prefetch_vthumbs vthumb_prefetch_in_progress"
" (0 NOTACTIVE, 1 PROGRESS, 2 RESTART, 3 CANCEL) value:%d\n"
,(int)sgpp->vthumb_prefetch_in_progress
);
}
if(sgpp->vthumb_prefetch_in_progress == GAP_VTHUMB_PREFETCH_RESTART_REQUEST)
{
recreateRequired = TRUE;
// if(option_restart == FALSE)
// {
// if(sgpp->progress_bar_master)
// {
// gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_master),
// _("videothumbnail cancelled"));
// gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_master), 0);
// }
// p_cancel_button_cb(NULL, sgpp);
// sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_NOT_ACTIVE;
// }
// else
{
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_IN_PROGRESS;
printf("performing GAP_VTHUMB_PREFETCH_RESTART_REQUEST\n");
}
}
else
{
/* regular end (all vthumbs prefeteched OK) */
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_NOT_ACTIVE;
break;
}
}
}
if(refreshRequired == TRUE)
{
if(sgpp->stb_widgets)
{
if(recreateRequired)
{
gap_story_dlg_recreate_tab_widgets(sgpp->stb_widgets, sgpp);
}
else
{
p_render_all_frame_widgets(sgpp->stb_widgets);
}
}
if(sgpp->cll_widgets)
{
if(recreateRequired)
{
gap_story_dlg_recreate_tab_widgets(sgpp->cll_widgets, sgpp);
}
else
{
p_render_all_frame_widgets(sgpp->cll_widgets);
}
}
refreshRequired = FALSE;
recreateRequired = FALSE;
}
}
} /* end p_optimized_prefetch_vthumbs */
/* -----------------------------------
* p_tabw_set_focus_to_first_fw
* -----------------------------------
*/
static void
p_tabw_set_focus_to_first_fw(GapStbTabWidgets *tabw)
{
GapStbFrameWidget *fw;
if(tabw == NULL) { return; }
if(tabw->fw_tab_size > 0)
{
fw = tabw->fw_tab[0];
gtk_widget_grab_focus (fw->vbox);
}
} /* end p_tabw_set_focus_to_first_fw */
/* -----------------------------------
* p_tabw_key_press_event_cb
* -----------------------------------
* handling of ctrl-c, ctrl-x, ctrl-v, ctrl-z keys
* pressed when focus is somewhere in the tabw frame_with_name.
*/
static gboolean
p_tabw_key_press_event_cb ( GtkWidget *widget
, GdkEvent *event
, GapStbTabWidgets *tabw
)
{
gint keyval;
gboolean sensitive;
gboolean ctrl_modifier;
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb;
GdkEventKey *kevent;
if(gap_debug) printf("p_tabw_key_press_event_cb : tabw:%d\n", (int)tabw);
if(tabw == NULL)
{
return (FALSE);
}
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
stb = p_tabw_get_stb_ptr(tabw);
ctrl_modifier = FALSE;
switch (event->type)
{
case GDK_KEY_PRESS:
kevent = (GdkEventKey *) event;
if(kevent->state & GDK_CONTROL_MASK)
{
ctrl_modifier = TRUE;
}
keyval = (gint)kevent->keyval;
if(gap_debug)
{
printf("KEY Press : val:%d ctrl_modifier:%d\n", (int)keyval, (int)ctrl_modifier);
}
switch (keyval)
{
case GDK_C:
case GDK_c:
if(ctrl_modifier)
{
if(gap_debug) printf("GDK_C: copy\n");
sensitive = p_cut_copy_sensitive(stb);
if(sensitive)
{
p_tabw_edit_copy_cb(NULL, tabw);
}
return(TRUE);
}
break;
case GDK_V:
case GDK_v:
if(ctrl_modifier)
{
if(gap_debug) printf("GDK_V: paste\n");
sensitive = p_paste_sensitive(sgpp, stb);
if(sensitive)
{
p_tabw_edit_paste_cb(NULL, tabw);
/* after paste focus is lost
* force setting focus at 1st widget in the fw_tab
* to catch the release event of the v-key
*/
p_tabw_set_focus_to_first_fw(tabw);
}
return(TRUE);
}
break;
case GDK_X:
case GDK_x:
if(ctrl_modifier)
{
if(gap_debug) printf("GDK_X: cut\n");
sensitive = p_cut_copy_sensitive(stb);
if(sensitive)
{
p_tabw_edit_cut_cb(NULL, tabw);
}
return(TRUE);
}
break;
case GDK_Z:
case GDK_z:
if(ctrl_modifier)
{
if(gap_debug) printf("GDK_Z: undo\n");
/* undo not implemented yet */
return(TRUE);
}
break;
}
break;
default:
/* do nothing */
break;
}
return FALSE;
} /* end p_tabw_key_press_event_cb */
/* -----------------------------------
* p_tabw_scroll_event_cb
* -----------------------------------
* handling of ctrl-c, ctrl-x, ctrl-v, ctrl-z keys
* pressed when focus is somewhere in the tabw frame_with_name.
*/
static gboolean
p_tabw_scroll_event_cb ( GtkWidget *widget
, GdkEventScroll *sevent
, GapStbTabWidgets *tabw
)
{
gint32 value;
if(tabw == NULL) { return FALSE;}
value = (gint32)GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj)->value;
if((sevent->direction == GDK_SCROLL_UP)
|| (sevent->direction == GDK_SCROLL_RIGHT))
{
value--;
}
else
{
value++;
}
/* set value in the rowpage spinbutton
* (this fires another callback for update of tabw->rowpage;)
*/
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->rowpage_spinbutton_adj), (gdouble)value);
return FALSE;
} /* end p_tabw_scroll_event_cb */
/* ---------------------------------
* story_dlg_response
* ---------------------------------
*/
static void
story_dlg_response (GtkWidget *widget,
gint response_id,
GapStbMainGlobalParams *sgpp)
{
GtkWidget *dialog;
switch (response_id)
{
case GTK_RESPONSE_OK:
if(sgpp)
{
if (GTK_WIDGET_VISIBLE (sgpp->shell_window))
gtk_widget_hide (sgpp->shell_window);
sgpp->run = TRUE;
}
default:
dialog = NULL;
if(sgpp)
{
gap_story_vthumb_close_videofile(sgpp);
dialog = sgpp->shell_window;
if(dialog)
{
sgpp->shell_window = NULL;
gtk_widget_destroy (dialog);
}
}
gtk_main_quit ();
break;
}
} /* end story_dlg_response */
/* ---------------------------------
* story_dlg_destroy
* ---------------------------------
*/
static void
story_dlg_destroy (GtkWidget *widget,
GapStbMainGlobalParams *sgpp_1)
{
GtkWidget *dialog;
GapStbMainGlobalParams *sgpp;
dialog = NULL;
if(sgpp_1 != NULL)
{
sgpp = sgpp_1;
}
else
{
sgpp = (GapStbMainGlobalParams *)g_object_get_data(G_OBJECT(widget), "sgpp");
}
if(sgpp)
{
gap_story_vthumb_close_videofile(sgpp);
dialog = sgpp->shell_window;
if(dialog)
{
sgpp->shell_window = NULL;
gtk_widget_destroy (dialog);
}
}
gtk_main_quit ();
} /* end story_dlg_destroy */
/* -----------------------------
* p_recreate_tab_widgets
* -----------------------------
* destroy old fw_table and all the attached frame_widgets if they exist.
* then newly create that stuff with empty frame_widgets.
* the caller should invoke the p_frame_widgets_render procedure afterwards.
*/
static void
p_recreate_tab_widgets(GapStoryBoard *stb
,GapStbTabWidgets *tabw
,gint32 mount_col
,gint32 mount_row
,GapStbMainGlobalParams *sgpp
)
{
if(gap_debug) printf("p_recreate_tab_widgets:START stb:%d tabw:%d\n", (int)stb ,(int)tabw);
if(tabw)
{
GtkWidget *table;
gint col;
gint row;
gint ii;
gint32 l_max_ii = 0;
gint32 l_act_elems = 0;
//printf("p_recreate_tab_widgets:(2)\n");
if(tabw->mount_table == NULL)
{
printf("Internal error: tabw->mount_table is NULL\n");
return;
}
tabw->sgpp = sgpp;
if(tabw->fw_tab)
{
/* destroy the old table of frame widgets */
for(ii=0; ii < tabw->fw_tab_size; ii++)
{
p_frame_widget_destroy(tabw->fw_tab[ii]);
g_free(tabw->fw_tab[ii]);
}
g_free(tabw->fw_tab);
tabw->fw_tab = NULL;
}
if(tabw->fw_gtk_table)
{
/* destroy the old table widget */
gtk_widget_destroy(tabw->fw_gtk_table);
tabw->fw_gtk_table = NULL;
}
tabw->mount_col = mount_col;
tabw->mount_row = mount_row;
if(stb)
{
gint32 l_width = 1;
gint32 l_height = 1;
gap_story_get_master_size_respecting_aspect(stb
,&l_width
,&l_height);
if(l_width > l_height)
{
tabw->thumb_width = tabw->thumbsize;
tabw->thumb_height = tabw->thumbsize * l_height / l_width;
}
else
{
tabw->thumb_width = tabw->thumbsize * l_width / l_height;
tabw->thumb_height = tabw->thumbsize;
}
l_act_elems = gap_story_count_active_elements(stb, tabw->vtrack);
}
if(gap_debug) printf("p_recreate_tab_widgets: rows:%d cols:%d\n", (int)tabw->rows ,(int)tabw->cols );
table = gtk_table_new (tabw->rows, tabw->cols, TRUE);
gtk_widget_show (table);
tabw->fw_gtk_table = table;
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_attach (GTK_TABLE (tabw->mount_table)
, tabw->fw_gtk_table
, tabw->mount_col, tabw->mount_col+1
, tabw->mount_row, tabw->mount_row+1
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, 0, 0);
/* allocate as much frame widgets as can be displayed
* in the table
*/
tabw->fw_tab_size = MIN((tabw->rows * tabw->cols), l_act_elems);
tabw->fw_tab = g_malloc0(sizeof(GapStbFrameWidget *) * tabw->fw_tab_size);
/* init buffers for the frame widgets */
for(ii=0; ii < tabw->fw_tab_size; ii++)
{
tabw->fw_tab[ii] = g_new(GapStbFrameWidget, 1);
p_frame_widget_init_empty(tabw, tabw->fw_tab[ii]);
}
ii = 0;
l_max_ii = l_act_elems - ((tabw->rowpage -1) * MAX(tabw->cols,1));
for(row=0; row < tabw->rows; row++)
{
for(col=0; col < tabw->cols; col++)
{
if(ii < l_max_ii)
{
GapStbFrameWidget *fw;
fw = tabw->fw_tab[ii];
gtk_table_attach (GTK_TABLE (tabw->fw_gtk_table)
, fw->vbox
, col, col+1
, row, row+1
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, 0, 0);
}
else
{
char *l_txt;
GtkWidget *label;
/* dummy label */
l_txt = g_strdup_printf(" ");
label = gtk_label_new (l_txt);
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (tabw->fw_gtk_table)
, label // tabw->fw_tab[ii].vbox
, col, col+1
, row, row+1
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, 0, 0);
g_free(l_txt);
}
ii++;
}
}
/* display frame label (if valid storyboard available add the filename)
* and set upper limit for the tabw->rowpage_spinbutton_adj widget
*/
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
}
} /* end p_recreate_tab_widgets */
/* ----------------------------------
* gap_story_dlg_recreate_tab_widgets
* ----------------------------------
*/
void
gap_story_dlg_recreate_tab_widgets(GapStbTabWidgets *tabw
,GapStbMainGlobalParams *sgpp
)
{
GapStoryBoard *stb_dst;
if(tabw)
{
stb_dst = p_tabw_get_stb_ptr(tabw);
/* clear selections when scene detection adds new clips */
gap_story_selection_all_set(stb_dst, FALSE);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
}
} /* end gap_story_dlg_recreate_tab_widgets */
/* ---------------------------------
* p_find_section_by_active_index
* ---------------------------------
* return the section corresponding to the specified active_index
* or NULL in case there is no such section available in
* the specified storyboard.
*/
static GapStorySection *
p_find_section_by_active_index(GapStoryBoard *stb, gint active_index)
{
GapStorySection *section;
gint ii;
section = NULL;
switch(active_index)
{
case 0:
section = gap_story_find_main_section(stb);
break;
case 1:
section = stb->mask_section;
break;
default:
ii = 0;
for(section = stb->stb_section; section != NULL; section = section->next)
{
if (ii == active_index)
{
return (section);
}
ii++;
}
break;
}
return (section);
} /* end p_find_section_by_active_index */
/* ---------------------------------
* p_find_combo_index_of_section
* ---------------------------------
* return the combo box index corresponding to the specified section
* (if section not found return 0 that also refers
* to the MAIN section)
*/
static gint
p_find_combo_index_of_section(GapStoryBoard *stb, GapStorySection *target_section)
{
GapStorySection *main_section;
GapStorySection *section;
gint index;
if(target_section == stb->mask_section)
{
return (1);
}
main_section = gap_story_find_main_section(stb);
if(target_section == main_section)
{
return (0);
}
index = 2;
for(section = stb->stb_section; section != NULL; section = section->next)
{
if((section == main_section) || (section == stb->mask_section))
{
continue;
}
if (section->section_id == target_section->section_id)
{
return (index);
}
index++;
}
return (0);
} /* end p_find_combo_index_of_section */
/* ---------------------------------
* p_activate_section_by_combo_index
* ---------------------------------
* select the active section by
* its index in the combo box.
*/
static void
p_activate_section_by_combo_index(gint target_index
, GapStbTabWidgets *tabw)
{
GapStoryBoard *stb_dst;
if(tabw == NULL) { return; }
if(tabw->sections_combo == NULL) {return;}
stb_dst = p_tabw_get_stb_ptr(tabw);
if (stb_dst)
{
GapStorySection *section;
section = p_find_section_by_active_index(stb_dst, target_index);
if (gap_debug)
{
if (section == NULL)
{
printf("p_activate_section_by_combo_index: %d NULL section not found\n"
,(int)target_index
);
}
else
{
printf("p_activate_section_by_combo_index: %d active_section: %d section:%d "
,(int)target_index
, (int)section
, (int)stb_dst->active_section
);
if (section->section_name == NULL)
{
printf("section_name: NULL (e.g. MAIN)\n");
}
else
{
printf("section_name: %s\n", section->section_name);
}
}
}
if ((section != stb_dst->active_section)
&& (section != NULL))
{
gint32 current_vtrack;
current_vtrack = gap_story_get_current_vtrack(stb_dst, section);
stb_dst->active_section = section;
p_tabw_sensibility(tabw->sgpp, stb_dst, tabw);
/* fake -99 as current video track to force always refresh
* in p_vtrack_spinbutton_cb
*/
tabw->vtrack = -99;
gtk_adjustment_set_value(GTK_ADJUSTMENT(tabw->vtrack_spinbutton_adj)
, current_vtrack);
if (tabw->vtrack != current_vtrack)
{
/* the callback p_vtrack_spinbutton_cb is normally triggered automatically
* if the current vtrack number is set to the another number.
* this explicite call is for the case where the track number
* did not change. (but same track number in another section requires
* always a refresh, that is triggered here)
*/
p_vtrack_spinbutton_cb(NULL, tabw);
}
}
else
{
p_tabw_sensibility(tabw->sgpp, stb_dst, tabw);
}
}
} /* end p_activate_section_by_combo_index */
/* ---------------------------------
* p_set_strings_for_section_combo
* ---------------------------------
* replace all entries in the combo box for section names.
* Note: at least the MAIN and Mask section are always present
* in the combo box, even if they are empty or not present in
* the storyboard (that is refered by tabw).
*/
static void
p_set_strings_for_section_combo(GapStbTabWidgets *tabw)
{
GapStoryBoard *stb;
GapStorySection *section;
gint index_of_active_item;
gint index;
gint remove_position;
if(tabw == NULL) {return;}
if(tabw->sections_combo == NULL) {return;}
/* remove all already existing entries */
remove_position = 0;
while(tabw->sections_combo_elem_count > 0)
{
gtk_combo_box_remove_text(GTK_COMBO_BOX (tabw->sections_combo), remove_position);
tabw->sections_combo_elem_count--;
}
index_of_active_item = 0;
tabw->sections_combo_elem_count = 0;
/* always add the entries for main and mask section */
gtk_combo_box_append_text(GTK_COMBO_BOX (tabw->sections_combo)
,_("MAIN"));
tabw->sections_combo_elem_count++;
gtk_combo_box_append_text(GTK_COMBO_BOX (tabw->sections_combo)
,_("Masks"));
tabw->sections_combo_elem_count++;
/* add all other subsection names if there are any present in the storyboard */
stb = p_tabw_get_stb_ptr (tabw);
if(stb)
{
index = 2;
for(section = stb->stb_section; section != NULL; section = section->next)
{
if (section->section_name == NULL)
{
if (section == stb->active_section)
{
index_of_active_item = 0;
}
}
else
{
if(section == stb->mask_section)
{
if (section == stb->active_section)
{
index_of_active_item = 1;
}
}
else
{
gchar *l_txt;
if(section == stb->active_section)
{
index_of_active_item = index;
}
l_txt = gap_base_shorten_filename(NULL /* prefix */
,section->section_name /* filenamepart */
,NULL /* suffix */
,12 /* max_chars */
);
gtk_combo_box_append_text(GTK_COMBO_BOX (tabw->sections_combo)
, l_txt);
g_free(l_txt);
tabw->sections_combo_elem_count++;
index++;
}
}
}
}
gtk_combo_box_set_active(GTK_COMBO_BOX (tabw->sections_combo)
,index_of_active_item);
} /* end p_make_func_menu_item */
/* -----------------------------
* p_create_button_bar
* -----------------------------
* create button bar (cut,copy,paste,play and rowpage spinbutton)
* and rowpage vscale widgets
*/
static GtkWidget *
p_create_button_bar(GapStbTabWidgets *tabw
,gint32 mount_col
,gint32 mount_row
,GapStbMainGlobalParams *sgpp
,gint32 mount_vs_col
,gint32 mount_vs_row
)
{
/* rowpage spinbutton and labels */
GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *entry;
GtkWidget *label;
GtkWidget *button;
GtkWidget *vscale;
GtkWidget *spinbutton;
GtkObject *spinbutton_adj;
GtkObject *adj;
/* the hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (tabw->mount_table)
, hbox
, mount_col, mount_col+1
, mount_row, mount_row+1
, (GtkAttachOptions) (GTK_FILL | GTK_EXPAND)
, (GtkAttachOptions) (0)
, 0, 0);
/* the hbox2 */
hbox2 = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 2);
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
gtk_widget_show (hbox2);
/* with_load_and_save button */
{
/* The Load button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_OPEN );
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_load_file_cb),
tabw);
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
gimp_help_set_help_data (button,
_("Load storyboard file"),
NULL);
}
else
{
gimp_help_set_help_data (button,
_("Load cliplist file"),
NULL);
}
gtk_widget_show (button);
/* The Save button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_SAVE );
tabw->save_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_menu_stb_save_cb),
tabw->sgpp);
gimp_help_set_help_data (button,
_("Save storyboard to file"),
NULL);
}
else
{
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_menu_cll_save_cb),
tabw->sgpp);
gimp_help_set_help_data (button,
_("Save cliplist to file"),
NULL);
}
gtk_widget_show (button);
}
/* Section Combo Box */
{
GtkWidget *combo;
combo = gtk_combo_box_new_text();
tabw->sections_combo_elem_count = 0;
tabw->sections_combo = combo;
gtk_box_pack_start (GTK_BOX (hbox2), combo, FALSE, FALSE, 2);
gtk_widget_show (combo);
p_set_strings_for_section_combo(tabw);
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (p_section_combo_changed_cb),
tabw);
}
/* The Section Properties button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_PROPERTIES );
//tabw->edit_story_properties_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_section_properties_cut_cb),
tabw);
gimp_help_set_help_data (button,
_("Show Section properites window"),
NULL);
gtk_widget_show (button);
/* Track label */
label = gtk_label_new (_("Track:"));
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 2);
gtk_widget_show (label);
/* video track spinbutton */
spinbutton_adj = gtk_adjustment_new ( tabw->vtrack
, 0 /* min */
, GAP_STB_MAX_VID_TRACKS -1 /* max */
, 1, 10, 0);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
tabw->vtrack_spinbutton_adj = spinbutton_adj;
tabw->vtrack_spinbutton = spinbutton;
gtk_widget_show (spinbutton);
gtk_box_pack_start (GTK_BOX (hbox2), spinbutton, FALSE, FALSE, 2);
gimp_help_set_help_data (spinbutton, _("Video Track Number (0 refers to mask definition track)"), NULL);
g_signal_connect (G_OBJECT (spinbutton), "value_changed",
G_CALLBACK (p_vtrack_spinbutton_cb),
tabw);
/* The Undo button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_UNDO );
tabw->undo_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_undo_cb),
tabw);
gimp_help_set_help_data (button, _("UNDO"), NULL);
gtk_widget_show (button);
/* The Redo button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_REDO );
tabw->redo_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_redo_cb),
tabw);
gimp_help_set_help_data (button, _("REDO"), NULL);
gtk_widget_show (button);
/* The Cut button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_CUT );
tabw->edit_cut_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_edit_cut_cb),
tabw);
gimp_help_set_help_data (button,
_("Cut a clip"),
NULL);
gtk_widget_show (button);
/* The Copy button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_COPY );
tabw->edit_copy_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_edit_copy_cb),
tabw);
gimp_help_set_help_data (button,
_("Copy a clip"),
NULL);
gtk_widget_show (button);
/* The Paste button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_PASTE );
tabw->edit_paste_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_tabw_edit_paste_cb),
tabw);
gimp_help_set_help_data (button,
_("Paste a clip after last (selected) element"),
NULL);
gtk_widget_show (button);
/* The New Clip button */
button = p_gtk_button_new_from_stock_icon (GTK_STOCK_NEW );
tabw->new_clip_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (p_tabw_new_clip_cb),
tabw);
gimp_help_set_help_data (button,
_("Create new clip\n"
"(SHIFT create transition\n"
"CTRL create section clip)"),
NULL);
gtk_widget_show (button);
/* The Play Button */
button = p_gtk_button_new_from_stock_icon (GAP_STOCK_PLAY);
tabw->play_button = button;
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
gimp_help_set_help_data (button,
_("Play selected clips\n"
"SHIFT: Playback all clips of current track.\n"
"CTRL: Play composite video (all tracks)"),
NULL);
if(tabw->type == GAP_STB_MASTER_TYPE_STORYBOARD)
{
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (p_player_stb_mode_cb),
sgpp);
}
else
{
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (p_player_cll_mode_cb),
sgpp);
}
gtk_widget_show (button);
/* The filename entry */
entry = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_entry_set_text(GTK_ENTRY(entry), tabw->filename_refptr);
g_signal_connect(G_OBJECT(entry), "changed",
G_CALLBACK (p_tabw_filename_entry_cb),
tabw);
tabw->filename_entry = entry;
/* gtk_widget_show (entry); */
/* Row label */
label = gtk_label_new (_("Row:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
gtk_widget_hide (label);
/* rowpage spinbutton */
spinbutton_adj = gtk_adjustment_new ( tabw->rowpage
, 1 /* min */
, 1 /* max */
, 1, 10, 0);
tabw->rowpage_spinbutton_adj = spinbutton_adj;
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
gtk_widget_hide (spinbutton);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 2);
gimp_help_set_help_data (spinbutton, _("Top rownumber"), NULL);
g_signal_connect (G_OBJECT (spinbutton), "value_changed",
G_CALLBACK (p_rowpage_spinbutton_cb),
tabw);
/* of label */
label = gtk_label_new (_("of:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
gtk_widget_hide (label);
/* total rows label */
label = gtk_label_new ("1");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
gtk_widget_show (label);
tabw->total_rows_label = label;
/* rowpage vscale */
adj = gtk_adjustment_new ( tabw->rowpage
, 1 /* min */
, 1 /* max */
, 1, 10, 0);
vscale = gtk_vscrollbar_new (GTK_ADJUSTMENT(adj));
gtk_range_set_update_policy (GTK_RANGE (vscale), GTK_UPDATE_DELAYED); /* GTK_UPDATE_CONTINUOUS */
gtk_table_attach (GTK_TABLE (tabw->mount_table)
, vscale
, mount_vs_col, mount_vs_col+1
, mount_vs_row, mount_vs_row+1
, (GtkAttachOptions) (0)
, (GtkAttachOptions) (GTK_FILL)
, 0, 0);
g_signal_connect (adj, "value_changed",
(GtkSignalFunc)p_vscale_changed_cb,
tabw);
/* startup with invisble vscale */
gtk_widget_hide (vscale);
tabw->rowpage_vscale_adj = adj;
tabw->rowpage_vscale = vscale;
/* setup the hbox that contains the button bar
* as drop destination.
* (for inserting clips at end of storyboard, and for
* enable drop destination in case when th storyboard is empty
* and has not frame widget that can act as DND target).
*/
p_widget_init_dnd_drop(hbox, tabw);
return(hbox);
} /* end p_create_button_bar */
/* --------------------------------
* p_gtk_button_new_from_stock_icon
* --------------------------------
* create a button from stock, using only the icon
* (the text assotiated with the stock id is not rendered,
* to keep the button width small)
*/
GtkWidget * p_gtk_button_new_from_stock_icon(const char *stock_id)
{
GtkWidget *button;
GtkWidget *image;
image = gtk_image_new_from_stock (stock_id,
GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image);
button = gtk_button_new();
gtk_container_add (GTK_CONTAINER (button), image);
return(button);
} /* end p_gtk_button_new_from_stock_icon */
/* ---------------------------------
* p_get_gimprc_preview_size
* ---------------------------------
*/
static gint32
p_get_gimprc_preview_size(const char *gimprc_option_name)
{
char *value_string;
gint32 preview_size;
preview_size = STB_THSIZE_MEDIUM; /* default preview size if nothing is configured */
value_string = gimp_gimprc_query(gimprc_option_name);
if(value_string)
{
if (strcmp (value_string, "small") == 0)
{
preview_size = STB_THSIZE_SMALL;
}
else if (strcmp (value_string, "medium") == 0)
{
preview_size = STB_THSIZE_MEDIUM;
}
else if (strcmp (value_string, "large") == 0)
{
preview_size = STB_THSIZE_LARGE;
}
else
{
preview_size = atol(value_string);
}
g_free(value_string);
}
/* limit to useable values (in case gimrc value was specified as integer number) */
if (preview_size < STB_THSIZE_MIN)
{
preview_size = STB_THSIZE_MIN;
}
if (preview_size > STB_THSIZE_MAX)
{
preview_size = STB_THSIZE_MAX;
}
return (preview_size);
} /* p_get_gimprc_preview_size */
/* ---------------------------------
* p_save_gimprc_preview_size
* ---------------------------------
*/
static void
p_save_gimprc_preview_size(const char *gimprc_option_name, gint32 preview_size)
{
char *value_string;
value_string = NULL;
switch(preview_size)
{
case STB_THSIZE_SMALL:
value_string = g_strdup_printf("small");
break;
case STB_THSIZE_MEDIUM:
value_string = g_strdup_printf("medium");
break;
case STB_THSIZE_LARGE:
value_string = g_strdup_printf("large");
break;
default:
value_string = g_strdup_printf("%d", preview_size);
break;
}
gimp_gimprc_set(gimprc_option_name, value_string);
g_free(value_string);
} /* p_save_gimprc_preview_size */
/* ---------------------------------
* p_save_gimprc_int_value
* ---------------------------------
*/
static void
p_save_gimprc_int_value(const char *gimprc_option_name, gint32 value)
{
char *value_string;
value_string = g_strdup_printf("%d", (int)value);
gimp_gimprc_set(gimprc_option_name, value_string);
g_free(value_string);
} /* p_save_gimprc_int_value */
/* ---------------------------------
* p_save_gimprc_gboolean_value
* ---------------------------------
*/
static void
p_save_gimprc_gboolean_value(const char *gimprc_option_name, gboolean value)
{
if(value)
{
gimp_gimprc_set(gimprc_option_name, "yes");
}
else
{
gimp_gimprc_set(gimprc_option_name, "no");
}
} /* p_save_gimprc_gboolean_value */
/* ---------------------------------
* p_save_gimprc_layout_settings
* ---------------------------------
*/
static void
p_save_gimprc_layout_settings(GapStbMainGlobalParams *sgpp)
{
p_save_gimprc_preview_size("video-cliplist-thumbnail_size", sgpp->cll_thumbsize);
p_save_gimprc_int_value("video-cliplist-columns", sgpp->cll_cols);
p_save_gimprc_int_value("video-cliplist-rows", sgpp->cll_rows);
p_save_gimprc_preview_size("video-storyboard-thumbnail_size", sgpp->stb_thumbsize);
p_save_gimprc_int_value("video-storyboard-columns", sgpp->stb_cols);
p_save_gimprc_int_value("video-storyboard-rows", sgpp->stb_rows);
p_save_gimprc_gboolean_value("video-storyboard-force-aspect-playback", sgpp->force_stb_aspect);
} /* end p_save_gimprc_layout_settings */
/* ---------------------------------
* p_get_gimprc_layout_settings
* ---------------------------------
*/
static void
p_get_gimprc_layout_settings(GapStbMainGlobalParams *sgpp)
{
sgpp->cll_thumbsize = p_get_gimprc_preview_size("video-cliplist-thumbnail_size");
sgpp->cll_cols = gap_base_get_gimprc_int_value("video-cliplist-columns"
, sgpp->cll_cols
, CLL_MIN_COL
, CLL_MAX_COL
);
sgpp->cll_rows = gap_base_get_gimprc_int_value("video-cliplist-rows"
, sgpp->cll_rows
, CLL_MIN_ROW
, CLL_MAX_ROW
);
sgpp->stb_thumbsize = p_get_gimprc_preview_size("video-storyboard-thumbnail_size");
sgpp->stb_cols = gap_base_get_gimprc_int_value("video-storyboard-columns"
, sgpp->stb_cols
, STB_MIN_COL
, STB_MAX_COL
);
sgpp->stb_rows = gap_base_get_gimprc_int_value("video-storyboard-rows"
, sgpp->stb_rows
, STB_MIN_ROW
, STB_MAX_ROW
);
sgpp->force_stb_aspect = gap_base_get_gimprc_gboolean_value("video-storyboard-force-aspect-playback"
, sgpp->force_stb_aspect
);
} /* end p_get_gimprc_layout_settings */
/* ---------------------------------
* p_reset_progress_bars
* ---------------------------------
*/
static void
p_reset_progress_bars(GapStbMainGlobalParams *sgpp)
{
if(sgpp)
{
if(sgpp->progress_bar_master)
{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_master), "");
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_master), 0);
}
if(sgpp->progress_bar_sub)
{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(sgpp->progress_bar_sub), "");
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(sgpp->progress_bar_sub), 0);
}
}
} /* end p_reset_progress_bars */
/* -----------------------------
* gap_storyboard_dialog
* -----------------------------
*/
void
gap_storyboard_dialog(GapStbMainGlobalParams *sgpp)
{
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *stb_frame;
GtkWidget *stb_vbox;
GtkWidget *clp_frame;
GtkWidget *clp_vbox;
GtkWidget *player_frame;
GtkWidget *table;
GtkWidget *menu_bar;
GtkWidget *frame_event_box;
GtkWidget *hbox_stb_frame;
/* Init UI */
gimp_ui_init ("storyboard", FALSE);
gap_stock_init();
/* The Storyboard dialog */
sgpp->run = FALSE;
sgpp->curr_selection = NULL;
sgpp->video_list = NULL;
sgpp->vthumb_list = NULL;
sgpp->gvahand = NULL;
sgpp->gva_videofile = NULL;
sgpp->progress_bar_master = NULL;
sgpp->progress_bar_sub = NULL;
sgpp->gva_lock = FALSE;
sgpp->vthumb_prefetch_in_progress = GAP_VTHUMB_PREFETCH_NOT_ACTIVE;
sgpp->auto_vthumb = FALSE;
sgpp->auto_vthumb = FALSE;
sgpp->auto_vthumb_refresh_canceled = FALSE;
sgpp->cll_widgets = NULL;
sgpp->menu_item_cll_save = NULL;
sgpp->menu_item_cll_save_as = NULL;
sgpp->menu_item_cll_add_clip = NULL;
sgpp->menu_item_cll_add_section_clip = NULL;
sgpp->menu_item_cll_att_properties = NULL;
sgpp->menu_item_cll_playback = NULL;
sgpp->menu_item_cll_properties = NULL;
sgpp->menu_item_cll_undo = NULL;
sgpp->menu_item_cll_redo = NULL;
sgpp->menu_item_cll_close = NULL;
sgpp->stb_widgets = NULL;
sgpp->menu_item_stb_save = NULL;
sgpp->menu_item_stb_save_as = NULL;
sgpp->menu_item_stb_add_clip = NULL;
sgpp->menu_item_stb_add_section_clip = NULL;
sgpp->menu_item_stb_att_properties = NULL;
sgpp->menu_item_stb_playback = NULL;
sgpp->menu_item_stb_properties = NULL;
sgpp->menu_item_stb_undo = NULL;
sgpp->menu_item_stb_redo = NULL;
sgpp->menu_item_stb_close = NULL;
sgpp->win_prop_dlg_open = FALSE;
sgpp->dnd_pixbuf = NULL;
/* get layout settings from gimprc
* (keeping initial values if no layout settings available in gimprc)
*/
p_get_gimprc_layout_settings(sgpp);
/* The dialog and main vbox */
/* the help_id is passed as NULL to avoid creation of the HELP button
* (the Help Button would be the only button in the action area and results
* in creating an extra row
* additional note: the Storyboard dialog provides
* Help via Menu-Item
*/
// // NO longer use gimp_dialog_new because the window gets no minimize widget when created this way !
// //
// dialog = gimp_dialog_new (_("Storyboard"), "storyboard",
// NULL, 0,
// gimp_standard_help_func, NULL, /* GAP_STORYBOARD_EDIT_HELP_ID */
// NULL);
// g_signal_connect (G_OBJECT (dialog), "response",
// G_CALLBACK (story_dlg_response),
// sgpp);
// /* the vbox */
// vbox = gtk_vbox_new (FALSE, 0);
// // gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
// gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
// TRUE, TRUE, 0);
// gtk_widget_show (vbox);
{
gimp_ui_init ("storyboard", TRUE);
dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (dialog), _("Storyboard"));
gtk_window_set_role (GTK_WINDOW (dialog), "storybord-editor");
g_object_set_data (G_OBJECT (dialog), "sgpp"
, (gpointer)sgpp);
g_signal_connect (dialog, "destroy",
G_CALLBACK (story_dlg_destroy),
sgpp);
gimp_help_connect (dialog, gimp_standard_help_func, GAP_STORY_PLUG_IN_PROC, NULL);
/* the vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (dialog), vbox);
gtk_widget_show (vbox);
}
sgpp->shell_window = dialog;
/* the menu_bar */
menu_bar = gtk_menu_bar_new();
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, TRUE, 0);
p_make_menu_global(sgpp, menu_bar);
p_make_menu_cliplist(sgpp, menu_bar);
p_make_menu_storyboard(sgpp, menu_bar);
p_make_menu_help(sgpp, menu_bar);
gtk_widget_show(menu_bar);
/* the hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
/* XXXXXXXXXXX Start of the CLIPLIST widgets XXXXXXXXXXXX */
/* the frame_event_box (to catch key events) */
frame_event_box = gtk_event_box_new ();
gtk_widget_show (frame_event_box);
gtk_widget_set_events (frame_event_box
, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
/* the clp_frame */
clp_frame = gimp_frame_new ( _("Cliplist") );
gtk_frame_set_shadow_type (GTK_FRAME (clp_frame) ,GTK_SHADOW_ETCHED_IN);
gtk_container_add (GTK_CONTAINER (frame_event_box ), clp_frame);
gtk_box_pack_start (GTK_BOX (hbox), frame_event_box, TRUE, TRUE, 0);
gtk_widget_show (clp_frame);
/* the clp_vbox */
clp_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (clp_vbox), 2);
gtk_container_add (GTK_CONTAINER (clp_frame), clp_vbox);
gtk_widget_show (clp_vbox);
/* mount_table for the cliplist table */
table = gtk_table_new (2, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (clp_vbox), table, TRUE, TRUE, 0);
/* init Table widgets (tabw struct for cliplist) */
sgpp->cll_widgets = p_new_stb_tab_widgets(sgpp, GAP_STB_MASTER_TYPE_CLIPLIST);
sgpp->cll_widgets->mount_table = table;
sgpp->cll_widgets->frame_with_name = clp_frame;
g_signal_connect (G_OBJECT (frame_event_box), "key_press_event",
G_CALLBACK (p_tabw_key_press_event_cb),
sgpp->cll_widgets);
g_signal_connect (G_OBJECT (frame_event_box), "scroll_event",
G_CALLBACK (p_tabw_scroll_event_cb),
sgpp->cll_widgets);
/* create CLIPLIST Table widgets */
p_recreate_tab_widgets( sgpp->cll
,sgpp->cll_widgets
,0 /* mount_col */
,0 /* mount_row */
,sgpp
);
/* button bar */
p_create_button_bar(sgpp->cll_widgets
,0 /* mount_col */
,1 /* mount_row */
,sgpp
,1 /* mount_vs_col */
,0 /* mount_vs_row */
);
/* XXXXXXXXXXX Player Frame XXXXXXXXXXXX */
/* the player_frame */
player_frame = gimp_frame_new ( _("Playback") );
gtk_frame_set_shadow_type (GTK_FRAME (player_frame) ,GTK_SHADOW_ETCHED_IN);
gtk_box_pack_start (GTK_BOX (hbox), player_frame, TRUE, TRUE, 0);
gtk_widget_show (player_frame);
sgpp->player_frame = player_frame;
/* XXXXXXXXXXX Start of the STORYBOARD widgets XXXXXXXXXXXX */
/* the frame_event_box (to catch key events) */
frame_event_box = gtk_event_box_new ();
gtk_widget_show (frame_event_box);
gtk_widget_set_events (frame_event_box
, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
/* the stb_frame */
stb_frame = gimp_frame_new ( _("Storyboard") );
gtk_frame_set_shadow_type (GTK_FRAME (stb_frame) ,GTK_SHADOW_ETCHED_IN);
gtk_container_add (GTK_CONTAINER (frame_event_box ), stb_frame);
gtk_box_pack_start (GTK_BOX (vbox), frame_event_box, TRUE, TRUE, 0);
gtk_widget_show (stb_frame);
/* the stb_vbox */
stb_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (stb_vbox), 2);
gtk_container_add (GTK_CONTAINER (stb_frame), stb_vbox);
gtk_widget_show (stb_vbox);
/* mount_table for the storyboard table */
table = gtk_table_new (2, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (stb_vbox), table, TRUE, TRUE, 0);
/* init Table widgets (tabw struct for storyboard) */
sgpp->stb_widgets = p_new_stb_tab_widgets(sgpp, GAP_STB_MASTER_TYPE_STORYBOARD);
sgpp->stb_widgets->mount_table = table;
sgpp->stb_widgets->frame_with_name = stb_frame;
g_signal_connect (G_OBJECT (frame_event_box), "key_press_event",
G_CALLBACK (p_tabw_key_press_event_cb),
sgpp->stb_widgets);
g_signal_connect (G_OBJECT (frame_event_box), "scroll_event",
G_CALLBACK (p_tabw_scroll_event_cb),
sgpp->stb_widgets);
/* create STORYBOARD Table widgets */
p_recreate_tab_widgets( sgpp->stb
,sgpp->stb_widgets
,0 /* mount_col */
,0 /* mount_row */
,sgpp
);
/* button bar */
hbox_stb_frame = p_create_button_bar(sgpp->stb_widgets
,0 /* mount_col */
,1 /* mount_row */
,sgpp
,1 /* mount_vs_col */
,0 /* mount_vs_row */
);
/* The clip target togglebutton */
{
GtkWidget *togglebutton;
gboolean initial_state;
GtkWidget *image;
image = gtk_image_new_from_stock (GAP_STOCK_RANGE_START, GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image);
togglebutton = gtk_toggle_button_new ();
gtk_container_add (GTK_CONTAINER (togglebutton), image);
gtk_widget_show (togglebutton);
gtk_box_pack_start (GTK_BOX (hbox_stb_frame), togglebutton, FALSE, FALSE, 0);
initial_state = FALSE;
if(sgpp->clip_target == GAP_STB_CLIPTARGET_STORYBOARD_APPEND)
{
initial_state = TRUE;
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), initial_state);
g_object_set_data (G_OBJECT (togglebutton), "sgpp"
, (gpointer)sgpp);
g_signal_connect (G_OBJECT (togglebutton), "toggled"
, G_CALLBACK (p_cliptarget_togglebutton_toggled_cb)
, &sgpp->clip_target);
gimp_help_set_help_data (togglebutton
, _("ON: clip target is storyboard (for clips created from playback range).")
, NULL);
}
/* The Video ProgressBar */
{
GtkWidget *button;
GtkWidget *progress_bar;
GtkWidget *vbox_progress;
vbox_progress = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox_progress);
progress_bar = gtk_progress_bar_new ();
sgpp->progress_bar_master = progress_bar;
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), " ");
gtk_widget_show (progress_bar);
gtk_box_pack_start (GTK_BOX (vbox_progress), progress_bar, TRUE, TRUE, 0);
progress_bar = gtk_progress_bar_new ();
sgpp->progress_bar_sub = progress_bar;
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar), " ");
gtk_widget_show (progress_bar);
gtk_box_pack_start (GTK_BOX (vbox_progress), progress_bar, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox_stb_frame), vbox_progress, TRUE, TRUE, 0);
button = gtk_button_new_with_label (_("Cancel"));
gtk_box_pack_start (GTK_BOX (hbox_stb_frame), button, FALSE, FALSE, 0);
gtk_widget_show (button);
gimp_help_set_help_data (button
, _("Cancel video access if in progress and disable automatic videothumbnails")
, NULL);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (p_cancel_button_cb),
sgpp);
}
sgpp->initialized = TRUE;
p_widget_sensibility(sgpp);
gtk_widget_show (dialog);
/* init player window */
p_player_img_mode_cb(NULL, sgpp);
{
gint32 ffetch_user_id;
/* register for frame fetcher resources (image cache)
*/
ffetch_user_id = gap_frame_fetch_register_user("gap_storyboard_dialog");
gtk_main ();
gdk_flush ();
/* unregister (shall drop cached resources of the frame fetcher) */
gap_frame_fetch_unregister_user(ffetch_user_id);
}
} /* end gap_storyboard_dialog */
/* -----------------------------------
* p_tabw_gen_otone_dialog
* ------------------------------------
*/
static void
p_tabw_gen_otone_dialog(GapStbTabWidgets *tabw)
{
GapArrArg argv[7];
gint l_ii;
gint l_ii_aud_seltrack;
gint l_ii_aud_track;
gint l_ii_replace;
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
gboolean l_rc;
stb_dst = p_tabw_get_stb_ptr (tabw);
if(stb_dst == NULL) { return; }
if(tabw->otone_dlg_open) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
tabw->otone_dlg_open = TRUE;
l_ii = 0;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL_LEFT);
argv[l_ii].label_txt = _("Generate original tone audio track "
"for all video clips in the storyboard");
l_ii++; l_ii_aud_seltrack = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Input Audiotrack:");
argv[l_ii].help_txt = _("select input audiotrack in the videofile(s).");
argv[l_ii].int_min = (gint)1;
argv[l_ii].int_max = (gint)99;
argv[l_ii].int_ret = (gint)1;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)1;
l_ii++; l_ii_aud_track = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Output Audiotrack:");
argv[l_ii].help_txt = _("output audiotrack to be generated in the storyboard file. "
"The generated storyboard audiotrack will be a list of references "
"to the audioparts in the input videos, corresponding to all "
"used video clip references.");
argv[l_ii].int_min = (gint)1;
argv[l_ii].int_max = (gint)GAP_STB_MAX_AUD_TRACKS;
argv[l_ii].int_ret = (gint)1;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)1;
l_ii++; l_ii_replace = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_TOGGLE);
argv[l_ii].label_txt = _("Replace Audiotrack:");
argv[l_ii].help_txt = _("ON: Allow replacing of already existing audio clip references "
" in the storyboard");
argv[l_ii].int_ret = FALSE;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = FALSE;
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_DEFAULT_BUTTON);
argv[l_ii].label_txt = _("Reset");
argv[l_ii].help_txt = _("Reset parameters to default values");
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_HELP_BUTTON);
argv[l_ii].help_id = GAP_STB_GEN_OTONE_DLG_HELP_ID;
l_ii++;
l_rc = gap_arr_ok_cancel_dialog( _("Generate Original Tone Audio")
, _("Settings")
, l_ii
, argv);
if((l_rc) && (sgpp->shell_window))
{
gint aud_seltrack;
gint aud_track;
gint vid_track;
gboolean replace_existing_aud_track;
gboolean l_ok;
gdouble l_first_non_matching_framerate;
aud_seltrack = (gint32)(argv[l_ii_aud_seltrack].int_ret);
aud_track = (gint32)(argv[l_ii_aud_track].int_ret);
vid_track = tabw->vtrack;
replace_existing_aud_track = (gint32)(argv[l_ii_replace].int_ret);
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_GENERATE_OTONE);
/* start otone generator procedure */
l_ok = gap_story_gen_otone_audio(stb_dst
,vid_track
,aud_track
,aud_seltrack
,replace_existing_aud_track
,&l_first_non_matching_framerate
);
gap_stb_undo_group_end(tabw);
if(!l_ok)
{
g_message(_("Original tone track was not created.\n"
"The storyboard %s\n"
"has already audio clip references at track %d.\n"
"Use another track number or allow replace at next try.")
,tabw->filename_refptr
,(int)aud_track
);
}
else
{
if(l_first_non_matching_framerate != 0.0)
{
g_message(_("Original tone track was created with warnings.\n"
"The storyboard %s\n"
"has movie clips with framerate %.4f. "
"that is different from the master framerate %.4f.\n"
"The generated audio is NOT synchronized with the video.")
,tabw->filename_refptr
,(float)l_first_non_matching_framerate
,(float)stb_dst->master_framerate
);
}
}
/* update to reflect the modified status */
p_tabw_update_frame_label_and_rowpage_limits (tabw, sgpp);
}
tabw->otone_dlg_open = FALSE;
} /* end p_tabw_gen_otone_dialog */
/* -----------------------------------
* p_parse_int
* ------------------------------------
*/
static gint32
p_parse_int(const char *buff)
{
gint32 value;
value = 0;
if(buff == NULL)
{
}
while(buff != NULL)
{
if (*buff == '\0')
{
break;
}
if ((*buff != ' ') || (*buff != '\t') || (*buff != '\n'))
{
value = atol(buff);
break;
}
buff++;
}
return (value);
} /* end p_parse_int */
/* -----------------------------------
* p_parse_aspect_width_and_height
* ------------------------------------
*/
static void
p_parse_aspect_width_and_height(const char *buff, gint32 *aspect_width, gint32 *aspect_height)
{
*aspect_width = 0;
*aspect_height = 0;
const char *h_ptr;
if(buff == NULL)
{
return;
}
*aspect_width = p_parse_int(buff);
h_ptr = buff;
while(h_ptr != NULL)
{
if (*h_ptr == ':')
{
h_ptr++;
*aspect_height = p_parse_int(h_ptr);
return;
}
if (*h_ptr == '\0')
{
break;
}
h_ptr++;
}
} /* end p_parse_aspect_width_and_height */
/* -----------------------------------
* p_tabw_master_prop_dialog
* -----------------------------------
*/
static void
p_tabw_master_prop_dialog(GapStbTabWidgets *tabw, gboolean new_flag)
{
GapArrArg argv[12];
static char *radio_args[4] = { N_("automatic"), "libmpeg3", "libavformat", "quicktime4linux" };
static char *radio_aspect_args[3] = { N_("none"), "4:3", "16:9"};
gint l_ii;
gint l_decoder_idx;
gint l_aspect_idx;
gint l_ii_width;
gint l_ii_height;
gint l_ii_framerate;
gint l_ii_vtrack1_is_toplayer;
gint l_ii_preferred_decoder;
gint l_ii_samplerate;
gint l_ii_volume;
gint l_ii_aspect;
GapStbMainGlobalParams *sgpp;
GapStoryBoard *stb_dst;
gint32 l_master_width;
gint32 l_master_height;
gchar buf_preferred_decoder[60];
gchar buf_aspect_string[40];
gchar *label_txt;
gchar l_master_insert_area_format[GAP_STORY_MAX_STORYFILENAME_LEN];
gboolean l_rc;
stb_dst = p_tabw_get_stb_ptr (tabw);
if(stb_dst == NULL)
{
return;
}
if(tabw->master_dlg_open)
{
return;
}
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
tabw->master_dlg_open = TRUE;
gap_story_get_master_pixelsize(stb_dst, &l_master_width, &l_master_height);
label_txt = NULL;
l_ii = 0;
if(new_flag)
{
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_FILESEL);
argv[l_ii].label_txt = _("Name:");
argv[l_ii].entry_width = 250; /* pixel */
if(tabw == sgpp->stb_widgets)
{
argv[l_ii].help_txt = _("Name of the Storyboardfile");
argv[l_ii].text_buf_len = sizeof(sgpp->storyboard_filename);
argv[l_ii].text_buf_ret = &sgpp->storyboard_filename[0];
}
else
{
argv[l_ii].help_txt = _("Name of the Cliplistfile");
argv[l_ii].text_buf_len = sizeof(sgpp->cliplist_filename);
argv[l_ii].text_buf_ret = &sgpp->cliplist_filename[0];
}
}
else
{
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_LABEL_LEFT);
if(tabw == sgpp->stb_widgets)
{
label_txt = g_strdup_printf(_("Name: %s"), sgpp->storyboard_filename);
}
else
{
label_txt = g_strdup_printf(_("Name: %s"), sgpp->cliplist_filename);
}
argv[l_ii].label_txt = label_txt;
}
l_ii++; l_ii_width = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT_PAIR);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Width:");
argv[l_ii].help_txt = _("Master width of the resulting video in pixels");
argv[l_ii].int_min = (gint)1;
argv[l_ii].int_max = (gint)9999;
argv[l_ii].int_ret = (gint)l_master_width;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)l_master_width;
l_ii++; l_ii_height = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT_PAIR);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Height:");
argv[l_ii].help_txt = _("Master height of the resulting video in pixels)");
argv[l_ii].int_min = (gint)1;
argv[l_ii].int_max = (gint)9999;
argv[l_ii].int_ret = (gint)l_master_height;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)l_master_height;
l_ii++; l_ii_framerate = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_FLT_PAIR);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Framerate:");
argv[l_ii].help_txt = _("Framerate in frames/sec.");
argv[l_ii].flt_min = 0.0;
argv[l_ii].flt_max = 999;
argv[l_ii].flt_step = 0.1;
argv[l_ii].pagestep = 1.0;
argv[l_ii].flt_ret = GAP_STORY_DEFAULT_FRAMERATE;
if(stb_dst->master_framerate > 0)
{
argv[l_ii].flt_ret = stb_dst->master_framerate;
}
argv[l_ii].has_default = TRUE;
argv[l_ii].flt_default = argv[l_ii].flt_ret;
/* the toggle that controls layerstack order of videotracks */
l_ii++; l_ii_vtrack1_is_toplayer = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_TOGGLE);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Track 1 on top:");
argv[l_ii].help_txt = _("ON: video track1 is Foregrond (on top). "
"OFF: video track 1 is on Background.");
argv[l_ii].int_ret = (gint)stb_dst->master_vtrack1_is_toplayer;
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = (gint)1;
/* the aspect option entry widget */
l_ii++; l_ii_aspect = l_ii;
buf_aspect_string[0] = '\0';
l_decoder_idx = 0;
l_aspect_idx = 0;
if((stb_dst->master_aspect_width == 4)
&& (stb_dst->master_aspect_height == 3))
{
l_aspect_idx = 1;
}
if((stb_dst->master_aspect_width == 16)
&& (stb_dst->master_aspect_height == 9))
{
l_aspect_idx = 2;
}
if((stb_dst->master_aspect_width != 0)
&& (stb_dst->master_aspect_height != 0))
{
g_snprintf(buf_aspect_string
, sizeof(buf_aspect_string)
, "%d:%d"
, (int)stb_dst->master_aspect_width
, (int)stb_dst->master_aspect_height
);
}
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_OPT_ENTRY);
argv[l_ii].label_txt = _("Aspect:");
argv[l_ii].help_txt = _("Select video frame aspect ratio; "
"enter a string like \"4:3\" or \"16:9\" to specify the aspect. "
"Enter none or leave empty if no special aspect shall be used "
"(in this case video frames use the master pixelsize 1:1 "
"for displaying video frames).");
argv[l_ii].radio_argc = G_N_ELEMENTS(radio_aspect_args);
argv[l_ii].radio_argv = radio_aspect_args;
argv[l_ii].radio_ret = l_aspect_idx;
argv[l_ii].has_default = TRUE;
argv[l_ii].radio_default = 1;
argv[l_ii].text_buf_ret = buf_aspect_string;
argv[l_ii].text_buf_len = sizeof(buf_aspect_string);
argv[l_ii].text_buf_default = "4:3";
/* the preferred decoder */
l_ii++; l_ii_preferred_decoder = l_ii;
buf_preferred_decoder[0] = '\0';
l_decoder_idx = 0;
if(stb_dst->preferred_decoder)
{
if(*stb_dst->preferred_decoder != '\0')
{
guint jj;
g_snprintf(buf_preferred_decoder
, sizeof(buf_preferred_decoder)
, "%s"
, stb_dst->preferred_decoder
);
for(jj=0; jj < G_N_ELEMENTS(radio_args);jj++)
{
if(strcmp(radio_args[jj], buf_preferred_decoder) == 0)
{
l_decoder_idx = jj;
break;
}
}
}
}
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_OPT_ENTRY);
argv[l_ii].label_txt = _("Decoder:");
argv[l_ii].help_txt = _("Select preferred video decoder library, "
"or leave empty for automatic selection."
"The decoder setting is only relevant if "
"videoclips are used (but not for frames "
"that are imagefiles)");
argv[l_ii].radio_argc = G_N_ELEMENTS(radio_args);
argv[l_ii].radio_argv = radio_args;
argv[l_ii].radio_ret = l_decoder_idx;
argv[l_ii].has_default = TRUE;
argv[l_ii].radio_default = l_decoder_idx;
argv[l_ii].text_buf_ret = buf_preferred_decoder;
argv[l_ii].text_buf_len = sizeof(buf_preferred_decoder);
argv[l_ii].text_buf_default = g_strdup(buf_preferred_decoder);
l_ii++; l_ii_samplerate = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_INT_PAIR);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Samplerate:");
argv[l_ii].help_txt = _("Master audio samplerate for the resulting video in samples/sec.");
argv[l_ii].int_min = 0;
argv[l_ii].int_max = 48000;
argv[l_ii].int_ret = GAP_STORY_DEFAULT_SAMPLERATE;
if(stb_dst->master_samplerate > 0)
{
argv[l_ii].int_ret = stb_dst->master_samplerate;
}
argv[l_ii].has_default = TRUE;
argv[l_ii].int_default = argv[l_ii].int_ret;
l_ii++; l_ii_volume = l_ii;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_FLT_PAIR);
argv[l_ii].constraint = TRUE;
argv[l_ii].label_txt = _("Volume:");
argv[l_ii].help_txt = _("Master audio volume, where 1.0 keeps original volume");
argv[l_ii].flt_min = 0.0;
argv[l_ii].flt_max = 5.0;
argv[l_ii].flt_step = 0.1;
argv[l_ii].pagestep = 1.0;
argv[l_ii].flt_ret = stb_dst->master_volume;
if(stb_dst->master_volume < 0.0)
{
argv[l_ii].flt_ret = 1.0;
}
argv[l_ii].has_default = TRUE;
argv[l_ii].flt_default = argv[l_ii].flt_ret;
l_ii++;
l_master_insert_area_format[0] = '\0';
if (stb_dst->master_insert_area_format)
{
g_snprintf(&l_master_insert_area_format[0], sizeof(l_master_insert_area_format), "%s"
, stb_dst->master_insert_area_format
);
}
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_FILESEL);
argv[l_ii].label_txt = _("AreaFormat:");
argv[l_ii].entry_width = 250; /* pixel */
argv[l_ii].help_txt = _("Format string for area replacement in movie clips. (e.g automatic logo insert)"
"this string shall contain \%s as placeholder for the basename of a videoclip and "
"optional \%06d as placeholder for the framenumber.");
argv[l_ii].text_buf_len = sizeof(l_master_insert_area_format);
argv[l_ii].text_buf_ret = &l_master_insert_area_format[0];
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_DEFAULT_BUTTON);
argv[l_ii].label_txt = _("Reset"); /* should use GIMP_STOCK_RESET if possible */
argv[l_ii].help_txt = _("Reset parameters to inital values");
l_ii++;
gap_arr_arg_init(&argv[l_ii], GAP_ARR_WGT_HELP_BUTTON);
argv[l_ii].help_id = GAP_STB_MASTER_PROP_DLG_HELP_ID;
l_ii++;
l_rc = gap_arr_ok_cancel_dialog( _("Master Properties"),
_("Settings"),
G_N_ELEMENTS(argv), argv);
if(label_txt)
{
g_free(label_txt);
}
if((l_rc) && (sgpp->shell_window))
{
GapStoryBoard *stb_dup;
gap_stb_undo_push(tabw, GAP_STB_FEATURE_PROPERTIES_MASTER);
stb_dup = gap_story_duplicate_active_and_mask_section(stb_dst);
stb_dst->master_width = (gint32)(argv[l_ii_width].int_ret);
stb_dst->master_height = (gint32)(argv[l_ii_height].int_ret);
stb_dst->master_framerate = (gint32)(argv[l_ii_framerate].flt_ret);
stb_dst->master_vtrack1_is_toplayer = (argv[l_ii_vtrack1_is_toplayer].int_ret != 0);
p_parse_aspect_width_and_height(buf_aspect_string
, &stb_dst->master_aspect_width
, &stb_dst->master_aspect_height
);
stb_dst->master_aspect_ratio = 0.0;
if(stb_dst->master_aspect_height > 0)
{
stb_dst->master_aspect_ratio = (gdouble)stb_dst->master_aspect_width
/ (gdouble)stb_dst->master_aspect_height;
}
if(gap_debug)
{
printf("master_aspect_width: %d\n", (int)stb_dst->master_aspect_width );
printf("master_aspect_height: %d\n", (int)stb_dst->master_aspect_height );
}
stb_dst->master_samplerate = (gint32)(argv[l_ii_samplerate].int_ret);
stb_dst->master_volume = (gint32)(argv[l_ii_volume].flt_ret);
if(*buf_preferred_decoder)
{
if(stb_dst->preferred_decoder)
{
if(strcmp(stb_dst->preferred_decoder, buf_preferred_decoder) != 0)
{
stb_dst->unsaved_changes = TRUE;
g_free(stb_dst->preferred_decoder);
stb_dst->preferred_decoder = g_strdup(buf_preferred_decoder);
/* close the videohandle (if open)
* this ensures that the newly selected decoder
* can be used at the next videofile access attempt
*/
gap_story_vthumb_close_videofile(sgpp);
}
}
else
{
stb_dst->unsaved_changes = TRUE;
stb_dst->preferred_decoder = g_strdup(buf_preferred_decoder);
gap_story_vthumb_close_videofile(sgpp);
}
}
else
{
if(stb_dst->preferred_decoder)
{
stb_dst->unsaved_changes = TRUE;
g_free(stb_dst->preferred_decoder);
}
stb_dst->preferred_decoder = NULL;
}
if (l_master_insert_area_format[0] != '\0')
{
if (stb_dst->master_insert_area_format)
{
if (strcmp(stb_dst->master_insert_area_format, &l_master_insert_area_format[0]) != 0)
{
stb_dst->unsaved_changes = TRUE;
}
g_free(stb_dst->master_insert_area_format);
}
else
{
stb_dst->unsaved_changes = TRUE;
}
stb_dst->master_insert_area_format = g_strdup(&l_master_insert_area_format[0]);
}
else
{
if (stb_dst->master_insert_area_format)
{
stb_dst->unsaved_changes = TRUE;
g_free(stb_dst->master_insert_area_format);
stb_dst->master_insert_area_format = NULL;
}
}
/* check for further changes of master properties */
if((stb_dst->master_width != stb_dup->master_width)
|| (stb_dst->master_height != stb_dup->master_height)
|| (stb_dst->master_framerate != stb_dup->master_framerate)
|| (stb_dst->master_aspect_ratio != stb_dup->master_aspect_ratio)
|| (stb_dst->master_samplerate != stb_dup->master_samplerate)
|| (stb_dst->master_volume != stb_dup->master_volume)
|| (stb_dst->master_vtrack1_is_toplayer != stb_dup->master_vtrack1_is_toplayer)
)
{
stb_dst->unsaved_changes = TRUE;
}
gap_story_free_storyboard(&stb_dup);
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( stb_dst
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
p_widget_sensibility(sgpp);
}
tabw->master_dlg_open = FALSE;
} /* end p_tabw_master_prop_dialog */
/* ---------------------------------
* on_stb_elem_drag_begin
* ---------------------------------
*/
static void
on_stb_elem_drag_begin (GtkWidget *widget,
GdkDragContext *context,
GapStbFrameWidget *fw)
{
GapStbMainGlobalParams *sgpp;
GapStbTabWidgets *tabw;
if(gap_debug)
{
printf("on_stb_elem_drag_begin FW:%d\n", (int)fw);
}
if (fw == NULL) { return; }
if(fw->stb_elem_refptr == NULL) { return; }
tabw = (GapStbTabWidgets *)fw->tabw;
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
if(fw->pv_ptr)
{
if(sgpp->dnd_pixbuf)
{
g_object_unref(sgpp->dnd_pixbuf);
}
/* get the icon from (a duplicate of the) repaint buffer */
sgpp->dnd_pixbuf = gap_pview_get_repaint_pixbuf(fw->pv_ptr);
if(sgpp->dnd_pixbuf)
{
gtk_drag_set_icon_pixbuf(context
, sgpp->dnd_pixbuf
, -7 /* hot_x */
, -7 /* hot_y */
);
}
}
} /* end on_stb_elem_drag_begin */
/* ---------------------------------
* on_stb_elem_drag_get
* ---------------------------------
*/
static void
on_stb_elem_drag_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
GapStbFrameWidget *fw)
{
if(gap_debug)
{
printf("on_stb_elem_drag_get FW:%d, info:%d\n", (int)fw, (int)info);
}
if (fw)
{
if (info == GAP_STB_TARGET_STORYBOARD_ELEM)
{
gtk_selection_data_set (selection_data,
selection_data->target, 8,
(void *)&fw, sizeof(GapStbFrameWidget *));
}
}
} /* end on_stb_elem_drag_get */
/* ---------------------------------
* on_stb_elem_drag_delete
* ---------------------------------
*/
//static void
//on_stb_elem_drag_delete (GtkWidget *widget,
// GdkDragContext *context,
// GapStbFrameWidget *fw)
//{
//printf("on_stb_elem_drag_delete FW:%d\n", (int)fw);
//} /* end on_stb_elem_drag_delete */
/* ---------------------------------
* on_clip_elements_dropped
* ---------------------------------
* signal handler called when uri list
* was dropped onto a frame widget
* or another widget that can act as drop destination.
* (the thumbnail icon in a storyboard)
* Note:
* this implementation replaces the current selection,
* with the elements received from the DND drop operation.
*/
static void
on_clip_elements_dropped (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time)
{
GapStoryBoard *stb_dst;
GapStoryBoard *stb_bck_selection;
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
GapStbFrameWidget *fw;
GapStbFrameWidget *fw_drop;
GapStoryBoard *stb_src;
GapStbTabWidgets *tabw_src;
gint32 dest_story_id;
gboolean insert_after;
gboolean auto_created;
if(gap_debug)
{
printf(" ** >> DROP handler(COPY:%d MOVE:%d ) context->action:%d x:%d y:%d\n"
, (int)GDK_ACTION_COPY
, (int)GDK_ACTION_MOVE
, (int)context->action
, (int)x
, (int)y
);
}
fw_drop = NULL;
stb_src = NULL;
tabw_src = NULL;
insert_after = TRUE;
auto_created = FALSE;
dest_story_id = -2; /* unknown id for insert after last elem */
fw = g_object_get_data (G_OBJECT (widget)
, GAP_STORY_FW_PTR);
/* check if we were invoked from a frame widget */
if(fw != NULL)
{
if(fw->pv_ptr)
{
if(x < (fw->pv_ptr->pv_width / 2))
{
/* insert before fw if drop in the left part of the thumbnail preview */
insert_after = FALSE;
}
}
if(fw->stb_elem_refptr == NULL)
{
return;
}
dest_story_id = fw->stb_elem_refptr->story_id;
tabw = (GapStbTabWidgets *)fw->tabw;
}
else
{
/* check if we were invoked from another DND destination widget */
tabw = (GapStbTabWidgets *)g_object_get_data (G_OBJECT (widget)
, GAP_STORY_TABW_PTR);
}
if(tabw == NULL) { return; }
sgpp = (GapStbMainGlobalParams *)tabw->sgpp;
if(sgpp == NULL) { return; }
/* find out the destination story board
* (or create a new one if drop destination has none)
*/
stb_dst = p_get_or_auto_create_storyboard(sgpp, tabw, &auto_created);
if(stb_dst == NULL)
{
return;
}
/* save existing selection */
stb_bck_selection = sgpp->curr_selection;
switch (info)
{
case GAP_STB_TARGET_URILIST:
/* clear all selected flags in the destination list */
gap_story_selection_all_set(stb_dst, FALSE);
/* replace the current selection with elements we got from DND as uri list */
sgpp->curr_selection = p_dnd_selection_to_stb_list((const char *)selection_data->data
, tabw->vtrack);
break;
case GAP_STB_TARGET_STORYBOARD_ELEM:
{
GapStbFrameWidget **fw_drop_ptr;
fw_drop_ptr = (GapStbFrameWidget **)selection_data->data;
fw_drop = *fw_drop_ptr;
if(gap_debug)
{
printf("on_clip_elements_dropped FW_DROP:%d\n", (int)fw_drop);
}
if (fw_drop == NULL)
{
return;
}
tabw_src = (GapStbTabWidgets *)fw_drop->tabw;
if ((tabw_src == NULL)
|| ((tabw_src != sgpp->cll_widgets) && (tabw_src != sgpp->stb_widgets)))
{
/* if tabw of the droped frame widget
* is not equal to one of stb_widgets or cll_widgets
* assume that the sender was another application
* which is not supported for drop type GAP_STB_TARGET_STORYBOARD_ELEM.
*/
return;
}
stb_src = p_tabw_get_stb_ptr(tabw_src);
if (auto_created)
{
/* clone properties from the source storyboard
* because the stb_dst was created in this DND drop action
*/
gap_story_set_properties_like_sample_storyboard (stb_dst, stb_src);
}
/* select the storyboard elem referred by fw_drop */
if(fw_drop->stb_elem_refptr)
{
fw_drop->stb_elem_refptr->selected = TRUE;
}
p_tabw_edit_copy_cb(widget, tabw_src);
}
break;
default:
return;
}
if(sgpp->curr_selection != NULL)
{
if (gap_debug)
{
gap_story_debug_print_list(sgpp->curr_selection);
}
gap_stb_undo_group_begin(tabw);
gap_stb_undo_push(tabw, GAP_STB_FEATURE_DND_PASTE);
/* insert into destination list via standard paste operation */
p_tabw_edit_paste_at_story_id (sgpp
, stb_dst
, tabw
, dest_story_id
, insert_after
);
gap_stb_undo_group_end(tabw);
if ((info == GAP_STB_TARGET_STORYBOARD_ELEM)
&& (context->action == GDK_ACTION_MOVE)
&& (tabw_src != NULL)
&& (stb_src != NULL))
{
/* normally delete should be done in the handler for the "drag_data_delete"
* handler of the source widget, but this handler was NEVER called
* in my tests.
*/
gap_stb_undo_group_begin(tabw_src);
gap_stb_undo_push(tabw_src, GAP_STB_FEATURE_DND_CUT);
gap_story_selection_from_ref_list_orig_ids(
stb_src
, TRUE /* sel_state */
, sgpp->curr_selection
);
p_tabw_edit_cut_cb(widget, tabw_src);
gap_stb_undo_group_end(tabw_src);
}
}
if (info == GAP_STB_TARGET_URILIST)
{
/* restore selection as it was before the DND of uri-list caused paste */
sgpp->curr_selection = stb_bck_selection;
}
if (gap_debug)
{
printf(" ** << DROP handler end\n\n");
}
} /* end on_clip_elements_dropped */
/* ---------------------------------
* p_get_or_auto_create_storyboard
* ---------------------------------
* the flag auto_created is set to TRUE if auto creation was done.
*/
static GapStoryBoard *
p_get_or_auto_create_storyboard (GapStbMainGlobalParams *sgpp
, GapStbTabWidgets *tabw
, gboolean *auto_created)
{
GapStoryBoard *l_stb;
*auto_created = FALSE;
if(gap_debug) printf("p_get_or_auto_create_storyboard\n");
if(tabw == NULL) { return (NULL); }
if(sgpp == NULL) { return (NULL); }
l_stb = p_tabw_get_stb_ptr(tabw);
if(gap_debug)
{
printf("(STB_tabw:%d CLL_tabw:%d) TABW: %d\n"
, (int)sgpp->stb_widgets
, (int)sgpp->cll_widgets
, (int)tabw
);
printf("(stb:%d cll:%d)stb_dst: %d\n"
, (int)sgpp->stb
, (int)sgpp->cll
, (int)l_stb
);
}
if(l_stb == NULL)
{
/* auto create a default storyboard or cliplist */
*auto_created = TRUE;
l_stb = gap_story_new_story_board(_("STORY_new.txt"));
l_stb->master_type = tabw->type;
if(tabw->type == GAP_STB_MASTER_TYPE_CLIPLIST)
{
sgpp->cll = l_stb;
g_snprintf(sgpp->cliplist_filename, sizeof(sgpp->cliplist_filename)
, "%s", l_stb->storyboardfile);
tabw->filename_refptr = sgpp->cliplist_filename;
tabw->filename_maxlen = sizeof(sgpp->cliplist_filename);
}
else
{
sgpp->stb = l_stb;;
g_snprintf(sgpp->storyboard_filename, sizeof(sgpp->storyboard_filename)
, "%s", l_stb->storyboardfile);
tabw->filename_refptr = sgpp->storyboard_filename;
tabw->filename_maxlen = sizeof(sgpp->storyboard_filename);
}
/* refresh storyboard layout and thumbnail list widgets */
p_recreate_tab_widgets( l_stb
,tabw
,tabw->mount_col
,tabw->mount_row
,sgpp
);
p_render_all_frame_widgets(tabw);
p_tabw_update_frame_label_and_rowpage_limits(tabw, sgpp);
//p_widget_sensibility(sgpp);
}
return(l_stb);
} /* end p_get_or_auto_create_storyboard */
/* ---------------------------------
* p_dnd_selection_to_stb_list
* ---------------------------------
*/
static GapStoryBoard *
p_dnd_selection_to_stb_list(const char *uri_list, gint32 vtrack)
{
const gchar *p, *q;
GapStoryElem *list_root;
GapStoryElem *prev_elem;
GapStoryBoard *stb_dnd;
prev_elem = NULL;
list_root = NULL;
stb_dnd = NULL;
g_return_val_if_fail (uri_list != NULL, NULL);
p = uri_list;
/* We don't actually try to validate the URI according to RFC
* 2396, or even check for allowed characters - we just ignore
* comments and trim whitespace off the ends. We also
* allow LF delimination as well as the specified CRLF.
*
* We do allow comments like specified in RFC 2483.
*/
while (p)
{
if (*p != '#')
{
while (g_ascii_isspace(*p))
{
p++;
}
q = p;
while (*q && (*q != '\n') && (*q != '\r'))
{
q++;
}
if (q > p)
{
q--;
while (q > p && g_ascii_isspace (*q))
{
q--;
}
if (q > p)
{
gchar *uri;
GapStoryElem *elem;
uri = g_strndup (p, q - p + 1);
elem = p_check_and_convert_uri_to_stb_elem(uri, prev_elem, vtrack);
if (elem)
{
if(list_root == NULL)
{
list_root = elem;
}
else
{
prev_elem->next = elem;
}
prev_elem = elem;
}
g_free(uri);
}
}
}
p = strchr (p, '\n');
if (p)
{
p++;
}
}
if(list_root)
{
GapStorySection *stb_dnd_main_section;
stb_dnd = gap_story_new_story_board("StoryboardDND");
stb_dnd_main_section = gap_story_find_main_section(stb_dnd);
stb_dnd_main_section->stb_elem = list_root;
}
return (stb_dnd);
} /* end p_dnd_selection_to_stb_list */
/* -----------------------------------
* p_check_and_convert_uri_to_stb_elem
* -----------------------------------
* check if the specified uri refers to
* an existing local file and convert
* to storyboard element.
* return the converted elem
* return NULL in case where conversion was not possible
* or in case the element could be merged into prev_elem
*/
static GapStoryElem *
p_check_and_convert_uri_to_stb_elem(const char *uri, GapStoryElem *prev_elem, gint32 vtrack)
{
GapStoryElem *elem;
gchar *filename;
gchar *hostname;
const gchar *this_hostname;
gboolean is_localfile;
GError *error = NULL;
elem = NULL;
hostname = NULL;
filename = g_filename_from_uri (uri, &hostname, &error);
if(gap_debug)
{
printf("DND: p_check_and_convert_uri_to_stb_elem\nURI:%s\nfilename:%s\n"
,uri
,filename
);
}
if (filename == NULL)
{
g_warning ("Error getting dropped filename: %s\n",
error->message);
g_error_free (error);
return (NULL);
}
this_hostname = g_get_host_name();
is_localfile = FALSE;
if (hostname == NULL)
{
is_localfile = TRUE;
}
else
{
if ((strcmp (hostname, this_hostname) == 0)
|| (strcmp (hostname, "localhost") == 0))
{
is_localfile = TRUE;
}
}
if (is_localfile)
{
if(g_file_test(filename, G_FILE_TEST_EXISTS))
{
elem = p_create_stb_elem_from_filename(filename, vtrack);
if (p_check_and_merge_range_if_possible(elem, prev_elem) == TRUE)
{
/* elem could be merged as extended range of prev_elem
* dont need elem any longer in this case.
*/
gap_story_elem_free(&elem);
return (NULL);
}
}
}
return (elem);
} /* end p_check_and_convert_uri_to_stb_elem */
/* -----------------------------------
* p_check_and_merge_range_if_possible
* -----------------------------------
* check if both prev_elem and framename
* are from type GAP_STBREC_VID_FRAMES
* AND if elem is a frame image
* representing the the next frame
* in sequence of the prev_elem.
* if this is the case, then add the frame to prev_elem
* by incrementing the to_frame atribut by 1 and return TRUE.
* otherwise return FALSE.
*/
static gboolean
p_check_and_merge_range_if_possible(GapStoryElem *elem, GapStoryElem *prev_elem)
{
if (prev_elem == NULL)
{
return (FALSE);
}
if(elem->record_type != GAP_STBREC_VID_FRAMES)
{
return (FALSE);
}
if (prev_elem->record_type != GAP_STBREC_VID_FRAMES)
{
return (FALSE);
}
if ((strcmp (prev_elem->basename, prev_elem->basename) == 0)
&& (strcmp (prev_elem->ext, prev_elem->ext) == 0)
&& (elem->from_frame == prev_elem->to_frame +1))
{
/* extend prv_elem range to include the elem range */
prev_elem->to_frame = elem->to_frame;
return (TRUE);
}
return (FALSE);
} /* end p_check_and_merge_range_if_possible */
/* -----------------------------------
* p_create_stb_elem_from_filename
* -----------------------------------
*/
static GapStoryElem *
p_create_stb_elem_from_filename (const char *filename, gint32 vtrack)
{
GapStoryElem *stb_elem;
long current_frame;
if(gap_debug)
{
printf("p_create_stb_elem_from_filename file:%s\n", filename);
}
stb_elem = gap_story_new_elem(GAP_STBREC_VID_IMAGE);
stb_elem->orig_filename = g_strdup(filename);
stb_elem->track = vtrack;
stb_elem->from_frame = 1;
stb_elem->to_frame = 1;
stb_elem->nloop = 1;
stb_elem->nframes = 1;
current_frame = gap_story_upd_elem_from_filename(stb_elem, filename);
if (current_frame > 0)
{
stb_elem->from_frame = current_frame;
stb_elem->to_frame = current_frame;
}
if(gap_debug)
{
printf("p_create_stb_elem_from_filename current_frame:%d\n"
, (int)current_frame);
gap_story_debug_print_elem(stb_elem);
}
return (stb_elem);
} /* end p_create_stb_elem_from_filename */
/* ---------------------------------
* p_frame_widget_init_dnd
* ---------------------------------
* accept dropping of uri (filenames) from
* any applications.
* TODO: this drop should be restricted to GDK_ACTION_COPY
* but if we remove the GDK_ACTION_MOVE in the gtk_drag_dest_set
* call, move would be disabled too for the application internal
* drop-move of typ GAP_STB_TARGET_STORYBOARD_ELEM
* drag & drop support for storyboard elem
* only local in the same application.
*/
static void
p_frame_widget_init_dnd(GapStbFrameWidget *fw)
{
GtkWidget *widget;
static const GtkTargetEntry drop_types[] = {
{ "text/uri-list", 0, GAP_STB_TARGET_URILIST},
{ "application/gimp-gap-story-elem", GTK_TARGET_SAME_APP, GAP_STB_TARGET_STORYBOARD_ELEM}
};
static const gint n_drop_types = sizeof(drop_types)/sizeof(drop_types[0]);
static const GtkTargetEntry drag_types[] = {
{ "application/gimp-gap-story-elem", GTK_TARGET_SAME_APP, GAP_STB_TARGET_STORYBOARD_ELEM}
};
static const gint n_drag_types = sizeof(drag_types)/sizeof(drag_types[0]);
widget = fw->pv_ptr->da_widget;
g_object_set_data (G_OBJECT (widget), GAP_STORY_FW_PTR, (gpointer)fw);
gtk_drag_dest_set (GTK_WIDGET (widget),
GTK_DEST_DEFAULT_ALL,
drop_types, n_drop_types,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (widget, "drag_data_received",
G_CALLBACK (on_clip_elements_dropped), NULL);
gtk_drag_source_set (GTK_WIDGET (widget),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
drag_types, n_drag_types,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (widget, "drag_data_get",
G_CALLBACK (on_stb_elem_drag_get), fw);
g_signal_connect (widget, "drag_begin",
G_CALLBACK (on_stb_elem_drag_begin), fw);
/* the "drag_data_delete" event handler was never called in may test
* therefore was commented out, and workaround was
* implemented in the drop handler on_clip_elements_dropped
*/
//g_signal_connect (widget, "drag_data_delete",
// G_CALLBACK (on_stb_elem_drag_delete), fw);
if(gap_debug) printf("INIT FW:%d fw->tabw:%d\n", (int)fw, (int)fw->tabw);
} /* end p_frame_widget_init_dnd */
/* ---------------------------------
* p_widget_init_dnd_drop
* ---------------------------------
* accept dropping of uri (filenames) from
* any applications.
*/
static void
p_widget_init_dnd_drop(GtkWidget *widget, GapStbTabWidgets *tabw)
{
static const GtkTargetEntry drop_types[] = {
{ "text/uri-list", 0, GAP_STB_TARGET_URILIST},
{ "application/gimp-gap-story-elem", GTK_TARGET_SAME_APP, GAP_STB_TARGET_STORYBOARD_ELEM}
};
static const gint n_drop_types = sizeof(drop_types)/sizeof(drop_types[0]);
g_object_set_data (G_OBJECT (widget), GAP_STORY_TABW_PTR, (gpointer)tabw);
gtk_drag_dest_set (GTK_WIDGET (widget),
GTK_DEST_DEFAULT_ALL,
drop_types, n_drop_types,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (widget, "drag_data_received",
G_CALLBACK (on_clip_elements_dropped), NULL);
} /* end p_widget_init_dnd_drop */
/* ---------------------------------
* p_get_external_image_viewer
* ---------------------------------
* TODO: configuration via environment AND/OR gimprc
*/
static char *
p_get_external_image_viewer()
{
static char *defaultExternalImageViewer = "eog";
char *value_string;
value_string = gimp_gimprc_query("video_external_image_viewer");
if(value_string)
{
return(value_string);
}
return g_strdup(defaultExternalImageViewer);
} /* end p_get_external_image_viewer */
/* ---------------------------------
* p_frame_widget_preview_events_cb
* ---------------------------------
* handles events for all frame_widgets (in the dyn_table)
* - Expose of pview drawing_area
*/
static void
p_call_external_image_viewer(GapStbFrameWidget *fw)
{
gchar *imagename;
GapStbTabWidgets *tabw;
GapStbMainGlobalParams *sgpp;
tabw = (GapStbTabWidgets *)fw->tabw;
sgpp = fw->sgpp;
if((tabw) && (sgpp))
{
if(fw->stb_elem_refptr)
{
if(gap_story_elem_is_video(fw->stb_elem_refptr))
{
if((fw->stb_elem_refptr->record_type == GAP_STBREC_VID_SECTION)
|| (fw->stb_elem_refptr->record_type == GAP_STBREC_VID_BLACKSECTION))
{
return;
}
else
{
char *externalImageViewerCall;
char *externalImageViewer;
imagename = gap_story_get_filename_from_elem(fw->stb_elem_refptr);
externalImageViewer = p_get_external_image_viewer();
externalImageViewerCall = g_strdup_printf("%s %s &"
,p_get_external_image_viewer()
,imagename
);
system(externalImageViewerCall);
g_free(externalImageViewerCall);
g_free(imagename);
}
}
}
}
} /* end p_call_external_image_viewer */
|