Merge remote-tracking branch 'Liru/master'

This commit is contained in:
Damian Zhaoying
2013-09-16 13:28:04 -03:00
19 changed files with 121 additions and 89 deletions

View File

@@ -218,7 +218,6 @@ public:
virtual BOOL canSaveAs() const { return FALSE; }
virtual void saveAs() {}
virtual void saveAsType(BOOL type=false) {}
void setSnapTarget(LLHandle<LLFloater> handle) { mSnappedTo = handle; }
void clearSnapTarget() { mSnappedTo.markDead(); }

View File

@@ -674,6 +674,19 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruGridInTitle</key>
<map>
<key>Comment</key>
<string>Show grid name in the viewer window title (takes effect upon next login)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>0</boolean>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>LiruGroupNoticeTimes</key>
<map>
<key>Comment</key>
@@ -833,6 +846,19 @@ Found in Advanced->Rendering->Info Displays</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogShowHistoryLines</key>
<map>
<key>Comment</key>
<string>Lines of history to load from log file if LogShowHistory is true.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>32</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>ContactsUseHorizontalButtons</key>
<map>
<key>Comment</key>
@@ -5842,6 +5868,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>DoubleClickTeleportMap</key>
<map>
<key>Comment</key>
<string>Enable double-click-teleport for the map</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>DoubleClickTeleportMiniMap</key>
<map>
<key>Comment</key>

View File

@@ -79,8 +79,6 @@ LLDropTarget::LLDropTarget(const LLDropTarget::Params& p)
LLDropTarget::~LLDropTarget()
{
delete mText;
delete mBorder;
}
// static

View File

@@ -36,9 +36,7 @@
#include "lllogchat.h"
#include "llappviewer.h"
#include "llfloaterchat.h"
#include "llviewercontrol.h"
const S32 LOG_RECALL_SIZE = 2048;
//static
std::string LLLogChat::makeLogFileName(std::string filename)
@@ -137,47 +135,19 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL
return ;
}
LLFILE* fptr = LLFile::fopen(makeLogFileName(filename), "r"); /*Flawfinder: ignore*/
if (!fptr)
llifstream ifstr(makeLogFileName(filename));
if (!ifstr.is_open())
{
//LLUIString message = LLFloaterChat::getInstance()->getString("IM_logging_string");
//callback(LOG_EMPTY,"IM_logging_string",userdata);
callback(LOG_EMPTY,LLStringUtil::null,userdata);
return; //No previous conversation with this name.
}
else
{
char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
char *bptr;
S32 len;
bool firstline=TRUE;
if ( fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END) )
{ //File is smaller than recall size. Get it all.
firstline = FALSE;
if ( fseek(fptr, 0, SEEK_SET) )
{
fclose(fptr);
return;
}
}
while ( fgets(buffer, LOG_RECALL_SIZE, fptr) && !feof(fptr) )
static const LLCachedControl<U32> lines("LogShowHistoryLines", 32);
std::string line;
for (U32 i = 0; i < lines && getline(ifstr, line); ++i)
{
len = strlen(buffer) - 1; /*Flawfinder: ignore*/
for ( bptr = (buffer + len); (*bptr == '\n' || *bptr == '\r') && bptr>buffer; bptr--) *bptr='\0';
if (!firstline)
{
callback(LOG_LINE,std::string(buffer),userdata);
}
else
{
firstline = FALSE;
}
callback(LOG_LINE, line, userdata);
}
callback(LOG_END,LLStringUtil::null,userdata);
fclose(fptr);
}
}

View File

@@ -671,19 +671,34 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,
// llwarns << "LLTaskInvFVBridge::dropped() - not implemented" << llendl;
//}
void pack_script_message(LLMessageSystem*, const LLInventoryItem*, const LLViewerObject*);
void reset_script(const LLInventoryItem* item, const LLViewerObject* obj)
{
if (!item || !obj) return;
gMessageSystem->newMessageFast(_PREHASH_ScriptReset);
pack_script_message(gMessageSystem, item, obj);
gMessageSystem->sendReliable(obj->getRegion()->getHost());
}
void set_script_running(bool running, const LLInventoryItem* item, const LLViewerObject* obj)
{
if (!item || !obj) return;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_SetScriptRunning);
pack_script_message(msg, item, obj);
msg->addBOOLFast(_PREHASH_Running, running);
msg->sendReliable(obj->getRegion()->getHost());
}
void pack_script_message(LLMessageSystem* msg, const LLInventoryItem* item, const LLViewerObject* obj)
{
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgentID);
msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
msg->nextBlockFast(_PREHASH_Script);
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
msg->addBOOLFast(_PREHASH_Running, running);
msg->sendReliable(obj->getRegion()->getHost());
}
// virtual
@@ -719,6 +734,10 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio
{
showProperties();
}
else if (action == "reset_script")
{
reset_script(findItem(), gObjectList.findObject(mPanel->getTaskUUID()));
}
else if (action == "start_script")
{
set_script_running(true, findItem(), gObjectList.findObject(mPanel->getTaskUUID()));
@@ -777,11 +796,13 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
if (LLAssetType::AT_LSL_TEXT == item->getType())
{
items.push_back(std::string("Task Reset"));
items.push_back(std::string("Task Set Running"));
items.push_back(std::string("Task Set Not Running"));
const LLViewerObject* obj = gObjectList.findObject(mPanel->getTaskUUID());
if (!obj || !(obj->permModify() || obj->permYouOwner()))
{
disabled_items.push_back(std::string("Task Reset"));
disabled_items.push_back(std::string("Task Set Running"));
disabled_items.push_back(std::string("Task Set Not Running"));
}

View File

@@ -40,8 +40,7 @@
#include "llcombobox.h"
#include "statemachine/aifilepicker.h"
#include "llfloaterinventory.h"
#include "llimagepng.h"
#include "llimagetga.h"
#include "llimage.h"
#include "llinventory.h"
#include "llnotificationsutil.h"
#include "llresmgr.h"
@@ -377,27 +376,16 @@ BOOL LLPreviewTexture::canSaveAs() const
return mIsCopyable && !mLoadingFullImage && mImage.notNull() && !mImage->isMissingAsset();
}
static bool sPng(false);
// virtual
void LLPreviewTexture::saveAsType(BOOL png)
void LLPreviewTexture::saveAs()
{
if( mLoadingFullImage )
return;
const LLViewerInventoryItem* item = getItem() ;
AIFilePicker* filepicker = AIFilePicker::create();
sPng = png;
if(png)
{
filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".png" : LLStringUtil::null, FFSAVE_PNG, "", "image");
filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker));
}
else
{
filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".tga" : LLStringUtil::null, FFSAVE_TGA, "", "image");
filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker));
}
filepicker->open(item ? LLDir::getScrubbedFileName(item->getName()) + ".png" : LLStringUtil::null, FFSAVE_IMAGE, "", "image");
filepicker->run(boost::bind(&LLPreviewTexture::saveAs_continued, this, item, filepicker));
}
void LLPreviewTexture::saveAs_continued(LLViewerInventoryItem const* item, AIFilePicker* filepicker)
@@ -446,16 +434,14 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success,
if( self && final && success )
{
//FIXME: There has to be a better way
LLPointer<LLImagePNG> image_png = new LLImagePNG;
LLPointer<LLImageTGA> image_tga = new LLImageTGA;
if( sPng ? !image_png->encode( src, 0.0 ) : !image_tga->encode( src ) )
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromExtension(self->mSaveFileName);
if (!image || !image->encode(src, 0.0))
{
LLSD args;
args["FILE"] = self->mSaveFileName;
LLNotificationsUtil::add("CannotEncodeFile", args);
}
else if( sPng ? !image_png->save( self->mSaveFileName ) : !image_tga->save( self->mSaveFileName ) )
else if (!image->save(self->mSaveFileName))
{
LLSD args;
args["FILE"] = self->mSaveFileName;

View File

@@ -63,8 +63,7 @@ public:
virtual void draw();
virtual BOOL canSaveAs() const;
virtual void saveAs(){ saveAsType(false); }
void saveAsType(BOOL png);
virtual void saveAs();
void saveAs_continued(LLViewerInventoryItem const* item, AIFilePicker* filepicker);
virtual LLUUID getItemID();
virtual std::string getItemCreatorName();

View File

@@ -1551,6 +1551,7 @@ bool idle_startup()
{
name += " " + lastname;
}
if (gSavedSettings.getBOOL("LiruGridInTitle")) gWindowTitle += "- " + gHippoGridManager->getCurrentGrid()->getGridName() + " ";
gViewerWindow->getWindow()->setTitle(gWindowTitle += "- " + name);
// Pass the user information to the voice chat server interface.
LLVoiceClient::getInstance()->userAuthorized(name, gAgentID);

View File

@@ -541,19 +541,6 @@ class LLFileSavePreview : public view_listener_t
}
};
class LLFileSavePreviewPNG : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLFloater* top = gFloaterView->getFrontmost();
if (top)
{
top->saveAsType(true);
}
return true;
}
};
class LLFileTakeSnapshot : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -1384,7 +1371,6 @@ void init_menu_file()
(new LLFileLocalAssetBrowser())->registerListener(gMenuHolder, "File.LocalAssetBrowser");
// </edit>
(new LLFileSavePreview())->registerListener(gMenuHolder, "File.SavePreview");
(new LLFileSavePreviewPNG())->registerListener(gMenuHolder, "File.SavePreviewPNG");
(new LLFileTakeSnapshot())->registerListener(gMenuHolder, "File.TakeSnapshot");
(new LLFileTakeSnapshotToDisk())->registerListener(gMenuHolder, "File.TakeSnapshotToDisk");
(new LLFileQuit())->registerListener(gMenuHolder, "File.Quit");

View File

@@ -2137,6 +2137,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
}
default:
{
if (!gSavedSettings.getBOOL("DoubleClickTeleportMap")) return true;
if (LLWorldMap::getInstance()->isTracking())
{
LLWorldMap::getInstance()->setTrackingDoubleClick();

View File

@@ -25,6 +25,9 @@
name="Task Remove" width="128">
<on_click filter="" function="Inventory.DoToSelected" userdata="delete" />
</menu_item_call>
<menu_item_call label="Reset" name="Task Reset">
<on_click filter="" function="Inventory.DoToSelected" userdata="reset_script" />
</menu_item_call>
<menu_item_call label="Set Not Running" name="Task Set Not Running">
<on_click filter="" function="Inventory.DoToSelected" userdata="stop_script" />
</menu_item_call>

View File

@@ -67,16 +67,11 @@
</menu_item_call>
<menu_item_separator bottom="-121" enabled="true" height="8" label="-----------" left="0"
mouse_opaque="true" name="separator2" width="243" />
<menu_item_call bottom="-140" enabled="true" height="19" label="Save Preview As (TGA)..." left="0"
<menu_item_call bottom="-140" enabled="true" height="19" label="Save Preview As..." left="0"
mouse_opaque="true" name="Save Preview As..." width="243">
<on_click function="File.SavePreview" userdata="" />
<on_enable function="File.EnableSaveAs" />
</menu_item_call>
<menu_item_call bottom="-140" enabled="true" height="19" label="Save Preview As (PNG)..." left="0"
mouse_opaque="true" name="Save Preview AsPNG..." width="243">
<on_click function="File.SavePreviewPNG" userdata="" />
<on_enable function="File.EnableSaveAs" />
</menu_item_call>
<menu_item_separator bottom="-148" enabled="true" height="8" label="-----------" left="0"
mouse_opaque="true" name="separator3" width="243" />
<menu_item_call bottom="-167" enabled="true" height="19" label="Take Snapshot" left="0"

View File

@@ -13,8 +13,7 @@
<menu_item_call label="Minimizar todas las Ventanas" name="Minimize All Windows"/>
<menu_item_call label="Cerrar Ventana" name="Close Window"/>
<menu_item_call label="Cerrar todas las Ventanas" name="Close All Windows"/>
<menu_item_call label="Guardar Vista Previa Como (TGA)..." name="Save Preview As..."/>
<menu_item_call label="Guardar Vista Previa Como (PNG)..." name="Save Preview AsPNG..."/>
<menu_item_call label="Guardar Vista Previa Como..." name="Save Preview As..."/>
<menu_item_call label="Hacer una Foto" name="Take Snapshot"/>
<menu_item_call label="Guardar Foto en Disco" name="Snapshot to Disk"/>
<menu_item_call label="Salir" name="Quit"/>

View File

@@ -12,8 +12,7 @@
<menu_item_separator/>
<menu_item_call label="Définir les droits par défaut " name="perm prefs"/>
<menu_item_separator/>
<menu_item_call label="Enregistrer la texture sur le disque dur en TGA" name="Save Preview As..."/>
<menu_item_call label="Enregistrer la texture sur le disque dur en PNG" name="Save Preview AsPNG..."/>
<menu_item_call label="Enregistrer la texture sur le disque" name="Save Preview As..."/>
<menu_item_separator/>
<menu_item_call label="Minimiser toutes les fenêtres" name="Minimize All Windows"/>

View File

@@ -329,6 +329,9 @@ void AIFilePicker::open(std::string const& filename, ESaveFilter filter, std::st
case FFSAVE_PHYSICS:
mFilter = "physics";
break;
case FFSAVE_IMAGE:
mFilter = "image";
break;
}
}

View File

@@ -91,7 +91,8 @@ enum ESaveFilter
FFSAVE_LANDMARK,
FFSAVE_AO,
FFSAVE_BLACKLIST,
FFSAVE_PHYSICS
FFSAVE_PHYSICS,
FFSAVE_IMAGE,
};
/*

View File

@@ -134,6 +134,8 @@ static LLFilePicker::ESaveFilter str2savefilter(std::string const& filter)
return LLFilePicker::FFSAVE_BLACKLIST;
else if (filter == "physics")
return LLFilePicker::FFSAVE_PHYSICS;
else if (filter == "image")
return LLFilePicker::FFSAVE_IMAGE;
else
return LLFilePicker::FFSAVE_ALL;
}

View File

@@ -692,6 +692,18 @@ bool LLFilePickerBase::getSaveFile(ESaveFilter filter, std::string const& filena
L"Landmarks (*.phy)\0*.phy\0" \
L"\0";
break;
case FFSAVE_IMAGE:
mOFN.lpstrDefExt = NULL;
mOFN.lpstrFilter =
L"Image (*.bmp *.dxt *.jpg *.jpeg *.j2c *.mip *.png *.tga)\0*.bmp;*.dxt;*.jpg;*.jpeg;*.j2c;*.mip;*.png;*.tga\0" \
L"PNG Image (*.png)\0*.png\0" \
L"Targa Image (*.tga)\0*.tga\0" \
L"Bitmap Image (*.bmp)\0*.bmp\0" \
L"JPEG Image (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
L"Compressed Image (*.j2c)\0*.j2c\0" \
L"DXT Image (*.dxt *.mip)\0*.dxt;*.mip\0" \
L"\0";
break;
// </edit>
default:
return FALSE;
@@ -1423,6 +1435,21 @@ static std::string add_imageload_filter_to_gtkchooser(GtkWindow *picker)
return filtername;
}
static std::string add_imagesave_filter_to_gtkchooser(GTKWindow *picker)
{
GtkFileFilter *gfilter = gtk_file_filter_new();
gtk_file_filter_add_mime_type(gfilter, "image/bmp");
gtk_file_filter_add_pattern(gfilter, "*.dxt");
gtk_file_filter_add_mime_type(gfilter, "image/jpeg");
gtk_file_filter_add_pattern(gfilter, "*.j2c");
gtk_file_filter_add_pattern(gfilter, "*.mip");
gtk_file_filter_add_mime_type(gfilter, "image/png");
gtk_file_filter_add_pattern(gfilter, "*.tga");
std::string filtername = LLTrans::getString("image_files") + "(*.bmp; *.dxt; *.jpg; *.jpeg; *.j2c; *.mip; *.png; *.tga)";
add_common_filters_to_gtkchooser(gfilter, picker, filtername);
return filtername;
}
static std::string add_script_filter_to_gtkchooser(GtkWindow *picker)
{
return add_simple_mime_filter_to_gtkchooser(picker, "text/plain",
@@ -1497,6 +1524,10 @@ bool LLFilePickerBase::getSaveFile(ESaveFilter filter, std::string const& filena
caption += add_script_filter_to_gtkchooser(picker);
suggest_ext = ".lsl";
break;
case FFSAVE_IMAGE:
caption += add_imagesave_filter_to_gtkchooser(picker);
suggest_ext = ".png";
break;
default:;
break;
}

View File

@@ -113,6 +113,7 @@ public:
FFSAVE_AO = 35,
FFSAVE_BLACKLIST = 36,
FFSAVE_PHYSICS = 37,
FFSAVE_IMAGE = 38,
// </edit>
};