Allow setting a custom size when uploading a texture.

This commit is contained in:
Aleric Inglewood
2012-11-26 23:21:34 +01:00
parent d7069a2a66
commit de52eebe7a

View File

@@ -1229,7 +1229,6 @@ public:
static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname, bool update_controls = true); static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname, bool update_controls = true);
static void updateControls(LLFloaterSnapshot* floater); static void updateControls(LLFloaterSnapshot* floater);
static void updateLayout(LLFloaterSnapshot* floater); static void updateLayout(LLFloaterSnapshot* floater);
static void updateResolutionTextEntry(LLFloaterSnapshot* floater);
static LLHandle<LLView> sPreviewHandle; static LLHandle<LLView> sPreviewHandle;
static BOOL sAspectRatioCheckOff ; static BOOL sAspectRatioCheckOff ;
@@ -1463,11 +1462,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
case LLSnapshotLivePreview::SNAPSHOT_LOCAL: case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
setResolution(floater, "local_size_combo", false); setResolution(floater, "local_size_combo", false);
break; break;
default:
break;
} }
} }
updateResolutionTextEntry(floater);
floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(shot_format); floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(shot_format);
@@ -1544,31 +1540,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
} }
} }
// static
void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater)
{
LLSpinCtrl* width_spinner = floater->getChild<LLSpinCtrl>("snapshot_width");
LLSpinCtrl* height_spinner = floater->getChild<LLSpinCtrl>("snapshot_height");
if (gSavedSettings.getS32("LastSnapshotType") == LLSnapshotLivePreview::SNAPSHOT_TEXTURE ||
gSavedSettings.getBOOL("RenderUIInSnapshot") ||
gSavedSettings.getBOOL("RenderHUDInSnapshot"))
{
// Disable without making label gray.
width_spinner->setAllowEdit(FALSE);
width_spinner->setIncrement(0);
height_spinner->setAllowEdit(FALSE);
height_spinner->setIncrement(0);
}
else
{
width_spinner->setAllowEdit(TRUE);
width_spinner->setIncrement(32);
height_spinner->setAllowEdit(TRUE);
height_spinner->setIncrement(32);
}
}
// static // static
void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail) void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)
{ {
@@ -2087,6 +2058,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
if(view->childGetValue("snapshot_width").asInteger() != width || view->childGetValue("snapshot_height").asInteger() != height) if(view->childGetValue("snapshot_width").asInteger() != width || view->childGetValue("snapshot_height").asInteger() != height)
{ {
Dout(dc::notice, "LLFloaterSnapshot::Impl::updateResolution: set width, height to " << width << ", " << height);
view->childSetValue("snapshot_width", width); view->childSetValue("snapshot_width", width);
view->childSetValue("snapshot_height", height); view->childSetValue("snapshot_height", height);
} }
@@ -2105,6 +2077,30 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
} }
} }
} }
// Set whether or not the spinners can be changed.
LLSpinCtrl* width_spinner = view->getChild<LLSpinCtrl>("snapshot_width");
LLSpinCtrl* height_spinner = view->getChild<LLSpinCtrl>("snapshot_height");
if ((gSavedSettings.getS32("LastSnapshotType") == LLSnapshotLivePreview::SNAPSHOT_TEXTURE &&
combobox->getCurrentIndex() != combobox->getItemCount() - 1) ||
gSavedSettings.getBOOL("RenderUIInSnapshot") ||
gSavedSettings.getBOOL("RenderHUDInSnapshot"))
{
// Disable without making label gray.
width_spinner->setAllowEdit(FALSE);
width_spinner->setIncrement(0);
height_spinner->setAllowEdit(FALSE);
height_spinner->setIncrement(0);
}
else
{
width_spinner->setAllowEdit(TRUE);
width_spinner->setIncrement(32);
height_spinner->setAllowEdit(TRUE);
height_spinner->setIncrement(32);
}
} }
// static // static
@@ -2256,6 +2252,7 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
//static //static
void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height)
{ {
DoutEntering(dc::notice, "LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(" << width << ", " << height << ")");
view->getChild<LLSpinCtrl>("snapshot_width")->forceSetValue(width); view->getChild<LLSpinCtrl>("snapshot_width")->forceSetValue(width);
view->getChild<LLSpinCtrl>("snapshot_height")->forceSetValue(height); view->getChild<LLSpinCtrl>("snapshot_height")->forceSetValue(height);
gSavedSettings.setS32(lastSnapshotWidthName(), width); gSavedSettings.setS32(lastSnapshotWidthName(), width);
@@ -2399,6 +2396,7 @@ BOOL LLFloaterSnapshot::postBuild()
childSetValue("layer_types", "colors"); childSetValue("layer_types", "colors");
childSetEnabled("layer_types", FALSE); childSetEnabled("layer_types", FALSE);
Dout(dc::notice, "LLFloaterSnapshot::postBuild: setting width, height to " << gSavedSettings.getS32(lastSnapshotWidthName()) << ", " << gSavedSettings.getS32(lastSnapshotHeightName()));
childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName())); childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName()));
childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName())); childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName()));