From 4a04f7206914a49f5f95adc5eb786237f1a9f547 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 23 Oct 2011 17:52:20 +0000 Subject: remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n --- source/blender/editors/interface/CMakeLists.txt | 1 - source/blender/editors/interface/interface.c | 2 -- source/blender/editors/interface/interface_anim.c | 2 -- source/blender/editors/interface/interface_draw.c | 2 -- .../blender/editors/interface/interface_handlers.c | 42 ++++++++++++++++------ source/blender/editors/interface/interface_icons.c | 2 -- .../blender/editors/interface/interface_intern.h | 2 -- .../blender/editors/interface/interface_layout.c | 2 -- source/blender/editors/interface/interface_ops.c | 2 -- source/blender/editors/interface/interface_panel.c | 2 -- source/blender/editors/interface/interface_style.c | 2 +- .../editors/interface/interface_templates.c | 2 -- .../blender/editors/interface/interface_widgets.c | 2 +- source/blender/editors/interface/resources.c | 2 -- source/blender/editors/interface/view2d.c | 2 -- source/blender/editors/interface/view2d_ops.c | 2 -- 16 files changed, 33 insertions(+), 38 deletions(-) (limited to 'source/blender/editors/interface') diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 678be82f160..8ba86673f87 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 12931 2007-12-17 18:20:48Z theeth $ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f9991079507..5b27fe88b4b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index aeb8ad99dd2..1edd43d4e01 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index aefe773fdad..3d08e761090 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9f77317292c..e49cb4898d9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1437,8 +1437,11 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, ui_check_but(but); } -/* note: utf8 & ascii funcs should be merged */ -static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) +/* this is used for both utf8 and ascii, its meant to be used for single keys, + * notie the buffer is either copied or not, so its not suitable for pasting in + * - campbell */ +static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data, + const char *utf8_buf, int utf8_buf_len) { char *str; int len, changed= 0; @@ -1447,7 +1450,7 @@ static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const cha len= strlen(str); if(len-(but->selend - but->selsta)+1 <= data->maxlen) { - int step= BLI_str_utf8_size(utf8_buf); + int step= utf8_buf_len; /* type over the current selection */ if ((but->selend - but->selsta) > 0) { @@ -1468,8 +1471,17 @@ static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const cha static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) { - char utf8_buf[6]= {ascii, '\0'}; - return ui_textedit_type_utf8(but, data, utf8_buf); + char buf[2]= {ascii, '\0'}; + + if (ui_is_but_utf8(but) && (BLI_str_utf8_size(buf) == -1)) { + printf("%s: entering invalid ascii char into an ascii key (%d)\n", + __func__, (int)(unsigned char)ascii); + + return 0; + } + + /* in some cases we want to allow invalid utf8 chars */ + return ui_textedit_type_buf(but, data, buf, 1); } static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, uiButtonJumpType jump) @@ -1932,18 +1944,26 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) { char ascii = event->ascii; + const char *utf8_buf= event->utf8_buf; /* exception that's useful for number buttons, some keyboard numpads have a comma instead of a period */ - if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) - if(event->type == PADPERIOD && ascii == ',') + if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/ + if(event->type == PADPERIOD && ascii == ',') { ascii = '.'; + utf8_buf= NULL; /* force ascii fallback */ + } + } - if(event->utf8_buf[0]) { + if(utf8_buf && utf8_buf[0]) { + int utf8_buf_len= BLI_str_utf8_size(utf8_buf); /* keep this printf until utf8 is well tested */ - printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); - // strcpy(event->utf8_buf, "12345"); - changed= ui_textedit_type_utf8(but, data, event->utf8_buf); + if (utf8_buf_len != 1) { + printf("%s: utf8 char '%.*s'\n", __func__, utf8_buf_len, utf8_buf); + } + + // strcpy(utf8_buf, "12345"); + changed= ui_textedit_type_buf(but, data, event->utf8_buf, utf8_buf_len); } else { changed= ui_textedit_type_ascii(but, data, ascii); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index f987aa9c4e6..39f6cb7b0c2 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 9d0383c8812..9c5fafaf167 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index be6c89eb37d..add023c940b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index eee771cbd93..27f94ae8e49 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 546f4f0b639..9a253952e6d 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 92d02ff3dc2..0e9dbaf3022 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -1,5 +1,5 @@ /* -* ***** BEGIN GPL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 34f9849fac7..b816d1a8f9c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 0215cc05d36..c5ac4f5aa88 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1,5 +1,5 @@ /* -* ***** BEGIN GPL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 61936fba931..d3a5c6691ef 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 18db1c8c894..5e97e01aed6 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 30ae69b71b8..998e70d5e25 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or -- cgit v1.2.3