CAM: Simulator - Decrease speed button (#21222)

* CAM: Simulator - Decrease speed button

* CAM: Simulator - Move slider upper

* CAM: Simulator - Changed speed icons
This commit is contained in:
tarman3
2025-05-12 16:57:30 +03:00
committed by GitHub
parent f71e84cad9
commit f75d79860b
16 changed files with 77 additions and 38 deletions

View File

@@ -126,11 +126,14 @@
<file>panels/TaskPathSimulator.ui</file>
<file>panels/TaskCAMSimulator.ui</file>
<file>panels/ZCorrectEdit.ui</file>
<file>gl_simulator/0.png</file>
<file>gl_simulator/1.png</file>
<file>gl_simulator/4.png</file>
<file>gl_simulator/X.png</file>
<file>gl_simulator/Slower.png</file>
<file>gl_simulator/Faster.png</file>
<file>gl_simulator/x.png</file>
<file>gl_simulator/1.png</file>
<file>gl_simulator/5.png</file>
<file>gl_simulator/10.png</file>
<file>gl_simulator/25.png</file>
<file>gl_simulator/50.png</file>
<file>gl_simulator/Pause.png</file>
<file>gl_simulator/Play.png</file>
<file>gl_simulator/Rotate.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

View File

@@ -32,17 +32,20 @@
using namespace MillSim;
GuiItem guiItems[] = {
{eGuiItemSlider, 0, 0, 240, -36, 0},
{eGuiItemThumb, 0, 0, 328, -50, 1},
{eGuiItemSlider, 0, 0, 40, -80, 0},
{eGuiItemThumb, 0, 0, 328, -94, 1},
{eGuiItemPause, 0, 0, 40, -50, 'P', true},
{eGuiItemPlay, 0, 0, 40, -50, 'S', false},
{eGuiItemSingleStep, 0, 0, 80, -50, 'T'},
{eGuiItemFaster, 0, 0, 120, -50, 'F'},
{eGuiItemSlower, 0, 0, 125, -50, ' '},
{eGuiItemFaster, 0, 0, 170, -50, 'F'},
{eGuiItemX, 0, 0, 220, -45, 0, false, 0},
{eGuiItem1, 0, 0, 242, -50, 0, false, 0},
{eGuiItem5, 0, 0, 242, -50, 0, true, 0},
{eGuiItem10, 0, 0, 242, -50, 0, true, 0},
{eGuiItem25, 0, 0, 242, -50, 0, true, 0},
{eGuiItem50, 0, 0, 242, -50, 0, true, 0},
{eGuiItemRotate, 0, 0, -140, -50, ' ', false, GUIITEM_CHECKABLE},
{eGuiItemCharXImg, 0, 0, 160, -50, 0, false, 0}, // 620
{eGuiItemChar0Img, 0, 0, 200, -50, 0, false, 0},
{eGuiItemChar1Img, 0, 0, 185, -50, 0, false, 0},
{eGuiItemChar4Img, 0, 0, 180, -50, 0, true, 0},
{eGuiItemPath, 0, 0, -100, -50, 'L', false, GUIITEM_CHECKABLE},
{eGuiItemAmbientOclusion, 0, 0, -60, -50, 'A', false, GUIITEM_CHECKABLE},
{eGuiItemView, 0, 0, -180, -50, 'V', false},
@@ -56,12 +59,15 @@ std::vector<std::string> guiFileNames = {"Slider.png",
"Pause.png",
"Play.png",
"SingleStep.png",
"Slower.png",
"Faster.png",
"Rotate.png",
"X.png",
"0.png",
"x.png",
"1.png",
"4.png",
"5.png",
"10.png",
"25.png",
"50.png",
"Rotate.png",
"Path.png",
"AmbientOclusion.png",
"View.png"};
@@ -73,8 +79,9 @@ void GuiDisplay::UpdateProjection()
mat4x4_ortho(projmat, 0, gWindowSizeW, gWindowSizeH, 0, -1, 1);
mShader.Activate();
mShader.UpdateProjectionMat(projmat);
mThumbMaxMotion = guiItems[eGuiItemView].posx() - guiItems[eGuiItemSlider].posx()
- guiItems[eGuiItemThumb].texItem.w;
mThumbMaxMotion = guiItems[eGuiItemAmbientOclusion].posx()
+ guiItems[eGuiItemAmbientOclusion].texItem.w
- guiItems[eGuiItemSlider].posx(); // - guiItems[eGuiItemThumb].texItem.w;
HStretchGlItem(&(guiItems[eGuiItemSlider]), mThumbMaxMotion, 10.0f);
}
@@ -263,8 +270,10 @@ void MillSim::GuiDisplay::SetupTooltips()
QCoreApplication::translate("CAM:Simulator:Tooltips", "Play simulation", nullptr);
guiItems[eGuiItemSingleStep].toolTip =
QCoreApplication::translate("CAM:Simulator:Tooltips", "Single step simulation", nullptr);
guiItems[eGuiItemSlower].toolTip =
QCoreApplication::translate("CAM:Simulator:Tooltips", "Decrease simulation speed", nullptr);
guiItems[eGuiItemFaster].toolTip =
QCoreApplication::translate("CAM:Simulator:Tooltips", "Change simulation speed", nullptr);
QCoreApplication::translate("CAM:Simulator:Tooltips", "Increase simulation speed", nullptr);
guiItems[eGuiItemPath].toolTip =
QCoreApplication::translate("CAM:Simulator:Tooltips", "Show/Hide tool path", nullptr);
guiItems[eGuiItemRotate].toolTip = QCoreApplication::translate("CAM:Simulator:Tooltips",
@@ -366,9 +375,11 @@ void GuiDisplay::UpdatePlayState(bool isRunning)
void MillSim::GuiDisplay::UpdateSimSpeed(int speed)
{
guiItems[eGuiItemChar0Img].hidden = speed == 1;
guiItems[eGuiItemChar1Img].hidden = speed == 40;
guiItems[eGuiItemChar4Img].hidden = speed != 40;
guiItems[eGuiItem1].hidden = speed != 1;
guiItems[eGuiItem5].hidden = speed != 5;
guiItems[eGuiItem10].hidden = speed != 10;
guiItems[eGuiItem25].hidden = speed != 25;
guiItems[eGuiItem50].hidden = speed != 50;
}
void MillSim::GuiDisplay::HandleKeyPress(int key)

View File

@@ -40,12 +40,15 @@ enum eGuiItems
eGuiItemPause,
eGuiItemPlay,
eGuiItemSingleStep,
eGuiItemSlower,
eGuiItemFaster,
eGuiItemX,
eGuiItem1,
eGuiItem5,
eGuiItem10,
eGuiItem25,
eGuiItem50,
eGuiItemRotate,
eGuiItemCharXImg,
eGuiItemChar0Img,
eGuiItemChar1Img,
eGuiItemChar4Img,
eGuiItemPath,
eGuiItemAmbientOclusion,
eGuiItemView,

View File

@@ -467,12 +467,15 @@ void MillSimulation::HandleGuiAction(eGuiItems actionItem, bool checked)
mSingleStep = true;
break;
case eGuiItemFaster:
if (mSimSpeed == 1) {
case eGuiItemSlower:
if (mSimSpeed == 50) {
mSimSpeed = 25;
}
else if (mSimSpeed == 25) {
mSimSpeed = 10;
}
else if (mSimSpeed == 10) {
mSimSpeed = 40;
mSimSpeed = 5;
}
else {
mSimSpeed = 1;
@@ -480,6 +483,22 @@ void MillSimulation::HandleGuiAction(eGuiItems actionItem, bool checked)
guiDisplay.UpdateSimSpeed(mSimSpeed);
break;
case eGuiItemFaster:
if (mSimSpeed == 1) {
mSimSpeed = 5;
}
else if (mSimSpeed == 5) {
mSimSpeed = 10;
}
else if (mSimSpeed == 10) {
mSimSpeed = 25;
}
else {
mSimSpeed = 50;
}
guiDisplay.UpdateSimSpeed(mSimSpeed);
break;
case eGuiItemPath:
simDisplay.updateDisplay = true;
break;

View File

@@ -25,20 +25,23 @@
using namespace MillSim;
TextureItem texItems[] = {
{1, 36, 0, 0},
{1, 40, 0, 0},
{1, 1, 0, 0},
{70, 1, 0, 0},
{100, 1, 0, 0},
{134, 1, 0, 0},
{172, 1, 0, 0},
{135, 1, 0, 0},
{30, 1, 0, 0},
{170, 1, 0, 0},
{1, 130, 0, 0},
{30, 130, 0, 0},
{55, 130, 0, 0},
{85, 130, 0, 0},
{140, 130, 0, 0},
{195, 130, 0, 0},
{210, 1, 0, 0},
{2, 50, 0, 0},
{70, 50, 0, 0},
{27, 50, 0, 0},
{44, 50, 0, 0},
{90, 50, 0, 0},
{128, 50, 0, 0},
{168, 50, 0, 0},
{95, 50, 0, 0},
{130, 50, 0, 0},
{170, 50, 0, 0},
};