*** empty log message ***

This commit is contained in:
Guido van Rossum 1991-05-14 12:22:25 +00:00
parent 17fca179bc
commit aa1791765e
4 changed files with 24 additions and 16 deletions

View File

@ -25,7 +25,7 @@ class TextEdit():
del self.window del self.window
# #
def minsize(self, m): def minsize(self, m):
return self.cols*m.textwidth('n'), self.rows*m.lineheight() return self.cols*m.textwidth('in')/2, self.rows*m.lineheight()
def setbounds(self, bounds): def setbounds(self, bounds):
self.bounds = bounds self.bounds = bounds
if self.editor: if self.editor:

View File

@ -22,14 +22,15 @@ class WindowParent() = ManageOneChild():
return self return self
# #
def _reset(self): def _reset(self):
self.child = 0 self.child = None
self.win = 0 self.win = None
self.itimer = 0 self.itimer = 0
self.do_mouse = 0 self.do_mouse = 0
self.do_keybd = 0 self.do_keybd = 0
self.do_timer = 0 self.do_timer = 0
self.do_altdraw = 0 self.do_altdraw = 0
self.pending_destroy = 0 self.pending_destroy = 0
self.close_hook = None
# #
def destroy(self): def destroy(self):
if self.win in WindowList: if self.win in WindowList:
@ -43,6 +44,9 @@ class WindowParent() = ManageOneChild():
# is not a good idea... # is not a good idea...
self.pending_destroy = 1 self.pending_destroy = 1
# #
def close_trigger(self):
if self.close_hook: self.close_hook(self)
#
def need_mouse(self, child): self.do_mouse = 1 def need_mouse(self, child): self.do_mouse = 1
def no_mouse(self, child): self.do_mouse = 0 def no_mouse(self, child): self.do_mouse = 0
# #
@ -63,10 +67,8 @@ class WindowParent() = ManageOneChild():
size = self.child.minsize(self.beginmeasuring()) size = self.child.minsize(self.beginmeasuring())
self.size = max(self.size[0], size[0]), \ self.size = max(self.size[0], size[0]), \
max(self.size[1], size[1]) max(self.size[1], size[1])
stdwin.setdefscrollbars(0, 0) # XXX Don't... stdwin.setdefscrollbars(0, 0)
# XXX Compensate stdwin bug: stdwin.setdefwinsize(self.size)
# XXX should really be stdwin.setdefwinsize(self.size)
stdwin.setdefwinsize(self.size[0]+4, self.size[1]+2)
self.win = stdwin.open(self.title) self.win = stdwin.open(self.title)
self.win.setdocsize(self.size) self.win.setdocsize(self.size)
if self.itimer: if self.itimer:
@ -82,6 +84,8 @@ class WindowParent() = ManageOneChild():
self.win.setdocsize(self.size) self.win.setdocsize(self.size)
bounds = (0, 0), self.win.getwinsize() bounds = (0, 0), self.win.getwinsize()
self.child.setbounds(bounds) self.child.setbounds(bounds)
# Force a redraw of the entire window:
self.win.change((0, 0), (10000, 10000))
# #
def beginmeasuring(self): def beginmeasuring(self):
# Return something with which a child can measure text # Return something with which a child can measure text
@ -137,7 +141,7 @@ class WindowParent() = ManageOneChild():
elif type = WE_SIZE: elif type = WE_SIZE:
self.fixup() self.fixup()
elif type = WE_CLOSE: elif type = WE_CLOSE:
self.delayed_destroy() self.close_trigger()
if self.pending_destroy: if self.pending_destroy:
self.destroy() self.destroy()
# #

View File

@ -25,7 +25,7 @@ class TextEdit():
del self.window del self.window
# #
def minsize(self, m): def minsize(self, m):
return self.cols*m.textwidth('n'), self.rows*m.lineheight() return self.cols*m.textwidth('in')/2, self.rows*m.lineheight()
def setbounds(self, bounds): def setbounds(self, bounds):
self.bounds = bounds self.bounds = bounds
if self.editor: if self.editor:

View File

@ -22,14 +22,15 @@ class WindowParent() = ManageOneChild():
return self return self
# #
def _reset(self): def _reset(self):
self.child = 0 self.child = None
self.win = 0 self.win = None
self.itimer = 0 self.itimer = 0
self.do_mouse = 0 self.do_mouse = 0
self.do_keybd = 0 self.do_keybd = 0
self.do_timer = 0 self.do_timer = 0
self.do_altdraw = 0 self.do_altdraw = 0
self.pending_destroy = 0 self.pending_destroy = 0
self.close_hook = None
# #
def destroy(self): def destroy(self):
if self.win in WindowList: if self.win in WindowList:
@ -43,6 +44,9 @@ class WindowParent() = ManageOneChild():
# is not a good idea... # is not a good idea...
self.pending_destroy = 1 self.pending_destroy = 1
# #
def close_trigger(self):
if self.close_hook: self.close_hook(self)
#
def need_mouse(self, child): self.do_mouse = 1 def need_mouse(self, child): self.do_mouse = 1
def no_mouse(self, child): self.do_mouse = 0 def no_mouse(self, child): self.do_mouse = 0
# #
@ -63,10 +67,8 @@ class WindowParent() = ManageOneChild():
size = self.child.minsize(self.beginmeasuring()) size = self.child.minsize(self.beginmeasuring())
self.size = max(self.size[0], size[0]), \ self.size = max(self.size[0], size[0]), \
max(self.size[1], size[1]) max(self.size[1], size[1])
stdwin.setdefscrollbars(0, 0) # XXX Don't... stdwin.setdefscrollbars(0, 0)
# XXX Compensate stdwin bug: stdwin.setdefwinsize(self.size)
# XXX should really be stdwin.setdefwinsize(self.size)
stdwin.setdefwinsize(self.size[0]+4, self.size[1]+2)
self.win = stdwin.open(self.title) self.win = stdwin.open(self.title)
self.win.setdocsize(self.size) self.win.setdocsize(self.size)
if self.itimer: if self.itimer:
@ -82,6 +84,8 @@ class WindowParent() = ManageOneChild():
self.win.setdocsize(self.size) self.win.setdocsize(self.size)
bounds = (0, 0), self.win.getwinsize() bounds = (0, 0), self.win.getwinsize()
self.child.setbounds(bounds) self.child.setbounds(bounds)
# Force a redraw of the entire window:
self.win.change((0, 0), (10000, 10000))
# #
def beginmeasuring(self): def beginmeasuring(self):
# Return something with which a child can measure text # Return something with which a child can measure text
@ -137,7 +141,7 @@ class WindowParent() = ManageOneChild():
elif type = WE_SIZE: elif type = WE_SIZE:
self.fixup() self.fixup()
elif type = WE_CLOSE: elif type = WE_CLOSE:
self.delayed_destroy() self.close_trigger()
if self.pending_destroy: if self.pending_destroy:
self.destroy() self.destroy()
# #