[PD-cvs] pd/src u_main.tk,1.1.1.4.2.7.4.1,1.1.1.4.2.7.4.2

matju at users.sourceforge.net matju at users.sourceforge.net
Sun Feb 22 21:45:54 CET 2004


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21427

Modified Files:
      Tag: impd_0_37
	u_main.tk 
Log Message:
added button_bar_add for externs that want to add their own buttons
buttons get only loaded once
at the end of the button bar, there's a (selectable) window-id


Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.1
retrieving revision 1.1.1.4.2.7.4.2
diff -C2 -d -r1.1.1.4.2.7.4.1 -r1.1.1.4.2.7.4.2
*** u_main.tk	22 Feb 2004 05:23:52 -0000	1.1.1.4.2.7.4.1
--- u_main.tk	22 Feb 2004 20:45:50 -0000	1.1.1.4.2.7.4.2
***************
*** 15,18 ****
--- 15,22 ----
  # all this changes are labeled with #######iemlib##########
  
+ #option add *background pink widgetDefault
+ #option add *backgroundPixmap /usr/share/themes/BrushedMetalBlue/gtk/brushed-dark.xpm widgetDefault
+ #option add *backgroundPixmap /home/matju/brushed-dark.gif widgetDefault
+ 
  # Tearoff is set to true by default:
  set pd_tearoff 1
***************
*** 374,382 ****
      -accelerator [accel_munge "Ctrl+o"]
  .mbar.file add  separator
  .mbar.file add command -label Message -command {menu_send} \
      -accelerator [accel_munge "Ctrl+m"]
  .mbar.file add command -label Path... \
      -command {pd pd start-path-dialog \;}
- .mbar.file add command -label {Class List} -command {show_class_list}
  .mbar.file add  separator
  .mbar.file add command -label Quit -command {menu_quit} \
--- 378,386 ----
      -accelerator [accel_munge "Ctrl+o"]
  .mbar.file add  separator
+ .mbar.file add command -label {Class List} -command {show_class_list}
  .mbar.file add command -label Message -command {menu_send} \
      -accelerator [accel_munge "Ctrl+m"]
  .mbar.file add command -label Path... \
      -command {pd pd start-path-dialog \;}
  .mbar.file add  separator
  .mbar.file add command -label Quit -command {menu_quit} \
***************
*** 655,659 ****
  }
  
- 
  ############# pdtk_canvas_new -- create a new canvas ###############
  proc pdtk_canvas_new {name width height geometry editable} {
--- 659,662 ----
***************
*** 673,681 ****
      scrollbar $name.scrollhort -command "$name.c xview" \
      	-orient horizontal
!     global env
!     if {[info exists env(pd_look)]} {
! 	make_button_bar $name.bbar $name
! 	pack $name.bbar -side top -fill x -expand no
!     }
  
      pack $name.scrollhort -side bottom -fill x
--- 676,682 ----
      scrollbar $name.scrollhort -command "$name.c xview" \
      	-orient horizontal
! 
!     make_button_bar $name.bbar $name
!     pack $name.bbar -side top -fill x -expand no
  
      pack $name.scrollhort -side bottom -fill x
***************
*** 779,782 ****
--- 780,785 ----
              $name.m.edit entryconfigure "Edit mode" -indicatoron false }
  	
+     $name.m.edit add command -label Redraw -command [list pd "$name map 0; $name map 1;\n"]
+ 	
  ############iemlib##################
  
***************
*** 950,953 ****
--- 953,957 ----
  #    puts stderr "all done"
  #   after 1 [concat raise $name]
+ #    after 1 [list canvas_animate $name]
  }
  
***************
*** 2589,2596 ****
      if {$value} {
  	$name.m.edit entryconfigure "Edit mode" -indicatoron true
! 	catch {$name.bbar.edit configure -image icon_mode_edit}
      } else {                          
          $name.m.edit entryconfigure "Edit mode" -indicatoron false
! 	catch {$name.bbar.edit configure -image icon_mode_run}
      }                                                 
  }
--- 2593,2602 ----
      if {$value} {
  	$name.m.edit entryconfigure "Edit mode" -indicatoron true
! 	$name.bbar.edit configure -image icon_mode_edit
! 	$name.c configure -background #dddddd
      } else {                          
          $name.m.edit entryconfigure "Edit mode" -indicatoron false
! 	$name.bbar.edit configure -image icon_mode_run
! 	$name.c configure -background #ffffff
      }                                                 
  }
***************
*** 2602,2606 ****
  #    if {$font >= 13} {set fontname [format -*-courier-----%d-* $font]}
      $canvasname create text $x $y \
!     	-font [format -*-courier-bold--normal--%d-* $font] \
      	-tags $myname -text $text -fill $color  -anchor nw 
  #    pd [concat $myname size [$canvasname bbox $myname] \;]
--- 2608,2612 ----
  #    if {$font >= 13} {set fontname [format -*-courier-----%d-* $font]}
      $canvasname create text $x $y \
!     	-font [format -*-courier-medium--normal--%d-* $font] \
      	-tags $myname -text $text -fill $color  -anchor nw 
  #    pd [concat $myname size [$canvasname bbox $myname] \;]
***************
*** 2637,2661 ****
      set pd_myversion $version
      set pd_apilist $apilist
  
!     set width1 [font measure  -*-courier-bold--normal--8-* x]
!     set height1 [lindex [font metrics -*-courier-bold--normal--8-*] 5]
! 
!     set width2 [font measure  -*-courier-bold--normal--10-* x]
!     set height2 [lindex [font metrics -*-courier-bold--normal--10-*] 5]
! 
!     set width3 [font measure  -*-courier-bold--normal--12-* x]
!     set height3 [lindex [font metrics -*-courier-bold--normal--12-*] 5]
! 
!     set width4 [font measure  -*-courier-bold--normal--14-* x]
!     set height4 [lindex [font metrics -*-courier-bold--normal--14-*] 5]
! 
!     set width5 [font measure  -*-courier-bold--normal--16-* x]
!     set height5 [lindex [font metrics -*-courier-bold--normal--16-*] 5]
! 
!     set width6 [font measure  -*-courier-bold--normal--24-* x]
!     set height6 [lindex [font metrics -*-courier-bold--normal--24-*] 5]
! 
!     set width7 [font measure  -*-courier-bold--normal--36-* x]
!     set height7 [lindex [font metrics -*-courier-bold--normal--36-*] 5]
  
      set tclpatch [info patchlevel]
--- 2643,2655 ----
      set pd_myversion $version
      set pd_apilist $apilist
+     set font -*-courier-bold--normal-
  
!     set width1 [font measure   $font-8-* x]; set height1 [lindex [font metrics  $font-8-*] 5]
!     set width2 [font measure  $font-10-* x]; set height2 [lindex [font metrics $font-10-*] 5]
!     set width3 [font measure  $font-12-* x]; set height3 [lindex [font metrics $font-12-*] 5]
!     set width4 [font measure  $font-14-* x]; set height4 [lindex [font metrics $font-14-*] 5]
!     set width5 [font measure  $font-16-* x]; set height5 [lindex [font metrics $font-16-*] 5]
!     set width6 [font measure  $font-24-* x]; set height6 [lindex [font metrics $font-24-*] 5]
!     set width7 [font measure  $font-36-* x]; set height7 [lindex [font metrics $font-36-*] 5]
  
      set tclpatch [info patchlevel]
***************
*** 3322,3398 ****
  catch {
  if {$env(pd_console_scrollback) != 0} {
!        frame .log
!        text .log.1 -width 80 -height 10 -yscrollcommand ".log.2 set"
!        scrollbar .log.2 -command ".log.1 yview"
!        .log.1 insert end "This is the PureData log\n"
!        pack .log.1 -side left -fill both -expand yes
!        pack .log.2 -side left -fill y -expand yes
!        pack .log -fill both -expand yes
! }} errMsg
! if {[string compare "" $errMsg] != 0} {
!        puts stderr "ERROR: $errMsg"
  }
! 
  set console_scrollback_count 0
  proc post_to_gui {x} {
!        global env
!        global console_scrollback_count
!        set oldpos [lindex [.log.2 get] 1]
!        .log.1 insert end $x
!        incr console_scrollback_count
!        if {$console_scrollback_count >= $env(pd_console_scrollback)} {
!                .log.1 delete 1.0 2.0
!        }
!        if {$oldpos > 0.9999} {.log.1 see end}
  }
  
- .log.2 set 0.0 1.0
- 
  ############ button bar
  
  set butt {
! 	{object  {obj 0} object}
! 	{message {msg 0} message}
! 	{number  {floatatom 0} number}
! 	{symbol  {symbolatom 0} symbol}
! 	{comment {text 0} comment}
! 	{bang    {bng 0} bang}
! 	{toggle  {toggle 0} toggle}
! 	{number2 {numbox 0} number2}
! 	{vslider {vslider 0} vslider}
! 	{hslider {hslider 0} hslider}
! 	{vradio  {vradio 0} vradio}
! 	{hradio  {hradio 0} hradio}
! 	{vu      {vumeter 0} vu}
! 	{canvas  {mycnv 0} canvas}
! 	{graph   {graph} graph}
! 	{array   {menuarray} array}
  }
  
! proc make_button_bar {self doc} {
! 	global data butt
! #	global pd_guidir
! #	set dir $pd_guidir/icons
  	global env
  	set dir $env(pd_look)
! 	frame $self
! 	foreach im {
! 		mode_edit mode_run
! 		object message number symbol comment bang
! 		toggle number2 vslider hslider vradio hradio
! 		vu canvas graph array
! 	} {
! 		image create photo icon_$im -file $dir/$im.gif
  	}
  	button $self.edit -image icon_mode_edit -border 1 \
  		-command [concat menu_editmode $doc]
  	pack $self.edit -side left 
- 
  	foreach b $butt {
  		set BLAH [lindex $b 1]
! 		button "$self.[lindex $b 0]" -image "icon_[lindex $b 2]" -border 1 \
! 			-command "pd \[concat $doc $BLAH \\;\]"
! 		pack $self.[lindex $b 0] -side left
  	}
  }
  
--- 3316,3407 ----
  catch {
  if {$env(pd_console_scrollback) != 0} {
! 	frame .log
! 	text .log.1 -width 60 -height 10 -yscrollcommand ".log.2 set"
! 	scrollbar .log.2 -command ".log.1 yview"
! 	.log.1 insert end "This is the PureData log\n"
! 	pack .log.1 -side left -fill both -expand yes
! 	pack .log.2 -side left -fill y -expand no
! 	pack .log -fill both -expand yes
! 	.log.2 set 0.0 1.0
  }
! } errMsg
! if {[string compare "" $errMsg] != 0} {puts stderr "ERROR: $errMsg"}
  set console_scrollback_count 0
  proc post_to_gui {x} {
! 	global env
! 	global console_scrollback_count
! 	set oldpos [lindex [.log.2 get] 1]
! 	.log.1 insert end $x
! 	incr console_scrollback_count
! 	if {$console_scrollback_count >= $env(pd_console_scrollback)} {
! 		.log.1 delete 1.0 2.0
! 	}
! 	if {$oldpos > 0.9999} {.log.1 see end}
  }
  
  ############ button bar
  
  set butt {
! 	{object  {obj 0}}
! 	{message {msg 0}}
! 	{number  {floatatom 0}}
! 	{symbol  {symbolatom 0}}
! 	{comment {text 0}}
! 	{bang    {bng 0}}
! 	{toggle  {toggle 0}}
! 	{number2 {numbox 0}}
! 	{vslider {vslider 0}}
! 	{hslider {hslider 0}}
! 	{vradio  {vradio 0}}
! 	{hradio  {hradio 0}}
! 	{vu      {vumeter 0}}
! 	{canvas  {mycnv 0}}
! 	{graph   {graph}}
! 	{array   {menuarray}}
  }
  
! proc button_bar_add {x y} {
! 	global butt
! 	lappend butt [list $x $y noload]
! 	
! }
! 
! proc load_button_bar {} {
! 	global butt
  	global env
+ 	set icons {mode_edit mode_run}
  	set dir $env(pd_look)
! 	foreach b $butt {
! 		if {[string compare [lindex $b 2] noload]!=0} {
! 			lappend icons [lindex $b 0]
! 		}
! 	}
! 	foreach im $icons {
! 		set errMsg {}
! 		catch {image create photo icon_$im -file $dir/$im.gif } errMsg
! 		if {[string compare "" $errMsg] != 0} { post_to_gui "ERROR: $errMsg\n" }
  	}
+ }
+ load_button_bar
+ 
+ proc make_button_bar {self doc} {
+         global butt
+ 	frame $self
  	button $self.edit -image icon_mode_edit -border 1 \
  		-command [concat menu_editmode $doc]
  	pack $self.edit -side left 
  	foreach b $butt {
  		set BLAH [lindex $b 1]
! 		catch {
! 			post_to_gui "butt: $b\n"
! 			button "$self.[lindex $b 0]" -image "icon_[lindex $b 0]" -border 1 \
! 				-command "pd \[concat $doc $BLAH \\;\]"
! 			pack $self.[lindex $b 0] -side left
! 		}
  	}
+ 	entry $self.name -font {courier 9} -width 10 -border 0
+ 	$self.name insert 0 ".[lindex [split .x81fb748.bbar .] 1]"
+ 	$self.name configure -state disabled
+ 	pack $self.name -side right
  }
  





More information about the Pd-cvs mailing list