[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wtext.py,1.15,1.16

Jack Jansen jackjansen@users.sourceforge.net
Tue, 04 Dec 2001 05:30:32 -0800


Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv6075/python/Mac/Tools/IDE

Modified Files:
	Wtext.py 
Log Message:
Patch by Jason Harper to allow IDE to work again under MacOS 8.1. Plus appearance support for Wlist frames and focussing. Plus commented-out appearance support for the same for Wtext, which still needs some work.

Index: Wtext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wtext.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Wtext.py	2001/11/18 14:12:43	1.15
--- Wtext.py	2001/12/04 13:30:29	1.16
***************
*** 71,74 ****
--- 71,79 ----
  			bar = self._parent._barx
  			bar.setmax(destwidth - viewwidth)
+ 			
+ 			# MacOS 8.1 doesn't automatically disable
+ 			# scrollbars whose max <= min
+ 			bar.enable(destwidth > viewwidth)
+ 			
  			bar.setviewsize(viewwidth)
  			bar.set(vl - dl)
***************
*** 78,81 ****
--- 83,91 ----
  			bar = self._parent._bary
  			bar.setmax(destheight - viewheight)
+ 			
+ 			# MacOS 8.1 doesn't automatically disable
+ 			# scrollbars whose max <= min
+ 			bar.enable(destheight > viewheight)
+ 			
  			bar.setviewsize(viewheight)
  			bar.set(vt - dt)
***************
*** 219,222 ****
--- 229,235 ----
  	def adjust(self, oldbounds):
  		self.SetPort()
+ 		# Note: if App.DrawThemeEditTextFrame is ever used, it will be necessary
+ 		# to unconditionally outset the invalidated rectangles, since Appearance
+ 		# frames are drawn outside the bounds.
  		if self._selected and self._parentwindow._hasselframes:
  			self.GetWindow().InvalWindowRect(Qd.InsetRect(oldbounds, -3, -3))
***************
*** 352,361 ****
  	def activate(self, onoff):
  		self._activated = onoff
! 		if self._selected and self._visible:
! 			if onoff:
! 				self.ted.WEActivate()
! 			else:
! 				self.ted.WEDeactivate()
  			if self._selected:
  				self.drawselframe(onoff)
  	
--- 365,381 ----
  	def activate(self, onoff):
  		self._activated = onoff
! 		if self._visible:
! 			self.SetPort()
! 			
! 			# DISABLED!  There are too many places where it is assumed that
! 			# the frame of an EditText item is 1 pixel, inside the bounds.
! 			#state = [kThemeStateActive, kThemeStateInactive][not onoff]
! 			#App.DrawThemeEditTextFrame(Qd.InsetRect(self._bounds, 1, 1), state)
! 			
  			if self._selected:
+ 				if onoff:
+ 					self.ted.WEActivate()
+ 				else:
+ 					self.ted.WEDeactivate()
  				self.drawselframe(onoff)
  	
***************
*** 377,384 ****
  				visRgn = self._parentwindow.wid.GetWindowPort().visRgn
  			self.ted.WEUpdate(visRgn)
  			if self._selected and self._activated:
  				self.drawselframe(1)
- 			Qd.FrameRect(self._bounds)
- 			#App.DrawThemeEditTextFrame(self._bounds, kThemeStateActive)
  	
  	# scrolling
--- 397,409 ----
  				visRgn = self._parentwindow.wid.GetWindowPort().visRgn
  			self.ted.WEUpdate(visRgn)
+ 
+ 			# DISABLED!  There are too many places where it is assumed that
+ 			# the frame of an EditText item is 1 pixel, inside the bounds.
+ 			#state = [kThemeStateActive, kThemeStateInactive][not self._activated]
+ 			#App.DrawThemeEditTextFrame(Qd.InsetRect(self._bounds, 1, 1), state)
+ 			Qd.FrameRect(self._bounds)
+ 
  			if self._selected and self._activated:
  				self.drawselframe(1)
  	
  	# scrolling
***************
*** 604,607 ****
--- 629,644 ----
  			if self._selected and self._activated:
  				self.drawselframe(1)
+ 
+ 	def activate(self, onoff):
+ 		self._activated = onoff
+ 		if self._visible:
+ 			self.SetPort()
+ 			# doesn't draw frame, as EditText.activate does
+ 			if self._selected:
+ 				if onoff:
+ 					self.ted.WEActivate()
+ 				else:
+ 					self.ted.WEDeactivate()
+ 				self.drawselframe(onoff)