Browse Source

Merge pull request #1306 from AtomicGameEngine/JME-ATOMIC-UPDATES-1

Button URL’s, updates to help menu/welcome/new build, TurboBadger font calculation tweaks
JoshEngebretson 9 years ago
parent
commit
17315c6107

+ 3 - 3
Resources/EditorData/AtomicEditor/editor/ui/newbuildwindow.tb.txt

@@ -2,12 +2,12 @@ TBLayout: axis: y, distribution: gravity
     TBImageWidget: filename: "AtomicEditor/editor/images/newbuilddetected_header.jpg"
         lp: width: 512, height: 167, min-width: 512, min-height: 167
     TBEditField: multiline: 1, styling: 1, gravity: all, id: newbuild_text, readonly: 1, adapt-to-content: 0
-        font: size: 13
-        lp: min-width: 480, min-height: 274
+        font: size: 12
+        lp: min-width: 500, min-height: 300
         text: "..."
     TBLayout:
         TBCheckBox: id: newbuild_check
-        TBTextField: text: "Don't show me again until a new build is installed"
+        TBTextField: id: newbuild_check_text, text: "Don't show me again until a new build is installed"
             font: size: 16
     TBLayout:
         TBButton: text: Ok, id: ok

+ 9 - 7
Resources/EditorData/AtomicEditor/editor/ui/welcomeframe.tb.txt

@@ -21,14 +21,16 @@ TBLayout: distribution: gravity, size: available, axis: y, id: welcomelayout, po
                 "<color #D4FB79>First Steps</color>\n\n" \
                 "• Try out some of the example projects!\n\n" \
                 "• Create a new project based on a 2D or 3D template.\n\n" \
-                "<color #D4FB79>Getting Started Videos & Javascript API Docs</color>\n" \
-                "<widget TBButton: id: 'getting_started' text: 'http://atomicgameengine.com/learn', skin: TBButton.link>\n\n" \
-                "<color #D4FB79>Atomic Community</color>\n" \
-                "<widget TBButton: id: 'community' text: 'http://atomicgameengine.com/community', skin: TBButton.link>\n\n" \
+                "<color #D4FB79>Atomic Resources</color>\n" \
+                "<widget TBButton: text: 'Documentation Wiki' url: 'https://github.com/AtomicGameEngine/AtomicGameEngine/wiki/' skin: TBButton.link>\n" \
+                "<widget TBButton: text: 'Atomic Q & A' url: 'https://qa.atomicgameengine.com/' skin: TBButton.link>\n" \
+                "<widget TBButton: text: 'Atomic Chat' url: 'https://gitter.im/AtomicGameEngine/AtomicGameEngine/' skin: TBButton.link>\n\n" \
+                "<color #D4FB79>Atomic API References</color>\n" \
+                "<widget TBButton: text: 'JavaScript & TypeScript' url: 'http://docs.atomicgameengine.com/api/modules/atomic.html' skin: TBButton.link>\n" \
+                "<widget TBButton: text: 'C#' url: 'http://docs.atomicgameengine.com/csharp/AtomicEngine/' skin: TBButton.link>\n" \
+                "<widget TBButton: text: 'C++' url: 'http://docs.atomicgameengine.com/cpp' skin: TBButton.link>\n\n" \
                 "<color #D4FB79>Atomic Game Engine on GitHub</color>\n" \
-                "<widget TBButton: id: 'atomic_github' text: 'https://github.com/AtomicGameEngine', skin: TBButton.link>\n\n" \
-                "<color #D4FB79>Atomic Game Engine Funding Information</color>\n" \
-                "<widget TBButton: id: 'atomic_github' text: 'http://atomicgameengine.com/funding', skin: TBButton.link>\n\n"
+                "<widget TBButton: id: 'atomic_github' text: 'https://github.com/AtomicGameEngine/' url: 'https://github.com/AtomicGameEngine/AtomicGameEngine' skin: TBButton.link>\n\n"
         TBLayout: distribution: gravity, axis: y, spacing: 12
             TBLayout: distribution: gravity, size: available
                 TBContainer: gravity: left right

+ 0 - 5
Script/AtomicEditor/ui/frames/inspector/AttributeInfoEdit.ts

@@ -234,7 +234,6 @@ class StringAttributeEdit extends AttributeInfoEdit {
         field.fontDescription = AttributeInfoEdit.fontDesc;
         var lp = new Atomic.UILayoutParams();
         lp.width = 160;
-        lp.height = 24;
         field.layoutParams = lp;
 
         field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
@@ -318,7 +317,6 @@ class IntAttributeEdit extends AttributeInfoEdit {
             field.fontDescription = AttributeInfoEdit.fontDesc;
             var lp = new Atomic.UILayoutParams();
             lp.width = 140;
-            lp.height = 24;
             field.layoutParams = lp;
 
             field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
@@ -414,7 +412,6 @@ class FloatAttributeEdit extends AttributeInfoEdit {
         field.fontDescription = AttributeInfoEdit.fontDesc;
         var lp = new Atomic.UILayoutParams();
         lp.width = 140;
-        lp.height = 24;
         field.layoutParams = lp;
 
         field.subscribeToEvent(field, "UIWidgetEditComplete", (ev) => this.handleUIWidgetEditCompleteEvent(ev));
@@ -648,7 +645,6 @@ class ColorAttributeEdit extends AttributeInfoEdit {
 
         var lp = new Atomic.UILayoutParams();
         lp.width = 140;
-        lp.height = 24;
         colorWidget.layoutParams = lp;
 
         this.editWidget = layout;
@@ -893,7 +889,6 @@ class ResourceRefAttributeEdit extends AttributeInfoEdit {
 
         var lp = new Atomic.UILayoutParams();
         lp.width = 140;
-        lp.height = 24;
         o.editField.layoutParams = lp;
         o.editField.readOnly = true;
 

+ 30 - 18
Script/AtomicEditor/ui/frames/menus/MainFrameMenu.ts

@@ -294,29 +294,35 @@ class MainFrameMenu extends Atomic.ScriptObject {
             }
 
         } else if (target.id == "menu help popup") {
+
             if (refid == "about atomic editor") {
                 EditorUI.getModelOps().showAbout();
                 return true;
             }
-            if (refid == "help community") {
-                Atomic.fileSystem.systemOpen("http://atomicgameengine.com/community/");
-                return true;
-            } else if (refid == "help chat") {
-                Atomic.fileSystem.systemOpen("https://gitter.im/AtomicGameEngine/AtomicGameEngine/");
+
+            if (refid == "help what new") {
+                EditorUI.getModelOps().showNewBuildWindow(false);
                 return true;
             }
-            else if (refid == "help getting started") {
-                Atomic.fileSystem.systemOpen("http://atomicgameengine.com/learn/");
-                return true;
-            } else if (refid == "help github") {
-                Atomic.fileSystem.systemOpen("https://github.com/AtomicGameEngine/AtomicGameEngine/");
-                return true;
-            } else if (refid == "help api") {
-                var url = "file://" + ToolCore.toolEnvironment.toolDataDir + "Docs/JSDocs/index.html";
-                Atomic.fileSystem.systemOpen(url);
+
+            let urlLookup = {
+
+                "help doc wiki" : "https://github.com/AtomicGameEngine/AtomicGameEngine/wiki/",
+                "help chat" : "https://gitter.im/AtomicGameEngine/AtomicGameEngine/",
+                "help api js" : "http://docs.atomicgameengine.com/api/modules/atomic.html",
+                "help api csharp" : "http://docs.atomicgameengine.com/csharp/AtomicEngine/",
+                "help api cplusplus" : "http://docs.atomicgameengine.com/cpp",
+                "help q_and_a" : "https://qa.atomicgameengine.com/",
+                "help github" : "https://github.com/AtomicGameEngine/AtomicGameEngine/"
+            };
+
+            if (urlLookup[refid]) {
+                Atomic.fileSystem.systemOpen(urlLookup[refid]);
                 return true;
             }
 
+            return false;
+
         } else {
             // console.log("Menu: " + target.id + " clicked");
         }
@@ -406,12 +412,18 @@ var fileItems = {
 
 var helpItems = {
 
-    "Getting Started": "help getting started",
-    "API Documentation": ["help api"],
+    "What's New": "help what new",
+    "Documentation Wiki": "help doc wiki",
     "-1": null,
-    "Atomic Chat": ["help chat"],
-    "Atomic Community": ["help community"],
+    "API References": {
+        "JavaScript & TypeScript": ["help api js"],
+        "C#": ["help api csharp"],
+        "C++": ["help api cplusplus"]
+    },
     "-2": null,
+    "Atomic Q & A": ["help q_and_a"],
+    "Atomic Chat": ["help chat"],
+    "-3": null,
     "Atomic Game Engine on GitHub": ["help github"],
     "About Atomic Editor": "about atomic editor"
 };

+ 2 - 2
Script/AtomicEditor/ui/modal/ModalOps.ts

@@ -175,11 +175,11 @@ class ModalOps extends Atomic.ScriptObject {
 
     }
 
-    showNewBuildWindow() {
+    showNewBuildWindow(showCheck:boolean = true) {
 
         if (this.show()) {
 
-            this.opWindow = new NewBuildWindow();
+            this.opWindow = new NewBuildWindow(showCheck);
 
         }
 

+ 59 - 13
Script/AtomicEditor/ui/modal/info/NewBuildWindow.ts

@@ -26,7 +26,7 @@ import Preferences = require("editor/Preferences");
 
 class NewBuildWindow extends ModalWindow {
 
-    constructor() {
+    constructor(showCheck:boolean = true) {
 
         super();
 
@@ -35,7 +35,7 @@ class NewBuildWindow extends ModalWindow {
         // we're not calling this.init here as it calls resizeToFitContent
         // and center, which screw up the generated About text being resized
 
-        this.text = "New Build Detected";
+        this.text = showCheck ? "New Build Detected" : "Latest Updates";
         this.load("AtomicEditor/editor/ui/newbuildwindow.tb.txt");
 
         this.newbuild_text = <Atomic.UIEditField>this.getWidget("newbuild_text");
@@ -43,6 +43,12 @@ class NewBuildWindow extends ModalWindow {
 
         this.newBuildCheck = <Atomic.UICheckBox> this.getWidget("newbuild_check");
 
+        if (!showCheck) {
+
+            this.getWidget("newbuild_check_text").visibility = Atomic.UI_WIDGET_VISIBILITY_GONE;
+            this.newBuildCheck.visibility = Atomic.UI_WIDGET_VISIBILITY_GONE;
+        }
+
         this.resizeToFitContent();
         this.center();
 
@@ -82,27 +88,67 @@ class NewBuildWindow extends ModalWindow {
         // TODO: this needs to be externally generated
         text += `
 <color #D4FB79>Hello and thanks for installing a new build of the Atomic Editor!</color>
-<color #AAAAAA>(Git SHA: ${Atomic.AtomicBuildInfo.getGitSHA()})</color>
 
-<color #76D6FF>Latest Updates:</color>
+Atomic Build 2 - <color #AAAAAA>(Git SHA: ${Atomic.AtomicBuildInfo.getGitSHA()})</color>
+
+<color #D4FB79>Closed Issues</color>
+
+<widget TBButton: text: 'https://github.com/AtomicGameEngine/AtomicGameEngine/milestone/1' url: 'https://github.com/AtomicGameEngine/AtomicGameEngine/milestone/1?closed=1' skin: TBButton.link>
+
+<color #D4FB79>Update Highlights</color>
+
+• <color #D4FB79>[Editor]</color> Custom file resource inspector plugins (with example)
+
+• <color #D4FB79>[Editor]</color> Added TmxFile2D resource type for inspector fields
+
+• <color #D4FB79>[Docs]</color> Added new C#, C++, and updated JavaScript/TypeScript API references
+
+• <color #D4FB79>[Network]</color> Restored functionality for master server and client
+
+• <color #D4FB79>[Web]</color> Added Web subsystem events and convenience methods for post data and responses
+
+• <color #D4FB79>[C#]</color> Output dev project assemblies to Lib, so when modifying AtomicNET sources, changes are used properly
+
+• <color #D4FB79>[C#]</color> CSComponent cleanups for instantiation from script/serialized from scene (also cleans up nativeOverride hack)
+
+• <color #D4FB79>[C#]</color> Fix for exception when instantiating any RefCounted derived instance during a CSComponent default constructor
+
+• <color #D4FB79>[C#]</color> Better error reporting for CSComponent load issues
+
+• <color #D4FB79>[C#]</color> Added Material.SetShaderParameter API
+
+• <color #D4FB79>[C#]</color> Added Vector4/String to ScriptVariant
+
+• <color #D4FB79>[C#]</color> On demand project assembly compilation from within the Atomic Editor
+
+• <color #D4FB79>[C#]</color> Inspector attribute can now be used to set inspector tooltips
+
+• <color #D4FB79>[TypeScript]</color> Upgraded to TypeScript 2.1
+
+• <color #D4FB79>[TypeScript]</color> Removed deprecated allowNonTsExtensions
+
+• <color #D4FB79>[TypeScript]</color> Automatically generate a tasks.json for VSCode
+
+• <color #D4FB79>[TypeScript]</color> Updated tsconfig with rootUrl properly for non-relative imports
+
+• <color #D4FB79>[TypeScript]</color> Strongly typed native event interfaces and subscription
 
-• Support for <color #D4FB79>Atomic C#</color> scripting on Windows, macOS, Linux, Android, and iOS
+• <color #D4FB79>[Examples]</color> Fixed exception with virtual dpad in JavaScript examples
 
-• <color #D4FB79>Visual Studio</color> and <color #D4FB79>Xamarin Studio</color> integration (with VSCode support coming soon!)
+• <color #D4FB79>[Desktop]</color> Fixed issues with engine configuration json parsing in deployed applications
 
-• Updated to TypeScript 2.0
+• <color #D4FB79>[Windows]</color> Fixed issue with Visual Studio 2017 detection
 
-• Physically Based Rendering (PBR) - Thanks to @dragonCASTjosh
+• <color #D4FB79>[Windows]</color> Fixed UI pixel offset issue when rendering with OpenGL
 
-• New examples and project templates
+• <color #D4FB79>[macOS]</color> Added NSHighResolutionCapable flag to Atomic Editor
 
-• Revamped build targeting JavaScript, TypeScript, C#, and native C++
+• <color #D4FB79>[General]</color> Updated About dialog with contributor and build vendor information
 
-• Updated to Urho3D 1.6 and SDL 2.0.4 with a great number of platform improvements
+• <color #D4FB79>[General]</color> Misc bug fixes and optimizations
 
-• Updated to to Monaco VSCode editor 0.6
+• <color #D4FB79>[Maintenance]</color> Removed CurlManager from ToolCore as duplicated Web subsystem
 
-• Bug fixes, improvements, and optimization
 `;
 
         return text;

+ 36 - 3
Source/Atomic/UI/UIButton.cpp

@@ -88,11 +88,23 @@ bool UIButton::OnEvent(const tb::TBWidgetEvent &ev)
     {
         if (urlEnabled_)
         {
-            String text = GetText();
-            if (text.StartsWith("http://") || text.StartsWith("https://"))
+            // First see if we have a url specified, if not and the button uses the TBButton.link skin try text
+            String url = GetURL();
+            String skinname = widget_->GetSkinBgElement() ? widget_->GetSkinBgElement()->name.CStr() : String::EMPTY;
+            if (!url.Length() && skinname == "TBButton.link")
+            {
+                String text = GetText();
+
+                if (text.StartsWith("http://") || text.StartsWith("https://") || text.StartsWith("file://"))
+                {
+                    url = text;
+                }
+            }
+
+            if (url.Length())
             {
                 FileSystem* fileSystem = GetSubsystem<FileSystem>();
-                fileSystem->SystemOpen(text);
+                fileSystem->SystemOpen(url);
             }
         }
     }
@@ -107,4 +119,25 @@ bool UIButton::OnEvent(const tb::TBWidgetEvent &ev)
     return UIWidget::OnEvent(ev);
 }
 
+/// Set the URL which is opened when this button is clicked, this overrides the text attr
+void UIButton::SetURL (const String& url)
+{
+    if (!widget_)
+        return;
+
+    ((TBButton*)widget_)->SetURL(url.CString());
+
+}
+
+/// Get the URL which is opened when this button is clicked
+String UIButton::GetURL()
+{
+    if (!widget_)
+        return String::EMPTY;
+
+    return ((TBButton*)widget_)->GetURL().CStr();
+
+}
+
+
 }

+ 8 - 2
Source/Atomic/UI/UIButton.h

@@ -45,11 +45,17 @@ public:
 
     void SetEmulationButton(int button);
 
-    /// A button link may be set via the text attribute, if enabled
-    /// a FileSystem open will be called when the button is clicked
+    /// A URL link may be set via the URL value (or the Text value if using TBButton.link skin)
+    /// If enabled, a FileSystem open will be called when the button is clicked
     /// for example a http:// link will open the default browser
     void SetURLEnabled(bool enabled) { urlEnabled_ = enabled; }
 
+    /// Set the URL which is opened when this button is clicked
+    void SetURL (const String& url);
+
+    /// Get the URL which is opened when this button is clicked
+    String GetURL ();
+
     ///Set to true if the button should toggle on and off    
     void SetToggleMode(bool toggle);
     bool GetToggleMode() const;

+ 10 - 1
Source/ThirdParty/TurboBadger/tb_editfield.cpp

@@ -420,7 +420,12 @@ void TBEditField::OnResized(int old_w, int old_h)
 
 PreferredSize TBEditField::OnCalculatePreferredContentSize(const SizeConstraints &constraints)
 {
-    int font_height = GetFont()->GetHeight();
+    // ATOMIC BEGIN
+    // TurboBadger uses font height here, we add 2 pixels to calculation
+    // as this gives better default breathing room and avoids pixels being cut off
+    int font_height = GetFont()->GetHeight() + 2;
+    // ATOMIC END
+
     PreferredSize ps;
     if (m_adapt_to_content_size)
     {
@@ -669,6 +674,10 @@ int TBEditFieldContentFactory::GetContent(const char *text)
 
 TBTextFragmentContent *TBEditFieldContentFactory::CreateFragmentContent(const char *text, int text_len)
 {
+    // ATOMIC BEGIN
+    // https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1297
+    // ATOMIC END
+
     if (strncmp(text, "<widget ", MIN(text_len, 8)) == 0)
     {
         // Create a wrapper for the generated widget.

+ 4 - 1
Source/ThirdParty/TurboBadger/tb_style_edit.cpp

@@ -874,7 +874,10 @@ int32 TBBlock::CalculateStringWidth(TBFontFace *font, const char *str, int len)
 
 int32 TBBlock::CalculateLineHeight(TBFontFace *font) const
 {
-    return font->GetHeight();
+    // ATOMIC BEGIN
+    // Atomic adds a bit of buffer here for better line separation, this could be exposed as a setting
+    return font->GetHeight() + 4;
+    // ATOMIC END
 }
 
 int32 TBBlock::CalculateBaseline(TBFontFace *font) const

+ 7 - 0
Source/ThirdParty/TurboBadger/tb_widgets.h

@@ -265,6 +265,13 @@ public:
     /** Set both min max and preferred height to the given height. */
     void SetHeight(int height) { min_h = max_h = pref_h = height; }
 
+    // ATOMIC BEGIN
+    bool operator == (const LayoutParams &lp) const { return min_w == lp.min_w &&
+                min_h == lp.min_h && max_w == lp.max_w && max_h == lp.max_h &&
+                pref_w == lp.pref_w && pref_h == lp.pref_h; }
+    // ATOMIC END
+
+
     int min_w, min_h;			///< The minimal preferred width and height.
     int max_w, max_h;			///< The maximum preferred width and height.
     int pref_w, pref_h;			///< The preferred width and height.

+ 13 - 0
Source/ThirdParty/TurboBadger/tb_widgets_common.h

@@ -131,6 +131,15 @@ public:
 
     // == TBMessageHandler ==============================================================
     virtual void OnMessageReceived(TBMessage *msg);
+
+    // ATOMIC BEGIN
+
+    /** Set the URL of the button */
+    void SetURL(const char* url) { m_url = url; }
+    const TBStr& GetURL() { return m_url; }
+
+    // ATOMIC END
+
 protected:
     void UpdateTextFieldVisibility();
     class ButtonLayout : public TBLayout
@@ -142,6 +151,10 @@ protected:
     TBTextField m_textfield;
     bool m_auto_repeat_click;
     bool m_toggle_mode;
+
+    // ATOMIC BEGIN
+    TBStr m_url;
+    // ATOMIC END
 };
 
 /** TBClickLabel has a text field in its internal layout by default. Pointer input on the

+ 3 - 0
Source/ThirdParty/TurboBadger/tb_widgets_reader.cpp

@@ -157,6 +157,9 @@ TB_WIDGET_FACTORY(TBButton, TBValue::TYPE_NULL, WIDGET_Z_BOTTOM) {}
 void TBButton::OnInflate(const INFLATE_INFO &info)
 {
     SetToggleMode(info.node->GetValueInt("toggle-mode", GetToggleMode()) ? true : false);
+    // ATOMIC BEGIN
+    SetURL(info.node->GetValueString("url", ""));
+    // ATOMIC END
     TBWidget::OnInflate(info);
 }