mirror of
https://github.com/leozide/leocad
synced 2024-12-26 21:58:44 +01:00
Moved background color to global options.
This commit is contained in:
parent
462897caf7
commit
ef2220ffdc
12 changed files with 203 additions and 443 deletions
|
@ -18,6 +18,10 @@ void lcPreferences::LoadDefaults()
|
|||
mFixedAxes = lcGetProfileInt(LC_PROFILE_FIXED_AXES);
|
||||
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
|
||||
mShadingMode = static_cast<lcShadingMode>(lcGetProfileInt(LC_PROFILE_SHADING_MODE));
|
||||
mBackgroundGradient = lcGetProfileInt(LC_PROFILE_BACKGROUND_GRADIENT);
|
||||
mBackgroundSolidColor = lcGetProfileInt(LC_PROFILE_BACKGROUND_COLOR);
|
||||
mBackgroundGradientColorTop = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_TOP);
|
||||
mBackgroundGradientColorBottom = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM);
|
||||
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
|
||||
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
|
||||
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
|
||||
|
@ -64,6 +68,10 @@ void lcPreferences::SaveDefaults()
|
|||
lcSetProfileInt(LC_PROFILE_SHADING_MODE, static_cast<int>(mShadingMode));
|
||||
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
|
||||
lcSetProfileInt(LC_PROFILE_AXES_COLOR, mAxesColor);
|
||||
lcSetProfileInt(LC_PROFILE_BACKGROUND_GRADIENT, mBackgroundGradient);
|
||||
lcSetProfileInt(LC_PROFILE_BACKGROUND_COLOR, mBackgroundSolidColor);
|
||||
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_TOP, mBackgroundGradientColorTop);
|
||||
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM, mBackgroundGradientColorBottom);
|
||||
lcSetProfileInt(LC_PROFILE_OVERLAY_COLOR, mOverlayColor);
|
||||
lcSetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR, mActiveViewColor);
|
||||
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
||||
|
@ -106,6 +114,9 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
|
|||
if (ColorTheme == lcColorTheme::Dark)
|
||||
{
|
||||
mAxesColor = LC_RGBA(0, 0, 0, 255);
|
||||
mBackgroundSolidColor = LC_RGB(49, 52, 55);
|
||||
mBackgroundGradientColorTop = LC_RGB(0, 0, 191);
|
||||
mBackgroundGradientColorBottom = LC_RGB(255, 255, 255);
|
||||
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
|
||||
mActiveViewColor = LC_RGBA(41, 128, 185, 255);
|
||||
mGridStudColor = LC_RGBA(24, 24, 24, 192);
|
||||
|
@ -113,11 +124,13 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
|
|||
mViewSphereColor = LC_RGBA(35, 38, 41, 255);
|
||||
mViewSphereTextColor = LC_RGBA(224, 224, 224, 255);
|
||||
mViewSphereHighlightColor = LC_RGBA(41, 128, 185, 255);
|
||||
// todo: background color
|
||||
}
|
||||
else
|
||||
{
|
||||
mAxesColor = LC_RGBA(0, 0, 0, 255);
|
||||
mBackgroundSolidColor = LC_RGB(255, 255, 255);
|
||||
mBackgroundGradientColorTop = LC_RGB(54, 72, 95);
|
||||
mBackgroundGradientColorBottom = LC_RGB(49, 52, 55);
|
||||
mOverlayColor = LC_RGBA(0, 0, 0, 255);
|
||||
mActiveViewColor = LC_RGBA(255, 0, 0, 255);
|
||||
mGridStudColor = LC_RGBA(64, 64, 64, 192);
|
||||
|
|
|
@ -51,6 +51,10 @@ public:
|
|||
|
||||
int mMouseSensitivity;
|
||||
lcShadingMode mShadingMode;
|
||||
bool mBackgroundGradient;
|
||||
quint32 mBackgroundSolidColor;
|
||||
quint32 mBackgroundGradientColorTop;
|
||||
quint32 mBackgroundGradientColorBottom;
|
||||
bool mDrawAxes;
|
||||
quint32 mAxesColor;
|
||||
quint32 mOverlayColor;
|
||||
|
|
|
@ -31,26 +31,11 @@
|
|||
void lcModelProperties::LoadDefaults()
|
||||
{
|
||||
mAuthor = lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME);
|
||||
|
||||
mBackgroundType = (lcBackgroundType)lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE);
|
||||
mBackgroundSolidColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR));
|
||||
mBackgroundGradientColor1 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1));
|
||||
mBackgroundGradientColor2 = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2));
|
||||
mBackgroundImage = lcGetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE);
|
||||
mBackgroundImageTile = lcGetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE);
|
||||
|
||||
mAmbientColor = lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR));
|
||||
}
|
||||
|
||||
void lcModelProperties::SaveDefaults()
|
||||
{
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE, mBackgroundType);
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR, lcColorFromVector3(mBackgroundSolidColor));
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1, lcColorFromVector3(mBackgroundGradientColor1));
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2, lcColorFromVector3(mBackgroundGradientColor2));
|
||||
lcSetProfileString(LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE, mBackgroundImage);
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TILE, mBackgroundImageTile);
|
||||
|
||||
lcSetProfileInt(LC_PROFILE_DEFAULT_AMBIENT_COLOR, lcColorFromVector3(mAmbientColor));
|
||||
}
|
||||
|
||||
|
@ -69,32 +54,6 @@ void lcModelProperties::SaveLDraw(QTextStream& Stream) const
|
|||
Stream << QLatin1String("0 !LEOCAD MODEL COMMENT ") << Comment << LineEnding;
|
||||
}
|
||||
|
||||
bool TypeChanged = (mBackgroundType != lcGetDefaultProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_TYPE));
|
||||
|
||||
switch (mBackgroundType)
|
||||
{
|
||||
case LC_BACKGROUND_SOLID:
|
||||
if (mBackgroundSolidColor != lcVector3FromColor(lcGetDefaultProfileInt(LC_PROFILE_DEFAULT_BACKGROUND_COLOR)) || TypeChanged)
|
||||
Stream << QLatin1String("0 !LEOCAD MODEL BACKGROUND COLOR ") << mBackgroundSolidColor[0] << ' ' << mBackgroundSolidColor[1] << ' ' << mBackgroundSolidColor[2] << LineEnding;
|
||||
break;
|
||||
|
||||
case LC_BACKGROUND_GRADIENT:
|
||||
if (mBackgroundGradientColor1 != lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR1)) ||
|
||||
mBackgroundGradientColor2 != lcVector3FromColor(lcGetProfileInt(LC_PROFILE_DEFAULT_GRADIENT_COLOR2)) || TypeChanged)
|
||||
Stream << QLatin1String("0 !LEOCAD MODEL BACKGROUND GRADIENT ") << mBackgroundGradientColor1[0] << ' ' << mBackgroundGradientColor1[1] << ' ' << mBackgroundGradientColor1[2] << ' ' << mBackgroundGradientColor2[0] << ' ' << mBackgroundGradientColor2[1] << ' ' << mBackgroundGradientColor2[2] << LineEnding;
|
||||
break;
|
||||
|
||||
case LC_BACKGROUND_IMAGE:
|
||||
if (!mBackgroundImage.isEmpty())
|
||||
{
|
||||
Stream << QLatin1String("0 !LEOCAD MODEL BACKGROUND IMAGE ");
|
||||
if (mBackgroundImageTile)
|
||||
Stream << QLatin1String("TILE ");
|
||||
Stream << QLatin1String("NAME ") << mBackgroundImage << LineEnding;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// lcVector3 mAmbientColor;
|
||||
}
|
||||
|
||||
|
@ -148,37 +107,6 @@ void lcModelProperties::ParseLDrawLine(QTextStream& Stream)
|
|||
mComments += '\n';
|
||||
mComments += Comment;
|
||||
}
|
||||
else if (Token == QLatin1String("BACKGROUND"))
|
||||
{
|
||||
Stream >> Token;
|
||||
|
||||
if (Token == QLatin1String("COLOR"))
|
||||
{
|
||||
mBackgroundType = LC_BACKGROUND_SOLID;
|
||||
Stream >> mBackgroundSolidColor[0] >> mBackgroundSolidColor[1] >> mBackgroundSolidColor[2];
|
||||
}
|
||||
else if (Token == QLatin1String("GRADIENT"))
|
||||
{
|
||||
mBackgroundType = LC_BACKGROUND_GRADIENT;
|
||||
Stream >> mBackgroundGradientColor1[0] >> mBackgroundGradientColor1[1] >> mBackgroundGradientColor1[2] >> mBackgroundGradientColor2[0] >> mBackgroundGradientColor2[1] >> mBackgroundGradientColor2[2];
|
||||
}
|
||||
else if (Token == QLatin1String("IMAGE"))
|
||||
{
|
||||
Stream >> Token;
|
||||
|
||||
if (Token == QLatin1String("TILE"))
|
||||
{
|
||||
mBackgroundImageTile = true;
|
||||
Stream >> Token;
|
||||
}
|
||||
|
||||
if (Token == QLatin1String("NAME"))
|
||||
{
|
||||
mBackgroundImage = Stream.readLine().trimmed();
|
||||
mBackgroundType = LC_BACKGROUND_IMAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lcModel::lcModel(const QString& FileName, bool Preview)
|
||||
|
@ -190,7 +118,6 @@ lcModel::lcModel(const QString& FileName, bool Preview)
|
|||
|
||||
mActive = false;
|
||||
mCurrentStep = 1;
|
||||
mBackgroundTexture = nullptr;
|
||||
mPieceInfo = nullptr;
|
||||
}
|
||||
|
||||
|
@ -263,9 +190,6 @@ void lcModel::DeleteHistory()
|
|||
|
||||
void lcModel::DeleteModel()
|
||||
{
|
||||
lcReleaseTexture(mBackgroundTexture);
|
||||
mBackgroundTexture = nullptr;
|
||||
|
||||
if (gMainWindow)
|
||||
{
|
||||
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
|
||||
|
@ -757,7 +681,6 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
|
|||
|
||||
mCurrentStep = CurrentStep;
|
||||
CalculateStep(mCurrentStep);
|
||||
UpdateBackgroundTexture();
|
||||
Library->WaitForLoadQueue();
|
||||
Library->mBuffersDirty = true;
|
||||
Library->UnloadUnusedParts();
|
||||
|
@ -794,9 +717,6 @@ bool lcModel::LoadBinary(lcFile* file)
|
|||
file->ReadFloats(&fv, 1);
|
||||
|
||||
file->ReadU32(&rgb, 1);
|
||||
mProperties.mBackgroundSolidColor[0] = (float)((unsigned char) (rgb))/255;
|
||||
mProperties.mBackgroundSolidColor[1] = (float)((unsigned char) (((unsigned short) (rgb)) >> 8))/255;
|
||||
mProperties.mBackgroundSolidColor[2] = (float)((unsigned char) ((rgb) >> 16))/255;
|
||||
|
||||
if (fv < 0.6f) // old view
|
||||
{
|
||||
|
@ -993,7 +913,6 @@ bool lcModel::LoadBinary(lcFile* file)
|
|||
{
|
||||
char Background[LC_MAXPATH];
|
||||
file->ReadBuffer(Background, sh);
|
||||
mProperties.mBackgroundImage = Background;
|
||||
}
|
||||
else
|
||||
file->Seek(sh, SEEK_CUR);
|
||||
|
@ -1023,16 +942,9 @@ bool lcModel::LoadBinary(lcFile* file)
|
|||
if (fv > 1.0f)
|
||||
{
|
||||
file->ReadU32(&rgb, 1);
|
||||
mProperties.mBackgroundGradientColor1[0] = (float)((unsigned char) (rgb))/255;
|
||||
mProperties.mBackgroundGradientColor1[1] = (float)((unsigned char) (((unsigned short) (rgb)) >> 8))/255;
|
||||
mProperties.mBackgroundGradientColor1[2] = (float)((unsigned char) ((rgb) >> 16))/255;
|
||||
file->ReadU32(&rgb, 1);
|
||||
mProperties.mBackgroundGradientColor2[0] = (float)((unsigned char) (rgb))/255;
|
||||
mProperties.mBackgroundGradientColor2[1] = (float)((unsigned char) (((unsigned short) (rgb)) >> 8))/255;
|
||||
mProperties.mBackgroundGradientColor2[2] = (float)((unsigned char) ((rgb) >> 16))/255;
|
||||
}
|
||||
|
||||
UpdateBackgroundTexture();
|
||||
CalculateStep(mCurrentStep);
|
||||
lcGetPiecesLibrary()->UnloadUnusedParts();
|
||||
|
||||
|
@ -1347,9 +1259,12 @@ void lcModel::AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMat
|
|||
|
||||
void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||
{
|
||||
if (mProperties.mBackgroundType == LC_BACKGROUND_SOLID)
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
|
||||
if (!Preferences.mBackgroundGradient)
|
||||
{
|
||||
glClearColor(mProperties.mBackgroundSolidColor[0], mProperties.mBackgroundSolidColor[1], mProperties.mBackgroundSolidColor[2], 0.0f);
|
||||
lcVector3 BackgroundColor = lcVector3FromColor(Preferences.mBackgroundSolidColor);
|
||||
glClearColor(BackgroundColor[0], BackgroundColor[1], BackgroundColor[2], 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
return;
|
||||
}
|
||||
|
@ -1368,12 +1283,10 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
Context->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
Context->SetProjectionMatrix(lcMatrix44Ortho(0.0f, ViewWidth, 0.0f, ViewHeight, -1.0f, 1.0f));
|
||||
|
||||
if (mProperties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
||||
{
|
||||
Context->SetSmoothShading(true);
|
||||
|
||||
const lcVector3& Color1 = mProperties.mBackgroundGradientColor1;
|
||||
const lcVector3& Color2 = mProperties.mBackgroundGradientColor2;
|
||||
const lcVector3 Color1 = lcVector3FromColor(Preferences.mBackgroundGradientColorTop);
|
||||
const lcVector3 Color2 = lcVector3FromColor(Preferences.mBackgroundGradientColorBottom);
|
||||
|
||||
float Verts[] =
|
||||
{
|
||||
|
@ -1390,34 +1303,6 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
Context->DrawPrimitives(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
Context->SetSmoothShading(false);
|
||||
}
|
||||
else if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||
{
|
||||
Context->BindTexture2D(mBackgroundTexture->mTexture);
|
||||
|
||||
float TileWidth = 1.0f, TileHeight = 1.0f;
|
||||
|
||||
if (mProperties.mBackgroundImageTile)
|
||||
{
|
||||
TileWidth = ViewWidth / mBackgroundTexture->mWidth;
|
||||
TileHeight = ViewHeight / mBackgroundTexture->mHeight;
|
||||
}
|
||||
|
||||
float Verts[] =
|
||||
{
|
||||
0.0f, ViewHeight, 0.0f, 0.0f,
|
||||
ViewWidth, ViewHeight, TileWidth, 0.0f,
|
||||
ViewWidth, 0.0f, TileWidth, TileHeight,
|
||||
0.0f, 0.0f, 0.0f, TileHeight
|
||||
};
|
||||
|
||||
Context->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Context->SetMaterial(lcMaterialType::UnlitTextureDecal);
|
||||
Context->SetVertexBufferPointer(Verts);
|
||||
Context->SetVertexFormat(0, 2, 0, 2, 0, false);
|
||||
|
||||
Context->DrawPrimitives(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
Context->SetDepthWrite(true);
|
||||
|
@ -1747,20 +1632,6 @@ std::vector<lcInstructionsPageLayout> lcModel::GetPageLayouts(std::vector<const
|
|||
return PageLayouts;
|
||||
}
|
||||
|
||||
void lcModel::UpdateBackgroundTexture()
|
||||
{
|
||||
lcReleaseTexture(mBackgroundTexture);
|
||||
mBackgroundTexture = nullptr;
|
||||
|
||||
if (mProperties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||
{
|
||||
mBackgroundTexture = lcLoadTexture(mProperties.mBackgroundImage, LC_TEXTURE_WRAPU | LC_TEXTURE_WRAPV);
|
||||
|
||||
if (!mBackgroundTexture)
|
||||
mProperties.mBackgroundType = LC_BACKGROUND_SOLID;
|
||||
}
|
||||
}
|
||||
|
||||
void lcModel::RayTest(lcObjectRayTest& ObjectRayTest) const
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
|
@ -4453,8 +4324,6 @@ void lcModel::ShowPropertiesDialog()
|
|||
|
||||
mProperties = Options.Properties;
|
||||
|
||||
UpdateBackgroundTexture();
|
||||
|
||||
lcPreferences& Preferences = lcGetPreferences();
|
||||
if (Preferences.mPreviewEnabled && Preferences.mPreviewPosition != lcPreviewPosition::Floating)
|
||||
gMainWindow->GetPreviewWidget()->UpdatePreview();
|
||||
|
|
|
@ -44,13 +44,6 @@ enum class lcTransformType
|
|||
Count
|
||||
};
|
||||
|
||||
enum lcBackgroundType
|
||||
{
|
||||
LC_BACKGROUND_SOLID,
|
||||
LC_BACKGROUND_GRADIENT,
|
||||
LC_BACKGROUND_IMAGE
|
||||
};
|
||||
|
||||
class lcModelProperties
|
||||
{
|
||||
public:
|
||||
|
@ -63,11 +56,6 @@ public:
|
|||
mDescription != Properties.mDescription || mComments != Properties.mComments)
|
||||
return false;
|
||||
|
||||
if (mBackgroundType != Properties.mBackgroundType || mBackgroundSolidColor != Properties.mBackgroundSolidColor ||
|
||||
mBackgroundGradientColor1 != Properties.mBackgroundGradientColor1 || mBackgroundGradientColor2 != Properties.mBackgroundGradientColor2 ||
|
||||
mBackgroundImage != Properties.mBackgroundImage || mBackgroundImageTile != Properties.mBackgroundImageTile)
|
||||
return false;
|
||||
|
||||
if (mAmbientColor != Properties.mAmbientColor)
|
||||
return false;
|
||||
|
||||
|
@ -84,13 +72,6 @@ public:
|
|||
QString mAuthor;
|
||||
QString mComments;
|
||||
|
||||
lcBackgroundType mBackgroundType;
|
||||
lcVector3 mBackgroundSolidColor;
|
||||
lcVector3 mBackgroundGradientColor1;
|
||||
lcVector3 mBackgroundGradientColor2;
|
||||
QString mBackgroundImage;
|
||||
bool mBackgroundImageTile;
|
||||
|
||||
lcVector3 mAmbientColor;
|
||||
};
|
||||
|
||||
|
@ -380,8 +361,6 @@ protected:
|
|||
void RemoveEmptyGroups();
|
||||
bool RemoveSelectedObjects();
|
||||
|
||||
void UpdateBackgroundTexture();
|
||||
|
||||
void SelectGroup(lcGroup* TopGroup, bool Select);
|
||||
|
||||
void AddPiece(lcPiece* Piece);
|
||||
|
@ -394,7 +373,6 @@ protected:
|
|||
bool mActive;
|
||||
lcStep mCurrentStep;
|
||||
lcVector3 mMouseToolDistance;
|
||||
lcTexture* mBackgroundTexture;
|
||||
|
||||
lcArray<lcPiece*> mPieces;
|
||||
lcArray<lcCamera*> mCameras;
|
||||
|
@ -408,4 +386,3 @@ protected:
|
|||
|
||||
Q_DECLARE_TR_FUNCTIONS(lcModel);
|
||||
};
|
||||
|
||||
|
|
|
@ -64,6 +64,10 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
lcProfileEntry("Settings", "HighlightNewParts", 0), // LC_PROFILE_HIGHLIGHT_NEW_PARTS
|
||||
lcProfileEntry("Settings", "HighlightNewPartsColor", LC_RGBA(255, 242, 0, 192)), // LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR
|
||||
lcProfileEntry("Settings", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE
|
||||
lcProfileEntry("Settings", "BackgroundGradient", false), // LC_PROFILE_BACKGROUND_GRADIENT
|
||||
lcProfileEntry("Settings", "BackgroundColor", LC_RGB(49, 52, 55)), // LC_PROFILE_BACKGROUND_COLOR
|
||||
lcProfileEntry("Settings", "GradientColorTop", LC_RGB(54, 72, 95)), // LC_PROFILE_GRADIENT_COLOR_TOP
|
||||
lcProfileEntry("Settings", "GradientColorBottom", LC_RGB(49, 52, 55)), // LC_PROFILE_GRADIENT_COLOR_BOTTOM
|
||||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||
lcProfileEntry("Settings", "AxesColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_AXES_COLOR
|
||||
lcProfileEntry("Settings", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR
|
||||
|
@ -114,12 +118,6 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
|
||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||
lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
|
||||
lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
|
||||
lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
|
||||
lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
|
||||
lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
|
||||
lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
|
||||
lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
|
||||
|
||||
lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
|
||||
|
|
|
@ -12,6 +12,10 @@ enum LC_PROFILE_KEY
|
|||
LC_PROFILE_HIGHLIGHT_NEW_PARTS,
|
||||
LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR,
|
||||
LC_PROFILE_SHADING_MODE,
|
||||
LC_PROFILE_BACKGROUND_GRADIENT,
|
||||
LC_PROFILE_BACKGROUND_COLOR,
|
||||
LC_PROFILE_GRADIENT_COLOR_TOP,
|
||||
LC_PROFILE_GRADIENT_COLOR_BOTTOM,
|
||||
LC_PROFILE_DRAW_AXES,
|
||||
LC_PROFILE_AXES_COLOR,
|
||||
LC_PROFILE_OVERLAY_COLOR,
|
||||
|
@ -63,12 +67,6 @@ enum LC_PROFILE_KEY
|
|||
// Defaults for new projects.
|
||||
LC_PROFILE_DEFAULT_AUTHOR_NAME,
|
||||
LC_PROFILE_DEFAULT_AMBIENT_COLOR,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TYPE,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_COLOR,
|
||||
LC_PROFILE_DEFAULT_GRADIENT_COLOR1,
|
||||
LC_PROFILE_DEFAULT_GRADIENT_COLOR2,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TILE,
|
||||
|
||||
// Exporters.
|
||||
LC_PROFILE_HTML_OPTIONS,
|
||||
|
|
|
@ -914,17 +914,15 @@ void Project::Export3DStudio(const QString& FileName)
|
|||
File.WriteU16(0x0010); // CHK_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundSolidColor, 3);
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
lcVector3 BackgroundSolidColor = lcVector3FromColor(Preferences.mBackgroundSolidColor);
|
||||
|
||||
File.WriteFloats(BackgroundSolidColor, 3);
|
||||
|
||||
File.WriteU16(0x0013); // CHK_LIN_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundSolidColor, 3);
|
||||
|
||||
File.WriteU16(0x1100); // CHK_BIT_MAP
|
||||
QByteArray BackgroundImage = Properties.mBackgroundImage.toLatin1();
|
||||
File.WriteU32(6 + 1 + (quint32)strlen(BackgroundImage.constData()));
|
||||
File.WriteBuffer(BackgroundImage.constData(), strlen(BackgroundImage.constData()) + 1);
|
||||
File.WriteFloats(BackgroundSolidColor, 3);
|
||||
|
||||
File.WriteU16(0x1300); // CHK_V_GRADIENT
|
||||
File.WriteU32(118);
|
||||
|
@ -934,43 +932,41 @@ void Project::Export3DStudio(const QString& FileName)
|
|||
File.WriteU16(0x0010); // CHK_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundGradientColor1, 3);
|
||||
const lcVector3 BackgroundGradientColor1 = lcVector3FromColor(Preferences.mBackgroundGradientColorTop);
|
||||
const lcVector3 BackgroundGradientColor2 = lcVector3FromColor(Preferences.mBackgroundGradientColorBottom);
|
||||
|
||||
File.WriteFloats(BackgroundGradientColor1, 3);
|
||||
|
||||
File.WriteU16(0x0013); // CHK_LIN_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundGradientColor1, 3);
|
||||
File.WriteFloats(BackgroundGradientColor1, 3);
|
||||
|
||||
File.WriteU16(0x0010); // CHK_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats((Properties.mBackgroundGradientColor1 + Properties.mBackgroundGradientColor2) / 2.0f, 3);
|
||||
File.WriteFloats((BackgroundGradientColor1 + BackgroundGradientColor2) / 2.0f, 3);
|
||||
|
||||
File.WriteU16(0x0013); // CHK_LIN_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats((Properties.mBackgroundGradientColor1 + Properties.mBackgroundGradientColor2) / 2.0f, 3);
|
||||
File.WriteFloats((BackgroundGradientColor1 + BackgroundGradientColor2) / 2.0f, 3);
|
||||
|
||||
File.WriteU16(0x0010); // CHK_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundGradientColor2, 3);
|
||||
File.WriteFloats(BackgroundGradientColor2, 3);
|
||||
|
||||
File.WriteU16(0x0013); // CHK_LIN_COLOR_F
|
||||
File.WriteU32(18);
|
||||
|
||||
File.WriteFloats(Properties.mBackgroundGradientColor2, 3);
|
||||
File.WriteFloats(BackgroundGradientColor2, 3);
|
||||
|
||||
if (Properties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
||||
if (Preferences.mBackgroundGradient)
|
||||
{
|
||||
File.WriteU16(0x1301); // LIB3DS_USE_V_GRADIENT
|
||||
File.WriteU32(6);
|
||||
}
|
||||
else if (Properties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||
{
|
||||
File.WriteU16(0x1101); // LIB3DS_USE_BIT_MAP
|
||||
File.WriteU32(6);
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteU16(0x1201); // LIB3DS_USE_SOLID_BGND
|
||||
|
@ -1969,12 +1965,12 @@ bool Project::ExportPOVRay(const QString& FileName)
|
|||
const lcVector3& Position = Camera->mPosition;
|
||||
const lcVector3& Target = Camera->mTargetPosition;
|
||||
const lcVector3& Up = Camera->mUpVector;
|
||||
const lcModelProperties& Properties = mModels[0]->GetProperties();
|
||||
|
||||
sprintf(Line, "camera {\n perspective\n right x * image_width / image_height\n sky<%1g,%1g,%1g>\n location <%1g, %1g, %1g>\n look_at <%1g, %1g, %1g>\n angle %.0f * image_width / image_height\n}\n\n",
|
||||
Up[1], Up[0], Up[2], Position[1] / 25.0f, Position[0] / 25.0f, Position[2] / 25.0f, Target[1] / 25.0f, Target[0] / 25.0f, Target[2] / 25.0f, Camera->m_fovy);
|
||||
POVFile.WriteLine(Line);
|
||||
sprintf(Line, "background { color rgb <%1g, %1g, %1g> }\n\n", Properties.mBackgroundSolidColor[0], Properties.mBackgroundSolidColor[1], Properties.mBackgroundSolidColor[2]);
|
||||
lcVector3 BackgroundColor = lcVector3FromColor(lcGetPreferences().mBackgroundSolidColor);
|
||||
sprintf(Line, "background { color rgb <%1g, %1g, %1g> }\n\n", BackgroundColor[0], BackgroundColor[1], BackgroundColor[2]);
|
||||
POVFile.WriteLine(Line);
|
||||
|
||||
lcVector3 Min(FLT_MAX, FLT_MAX, FLT_MAX);
|
||||
|
|
|
@ -28,6 +28,9 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
delete ui->povrayLayout;
|
||||
#endif
|
||||
|
||||
connect(ui->BackgroundSolidColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->BackgroundGradient1ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->BackgroundGradient2ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->AxesColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->OverlayColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->FadeStepsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
|
@ -102,6 +105,11 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing));
|
||||
ui->AxisIconCheckBox->setChecked(mOptions->Preferences.mDrawAxes);
|
||||
|
||||
if (!mOptions->Preferences.mBackgroundGradient)
|
||||
ui->BackgroundSolidRadio->setChecked(true);
|
||||
else
|
||||
ui->BackgroundGradientRadio->setChecked(true);
|
||||
|
||||
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
|
||||
|
||||
if (mOptions->Preferences.mViewSphereEnabled)
|
||||
|
@ -186,6 +194,15 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundSolidColor), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundSolidColor), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundSolidColor)));
|
||||
ui->BackgroundSolidColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorTop)));
|
||||
ui->BackgroundGradient1ColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorBottom)));
|
||||
ui->BackgroundGradient2ColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mAxesColor), LC_RGBA_GREEN(mOptions->Preferences.mAxesColor), LC_RGBA_BLUE(mOptions->Preferences.mAxesColor)));
|
||||
ui->AxesColorButton->setIcon(pix);
|
||||
|
||||
|
@ -307,6 +324,7 @@ void lcQPreferencesDialog::accept()
|
|||
mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked();
|
||||
mOptions->Preferences.mGridLineSpacing = gridLineSpacing;
|
||||
|
||||
mOptions->Preferences.mBackgroundGradient = ui->BackgroundGradientRadio->isChecked();
|
||||
mOptions->Preferences.mDrawAxes = ui->AxisIconCheckBox->isChecked();
|
||||
mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();
|
||||
|
||||
|
@ -443,7 +461,25 @@ void lcQPreferencesDialog::ColorButtonClicked()
|
|||
quint32* Color = nullptr;
|
||||
QColorDialog::ColorDialogOptions DialogOptions;
|
||||
|
||||
if (Button == ui->AxesColorButton)
|
||||
if (Button == ui->BackgroundSolidColorButton)
|
||||
{
|
||||
Color = &mOptions->Preferences.mBackgroundSolidColor;
|
||||
Title = tr("Select Background Color");
|
||||
DialogOptions = 0;
|
||||
}
|
||||
else if (Button == ui->BackgroundGradient1ColorButton)
|
||||
{
|
||||
Color = &mOptions->Preferences.mBackgroundGradientColorTop;
|
||||
Title = tr("Select Gradient Top Color");
|
||||
DialogOptions = 0;
|
||||
}
|
||||
else if (Button == ui->BackgroundGradient2ColorButton)
|
||||
{
|
||||
Color = &mOptions->Preferences.mBackgroundGradientColorBottom;
|
||||
Title = tr("Select Gradient Bottom Color");
|
||||
DialogOptions = 0;
|
||||
}
|
||||
else if (Button == ui->AxesColorButton)
|
||||
{
|
||||
Color = &mOptions->Preferences.mAxesColor;
|
||||
Title = tr("Select Axes Color");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>598</width>
|
||||
<height>503</height>
|
||||
<height>530</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -545,6 +545,98 @@
|
|||
<string>Interface</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Background</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Top Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="BackgroundGradient1ColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>Bottom Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="BackgroundGradient2ColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="BackgroundSolidRadio">
|
||||
<property name="text">
|
||||
<string>So&lid Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="BackgroundGradientRadio">
|
||||
<property name="text">
|
||||
<string>&Gradient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QToolButton" name="BackgroundSolidColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
|
@ -1549,6 +1641,11 @@
|
|||
<tabstop>HighlightNewParts</tabstop>
|
||||
<tabstop>HighlightNewPartsColor</tabstop>
|
||||
<tabstop>ShadingMode</tabstop>
|
||||
<tabstop>BackgroundSolidRadio</tabstop>
|
||||
<tabstop>BackgroundSolidColorButton</tabstop>
|
||||
<tabstop>BackgroundGradientRadio</tabstop>
|
||||
<tabstop>BackgroundGradient1ColorButton</tabstop>
|
||||
<tabstop>BackgroundGradient2ColorButton</tabstop>
|
||||
<tabstop>AxisIconCheckBox</tabstop>
|
||||
<tabstop>AxesColorButton</tabstop>
|
||||
<tabstop>ActiveViewColorButton</tabstop>
|
||||
|
|
|
@ -30,17 +30,13 @@ public:
|
|||
bool mLast;
|
||||
};
|
||||
|
||||
lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||
QDialog(parent),
|
||||
lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, void* Data)
|
||||
: QDialog(Parent),
|
||||
ui(new Ui::lcQPropertiesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->solidColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
|
||||
connect(ui->gradient1ColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
|
||||
connect(ui->gradient2ColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
|
||||
|
||||
options = (lcPropertiesDialogOptions*)data;
|
||||
options = (lcPropertiesDialogOptions*)Data;
|
||||
|
||||
setWindowTitle(tr("%1 Properties").arg(options->Properties.mFileName));
|
||||
|
||||
|
@ -48,25 +44,6 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
|||
ui->authorEdit->setText(options->Properties.mAuthor);
|
||||
ui->commentsEdit->setText(options->Properties.mComments);
|
||||
|
||||
if (options->Properties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||
ui->imageRadio->setChecked(true);
|
||||
else if (options->Properties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
||||
ui->gradientRadio->setChecked(true);
|
||||
else
|
||||
ui->solidRadio->setChecked(true);
|
||||
|
||||
ui->imageNameEdit->setText(options->Properties.mBackgroundImage);
|
||||
ui->imageTileCheckBox->setChecked(options->Properties.mBackgroundImageTile);
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(QColor(options->Properties.mBackgroundSolidColor[0] * 255, options->Properties.mBackgroundSolidColor[1] * 255, options->Properties.mBackgroundSolidColor[2] * 255));
|
||||
ui->solidColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->Properties.mBackgroundGradientColor1[0] * 255, options->Properties.mBackgroundGradientColor1[1] * 255, options->Properties.mBackgroundGradientColor1[2] * 255));
|
||||
ui->gradient1ColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->Properties.mBackgroundGradientColor2[0] * 255, options->Properties.mBackgroundGradientColor2[1] * 255, options->Properties.mBackgroundGradientColor2[2] * 255));
|
||||
ui->gradient2ColorButton->setIcon(pix);
|
||||
|
||||
const lcPartsList& PartsList = options->PartsList;
|
||||
QStringList horizontalLabels;
|
||||
|
||||
|
@ -168,65 +145,5 @@ void lcQPropertiesDialog::accept()
|
|||
options->Properties.mAuthor = ui->authorEdit->text();
|
||||
options->Properties.mComments = ui->commentsEdit->toPlainText();
|
||||
|
||||
if (ui->imageRadio->isChecked())
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_IMAGE;
|
||||
else if (ui->gradientRadio->isChecked())
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_GRADIENT;
|
||||
else
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_SOLID;
|
||||
|
||||
options->Properties.mBackgroundImage = ui->imageNameEdit->text();
|
||||
options->Properties.mBackgroundImageTile = ui->imageTileCheckBox->isChecked();
|
||||
options->SetDefault = ui->setDefaultCheckBox->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void lcQPropertiesDialog::colorClicked()
|
||||
{
|
||||
QObject *button = sender();
|
||||
QString title;
|
||||
float *color = nullptr;
|
||||
|
||||
if (button == ui->solidColorButton)
|
||||
{
|
||||
color = options->Properties.mBackgroundSolidColor;
|
||||
title = tr("Select Background Color");
|
||||
}
|
||||
else if (button == ui->gradient1ColorButton)
|
||||
{
|
||||
color = options->Properties.mBackgroundGradientColor1;
|
||||
title = tr("Select Background Top Color");
|
||||
}
|
||||
else if (button == ui->gradient2ColorButton)
|
||||
{
|
||||
color = options->Properties.mBackgroundGradientColor2;
|
||||
title = tr("Select Background Bottom Color");
|
||||
}
|
||||
|
||||
if (!color)
|
||||
return;
|
||||
|
||||
QColor oldColor = QColor(color[0] * 255, color[1] * 255, color[2] * 255);
|
||||
QColor newColor = QColorDialog::getColor(oldColor, this, title);
|
||||
|
||||
if (newColor == oldColor || !newColor.isValid())
|
||||
return;
|
||||
|
||||
color[0] = (float)newColor.red() / 255.0f;
|
||||
color[1] = (float)newColor.green() / 255.0f;
|
||||
color[2] = (float)newColor.blue() / 255.0f;
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(newColor);
|
||||
((QToolButton*)button)->setIcon(pix);
|
||||
}
|
||||
|
||||
void lcQPropertiesDialog::on_imageNameButton_clicked()
|
||||
{
|
||||
QString result = QFileDialog::getOpenFileName(this, tr("Select Background Image"), ui->imageNameEdit->text(), tr("All Image Files (*.png *.jpg *.gif *.bmp);;PNG Files (*.png);;JPEG Files (*.jpg);;GIF Files (*.gif);;BMP Files (*.bmp);;All Files (*.*)"));
|
||||
|
||||
if (!result.isEmpty())
|
||||
ui->imageNameEdit->setText(QDir::toNativeSeparators(result));
|
||||
}
|
||||
|
|
|
@ -12,15 +12,13 @@ class lcQPropertiesDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit lcQPropertiesDialog(QWidget *parent, void *data);
|
||||
lcQPropertiesDialog(QWidget* Parent, void* Data);
|
||||
~lcQPropertiesDialog();
|
||||
|
||||
lcPropertiesDialogOptions *options;
|
||||
|
||||
public slots:
|
||||
void accept() override;
|
||||
void colorClicked();
|
||||
void on_imageNameButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::lcQPropertiesDialog *ui;
|
||||
|
|
|
@ -72,139 +72,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabScene">
|
||||
<attribute name="title">
|
||||
<string>Scene</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Background</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QToolButton" name="gradient1ColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="gradient2ColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="solidRadio">
|
||||
<property name="text">
|
||||
<string>So&lid Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="imageRadio">
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="gradientRadio">
|
||||
<property name="text">
|
||||
<string>&Gradient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="imageNameEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="imageNameButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="imageTileCheckBox">
|
||||
<property name="text">
|
||||
<string>Tile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QToolButton" name="solidColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="setDefaultCheckBox">
|
||||
<property name="text">
|
||||
<string>Set default options for new projects</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabParts">
|
||||
<attribute name="title">
|
||||
<string>Parts Used</string>
|
||||
|
@ -251,16 +118,6 @@
|
|||
<tabstop>authorEdit</tabstop>
|
||||
<tabstop>descriptionEdit</tabstop>
|
||||
<tabstop>commentsEdit</tabstop>
|
||||
<tabstop>solidRadio</tabstop>
|
||||
<tabstop>solidColorButton</tabstop>
|
||||
<tabstop>gradientRadio</tabstop>
|
||||
<tabstop>gradient1ColorButton</tabstop>
|
||||
<tabstop>gradient2ColorButton</tabstop>
|
||||
<tabstop>imageRadio</tabstop>
|
||||
<tabstop>imageNameEdit</tabstop>
|
||||
<tabstop>imageNameButton</tabstop>
|
||||
<tabstop>imageTileCheckBox</tabstop>
|
||||
<tabstop>setDefaultCheckBox</tabstop>
|
||||
<tabstop>partsTable</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in a new issue