Allow highlight color to be set by the user.

This commit is contained in:
Leonardo Zide 2020-04-25 11:36:28 -07:00
parent b7f57c03f0
commit acd7dd3f9a
18 changed files with 144 additions and 102 deletions

View file

@ -22,6 +22,8 @@ void lcPreferences::LoadDefaults()
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH); mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD); mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD);
mFadeSteps = lcGetProfileInt(LC_PROFILE_FADE_STEPS); mFadeSteps = lcGetProfileInt(LC_PROFILE_FADE_STEPS);
mHighlightNewParts = lcGetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS);
mHighlightNewPartsColor = lcGetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR);
mDrawGridStuds = lcGetProfileInt(LC_PROFILE_GRID_STUDS); mDrawGridStuds = lcGetProfileInt(LC_PROFILE_GRID_STUDS);
mGridStudColor = lcGetProfileInt(LC_PROFILE_GRID_STUD_COLOR); mGridStudColor = lcGetProfileInt(LC_PROFILE_GRID_STUD_COLOR);
mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES); mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES);
@ -47,6 +49,8 @@ void lcPreferences::SaveDefaults()
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth); lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD); lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD);
lcSetProfileInt(LC_PROFILE_FADE_STEPS, mFadeSteps); lcSetProfileInt(LC_PROFILE_FADE_STEPS, mFadeSteps);
lcSetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS, mHighlightNewParts);
lcSetProfileInt(LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR, mHighlightNewPartsColor);
lcSetProfileInt(LC_PROFILE_GRID_STUDS, mDrawGridStuds); lcSetProfileInt(LC_PROFILE_GRID_STUDS, mDrawGridStuds);
lcSetProfileInt(LC_PROFILE_GRID_STUD_COLOR, mGridStudColor); lcSetProfileInt(LC_PROFILE_GRID_STUD_COLOR, mGridStudColor);
lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines); lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines);
@ -194,7 +198,7 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
bool SaveHTML = false; bool SaveHTML = false;
bool SetCameraAngles = false; bool SetCameraAngles = false;
bool Orthographic = false; bool Orthographic = false;
bool ImageHighlight = false; bool ImageHighlight = mPreferences.mHighlightNewParts;
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH); int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT); int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
int StudLogo = lcGetProfileInt(LC_PROFILE_STUD_LOGO); int StudLogo = lcGetProfileInt(LC_PROFILE_STUD_LOGO);
@ -544,7 +548,9 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
else else
Frame = ImageName; Frame = ImageName;
ActiveModel->SaveStepImages(Frame, ImageStart != ImageEnd, CameraName == nullptr, ImageHighlight, ImageWidth, ImageHeight, ImageStart, ImageEnd); mPreferences.mHighlightNewParts = ImageHighlight;
ActiveModel->SaveStepImages(Frame, ImageStart != ImageEnd, CameraName == nullptr, ImageWidth, ImageHeight, ImageStart, ImageEnd);
} }
if (SaveWavefront) if (SaveWavefront)

View file

@ -34,6 +34,8 @@ public:
float mLineWidth; float mLineWidth;
bool mAllowLOD; bool mAllowLOD;
bool mFadeSteps; bool mFadeSteps;
bool mHighlightNewParts;
quint32 mHighlightNewPartsColor;
bool mDrawGridStuds; bool mDrawGridStuds;
quint32 mGridStudColor; quint32 mGridStudColor;
bool mDrawGridLines; bool mDrawGridLines;

View file

@ -1108,7 +1108,7 @@ void lcMainWindow::Print(QPrinter* Printer)
lcModel* Model = PageLayouts[Page - 1].first; lcModel* Model = PageLayouts[Page - 1].first;
lcStep Step = PageLayouts[Page - 1].second; lcStep Step = PageLayouts[Page - 1].second;
QImage Image = Model->GetStepImage(false, false, StepWidth, StepHeight, Step); QImage Image = Model->GetStepImage(false, StepWidth, StepHeight, Step);
Painter.drawImage(MarginRect.left(), MarginRect.top(), Image); Painter.drawImage(MarginRect.left(), MarginRect.top(), Image);

View file

@ -1362,7 +1362,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
Context->SetDepthWrite(true); Context->SetDepthWrite(true);
} }
QImage lcModel::GetStepImage(bool Zoom, bool Highlight, int Width, int Height, lcStep Step) QImage lcModel::GetStepImage(bool Zoom, int Width, int Height, lcStep Step)
{ {
View* ActiveView = gMainWindow->GetActiveView(); View* ActiveView = gMainWindow->GetActiveView();
ActiveView->MakeCurrent(); ActiveView->MakeCurrent();
@ -1375,7 +1375,6 @@ QImage lcModel::GetStepImage(bool Zoom, bool Highlight, int Width, int Height, l
ZoomExtents(Camera, (float)Width / (float)Height); ZoomExtents(Camera, (float)Width / (float)Height);
View View(this); View View(this);
View.SetHighlight(Highlight);
View.SetCamera(Camera, false); View.SetCamera(Camera, false);
View.SetContext(Context); View.SetContext(Context);
@ -1620,7 +1619,7 @@ QImage lcModel::GetPartsListImage(int MaxWidth, lcStep Step) const
return PainterImage; return PainterImage;
} }
void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End) void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, int Width, int Height, lcStep Start, lcStep End)
{ {
for (lcStep Step = Start; Step <= End; Step++) for (lcStep Step = Start; Step <= End; Step++)
{ {
@ -1636,7 +1635,7 @@ void lcModel::SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Z
if (Writer.format().isEmpty()) if (Writer.format().isEmpty())
Writer.setFormat("png"); Writer.setFormat("png");
QImage Image = GetStepImage(Zoom, Highlight, Width, Height, Step); QImage Image = GetStepImage(Zoom, Width, Height, Step);
if (!Writer.write(Image)) if (!Writer.write(Image))
{ {
QMessageBox::information(gMainWindow, tr("Error"), tr("Error writing to file '%1':\n%2").arg(FileName, Writer.errorString())); QMessageBox::information(gMainWindow, tr("Error"), tr("Error writing to file '%1':\n%2").arg(FileName, Writer.errorString()));

View file

@ -228,9 +228,9 @@ public:
void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool AllowHighlight, bool AllowFade) const; void GetScene(lcScene& Scene, lcCamera* ViewCamera, bool AllowHighlight, bool AllowFade) const;
void AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const; void AddSubModelRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, lcRenderMeshState RenderMeshState, bool ParentActive) const;
void DrawBackground(lcGLWidget* Widget); void DrawBackground(lcGLWidget* Widget);
QImage GetStepImage(bool Zoom, bool Highlight, int Width, int Height, lcStep Step); QImage GetStepImage(bool Zoom, int Width, int Height, lcStep Step);
QImage GetPartsListImage(int MaxWidth, lcStep Step) const; QImage GetPartsListImage(int MaxWidth, lcStep Step) const;
void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, bool Highlight, int Width, int Height, lcStep Start, lcStep End); void SaveStepImages(const QString& BaseName, bool AddStepSuffix, bool Zoom, int Width, int Height, lcStep Start, lcStep End);
std::vector<std::pair<lcModel*, lcStep>> GetPageLayouts(std::vector<const lcModel*>& AddedModels); std::vector<std::pair<lcModel*, lcStep>> GetPageLayouts(std::vector<const lcModel*>& AddedModels);
void RayTest(lcObjectRayTest& ObjectRayTest) const; void RayTest(lcObjectRayTest& ObjectRayTest) const;

View file

@ -59,6 +59,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD
lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS
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", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES

View file

@ -7,6 +7,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_LINE_WIDTH, LC_PROFILE_LINE_WIDTH,
LC_PROFILE_ALLOW_LOD, LC_PROFILE_ALLOW_LOD,
LC_PROFILE_FADE_STEPS, LC_PROFILE_FADE_STEPS,
LC_PROFILE_HIGHLIGHT_NEW_PARTS,
LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR,
LC_PROFILE_SHADING_MODE, LC_PROFILE_SHADING_MODE,
LC_PROFILE_DRAW_AXES, LC_PROFILE_DRAW_AXES,
LC_PROFILE_DRAW_EDGE_LINES, LC_PROFILE_DRAW_EDGE_LINES,

View file

@ -218,7 +218,7 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
break; break;
case lcRenderMeshState::Highlighted: case lcRenderMeshState::Highlighted:
Context->SetInterfaceColor(LC_COLOR_HIGHLIGHT); Context->SetColor(lcVector4FromColor(lcGetPreferences().mHighlightNewPartsColor));
break; break;
case lcRenderMeshState::Faded: case lcRenderMeshState::Faded:

View file

@ -654,6 +654,9 @@ void lcPiece::AddMainModelRenderMeshes(lcScene& Scene, bool Highlight, bool Fade
lcRenderMeshState RenderMeshState = lcRenderMeshState::Default; lcRenderMeshState RenderMeshState = lcRenderMeshState::Default;
bool ParentActive = false; bool ParentActive = false;
if (Highlight)
RenderMeshState = lcRenderMeshState::Highlighted;
if (Fade) if (Fade)
RenderMeshState = lcRenderMeshState::Faded; RenderMeshState = lcRenderMeshState::Faded;
@ -668,8 +671,6 @@ void lcPiece::AddMainModelRenderMeshes(lcScene& Scene, bool Highlight, bool Fade
else else
RenderMeshState = lcRenderMeshState::Faded; RenderMeshState = lcRenderMeshState::Faded;
} }
else if (Highlight)
RenderMeshState = lcRenderMeshState::Highlighted;
if (!mMesh) if (!mMesh)
mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, RenderMeshState, ParentActive); mPieceInfo->AddRenderMeshes(Scene, mModelWorld, mColorIndex, RenderMeshState, ParentActive);

View file

@ -33,7 +33,6 @@ lcHTMLExportOptions::lcHTMLExportOptions(const Project* Project)
IndexPage = (HTMLOptions & LC_HTML_INDEX) != 0; IndexPage = (HTMLOptions & LC_HTML_INDEX) != 0;
StepImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH); StepImagesWidth = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_WIDTH);
StepImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT); StepImagesHeight = lcGetProfileInt(LC_PROFILE_HTML_IMAGE_HEIGHT);
HighlightNewParts = (HTMLOptions & LC_HTML_HIGHLIGHT) != 0;
PartsListStep = (HTMLOptions & LC_HTML_LISTSTEP) != 0; PartsListStep = (HTMLOptions & LC_HTML_LISTSTEP) != 0;
PartsListEnd = (HTMLOptions & LC_HTML_LISTEND) != 0; PartsListEnd = (HTMLOptions & LC_HTML_LISTEND) != 0;
} }
@ -50,8 +49,6 @@ void lcHTMLExportOptions::SaveDefaults()
HTMLOptions |= LC_HTML_SINGLEPAGE; HTMLOptions |= LC_HTML_SINGLEPAGE;
if (IndexPage) if (IndexPage)
HTMLOptions |= LC_HTML_INDEX; HTMLOptions |= LC_HTML_INDEX;
if (HighlightNewParts)
HTMLOptions |= LC_HTML_HIGHLIGHT;
if (PartsListStep) if (PartsListStep)
HTMLOptions |= LC_HTML_LISTSTEP; HTMLOptions |= LC_HTML_LISTSTEP;
if (PartsListEnd) if (PartsListEnd)
@ -1656,7 +1653,7 @@ void Project::ExportHTML(const lcHTMLExportOptions& Options)
} }
QString StepImageBaseName = QFileInfo(Dir, BaseName + QLatin1String("-%1.png")).absoluteFilePath(); QString StepImageBaseName = QFileInfo(Dir, BaseName + QLatin1String("-%1.png")).absoluteFilePath();
Model->SaveStepImages(StepImageBaseName, true, false, Options.HighlightNewParts, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep); Model->SaveStepImages(StepImageBaseName, true, false, Options.StepImagesWidth, Options.StepImagesHeight, 1, LastStep);
} }
if (Models.GetSize() > 1) if (Models.GetSize() > 1)
@ -2147,7 +2144,7 @@ void Project::SaveImage()
if (Dialog.mStart != Dialog.mEnd) if (Dialog.mStart != Dialog.mEnd)
Dialog.mFileName = Dialog.mFileName.insert(Dialog.mFileName.length() - Extension.length() - 1, QLatin1String("%1")); Dialog.mFileName = Dialog.mFileName.insert(Dialog.mFileName.length() - Extension.length() - 1, QLatin1String("%1"));
mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mStart != Dialog.mEnd, false, false, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd); mActiveModel->SaveStepImages(Dialog.mFileName, Dialog.mStart != Dialog.mEnd, false, Dialog.mWidth, Dialog.mHeight, Dialog.mStart, Dialog.mEnd);
} }
void Project::UpdatePieceInfo(PieceInfo* Info) const void Project::UpdatePieceInfo(PieceInfo* Info) const

View file

@ -8,7 +8,6 @@
#define LC_HTML_INDEX 0x02 #define LC_HTML_INDEX 0x02
#define LC_HTML_LISTEND 0x08 #define LC_HTML_LISTEND 0x08
#define LC_HTML_LISTSTEP 0x10 #define LC_HTML_LISTSTEP 0x10
#define LC_HTML_HIGHLIGHT 0x20
#define LC_HTML_SUBMODELS 0x40 #define LC_HTML_SUBMODELS 0x40
#define LC_HTML_CURRENT_ONLY 0x80 #define LC_HTML_CURRENT_ONLY 0x80
@ -26,7 +25,6 @@ public:
bool IndexPage; bool IndexPage;
int StepImagesWidth; int StepImagesWidth;
int StepImagesHeight; int StepImagesHeight;
bool HighlightNewParts;
bool PartsListStep; bool PartsListStep;
bool PartsListEnd; bool PartsListEnd;
}; };

View file

@ -18,7 +18,6 @@ View::View(lcModel* Model)
mModel = Model; mModel = Model;
mActiveSubmodelInstance = nullptr; mActiveSubmodelInstance = nullptr;
mCamera = nullptr; mCamera = nullptr;
mHighlight = false;
memset(mGridSettings, 0, sizeof(mGridSettings)); memset(mGridSettings, 0, sizeof(mGridSettings));
mDragState = lcDragState::None; mDragState = lcDragState::None;
@ -820,7 +819,7 @@ void View::OnDraw()
mScene.SetActiveSubmodelInstance(mActiveSubmodelInstance, mActiveSubmodelTransform); mScene.SetActiveSubmodelInstance(mActiveSubmodelInstance, mActiveSubmodelTransform);
mScene.SetDrawInterface(DrawInterface); mScene.SetDrawInterface(DrawInterface);
mModel->GetScene(mScene, mCamera, mHighlight, Preferences.mFadeSteps); mModel->GetScene(mScene, mCamera, Preferences.mHighlightNewParts, Preferences.mFadeSteps);
if (DrawInterface && mTrackTool == LC_TRACKTOOL_INSERT) if (DrawInterface && mTrackTool == LC_TRACKTOOL_INSERT)
{ {

View file

@ -77,11 +77,6 @@ public:
void SetTopSubmodelActive(); void SetTopSubmodelActive();
void SetSelectedSubmodelActive(); void SetSelectedSubmodelActive();
void SetHighlight(bool Highlight)
{
mHighlight = Highlight;
}
static void CreateResources(lcContext* Context); static void CreateResources(lcContext* Context);
static void DestroyResources(lcContext* Context); static void DestroyResources(lcContext* Context);
@ -198,7 +193,6 @@ protected:
int mMouseDownY; int mMouseDownY;
lcVector3 mMouseDownPosition; lcVector3 mMouseDownPosition;
PieceInfo* mMouseDownPiece; PieceInfo* mMouseDownPiece;
bool mHighlight;
QImage mRenderImage; QImage mRenderImage;
std::pair<lcFramebuffer, lcFramebuffer> mRenderFramebuffer; std::pair<lcFramebuffer, lcFramebuffer> mRenderFramebuffer;
lcViewSphere mViewSphere; lcViewSphere mViewSphere;

View file

@ -28,7 +28,6 @@ lcQHTMLDialog::lcQHTMLDialog(QWidget* Parent, lcHTMLExportOptions* Options)
ui->indexPage->setChecked(mOptions->SinglePage); ui->indexPage->setChecked(mOptions->SinglePage);
ui->stepWidth->setText(QString::number(mOptions->StepImagesWidth)); ui->stepWidth->setText(QString::number(mOptions->StepImagesWidth));
ui->stepHeight->setText(QString::number(mOptions->StepImagesHeight)); ui->stepHeight->setText(QString::number(mOptions->StepImagesHeight));
ui->highlightNewParts->setChecked(mOptions->HighlightNewParts);
ui->partsAfterEachStep->setChecked(mOptions->PartsListStep); ui->partsAfterEachStep->setChecked(mOptions->PartsListStep);
ui->partsAtTheEnd->setChecked(mOptions->PartsListEnd); ui->partsAtTheEnd->setChecked(mOptions->PartsListEnd);
} }
@ -56,7 +55,6 @@ void lcQHTMLDialog::accept()
mOptions->IndexPage = ui->indexPage->isChecked(); mOptions->IndexPage = ui->indexPage->isChecked();
mOptions->StepImagesWidth = ui->stepWidth->text().toInt(); mOptions->StepImagesWidth = ui->stepWidth->text().toInt();
mOptions->StepImagesHeight = ui->stepHeight->text().toInt(); mOptions->StepImagesHeight = ui->stepHeight->text().toInt();
mOptions->HighlightNewParts = ui->highlightNewParts->isChecked();
mOptions->PartsListStep = ui->partsAfterEachStep->isChecked(); mOptions->PartsListStep = ui->partsAfterEachStep->isChecked();
mOptions->PartsListEnd = ui->partsAtTheEnd->isChecked(); mOptions->PartsListEnd = ui->partsAtTheEnd->isChecked();

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>612</height> <height>460</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -163,13 +163,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="highlightNewParts">
<property name="text">
<string>Highlight new parts</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -220,7 +213,6 @@
<tabstop>indexPage</tabstop> <tabstop>indexPage</tabstop>
<tabstop>stepWidth</tabstop> <tabstop>stepWidth</tabstop>
<tabstop>stepHeight</tabstop> <tabstop>stepHeight</tabstop>
<tabstop>highlightNewParts</tabstop>
<tabstop>partsAtTheEnd</tabstop> <tabstop>partsAtTheEnd</tabstop>
<tabstop>partsAfterEachStep</tabstop> <tabstop>partsAfterEachStep</tabstop>
</tabstops> </tabstops>

View file

@ -29,6 +29,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
#endif #endif
ui->lineWidth->setValidator(new QDoubleValidator(ui->lineWidth)); ui->lineWidth->setValidator(new QDoubleValidator(ui->lineWidth));
connect(ui->HighlightNewPartsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->gridLineColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->gridLineColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->ViewSphereColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->ViewSphereColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
@ -70,6 +71,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
ui->lineWidth->setText(lcFormatValueLocalized(mOptions->Preferences.mLineWidth)); ui->lineWidth->setText(lcFormatValueLocalized(mOptions->Preferences.mLineWidth));
ui->MeshLOD->setChecked(mOptions->Preferences.mAllowLOD); ui->MeshLOD->setChecked(mOptions->Preferences.mAllowLOD);
ui->FadeSteps->setChecked(mOptions->Preferences.mFadeSteps); ui->FadeSteps->setChecked(mOptions->Preferences.mFadeSteps);
ui->HighlightNewParts->setChecked(mOptions->Preferences.mHighlightNewParts);
ui->gridStuds->setChecked(mOptions->Preferences.mDrawGridStuds); ui->gridStuds->setChecked(mOptions->Preferences.mDrawGridStuds);
ui->gridLines->setChecked(mOptions->Preferences.mDrawGridLines); ui->gridLines->setChecked(mOptions->Preferences.mDrawGridLines);
ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing)); ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing));
@ -110,6 +112,9 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
QPixmap pix(12, 12); QPixmap pix(12, 12);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mHighlightNewPartsColor), LC_RGBA_GREEN(mOptions->Preferences.mHighlightNewPartsColor), LC_RGBA_BLUE(mOptions->Preferences.mHighlightNewPartsColor)));
ui->HighlightNewPartsColor->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridStudColor), LC_RGBA_GREEN(mOptions->Preferences.mGridStudColor), LC_RGBA_BLUE(mOptions->Preferences.mGridStudColor))); pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridStudColor), LC_RGBA_GREEN(mOptions->Preferences.mGridStudColor), LC_RGBA_BLUE(mOptions->Preferences.mGridStudColor)));
ui->gridStudColor->setIcon(pix); ui->gridStudColor->setIcon(pix);
@ -128,6 +133,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
on_studLogo_toggled(); on_studLogo_toggled();
on_antiAliasing_toggled(); on_antiAliasing_toggled();
on_edgeLines_toggled(); on_edgeLines_toggled();
on_HighlightNewParts_toggled();
on_gridStuds_toggled(); on_gridStuds_toggled();
on_gridLines_toggled(); on_gridLines_toggled();
on_ViewSphereSizeCombo_currentIndexChanged(ui->ViewSphereSizeCombo->currentIndex()); on_ViewSphereSizeCombo_currentIndexChanged(ui->ViewSphereSizeCombo->currentIndex());
@ -197,6 +203,7 @@ void lcQPreferencesDialog::accept()
mOptions->Preferences.mLineWidth = lcParseValueLocalized(ui->lineWidth->text()); mOptions->Preferences.mLineWidth = lcParseValueLocalized(ui->lineWidth->text());
mOptions->Preferences.mAllowLOD = ui->MeshLOD->isChecked(); mOptions->Preferences.mAllowLOD = ui->MeshLOD->isChecked();
mOptions->Preferences.mFadeSteps = ui->FadeSteps->isChecked(); mOptions->Preferences.mFadeSteps = ui->FadeSteps->isChecked();
mOptions->Preferences.mHighlightNewParts = ui->HighlightNewParts->isChecked();
mOptions->Preferences.mDrawGridStuds = ui->gridStuds->isChecked(); mOptions->Preferences.mDrawGridStuds = ui->gridStuds->isChecked();
mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked(); mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked();
@ -287,56 +294,62 @@ void lcQPreferencesDialog::on_lgeoPathBrowse_clicked()
void lcQPreferencesDialog::ColorButtonClicked() void lcQPreferencesDialog::ColorButtonClicked()
{ {
QObject *button = sender(); QObject* Button = sender();
QString title; QString Title;
quint32 *color = nullptr; quint32* Color = nullptr;
QColorDialog::ColorDialogOptions dialogOptions; QColorDialog::ColorDialogOptions DialogOptions;
if (button == ui->gridStudColor) if (Button == ui->HighlightNewPartsColor)
{ {
color = &mOptions->Preferences.mGridStudColor; Color = &mOptions->Preferences.mHighlightNewPartsColor;
title = tr("Select Grid Stud Color"); Title = tr("Select Highlight Color");
dialogOptions = QColorDialog::ShowAlphaChannel; DialogOptions = QColorDialog::ShowAlphaChannel;
} }
else if (button == ui->gridLineColor) else if (Button == ui->gridStudColor)
{ {
color = &mOptions->Preferences.mGridLineColor; Color = &mOptions->Preferences.mGridStudColor;
title = tr("Select Grid Line Color"); Title = tr("Select Grid Stud Color");
dialogOptions = 0; DialogOptions = QColorDialog::ShowAlphaChannel;
} }
else if (button == ui->ViewSphereColorButton) else if (Button == ui->gridLineColor)
{ {
color = &mOptions->Preferences.mViewSphereColor; Color = &mOptions->Preferences.mGridLineColor;
title = tr("Select View Sphere Color"); Title = tr("Select Grid Line Color");
dialogOptions = 0; DialogOptions = 0;
} }
else if (button == ui->ViewSphereTextColorButton) else if (Button == ui->ViewSphereColorButton)
{ {
color = &mOptions->Preferences.mViewSphereTextColor; Color = &mOptions->Preferences.mViewSphereColor;
title = tr("Select View Sphere Text Color"); Title = tr("Select View Sphere Color");
dialogOptions = 0; DialogOptions = 0;
} }
else if (button == ui->ViewSphereHighlightColorButton) else if (Button == ui->ViewSphereTextColorButton)
{ {
color = &mOptions->Preferences.mViewSphereHighlightColor; Color = &mOptions->Preferences.mViewSphereTextColor;
title = tr("Select View Sphere Highlight Color"); Title = tr("Select View Sphere Text Color");
dialogOptions = 0; DialogOptions = 0;
}
else if (Button == ui->ViewSphereHighlightColorButton)
{
Color = &mOptions->Preferences.mViewSphereHighlightColor;
Title = tr("Select View Sphere Highlight Color");
DialogOptions = 0;
} }
else else
return; return;
QColor oldColor = QColor(LC_RGBA_RED(*color), LC_RGBA_GREEN(*color), LC_RGBA_BLUE(*color), LC_RGBA_ALPHA(*color)); QColor oldColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
QColor newColor = QColorDialog::getColor(oldColor, this, title, dialogOptions); QColor newColor = QColorDialog::getColor(oldColor, this, Title, DialogOptions);
if (newColor == oldColor || !newColor.isValid()) if (newColor == oldColor || !newColor.isValid())
return; return;
*color = LC_RGBA(newColor.red(), newColor.green(), newColor.blue(), newColor.alpha()); *Color = LC_RGBA(newColor.red(), newColor.green(), newColor.blue(), newColor.alpha());
QPixmap pix(12, 12); QPixmap pix(12, 12);
pix.fill(newColor); pix.fill(newColor);
((QToolButton*)button)->setIcon(pix); ((QToolButton*)Button)->setIcon(pix);
} }
void lcQPreferencesDialog::on_studLogo_toggled() void lcQPreferencesDialog::on_studLogo_toggled()
@ -354,6 +367,11 @@ void lcQPreferencesDialog::on_edgeLines_toggled()
ui->lineWidth->setEnabled(ui->edgeLines->isChecked()); ui->lineWidth->setEnabled(ui->edgeLines->isChecked());
} }
void lcQPreferencesDialog::on_HighlightNewParts_toggled()
{
ui->HighlightNewPartsColor->setEnabled(ui->HighlightNewParts->isChecked());
}
void lcQPreferencesDialog::on_gridStuds_toggled() void lcQPreferencesDialog::on_gridStuds_toggled()
{ {
ui->gridStudColor->setEnabled(ui->gridStuds->isChecked()); ui->gridStudColor->setEnabled(ui->gridStuds->isChecked());

View file

@ -35,6 +35,7 @@ public slots:
void ColorButtonClicked(); void ColorButtonClicked();
void on_antiAliasing_toggled(); void on_antiAliasing_toggled();
void on_edgeLines_toggled(); void on_edgeLines_toggled();
void on_HighlightNewParts_toggled();
void on_gridStuds_toggled(); void on_gridStuds_toggled();
void on_gridLines_toggled(); void on_gridLines_toggled();
void on_ViewSphereSizeCombo_currentIndexChanged(int Index); void on_ViewSphereSizeCombo_currentIndexChanged(int Index);

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>598</width> <width>598</width>
<height>477</height> <height>489</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -304,23 +304,6 @@
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>width</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineWidth">
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="antiAliasingSamples"> <widget class="QComboBox" name="antiAliasingSamples">
<item> <item>
@ -340,21 +323,31 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Shading Mode:</string> <string>Shading Mode:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="2" column="2">
<widget class="QCheckBox" name="axisIcon"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Axis icon</string> <string>width</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1" colspan="2"> <item row="2" column="1">
<widget class="QLineEdit" name="lineWidth">
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QComboBox" name="ShadingMode"> <widget class="QComboBox" name="ShadingMode">
<item> <item>
<property name="text"> <property name="text">
@ -380,13 +373,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="studLogo">
<property name="text">
<string>Stud Logo</string>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="studLogoCombo"> <widget class="QComboBox" name="studLogoCombo">
<item> <item>
@ -416,6 +402,20 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="studLogo">
<property name="text">
<string>Stud Logo</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="axisIcon">
<property name="text">
<string>Axis icon</string>
</property>
</widget>
</item>
<item row="0" column="3"> <item row="0" column="3">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -436,6 +436,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="FadeSteps">
<property name="text">
<string>Fade Previous Steps</string>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QCheckBox" name="MeshLOD"> <widget class="QCheckBox" name="MeshLOD">
<property name="text"> <property name="text">
@ -443,12 +450,36 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="7" column="0" colspan="4">
<widget class="QCheckBox" name="FadeSteps"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="text"> <item>
<string>Fade Previous Steps</string> <widget class="QCheckBox" name="HighlightNewParts">
</property> <property name="text">
</widget> <string>Highlight new parts</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="HighlightNewPartsColor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<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>
</layout> </layout>
</widget> </widget>
@ -1198,6 +1229,8 @@
<tabstop>MeshLOD</tabstop> <tabstop>MeshLOD</tabstop>
<tabstop>axisIcon</tabstop> <tabstop>axisIcon</tabstop>
<tabstop>FadeSteps</tabstop> <tabstop>FadeSteps</tabstop>
<tabstop>HighlightNewParts</tabstop>
<tabstop>HighlightNewPartsColor</tabstop>
<tabstop>ShadingMode</tabstop> <tabstop>ShadingMode</tabstop>
<tabstop>gridStuds</tabstop> <tabstop>gridStuds</tabstop>
<tabstop>gridStudColor</tabstop> <tabstop>gridStudColor</tabstop>