Minor UI fixes
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 17 Mar 2015 04:34:49 +0000
changeset 1 7bfafe79fa34
parent 0 da028ec9cc07
child 2 0f7b0c88f894
Minor UI fixes * Fixed About box * Added "Documentation" and "Report Problem" menu entries * Better file open handling * Nicer window labeling
StataScriptEditor.st
StataScriptEditorMain.st
--- a/StataScriptEditor.st	Fri Mar 13 22:51:48 2015 +0000
+++ b/StataScriptEditor.st	Tue Mar 17 04:34:49 2015 +0000
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'jv:statascripteditor' }"
 
 "{ NameSpace: Smalltalk }"
@@ -38,11 +40,12 @@
                (MenuItem
                   label: 'New'
                   itemValue: newWorkspace
-                  shortcutKey: Ctrln
+                  shortcutKey: Ctrlt
                 )
                (MenuItem
                   label: 'New Window'
                   itemValue: newWindow
+                  shortcutKey: Ctrln
                 )
                (MenuItem
                   label: '-'
@@ -149,6 +152,17 @@
            (Menu
               (
                (MenuItem
+                  label: 'Documenation'
+                  itemValue: openDocumentation
+                )
+               (MenuItem
+                  label: 'Report Problem'
+                  itemValue: openBug
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
                   label: 'About this Application...'
                   itemValue: openAboutThisApplication
                 )
@@ -161,8 +175,14 @@
         nil
         nil
       )
+! !
 
-    "Modified: / 11-02-2015 / 00:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!StataScriptEditor methodsFor:'change & update'!
+
+windowLabelPrefix
+    ^ 'STATA Script Editor'
+
+    "Created: / 17-03-2015 / 04:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !StataScriptEditor methodsFor:'defaults'!
@@ -181,6 +201,29 @@
     "Modified: / 10-02-2015 / 22:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!StataScriptEditor methodsFor:'help'!
+
+aboutThisApplicationText
+    "text for an about box for this application.
+     Extracts some common info (i.e. class revision, author etc.) from
+     the classes documentation."
+
+    ^ resources 
+        stringWithCRs: 'STATA Script Editor (rev %1)\\https://bitbucket.org/janvrany/jv-statascripteditor/wiki/Home\\(C) 2015 Jan Vrany'
+                 with: (self class revision ? '0.1')
+
+    "Created: / 17-03-2015 / 04:14:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!StataScriptEditor methodsFor:'hooks'!
+
+postBuildWith:aBuilder
+    super postBuildWith:aBuilder.
+    self window label:self windowLabelPrefix
+
+    "Created: / 17-03-2015 / 04:22:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !StataScriptEditor methodsFor:'menu actions'!
 
 menuSave
@@ -194,6 +237,22 @@
     "action to be added ..."
 
     Transcript showCR:self class name, ': action for #menuSave ...'.
+!
+
+openBug
+    OperatingSystem 
+        openApplicationForDocument: 'https://bitbucket.org/janvrany/jv-statascripteditor/issues/new'
+                         operation: #open
+
+    "Modified: / 17-03-2015 / 04:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+openDocumentation
+    OperatingSystem 
+        openApplicationForDocument: 'https://bitbucket.org/janvrany/jv-statascripteditor/wiki/Home'
+                         operation: #open
+
+    "Modified: / 17-03-2015 / 04:17:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !StataScriptEditor methodsFor:'menu-actions'!
@@ -202,7 +261,6 @@
     |file ws|
 
     file := aFileName asFilename.
-    ws := self selectedWorkspacesTextView.
     [
         | contents |
 
@@ -212,6 +270,13 @@
             contents := file contents.
         ].
 
+        ws := self selectedWorkspacesTextView. 
+        ws contents asString indexOfNonSeparator ~~ 0 ifTrue:[ 
+            self addWindow: self createWorkspace named: label.
+            ws := self selectedWorkspacesTextView. 
+        ].
+
+
         encodingSymbolOrNil notNil ifTrue:[
             contents := contents encodeFrom:encodingSymbolOrNil into:#'unicode'.
             ws externalEncoding:encodingSymbolOrNil.
@@ -226,6 +291,7 @@
     self setLabel:label.
 
     "Created: / 11-02-2015 / 00:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-03-2015 / 04:28:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 menuLoad
--- a/StataScriptEditorMain.st	Fri Mar 13 22:51:48 2015 +0000
+++ b/StataScriptEditorMain.st	Tue Mar 17 04:34:49 2015 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "{ Package: 'jv:statascripteditor' }"
 
 "{ NameSpace: Smalltalk }"