ThreeColumnTextView.st
changeset 111 86f6d5536b05
child 1440 6e313ad0c279
equal deleted inserted replaced
110:b3cfcfafcc0d 111:86f6d5536b05
       
     1 "
       
     2  COPYRIGHT (c) 1994 by Claus Gittinger
       
     3 	      All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13     "Created: 20.11.1995 / 13:21:17 / cg"
       
    14 
       
    15 SyncedMultiColumnTextView subclass:#ThreeColumnTextView
       
    16 	instanceVariableNames:''
       
    17 	classVariableNames:''
       
    18 	poolDictionaries:''
       
    19 	category:'Views-Text'
       
    20 !
       
    21 
       
    22 !ThreeColumnTextView class methodsFor:'documentation'!
       
    23 
       
    24 copyright
       
    25 "
       
    26  COPYRIGHT (c) 1994 by Claus Gittinger
       
    27 	      All Rights Reserved
       
    28 
       
    29  This software is furnished under a license and may be used
       
    30  only in accordance with the terms of that license and with the
       
    31  inclusion of the above copyright notice.   This software may not
       
    32  be provided or otherwise made available to, or used by, any
       
    33  other person.  No title to or ownership of the software is
       
    34  hereby transferred.
       
    35 "
       
    36 
       
    37     "Created: 20.11.1995 / 13:21:17 / cg"
       
    38 !
       
    39 
       
    40 documentation
       
    41 "
       
    42     a view showing two texts side-by-side.
       
    43     Scrolling is synced, by always scrolling both views.
       
    44     This type of view is especially useful to show diff-lists,
       
    45     code-versions, or other one-by-one viewable texts.
       
    46 
       
    47     Usually, it does not make much sense, to put totally different
       
    48     or unrelated texts into this kind of view.
       
    49 
       
    50     See subclass DiffTextView for a real class;
       
    51     see ChangesBrowsers compare operation for a real application
       
    52     of this kind of views.
       
    53 "
       
    54 
       
    55     "Created: 20.11.1995 / 13:21:17 / cg"
       
    56 !
       
    57 
       
    58 examples
       
    59 "
       
    60      TwoColumnTextView are currently not directly used by the system.
       
    61      However, it is used as an abstract superclass for DiffTextView.
       
    62      See more examples there.
       
    63      (you may find nice uses for it anyway ...)
       
    64 
       
    65      TwoColumnTextView
       
    66         openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
       
    67         and:('display.rc' asFilename contentsOfEntireFile)
       
    68 
       
    69 
       
    70      TwoColumnTextView
       
    71         openOn:('display.rc' asFilename contentsOfEntireFile)
       
    72         and:('smalltalk.rc' asFilename contentsOfEntireFile)
       
    73 
       
    74 
       
    75      TwoColumnTextView
       
    76         openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
       
    77         label:'smalltalk.rc'
       
    78         and:('display.rc' asFilename contentsOfEntireFile)
       
    79         label:'display.rc'
       
    80 "
       
    81 
       
    82     "Created: 20.11.1995 / 13:21:42 / cg"
       
    83     "Modified: 20.11.1995 / 13:23:12 / cg"
       
    84 ! !
       
    85 
       
    86 !ThreeColumnTextView class methodsFor:'instance creation'!
       
    87 
       
    88 openOn:firstText and:secondText and:thirdText
       
    89     "open up a view showing firstText, secondText and thirdText side-by-side"
       
    90 
       
    91     |top v|
       
    92 
       
    93     top := StandardSystemView label:'three texts'.
       
    94     v := HVScrollableView 
       
    95                for:self 
       
    96                miniScrollerH:true miniScrollerV:false
       
    97                in:top.
       
    98     v origin:0.0 @ 0.0 corner:1.0 @ 1.0.
       
    99     v scrolledView text1:firstText text2:secondText text3:thirdText.
       
   100     ^ top open
       
   101 
       
   102     "
       
   103      ThreeColumnTextView
       
   104         openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
       
   105         and:('display.rc' asFilename contentsOfEntireFile)
       
   106         and:('private.rc' asFilename contentsOfEntireFile)
       
   107     "
       
   108 
       
   109     "Modified: 12.12.1995 / 12:22:51 / cg"
       
   110 !
       
   111 
       
   112 openOn:firstText label:firstLabel and:secondText label:secondLabel and:thirdText label:thirdLabel
       
   113     "open up a view showing firstText, secondText and thirdText side-by-side,
       
   114      and labels for all views."
       
   115 
       
   116     |top v l1 l2 l3|
       
   117 
       
   118     top := StandardSystemView label:'three texts'.
       
   119     l1 := Label label:firstLabel in:top.
       
   120     l1 origin:0.0@0.0 corner:0.33@(l1 height).
       
   121     l2 := Label label:secondLabel in:top.
       
   122     l2 origin:0.33@0.0 corner:0.67@(l1 height).
       
   123     l3 := Label label:thirdLabel in:top.
       
   124     l3 origin:0.67@0.0 corner:1.0@(l1 height).
       
   125 
       
   126     v := HVScrollableView 
       
   127                for:self 
       
   128                miniScrollerH:true miniScrollerV:false
       
   129                in:top.
       
   130     v origin:0.0 @ (l1 height + ViewSpacing) corner:1.0 @ 1.0.
       
   131     v scrolledView text1:firstText text2:secondText text3:thirdText.
       
   132     ^ top open
       
   133 
       
   134     "
       
   135      ThreeColumnTextView
       
   136         openOn:('smalltalk.rc' asFilename contentsOfEntireFile)
       
   137         label:'smalltalk.rc'
       
   138         and:('display.rc' asFilename contentsOfEntireFile)
       
   139         label:'display.rc'
       
   140         and:('private.rc' asFilename contentsOfEntireFile)
       
   141         label:'private.rc'
       
   142     "
       
   143 
       
   144     "Modified: 12.12.1995 / 12:24:14 / cg"
       
   145 ! !
       
   146 
       
   147 !ThreeColumnTextView class methodsFor:'specification'!
       
   148 
       
   149 numberOfViews
       
   150     ^ 3
       
   151 
       
   152     "Created: 20.11.1995 / 13:17:00 / cg"
       
   153     "Modified: 12.12.1995 / 12:24:06 / cg"
       
   154 ! !
       
   155 
       
   156 !ThreeColumnTextView methodsFor:'accessing'!
       
   157 
       
   158 text1:t1 text2:t2 text3:t3
       
   159     (textViews at:1) list:t1 asText.
       
   160     (textViews at:2) list:t2 asText.
       
   161     (textViews at:3) list:t3 asText.
       
   162 
       
   163     "Created: 20.11.1995 / 13:20:39 / cg"
       
   164     "Modified: 12.12.1995 / 12:21:42 / cg"
       
   165 ! !
       
   166 
       
   167 !ThreeColumnTextView class methodsFor:'documentation'!
       
   168 
       
   169 version
       
   170 ^ '$Header: /cvs/stx/stx/libwidg2/ThreeColumnTextView.st,v 1.1 1995-12-12 12:34:32 cg Exp $'
       
   171 ! !