[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52224] trunk/blender/source/blender: fix for deleting lines hanging the text editor when no markers are used, presence of markers still hangs.
Campbell Barton
ideasman42 at gmail.com
Thu Nov 15 03:11:43 CET 2012
Revision: 52224
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52224
Author: campbellbarton
Date: 2012-11-15 02:11:40 +0000 (Thu, 15 Nov 2012)
Log Message:
-----------
fix for deleting lines hanging the text editor when no markers are used, presence of markers still hangs.
also compiler warnings and some style edits.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/text.c
trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp
trunk/blender/source/blender/editors/space_text/text_ops.c
Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c 2012-11-15 02:05:32 UTC (rev 52223)
+++ trunk/blender/source/blender/blenkernel/intern/text.c 2012-11-15 02:11:40 UTC (rev 52224)
@@ -1764,7 +1764,7 @@
txt_undo_store_cursors(text);
text->undo_buf[text->undo_pos] = op;
- text->undo_buf[text->undo_pos+1] = 0;
+ text->undo_buf[text->undo_pos + 1] = 0;
}
/* store an operator for a single character */
@@ -2386,20 +2386,22 @@
static void txt_delete_line(Text *text, TextLine *line)
{
TextMarker *mrk = NULL, *nxt;
- int lineno = -1;
if (!text) return;
if (!text->curl) return;
- lineno = txt_get_span(text->lines.first, line);
- mrk = text->markers.first;
- while (mrk) {
- nxt = mrk->next;
- if (mrk->lineno == lineno)
- BLI_freelinkN(&text->markers, mrk);
- else if (mrk->lineno > lineno)
- mrk->lineno--;
- mrk = nxt;
+ /* warning, this can be _slow_ when deleting many lines! */
+ if ((mrk = text->markers.first)) {
+ int lineno = txt_get_span(text->lines.first, line);
+ mrk = text->markers.first;
+ while (mrk) {
+ nxt = mrk->next;
+ if (mrk->lineno == lineno)
+ BLI_freelinkN(&text->markers, mrk);
+ else if (mrk->lineno > lineno)
+ mrk->lineno--;
+ mrk = nxt;
+ }
}
BLI_remlink(&text->lines, line);
@@ -2417,14 +2419,14 @@
{
char *tmp;
TextMarker *mrk = NULL;
- int lineno = -1;
-
+
if (!text) return;
if (!linea || !lineb) return;
mrk = txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
if (mrk) {
+ int lineno;
lineno = mrk->lineno;
do {
mrk->lineno--;
@@ -2433,8 +2435,11 @@
mrk = mrk->next;
} while (mrk && mrk->lineno == lineno);
}
- if (lineno == -1) lineno = txt_get_span(text->lines.first, lineb);
-
+#if 0 /* UNUSED */
+ if (lineno == -1)
+ lineno = txt_get_span(text->lines.first, lineb);
+#endif
+
tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string");
strcpy(tmp, linea->line);
Modified: trunk/blender/source/blender/bmesh/operators/bmo_bevel.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-11-15 02:05:32 UTC (rev 52223)
+++ trunk/blender/source/blender/bmesh/operators/bmo_bevel.c 2012-11-15 02:11:40 UTC (rev 52224)
@@ -110,8 +110,9 @@
float offset; /* blender units to offset each side of a beveled edge */
int seg; /* number of segments in beveled edge profile */
} BevelParams;
-#include "bevdebug.c"
+//#include "bevdebug.c"
+
/* Make a new BoundVert of the given kind, insert it at the end of the circular linked
* list with entry point bv->boundstart, and return it. */
static BoundVert *add_new_bound_vert(MemArena *mem_arena, VMesh *vm, float co[3])
Modified: trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp 2012-11-15 02:05:32 UTC (rev 52223)
+++ trunk/blender/source/blender/compositor/operations/COM_MapRangeOperation.cpp 2012-11-15 02:11:40 UTC (rev 52224)
@@ -51,10 +51,10 @@
float dest_min, dest_max;
this->m_inputOperation->read(inputs, x, y, sampler);
- this->m_sourceMinOperation->read(inputs+1, x, y, sampler);
- this->m_sourceMaxOperation->read(inputs+2, x, y, sampler);
- this->m_destMinOperation->read(inputs+3, x, y, sampler);
- this->m_destMaxOperation->read(inputs+4, x, y, sampler);
+ this->m_sourceMinOperation->read(inputs + 1, x, y, sampler);
+ this->m_sourceMaxOperation->read(inputs + 2, x, y, sampler);
+ this->m_destMinOperation->read(inputs + 3, x, y, sampler);
+ this->m_destMaxOperation->read(inputs + 4, x, y, sampler);
value = inputs[0];
source_min = inputs[1];
Modified: trunk/blender/source/blender/editors/space_text/text_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_ops.c 2012-11-15 02:05:32 UTC (rev 52223)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c 2012-11-15 02:11:40 UTC (rev 52224)
@@ -1135,7 +1135,8 @@
tmp = text->lines.first;
- //first convert to all space, this make it a lot easier to convert to tabs because there is no mixtures of ' ' && '\t'
+ /* first convert to all space, this make it a lot easier to convert to tabs
+ * because there is no mixtures of ' ' && '\t' */
while (tmp) {
text_check_line = tmp->line;
number = flatten_string(st, &fs, text_check_line) + 1;
@@ -1669,8 +1670,8 @@
text_update_character_width(st);
- if (sel) linep = &text->sell, charp = &text->selc;
- else linep = &text->curl, charp = &text->curc;
+ if (sel) { linep = &text->sell; charp = &text->selc; }
+ else { linep = &text->curl; charp = &text->curc; }
oldc = *charp;
@@ -1735,8 +1736,8 @@
text_update_character_width(st);
- if (sel) linep = &text->sell, charp = &text->selc;
- else linep = &text->curl, charp = &text->curc;
+ if (sel) { linep = &text->sell; charp = &text->selc; }
+ else { linep = &text->curl; charp = &text->curc; }
oldc = *charp;
@@ -1798,8 +1799,8 @@
text_update_character_width(st);
- if (sel) linep = &text->sell, charp = &text->selc;
- else linep = &text->curl, charp = &text->curc;
+ if (sel) { linep = &text->sell; charp = &text->selc; }
+ else { linep = &text->curl; charp = &text->curc; }
wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
@@ -1825,12 +1826,12 @@
Text *text = st->text;
TextLine **linep;
int *charp;
- int offl, offc, col, newl, visible_lines;
+ int offl, offc, col, visible_lines;
text_update_character_width(st);
- if (sel) linep = &text->sell, charp = &text->selc;
- else linep = &text->curl, charp = &text->curc;
+ if (sel) { linep = &text->sell; charp = &text->selc; }
+ else { linep = &text->curl; charp = &text->curc; }
wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
@@ -1860,8 +1861,8 @@
TextLine **linep;
int *charp;
- if (sel) linep = &text->sell, charp = &text->selc;
- else linep = &text->curl, charp = &text->curc;
+ if (sel) { linep = &text->sell; charp = &text->selc; }
+ else { linep = &text->curl; charp = &text->curc; }
if (st && ar && st->wordwrap) {
int rell, relc;
@@ -2590,7 +2591,7 @@
if (linep && charp != -1) {
if (sel) { text->sell = linep; text->selc = charp; }
- else { text->curl = linep; text->curc = charp; }
+ else { text->curl = linep; text->curc = charp; }
}
}
@@ -2615,7 +2616,7 @@
int w;
if (sel) { linep = &text->sell; charp = &text->selc; }
- else { linep = &text->curl; charp = &text->curc; }
+ else { linep = &text->curl; charp = &text->curc; }
y -= txt_get_span(text->lines.first, *linep) - st->top;
More information about the Bf-blender-cvs
mailing list