Merge branch 'master' of git://github.com/Lirusaito/SingularityViewer

This commit is contained in:
Latif Khalifa
2013-09-30 23:24:11 +02:00
11 changed files with 2063 additions and 1955 deletions

View File

@@ -860,6 +860,32 @@ void LLLineEditor::removeChar()
}
}
// Remove a word (set of characters up to next space/punctuation) from the text
void LLLineEditor::removeWord(bool prev)
{
const U32 pos(getCursor());
if (prev ? pos > 0 : static_cast<S32>(pos) < getLength())
{
U32 new_pos(prev ? prevWordPos(pos) : nextWordPos(pos));
if (new_pos == pos) // Other character we don't jump over
new_pos = prev ? prevWordPos(new_pos-1) : nextWordPos(new_pos+1);
const U32 diff(labs(pos - new_pos));
if (prev)
{
mText.erase(new_pos, diff);
setCursor(new_pos);
}
else
{
mText.erase(pos, diff);
}
}
else
{
reportBadKeystroke();
}
}
void LLLineEditor::addChar(const llwchar uni_char)
{
@@ -1318,7 +1344,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
else
if( 0 < getCursor() )
{
removeChar();
if (mask == MASK_CONTROL)
removeWord(true);
else
removeChar();
}
else
{
@@ -1328,6 +1357,14 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
handled = TRUE;
break;
case KEY_DELETE:
if (!mReadOnly && mask == MASK_CONTROL)
{
removeWord(false);
handled = true;
}
break;
case KEY_PAGE_UP:
case KEY_HOME:
if (!mIgnoreArrowKeys)

View File

@@ -266,6 +266,7 @@ private:
void pasteHelper(bool is_primary);
void removeChar();
void removeWord(bool prev);
void addChar(const llwchar c);
void setCursorAtLocalPos(S32 local_mouse_x);
S32 calculateCursorFromMouse(S32 local_mouse_x);

View File

@@ -1814,6 +1814,33 @@ void LLTextEditor::removeChar()
}
}
// Remove a word (set of characters up to next space/punctuation) from the text
void LLTextEditor::removeWord(bool prev)
{
const U32 pos(mCursorPos);
if (prev ? pos > 0 : static_cast<S32>(pos) < getLength())
{
U32 new_pos(prev ? prevWordPos(pos) : nextWordPos(pos));
if (new_pos == pos) // Other character we don't jump over
new_pos = prev ? prevWordPos(new_pos-1) : nextWordPos(new_pos+1);
const U32 diff(labs(pos - new_pos));
if (prev)
{
remove(new_pos, diff, false);
setCursorPos(new_pos);
}
else
{
remove(pos, diff, false);
}
}
else
{
reportBadKeystroke();
}
}
// Add a single character to the text
S32 LLTextEditor::addChar(S32 pos, llwchar wc)
{
@@ -2447,7 +2474,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
else
if( 0 < mCursorPos )
{
removeCharOrTab();
if (mask == MASK_CONTROL)
removeWord(true);
else
removeCharOrTab();
}
else
{
@@ -2455,6 +2485,12 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
}
break;
case KEY_DELETE:
if (getEnabled() && mask == MASK_CONTROL)
{
removeWord(false);
}
break;
case KEY_RETURN:
if (mask == MASK_NONE)

View File

@@ -408,6 +408,7 @@ protected:
S32 overwriteChar(S32 pos, llwchar wc);
void removeChar();
S32 removeChar(S32 pos);
void removeWord(bool prev);
S32 insert(const S32 pos, const LLWString &wstr, const BOOL group_with_next_op);
S32 remove(const S32 pos, const S32 length, const BOOL group_with_next_op);
S32 append(const LLWString &wstr, const BOOL group_with_next_op);

File diff suppressed because it is too large Load Diff

View File

@@ -215,6 +215,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo");
server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1));
server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo));
// Load all of the grids, sorted, and then add a bar and the current grid at the top
updateGridCombo();
@@ -1031,7 +1032,33 @@ void LLPanelLogin::refreshLoginPage()
//void LLPanelLogin::onSelectServer()
void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
{
gHippoGridManager->setCurrentGrid(ctrl->getValue());
std::string grid(ctrl->getValue().asString());
LLStringUtil::trim(grid); // Guard against copy paste
if (!gHippoGridManager->getGrid(grid)) // We can't get an input grid by name or nick, perhaps a Login URI was entered
{
HippoGridInfo* info(new HippoGridInfo("")); // Start off with empty grid name, otherwise we don't know what to name
info->setLoginUri(grid);
if (info->retrieveGridInfo()) // There's info from this URI
{
grid = info->getGridName();
if (HippoGridInfo* nick_info = gHippoGridManager->getGrid(info->getGridNick())) // Grid of same nick exists
{
delete info;
grid = nick_info->getGridName();
}
else // Guess not, try adding this grid
{
gHippoGridManager->addGrid(info); // deletes info if not needed (existing or no name)
}
}
else
{
delete info;
grid = gHippoGridManager->getCurrentGridName();
}
}
gHippoGridManager->setCurrentGrid(grid);
ctrl->setValue(grid);
}
void LLPanelLogin::onLocationSLURL()

View File

@@ -304,6 +304,12 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride)
if (!ppatches[i][j]->getNeighborPatch(SOUTH))
{
poffsets[i][j][1] = 0;
}
else
{
// <FS:CR> Aurora Sim
ppatches[i][j] = ppatches[i][j]->getNeighborPatch(SOUTH);
poffsets[i][j][1] += patch_width;
poffsets[i][j][2] = ppatches[i][j]->getSurface()->getGridsPerEdge();
// </FS>CR> Aurora Sim
}

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@
left="0" mouse_opaque="true" name="grids_combo_text" v_pad="0" width="120">
Grid:
</text>
<combo_box allow_text_entry="false" bottom_delta="-24" follows="left|bottom" height="20"
<combo_box allow_text_entry="true" max_chars="128" bottom_delta="-24" follows="left|bottom" height="20"
left="0" mouse_opaque="true" name="grids_combo" width="120" />
<button name="grids_btn" label="Grid Manager"
bottom_delta="-20" left_delta="10" height="16" width="100"

View File

@@ -17,7 +17,7 @@
<text name="grids_combo_text">
Grelha:
</text>
<!--<button name="grids_btn" label="Administrar Grid"/>-->
<button name="grids_btn" label="Administrar Grid"/>
</layout_panel>
<layout_panel name="location_panel">
<text name="start_location_text">

File diff suppressed because it is too large Load Diff