Changeset 46
- Timestamp:
- 04/19/08 21:23:06 (8 months ago)
- Files:
-
- trunk/pihlaja/src/pihlaja/PihlajaMain.d (modified) (8 diffs)
- trunk/pihlaja/src/shiraz/canvas/PlainRectangle.d (modified) (14 diffs)
- trunk/pihlaja/src/shiraz/canvas/Rectangle.d (modified) (9 diffs)
- trunk/pihlaja/src/shiraz/ui/Button.d (modified) (1 diff)
- trunk/pihlaja/src/shiraz/ui/ProgressBar.d (modified) (1 diff)
- trunk/pihlaja/src/shiraz/ui/SubWindow.d (modified) (14 diffs)
- trunk/pihlaja/src/shiraz/ui/Window.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pihlaja/src/pihlaja/PihlajaMain.d
r45 r46 202 202 203 203 super(); 204 205 isDoubleSided = true; 204 206 205 207 initVideo(); … … 418 420 */ 419 421 420 //rename to render() draw() or similar.422 421 423 void render() 422 424 { … … 426 428 applyRotation(); 427 429 applyScale(); 430 431 applyCulling(); 428 432 applyColour(); 429 applyClipping();433 430 434 431 435 /*GLdouble eqn[4] = [0.0, 1.0, 0.0, 0.0]; // y < 0 … … 483 487 484 488 489 //TODO draw children... 490 //Check if it's just this simple: 491 applyClipping(); 492 doRend(); 493 endClipping(); 494 485 495 glPopMatrix(); 486 496 } … … 509 519 510 520 glEnable(GL_TEXTURE_2D); 521 522 //glEnable(GL_CULL_FACE); 511 523 512 524 /* … … 608 620 float hh = fs.h / TEXTURE_HEIGHT; 609 621 622 623 610 624 glColor4f( 1.0f, 1.0f, 1.0f, fs.alpha ); //Control Transparency 611 625 glBegin (GL_QUADS); … … 901 915 902 916 myWindow2 = new SubWindow("Viewer"); 917 918 myWindow2.side1.container.isDoubleSided = true;//BUG WEIRD. Why do I have to do this too? 919 903 920 //myWindow2.isRotate = true; 904 921 Trace.formatln("{}", myWindow2 ); … … 908 925 //myWindow2.colour( 0.2, 0.5, 0.3, 0.5 ); 909 926 myWindow2.signalMouseButtonPress.attach(&clickHandler); 927 928 myWindow2.side2.a = 0.5f;//TEMP hack. Side2 alpha to 0.5. 929 auto isInterlacedButton = new Button("Interlaced"); 930 isInterlacedButton.a = 0.5f; 931 isInterlacedButton.signalActivate.attach(&clickHandler3); 932 myWindow2.add2(isInterlacedButton); 910 933 911 934 myWindow2.add(videoViewer); trunk/pihlaja/src/shiraz/canvas/PlainRectangle.d
r45 r46 976 976 protected float _scale = 1.0f; 977 977 978 //If this Rectangle is double-sided or not. 979 //If it is, we'll use OpenGL culling to remove 980 //the back. 981 bool isDoubleSided() { return m_isDoubleSided; } 982 bool isDoubleSided(bool set) { return m_isDoubleSided = set; } 983 bool m_isDoubleSided = false; 984 978 985 //To draw an outline or not... 979 986 bool isOutline() { return m_isOutline; } … … 993 1000 applyScale(); 994 1001 1002 applyCulling(); 995 1003 applyTexture(); 996 1004 applyColour(); … … 1046 1054 } 1047 1055 1056 void applyCulling() 1057 { 1058 if( isDoubleSided == true ) 1059 glDisable(GL_CULL_FACE); 1060 else glEnable(GL_CULL_FACE); 1061 } 1062 //TODO endCulling() ??? 1063 1048 1064 void applyTexture() 1049 1065 { … … 1075 1091 applyScale(); 1076 1092 1093 applyCulling(); 1077 1094 applyTexture(); 1078 1095 applyColour(); … … 1444 1461 return _xPos + _ix1; 1445 1462 } 1463 public float x1N( float set )//N versions don't do arrange and invalidate automatically. 1464 { 1465 float delt = set - x1; 1466 _ix1 = _ix1 + (delt*0.5);//Move _ix1 half the delta. 1467 _xPos = _xPos + (delt*0.5);//Move xPos half the delta. 1468 _ix2 = _ix2 - (delt*0.5);//Move _ix2 half the delta to the other direction. 1469 //arrange(); 1470 //invalidate(); 1471 return _xPos + _ix1; 1472 } 1446 1473 public float ix1() { return _ix1; } 1447 1474 public float ix1( float set ) //{ return _ix1 = set; } … … 1450 1477 arrange(); 1451 1478 invalidate(); 1479 return _ix1; 1480 } 1481 public float ix1N( float set ) //{ return _ix1 = set; } 1482 { 1483 _ix1 = set; 1484 //arrange(); 1485 //invalidate(); 1452 1486 return _ix1; 1453 1487 } … … 1466 1500 return _yPos + _iy1; 1467 1501 } 1502 public float y1N( float set ) 1503 { 1504 float delt = set - y1; 1505 _iy1 = _iy1 + (delt*0.5);//Move _iy1 half the delta. 1506 _yPos = _yPos + (delt*0.5);//Move yPos half the delta. 1507 _iy2 = _iy2 - (delt*0.5);//Move _iy2 half the delta to the other direction. 1508 //arrange(); 1509 //invalidate(); 1510 return _yPos + _iy1; 1511 } 1468 1512 public float iy1() { return _iy1; } 1469 1513 public float iy1( float set ) //{ return _iy1 = set; } … … 1472 1516 arrange(); 1473 1517 invalidate(); 1518 return _iy1; 1519 } 1520 public float iy1N( float set ) //{ return _iy1 = set; } 1521 { 1522 _iy1 = set; 1523 //arrange(); 1524 //invalidate(); 1474 1525 return _iy1; 1475 1526 } … … 1488 1539 return _xPos + _ix2; 1489 1540 } 1541 public float x2N( float set ) 1542 { 1543 float delt = set - x2; 1544 _ix2 = _ix2 + (delt*0.5);//Move _ix2 half the delta. 1545 _xPos = _xPos + (delt*0.5);//Move xPos half the delta. 1546 _ix1 = _ix1 - (delt*0.5);//Move _ix1 half the delta to the other direction. 1547 //arrange(); 1548 //invalidate(); 1549 return _xPos + _ix2; 1550 } 1490 1551 1491 1552 public float ix2() { return _ix2; } … … 1495 1556 arrange(); 1496 1557 invalidate(); 1558 return _ix2; 1559 } 1560 public float ix2N( float set ) //{ return _ix2 = set; } 1561 { 1562 _ix2 = set; 1563 //arrange(); 1564 //invalidate(); 1497 1565 return _ix2; 1498 1566 } … … 1507 1575 arrange(); 1508 1576 invalidate(); 1577 return _ix2 - _ix1; 1578 } 1579 public float wN( float set ) 1580 { 1581 float delt = w - set; 1582 _ix1 = _ix1 + (delt*0.5);//Move _ix1 half the delta. 1583 _ix2 = _ix2 - (delt*0.5);//Move _ix2 half the delta. 1584 //arrange(); 1585 //invalidate(); 1509 1586 return _ix2 - _ix1; 1510 1587 } … … 1531 1608 return _yPos + _iy2; 1532 1609 } 1610 public float y2N( float set ) 1611 { 1612 float delt = set - y2; 1613 _iy2 = _iy2 + (delt*0.5);//Move _iy2 half the delta. 1614 _yPos = _yPos + (delt*0.5);//Move yPos half the delta. 1615 _iy1 = _iy1 - (delt*0.5);//Move _iy1 half the delta to the other direction. 1616 //arrange(); 1617 //invalidate(); 1618 return _yPos + _iy2; 1619 } 1533 1620 1534 1621 public float iy2() { return _iy2; } … … 1538 1625 arrange(); 1539 1626 invalidate(); 1627 return _iy2; 1628 } 1629 public float iy2N( float set ) //{ return _iy2 = set; } 1630 { 1631 _iy2 = set; 1632 //arrange(); 1633 //invalidate(); 1540 1634 return _iy2; 1541 1635 } … … 1550 1644 arrange(); 1551 1645 invalidate(); 1646 return _iy2 - _iy1; 1647 } 1648 public float hN( float set ) 1649 { 1650 float delt = h - set; 1651 _iy1 = _iy1 + (delt*0.5);//Move _iy1 half the delta. 1652 _iy2 = _iy2 - (delt*0.5);//Move _iy2 half the delta. 1653 //arrange(); 1654 //invalidate(); 1552 1655 return _iy2 - _iy1; 1553 1656 } trunk/pihlaja/src/shiraz/canvas/Rectangle.d
r45 r46 2632 2632 void arrange() 2633 2633 { 2634 //Trace.formatln(" This size: {}", toString() );2634 //Trace.formatln("arrange() {}", fullName() ); 2635 2635 2636 2636 //checkZOrder();//This isn't entirely necessary on most … … 2660 2660 //if( wid.hasMaxWidth == true && (w - (border*2.0)) > wid.maxWidth ) 2661 2661 if( wid.hasMaxHeight == true && (h - (wid.padding*2.0)) > wid.maxHeight ) 2662 wid.h = wid.maxHeight;//was wc()2662 wid.hN = wid.maxHeight;//was wc() 2663 2663 //else if( wid.hasMinWidth == true && (w - (border*2.0)) < wid.minWidth ) 2664 2664 else if( wid.hasMinHeight == true && (h - (wid.padding*2.0)) < wid.minHeight ) 2665 wid.h = wid.minHeight;//was wc()2665 wid.hN = wid.minHeight;//was wc() 2666 2666 else 2667 2667 //wid.wc = w - (border*2.0); 2668 wid.h = h - (wid.padding*2.0);//was wc()2668 wid.hN = h - (wid.padding*2.0);//was wc() 2669 2669 } 2670 2670 else if( wid.yPackOptions == PackOptions.SHRINK ) 2671 2671 { 2672 wid.h = h - (wid.padding*2.0);2672 wid.hN = h - (wid.padding*2.0); 2673 2673 } 2674 2674 … … 2677 2677 //if( wid.hasMaxWidth == true && (w - (border*2.0)) > wid.maxWidth ) 2678 2678 if( wid.hasMaxWidth == true && (w - (wid.padding*2.0)) > wid.maxWidth ) 2679 wid.w = wid.maxWidth;//was wc()2679 wid.wN = wid.maxWidth;//was wc() 2680 2680 //else if( wid.hasMinWidth == true && (w - (border*2.0)) < wid.minWidth ) 2681 2681 else if( wid.hasMinWidth == true && (w - (wid.padding*2.0)) < wid.minWidth ) 2682 wid.w = wid.minWidth;//was wc()2682 wid.wN = wid.minWidth;//was wc() 2683 2683 else 2684 2684 //wid.wc = w - (border*2.0); 2685 wid.w = w - (wid.padding*2.0);//was wc()2685 wid.wN = w - (wid.padding*2.0);//was wc() 2686 2686 } 2687 2687 else if( wid.yPackOptions == PackOptions.SHRINK ) 2688 2688 { 2689 wid.w = w - (wid.padding*2.0);2689 wid.wN = w - (wid.padding*2.0); 2690 2690 } 2691 2691 … … 2791 2791 //if( wid.hasMaxWidth == true && (w - (border*2.0)) > wid.maxWidth ) 2792 2792 if( wid.hasMaxHeight == true && (h - (wid.padding*2.0)) > wid.maxHeight ) 2793 wid.h = wid.maxHeight;//was wc()2793 wid.hN = wid.maxHeight;//was wc() 2794 2794 //else if( wid.hasMinWidth == true && (w - (border*2.0)) < wid.minWidth ) 2795 2795 else if( wid.hasMinHeight == true && (h - (wid.padding*2.0)) < wid.minHeight ) 2796 wid.h = wid.minHeight;//was wc()2796 wid.hN = wid.minHeight;//was wc() 2797 2797 else 2798 2798 //wid.wc = w - (border*2.0); 2799 wid.h = h - (wid.padding*2.0);//was wc()2799 wid.hN = h - (wid.padding*2.0);//was wc() 2800 2800 } 2801 2801 else if( wid.yPackOptions == PackOptions.SHRINK ) 2802 2802 { 2803 wid.h = h - (wid.padding*2.0);2803 wid.hN = h - (wid.padding*2.0); 2804 2804 } 2805 2805 … … 2810 2810 if( wid.hasMaxWidth == true && temp_width_shared > wid.maxWidth ) 2811 2811 { 2812 wid.w = wid.maxWidth;//was hc()2812 wid.wN = wid.maxWidth;//was hc() 2813 2813 debug(arrange) Trace.formatln("wid.w {} set to w.maxWidth {}", cast(double)wid.w, cast(double)wid.maxWidth ); 2814 2814 } 2815 2815 else if( wid.hasMinWidth == true && temp_width_shared < wid.minWidth ) 2816 2816 { 2817 wid.w = wid.minWidth;//was hc()2817 wid.wN = wid.minWidth;//was hc() 2818 2818 debug(arrange) Trace.formatln("wid.w {} set to w.minWidth {}", cast(double)wid.w, cast(double)wid.minWidth ); 2819 2819 } 2820 2820 else 2821 2821 { 2822 //wid.h = temp_height_shared;//was hc()2823 wid.w = width_left_for_one;2822 //wid.hN = temp_height_shared;//was hc() 2823 wid.wN = width_left_for_one; 2824 2824 debug(arrange) 2825 2825 { … … 2838 2838 if( wid.hasMinWidth == true && temp_width_shared > wid.minWidth ) 2839 2839 { 2840 wid.w = wid.minWidth;//was hc()2840 wid.wN = wid.minWidth;//was hc() 2841 2841 debug(arrange) Trace.formatln("wid.w {} set to w.minWidth {}", cast(double)wid.w, cast(double)wid.minWidth ); 2842 2842 } 2843 2843 else if( wid.defaultWidth < temp_width_shared ) 2844 2844 { 2845 wid.w = wid.defaultWidth;2845 wid.wN = wid.defaultWidth; 2846 2846 debug(arrange) Trace.formatln("wid.w {} set to w.defaultWidth {}", cast(double)wid.w, cast(double)wid.defaultWidth ); 2847 2847 } 2848 2848 else 2849 2849 { 2850 wid.w = temp_width_shared;2850 wid.wN = temp_width_shared; 2851 2851 debug(arrange) Trace.formatln("wid.w {} set to temp_width_shared {}", cast(double)wid.w, cast(double)temp_width_shared ); 2852 2852 } … … 2953 2953 //if( wid.hasMaxWidth == true && (w - (border*2.0)) > wid.maxWidth ) 2954 2954 if( wid.hasMaxWidth == true && (w - (wid.padding*2.0)) > wid.maxWidth ) 2955 wid.w = wid.maxWidth;//was wc()2955 wid.wN = wid.maxWidth;//was wc() 2956 2956 //else if( wid.hasMinWidth == true && (w - (border*2.0)) < wid.minWidth ) 2957 2957 else if( wid.hasMinWidth == true && (w - (wid.padding*2.0)) < wid.minWidth ) 2958 wid.w = wid.minWidth;//was wc()2958 wid.wN = wid.minWidth;//was wc() 2959 2959 else 2960 2960 //wid.wc = w - (border*2.0); 2961 wid.w = w - (wid.padding*2.0);//was wc()2961 wid.wN = w - (wid.padding*2.0);//was wc() 2962 2962 } 2963 2963 … … 2965 2965 { 2966 2966 if( wid.hasMaxHeight == true && temp_height_shared > wid.maxHeight ) 2967 wid.h = wid.maxHeight;//was hc()2967 wid.hN = wid.maxHeight;//was hc() 2968 2968 else if( wid.hasMinHeight == true && temp_height_shared < wid.minHeight ) 2969 wid.h = wid.minHeight;//was hc()2969 wid.hN = wid.minHeight;//was hc() 2970 2970 else 2971 //wid.h = temp_height_shared;//was hc()2972 wid.h = height_left_for_one;2971 //wid.hN = temp_height_shared;//was hc() 2972 wid.hN = height_left_for_one; 2973 2973 } 2974 2974 /* 2975 2975 else if( wid.yPackOptions == PackOptions.SHRINK ) 2976 2976 { 2977 wid.h = wid.defaultHeight;2977 wid.hN = wid.defaultHeight; 2978 2978 } 2979 2979 */ … … 3016 3016 if( parent !is null ) 3017 3017 parent.arrangeParent(); 3018 3019 invalidate(); 3018 3020 } 3019 3021 trunk/pihlaja/src/shiraz/ui/Button.d
r45 r46 171 171 applyScale(); 172 172 173 applyCulling(); 174 173 175 //float zero = 0.0f; 174 176 trunk/pihlaja/src/shiraz/ui/ProgressBar.d
r42 r46 53 53 { 54 54 super(); 55 56 name = "GradientRect"; 55 57 56 58 colour( 25.0f/255.0f, 35.0f/255.0f, 19.0f/255.0f, 1.0f); trunk/pihlaja/src/shiraz/ui/SubWindow.d
r45 r46 218 218 applyRotation(); 219 219 applyScale(); 220 applyClipping(); 220 221 applyCulling(); 221 222 applyTexture(); 222 223 applyColour(); … … 304 305 } 305 306 306 doRend(); 307 307 308 applyClipping(); 309 doRend(); 308 310 endClipping(); 309 311 … … 383 385 applyScale(); 384 386 387 applyCulling(); 388 389 385 390 //float zero = 0.0f; 386 391 … … 731 736 732 737 applyClipping(); 733 734 738 doRend(); 735 736 739 endClipping(); 737 740 … … 796 799 797 800 leftSeparator = new Rectangle(); 801 leftSeparator.name = "leftSeparator";//TEMP 798 802 //leftSeparator.maxWidth = 0.012f; 799 803 leftSeparator.maxWidth = 0.025f; … … 815 819 816 820 rightSeparator = new Rectangle(); 821 rightSeparator.name = "rightSeparator";//TEMP 817 822 //rightSeparator.maxWidth = 0.012f; 818 823 rightSeparator.maxWidth = 0.025f; … … 900 905 applyRotation(); 901 906 applyScale(); 902 applyClipping(); 907 908 applyCulling(); 903 909 //applyColour(); 904 910 … … 937 943 } 938 944 939 940 doRend(); 941 945 applyClipping(); 946 doRend(); 942 947 endClipping(); 943 948 … … 1083 1088 if( input.mouse.button[MouseButton.LEFT] == true ) 1084 1089 { 1085 controlWidget.x2 = controlWidget.x2 + input.mouse.xRel;1090 controlWidget.x2N = controlWidget.x2 + input.mouse.xRel; 1086 1091 controlWidget.y2 = controlWidget.y2 + input.mouse.yRel; 1087 1092 //myWindow4.moveTo( input.mouse.x, input.mouse.y ); … … 1129 1134 //bottomHeader.set( 0.0, h/2.0, w, 0.1 ); 1130 1135 }*/ 1136 1137 //Colour is overridden to control container widget. 1138 float r() { return ((container is null) ? _colour_data[0] : container.r); } 1139 float g() { return ((container is null) ? _colour_data[1] : container.g); } 1140 float b() { return ((container is null) ? _colour_data[2] : container.b); } 1141 float a() { return ((container is null) ? _colour_data[3] : container.a); } 1142 1143 1144 1145 float r( float set ) { return ((container is null) ? (_colour_data[0] = set) : (container.r = set)); } 1146 float g( float set ) { return ((container is null) ? (_colour_data[1] = set) : (container.g = set)); } 1147 float b( float set ) { return ((container is null) ? (_colour_data[2] = set) : (container.b = set)); } 1148 float a( float set ) { return ((container is null) ? (_colour_data[3] = set) : (container.a = set)); } 1149 1131 1150 1132 1151 //class Header? … … 1161 1180 super(); 1162 1181 1182 name = "Sides"; 1183 1163 1184 padding = 0.0f; 1164 1185 … … 1182 1203 applyRotation(); 1183 1204 applyScale(); 1184 1205 1185 1206 uint i = 0; 1186 1207 foreach( Rectangle rect; itemList ) … … 1198 1219 synchronized bool mouseEvent( InputState input )//THIS , bool bypass_hittest = false ) 1199 1220 { 1200 if( yRot == 0.0f || yRot == 360.0f)1221 if( yRot >= -90.0f && yRot <= 90.0f || yRot >= 270.0f && yRot <= 450.0f ) 1201 1222 { 1202 if( itemList.length !=0 )1223 if( itemList.length > 0 ) 1203 1224 return itemList[0].mouseEvent(input); 1225 } 1226 else if( yRot > 90.0f && yRot < 270.0f ) 1227 { 1228 if( itemList.length > 1 ) 1229 return itemList[1].mouseEvent(input); 1204 1230 } 1205 1231 … … 1281 1307 side1.prepend( a_widget ); 1282 1308 } 1309 1310 void add2( Rectangle a_widget ) 1311 { 1312 side2.append( a_widget ); 1313 } 1314 1315 void append2( Rectangle a_widget ) 1316 { 1317 side2.append( a_widget ); 1318 } 1319 1320 void prepend2( Rectangle a_widget ) 1321 { 1322 side2.prepend( a_widget ); 1323 } 1283 1324 1284 1325 PlainWindow side1; trunk/pihlaja/src/shiraz/ui/Window.d
r45 r46 835 835 debug(Hitting) Trace.formatln("Window.mouseEvent() START."); 836 836 debug(Hitting) scope(exit) Trace.formatln("Window.mouseEvent() END."); 837 838 //Trace.formatln("Window.mouseEvent() START."); 837 839 838 840 bool was_handled = false;
