*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 24 Feb 2004 11:30:09 +0100
changeset 2649 c65e9d0c2b35
parent 2648 188fb279a589
child 2650 f41da3ee2446
*** empty log message ***
CharacterSetView.st
--- a/CharacterSetView.st	Mon Feb 23 14:27:44 2004 +0100
+++ b/CharacterSetView.st	Tue Feb 24 11:30:09 2004 +0100
@@ -13,7 +13,7 @@
 "{ Package: 'stx:goodies' }"
 
 View subclass:#CharacterSetView
-	instanceVariableNames:'codePageHolder selectedCodePointHolder'
+	instanceVariableNames:'codePageHolder selectedCodePointHolder masterViewOrNil'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Collections-Text-Encodings'
@@ -43,6 +43,12 @@
 "
 ! !
 
+!CharacterSetView class methodsFor:'instance creation'!
+
+new
+    ^ self basicNew initialize.
+! !
+
 !CharacterSetView class methodsFor:'startup'!
 
 open
@@ -53,6 +59,14 @@
     "
 !
 
+openAsInputFor:aView label:viewLabel clickLabel:clickLabel
+    ^ self 
+        openOn:aView font
+        label:viewLabel 
+        clickLabel:clickLabel
+        asInputFor:aView
+!
+
 openOn:aFont
     ^ self
         openOn:aFont 
@@ -65,6 +79,14 @@
 !
 
 openOn:aFont label:viewLabel clickLabel:clickLabel
+    ^ self 
+        openOn:aFont 
+        label:viewLabel 
+        clickLabel:clickLabel 
+        asInputFor:nil
+!
+
+openOn:aFont label:viewLabel clickLabel:clickLabel asInputFor:aView
     |top panel v bNext bPrev bFirst bLast rangeLabel codePointLabel
      first last next prev enable update updateCodePoint w h
      minPage maxPage|
@@ -84,6 +106,10 @@
     panel bottomInset:-25.
     panel horizontalLayout:#left.
 
+    aView notNil ifTrue:[
+        v useSameFontAs:aView.
+    ].
+
     "/ actions
     updateCodePoint := [
             |selectedCodePoint selectedChar 
@@ -196,6 +222,10 @@
     h := v preferredExtent y + (panel preferredExtent y).
     top extent:(w @ h).
 
+    aView notNil ifTrue:[
+        top application:(aView application).
+        top beSlave.
+    ].
     top open.
     ^ v
 
@@ -227,6 +257,16 @@
     ^ selectedCodePointHolder
 ! !
 
+!CharacterSetView methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+    something == #font ifTrue:[
+        self font:(masterViewOrNil font).
+        ^ self.
+    ].
+    super update:something with:aParameter from:changedObject
+! !
+
 !CharacterSetView methodsFor:'drawing'!
 
 redraw
@@ -356,7 +396,15 @@
     ].
 ! !
 
-!CharacterSetView methodsFor:'initialization'!
+!CharacterSetView methodsFor:'initialization & release'!
+
+destroy
+    masterViewOrNil notNil ifTrue:[
+        masterViewOrNil removeDependent:self.
+        masterViewOrNil := nil.
+    ].
+    super destroy.
+!
 
 initialize
     super initialize.
@@ -365,6 +413,11 @@
 
     selectedCodePointHolder := ValueHolder new.
     selectedCodePointHolder onChangeSend:#selectedCodePointChanged to:self.
+!
+
+useSameFontAs:aView
+    masterViewOrNil := aView.
+    masterViewOrNil addDependent:self
 ! !
 
 !CharacterSetView methodsFor:'queries'!
@@ -382,5 +435,5 @@
 !CharacterSetView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.12 2004-02-23 13:27:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.13 2004-02-24 10:30:09 cg Exp $'
 ! !