comparison src/image-overlay.c @ 886:04c317fb7da0

Tidy up and code redundancy reduction.
author zas_
date Tue, 15 Jul 2008 14:32:00 +0000
parents c879a9a4f186
children e418c33a49c8
comparison
equal deleted inserted replaced
885:ad420f2eb789 886:04c317fb7da0
773 image_overlay_remove(osd->imd, osd->icon_id[flag]); 773 image_overlay_remove(osd->imd, osd->icon_id[flag]);
774 osd->icon_id[flag] = 0; 774 osd->icon_id[flag] = 0;
775 } 775 }
776 } 776 }
777 777
778 static void image_osd_icons_reset_time(OverlayStateData *osd)
779 {
780 gint i;
781
782 for (i = 0; i < IMAGE_OSD_COUNT; i++)
783 {
784 if (osd_icons[i].reset)
785 {
786 osd->icon_time[i] = 0;
787 }
788 }
789 }
790
791 static void image_osd_icons_update(OverlayStateData *osd)
792 {
793 gint i;
794
795 for (i = 0; i < IMAGE_OSD_COUNT; i++)
796 {
797 if (osd->icon_time[i] > 0)
798 {
799 image_osd_icon_show(osd, i);
800 }
801 else
802 {
803 image_osd_icon_hide(osd, i);
804 }
805 }
806 }
807
808 static void image_osd_icons_hide(OverlayStateData *osd)
809 {
810 gint i;
811
812 for (i = 0; i < IMAGE_OSD_COUNT; i++)
813 {
814 image_osd_icon_hide(osd, i);
815 }
816 }
817
778 static gint image_osd_update_cb(gpointer data) 818 static gint image_osd_update_cb(gpointer data)
779 { 819 {
780 OverlayStateData *osd = data; 820 OverlayStateData *osd = data;
781 821
782 osd->imd->overlay_show_zoom = FALSE; 822 osd->imd->overlay_show_zoom = FALSE;
817 } 857 }
818 } 858 }
819 859
820 if (osd->show & OSD_SHOW_STATUS) 860 if (osd->show & OSD_SHOW_STATUS)
821 { 861 {
822 gint i;
823
824 if (osd->changed_states & IMAGE_STATE_IMAGE) 862 if (osd->changed_states & IMAGE_STATE_IMAGE)
825 { 863 image_osd_icons_reset_time(osd);
826 for (i = 0; i < IMAGE_OSD_COUNT; i++) 864
827 {
828 if (osd_icons[i].reset) osd->icon_time[i] = 0;
829 }
830 }
831
832 if (osd->changed_states & IMAGE_STATE_COLOR_ADJ) 865 if (osd->changed_states & IMAGE_STATE_COLOR_ADJ)
833 { 866 {
834 osd->icon_time[IMAGE_OSD_COLOR] = IMAGE_OSD_DEFAULT_DURATION + 1; 867 osd->icon_time[IMAGE_OSD_COLOR] = IMAGE_OSD_DEFAULT_DURATION + 1;
835 image_osd_timer_schedule(osd); 868 image_osd_timer_schedule(osd);
836 } 869 }
847 880
848 osd->icon_time[IMAGE_OSD_ROTATE_AUTO] = n; 881 osd->icon_time[IMAGE_OSD_ROTATE_AUTO] = n;
849 image_osd_timer_schedule(osd); 882 image_osd_timer_schedule(osd);
850 } 883 }
851 884
852 for (i = 0; i < IMAGE_OSD_COUNT; i++) 885 image_osd_icons_update(osd);
853 {
854 if (osd->icon_time[i] > 0)
855 {
856 image_osd_icon_show(osd, i);
857 }
858 else
859 {
860 image_osd_icon_hide(osd, i);
861 }
862 }
863 } 886 }
864 else 887 else
865 { 888 {
866 gint i; 889 image_osd_icons_hide(osd);
867
868 for (i = 0; i < IMAGE_OSD_COUNT; i++)
869 {
870 image_osd_icon_hide(osd, i);
871 }
872 } 890 }
873 891
874 if (osd->imd->il && osd->imd->il->done) 892 if (osd->imd->il && osd->imd->il->done)
875 osd->changed_states = IMAGE_STATE_NONE; 893 osd->changed_states = IMAGE_STATE_NONE;
876 osd->idle_id = -1; 894 osd->idle_id = -1;
954 if (osd->idle_id != -1) g_source_remove(osd->idle_id); 972 if (osd->idle_id != -1) g_source_remove(osd->idle_id);
955 if (osd->timer_id != -1) g_source_remove(osd->timer_id); 973 if (osd->timer_id != -1) g_source_remove(osd->timer_id);
956 974
957 if (osd->imd) 975 if (osd->imd)
958 { 976 {
959 gint i;
960
961 image_set_osd_data(osd->imd, NULL); 977 image_set_osd_data(osd->imd, NULL);
962 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id); 978 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id);
963 979
964 image_set_state_func(osd->imd, NULL, NULL); 980 image_set_state_func(osd->imd, NULL, NULL);
965 image_overlay_remove(osd->imd, osd->ovl_info); 981 image_overlay_remove(osd->imd, osd->ovl_info);
966 982
967 for (i = 0; i < IMAGE_OSD_COUNT; i++) 983 image_osd_icons_hide(osd);
968 {
969 image_osd_icon_hide(osd, i);
970 }
971 } 984 }
972 985
973 if (osd->histogram) histogram_free(osd->histogram); 986 if (osd->histogram) histogram_free(osd->histogram);
974 987
975 g_free(osd); 988 g_free(osd);