summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ustring.cpp24
-rw-r--r--core/ustring.h1
-rw-r--r--core/variant_call.cpp2
-rw-r--r--doc/base/classes.xml106
-rw-r--r--modules/gdscript/gd_parser.cpp4
-rw-r--r--modules/gdscript/gd_script.cpp1
-rw-r--r--platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl144
-rw-r--r--scene/2d/canvas_item.cpp2
-rw-r--r--scene/gui/line_edit.cpp110
-rw-r--r--scene/gui/line_edit.h18
-rw-r--r--scene/gui/text_edit.cpp12
-rw-r--r--scene/resources/default_theme/default_theme.cpp3
-rw-r--r--tools/editor/editor_settings.cpp2
13 files changed, 250 insertions, 179 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index ea9a9d903e..3c22de35f1 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -257,13 +257,10 @@ bool String::operator==(const StrRange &p_range) const {
return true;
const CharType *c_str=p_range.c_str;
-
- int l=length();
-
- const CharType *dst = p_range.c_str;
+ const CharType *dst = &operator[](0);
/* Compare char by char */
- for (int i=0;i<l;i++) {
+ for (int i=0;i<len;i++) {
if (c_str[i]!=dst[i])
return false;
@@ -2419,6 +2416,23 @@ Vector<uint8_t> String::md5_buffer() const {
return ret;
};
+Vector<uint8_t> String::sha256_buffer() const {
+ CharString cs = utf8();
+ unsigned char hash[32];
+ sha256_context ctx;
+ sha256_init(&ctx);
+ sha256_hash(&ctx, (unsigned char*)cs.ptr(), cs.length());
+ sha256_done(&ctx, hash);
+
+ Vector<uint8_t> ret;
+ ret.resize(32);
+ for (int i = 0; i < 32; i++) {
+ ret[i] = hash[i];
+ }
+
+ return ret;
+}
+
String String::insert(int p_at_pos,String p_string) const {
diff --git a/core/ustring.h b/core/ustring.h
index 692cb4e37d..bb57b11d88 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -196,6 +196,7 @@ public:
String md5_text() const;
String sha256_text() const;
Vector<uint8_t> md5_buffer() const;
+ Vector<uint8_t> sha256_buffer() const;
inline bool empty() const { return length() == 0; }
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 34e5164b24..c0f8930eed 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -271,6 +271,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(String,md5_text);
VCALL_LOCALMEM0R(String,sha256_text);
VCALL_LOCALMEM0R(String,md5_buffer);
+ VCALL_LOCALMEM0R(String,sha256_buffer);
VCALL_LOCALMEM0R(String,empty);
VCALL_LOCALMEM0R(String,is_abs_path);
VCALL_LOCALMEM0R(String,is_rel_path);
@@ -1322,6 +1323,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(STRING,STRING,String,md5_text,varray());
ADDFUNC0(STRING,STRING,String,sha256_text,varray());
ADDFUNC0(STRING,RAW_ARRAY,String,md5_buffer,varray());
+ ADDFUNC0(STRING,RAW_ARRAY,String,sha256_buffer,varray());
ADDFUNC0(STRING,BOOL,String,empty,varray());
ADDFUNC0(STRING,BOOL,String,is_abs_path,varray());
ADDFUNC0(STRING,BOOL,String,is_rel_path,varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 808bf20c25..09554e6a98 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -7059,8 +7059,11 @@
Draw a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture.
</description>
</method>
- <method name="edit_get" qualifiers="const">
+ <method name="edit_get_state" qualifiers="const">
+ <return type="Variant">
+ </return>
<description>
+ Used for editing, returns an opaque value representing the transform state.
</description>
</method>
<method name="edit_rotate">
@@ -7080,7 +7083,7 @@
<argument index="0" name="state" type="Variant">
</argument>
<description>
- Used for editing, returns an opaque value representing the transform state.
+ Set the transform state of this CanvasItem. For [Node2D], this is an [Array] with (in order) a [Vector2] for position, a float for rotation and another [Vector2] for scale. For [Control] this is a [Rect2] with the position and size.
</description>
</method>
<method name="get_blend_mode" qualifiers="const">
@@ -7094,6 +7097,7 @@
<return type="RID">
</return>
<description>
+ Return the [RID] of the [World2D] canvas where this item is in.
</description>
</method>
<method name="get_canvas_item" qualifiers="const">
@@ -7107,55 +7111,63 @@
<return type="Matrix32">
</return>
<description>
+ Get the transform matrix of this item's canvas.
</description>
</method>
<method name="get_global_mouse_pos" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Get the global position of the mouse.
</description>
</method>
<method name="get_global_transform" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get the global transform matrix of this item.
</description>
</method>
<method name="get_global_transform_with_canvas" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get the global transform matrix of this item in relation to the canvas.
</description>
</method>
<method name="get_item_and_children_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
+ Get a [Rect2] with the boundaries of this item and its children.
</description>
</method>
<method name="get_item_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
- Return a rect containing the editable contents of the item.
+ Return a rect containing the editable boundaries of the item.
</description>
</method>
<method name="get_light_mask" qualifiers="const">
<return type="int">
</return>
<description>
+ Get this item's light mask number.
</description>
</method>
<method name="get_local_mouse_pos" qualifiers="const">
<return type="Vector2">
</return>
<description>
+ Get the mouse position relative to this item's position.
</description>
</method>
<method name="get_material" qualifiers="const">
<return type="CanvasItemMaterial">
</return>
<description>
+ Get the material of this item.
</description>
</method>
<method name="get_opacity" qualifiers="const">
@@ -7176,30 +7188,35 @@
<return type="Matrix32">
</return>
<description>
+ Get the transform matrix of this item.
</description>
</method>
<method name="get_use_parent_material" qualifiers="const">
<return type="bool">
</return>
<description>
+ Get whether this item uses its parent's material.
</description>
</method>
<method name="get_viewport_rect" qualifiers="const">
<return type="Rect2">
</return>
<description>
+ Get the viewport's boundaries as a [Rect2].
</description>
</method>
<method name="get_viewport_transform" qualifiers="const">
<return type="Matrix32">
</return>
<description>
+ Get this item's transform in relation to the viewport.
</description>
</method>
<method name="get_world_2d" qualifiers="const">
<return type="Object">
</return>
<description>
+ Get the [World2D] where this item is in.
</description>
</method>
<method name="hide">
@@ -7241,13 +7258,14 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
+ Takes a global input event and convert to this item's coordinate system.
</description>
</method>
<method name="set_as_toplevel">
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Set as toplevel. This means that it will not inherit transform from parent canvas items.
+ Set as top level. This means that it will not inherit transform from parent canvas items.
</description>
</method>
<method name="set_blend_mode">
@@ -7261,25 +7279,28 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Sets whether the canvas item is drawn behind its parent.
+ Set whether the canvas item is drawn behind its parent.
</description>
</method>
<method name="set_hidden">
<argument index="0" name="hidden" type="bool">
</argument>
<description>
+ Set whether this item should be hidden or not. Note that no matter what is set here this item won't be shown if its parent or grandparents nodes are also hidden. A hidden CanvasItem make all children hidden too.
</description>
</method>
<method name="set_light_mask">
<argument index="0" name="light_mask" type="int">
</argument>
<description>
+ Set the ligtht mask number of this item.
</description>
</method>
<method name="set_material">
<argument index="0" name="material" type="CanvasItemMaterial">
</argument>
<description>
+ Set the material of this item.
</description>
</method>
<method name="set_opacity">
@@ -7300,6 +7321,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
+ Set whether or not this item should use its parent's material.
</description>
</method>
<method name="show">
@@ -7309,7 +7331,7 @@
</method>
<method name="update">
<description>
- Queue the CanvasItem for update. NOTIFICATION_DRAW will be called on idle time to request redraw.
+ Queue the CanvasItem for update. [code]NOTIFICATION_DRAW[/code] will be called on idle time to request redraw.
</description>
</method>
</methods>
@@ -18959,6 +18981,34 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Set the cursor position inside the [LineEdit], causing it to scroll if needed.
</description>
</method>
+ <method name="cursor_set_blink_enabled">
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ Set the line edit caret to blink.
+ </description>
+ </method>
+ <method name="cursor_get_blink_enabled" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Gets whether the line edit caret is blinking.
+ </description>
+ </method>
+ <method name="cursor_set_blink_speed">
+ <argument index="0" name="blink_speed" type="float">
+ </argument>
+ <description>
+ Set the line edit caret blink speed. Cannot be less then or equal to 0.
+ </description>
+ </method>
+ <method name="cursor_get_blink_speed" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ Gets the line edit caret blink speed.
+ </description>
+ </method>
<method name="set_editable">
<argument index="0" name="enabled" type="bool">
</argument>
@@ -37540,12 +37590,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
+ Return a copy of the string with special characters escaped using the C language standard.
</description>
</method>
<method name="c_unescape">
<return type="String">
</return>
<description>
+ Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
</description>
</method>
<method name="capitalize">
@@ -37577,6 +37629,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
+ Return true if the strings ends with the given string.
</description>
</method>
<method name="erase">
@@ -37585,6 +37638,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="chars" type="int">
</argument>
<description>
+ Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
</description>
</method>
<method name="extension">
@@ -37684,7 +37738,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
- Checked whether this string is a subsequence of the given string.
+ Check whether this string is a subsequence of the given string.
</description>
</method>
<method name="is_subsequence_ofi">
@@ -37693,7 +37747,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="text" type="String">
</argument>
<description>
- Checked whether this string is a subsequence of the given string, without considering case.
+ Check whether this string is a subsequence of the given string, without considering case.
</description>
</method>
<method name="is_valid_float">
@@ -37714,6 +37768,7 @@ A similar effect may be achieved moving this node's descendants.
<return type="bool">
</return>
<description>
+ Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.
</description>
</method>
<method name="is_valid_integer">
@@ -37734,6 +37789,7 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
+ Return a copy of the string with special characters escaped using the JSON standard.
</description>
</method>
<method name="left">
@@ -37774,12 +37830,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="RawArray">
</return>
<description>
+ Return the MD5 hash of the string as an array of bytes.
</description>
</method>
<method name="md5_text">
<return type="String">
</return>
<description>
+ Return the MD5 hash of the string as a string.
</description>
</method>
<method name="nocasecmp_to">
@@ -37797,7 +37855,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="at" type="int">
</argument>
<description>
- Return the character code at position "at".
+ Return the character code at position [code]at[/code].
</description>
</method>
<method name="pad_decimals">
@@ -37806,6 +37864,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="digits" type="int">
</argument>
<description>
+ Format a number to have an exact number of [code]digits[/code] after the decimal point.
</description>
</method>
<method name="pad_zeros">
@@ -37814,18 +37873,21 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="digits" type="int">
</argument>
<description>
+ Format a number to have an exact number of [code]digits[/code] before the decimal point.
</description>
</method>
<method name="percent_decode">
<return type="String">
</return>
<description>
+ Decode a percent-encoded string. See [method percent_encode].
</description>
</method>
<method name="percent_encode">
<return type="String">
</return>
<description>
+ Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
</description>
</method>
<method name="plus_file">
@@ -37834,6 +37896,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="0" name="file" type="String">
</argument>
<description>
+ If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
</description>
</method>
<method name="replace">
@@ -37889,10 +37952,17 @@ A similar effect may be achieved moving this node's descendants.
Return the right side of the string from a given position.
</description>
</method>
+ <method name="sha256_buffer">
+ <return type="RawArray">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="sha256_text">
<return type="String">
</return>
<description>
+ Return the SHA-256 hash of the string as a string.
</description>
</method>
<method name="similarity">
@@ -37912,7 +37982,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="allow_empty" type="bool" default="True">
</argument>
<description>
- Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return \["One","Two","Three"\] if split by ",".
+ Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".
</description>
</method>
<method name="split_floats">
@@ -37923,7 +37993,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="allow_empty" type="bool" default="True">
</argument>
<description>
- Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return \[1,2.5,3\] if split by ",".
+ Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".
</description>
</method>
<method name="strip_edges">
@@ -37945,7 +38015,7 @@ A similar effect may be achieved moving this node's descendants.
<argument index="1" name="len" type="int">
</argument>
<description>
- Return part of the string from "from", with length "len".
+ Return part of the string from the position [code]from[/code], with length [code]len[/code].
</description>
</method>
<method name="to_ascii">
@@ -37959,14 +38029,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="float">
</return>
<description>
- Convert a string, containing a decimal number, into a float.
+ Convert a string, containing a decimal number, into a [code]float[/code].
</description>
</method>
<method name="to_int">
<return type="int">
</return>
<description>
- Convert a string, containing an integer number, into an int.
+ Convert a string, containing an integer number, into an [code]int[/code].
</description>
</method>
<method name="to_lower">
@@ -37994,14 +38064,14 @@ A similar effect may be achieved moving this node's descendants.
<return type="String">
</return>
<description>
- Perform XML escaping on the string.
+ Return a copy of the string with special characters escaped using the XML standard.
</description>
</method>
<method name="xml_unescape">
<return type="String">
</return>
<description>
- Perform XML un-escaping of the string.
+ Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
</description>
</method>
</methods>
@@ -39262,8 +39332,6 @@ A similar effect may be achieved moving this node's descendants.
</theme_item>
<theme_item name="completion" type="StyleBox">
</theme_item>
- <theme_item name="completion_existing" type="Color">
- </theme_item>
<theme_item name="completion_lines" type="int">
</theme_item>
<theme_item name="completion_max_width" type="int">
@@ -39272,8 +39340,6 @@ A similar effect may be achieved moving this node's descendants.
</theme_item>
<theme_item name="completion_scroll_width" type="int">
</theme_item>
- <theme_item name="completion_selected" type="StyleBox">
- </theme_item>
<theme_item name="current_line_color" type="Color">
</theme_item>
<theme_item name="focus" type="StyleBox">
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index ac96a2117c..3ef42f81a4 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1069,8 +1069,8 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
// can be followed by an unary op in a valid combination,
// due to how precedence works, unaries will always dissapear first
- _set_error("Parser bug..");
-
+ _set_error("Unexpected two consecutive operators.");
+ return NULL;
}
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 026fd04869..e37a2ca155 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1709,6 +1709,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"false",
"float",
"int",
+ "bool",
"null",
"PI",
"self",
diff --git a/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl b/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl
deleted file mode 100644
index 2a492f7845..0000000000
--- a/platform/android/java/src/com/android/vending/billing/IInAppBillingService.aidl
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.vending.billing;
-
-import android.os.Bundle;
-
-/**
- * InAppBillingService is the service that provides in-app billing version 3 and beyond.
- * This service provides the following features:
- * 1. Provides a new API to get details of in-app items published for the app including
- * price, type, title and description.
- * 2. The purchase flow is synchronous and purchase information is available immediately
- * after it completes.
- * 3. Purchase information of in-app purchases is maintained within the Google Play system
- * till the purchase is consumed.
- * 4. An API to consume a purchase of an inapp item. All purchases of one-time
- * in-app items are consumable and thereafter can be purchased again.
- * 5. An API to get current purchases of the user immediately. This will not contain any
- * consumed purchases.
- *
- * All calls will give a response code with the following possible values
- * RESULT_OK = 0 - success
- * RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog
- * RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested
- * RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase
- * RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API
- * RESULT_ERROR = 6 - Fatal error during the API action
- * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
- * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
- */
-interface IInAppBillingService {
- /**
- * Checks support for the requested billing API version, package and in-app type.
- * Minimum API version supported by this interface is 3.
- * @param apiVersion the billing version which the app is using
- * @param packageName the package name of the calling app
- * @param type type of the in-app item being purchased "inapp" for one-time purchases
- * and "subs" for subscription.
- * @return RESULT_OK(0) on success, corresponding result code on failures
- */
- int isBillingSupported(int apiVersion, String packageName, String type);
-
- /**
- * Provides details of a list of SKUs
- * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
- * with a list JSON strings containing the productId, price, title and description.
- * This API can be called with a maximum of 20 SKUs.
- * @param apiVersion billing API version that the Third-party is using
- * @param packageName the package name of the calling app
- * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "DETAILS_LIST" with a StringArrayList containing purchase information
- * in JSON format similar to:
- * '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
- * "title : "Example Title", "description" : "This is an example description" }'
- */
- Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);
-
- /**
- * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
- * the type, a unique purchase token and an optional developer payload.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param sku the SKU of the in-app item as published in the developer console
- * @param type the type of the in-app item ("inapp" for one-time purchases
- * and "subs" for subscription).
- * @param developerPayload optional argument to be sent back with the purchase information
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "BUY_INTENT" - PendingIntent to start the purchase flow
- *
- * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
- * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
- * If the purchase is successful, the result data will contain the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_DATA" - String in JSON format similar to
- * '{"orderId":"12999763169054705758.1371079406387615",
- * "packageName":"com.example.app",
- * "productId":"exampleSku",
- * "purchaseTime":1345678900000,
- * "purchaseToken" : "122333444455555",
- * "developerPayload":"example developer payload" }'
- * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
- * was signed with the private key of the developer
- * TODO: change this to app-specific keys.
- */
- Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,
- String developerPayload);
-
- /**
- * Returns the current SKUs owned by the user of the type and package name specified along with
- * purchase information and a signature of the data to be validated.
- * This will return all SKUs that have been purchased in V3 and managed items purchased using
- * V1 and V2 that have not been consumed.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param type the type of the in-app items being requested
- * ("inapp" for one-time purchases and "subs" for subscription).
- * @param continuationToken to be set as null for the first call, if the number of owned
- * skus are too many, a continuationToken is returned in the response bundle.
- * This method can be called again with the continuation token to get the next set of
- * owned skus.
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
- * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
- * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
- * of the purchase information
- * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
- * next set of in-app purchases. Only set if the
- * user has more owned skus than the current list.
- */
- Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
-
- /**
- * Consume the last purchase of the given SKU. This will result in this item being removed
- * from all subsequent responses to getPurchases() and allow re-purchase of this item.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param purchaseToken token in the purchase information JSON that identifies the purchase
- * to be consumed
- * @return 0 if consumption succeeded. Appropriate error values for failures.
- */
- int consumePurchase(int apiVersion, String packageName, String purchaseToken);
-}
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index eb37634b24..976a5c4f1e 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1023,7 +1023,7 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_);
ObjectTypeDB::bind_method(_MD("edit_set_state","state"),&CanvasItem::edit_set_state);
- ObjectTypeDB::bind_method(_MD("edit_get"),&CanvasItem::edit_get_state);
+ ObjectTypeDB::bind_method(_MD("edit_get_state:Variant"),&CanvasItem::edit_get_state);
ObjectTypeDB::bind_method(_MD("edit_set_rect","rect"),&CanvasItem::edit_set_rect);
ObjectTypeDB::bind_method(_MD("edit_rotate","degrees"),&CanvasItem::edit_rotate);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 52ef57cf1c..579a6e2f0a 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -31,6 +31,9 @@
#include "os/os.h"
#include "print_string.h"
#include "label.h"
+#ifdef TOOLS_ENABLED
+#include "tools/editor/editor_settings.h"
+#endif
static bool _is_text_char(CharType c) {
@@ -57,6 +60,7 @@ void LineEdit::_input_event(InputEvent p_event) {
if (b.button_index!=BUTTON_LEFT)
break;
+ _reset_caret_blink_timer();
if (b.pressed) {
shift_selection_check_pre(b.mod.shift);
@@ -227,7 +231,7 @@ void LineEdit::_input_event(InputEvent p_event) {
}
}
-
+ _reset_caret_blink_timer();
if (!k.mod.meta) {
bool handled=true;
@@ -294,6 +298,9 @@ void LineEdit::_input_event(InputEvent p_event) {
}
case KEY_LEFT: {
+#ifndef APPLE_STYLE_KEYS
+ if (!k.mod.alt)
+#endif
shift_selection_check_pre(k.mod.shift);
#ifdef APPLE_STYLE_KEYS
@@ -543,14 +550,37 @@ void LineEdit::drop_data(const Point2& p_point,const Variant& p_data){
void LineEdit::_notification(int p_what) {
switch(p_what) {
+#ifdef TOOLS_ENABLED
+ case NOTIFICATION_ENTER_TREE: {
+ if (get_tree()->is_editor_hint()) {
+ cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false));
+ cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65));
+ EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed");
+ }
+ } break;
+#endif
case NOTIFICATION_RESIZED: {
set_cursor_pos( get_cursor_pos() );
} break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
+ window_has_focus = true;
+ draw_caret = true;
+ update();
+ } break;
+ case MainLoop::NOTIFICATION_WM_FOCUS_OUT: {
+ window_has_focus = false;
+ draw_caret = false;
+ update();
+ } break;
case NOTIFICATION_DRAW: {
+ if ((!has_focus() && !menu->has_focus()) || !window_has_focus) {
+ draw_caret = false;
+ }
+
int width,height;
Size2 size=get_size();
@@ -627,21 +657,26 @@ void LineEdit::_notification(int p_what) {
font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color);
- if (char_ofs==cursor_pos && has_focus())
+ if (char_ofs==cursor_pos && draw_caret) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(
Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color );
+ }
x_ofs+=char_width;
char_ofs++;
}
- if (char_ofs==cursor_pos && has_focus()) //may be at the end
+ if (char_ofs==cursor_pos && draw_caret) {//may be at the end
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(
Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color );
-
+ }
} break;
case NOTIFICATION_FOCUS_ENTER: {
+ if (!caret_blink_enabled) {
+ draw_caret = true;
+ }
+
if (OS::get_singleton()->has_virtual_keyboard())
OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
@@ -788,6 +823,45 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
}
+bool LineEdit::cursor_get_blink_enabled() const {
+ return caret_blink_enabled;
+}
+
+void LineEdit::cursor_set_blink_enabled(const bool p_enabled) {
+ caret_blink_enabled = p_enabled;
+ if (p_enabled) {
+ caret_blink_timer->start();
+ } else {
+ caret_blink_timer->stop();
+ }
+ draw_caret = true;
+}
+
+float LineEdit::cursor_get_blink_speed() const {
+ return caret_blink_timer->get_wait_time();
+}
+
+void LineEdit::cursor_set_blink_speed(const float p_speed) {
+ ERR_FAIL_COND(p_speed <= 0);
+ caret_blink_timer->set_wait_time(p_speed);
+}
+
+void LineEdit::_reset_caret_blink_timer() {
+ if (caret_blink_enabled) {
+ caret_blink_timer->stop();
+ caret_blink_timer->start();
+ draw_caret = true;
+ update();
+ }
+ }
+
+void LineEdit::_toggle_draw_caret() {
+ draw_caret = !draw_caret;
+ if (is_visible()) {
+ update();
+ }
+}
+
void LineEdit::delete_char() {
if ((text.length()<=0) || (cursor_pos==0)) return;
@@ -1126,8 +1200,21 @@ PopupMenu *LineEdit::get_menu() const {
return menu;
}
+#ifdef TOOLS_ENABLED
+ void LineEdit::_editor_settings_changed() {
+ cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false));
+ cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65));
+ }
+#endif
+
void LineEdit::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("_toggle_draw_caret"),&LineEdit::_toggle_draw_caret);
+
+#ifdef TOOLS_ENABLED
+ ObjectTypeDB::bind_method("_editor_settings_changed",&LineEdit::_editor_settings_changed);
+#endif
+
ObjectTypeDB::bind_method(_MD("set_align", "align"), &LineEdit::set_align);
ObjectTypeDB::bind_method(_MD("get_align"), &LineEdit::get_align);
@@ -1138,6 +1225,10 @@ void LineEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_text"),&LineEdit::get_text);
ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos);
ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos);
+ ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled);
+ ObjectTypeDB::bind_method(_MD("cursor_get_blink_enabled"),&LineEdit::cursor_get_blink_enabled);
+ ObjectTypeDB::bind_method(_MD("cursor_set_blink_speed", "blink_speed"),&LineEdit::cursor_set_blink_speed);
+ ObjectTypeDB::bind_method(_MD("cursor_get_blink_speed"),&LineEdit::cursor_get_blink_speed);
ObjectTypeDB::bind_method(_MD("set_max_length","chars"),&LineEdit::set_max_length);
ObjectTypeDB::bind_method(_MD("get_max_length"),&LineEdit::get_max_length);
ObjectTypeDB::bind_method(_MD("append_at_cursor","text"),&LineEdit::append_at_cursor);
@@ -1171,7 +1262,8 @@ void LineEdit::_bind_methods() {
ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") );
ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "secret" ), _SCS("set_secret"),_SCS("is_secret") );
ADD_PROPERTY( PropertyInfo( Variant::INT,"focus_mode", PROPERTY_HINT_ENUM, "None,Click,All" ), _SCS("set_focus_mode"), _SCS("get_focus_mode") );
-
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled"));;
+ ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1,10,0.1"), _SCS("cursor_set_blink_speed"),_SCS("cursor_get_blink_speed") );
}
LineEdit::LineEdit() {
@@ -1180,6 +1272,7 @@ LineEdit::LineEdit() {
cached_width = 0;
cursor_pos=0;
window_pos=0;
+ window_has_focus=true;
max_length = 0;
pass=false;
@@ -1189,6 +1282,13 @@ LineEdit::LineEdit() {
set_default_cursor_shape(CURSOR_IBEAM);
set_stop_mouse(true);
+ draw_caret=true;
+ caret_blink_enabled=false;
+ caret_blink_timer = memnew(Timer);
+ add_child(caret_blink_timer);
+ caret_blink_timer->set_wait_time(0.65);
+ caret_blink_timer->connect("timeout", this,"_toggle_draw_caret");
+ cursor_set_blink_enabled(false);
menu = memnew( PopupMenu );
add_child(menu);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index ce3958db02..e4da0f0b87 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -87,6 +87,11 @@ private:
bool drag_attempt;
} selection;
+ Timer *caret_blink_timer;
+ bool caret_blink_enabled;
+ bool draw_caret;
+ bool window_has_focus;
+
void shift_selection_check_pre(bool);
void shift_selection_check_post(bool);
@@ -97,10 +102,15 @@ private:
void set_cursor_at_pixel_pos(int p_x);
+ void _reset_caret_blink_timer();
+ void _toggle_draw_caret();
+
void clear_internal();
void changed_internal();
-
+#ifdef TOOLS_ENABLED
+ void _editor_settings_changed();
+#endif
void _input_event(InputEvent p_event);
void _notification(int p_what);
@@ -132,6 +142,12 @@ public:
void append_at_cursor(String p_text);
void clear();
+ bool cursor_get_blink_enabled() const;
+ void cursor_set_blink_enabled(const bool p_enabled);
+
+ float cursor_get_blink_speed() const;
+ void cursor_set_blink_speed(const float p_speed);
+
void copy_text();
void cut_text();
void paste_text();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 9342d077eb..6fd6137ac8 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2065,6 +2065,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (k.mod.shift)
_pre_shift_selection();
+#ifdef APPLE_STYLE_KEYS
+ else
+#else
+ else if (!k.mod.alt)
+#endif
+ deselect();
#ifdef APPLE_STYLE_KEYS
if (k.mod.command) {
@@ -2118,6 +2124,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
if (k.mod.shift)
_pre_shift_selection();
+#ifdef APPLE_STYLE_KEYS
+ else
+#else
+ else if (!k.mod.alt)
+#endif
+ deselect();
#ifdef APPLE_STYLE_KEYS
if (k.mod.command) {
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index db45a998c3..7ed83f50f8 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -469,6 +469,9 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F
t->set_font("font","TextEdit", default_font );
+ t->set_color("completion_background_color", "TextEdit",Color::html("2C2A32"));
+ t->set_color("completion_selected_color", "TextEdit",Color::html("434244"));
+ t->set_color("completion_existing_color", "TextEdit",Color::html("21dfdfdf"));
t->set_color("completion_scroll_color","TextEdit", control_font_color_pressed );
t->set_color("font_color","TextEdit", control_font_color );
t->set_color("font_color_selected","TextEdit", Color(0,0,0) );
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 457aecba4a..b89863289a 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -423,7 +423,7 @@ void EditorSettings::setup_network() {
if (ip=="127.0.0.1")
continue;
- if (lip!="")
+ if (lip=="")
lip=ip;
if (ip==current)
lip=current; //so it saves