equal
deleted
inserted
replaced
469 glxView invalidate. |
469 glxView invalidate. |
470 ] |
470 ] |
471 |
471 |
472 ! ! |
472 ! ! |
473 |
473 |
|
474 !GraphColumnView3D::GLXGraph class methodsFor:'constants'! |
|
475 |
|
476 maxColors |
|
477 ^ 256 |
|
478 ! ! |
|
479 |
474 !GraphColumnView3D::GLXGraph methodsFor:'event handling'! |
480 !GraphColumnView3D::GLXGraph methodsFor:'event handling'! |
475 |
481 |
476 buttonPress:button x:x y:y |
482 buttonPress:button x:x y:y |
477 "delegate button to graph |
483 "delegate button to graph |
478 " |
484 " |
496 initialize |
502 initialize |
497 "setup default values |
503 "setup default values |
498 " |
504 " |
499 super initialize. |
505 super initialize. |
500 |
506 |
501 type := #colorIndexDoubleBuffer. "/ works on any device |
507 type := #colorIndexDoubleBuffer. "/ works on any device |
502 colorMap := Dictionary new. |
508 maxY := 1.0. |
503 maxY := 1.0. |
509 minY := -1.0. |
504 minY := -1.0. |
|
505 |
510 |
506 removeFunc := false. |
511 removeFunc := false. |
507 removeRefs := false. |
512 removeRefs := false. |
508 removeGrid := false. |
513 removeGrid := false. |
509 removeAxis := false. |
514 removeAxis := false. |
734 |
739 |
735 shown ifTrue:[ |
740 shown ifTrue:[ |
736 self redrawInBackBuffer. |
741 self redrawInBackBuffer. |
737 self swapBuffers. |
742 self swapBuffers. |
738 ] ifFalse:[ |
743 ] ifFalse:[ |
739 colorMap := Dictionary new |
744 colorMap := nil |
740 ]. |
745 ]. |
741 |
746 |
|
747 |
|
748 ! |
|
749 |
|
750 initializeColorMap |
|
751 "setup colors |
|
752 " |
|
753 colorMap := Dictionary new. |
|
754 |
|
755 colorMap at:(Color black) put:Black. |
|
756 colorMap at:(Color white) put:White. |
|
757 colorMap at:(Color blue) put:Blue. |
|
758 colorMap at:(Color cyan) put:Cyan. |
|
759 colorMap at:(Color magenta) put:Magenta. |
|
760 colorMap at:(Color red) put:Red. |
|
761 colorMap at:(Color yellow) put:Yellow. |
|
762 colorMap at:(Color green) put:Green. |
742 |
763 |
743 ! |
764 ! |
744 |
765 |
745 redrawInBackBuffer |
766 redrawInBackBuffer |
746 "redraw in back |
767 "redraw in back |
747 " |
768 " |
748 |sY sX sZ noCols dY winSize w2 showRefs showGrid showFunc showAxis| |
769 |sY sX sZ noCols dY winSize w2 showRefs showGrid showFunc showAxis| |
|
770 |
|
771 colorMap isNil ifTrue:[ |
|
772 self initializeColorMap |
|
773 ]. |
749 |
774 |
750 self setColor:(graph backgroundColor). |
775 self setColor:(graph backgroundColor). |
751 self clear. |
776 self clear. |
752 |
777 |
753 loVCols isNil ifTrue:[ |
778 loVCols isNil ifTrue:[ |
814 |
839 |
815 setColor:aColor |
840 setColor:aColor |
816 |index useCol| |
841 |index useCol| |
817 |
842 |
818 useCol := aColor ? graph foregroundColor. |
843 useCol := aColor ? graph foregroundColor. |
819 |
844 index := colorMap at:useCol ifAbsent:nil. |
820 index := colorMap at:useCol ifAbsent:nil. |
|
821 |
845 |
822 index isNil ifTrue:[ |
846 index isNil ifTrue:[ |
823 index := colorMap size + self class numberOfStandardColors. |
847 index := colorMap size + self class numberOfStandardColors. |
824 colorMap at:(useCol on:device) put:index. |
848 |
825 |
849 ( (index > self class maxColors) |
826 self colorRed:(useCol red) green:(useCol green) blue:(useCol blue). |
850 or:[(useCol := useCol on:device) colorId isNil] |
827 |
851 ) ifTrue:[ |
828 self mapColor:index |
852 Transcript showCR:'cannot allocate more colors'. |
829 red:(useCol redByte) |
853 index := (useCol brightness > 0.5) ifTrue:[White] |
830 green:(useCol greenByte) |
854 ifFalse:[Black] |
831 blue:(useCol blueByte). |
855 ] ifFalse:[ |
|
856 colorMap at:useCol put:index. |
|
857 |
|
858 self colorRed:(useCol red) |
|
859 green:(useCol green) |
|
860 blue:(useCol blue). |
|
861 |
|
862 self mapColor:index |
|
863 red:(useCol redByte) |
|
864 green:(useCol greenByte) |
|
865 blue:(useCol blueByte) |
|
866 ] |
832 ]. |
867 ]. |
833 self color:index. |
868 self color:index. |
834 |
869 |
835 |
870 |
836 ! ! |
871 ! ! |
899 ! ! |
934 ! ! |
900 |
935 |
901 !GraphColumnView3D class methodsFor:'documentation'! |
936 !GraphColumnView3D class methodsFor:'documentation'! |
902 |
937 |
903 version |
938 version |
904 ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.5 1998-03-06 09:30:58 ca Exp $' |
939 ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView3D.st,v 1.6 1998-03-06 11:22:28 ca Exp $' |
905 ! ! |
940 ! ! |