Changeset 2866
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Makefile.in ¶
r2773 r2866 108 108 $(INSTALL) -d $(prefix)/bin; \ 109 109 $(INSTALL) -d $(prefix)/share/applications; \ 110 $(INSTALL) -d $(prefix)/share/dwtest /gtk; \110 $(INSTALL) -d $(prefix)/share/dwtest; \ 111 111 $(INSTALL) dwtest $(prefix)/bin; \ 112 112 $(INSTALL) org.dbsoft.dwindows.dwtest.desktop $(prefix)/share/applications/; \ 113 $(INSTALL) image/test.png $(prefix)/share/dwtest /; \114 $(INSTALL) gtk/file.xpm $(prefix)/share/dwtest /gtk; \115 $(INSTALL) gtk/folder.xpm $(prefix)/share/dwtest /gtk113 $(INSTALL) image/test.png $(prefix)/share/dwtest; \ 114 $(INSTALL) gtk/file.xpm $(prefix)/share/dwtest; \ 115 $(INSTALL) gtk/folder.xpm $(prefix)/share/dwtest 116 116 117 117 installdwcompat: $(SYSCONF_LINK_TARGET2) … … 141 141 rm -f $(prefix)/share/man/man1/dwindows-config.1.gz 142 142 rm -f $(prefix)/share/dwtest/test.png 143 rm -f $(prefix)/share/dwtest/ gtk/file.xpm144 rm -f $(prefix)/share/dwtest/ gtk/folder.xpm143 rm -f $(prefix)/share/dwtest/file.xpm 144 rm -f $(prefix)/share/dwtest/folder.xpm 145 145 146 146 deb: dist -
TabularUnified trunk/dwtest.c ¶
r2863 r2866 2251 2251 foldericon = dw_icon_load_from_file(pathbuff); 2252 2252 if(foldericon) 2253 strncpy(foldericonpath, pathbuff, 102 4);2253 strncpy(foldericonpath, pathbuff, 1025); 2254 2254 strncpy(&pathbuff[pos], "file", 1024-pos); 2255 2255 fileicon = dw_icon_load_from_file(pathbuff); 2256 2256 if(fileicon) 2257 strncpy(fileiconpath, pathbuff, 102 4);2257 strncpy(fileiconpath, pathbuff, 1025); 2258 2258 } 2259 2259 -
TabularUnified trunk/gtk/dw.c ¶
r2762 r2866 4610 4610 { 4611 4611 dw_window_set_bitmap(bitmap, id, NULL); 4612 gtk_container_add 4612 gtk_container_add(GTK_CONTAINER(tmp), bitmap); 4613 4613 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_bitmap", bitmap); 4614 4614 } … … 4641 4641 /* Now on to the image stuff */ 4642 4642 bitmap = dw_bitmap_new(id); 4643 if ( bitmap)4644 { 4645 dw_window_set_bitmap( bitmap, 0, filename);4643 if(bitmap) 4644 { 4645 dw_window_set_bitmap(bitmap, 0, filename); 4646 4646 gtk_container_add (GTK_CONTAINER(tmp), bitmap); 4647 4647 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_bitmap", bitmap); … … 4675 4675 bitmap = dw_bitmap_new(id); 4676 4676 4677 if ( bitmap)4677 if(bitmap) 4678 4678 { 4679 4679 dw_window_set_bitmap_from_data(bitmap, 0, data, len); 4680 gtk_container_add 4680 gtk_container_add(GTK_CONTAINER(tmp), bitmap); 4681 4681 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_bitmap", bitmap); 4682 4682 } … … 4910 4910 * Windows and a pixmap on Unix, pass 4911 4911 * NULL if you use the id param) 4912 */ 4913 void dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) 4912 * Returns: 4913 * DW_ERROR_NONE on success. 4914 * DW_ERROR_UNKNOWN if the parameters were invalid. 4915 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 4916 */ 4917 int dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) 4914 4918 { 4915 4919 #if GTK_MAJOR_VERSION > 1 … … 4919 4923 GdkPixmap *tmp = NULL; 4920 4924 #endif 4921 int found_ext = 0;4922 int i;4923 int _dw_locked_by_me = FALSE;4925 int i, found_ext = 0; 4926 int _dw_locked_by_me = FALSE; 4927 int retval = DW_ERROR_UNKNOWN; 4924 4928 4925 4929 if(!id && !filename) 4926 return ;4930 return retval; 4927 4931 4928 4932 DW_MUTEX_LOCK; … … 4940 4944 #endif 4941 4945 4942 if 4946 if(!file) 4943 4947 { 4944 4948 DW_MUTEX_UNLOCK; 4945 return ;4949 return DW_ERROR_GENERAL; 4946 4950 } 4947 4951 … … 4949 4953 4950 4954 /* check if we can read from this file (it exists and read permission) */ 4951 if ( access(file, 04 ) != 0)4955 if(access(file, 04 ) != 0) 4952 4956 { 4953 4957 /* Try with various extentions */ 4954 for ( i = 0; i < NUM_EXTS; i++)4958 for(i = 0; i < NUM_EXTS; i++) 4955 4959 { 4956 strcpy( file, filename);4957 strcat( file, _dw_image_exts[i]);4958 if ( access( file, 04 ) == 0)4960 strcpy(file, filename); 4961 strcat(file, _dw_image_exts[i]); 4962 if(access( file, 04 ) == 0) 4959 4963 { 4960 4964 found_ext = 1; … … 4962 4966 } 4963 4967 } 4964 if ( found_ext == 0)4968 if(found_ext == 0) 4965 4969 { 4966 4970 DW_MUTEX_UNLOCK; 4967 return ;4971 return DW_ERROR_GENERAL; 4968 4972 } 4969 4973 } 4970 4974 #if GTK_MAJOR_VERSION > 1 4971 pixbuf = gdk_pixbuf_new_from_file(file, NULL 4975 pixbuf = gdk_pixbuf_new_from_file(file, NULL); 4972 4976 #elif defined(USE_IMLIB) 4973 4977 image = gdk_imlib_load_image(file); … … 4982 4986 4983 4987 #if GTK_MAJOR_VERSION > 1 4984 if 4988 if(pixbuf) 4985 4989 #else 4986 if 4987 #endif 4988 { 4989 if ( GTK_IS_BUTTON(handle))4990 if(tmp) 4991 #endif 4992 { 4993 if(GTK_IS_BUTTON(handle)) 4990 4994 { 4991 4995 #if GTK_MAJOR_VERSION > 1 4992 GtkWidget *pixmap = (GtkWidget *)gtk_object_get_data( GTK_OBJECT(handle), "_dw_bitmap");4996 GtkWidget *pixmap = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_bitmap"); 4993 4997 if(pixmap) 4994 4998 { 4995 4999 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), pixbuf); 5000 retval = DW_ERROR_NONE; 4996 5001 } 4997 5002 #else 4998 5003 GtkWidget *pixmap = GTK_BUTTON(handle)->child; 4999 5004 gtk_pixmap_set(GTK_PIXMAP(pixmap), tmp, bitmap); 5000 #endif 5001 } 5002 else 5003 { 5005 retval = DW_ERROR_NONE; 5006 #endif 5007 } 5004 5008 #if GTK_MAJOR_VERSION > 1 5009 else if(GTK_IS_IMAGE(handle)) 5010 { 5005 5011 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), pixbuf); 5006 5012 #else 5013 else if(GTK_IS_PIXMAP(handle)) 5014 { 5007 5015 gtk_pixmap_set(GTK_PIXMAP(handle), tmp, bitmap); 5008 5016 #endif 5017 retval = DW_ERROR_NONE; 5009 5018 } 5010 5019 } … … 5014 5023 #endif 5015 5024 DW_MUTEX_UNLOCK; 5025 return retval; 5016 5026 } 5017 5027 … … 5026 5036 * NULL if you use the id param) 5027 5037 * len: length of data 5028 */ 5029 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) 5038 * Returns: 5039 * DW_ERROR_NONE on success. 5040 * DW_ERROR_UNKNOWN if the parameters were invalid. 5041 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 5042 */ 5043 int dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) 5030 5044 { 5031 5045 #if GTK_MAJOR_VERSION > 1 … … 5036 5050 #endif 5037 5051 int _dw_locked_by_me = FALSE; 5052 int retval = DW_ERROR_UNKNOWN; 5038 5053 5039 5054 if(!id && !data) 5040 return ;5055 return retval; 5041 5056 5042 5057 DW_MUTEX_LOCK; … … 5062 5077 { 5063 5078 DW_MUTEX_UNLOCK; 5064 return ;5079 return DW_ERROR_GENERAL; 5065 5080 } 5066 5081 #if GTK_MAJOR_VERSION > 1 … … 5078 5093 unlink(template); 5079 5094 } 5080 else if 5095 else if(id) 5081 5096 #if GTK_MAJOR_VERSION > 1 5082 5097 pixbuf = _dw_find_pixbuf((HICN)id); … … 5086 5101 5087 5102 #if GTK_MAJOR_VERSION > 1 5088 if 5103 if(pixbuf) 5089 5104 #else 5090 if 5091 #endif 5092 { 5093 if ( GTK_IS_BUTTON(handle))5105 if(tmp) 5106 #endif 5107 { 5108 if(GTK_IS_BUTTON(handle)) 5094 5109 { 5095 5110 #if GTK_MAJOR_VERSION > 1 … … 5098 5113 { 5099 5114 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), pixbuf); 5115 retval = DW_ERROR_NONE; 5100 5116 } 5101 5117 #else 5102 5118 GtkWidget *pixmap = GTK_BUTTON(handle)->child; 5103 5119 gtk_pixmap_set(GTK_PIXMAP(pixmap), tmp, bitmap); 5104 #endif 5105 } 5106 else 5107 { 5120 retval = DW_ERROR_NONE; 5121 #endif 5122 } 5108 5123 #if GTK_MAJOR_VERSION > 1 5124 else if(GTK_IS_IMAGE(handle)) 5125 { 5109 5126 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), pixbuf); 5110 5127 #else 5128 else if(GTK_IS_PIXMAP(handle)) 5129 { 5111 5130 gtk_pixmap_set(GTK_PIXMAP(handle), tmp, bitmap); 5112 5131 #endif 5132 retval = DW_ERROR_NONE; 5113 5133 } 5114 5134 } … … 5118 5138 #endif 5119 5139 DW_MUTEX_UNLOCK; 5140 return retval; 5120 5141 } 5121 5142 -
TabularUnified trunk/gtk3/dw.c ¶
r2762 r2866 4263 4263 if(bitmap) 4264 4264 { 4265 dw_window_set_bitmap( bitmap, 0, filename);4266 gtk_container_add 4265 dw_window_set_bitmap(bitmap, 0, filename); 4266 gtk_container_add(GTK_CONTAINER(tmp), bitmap); 4267 4267 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); 4268 4268 } … … 4299 4299 { 4300 4300 dw_window_set_bitmap_from_data(bitmap, 0, data, len); 4301 gtk_container_add 4301 gtk_container_add(GTK_CONTAINER(tmp), bitmap); 4302 4302 g_object_set_data(G_OBJECT(tmp), "_dw_bitmap", bitmap); 4303 4303 } … … 4550 4550 * Windows and a pixmap on Unix, pass 4551 4551 * NULL if you use the id param) 4552 */ 4553 void dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) 4552 * Returns: 4553 * DW_ERROR_NONE on success. 4554 * DW_ERROR_UNKNOWN if the parameters were invalid. 4555 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 4556 */ 4557 int dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) 4554 4558 { 4555 4559 GdkPixbuf *tmp = NULL; 4556 int found_ext = 0;4557 int i;4558 int _dw_locked_by_me = FALSE;4560 int i, found_ext = 0; 4561 int _dw_locked_by_me = FALSE; 4562 int retval = DW_ERROR_UNKNOWN; 4559 4563 4560 4564 if(!id && !filename) 4561 return ;4565 return retval; 4562 4566 4563 4567 DW_MUTEX_LOCK; … … 4568 4572 char *file = alloca(strlen(filename) + 6); 4569 4573 4570 if 4574 if(!file) 4571 4575 { 4572 4576 DW_MUTEX_UNLOCK; 4573 return ;4577 return DW_ERROR_GENERAL; 4574 4578 } 4575 4579 … … 4577 4581 4578 4582 /* check if we can read from this file (it exists and read permission) */ 4579 if ( access(file, 04 ) != 0)4583 if(access(file, 04) != 0) 4580 4584 { 4581 4585 /* Try with various extentions */ 4582 for ( i = 0; i < NUM_EXTS; i++)4586 for(i = 0; i < NUM_EXTS; i++) 4583 4587 { 4584 strcpy( file, filename);4585 strcat( file, _dw_image_exts[i]);4586 if ( access( file, 04 ) == 0)4588 strcpy(file, filename); 4589 strcat(file, _dw_image_exts[i]); 4590 if(access( file, 04 ) == 0) 4587 4591 { 4588 4592 found_ext = 1; … … 4590 4594 } 4591 4595 } 4592 if ( found_ext == 0)4596 if(found_ext == 0) 4593 4597 { 4594 4598 DW_MUTEX_UNLOCK; 4595 return ;4599 return DW_ERROR_GENERAL; 4596 4600 } 4597 4601 } 4598 tmp = gdk_pixbuf_new_from_file(file, NULL 4599 } 4600 4601 if 4602 { 4603 if ( GTK_IS_BUTTON(handle))4604 { 4605 GtkWidget *pixmap = (GtkWidget *)g_object_get_data( G_OBJECT(handle), "_dw_bitmap");4602 tmp = gdk_pixbuf_new_from_file(file, NULL); 4603 } 4604 4605 if(tmp) 4606 { 4607 if(GTK_IS_BUTTON(handle)) 4608 { 4609 GtkWidget *pixmap = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_bitmap"); 4606 4610 if(pixmap) 4607 4611 { 4608 4612 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), tmp); 4613 retval = DW_ERROR_NONE; 4609 4614 } 4610 4615 } 4611 else 4616 else if(GTK_IS_IMAGE(handle)) 4612 4617 { 4613 4618 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); 4614 } 4615 } 4616 DW_MUTEX_UNLOCK; 4619 retval = DW_ERROR_NONE; 4620 } 4621 } 4622 DW_MUTEX_UNLOCK; 4623 return retval; 4617 4624 } 4618 4625 … … 4627 4634 * NULL if you use the id param) 4628 4635 * len: length of data 4629 */ 4630 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) 4636 * Returns: 4637 * DW_ERROR_NONE on success. 4638 * DW_ERROR_UNKNOWN if the parameters were invalid. 4639 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 4640 */ 4641 int dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) 4631 4642 { 4632 4643 GdkPixbuf *tmp = NULL; 4633 4644 int _dw_locked_by_me = FALSE; 4645 int retval = DW_ERROR_UNKNOWN; 4634 4646 4635 4647 if(!id && !data) 4636 return ;4648 return retval; 4637 4649 4638 4650 DW_MUTEX_LOCK; … … 4655 4667 { 4656 4668 DW_MUTEX_UNLOCK; 4657 return ;4669 return DW_ERROR_GENERAL; 4658 4670 } 4659 4671 … … 4672 4684 4673 4685 if(pixmap) 4686 { 4674 4687 gtk_image_set_from_pixbuf(GTK_IMAGE(pixmap), tmp); 4675 } 4676 else 4688 retval = DW_ERROR_NONE; 4689 } 4690 } 4691 else if(GTK_IS_IMAGE(handle)) 4692 { 4677 4693 gtk_image_set_from_pixbuf(GTK_IMAGE(handle), tmp); 4678 } 4679 DW_MUTEX_UNLOCK; 4694 retval = DW_ERROR_NONE; 4695 } 4696 } 4697 DW_MUTEX_UNLOCK; 4698 return retval; 4680 4699 } 4681 4700 -
TabularUnified trunk/gtk4/dw.c ¶
r2770 r2866 3926 3926 * Windows and a pixmap on Unix, pass 3927 3927 * NULL if you use the id param) 3928 */ 3929 DW_FUNCTION_DEFINITION(dw_window_set_bitmap, void, HWND handle, unsigned long id, const char *filename) 3928 * Returns: 3929 * DW_ERROR_NONE on success. 3930 * DW_ERROR_UNKNOWN if the parameters were invalid. 3931 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 3932 */ 3933 DW_FUNCTION_DEFINITION(dw_window_set_bitmap, int, HWND handle, unsigned long id, const char *filename) 3930 3934 DW_FUNCTION_ADD_PARAM3(handle, id, filename) 3931 DW_FUNCTION_ NO_RETURN(dw_window_set_bitmap)3935 DW_FUNCTION_RETURN(dw_window_set_bitmap, int) 3932 3936 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, id, ULONG, filename, const char *) 3933 3937 { 3934 3938 GdkPixbuf *tmp = NULL; 3939 int retval = DW_ERROR_UNKNOWN; 3935 3940 3936 3941 if(id) … … 3967 3972 GtkWidget *pixmap = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_bitmap"); 3968 3973 if(pixmap) 3974 { 3969 3975 gtk_picture_set_pixbuf(GTK_PICTURE(pixmap), tmp); 3976 retval = DW_ERROR_NONE; 3977 } 3970 3978 } 3971 3979 else if(GTK_IS_PICTURE(handle)) 3980 { 3972 3981 gtk_picture_set_pixbuf(GTK_PICTURE(handle), tmp); 3973 } 3974 DW_FUNCTION_RETURN_NOTHING; 3982 retval = DW_ERROR_NONE; 3983 } 3984 } 3985 else 3986 retval = DW_ERROR_GENERAL; 3987 DW_FUNCTION_RETURN_THIS(retval); 3975 3988 } 3976 3989 … … 3985 3998 * NULL if you use the id param) 3986 3999 * len: length of data 3987 */ 3988 DW_FUNCTION_DEFINITION(dw_window_set_bitmap_from_data, void, HWND handle, unsigned long id, const char *data, int len) 4000 * Returns: 4001 * DW_ERROR_NONE on success. 4002 * DW_ERROR_UNKNOWN if the parameters were invalid. 4003 * DW_ERROR_GENERAL if the bitmap was unable to be loaded. 4004 */ 4005 DW_FUNCTION_DEFINITION(dw_window_set_bitmap_from_data, int, HWND handle, unsigned long id, const char *data, int len) 3989 4006 DW_FUNCTION_ADD_PARAM4(handle, id, data, len) 3990 DW_FUNCTION_ NO_RETURN(dw_window_set_bitmap_from_data)4007 DW_FUNCTION_RETURN(dw_window_set_bitmap_from_data, int) 3991 4008 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, id, ULONG, data, const char *, len, int) 3992 4009 { 3993 4010 GdkPixbuf *tmp = NULL; 4011 int retval = DW_ERROR_UNKNOWN; 3994 4012 3995 4013 if(data) … … 4015 4033 } 4016 4034 } 4017 else if 4035 else if(id) 4018 4036 tmp = _dw_find_pixbuf((HICN)id, NULL, NULL); 4019 4037 … … 4025 4043 4026 4044 if(pixmap) 4045 { 4027 4046 gtk_picture_set_pixbuf(GTK_PICTURE(pixmap), tmp); 4047 retval = DW_ERROR_NONE; 4048 } 4028 4049 } 4029 4050 else if(GTK_IS_PICTURE(handle)) 4051 { 4030 4052 gtk_picture_set_pixbuf(GTK_PICTURE(handle), tmp); 4031 } 4032 DW_FUNCTION_RETURN_NOTHING; 4053 retval = DW_ERROR_NONE; 4054 } 4055 } 4056 else 4057 retval = DW_ERROR_GENERAL; 4058 DW_FUNCTION_RETURN_THIS(retval); 4033 4059 } 4034 4060
Note:
See TracChangeset
for help on using the changeset viewer.