EXT-3531 - Ctrl-P does not work reliably on login

master
Richard Nelson 2010-04-01 11:47:21 -07:00
parent 2bb03e5edb
commit 7b4046df83
22 changed files with 143 additions and 523 deletions

View File

@ -495,7 +495,6 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p)
params.max_length_bytes(mMaxChars);
params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2));
params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
params.handle_edit_keys_directly(true);
params.commit_on_focus_lost(false);
params.follows.flags(FOLLOWS_ALL);
params.label(mLabel);

View File

@ -53,6 +53,17 @@ LLFlatListView::Params::Params()
no_items_text("no_items_text")
{};
LLFlatListView::~LLFlatListView()
{
clear();
// Route menu back to the default
if( gEditMenuHandler == this )
{
gEditMenuHandler = NULL;
}
};
void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
LLScrollContainer::reshape(width, height, called_from_parent);
@ -558,15 +569,6 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
}
break;
}
case 'A':
{
if(MASK_CONTROL & mask)
{
selectAll();
handled = TRUE;
}
break;
}
default:
break;
}
@ -791,10 +793,15 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
return false;
}
bool LLFlatListView::selectAll()
BOOL LLFlatListView::canSelectAll() const
{
return !mItemPairs.empty() && mAllowSelection;
}
void LLFlatListView::selectAll()
{
if (!mAllowSelection)
return false;
return;
mSelectedItemPairs.clear();
@ -814,8 +821,6 @@ bool LLFlatListView::selectAll()
// Stretch selected item rect to ensure it won't be clipped
mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
return true;
}
bool LLFlatListView::isSelected(item_pair_t* item_pair) const
@ -953,11 +958,17 @@ void LLFlatListView::getValues(std::vector<LLSD>& values) const
void LLFlatListView::onFocusReceived()
{
mSelectedItemsBorder->setVisible(TRUE);
gEditMenuHandler = this;
}
// virtual
void LLFlatListView::onFocusLost()
{
mSelectedItemsBorder->setVisible(FALSE);
// Route menu back to the default
if( gEditMenuHandler == this )
{
gEditMenuHandler = NULL;
}
}
//virtual

View File

@ -58,7 +58,7 @@
* - Order of returned selected items are not guaranteed
* - The control assumes that all items being added are unique.
*/
class LLFlatListView : public LLScrollContainer
class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
{
public:
@ -114,7 +114,7 @@ public:
Params();
};
virtual ~LLFlatListView() { clear(); };
virtual ~LLFlatListView();
/**
* Connects callback to signal called when Return key is pressed.
@ -344,7 +344,8 @@ protected:
virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection);
virtual bool selectAll();
virtual BOOL canSelectAll() const;
virtual void selectAll();
virtual bool isSelected(item_pair_t* item_pair) const;

View File

@ -91,7 +91,6 @@ LLLineEditor::Params::Params()
background_image_disabled("background_image_disabled"),
background_image_focused("background_image_focused"),
select_on_focus("select_on_focus", false),
handle_edit_keys_directly("handle_edit_keys_directly", false),
revert_on_esc("revert_on_esc", true),
commit_on_focus_lost("commit_on_focus_lost", true),
ignore_tab("ignore_tab", true),
@ -136,7 +135,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mIgnoreArrowKeys( FALSE ),
mIgnoreTab( p.ignore_tab ),
mDrawAsterixes( FALSE ),
mHandleEditKeysDirectly(p.handle_edit_keys_directly),
mSelectAllonFocusReceived( p.select_on_focus ),
mPassDelete(FALSE),
mReadOnly(FALSE),
@ -497,6 +495,7 @@ void LLLineEditor::selectAll()
setCursor(mSelectionEnd);
//mScrollHPos = 0;
mIsSelecting = TRUE;
updatePrimary();
}
@ -788,7 +787,7 @@ void LLLineEditor::removeChar()
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
@ -827,7 +826,7 @@ void LLLineEditor::addChar(const llwchar uni_char)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
getWindow()->hideCursorUntilMouseMove();
@ -916,7 +915,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
break;
@ -932,7 +931,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
break;
@ -958,22 +957,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
}
if (!handled && mHandleEditKeysDirectly)
{
if( (MASK_CONTROL & mask) && ('A' == key) )
{
if( canSelectAll() )
{
selectAll();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
}
if(handled)
{
// take selection to 'primary' clipboard
@ -1020,7 +1003,7 @@ void LLLineEditor::cut()
if( need_to_rollback )
{
rollback.doRollback( this );
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
else
if( mKeystrokeCallback )
@ -1129,7 +1112,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
}
// Truncate the clean string at the limit of what will fit
clean_string = clean_string.substr(0, wchars_that_fit);
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
mText.insert(getCursor(), clean_string);
@ -1141,7 +1124,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
if( need_to_rollback )
{
rollback.doRollback( this );
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
else
if( mKeystrokeCallback )
@ -1206,7 +1189,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
handled = TRUE;
@ -1255,7 +1238,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
@ -1282,7 +1265,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
@ -1299,7 +1282,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
@ -1316,7 +1299,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
handled = TRUE;
}
@ -1339,64 +1322,6 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
break;
}
if( !handled && mHandleEditKeysDirectly )
{
// Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system.
if( KEY_DELETE == key )
{
if( canDoDelete() )
{
doDelete();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( MASK_CONTROL & mask )
{
if( 'C' == key )
{
if( canCopy() )
{
copy();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( 'V' == key )
{
if( canPaste() )
{
paste();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( 'X' == key )
{
if( canCut() )
{
cut();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
}
}
return handled;
}
@ -1451,7 +1376,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
{
rollback.doRollback(this);
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
// Notify owner if requested
@ -1499,7 +1424,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
{
rollback.doRollback( this );
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
// Notify owner if requested
@ -1544,7 +1469,7 @@ void LLLineEditor::doDelete()
if( need_to_rollback )
{
rollback.doRollback( this );
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
else
{
@ -1879,11 +1804,6 @@ S32 LLLineEditor::findPixelNearestPos(const S32 cursor_offset) const
return result;
}
void LLLineEditor::reportBadKeystroke()
{
make_ui_sound("UISndBadKeystroke");
}
//virtual
void LLLineEditor::clear()
{

View File

@ -81,7 +81,6 @@ public:
background_image_focused;
Optional<bool> select_on_focus,
handle_edit_keys_directly,
revert_on_esc,
commit_on_focus_lost,
ignore_tab;
@ -215,7 +214,6 @@ public:
void extendSelection(S32 new_cursor_pos);
void deleteSelection();
void setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; }
void setSelectAllonFocusReceived(BOOL b);
typedef boost::function<void (LLLineEditor* caller, void* user_data)> callback_t;
@ -247,7 +245,6 @@ private:
void addChar(const llwchar c);
void setCursorAtLocalPos(S32 local_mouse_x);
S32 findPixelNearestPos(S32 cursor_offset = 0) const;
void reportBadKeystroke();
BOOL handleSpecialKey(KEY key, MASK mask);
BOOL handleSelectionKey(KEY key, MASK mask);
BOOL handleControlKey(KEY key, MASK mask);
@ -325,7 +322,6 @@ protected:
BOOL mIgnoreTab;
BOOL mDrawAsterixes;
BOOL mHandleEditKeysDirectly; // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system
BOOL mSelectAllonFocusReceived;
BOOL mPassDelete;

View File

@ -3345,7 +3345,7 @@ void LLMenuHolderGL::draw()
LLView::draw();
// now draw last selected item as overlay
LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get();
if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
if (selecteditem && selecteditem->getVisible() && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
{
// make sure toggle items, for example, show the proper state when fading out
selecteditem->buildDrawLabel();

View File

@ -345,7 +345,7 @@ void LLMultiFloater::setVisible(BOOL visible)
BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask)
{
if (key == 'W' && mask == MASK_CONTROL)
if (key == 'W' && mask == (MASK_CONTROL|MASK_SHIFT))
{
LLFloater* floater = getActiveFloater();
// is user closeable and is system closeable

View File

@ -1047,6 +1047,13 @@ void LLTextBase::setValue(const LLSD& value )
setText(value.asString());
}
//virtual
BOOL LLTextBase::canDeselect() const
{
return hasSelection();
}
//virtual
void LLTextBase::deselect()
{

View File

@ -132,6 +132,7 @@ public:
/*virtual*/ LLTextViewModel* getViewModel() const;
// LLEditMenuHandler interface
/*virtual*/ BOOL canDeselect() const;
/*virtual*/ void deselect();
// used by LLTextSegment layout code

View File

@ -240,7 +240,6 @@ LLTextEditor::Params::Params()
prevalidate_callback("prevalidate_callback"),
embedded_items("embedded_items", false),
ignore_tab("ignore_tab", true),
handle_edit_keys_directly("handle_edit_keys_directly", false),
show_line_numbers("show_line_numbers", false),
default_color("default_color"),
commit_on_focus_lost("commit_on_focus_lost", false),
@ -258,7 +257,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mShowLineNumbers ( p.show_line_numbers ),
mCommitOnFocusLost( p.commit_on_focus_lost),
mAllowEmbeddedItems( p.embedded_items ),
mHandleEditKeysDirectly( p.handle_edit_keys_directly ),
mMouseDownX(0),
mMouseDownY(0),
mTabsToNextField(p.ignore_tab),
@ -507,21 +505,6 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out,
}
}
// virtual
BOOL LLTextEditor::canDeselect() const
{
return hasSelection();
}
void LLTextEditor::deselect()
{
mSelectionStart = 0;
mSelectionEnd = 0;
mIsSelecting = FALSE;
}
BOOL LLTextEditor::selectionContainsLineBreaks()
{
if (hasSelection())
@ -668,6 +651,7 @@ void LLTextEditor::selectAll()
mSelectionStart = getLength();
mSelectionEnd = 0;
setCursorPos(mSelectionEnd);
updatePrimary();
}
BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
@ -1025,7 +1009,7 @@ void LLTextEditor::removeCharOrTab()
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
@ -1048,7 +1032,7 @@ void LLTextEditor::removeChar()
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
@ -1198,22 +1182,6 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
}
}
if( !handled && mHandleEditKeysDirectly )
{
if( (MASK_CONTROL & mask) && ('A' == key) )
{
if( canSelectAll() )
{
selectAll();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
}
if( handled )
{
// take selection to 'primary' clipboard
@ -1247,6 +1215,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
case KEY_DOWN:
changeLine( 1 );
deselect();
break;
case KEY_PAGE_DOWN:
@ -1260,7 +1229,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
case KEY_LEFT:
if( hasSelection() )
{
setCursorPos(llmin( mCursorPos - 1, mSelectionStart, mSelectionEnd ));
setCursorPos(llmin( mSelectionStart, mSelectionEnd ));
}
else
{
@ -1270,7 +1239,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
break;
@ -1278,7 +1247,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
case KEY_RIGHT:
if( hasSelection() )
{
setCursorPos(llmax( mCursorPos + 1, mSelectionStart, mSelectionEnd ));
setCursorPos(llmax( mSelectionStart, mSelectionEnd ));
}
else
{
@ -1288,7 +1257,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
}
break;
@ -1298,6 +1267,11 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
break;
}
}
if (handled)
{
deselect();
}
return handled;
}
@ -1551,75 +1525,13 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
return handled;
}
BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask)
BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
{
BOOL handled = FALSE;
// Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system.
if( KEY_DELETE == key )
{
if( canDoDelete() )
{
doDelete();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( MASK_CONTROL & mask )
{
if( 'C' == key )
{
if( canCopy() )
{
copy();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( 'V' == key )
{
if( canPaste() )
{
paste();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
else
if( 'X' == key )
{
if( canCut() )
{
cut();
}
else
{
reportBadKeystroke();
}
handled = TRUE;
}
}
return handled;
}
BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit)
{
*return_key_hit = FALSE;
BOOL handled = TRUE;
if (mReadOnly) return FALSE;
switch( key )
{
case KEY_INSERT:
@ -1641,7 +1553,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
}
else
{
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
break;
@ -1694,6 +1606,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
break;
}
if (handled)
{
onKeyStroke();
}
return handled;
}
@ -1714,9 +1630,6 @@ void LLTextEditor::unindentLineBeforeCloseBrace()
BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
BOOL handled = FALSE;
BOOL selection_modified = FALSE;
BOOL return_key_hit = FALSE;
BOOL text_may_have_changed = TRUE;
// Special case for TAB. If want to move to next field, report
// not handled and let the parent take care of field movement.
@ -1724,116 +1637,24 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
{
return FALSE;
}
/*
if (KEY_F10 == key)
{
LLComboBox::Params cp;
cp.name = "combo box";
cp.label = "my combo";
cp.rect.width = 100;
cp.rect.height = 20;
cp.items.add().label = "item 1";
cp.items.add().label = "item 2";
cp.items.add().label = "item 3";
appendWidget(LLUICtrlFactory::create<LLComboBox>(cp), "combo", true, false);
}
if (KEY_F11 == key)
{
LLButton::Params bp;
bp.name = "text button";
bp.label = "Click me";
bp.rect.width = 100;
bp.rect.height = 20;
appendWidget(LLUICtrlFactory::create<LLButton>(bp), "button", true, false);
}
*/
if (mReadOnly)
if (mReadOnly && mScroller)
{
if(mScroller)
{
handled = mScroller->handleKeyHere( key, mask );
}
else
{
handled = handleNavigationKey( key, mask );
}
handled = (mScroller && mScroller->handleKeyHere( key, mask ))
|| handleSelectionKey(key, mask)
|| handleControlKey(key, mask);
}
else
{
// handle navigation keys ourself
handled = handleNavigationKey( key, mask );
}
if( handled )
{
text_may_have_changed = FALSE;
}
if( !handled )
{
handled = handleSelectionKey( key, mask );
if( handled )
{
selection_modified = TRUE;
}
}
if( !handled )
{
handled = handleControlKey( key, mask );
if( handled )
{
selection_modified = TRUE;
}
}
if( !handled && mHandleEditKeysDirectly )
{
handled = handleEditKey( key, mask );
if( handled )
{
selection_modified = TRUE;
text_may_have_changed = TRUE;
}
}
// Handle most keys only if the text editor is writeable.
if( !mReadOnly )
{
if( !handled )
{
handled = handleSpecialKey( key, mask, &return_key_hit );
if( handled )
{
selection_modified = TRUE;
text_may_have_changed = TRUE;
}
}
handled = handleNavigationKey( key, mask )
|| handleSelectionKey(key, mask)
|| handleControlKey(key, mask)
|| handleSpecialKey(key, mask);
}
if( handled )
{
resetCursorBlink();
// Most keystrokes will make the selection box go away, but not all will.
if( !selection_modified &&
KEY_SHIFT != key &&
KEY_CONTROL != key &&
KEY_ALT != key &&
KEY_CAPSLOCK )
{
deselect();
}
if(text_may_have_changed)
{
onKeyStroke();
}
needsScroll();
}

View File

@ -68,7 +68,6 @@ public:
Optional<bool> embedded_items,
ignore_tab,
handle_edit_keys_directly,
show_line_numbers,
commit_on_focus_lost,
show_context_menu;
@ -146,8 +145,6 @@ public:
virtual BOOL canDoDelete() const;
virtual void selectAll();
virtual BOOL canSelectAll() const;
virtual void deselect();
virtual BOOL canDeselect() const;
void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
@ -218,13 +215,10 @@ protected:
S32 indentLine( S32 pos, S32 spaces );
void unindentLineBeforeCloseBrace();
void reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); }
BOOL handleNavigationKey(const KEY key, const MASK mask);
BOOL handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit);
BOOL handleSpecialKey(const KEY key, const MASK mask);
BOOL handleSelectionKey(const KEY key, const MASK mask);
BOOL handleControlKey(const KEY key, const MASK mask);
BOOL handleEditKey(const KEY key, const MASK mask);
BOOL selectionContainsLineBreaks();
void deleteSelection(BOOL transient_operation);
@ -329,10 +323,6 @@ private:
LLUUID mSourceID;
// If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here
//instead of routed by the menu system
BOOL mHandleEditKeysDirectly;
LLCoordGL mLastIMEPosition; // Last position of the IME editor
keystroke_signal_t mKeystrokeSignal;

View File

@ -1914,7 +1914,12 @@ void LLUI::clearPopups()
}
}
//static
void LLUI::reportBadKeystroke()
{
make_ui_sound("UISndBadKeystroke");
}
//static
// spawn_x and spawn_y are top left corner of view in screen GL coordinates
void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)

View File

@ -217,6 +217,8 @@ public:
static void removePopup(LLView*);
static void clearPopups();
static void reportBadKeystroke();
// Ensures view does not overlap mouse cursor, but is inside
// the view's parent rectangle. Used for tooltips, inspectors.
// Optionally override the view's default X/Y, which are relative to the

View File

@ -2999,79 +2999,6 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
sei.lpVerb = L"open";
sei.lpFile = url_utf16.c_str();
ShellExecuteEx( &sei );
//// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES
//// DELETE THIS ONCE THE MERGES ARE DONE
// Figure out the user's default web browser
// HKEY_CLASSES_ROOT\http\shell\open\command
/*
std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command";
WCHAR reg_path_wstr[256];
mbstowcs( reg_path_wstr, reg_path_str.c_str(), LL_ARRAY_SIZE(reg_path_wstr) );
HKEY key;
WCHAR browser_open_wstr[1024];
DWORD buffer_length = 1024;
RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key);
RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length);
RegCloseKey(key);
// Convert to STL string
LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr);
if (browser_open_wstring.length() < 2)
{
LL_WARNS("Window") << "Invalid browser executable in registry " << browser_open_wstring << LL_ENDL;
return;
}
// Extract the process that's supposed to be launched
LLWString browser_executable;
if (browser_open_wstring[0] == '"')
{
// executable is quoted, find the matching quote
size_t quote_pos = browser_open_wstring.find('"', 1);
// copy out the string including both quotes
browser_executable = browser_open_wstring.substr(0, quote_pos+1);
}
else
{
// executable not quoted, find a space
size_t space_pos = browser_open_wstring.find(' ', 1);
browser_executable = browser_open_wstring.substr(0, space_pos);
}
LL_DEBUGS("Window") << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << LL_ENDL;
LL_INFOS("Window") << "Browser executable: " << wstring_to_utf8str(browser_executable) << LL_ENDL;
// Convert URL to wide string for Windows API
// Assume URL is UTF8, as can come from scripts
LLWString url_wstring = utf8str_to_wstring(escaped_url);
llutf16string url_utf16 = wstring_to_utf16str(url_wstring);
// Convert executable and path to wide string for Windows API
llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable);
// ShellExecute returns HINSTANCE for backwards compatiblity.
// MS docs say to cast to int and compare to 32.
HWND our_window = NULL;
LPCWSTR directory_wstr = NULL;
int retval = (int) ShellExecute(our_window, // Flawfinder: ignore
L"open",
browser_exec_utf16.c_str(),
url_utf16.c_str(),
directory_wstr,
SW_SHOWNORMAL);
if (retval > 32)
{
LL_DEBUGS("Window") << "load_url success with " << retval << LL_ENDL;
}
else
{
LL_INFOS("Window") << "load_url failure with " << retval << LL_ENDL;
}
*/
}
/*

View File

@ -227,7 +227,6 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
params.default_text(LLStringUtil::null);
params.max_length_bytes(p.max_chars);
params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
params.handle_edit_keys_directly(true);
params.commit_on_focus_lost(false);
params.follows.flags(FOLLOWS_ALL);
mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);

View File

@ -281,9 +281,6 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
mLineEditor->setText(edit_text_contents);
mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
// make sure all edit keys get handled properly (DEV-22396)
mLineEditor->setHandleEditKeysDirectly(TRUE);
LLToastPanel::addChild(mLineEditor);
mLineEditor->setDrawAsterixes(is_password);

View File

@ -72,7 +72,7 @@ void LLURLLineEditor::cut()
if( need_to_rollback )
{
rollback.doRollback( this );
reportBadKeystroke();
LLUI::reportBadKeystroke();
}
else
if( mKeystrokeCallback )
@ -96,8 +96,3 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
gClipboard.copyFromString( text_to_copy );
}
// Makes UISndBadKeystroke sound
void LLURLLineEditor::reportBadKeystroke()
{
make_ui_sound("UISndBadKeystroke");
}

View File

@ -55,8 +55,6 @@ protected:
private:
// util function to escape selected text and copy it to clipboard
void copyEscapedURLToClipboard();
// send a beep signal if keystroke is bad. As it is private at LLLineEditor we need own function
void reportBadKeystroke();
// Helper class to do rollback if needed
class LLURLLineEditorRollback

View File

@ -74,6 +74,7 @@
#include "llnavigationbar.h"
#include "llfloatertools.h"
#include "llpaneloutfitsinventory.h"
#include "llpanellogin.h"
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
BOOL gHackGodmode = FALSE;
@ -443,6 +444,12 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
return true;
}
bool handleForceShowGrid(const LLSD& newvalue)
{
LLPanelLogin::refreshLocation( false );
return true;
}
bool toggle_agent_pause(const LLSD& newvalue)
{
if ( newvalue.asBoolean() )
@ -648,6 +655,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2));
gSavedSettings.getControl("ShowDebugAppearanceEditor")->getSignal()->connect(boost::bind(&toggle_show_appearance_editor, _2));
gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2));
gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2));
}
#if TEST_CACHED_CONTROL

View File

@ -136,6 +136,7 @@ extern BOOL gDebugWindowProc;
LLMenuBarGL *gMenuBarView = NULL;
LLViewerMenuHolderGL *gMenuHolder = NULL;
LLMenuGL *gPopupMenuView = NULL;
LLMenuGL *gEditMenu = NULL;
LLMenuBarGL *gLoginMenuBarView = NULL;
// Pie menus
@ -383,8 +384,10 @@ void init_menus()
///
/// Context menus
///
const widget_registry_t& registry =
LLViewerMenuHolderGL::child_registry_t::instance();
gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
"menu_avatar_self.xml", gMenuHolder, registry);
gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
@ -5182,10 +5185,6 @@ void toggle_debug_menus(void*)
{
BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus");
gSavedSettings.setBOOL("UseDebugMenus", visible);
if(visible)
{
//LLFirstUse::useDebugMenus();
}
show_debug_menus();
}

View File

@ -157,6 +157,7 @@ extern const std::string SAVE_INTO_INVENTORY;
extern LLMenuBarGL* gMenuBarView;
//extern LLView* gMenuBarHolder;
extern LLMenuGL* gEditMenu;
extern LLMenuGL* gPopupMenuView;
extern LLViewerMenuHolderGL* gMenuHolder;
extern LLMenuBarGL* gLoginMenuBarView;

View File

@ -2145,12 +2145,14 @@ void LLViewerWindow::draw()
// Takes a single keydown event, usually when UI is visible
BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
// hide tooltips on keypress
LLToolTipMgr::instance().blockToolTips();
if (gFocusMgr.getKeyboardFocus()
&& !(mask & (MASK_CONTROL | MASK_ALT))
&& !gFocusMgr.getKeystrokesOnly())
{
// We have keyboard focus, and it's not an accelerator
if (key < 0x80)
{
// Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
@ -2158,68 +2160,49 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
}
// hide tooltips on keypress
LLToolTipMgr::instance().blockToolTips();
// Explicit hack for debug menu.
if ((MASK_ALT & mask) &&
(MASK_CONTROL & mask) &&
('D' == key || 'd' == key))
// let menus handle navigation keys for navigation
if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
{
toggle_debug_menus(NULL);
return TRUE;
}
// Explicit hack for debug menu.
if ((mask == (MASK_SHIFT | MASK_CONTROL)) &&
('G' == key || 'g' == key))
// give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
// as long as focus isn't locked
if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
{
if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
{
BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid");
gSavedSettings.setBOOL("ForceShowGrid", visible);
// Initialize visibility (and don't force visibility - use prefs)
LLPanelLogin::refreshLocation( false );
return TRUE;
}
}
// Debugging view for unified notifications: CTRL-SHIFT-5
// *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks.
if ((MASK_SHIFT & mask)
&& (!(MASK_ALT & mask))
&& (MASK_CONTROL & mask)
&& ('5' == key))
// give floaters first chance to handle TAB key
// so frontmost floater gets focus
// if nothing has focus, go to first or last UI element as appropriate
if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL))
{
//LLFloaterNotificationConsole::showInstance();
LLFloaterReg::showInstance("notifications_console");
if (gMenuHolder) gMenuHolder->hideMenus();
// if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
// do CTRL-TAB and CTRL-SHIFT-TAB logic
if (mask & MASK_SHIFT)
{
mRootView->focusPrevRoot();
}
else
{
mRootView->focusNextRoot();
}
return TRUE;
}
// handle escape key
//if (key == KEY_ESCAPE && mask == MASK_NONE)
//{
// *TODO: get this to play well with mouselook and hidden
// cursor modes, etc, and re-enable.
//if (gFocusMgr.getMouseCapture())
//{
// gFocusMgr.setMouseCapture(NULL);
// return TRUE;
//}
//}
// let menus handle navigation keys
if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
{
return TRUE;
}
// let menus handle navigation keys
if (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
{
return TRUE;
}
//some of context menus use this container, let context menu handle navigation keys
if(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))
// hidden edit menu for cut/copy/paste
if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
{
return TRUE;
}
@ -2284,50 +2267,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
// Topmost view gets a chance before the hierarchy
// *FIX: get rid of this?
//LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
//if (top_ctrl)
//{
// if( top_ctrl->handleKey( key, mask, TRUE ) )
// {
// return TRUE;
// }
//}
// give floaters first chance to handle TAB key
// so frontmost floater gets focus
if (key == KEY_TAB)
{
// if nothing has focus, go to first or last UI element as appropriate
if (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)
{
if (gMenuHolder) gMenuHolder->hideMenus();
// if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
// do CTRL-TAB and CTRL-SHIFT-TAB logic
if (mask & MASK_SHIFT)
{
mRootView->focusPrevRoot();
}
else
{
mRootView->focusNextRoot();
}
return TRUE;
}
}
// give menus a chance to handle keys
if (gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
{
return TRUE;
}
// give menus a chance to handle keys
if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
// give menus a chance to handle unmodified accelerator keys
if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
{
return TRUE;
}