diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
commit | 526b5580dabbfed7cfe5439dc3a90ec727f563c2 (patch) | |
tree | 22b1af92348785daad16714ee5e2b633017e0e48 /apps/plugins/pdbox/PDa/src/g_all_guis.c | |
parent | 4f2dfcc01b260d946044ef2b6af5fe36cb772c8d (diff) | |
download | rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.gz rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.zip |
Cut the files in half and it might work better (note to self: check your tree is really clean before patching)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21070 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_all_guis.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_all_guis.c | 661 |
1 files changed, 0 insertions, 661 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_all_guis.c b/apps/plugins/pdbox/PDa/src/g_all_guis.c index 9254bafebd..74a7656492 100644 --- a/apps/plugins/pdbox/PDa/src/g_all_guis.c +++ b/apps/plugins/pdbox/PDa/src/g_all_guis.c | |||
@@ -660,665 +660,4 @@ int iem_fstyletoint(t_iem_fstyle_flags *fstylep) | |||
660 | { | 660 | { |
661 | return ((fstylep->x_font_style << 0) & 63); | 661 | return ((fstylep->x_font_style << 0) & 63); |
662 | } | 662 | } |
663 | /* Copyright (c) 1997-1999 Miller Puckette. | ||
664 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
665 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ | ||
666 | |||
667 | /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ | ||
668 | /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ | ||
669 | |||
670 | |||
671 | #include <stdlib.h> | ||
672 | #include <string.h> | ||
673 | #include <stdio.h> | ||
674 | #include <ctype.h> | ||
675 | #include "m_pd.h" | ||
676 | #include "g_canvas.h" | ||
677 | #include "t_tk.h" | ||
678 | #include "g_all_guis.h" | ||
679 | #include <math.h> | ||
680 | |||
681 | #ifdef MSW | ||
682 | #include <io.h> | ||
683 | #else | ||
684 | #include <unistd.h> | ||
685 | #endif | ||
686 | |||
687 | /* #define GGEE_HSLIDER_COMPATIBLE */ | ||
688 | |||
689 | /*------------------ global varaibles -------------------------*/ | ||
690 | |||
691 | int iemgui_color_hex[]= | ||
692 | { | ||
693 | 16579836, 10526880, 4210752, 16572640, 16572608, | ||
694 | 16579784, 14220504, 14220540, 14476540, 16308476, | ||
695 | 14737632, 8158332, 2105376, 16525352, 16559172, | ||
696 | 15263784, 1370132, 2684148, 3952892, 16003312, | ||
697 | 12369084, 6316128, 0, 9177096, 5779456, | ||
698 | 7874580, 2641940, 17488, 5256, 5767248 | ||
699 | }; | ||
700 | |||
701 | int iemgui_vu_db2i[]= | ||
702 | { | ||
703 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
704 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
705 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
706 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
707 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
708 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
709 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
710 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
711 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||
712 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
713 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
714 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
715 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
716 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | ||
717 | 9, 9, 9, 9, 9,10,10,10,10,10, | ||
718 | 11,11,11,11,11,12,12,12,12,12, | ||
719 | 13,13,13,13,14,14,14,14,15,15, | ||
720 | 15,15,16,16,16,16,17,17,17,18, | ||
721 | 18,18,19,19,19,20,20,20,21,21, | ||
722 | 22,22,23,23,24,24,25,26,27,28, | ||
723 | 29,30,31,32,33,33,34,34,35,35, | ||
724 | 36,36,37,37,37,38,38,38,39,39, | ||
725 | 39,39,39,39,40,40 | ||
726 | }; | ||
727 | |||
728 | int iemgui_vu_col[]= | ||
729 | { | ||
730 | 0,17,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, | ||
731 | 15,15,15,15,15,15,15,15,15,15,14,14,13,13,13,13,13,13,13,13,13,13,13,19,19,19 | ||
732 | }; | ||
733 | |||
734 | char *iemgui_vu_scale_str[]= | ||
735 | { | ||
736 | "", | ||
737 | "<-99", | ||
738 | "", | ||
739 | "", | ||
740 | "", | ||
741 | "-50", | ||
742 | "", | ||
743 | "", | ||
744 | "", | ||
745 | "-30", | ||
746 | "", | ||
747 | "", | ||
748 | "", | ||
749 | "-20", | ||
750 | "", | ||
751 | "", | ||
752 | "", | ||
753 | "-12", | ||
754 | "", | ||
755 | "", | ||
756 | "", | ||
757 | "-6", | ||
758 | "", | ||
759 | "", | ||
760 | "", | ||
761 | "-2", | ||
762 | "", | ||
763 | "", | ||
764 | "", | ||
765 | "-0dB", | ||
766 | "", | ||
767 | "", | ||
768 | "", | ||
769 | "+2", | ||
770 | "", | ||
771 | "", | ||
772 | "", | ||
773 | "+6", | ||
774 | "", | ||
775 | "", | ||
776 | "", | ||
777 | ">+12", | ||
778 | "", | ||
779 | "", | ||
780 | "", | ||
781 | "", | ||
782 | "", | ||
783 | }; | ||
784 | |||
785 | |||
786 | /*------------------ global functions -------------------------*/ | ||
787 | |||
788 | 663 | ||
789 | int iemgui_clip_size(int size) | ||
790 | { | ||
791 | if(size < IEM_GUI_MINSIZE) | ||
792 | size = IEM_GUI_MINSIZE; | ||
793 | return(size); | ||
794 | } | ||
795 | |||
796 | int iemgui_clip_font(int size) | ||
797 | { | ||
798 | if(size < IEM_FONT_MINSIZE) | ||
799 | size = IEM_FONT_MINSIZE; | ||
800 | return(size); | ||
801 | } | ||
802 | |||
803 | int iemgui_modulo_color(int col) | ||
804 | { | ||
805 | while(col >= IEM_GUI_MAX_COLOR) | ||
806 | col -= IEM_GUI_MAX_COLOR; | ||
807 | while(col < 0) | ||
808 | col += IEM_GUI_MAX_COLOR; | ||
809 | return(col); | ||
810 | } | ||
811 | |||
812 | t_symbol *iemgui_raute2dollar(t_symbol *s) | ||
813 | { | ||
814 | if (s->s_name[0] == '#') | ||
815 | { | ||
816 | char buf[MAXPDSTRING]; | ||
817 | strncpy(buf, s->s_name, MAXPDSTRING); | ||
818 | buf[MAXPDSTRING-1] = 0; | ||
819 | buf[0] = '$'; | ||
820 | return (gensym(buf)); | ||
821 | } | ||
822 | else return (s); | ||
823 | } | ||
824 | |||
825 | t_symbol *iemgui_dollar2raute(t_symbol *s) | ||
826 | { | ||
827 | if (s->s_name[0] == '$') | ||
828 | { | ||
829 | char buf[MAXPDSTRING]; | ||
830 | strncpy(buf, s->s_name, MAXPDSTRING); | ||
831 | buf[MAXPDSTRING-1] = 0; | ||
832 | buf[0] = '#'; | ||
833 | return (gensym(buf)); | ||
834 | } | ||
835 | else return (s); | ||
836 | } | ||
837 | |||
838 | void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui) | ||
839 | { | ||
840 | iemgui->x_fsf.x_put_in2out = 1; | ||
841 | if(iemgui->x_fsf.x_snd_able && iemgui->x_fsf.x_rcv_able) | ||
842 | { | ||
843 | if(!strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name)) | ||
844 | iemgui->x_fsf.x_put_in2out = 0; | ||
845 | } | ||
846 | } | ||
847 | |||
848 | t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv) | ||
849 | { | ||
850 | if (IS_A_SYMBOL(argv, indx)) | ||
851 | return (atom_getsymbolarg(indx, 100000, argv)); | ||
852 | else if (IS_A_FLOAT(argv, indx)) | ||
853 | { | ||
854 | char str[80]; | ||
855 | sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv)); | ||
856 | return (gensym(str)); | ||
857 | } | ||
858 | else return (gensym("empty")); | ||
859 | } | ||
860 | |||
861 | void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv) | ||
862 | { | ||
863 | if (argv) | ||
864 | { | ||
865 | iemgui->x_snd = iemgui_new_dogetname(iemgui, indx, argv); | ||
866 | iemgui->x_rcv = iemgui_new_dogetname(iemgui, indx+1, argv); | ||
867 | iemgui->x_lab = iemgui_new_dogetname(iemgui, indx+2, argv); | ||
868 | } | ||
869 | else iemgui->x_snd = iemgui->x_rcv = iemgui->x_lab = gensym("empty"); | ||
870 | iemgui->x_snd_unexpanded = iemgui->x_rcv_unexpanded = | ||
871 | iemgui->x_lab_unexpanded = 0; | ||
872 | iemgui->x_binbufindex = indx; | ||
873 | iemgui->x_labelbindex = indx + 3; | ||
874 | } | ||
875 | |||
876 | /* convert symbols in "$" form to the expanded symbols */ | ||
877 | void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym) | ||
878 | { | ||
879 | /* save unexpanded ones for later */ | ||
880 | iemgui->x_snd_unexpanded = srlsym[0]; | ||
881 | iemgui->x_rcv_unexpanded = srlsym[1]; | ||
882 | iemgui->x_lab_unexpanded = srlsym[2]; | ||
883 | srlsym[0] = canvas_realizedollar(iemgui->x_glist, srlsym[0]); | ||
884 | srlsym[1] = canvas_realizedollar(iemgui->x_glist, srlsym[1]); | ||
885 | srlsym[2] = canvas_realizedollar(iemgui->x_glist, srlsym[2]); | ||
886 | } | ||
887 | |||
888 | /* initialize a single symbol in unexpanded form. We reach into the | ||
889 | binbuf to grab them; if there's nothing there, set it to the | ||
890 | fallback; if still nothing, set to "empty". */ | ||
891 | static void iemgui_init_sym2dollararg(t_iemgui *iemgui, t_symbol **symp, | ||
892 | int indx, t_symbol *fallback) | ||
893 | { | ||
894 | if (!*symp) | ||
895 | { | ||
896 | t_binbuf *b = iemgui->x_obj.ob_binbuf; | ||
897 | if (binbuf_getnatom(b) > indx) | ||
898 | { | ||
899 | char buf[80]; | ||
900 | atom_string(binbuf_getvec(b) + indx, buf, 80); | ||
901 | *symp = gensym(buf); | ||
902 | } | ||
903 | else if (fallback) | ||
904 | *symp = fallback; | ||
905 | else *symp = gensym("empty"); | ||
906 | } | ||
907 | } | ||
908 | |||
909 | /* get the unexpanded versions of the symbols; initialize them if | ||
910 | necessary. */ | ||
911 | void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym) | ||
912 | { | ||
913 | iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded, | ||
914 | iemgui->x_binbufindex+1, iemgui->x_snd); | ||
915 | iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded, | ||
916 | iemgui->x_binbufindex+2, iemgui->x_rcv); | ||
917 | iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded, | ||
918 | iemgui->x_labelbindex, iemgui->x_lab); | ||
919 | srlsym[0] = iemgui->x_snd_unexpanded; | ||
920 | srlsym[1] = iemgui->x_rcv_unexpanded; | ||
921 | srlsym[2] = iemgui->x_lab_unexpanded; | ||
922 | } | ||
923 | |||
924 | void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym) | ||
925 | { | ||
926 | /* delete this function */ | ||
927 | } | ||
928 | |||
929 | void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol) | ||
930 | { | ||
931 | bflcol[0] = -1 - (((0xfc0000 & iemgui->x_bcol) >> 6)| | ||
932 | ((0xfc00 & iemgui->x_bcol) >> 4)|((0xfc & iemgui->x_bcol) >> 2)); | ||
933 | bflcol[1] = -1 - (((0xfc0000 & iemgui->x_fcol) >> 6)| | ||
934 | ((0xfc00 & iemgui->x_fcol) >> 4)|((0xfc & iemgui->x_fcol) >> 2)); | ||
935 | bflcol[2] = -1 - (((0xfc0000 & iemgui->x_lcol) >> 6)| | ||
936 | ((0xfc00 & iemgui->x_lcol) >> 4)|((0xfc & iemgui->x_lcol) >> 2)); | ||
937 | } | ||
938 | |||
939 | void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol) | ||
940 | { | ||
941 | if(bflcol[0] < 0) | ||
942 | { | ||
943 | bflcol[0] = -1 - bflcol[0]; | ||
944 | iemgui->x_bcol = ((bflcol[0] & 0x3f000) << 6)|((bflcol[0] & 0xfc0) << 4)| | ||
945 | ((bflcol[0] & 0x3f) << 2); | ||
946 | } | ||
947 | else | ||
948 | { | ||
949 | bflcol[0] = iemgui_modulo_color(bflcol[0]); | ||
950 | iemgui->x_bcol = iemgui_color_hex[bflcol[0]]; | ||
951 | } | ||
952 | if(bflcol[1] < 0) | ||
953 | { | ||
954 | bflcol[1] = -1 - bflcol[1]; | ||
955 | iemgui->x_fcol = ((bflcol[1] & 0x3f000) << 6)|((bflcol[1] & 0xfc0) << 4)| | ||
956 | ((bflcol[1] & 0x3f) << 2); | ||
957 | } | ||
958 | else | ||
959 | { | ||
960 | bflcol[1] = iemgui_modulo_color(bflcol[1]); | ||
961 | iemgui->x_fcol = iemgui_color_hex[bflcol[1]]; | ||
962 | } | ||
963 | if(bflcol[2] < 0) | ||
964 | { | ||
965 | bflcol[2] = -1 - bflcol[2]; | ||
966 | iemgui->x_lcol = ((bflcol[2] & 0x3f000) << 6)|((bflcol[2] & 0xfc0) << 4)| | ||
967 | ((bflcol[2] & 0x3f) << 2); | ||
968 | } | ||
969 | else | ||
970 | { | ||
971 | bflcol[2] = iemgui_modulo_color(bflcol[2]); | ||
972 | iemgui->x_lcol = iemgui_color_hex[bflcol[2]]; | ||
973 | } | ||
974 | } | ||
975 | |||
976 | int iemgui_compatible_col(int i) | ||
977 | { | ||
978 | int j; | ||
979 | |||
980 | if(i >= 0) | ||
981 | { | ||
982 | j = iemgui_modulo_color(i); | ||
983 | return(iemgui_color_hex[(j)]); | ||
984 | } | ||
985 | else | ||
986 | return((-1 -i)&0xffffff); | ||
987 | } | ||
988 | |||
989 | void iemgui_all_dollar2raute(t_symbol **srlsym) | ||
990 | { | ||
991 | srlsym[0] = iemgui_dollar2raute(srlsym[0]); | ||
992 | srlsym[1] = iemgui_dollar2raute(srlsym[1]); | ||
993 | srlsym[2] = iemgui_dollar2raute(srlsym[2]); | ||
994 | } | ||
995 | |||
996 | void iemgui_all_raute2dollar(t_symbol **srlsym) | ||
997 | { | ||
998 | srlsym[0] = iemgui_raute2dollar(srlsym[0]); | ||
999 | srlsym[1] = iemgui_raute2dollar(srlsym[1]); | ||
1000 | srlsym[2] = iemgui_raute2dollar(srlsym[2]); | ||
1001 | } | ||
1002 | |||
1003 | void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s) | ||
1004 | { | ||
1005 | t_symbol *snd; | ||
1006 | int pargc, tail_len, nth_arg, sndable=1, oldsndrcvable=0; | ||
1007 | t_atom *pargv; | ||
1008 | |||
1009 | if(iemgui->x_fsf.x_rcv_able) | ||
1010 | oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; | ||
1011 | if(iemgui->x_fsf.x_snd_able) | ||
1012 | oldsndrcvable += IEM_GUI_OLD_SND_FLAG; | ||
1013 | |||
1014 | if(!strcmp(s->s_name, "empty")) sndable = 0; | ||
1015 | snd = iemgui_raute2dollar(s); | ||
1016 | iemgui->x_snd_unexpanded = snd; | ||
1017 | iemgui->x_snd = snd = canvas_realizedollar(iemgui->x_glist, snd); | ||
1018 | post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name, | ||
1019 | iemgui->x_snd->s_name); | ||
1020 | |||
1021 | iemgui->x_fsf.x_snd_able = sndable; | ||
1022 | iemgui_verify_snd_ne_rcv(iemgui); | ||
1023 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable); | ||
1024 | } | ||
1025 | |||
1026 | void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s) | ||
1027 | { | ||
1028 | t_symbol *rcv; | ||
1029 | int pargc, tail_len, nth_arg, rcvable=1, oldsndrcvable=0; | ||
1030 | t_atom *pargv; | ||
1031 | |||
1032 | if(iemgui->x_fsf.x_rcv_able) | ||
1033 | oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; | ||
1034 | if(iemgui->x_fsf.x_snd_able) | ||
1035 | oldsndrcvable += IEM_GUI_OLD_SND_FLAG; | ||
1036 | |||
1037 | if(!strcmp(s->s_name, "empty")) rcvable = 0; | ||
1038 | rcv = iemgui_raute2dollar(s); | ||
1039 | iemgui->x_rcv_unexpanded = rcv; | ||
1040 | iemgui->x_rcv = rcv = canvas_realizedollar(iemgui->x_glist, rcv); | ||
1041 | if(rcvable) | ||
1042 | { | ||
1043 | if(strcmp(rcv->s_name, iemgui->x_rcv->s_name)) | ||
1044 | { | ||
1045 | if(iemgui->x_fsf.x_rcv_able) | ||
1046 | pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1047 | iemgui->x_rcv = rcv; | ||
1048 | pd_bind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1049 | } | ||
1050 | } | ||
1051 | else if(!rcvable && iemgui->x_fsf.x_rcv_able) | ||
1052 | { | ||
1053 | pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1054 | iemgui->x_rcv = rcv; | ||
1055 | } | ||
1056 | iemgui->x_fsf.x_rcv_able = rcvable; | ||
1057 | iemgui_verify_snd_ne_rcv(iemgui); | ||
1058 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable); | ||
1059 | } | ||
1060 | |||
1061 | void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s) | ||
1062 | { | ||
1063 | t_symbol *lab; | ||
1064 | int pargc, tail_len, nth_arg; | ||
1065 | t_atom *pargv; | ||
1066 | |||
1067 | lab = iemgui_raute2dollar(s); | ||
1068 | iemgui->x_lab_unexpanded = lab; | ||
1069 | iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab); | ||
1070 | |||
1071 | if(glist_isvisible(iemgui->x_glist)) | ||
1072 | sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n", | ||
1073 | glist_getcanvas(iemgui->x_glist), x, | ||
1074 | strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:""); | ||
1075 | } | ||
1076 | |||
1077 | void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) | ||
1078 | { | ||
1079 | iemgui->x_ldx = (int)atom_getintarg(0, ac, av); | ||
1080 | iemgui->x_ldy = (int)atom_getintarg(1, ac, av); | ||
1081 | if(glist_isvisible(iemgui->x_glist)) | ||
1082 | sys_vgui(".x%x.c coords %xLABEL %d %d\n", | ||
1083 | glist_getcanvas(iemgui->x_glist), x, | ||
1084 | iemgui->x_obj.te_xpix+iemgui->x_ldx, | ||
1085 | iemgui->x_obj.te_ypix+iemgui->x_ldy); | ||
1086 | } | ||
1087 | |||
1088 | void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) | ||
1089 | { | ||
1090 | int f = (int)atom_getintarg(0, ac, av); | ||
1091 | |||
1092 | if(f == 1) strcpy(iemgui->x_font, "helvetica"); | ||
1093 | else if(f == 2) strcpy(iemgui->x_font, "times"); | ||
1094 | else | ||
1095 | { | ||
1096 | f = 0; | ||
1097 | strcpy(iemgui->x_font, "courier"); | ||
1098 | } | ||
1099 | iemgui->x_fsf.x_font_style = f; | ||
1100 | f = (int)atom_getintarg(1, ac, av); | ||
1101 | if(f < 4) | ||
1102 | f = 4; | ||
1103 | iemgui->x_fontsize = f; | ||
1104 | if(glist_isvisible(iemgui->x_glist)) | ||
1105 | sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n", | ||
1106 | glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize); | ||
1107 | } | ||
1108 | |||
1109 | void iemgui_size(void *x, t_iemgui *iemgui) | ||
1110 | { | ||
1111 | if(glist_isvisible(iemgui->x_glist)) | ||
1112 | { | ||
1113 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); | ||
1114 | canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); | ||
1115 | } | ||
1116 | } | ||
1117 | |||
1118 | void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) | ||
1119 | { | ||
1120 | iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av); | ||
1121 | iemgui->x_obj.te_ypix += (int)atom_getintarg(1, ac, av); | ||
1122 | if(glist_isvisible(iemgui->x_glist)) | ||
1123 | { | ||
1124 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); | ||
1125 | canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); | ||
1126 | } | ||
1127 | } | ||
1128 | |||
1129 | void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) | ||
1130 | { | ||
1131 | iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av); | ||
1132 | iemgui->x_obj.te_ypix = (int)atom_getintarg(1, ac, av); | ||
1133 | if(glist_isvisible(iemgui->x_glist)) | ||
1134 | { | ||
1135 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); | ||
1136 | canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); | ||
1137 | } | ||
1138 | } | ||
1139 | |||
1140 | void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) | ||
1141 | { | ||
1142 | iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av)); | ||
1143 | if(ac > 2) | ||
1144 | { | ||
1145 | iemgui->x_fcol = iemgui_compatible_col(atom_getintarg(1, ac, av)); | ||
1146 | iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(2, ac, av)); | ||
1147 | } | ||
1148 | else | ||
1149 | iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av)); | ||
1150 | if(glist_isvisible(iemgui->x_glist)) | ||
1151 | (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_CONFIG); | ||
1152 | } | ||
1153 | |||
1154 | void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy) | ||
1155 | { | ||
1156 | t_iemguidummy *x = (t_iemguidummy *)z; | ||
1157 | |||
1158 | x->x_gui.x_obj.te_xpix += dx; | ||
1159 | x->x_gui.x_obj.te_ypix += dy; | ||
1160 | (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_MOVE); | ||
1161 | canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z); | ||
1162 | } | ||
1163 | |||
1164 | void iemgui_select(t_gobj *z, t_glist *glist, int selected) | ||
1165 | { | ||
1166 | t_iemguidummy *x = (t_iemguidummy *)z; | ||
1167 | |||
1168 | x->x_gui.x_fsf.x_selected = selected; | ||
1169 | (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT); | ||
1170 | } | ||
1171 | |||
1172 | void iemgui_delete(t_gobj *z, t_glist *glist) | ||
1173 | { | ||
1174 | canvas_deletelinesfor(glist, (t_text *)z); | ||
1175 | } | ||
1176 | |||
1177 | void iemgui_vis(t_gobj *z, t_glist *glist, int vis) | ||
1178 | { | ||
1179 | t_iemguidummy *x = (t_iemguidummy *)z; | ||
1180 | |||
1181 | if (vis) | ||
1182 | (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_NEW); | ||
1183 | else | ||
1184 | (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_ERASE); | ||
1185 | } | ||
1186 | |||
1187 | void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol) | ||
1188 | { | ||
1189 | srl[0] = iemgui->x_snd; | ||
1190 | srl[1] = iemgui->x_rcv; | ||
1191 | srl[2] = iemgui->x_lab; | ||
1192 | iemgui_all_sym2dollararg(iemgui, srl); | ||
1193 | iemgui_all_col2save(iemgui, bflcol); | ||
1194 | } | ||
1195 | |||
1196 | void iemgui_properties(t_iemgui *iemgui, t_symbol **srl) | ||
1197 | { | ||
1198 | srl[0] = iemgui->x_snd; | ||
1199 | srl[1] = iemgui->x_rcv; | ||
1200 | srl[2] = iemgui->x_lab; | ||
1201 | iemgui_all_sym2dollararg(iemgui, srl); | ||
1202 | iemgui_all_dollar2raute(srl); | ||
1203 | } | ||
1204 | |||
1205 | int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv) | ||
1206 | { | ||
1207 | char str[144]; | ||
1208 | int init = (int)atom_getintarg(5, argc, argv); | ||
1209 | int ldx = (int)atom_getintarg(10, argc, argv); | ||
1210 | int ldy = (int)atom_getintarg(11, argc, argv); | ||
1211 | int f = (int)atom_getintarg(12, argc, argv); | ||
1212 | int fs = (int)atom_getintarg(13, argc, argv); | ||
1213 | int bcol = (int)atom_getintarg(14, argc, argv); | ||
1214 | int fcol = (int)atom_getintarg(15, argc, argv); | ||
1215 | int lcol = (int)atom_getintarg(16, argc, argv); | ||
1216 | int sndable=1, rcvable=1, oldsndrcvable=0; | ||
1217 | |||
1218 | if(iemgui->x_fsf.x_rcv_able) | ||
1219 | oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; | ||
1220 | if(iemgui->x_fsf.x_snd_able) | ||
1221 | oldsndrcvable += IEM_GUI_OLD_SND_FLAG; | ||
1222 | if(IS_A_SYMBOL(argv,7)) | ||
1223 | srl[0] = atom_getsymbolarg(7, argc, argv); | ||
1224 | else if(IS_A_FLOAT(argv,7)) | ||
1225 | { | ||
1226 | sprintf(str, "%d", (int)atom_getintarg(7, argc, argv)); | ||
1227 | srl[0] = gensym(str); | ||
1228 | } | ||
1229 | if(IS_A_SYMBOL(argv,8)) | ||
1230 | srl[1] = atom_getsymbolarg(8, argc, argv); | ||
1231 | else if(IS_A_FLOAT(argv,8)) | ||
1232 | { | ||
1233 | sprintf(str, "%d", (int)atom_getintarg(8, argc, argv)); | ||
1234 | srl[1] = gensym(str); | ||
1235 | } | ||
1236 | if(IS_A_SYMBOL(argv,9)) | ||
1237 | srl[2] = atom_getsymbolarg(9, argc, argv); | ||
1238 | else if(IS_A_FLOAT(argv,9)) | ||
1239 | { | ||
1240 | sprintf(str, "%d", (int)atom_getintarg(9, argc, argv)); | ||
1241 | srl[2] = gensym(str); | ||
1242 | } | ||
1243 | if(init != 0) init = 1; | ||
1244 | iemgui->x_isa.x_loadinit = init; | ||
1245 | if(!strcmp(srl[0]->s_name, "empty")) sndable = 0; | ||
1246 | if(!strcmp(srl[1]->s_name, "empty")) rcvable = 0; | ||
1247 | iemgui_all_raute2dollar(srl); | ||
1248 | iemgui_all_dollararg2sym(iemgui, srl); | ||
1249 | if(rcvable) | ||
1250 | { | ||
1251 | if(strcmp(srl[1]->s_name, iemgui->x_rcv->s_name)) | ||
1252 | { | ||
1253 | if(iemgui->x_fsf.x_rcv_able) | ||
1254 | pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1255 | iemgui->x_rcv = srl[1]; | ||
1256 | pd_bind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1257 | } | ||
1258 | } | ||
1259 | else if(!rcvable && iemgui->x_fsf.x_rcv_able) | ||
1260 | { | ||
1261 | pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); | ||
1262 | iemgui->x_rcv = srl[1]; | ||
1263 | } | ||
1264 | iemgui->x_snd = srl[0]; | ||
1265 | iemgui->x_fsf.x_snd_able = sndable; | ||
1266 | iemgui->x_fsf.x_rcv_able = rcvable; | ||
1267 | iemgui->x_lcol = lcol & 0xffffff; | ||
1268 | iemgui->x_fcol = fcol & 0xffffff; | ||
1269 | iemgui->x_bcol = bcol & 0xffffff; | ||
1270 | iemgui->x_lab = srl[2]; | ||
1271 | iemgui->x_ldx = ldx; | ||
1272 | iemgui->x_ldy = ldy; | ||
1273 | if(f == 1) strcpy(iemgui->x_font, "helvetica"); | ||
1274 | else if(f == 2) strcpy(iemgui->x_font, "times"); | ||
1275 | else | ||
1276 | { | ||
1277 | f = 0; | ||
1278 | strcpy(iemgui->x_font, "courier"); | ||
1279 | } | ||
1280 | iemgui->x_fsf.x_font_style = f; | ||
1281 | if(fs < 4) | ||
1282 | fs = 4; | ||
1283 | iemgui->x_fontsize = fs; | ||
1284 | iemgui_verify_snd_ne_rcv(iemgui); | ||
1285 | return(oldsndrcvable); | ||
1286 | } | ||
1287 | |||
1288 | void iem_inttosymargs(t_iem_init_symargs *symargp, int n) | ||
1289 | { | ||
1290 | memset(symargp, 0, sizeof(*symargp)); | ||
1291 | symargp->x_loadinit = (n >> 0); | ||
1292 | symargp->x_scale = (n >> 20); | ||
1293 | symargp->x_flashed = 0; | ||
1294 | symargp->x_locked = 0; | ||
1295 | symargp->x_reverse = 0; | ||
1296 | symargp->dummy = 0; | ||
1297 | } | ||
1298 | |||
1299 | int iem_symargstoint(t_iem_init_symargs *symargp) | ||
1300 | { | ||
1301 | return ( | ||
1302 | (((symargp->x_loadinit & 1) << 0) | | ||
1303 | ((symargp->x_scale & 1) << 20))); | ||
1304 | } | ||
1305 | |||
1306 | void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n) | ||
1307 | { | ||
1308 | memset(fstylep, 0, sizeof(*fstylep)); | ||
1309 | fstylep->x_font_style = (n >> 0); | ||
1310 | fstylep->x_shiftdown = 0; | ||
1311 | fstylep->x_selected = 0; | ||
1312 | fstylep->x_finemoved = 0; | ||
1313 | fstylep->x_put_in2out = 0; | ||
1314 | fstylep->x_change = 0; | ||
1315 | fstylep->x_thick = 0; | ||
1316 | fstylep->x_lin0_log1 = 0; | ||
1317 | fstylep->x_steady = 0; | ||
1318 | fstylep->dummy = 0; | ||
1319 | } | ||
1320 | |||
1321 | int iem_fstyletoint(t_iem_fstyle_flags *fstylep) | ||
1322 | { | ||
1323 | return ((fstylep->x_font_style << 0) & 63); | ||
1324 | } | ||