Mercurial > hg > xemacs-beta
comparison src/toolbar-x.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 0e522484dd2a |
children | c42ec1d1cded |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
517 } | 517 } |
518 | 518 |
519 static void | 519 static void |
520 x_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change) | 520 x_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change) |
521 { | 521 { |
522 Lisp_Object frame = Qnil; | 522 Lisp_Object frame; |
523 struct device *d = XDEVICE (f->device); | 523 struct device *d = XDEVICE (f->device); |
524 int x, y, width, height, vert; | 524 int x, y, width, height, vert; |
525 | 525 |
526 get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1); | 526 get_toolbar_coords (f, pos, &x, &y, &width, &height, &vert, 1); |
527 XSETFRAME (frame, f); | 527 XSETFRAME (frame, f); |
685 /* We want the text area to stay the same size. So, we query the | 685 /* We want the text area to stay the same size. So, we query the |
686 current size and then adjust it for the change in the toolbar | 686 current size and then adjust it for the change in the toolbar |
687 size. */ | 687 size. */ |
688 | 688 |
689 in_specifier_change_function++; | 689 in_specifier_change_function++; |
690 | |
690 if (!in_resource_setting) | 691 if (!in_resource_setting) |
691 /* mirror the value in the frame resources, unless already done. */ | 692 /* mirror the value in the frame resources, unless already done. */ |
692 { | 693 Xt_SET_VALUE (FRAME_X_CONTAINER_WIDGET (f), |
693 Arg al [1]; | 694 pos == TOP_TOOLBAR ? XtNtopToolBarHeight : |
694 XtSetArg (al [0], | 695 pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight : |
695 pos == TOP_TOOLBAR ? XtNtopToolBarHeight : | 696 pos == LEFT_TOOLBAR ? XtNleftToolBarWidth : |
696 pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight : | 697 XtNrightToolBarWidth, |
697 pos == LEFT_TOOLBAR ? XtNleftToolBarWidth : | 698 newval); |
698 XtNrightToolBarWidth, | 699 |
699 newval); | |
700 XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1); | |
701 } | |
702 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) | 700 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) |
703 { | 701 { |
704 int change = newval - oldval; | 702 int change = newval - oldval; |
705 Lisp_Object new_visibility = f->toolbar_visible_p[pos]; | 703 Lisp_Object new_visibility = f->toolbar_visible_p[pos]; |
706 | 704 |
788 /* We want the text area to stay the same size. So, we query the | 786 /* We want the text area to stay the same size. So, we query the |
789 current size and then adjust it for the change in the toolbar | 787 current size and then adjust it for the change in the toolbar |
790 size. */ | 788 size. */ |
791 | 789 |
792 in_specifier_change_function++; | 790 in_specifier_change_function++; |
791 | |
793 if (!in_resource_setting) | 792 if (!in_resource_setting) |
794 /* mirror the value in the frame resources, unless already done. */ | 793 /* mirror the value in the frame resources, unless already done. */ |
795 { | 794 Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), |
796 Arg al [1]; | 795 pos == TOP_TOOLBAR ? XtNtopToolBarBorderWidth : |
797 XtSetArg (al [0], | 796 pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth : |
798 pos == TOP_TOOLBAR ? XtNtopToolBarBorderWidth : | 797 pos == LEFT_TOOLBAR ? XtNleftToolBarBorderWidth : |
799 pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth : | 798 XtNrightToolBarBorderWidth, |
800 pos == LEFT_TOOLBAR ? XtNleftToolBarBorderWidth : | 799 newval); |
801 XtNrightToolBarBorderWidth, | 800 |
802 newval); | |
803 XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1); | |
804 } | |
805 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) | 801 if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) |
806 { | 802 { |
807 int change = 2 * (newval - oldval); | 803 int change = 2 * (newval - oldval); |
808 | 804 |
809 req.request_mode = 0; | 805 req.request_mode = 0; |
836 | 832 |
837 static void | 833 static void |
838 x_initialize_frame_toolbar_gcs (struct frame *f) | 834 x_initialize_frame_toolbar_gcs (struct frame *f) |
839 { | 835 { |
840 EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); | 836 EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); |
837 EmacsFramePart *efp = &(ef->emacs_frame); | |
841 XGCValues gcv; | 838 XGCValues gcv; |
842 unsigned long flags = (GCForeground | GCBackground | GCGraphicsExposures); | 839 unsigned long flags = (GCForeground | GCBackground | GCGraphicsExposures); |
843 | 840 |
844 /* | 841 /* |
845 * If backgroundToolBarColor is specified, use it. | 842 * If backgroundToolBarColor is specified, use it. |
846 * Otherwise use the background resource. | 843 * Otherwise use the background resource. |
847 */ | 844 */ |
848 if (ef->emacs_frame.background_toolbar_pixel == -1) | 845 if (efp->background_toolbar_pixel == (Pixel) (-1)) |
849 ef->emacs_frame.background_toolbar_pixel = | 846 efp->background_toolbar_pixel = efp->background_pixel; |
850 ef->emacs_frame.background_pixel; | |
851 | 847 |
852 /* | 848 /* |
853 * #### | 849 * #### |
854 * If foregroundToolBarColor is specified, use it. | 850 * If foregroundToolBarColor is specified, use it. |
855 * Otherwise use the foreground resource. | 851 * Otherwise use the foreground resource. |
856 * | 852 * |
857 * The foreground pixel is currently unused, but will likely be | 853 * The foreground pixel is currently unused, but will likely be |
858 * used when toolbar captions are generated by the toolbar code | 854 * used when toolbar captions are generated by the toolbar code |
859 * instead being incorporated into the icon image. | 855 * instead being incorporated into the icon image. |
860 */ | 856 */ |
861 if (ef->emacs_frame.foreground_toolbar_pixel == -1) | 857 if (efp->foreground_toolbar_pixel == (Pixel) (-1)) |
862 ef->emacs_frame.foreground_toolbar_pixel = | 858 efp->foreground_toolbar_pixel = efp->foreground_pixel; |
863 ef->emacs_frame.foreground_pixel; | 859 |
864 | 860 gcv.foreground = efp->background_toolbar_pixel; |
865 gcv.foreground = ef->emacs_frame.background_toolbar_pixel; | |
866 gcv.background = ef->core.background_pixel; | 861 gcv.background = ef->core.background_pixel; |
867 gcv.graphics_exposures = False; | 862 gcv.graphics_exposures = False; |
868 FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f) = | 863 FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f) = |
869 XtGetGC ((Widget) ef, flags, &gcv); | 864 XtGetGC ((Widget) ef, flags, &gcv); |
870 | 865 |
871 if (ef->emacs_frame.top_toolbar_shadow_pixel == | 866 if (efp->top_toolbar_shadow_pixel == efp->bottom_toolbar_shadow_pixel) |
872 ef->emacs_frame.bottom_toolbar_shadow_pixel) | 867 { |
873 { | 868 efp->top_toolbar_shadow_pixel = efp->background_toolbar_pixel; |
874 ef->emacs_frame.top_toolbar_shadow_pixel = | 869 efp->bottom_toolbar_shadow_pixel = efp->background_toolbar_pixel; |
875 ef->emacs_frame.background_toolbar_pixel; | 870 } |
876 ef->emacs_frame.bottom_toolbar_shadow_pixel = | 871 |
877 ef->emacs_frame.background_toolbar_pixel; | 872 x_generate_shadow_pixels (f, &efp->top_toolbar_shadow_pixel, |
878 } | 873 &efp->bottom_toolbar_shadow_pixel, |
879 | 874 efp->background_toolbar_pixel, |
880 x_generate_shadow_pixels (f, &ef->emacs_frame.top_toolbar_shadow_pixel, | |
881 &ef->emacs_frame.bottom_toolbar_shadow_pixel, | |
882 ef->emacs_frame.background_toolbar_pixel, | |
883 ef->core.background_pixel); | 875 ef->core.background_pixel); |
884 | 876 |
885 gcv.foreground = ef->emacs_frame.top_toolbar_shadow_pixel; | 877 gcv.foreground = efp->top_toolbar_shadow_pixel; |
886 gcv.background = ef->core.background_pixel; | 878 gcv.background = ef->core.background_pixel; |
887 gcv.graphics_exposures = False; | 879 gcv.graphics_exposures = False; |
888 flags = GCForeground | GCBackground | GCGraphicsExposures; | 880 flags = GCForeground | GCBackground | GCGraphicsExposures; |
889 if (ef->emacs_frame.top_toolbar_shadow_pixmap) | 881 if (efp->top_toolbar_shadow_pixmap) |
890 { | 882 { |
891 gcv.fill_style = FillOpaqueStippled; | 883 gcv.fill_style = FillOpaqueStippled; |
892 gcv.stipple = ef->emacs_frame.top_toolbar_shadow_pixmap; | 884 gcv.stipple = efp->top_toolbar_shadow_pixmap; |
893 flags |= GCStipple | GCFillStyle; | 885 flags |= GCStipple | GCFillStyle; |
894 } | 886 } |
895 FRAME_X_TOOLBAR_TOP_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv); | 887 FRAME_X_TOOLBAR_TOP_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv); |
896 | 888 |
897 gcv.foreground = ef->emacs_frame.bottom_toolbar_shadow_pixel; | 889 gcv.foreground = efp->bottom_toolbar_shadow_pixel; |
898 gcv.background = ef->core.background_pixel; | 890 gcv.background = ef->core.background_pixel; |
899 gcv.graphics_exposures = False; | 891 gcv.graphics_exposures = False; |
900 flags = GCForeground | GCBackground | GCGraphicsExposures; | 892 flags = GCForeground | GCBackground | GCGraphicsExposures; |
901 if (ef->emacs_frame.bottom_toolbar_shadow_pixmap) | 893 if (efp->bottom_toolbar_shadow_pixmap) |
902 { | 894 { |
903 gcv.fill_style = FillOpaqueStippled; | 895 gcv.fill_style = FillOpaqueStippled; |
904 gcv.stipple = ef->emacs_frame.bottom_toolbar_shadow_pixmap; | 896 gcv.stipple = efp->bottom_toolbar_shadow_pixmap; |
905 flags |= GCStipple | GCFillStyle; | 897 flags |= GCStipple | GCFillStyle; |
906 } | 898 } |
907 FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv); | 899 FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv); |
908 | 900 |
909 #ifdef HAVE_XPM | 901 #ifdef HAVE_XPM |
937 #endif | 929 #endif |
938 XtReleaseGC (ew, FRAME_X_TOOLBAR_TOP_SHADOW_GC (f)); | 930 XtReleaseGC (ew, FRAME_X_TOOLBAR_TOP_SHADOW_GC (f)); |
939 XtReleaseGC (ew, FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f)); | 931 XtReleaseGC (ew, FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f)); |
940 | 932 |
941 /* Seg fault if we try and use these again. */ | 933 /* Seg fault if we try and use these again. */ |
942 FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f) = (GC) - 1; | 934 FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f) = (GC) - 1; |
943 FRAME_X_TOOLBAR_PIXMAP_BACKGROUND_GC (f) = (GC) - 1; | 935 FRAME_X_TOOLBAR_PIXMAP_BACKGROUND_GC (f) = (GC) - 1; |
944 FRAME_X_TOOLBAR_TOP_SHADOW_GC (f) = (GC) - 1; | 936 FRAME_X_TOOLBAR_TOP_SHADOW_GC (f) = (GC) - 1; |
945 FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f) = (GC) - 1; | 937 FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f) = (GC) - 1; |
946 } | 938 } |
947 | 939 |
948 static void | 940 static void |
949 x_initialize_frame_toolbars (struct frame *f) | 941 x_initialize_frame_toolbars (struct frame *f) |
950 { | 942 { |
951 EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); | 943 EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); |
952 | 944 |
953 if (ef->emacs_frame.toolbar_shadow_thickness < MINIMUM_SHADOW_THICKNESS) | 945 if (ef->emacs_frame.toolbar_shadow_thickness < MINIMUM_SHADOW_THICKNESS) |
954 { | 946 Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), |
955 Arg al [1]; | 947 XtNtoolBarShadowThickness, MINIMUM_SHADOW_THICKNESS); |
956 XtSetArg (al [0], XtNtoolBarShadowThickness, MINIMUM_SHADOW_THICKNESS); | |
957 XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1); | |
958 } | |
959 | 948 |
960 x_initialize_frame_toolbar_gcs (f); | 949 x_initialize_frame_toolbar_gcs (f); |
961 } | 950 } |
962 | 951 |
963 /* This only calls one function but we go ahead and create this in | 952 /* This only calls one function but we go ahead and create this in |