dimonly fix
parent
4a34253a37
commit
a0219b2228
|
@ -268,6 +268,8 @@ add_resources(
|
|||
icons/graphics-window/trim.png
|
||||
icons/graphics-window/vert.png
|
||||
icons/text-window/constraint.png
|
||||
icons/text-window/constraint-dimo.png
|
||||
icons/text-window/constraint-wo.png
|
||||
icons/text-window/construction.png
|
||||
icons/text-window/edges.png
|
||||
icons/text-window/faces.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 480 B |
Binary file not shown.
After Width: | Height: | Size: 328 B |
|
@ -449,7 +449,23 @@ void Constraint::DoArcForAngle(Canvas *canvas, Canvas::hStroke hcs,
|
|||
}
|
||||
|
||||
bool Constraint::IsVisible() const {
|
||||
if(!SS.GW.showConstraints) return false;
|
||||
if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_NOSHOW ) return false;
|
||||
bool isDim = false;
|
||||
|
||||
if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_SHOW_DIM )
|
||||
switch (type){
|
||||
case ConstraintBase::Type::ANGLE:
|
||||
case ConstraintBase::Type::DIAMETER:
|
||||
case ConstraintBase::Type::PT_PT_DISTANCE:
|
||||
case ConstraintBase::Type::PT_FACE_DISTANCE:
|
||||
case ConstraintBase::Type::PT_LINE_DISTANCE:
|
||||
case ConstraintBase::Type::PT_PLANE_DISTANCE:
|
||||
isDim = true;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
if(SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_SHOW_ALL || isDim ) {
|
||||
Group *g = SK.GetGroup(group);
|
||||
// If the group is hidden, then the constraints are hidden and not
|
||||
// able to be selected.
|
||||
|
@ -465,6 +481,8 @@ bool Constraint::IsVisible() const {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Constraint::DoLineExtend(Canvas *canvas, Canvas::hStroke hcs,
|
||||
Vector p0, Vector p1, Vector pt, double salient) {
|
||||
|
|
|
@ -227,7 +227,7 @@ void SolveSpaceUI::ExportViewOrWireframeTo(const Platform::Path &filename, bool
|
|||
}
|
||||
}
|
||||
|
||||
if(SS.GW.showConstraints) {
|
||||
if(SS.GW.showConstraints != GraphicsWindow::ShowConstraintMode::SCM_NOSHOW ) {
|
||||
if(!out->OutputConstraints(&SK.constraint)) {
|
||||
GetEdgesCanvas canvas = {};
|
||||
canvas.camera = SS.GW.GetCamera();
|
||||
|
|
|
@ -409,7 +409,7 @@ void GraphicsWindow::Init() {
|
|||
showNormals = true;
|
||||
showPoints = true;
|
||||
showConstruction = true;
|
||||
showConstraints = true;
|
||||
showConstraints = GraphicsWindow::ShowConstraintMode::SCM_SHOW_ALL;
|
||||
showShaded = true;
|
||||
showEdges = true;
|
||||
showMesh = false;
|
||||
|
|
|
@ -719,7 +719,7 @@ void SolveSpaceUI::MenuFile(Command id) {
|
|||
|
||||
// If the user is exporting something where it would be
|
||||
// inappropriate to include the constraints, then warn.
|
||||
if(SS.GW.showConstraints &&
|
||||
if(SS.GW.showConstraints != GraphicsWindow::ShowConstraintMode::SCM_NOSHOW &&
|
||||
(dialog->GetFilename().HasExtension("txt") ||
|
||||
fabs(SS.exportOffset) > LENGTH_EPS))
|
||||
{
|
||||
|
|
|
@ -194,8 +194,7 @@ void TextWindow::ScreenHoverRequest(int link, uint32_t v) {
|
|||
SS.GW.hover.emphasized = true;
|
||||
}
|
||||
void TextWindow::ScreenHoverConstraint(int link, uint32_t v) {
|
||||
if(!SS.GW.showConstraints) return;
|
||||
|
||||
if( SS.GW.showConstraints == GraphicsWindow::ShowConstraintMode::SCM_NOSHOW ) return;
|
||||
hConstraint hc = { v };
|
||||
SS.GW.hover.Clear();
|
||||
SS.GW.hover.constraint = hc;
|
||||
|
|
|
@ -82,6 +82,62 @@ public:
|
|||
}
|
||||
}
|
||||
};
|
||||
#include <array>
|
||||
class TriStateButton : public Button {
|
||||
public:
|
||||
TriStateButton(GraphicsWindow::ShowConstraintMode*variable,
|
||||
const std::array<GraphicsWindow::ShowConstraintMode,3> &states,
|
||||
const std::array<std::string,3> &tooltips,
|
||||
const std::array<std::string,3> &iconNames ):variable(variable),states(states),tooltips(tooltips),iconNames(iconNames){}
|
||||
|
||||
GraphicsWindow::ShowConstraintMode* variable;
|
||||
std::array<GraphicsWindow::ShowConstraintMode,3> states;
|
||||
std::array<std::string,3> tooltips;
|
||||
std::array<std::string,3> iconNames;
|
||||
std::shared_ptr<Pixmap> icons[3];
|
||||
|
||||
std::string Tooltip() override {
|
||||
for (size_t k = 0; k < 3; ++k )
|
||||
if ( *variable == states[k] ) return tooltips[k];
|
||||
ssassert(false, "Unexpected mode");
|
||||
}
|
||||
|
||||
void Draw(UiCanvas *uiCanvas, int x, int y, bool asHovered) override {
|
||||
for (size_t k = 0; k < 3;++k)
|
||||
if(icons[k] == nullptr)
|
||||
icons[k] = LoadPng("icons/text-window/" + iconNames[k] + ".png");
|
||||
|
||||
std::shared_ptr<Pixmap> icon;
|
||||
for (size_t k = 0; k < 3; ++k )
|
||||
if ( *variable == states[k] ){
|
||||
icon = icons[k];
|
||||
break;
|
||||
}
|
||||
|
||||
uiCanvas->DrawPixmap(icon, x, y - 24);
|
||||
if(asHovered) {
|
||||
uiCanvas->DrawRect(x - 2, x + 26, y + 2, y - 26,
|
||||
/*fillColor=*/{ 255, 255, 0, 75 },
|
||||
/*outlineColor=*/{});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int AdvanceWidth() override { return 32; }
|
||||
|
||||
void Click() override {
|
||||
for (size_t k = 0;k < 3;++k)
|
||||
if ( *variable == states[k] ){
|
||||
*variable = states[(k+1)%3];
|
||||
break;
|
||||
}
|
||||
|
||||
SS.GenerateAll();
|
||||
SS.GW.Invalidate();
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OccludedLinesButton : public Button {
|
||||
public:
|
||||
|
@ -163,8 +219,15 @@ static ShowHideButton pointsButton =
|
|||
{ &(SS.GW.showPoints), "point", "points" };
|
||||
static ShowHideButton constructionButton =
|
||||
{ &(SS.GW.showConstruction), "construction", "construction entities" };
|
||||
static ShowHideButton constraintsButton =
|
||||
{ &(SS.GW.showConstraints), "constraint", "constraints and dimensions" };
|
||||
static TriStateButton constraintsButton =
|
||||
{ &(SS.GW.showConstraints),
|
||||
{GraphicsWindow::ShowConstraintMode::SCM_SHOW_ALL,
|
||||
GraphicsWindow::ShowConstraintMode::SCM_SHOW_DIM,
|
||||
GraphicsWindow::ShowConstraintMode::SCM_NOSHOW},
|
||||
{"constraints and dimensions","dimensions","none"},
|
||||
{"constraint","constraint-dimo","constraint-wo"}
|
||||
};
|
||||
|
||||
static FacesButton facesButton;
|
||||
static ShowHideButton shadedButton =
|
||||
{ &(SS.GW.showShaded), "shaded", "shaded view of solid model" };
|
||||
|
|
4
src/ui.h
4
src/ui.h
|
@ -801,12 +801,14 @@ public:
|
|||
bool ToolbarMouseDown(int x, int y);
|
||||
Command toolbarHovered;
|
||||
|
||||
enum class ShowConstraintMode{SCM_NOSHOW,SCM_SHOW_ALL,SCM_SHOW_DIM};
|
||||
|
||||
// This sets what gets displayed.
|
||||
bool showWorkplanes;
|
||||
bool showNormals;
|
||||
bool showPoints;
|
||||
bool showConstruction;
|
||||
bool showConstraints;
|
||||
ShowConstraintMode showConstraints;
|
||||
bool showTextWindow;
|
||||
bool showShaded;
|
||||
bool showEdges;
|
||||
|
|
Loading…
Reference in New Issue