summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r--indra/newview/llviewerwindow.cpp105
1 files changed, 78 insertions, 27 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 4c6a3dd33d..ea846805c2 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -122,7 +122,7 @@
#include "llhudmanager.h"
#include "llhudobject.h"
#include "llhudview.h"
-#include "llimagebmp.h"
+#include "llimage.h"
#include "llimagej2c.h"
#include "llimageworker.h"
#include "llkeyboard.h"
@@ -938,6 +938,12 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
mLeftMouseDown = down;
buttonname = "Left Double Click";
break;
+ case LLMouseHandler::CLICK_BUTTON4:
+ buttonname = "Button 4";
+ break;
+ case LLMouseHandler::CLICK_BUTTON5:
+ buttonname = "Button 5";
+ break;
}
LLView::sMouseHandlerMessage.clear();
@@ -1115,7 +1121,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = TRUE;
- LLVoiceClient::getInstance()->middleMouseState(true);
+ LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, true);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -1267,17 +1273,47 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
return result;
}
-
+
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
- LLVoiceClient::getInstance()->middleMouseState(false);
+ LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, false);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
return TRUE;
}
+BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down)
+{
+ switch (button)
+ {
+ case 4:
+ LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON4, down);
+ handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON4, down);
+ break;
+ case 5:
+ LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON5, down);
+ handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON5, down);
+ break;
+ default:
+ break;
+ }
+
+ // Always handled as far as the OS is concerned.
+ return TRUE;
+}
+
+BOOL LLViewerWindow::handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button)
+{
+ return handleOtherMouse(window, pos, mask, button, TRUE);
+}
+
+BOOL LLViewerWindow::handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button)
+{
+ return handleOtherMouse(window, pos, mask, button, FALSE);
+}
+
// WARNING: this is potentially called multiple times per frame
void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask)
{
@@ -3331,7 +3367,8 @@ void LLViewerWindow::updateUI()
LLRect screen_sticky_rect = mRootView->getLocalRect();
S32 local_x, local_y;
- if (gSavedSettings.getBOOL("DebugShowXUINames"))
+ static LLCachedControl<bool> debug_show_xui_names(gSavedSettings, "DebugShowXUINames", 0);
+ if (debug_show_xui_names)
{
LLToolTip::Params params;
@@ -4487,32 +4524,46 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
}
}
-BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type)
+BOOL LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format)
{
- LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL;
+ LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL;
- LLPointer<LLImageRaw> raw = new LLImageRaw;
- BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, do_rebuild);
+ LLPointer<LLImageRaw> raw = new LLImageRaw;
+ BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, do_rebuild);
- if (success)
- {
- LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
- success = bmp_image->encode(raw, 0.0f);
- if( success )
- {
- success = bmp_image->save(filepath);
- }
- else
- {
- LL_WARNS() << "Unable to encode bmp snapshot" << LL_ENDL;
- }
- }
- else
- {
- LL_WARNS() << "Unable to capture raw snapshot" << LL_ENDL;
- }
+ if (success)
+ {
+ U8 image_codec = IMG_CODEC_BMP;
+ switch (format)
+ {
+ case LLSnapshotModel::SNAPSHOT_FORMAT_PNG:
+ image_codec = IMG_CODEC_PNG;
+ break;
+ case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG:
+ image_codec = IMG_CODEC_JPEG;
+ break;
+ default:
+ image_codec = IMG_CODEC_BMP;
+ break;
+ }
- return success;
+ LLPointer<LLImageFormatted> formated_image = LLImageFormatted::createFromType(image_codec);
+ success = formated_image->encode(raw, 0.0f);
+ if (success)
+ {
+ success = formated_image->save(filepath);
+ }
+ else
+ {
+ LL_WARNS() << "Unable to encode snapshot of format " << format << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Unable to capture raw snapshot" << LL_ENDL;
+ }
+
+ return success;
}