Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectTypes/CInput.cpp
Show First 20 Lines • Show All 1,274 Lines • ▼ Show 20 Lines | if (SelectingText()) | ||||
// Now m_iBufferPos_Tail can be of both sides of m_iBufferPos, | // Now m_iBufferPos_Tail can be of both sides of m_iBufferPos, | ||||
// just like you can select from right to left, as you can | // just like you can select from right to left, as you can | ||||
// left to right. Is there a difference? Yes, the pointer | // left to right. Is there a difference? Yes, the pointer | ||||
// be placed accordingly, so that if you select shift and | // be placed accordingly, so that if you select shift and | ||||
// expand this selection, it will expand on appropriate side. | // expand this selection, it will expand on appropriate side. | ||||
// Anyway, since the drawing procedure needs "To" to be | // Anyway, since the drawing procedure needs "To" to be | ||||
// greater than from, we need virtual values that might switch | // greater than from, we need virtual values that might switch | ||||
// place. | // place. | ||||
int virtualFrom = 0; | |||||
int VirtualFrom, VirtualTo; | int virtualTo = 0; | ||||
Silier: nope,
these will end exist if end of if (SelectingText()) scope and later would be used onrd… | |||||
if (m_iBufferPos_Tail >= m_iBufferPos) | if (m_iBufferPos_Tail >= m_iBufferPos) | ||||
{ | { | ||||
VirtualFrom = m_iBufferPos; | virtualFrom = m_iBufferPos; | ||||
VirtualTo = m_iBufferPos_Tail; | virtualTo = m_iBufferPos_Tail; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
VirtualFrom = m_iBufferPos_Tail; | virtualFrom = m_iBufferPos_Tail; | ||||
VirtualTo = m_iBufferPos; | virtualTo = m_iBufferPos; | ||||
Done Inline Actionswhat's the warning for these? It seems to be rather well defined wraitii: what's the warning for these? It seems to be rather well defined | |||||
Done Inline Actionsit is for L1284 shadowing variables Silier: it is for L1284 shadowing variables | |||||
Done Inline Actionsfeels kinda spurious... I'd rather add a scope on the usage above and use the same variable name, to avoid weird typos. wraitii: feels kinda spurious... I'd rather add a scope on the usage above and use the same variable… | |||||
Done Inline Actionsyou cant, variables from earlier are used after this scope ends, Silier: you cant, variables from earlier are used after this scope ends,
maybe more different names for… | |||||
Done Inline ActionsHm, as a matter of fact I don't understand why this exists here. It seems it's initialised above, but not used until this "if" or after this "if". So most like we should just do the initialisation above the if once, and carry on. wraitii: Hm, as a matter of fact I don't understand why this exists here. It seems it's initialised… | |||||
} | } | ||||
bool done = false; | bool done = false; | ||||
for (std::list<SRow>::const_iterator it = m_CharacterPositions.begin(); | for (std::list<SRow>::const_iterator it = m_CharacterPositions.begin(); | ||||
it != m_CharacterPositions.end(); | it != m_CharacterPositions.end(); | ||||
++it, buffered_y += ls, x_pointer = 0.f) | ++it, buffered_y += ls, x_pointer = 0.f) | ||||
{ | { | ||||
if (m_MultiLine && buffered_y > m_CachedActualSize.GetHeight()) | if (m_MultiLine && buffered_y > m_CachedActualSize.GetHeight()) | ||||
break; | break; | ||||
// We might as well use 'i' here to iterate, because we need it | // We might as well use 'i' here to iterate, because we need it | ||||
// (often compared against ints, so don't make it size_t) | // (often compared against ints, so don't make it size_t) | ||||
for (int i = 0; i < (int)it->m_ListOfX.size()+2; ++i) | for (int i = 0; i < (int)it->m_ListOfX.size()+2; ++i) | ||||
{ | { | ||||
if (it->m_ListStart + i == VirtualFrom) | if (it->m_ListStart + i == virtualFrom) | ||||
{ | { | ||||
// we won't actually draw it now, because we don't | // we won't actually draw it now, because we don't | ||||
// know the width of each glyph to that position. | // know the width of each glyph to that position. | ||||
// we need to go along with the iteration, and | // we need to go along with the iteration, and | ||||
// make a mark where the box started: | // make a mark where the box started: | ||||
drawing_box = true; // will turn false when finally rendered. | drawing_box = true; // will turn false when finally rendered. | ||||
// Get current x position | // Get current x position | ||||
box_x = x_pointer; | box_x = x_pointer; | ||||
} | } | ||||
const bool at_end = (i == (int)it->m_ListOfX.size()+1); | const bool at_end = (i == (int)it->m_ListOfX.size()+1); | ||||
if (drawing_box && (it->m_ListStart + i == VirtualTo || at_end)) | if (drawing_box && (it->m_ListStart + i == virtualTo || at_end)) | ||||
{ | { | ||||
// Depending on if it's just a row change, or if it's | // Depending on if it's just a row change, or if it's | ||||
// the end of the select box, do slightly different things. | // the end of the select box, do slightly different things. | ||||
if (at_end) | if (at_end) | ||||
{ | { | ||||
if (it->m_ListStart + i != VirtualFrom) | if (it->m_ListStart + i != virtualFrom) | ||||
// and actually add a white space! yes, this is done in any common input | // and actually add a white space! yes, this is done in any common input | ||||
x_pointer += font.GetCharacterWidth(L' '); | x_pointer += font.GetCharacterWidth(L' '); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
drawing_box = false; | drawing_box = false; | ||||
done = true; | done = true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | if (to_before != -1 && i == to-1 && current_line != m_CharacterPositions.end()) | ||||
// was used, but it didn't work with GCC. | // was used, but it didn't work with GCC. | ||||
bool destroy_row_from_used = false; | bool destroy_row_from_used = false; | ||||
bool destroy_row_to_used = false; | bool destroy_row_to_used = false; | ||||
// Iterate, and remove everything between 'from' and 'to_before' | // Iterate, and remove everything between 'from' and 'to_before' | ||||
// actually remove the entire lines they are on, it'll all have | // actually remove the entire lines they are on, it'll all have | ||||
// to be redone. And when going along, we'll delete a row at a time | // to be redone. And when going along, we'll delete a row at a time | ||||
// when continuing to see how much more after 'to' we need to remake. | // when continuing to see how much more after 'to' we need to remake. | ||||
int i = 0; | |||||
for (std::list<SRow>::iterator it = m_CharacterPositions.begin(); | for (std::list<SRow>::iterator it = m_CharacterPositions.begin(); | ||||
it != m_CharacterPositions.end(); | it != m_CharacterPositions.end(); | ||||
++it, ++i) | ++it) | ||||
{ | { | ||||
if (!destroy_row_from_used && it->m_ListStart > check_point_row_start) | if (!destroy_row_from_used && it->m_ListStart > check_point_row_start) | ||||
{ | { | ||||
// Destroy the previous line, and all to 'to_before' | // Destroy the previous line, and all to 'to_before' | ||||
//if (i >= 2) | //if (i >= 2) | ||||
// destroy_row_from = it-2; | // destroy_row_from = it-2; | ||||
//else | //else | ||||
// destroy_row_from = it-1; | // destroy_row_from = it-1; | ||||
▲ Show 20 Lines • Show All 301 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
nope,
these will end exist if end of if (SelectingText()) scope and later would be used onrd from above this scope