[comp.windows.x] Sun X Soundtool

khera@cs.duke.edu (Vivek Khera) (05/04/91)

A couple of weeks ago I posted a query about not getting an icon when
I tried to iconify Sun's x_soundtool under twm.  Since I got no
response, I decided to look into the problem.  Well, it turns out that
whoever wrote x_soundtool for SunOS 4.1.1 did not know what he or she
was doing with respect to icons.  Below are the necessary patches to
get the icon that seems to have been desired by the author.  Also,
there are a couple of fixes I added to make the window sized
properly-- before it always came out too small to hold its contents.
Since I don't subscribe to the Open Look interface, i added a quit
button, but that can easily be removed if you are pedantic about
sticking to the OpenLook definition.  Enjoy.  Patches follow.




*** /tmp/RCSAa02188	Fri May  3 15:48:44 1991
--- x_soundtool.c	Fri Apr 12 15:14:40 1991
***************
*** 77,83 ****
  #define	BUTTON_WIDTH	(8)
  #define	SCROLLBAR_WIDTH	(18)
  
! #define	WINDOW_WIDTH	(800)
  #define	SCOPE_HEIGHT	(256 + SCROLLBAR_WIDTH + 4)
  
  #define	SCOPE_WIDTH	(256)
--- 77,83 ----
  #define	BUTTON_WIDTH	(8)
  #define	SCROLLBAR_WIDTH	(18)
  
! #define	WINDOW_WIDTH	(925)
  #define	SCOPE_HEIGHT	(256 + SCROLLBAR_WIDTH + 4)
  
  #define	SCOPE_WIDTH	(256)
***************
*** 235,240 ****
--- 235,242 ----
  	char	*argv[];
  	char	*envp[];
  {
+ 	Icon soundtool_icon;
+ 
  	/* Save the invocation command name for error messages */
  	prog = argv[0];
  
***************
*** 247,252 ****
--- 249,258 ----
  		SERVER_IMAGE_BITS, soundtool_image_bits, 
  		0);
  
+     soundtool_icon = xv_create((Xv_window)NULL, ICON,
+ 		ICON_IMAGE, soundtool_icon_image,
+ 		0);
+ 
      waveform_cursor_image = xv_create(NULL, SERVER_IMAGE,
  		XV_WIDTH, 16,
  		XV_HEIGHT, 16, 
***************
*** 266,274 ****
  	Base_frame = xv_create((Xv_Window) 0, FRAME,
  	    WIN_ROWS,				35,
  	    XV_WIDTH,				WINDOW_WIDTH,
! 		FRAME_ARGS,				argc, argv,
  	    XV_LABEL,			"soundtool",
! 	    FRAME_ICON, soundtool_icon_image, 
  	    0);
  
  	if (Base_frame == (Frame) 0) {
--- 272,280 ----
  	Base_frame = xv_create((Xv_Window) 0, FRAME,
  	    WIN_ROWS,				35,
  	    XV_WIDTH,				WINDOW_WIDTH,
! 	    FRAME_ARGS,				argc, argv,
  	    XV_LABEL,			"soundtool",
! 	    FRAME_ICON, soundtool_icon, 
  	    0);
  
  	if (Base_frame == (Frame) 0) {
***************
*** 475,480 ****
--- 481,497 ----
  	    0);
  }
  
+ /* Quit button pressed */
+ /*ARGSUSED*/
+ main_quit_proc(item, event)
+ 	Panel_item	item;
+ 	Event		*event;
+ {
+ 	EVENTP("main_quit_proc", event);
+ 
+ 	closedown();
+ }
+ 
  /* Convert local gain into device parameters */
  double
  scale_gain(g)
***************
*** 662,667 ****
--- 679,691 ----
  	    PANEL_NOTIFY_PROC, main_describe_proc,
  	    0);
  
+ 	(void) xv_create(Main_panel, PANEL_BUTTON,
+ 	    XV_X,	xv_col(Main_panel, 0),
+ 	    XV_Y,	xv_row(Main_panel, 4),
+ 	    PANEL_LABEL_STRING, "Quit",
+ 	    PANEL_NOTIFY_PROC, main_quit_proc,
+ 	    0);
+ 
  	Main_playgain_item = xv_create(Main_panel, PANEL_SLIDER,
  	    XV_X, xv_col(Main_panel, 14),
  	    XV_Y, xv_row(Main_panel, 0),
***************
*** 1436,1445 ****
  	    PANEL_LABEL_STRING, "Zoom",
  	    PANEL_MIN_VALUE,	1,
  	    PANEL_MAX_VALUE,	2,
! 	    PANEL_VALUE,	2,
  	    PANEL_SHOW_VALUE,	TRUE,
  	    PANEL_SHOW_RANGE,	FALSE,
! 	    PANEL_SLIDER_WIDTH,	WINDOW_WIDTH - SCOPE_WIDTH - 100,
  	    PANEL_NOTIFY_PROC,	waveform_zoom_proc,
  	    PANEL_NOTIFY_LEVEL, PANEL_ALL,
  	    0);
--- 1460,1469 ----
  	    PANEL_LABEL_STRING, "Zoom",
  	    PANEL_MIN_VALUE,	1,
  	    PANEL_MAX_VALUE,	2,
! 	    PANEL_VALUE,	Zoom,
  	    PANEL_SHOW_VALUE,	TRUE,
  	    PANEL_SHOW_RANGE,	FALSE,
! 	    PANEL_SLIDER_WIDTH,	WINDOW_WIDTH - SCOPE_WIDTH - 150,
  	    PANEL_NOTIFY_PROC,	waveform_zoom_proc,
  	    PANEL_NOTIFY_LEVEL, PANEL_ALL,
  	    0);


--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera, Gradual Student/Systems Guy   Department of Computer Science
ARPA:   khera@cs.duke.edu                 Duke University
UUCP:   ...!mcnc!duke!khera               Durham, NC 27706     (919) 660-6528