Commit Graph

470 Commits

Author SHA1 Message Date
5792e77239 Patch [#34373] Use i18n monospace font in Text editor and Python console
This patch allows Blender to display i18n monospace font in the text
editor and the Python interactive console. Wide characters that occupy
multiple columns such as CJK characters can be displayed correctly.
Furthermore, wrapping, selection, suggestion, cursor drawing, and
syntax highlighting should work.

Also fixes a bug [#34543]: In Text Editor false color in comment on cyrillic

To estimate how many columns each character occupies, this patch uses
wcwidth.c written by Markus Kuhn and distributed under MIT-style license:

  http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

wcwidth.c is stored in extern/wcwidth and used as a static library.

This patch adds new API to blenfont, blenlib and blenkernel:

BLF_get_unifont_mono()
BLF_free_unifont_mono()
BLF_draw_mono()
BLI_wcwidth()
BLI_wcswidth()
BLI_str_utf8_char_width()
BLI_str_utf8_char_width_safe()
txt_utf8_offset_to_column()
txt_utf8_column_to_offset()
2013-03-12 07:25:53 +00:00
ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
53b7bc8f1f Change !BLI_ghashIterator_isDone to BLI_ghashIterator_notDone. It is
always used in that context so we can at least avoid reverting it twice
:p.
2013-03-06 20:55:04 +00:00
713c9afb39 fix [#34460] text editor freezes when turning on syntax highlight 2013-02-27 14:19:44 +00:00
b1543f07bf Another bunch of UI translation fixes, thanks to Leon Cheung, Gabriel Gazzán and S. Lockal for spotting them! 2013-02-24 15:40:28 +00:00
7f1ae2497b fix [#34275] Text autocomplete cuts words with accents or special characters
autocomplete is now unicode aware, using python api's checks for now. eventually we should have our own.
2013-02-19 16:13:41 +00:00
cd3b98c4fa step over unicode characters with autocomplete (correctly this time). 2013-02-19 15:56:49 +00:00
54311fde29 revert own commit r54625, broke autocomplete. 2013-02-19 13:41:53 +00:00
098e4234b1 minor change to own recent commit with transform fcurve centers and some style edits and typo corrections. 2013-02-19 02:30:02 +00:00
5ba0eb0ae5 Fix some popups being too small on retina display, among them the new image dialog. 2013-02-18 15:08:27 +00:00
1c216337f0 make autocomplete use unicode character stepping (needed for bugfix). 2013-02-18 12:00:17 +00:00
ab7ca2dc44 fix for double clicking in the text editor not working usefully (double clicking a pair chars would select 3 - one to the left). 2013-02-14 03:03:12 +00:00
fdfa5910b5 Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances:

- Normal Map node requires tesselated faces to compute tangent space
- All temporary meshes needed for Cycles export were adding to G.main
- Undo pushes would temporary set meshes tessfaces to NULL
- Moving node will cause undo push and tree re-evaluate fr preview

All this leads to threading conflict between preview render and undo
system.

Solved it in  way that all temporary meshes are adding to that exact
Main which was passed to Cycles via BlendData. This required couple
of mechanic changes like adding extra parameter to *_add() functions
and adding some *_ex() functions to make it possible RNA adds objects
to Main passed to new() RNA function.

This was tricky to pass Main to RNA function and IMO that's not so
nice to pass main to function, so ended up with such decision:

- Object.to_mesh() will add temp mesh to G.main
- Added Main.meshes.new_from_object() which does the same as to_mesh,
  but adds temporary mesh to specified Main.

So now all temporary meshes needed for preview render would be added
to preview_main which does not conflict with undo pushes.

Viewport render shall not be an issue because object sync happens from
main thread in this case.

It could be some issues with final render, but that's not so much
likely to happen, so shall be fine.

Thanks to Brecht for review!
2013-02-05 12:46:15 +00:00
6e7ee2649d style cleanup 2013-01-16 18:16:05 +00:00
fe83dc6882 dont add identifiers starting with digits to autocomplete 2013-01-16 04:43:37 +00:00
d0e65f2bf4 text syntax highlighting: don't use utf8 stepping if we know the text is ascii 2013-01-16 04:05:01 +00:00
6fd5645d56 patch [#33888] Syntax Highlighting Changes
from Benjamin Tolputt (btolputt), (with minor changes)

adds support for LUA syntax highlighting.
2013-01-16 03:43:09 +00:00
c420547625 correction to last commit 2013-01-16 03:30:40 +00:00
a6d9bcd36d text syntax highlighting, add utility function 'text_format_fill()' which fills in the line with a formatting value.
this fixes a mistake in OSL lexer which would comment all lines after '//'
2013-01-16 03:18:22 +00:00
71b9acaf76 Bug fix #33873
CTRL+F in text editor now also works in the button region.
Added generic keymap for it, could get other shortcuts as well. Will leave it to the
maintainers :)
2013-01-15 16:53:52 +00:00
5ffcde851b Add translation contexts for line, mute and clip 2013-01-05 12:06:50 +00:00
9d9542561c code cleanup: autocomplete functions 2012-12-31 17:19:55 +00:00
d191dec1d5 syntax highlight autocomplete listing. 2012-12-31 16:40:14 +00:00
dd62a2c375 text autocomplete
- make the popup box line up the X axis with the current word.
- add poll function for the operator
2012-12-31 16:24:49 +00:00
4e1da54b5e add back initial autocomplete support.
- This doesnt use python as 2.4x did, instead it just autocompletes based on the text files unique identifiers so its useful for any language.
- key is same as console (Ctrl+Space)
2012-12-31 15:11:36 +00:00
acc05db50f minor updates to text autocomplete api
- draw function wasn't lining up correctly since DPI edits
- rename text_python.c to text_autocomplete.c
2012-12-31 14:49:27 +00:00
feb0d1d698 Fix crash in syntax color code when drawing a text editor with no text. 2012-12-30 18:17:20 +00:00
e54b95d1c9 optimization for text drawing:
- dont set the color for each character, check if it changes from the previous one.
- dont memcpy text into a null terminated string to draw, instead rely on the length argument to BLF_draw().
2012-12-30 15:40:49 +00:00
f7e8ffdb85 OSL Templates:
* Add 3 simple templates:
** empty_shader.osl: A basic shader declaration to start with
** wireframe.osl: Simple wireframe shader
** noise.osl: Simple noise shader, with 3 noise types.
2012-12-30 03:11:52 +00:00
398da25b1b OSL Syntax Highlighting:
* Added the remaining shader types
* Some comment and link fixes.
2012-12-30 02:51:29 +00:00
33955940e4 add templates menu for OSL, use preprocessor directive color for decorators in python. 2012-12-30 01:39:55 +00:00
e12354c4c5 add syntax highlighting color for symbols 2012-12-30 01:26:31 +00:00
099d8c9390 code cleanup: enum for formatting char (avoid confusion when '#' is a comment for // in OSL) 2012-12-30 01:12:21 +00:00
4ed9cea8ce code cleanup: text editor formatting enums were named crypticly, also add asserts if the continuation values are wrong (which can happen with buffer overflows on formatting). 2012-12-30 00:46:17 +00:00
1fd0520725 Infinite loop caused by using an uninitialized variable in a compairison statement 2012-12-29 22:06:44 +00:00
76fd28c25d Missing NULL check which crashes on opening the Text Editor without an active Text object 2012-12-29 20:16:21 +00:00
e9c7aaaa3c patch [#33609] Syntax highlighting for OSL in Text Editor
from Patrick Boelens (senshi). with modifications to split it into its own function.

also added C style multi-line comment support /* ... */

I've left out the part of this patch that sets the language in the space, since I think this might be better stored in the text block.

For now it simply uses OSL syntax highlighting when the extension is '.osl'.
2012-12-29 18:25:03 +00:00
14ea084580 fix for 2 errors in python syntax highlighting, no space was allowed in decorators and decorators where being skipped. 2012-12-29 18:20:14 +00:00
8c29f611e9 code cleanup: text editor syntax highlighting - avoid loops using memset() 2012-12-29 16:18:03 +00:00
4fc84b8f15 text editor: replace strncmp() and hard coded size with STR_LITERAL_STARTSWITH() macro that gets the size from sizeof(). 2012-12-29 16:04:45 +00:00
c157f815a8 code cleanup 2012-12-29 02:57:52 +00:00
4a427d8e0d style cleanup 2012-12-29 01:54:58 +00:00
4d3f0cb8c1 Better cursor centering for text editor 2012-12-20 16:37:07 +00:00
cc23d4cd3e use DPI for scrollbar width 2012-12-19 15:22:39 +00:00
3134407c48 code cleanup: remove unneeded include's and rename some static functions in text_format_py.c 2012-12-19 04:23:02 +00:00
f43923d86d generalize formatting code so different formatters can be registered and each has their own source file,
Since we will likely have OSL formatting added soon.
2012-12-19 04:02:19 +00:00
ab2c273b12 Added GPL header to sconscripts!
Also changed shebang to '#!/usr/bin/env python', this is more portable across unixes...
2012-12-17 08:01:43 +00:00
81d240c8c8 avoid using strlen() for comparisons in for loops. for expanding whitespace in the text editor and ui paste. 2012-12-15 07:57:16 +00:00
48661fd663 tweaks to text selection and highlight drawing. 2012-12-14 06:12:04 +00:00
12b642062c Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability

Short list of main changes:

- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
  Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
  This allows keeping UI and data without actual saves, until you actually save.
  When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). 
  Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. 
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
  Old option is called "Save Startup File" the new one "Save User Settings".
  To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
  This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00