Commit Graph

79 Commits

Author SHA1 Message Date
Jeff Wang 925b727bb1 replace setColor with setTextColor for RichElementText (#18985) 2018-08-17 11:52:16 +08:00
rh101 fd7f7ba085 Fix for Label and UIRichEdit text trailing space trimming (#18876)
* [UIRichText.cpp] Allow user to select if they want to trim trailing spaces for a RichElementText. Also fixed crash if estimatedIdx is less than 0 in certain conditions.
[UIRichText.h] New flag added for enabling trailing space trimming.
[CCLabelTextFormatter.cpp] Only trim trailing whitespace if lines are being split. This will trim all whitespace up to the next non-whitespace token in a line.

* Fix for oversized sprites that need to be offset by X and Y to be aligned correctly in the UIRichText

* Revert "Fix for oversized sprites that need to be offset by X and Y to be aligned correctly in the UIRichText"

This reverts commit fc5492e878a982ff748488bf1de4ffa88a3d4755.

* [UIRichText] Reverted changes made for trimming since they are no longer required. The changes made to CCLabelTextFormatter.cpp fixed all the current issues.

* Added test cases from #18869

* Removed the forced trailing space clipping since it is not required here, and causing side-effects.

* Removed comment that no longer applies to that section of code
2018-06-08 17:06:29 +08:00
leeda 18a6d8241d update Copyright. might need manual fix later (#18659)
* Copyright use python script updated. might be fix by manual later

* Revert "Copyright use python script updated. might be fix by manual later"

This reverts commit 49e99418e4da1fd02afda448ddeb16210f5e8c71.

* re modify copyright, consider utf-8-sig encoding

* another situation, add Copyright before  "Permission is hereby granted"

* Revert "another situation, add Copyright before  "Permission is hereby granted""

This reverts commit ee82591d32353c7ce2e146fe51ef447433b47571.

* another situation, add Copyright before Permission is hereby granted

* change "Copyright (c) 2016-2016 Chukong Technologies Inc." to " Copyright (c) 2016 Chukong Technologies Inc."

* script modify copyright, consider is cocos copyright or not

* change "Copyright (c) 2017 Chukong Technologies Inc." to "Copyright (c) 2016 Chukong Technologies Inc."

* manual fix, not fix audio related

* change "2016-2016" to "2016"
2018-01-29 16:25:32 +08:00
Jeff Wang bceb242ebd no message (#18460) 2017-11-10 15:05:21 +08:00
Jeff Wang b7bb03a061 RichText improvements (#18447)
* RichText improvements

* add support for continuous \n

* update UIRichText.cpp

* fix issue out of bounds

* Update UIRichText.cpp

* replace defaultHeights with lineHeights

* Update UIRichText.cpp
2017-11-08 13:59:57 +08:00
Jeff Wang 0051c21be6 fix typos (#18444) 2017-11-06 10:28:11 +08:00
minggo b77c29f750 make RichText supports img tag with Sprite Frame name (#18087) 2017-07-24 10:35:52 +08:00
kepler-5 d3eb857482 horizontal alignment support in RichText (#18027)
* horizontal alignment support in RichText

* split lambda into separate function

* tweak shadow test's content size so horizontal aligment doesn't give the illusion of behaving incorrectly

* fix alignment when the last char of a line is whitespace

* fix errors from merge

* fix bug in setting of size of image elements. scaling was applied effectively twice.

* removed debugging code. whoops
2017-07-05 09:25:12 +08:00
kepler-5 bbe84f8d7a Remove unnecessary dynamic allocation (#18014)
* don't dynamically allocate PointArray's internal vector. take advantage of move semantics where possible.

* don't dynamically allocate RichText's _elementRenders vectors
2017-07-04 14:31:29 +08:00
mogemimi c06612251c Use range-based for loops to avoid shadowing (#17281) 2017-02-06 15:14:18 +08:00
Wilson E. Alvarez ca28af0113 Fixed variable order in initializer lists (#17274) 2017-02-04 10:33:58 +08:00
pyrosphere 663bb4d7ed No CC_UNUSED_PARAM (#16812)
* Added -Wno-unused-parameter and removed all uses of the CC_UNUSED_PARAM macro

* Commented unused parameter names in .cpp files which previously used CC_UNUSED_PARAM

* Reverted -Wno-unused-param flag.
Moved deprecated touch methods definitions to .cpp file.
Commented more unused parameter names.

* Fixed some errors and warnings caused by the previous commit.

* Commented remaining unused parameter names in .cpp files.

* Fixed unused parameter warnings in headers.

* Fixed some more unused parameter warnings.

* Fixed some more unused parameters warnings.

* Fixed mistake in previous commit, missing ComAudioReader:: in method. Other warnings.

* Fixed build errors.

* Added missing file to CMakeLists
2016-11-16 09:48:37 +08:00
Wilson E. Alvarez c0e1e91373 Performance tweak: Use range-based for-loops and allocate std::vector size() and *end() on the stack where favorable. (#16716)
* Use range-based for-loops and allocate std::vector size(), end(), cend(), rend(), crend() on the stack where favorable.

Other minor trivial changes were applied.

* Fixed Android compilation error

* Fixed windows-universal compilation error
2016-10-27 15:10:24 +08:00
mogemimi 8b703a8d12 Fix implicit conversion warning (#16598)
* Fix implicit conversion warning

* Change SAXParser::textHandler parameter type from int to size_t
2016-09-26 14:49:47 +08:00
halx99 5bc3659a33 #Improve XML parse performance with rapidxml pure SAX parser (#16419)
* Update CCSAXParser.cpp

* #Improve XML parse performance with rapidxml pure SAX parser without compatible break.

* put rapidxml to external

* Update deps
2016-08-24 16:37:03 -07:00
mogemimi 2650fd1afd Add missing float suffix to avoid -Wdouble-promotion 2016-07-04 23:12:45 +09:00
mogemimi a3bc979452 Fix typos in documentation and comments 2016-06-22 11:22:05 +09:00
Adrien de Sentenac dac9be5016 Various CMake improvements
- Added c++_shared (LLVM) to Android toolchain options. Fixed AndroidNdkGdb.cmake.
- Fixed includes when not using prebuilt libs. Added option to use sources in external when not using prebuilt libs.
- Added option in CMake to be able build Box2D without using it as physics library in cocos2d-x (similar to what is done in the Visual Studio solution).
2016-06-14 10:20:57 -04:00
mogemimi a1a8feed71 Add missing references to avoid unnecessary copies 2016-05-17 01:15:07 +09:00
Xpol Wan 1cc0130bdd Fixes signed/unsigned mismatch warnings.
```
2d\CCFontFNT.cpp(328): warning C4018: '<' : signed/unsigned mismatch
2d\CCLabel.cpp(782): warning C4018: '>' : signed/unsigned mismatch
2d\CCLabel.cpp(784): warning C4018: '<' : signed/unsigned mismatch
scripting\js-bindings\manual\cocos2d_specifics.cpp(2741): warning C4018: '<' : signed/unsigned mismatch
tests\cpp-tests\Classes\Sprite3DTest\Sprite3DTest.cpp(1969): warning C4018: '>=' : signed/unsigned mismatch
tests\cpp-tests\Classes\TextInputTest\TextInputTest.cpp(264): warning C4018: '>=' : signed/unsigned mismatch
ui\UIEditBox\UIEditBoxImpl-common.cpp(113): warning C4018: '<' : signed/unsigned mismatch
ui\UIRichText.cpp(1573): warning C4018: '<=' : signed/unsigned mismatch
ui\UITextField.cpp(89): warning C4018: '>=' : signed/unsigned mismatch
```
2016-04-26 17:53:25 +08:00
mogemimi a3ad4cddf8 Fix warnings about signed/unsigned mismatch 2016-04-22 12:20:05 +09:00
Ricardo Quesada b8eae430fb Merge pull request #15289 from m-yukio/feature/richtext_xml_refactor
extend the RichText
2016-04-20 20:05:29 -07:00
Yukio Murakami a8ddbdc12c defaults and append tag support 2016-04-21 10:03:57 +09:00
Ricardo Quesada 4bb35f2219 fix: fix crash in win for rich text
use `std::locale()` when invoking `std::isXXX` function
to avoid crash

github issue #15423
2016-04-19 13:53:27 -07:00
Xpol Wan 90456d29ba Fixes 1605 include path in 541 files
using the tools/coding-style/include-linter.py with -f options.
2016-03-20 21:53:44 +08:00
Ricardo Quesada 7582518424 default is word-wrap 2016-01-22 06:20:01 -08:00
Ricardo Quesada 25f78e490d RichText with word wrapping working as expected 2016-01-21 21:44:45 -08:00
Ricardo Quesada 7735a75651 adds JS tests for RichText 2016-01-20 17:59:13 -08:00
Ricardo Quesada e36d71a24c adds Invalid test
UIRichText reports error on console when parsing invalid xml
2016-01-19 21:16:53 -08:00
Ricardo Quesada 27c8e5227d Adds xml support in UIRichText
Supported tags:
- <small>: makes the font 20% smaller
- <big>: makes the font 25% bigger
- <img src="" />: to add an image
- <font face="path to font" size="size" color="#00ffaa">: font
  attributes
- <i>: italics
- <b>: bold
- <u>: underline
- <del> strike-through
- </br>: new line

Also adds support for strikethrough, italics, bold and underlie to
`Label`

Contains tests for UIRichText and Label

Squashed commit of the following:

commit a0d6ae0513d40dbf414930210ab032a49d8984a0
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 19 20:39:21 2016 -0800

    cleanup LabelTestNew

commit 0cf423af85d88a42fc1317207feeb3d05da7f8ab
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 19 20:34:53 2016 -0800

    adds maaaany tests

    ...and fixes width and height in <img src="">

commit e8ba6acd5d79bbc766d7aa02ef166e166c801d01
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 15 19:41:37 2016 -0800

    Label + URL working Ok

commit 36689e29ee3d77310e92264a09084cc06e30664c
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 15 18:24:44 2016 -0800

    adding this code just in case...

    ... should use a listener component instead

commit af03708950e74483b875d0baad593aa6ed242a04
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Thu Jan 14 20:23:36 2016 -0800

    URL node

    plus <de><u> and <a img

commit e3a4930b012c0b3756752dac6ffb5ad43d24ae99
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Jan 13 18:42:18 2016 -0800

    strikethrough and underline implemented

    they support multiline and horizontal alignment as well
    includes test
    however vertical alignment might not work

commit 640ccf39f56e153db46785a61be7000e898174c7
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 18:14:57 2016 -0800

    bug fixes

commit 5e41fb76e91c571639585a609a255eb41797a302
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 16:47:20 2016 -0800

    adds italics and bold "disable test"

commit 202c5a45bb9c8ea160b9f6880ef858874e07814b
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 14:40:13 2016 -0800

    adds italics test

commit d1a8b421445053cc36860fc376f52692a3672dfe
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Mon Jan 11 20:53:23 2016 -0800

    italics is working ok

commit fdd02087fce920c27c2409301ec88685fe68085b
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 8 17:18:56 2016 -0800

    color, size and face working

commit c01bdef6b1d49f8805b69d4c162b74cd00c8f5b3
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Thu Jan 7 19:02:16 2016 -0800

    initial commit
2016-01-19 20:41:31 -08:00
Wenhai Lin 4fa58602a8 Adds `std::nothrow` to the `new` statements 2015-12-16 14:02:55 +08:00
Yukio Murakami bc4bd99863 Support the new line element. Fixed a problem that protrude from the drawing area. 2015-09-28 14:47:09 +09:00
pandamicro 66b21fb2a8 Merge pull request #12972 from yangws/issue_12145
Fixed #12145 : formarRenderers in RichText doesn’t update container s…
2015-07-28 17:13:26 +08:00
Vincent Yang b92733c402 Add items as protected children. 2015-07-28 11:38:21 +08:00
fusijie 651d877e28 set minimum display length to 1. 2015-07-27 17:55:32 +08:00
Vincent Yang 57943b41b1 Fixed #12145 : formarRenderers in RichText doesn’t update container size. 2015-07-23 14:59:24 +08:00
andyque 294271682b change return const value to value 2014-09-12 14:39:22 +08:00
andyque ed22792a72 fix text only button issue 2014-09-12 13:50:13 +08:00
minggo 6a8270f33b Merge pull request #7900 from minggo/setposition-optimize
not create Vec as possible for setting position
2014-08-28 14:31:54 +08:00
minggo 9fb977ff99 not create Vec as possible for setting position 2014-08-28 11:41:18 +08:00
Ricardo Quesada 3dda35b4ef Adds `std::nothrow` to `new`
Since cocos2d-x doesn't support exceptions, it is important to add
`std::nothrow` to all the `new` statements
2014-08-27 16:31:57 -07:00
andyque f2b0528cc9 refactor 2014-07-30 10:45:35 +08:00
andyque 955da5d3cc move utf8_substr to ui::helper class. 2014-07-30 10:34:37 +08:00
andyque a9a16b3ee5 fix RichText visit issue 2014-07-24 11:51:47 +08:00
andyque 21f1624462 minor fix of RichText 2014-07-23 14:10:00 +08:00
andyque 7ff78c61ba fix richText UTF8 2014-07-17 18:36:09 +08:00
andyque fc2ab110cc fix richText utf8 error 2014-07-17 17:58:40 +08:00
Dhilan007 6cff8cb564 fixed warn and replace NULL with nullptr. 2014-07-10 00:45:27 +08:00
minggo 66703addb2 fixed #4693: override addChild by name 2014-06-25 11:27:48 +08:00
andyque 4d82673760 issue #5161, replace _size with _contentSize 2014-06-24 15:08:58 +08:00