ProjectView.st
changeset 0 571fd5eee315
child 3 9ff3765f06d0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ProjectView.st	Fri Jul 16 11:44:07 1993 +0200
@@ -0,0 +1,157 @@
+'From Smalltalk/X, Version:2.6.4 on 27-Apr-1993 at 20:02:12'!
+
+StandardSystemView subclass:#ProjectView
+         instanceVariableNames:'myProject toggle'
+         classVariableNames:'ActiveProjectView'
+         poolDictionaries:''
+         category:'Interface-Smalltalk'
+!
+
+!ProjectView class methodsFor:'instance creation'!
+
+for:aProject
+    |newView|
+
+    newView := super new.
+    newView setProject:aProject.
+    ^ newView
+
+    "ProjectView for:(Project new)"
+! !
+
+!ProjectView methodsFor:'private accessing'!
+
+setProject:aProject
+    |name e|
+
+    name := aProject name.
+    self label:name.
+    self iconName:name.
+    toggle label:'Project: ' , name.
+    toggle resize.
+    myProject := aProject.
+    e := (toggle width @ toggle height).
+    self extent:e.
+    self minExtent:e.
+    self maxExtent:e
+! !
+
+!ProjectView methodsFor:'initialization'!
+
+initialize
+    super initialize.
+    toggle := Toggle in:self.
+    toggle borderWidth:0.
+    toggle pressAction:[self showProject].
+    toggle releaseAction:[self hideProject].
+    toggle middleButtonMenu:(
+        PopUpMenu
+                labels:#('rename'
+                         '-'
+                         'changes'
+                         '-'
+                         'show'
+                         'hide'
+                         '-'
+                         'destroy'
+                        )
+             selectors:#(renameProject
+                         nil
+                         browseChanges
+                         nil
+                         showProject
+                         hideProject
+                         nil
+                         destroy
+                        )
+              receiver:self
+    )
+!
+
+addToCurrentProject
+    "ignored here"
+
+    ^ self
+! !
+
+!ProjectView methodsFor:'menu actions'!
+
+browseChanges
+    ChangeSetBrowser startOn:(myProject changeSet)
+!
+
+destroyProject
+    |box|
+
+    box := YesNoBox new.
+    box title:'Destroying a project will discard all changes made
+for that project and destroy all views opened for it.
+
+Do you really want to do this ?'.
+    box okText:'yes'.
+    box yesAction:[
+        self doDestroyProject
+    ].
+    box showAtPointer
+!
+
+showProject
+    ActiveProjectView notNil ifTrue:[
+        ActiveProjectView hideProject
+    ].
+    ActiveProjectView := self.
+
+    myProject views notNil ifTrue:[
+        myProject views do:[:aView |
+            aView rerealize
+        ]
+    ].
+    Project current:myProject.
+    toggle turnOn
+!
+
+hideProject
+    myProject views notNil ifTrue:[
+        myProject views do:[:aView |
+            aView unrealize
+        ]
+    ].
+    ActiveProjectView := nil.
+    toggle turnOff
+!
+
+renameProject
+    |box|
+
+    box := EnterBox new.
+    box title:'new name of project:'.
+    box okText:'rename'.
+    box initialText:(myProject name).
+    box action:[:newName |
+        myProject name:newName.
+        self setProject:myProject
+    ].
+    box showAtPointer
+!
+
+doDestroy
+    self hideProject.
+
+    myProject := nil.
+    super destroy
+!
+
+destroy
+    |box|
+
+    box := YesNoBox new.
+    box title:'Destroying a project will discard all changes made
+for that project and destroy all views opened for it.
+
+Do you really want to do this ?'.
+    box okText:'yes'.
+    box yesAction:[
+        self doDestroy
+    ].
+    box showAtPointer
+! !