Merge pull request #4 from solvespace/master

Merge from remote.
pull/493/head
Yuan 2020-02-22 15:07:12 +08:00 committed by GitHub
commit 101a08e1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 121 additions and 54 deletions

View File

@ -25,3 +25,30 @@ jobs:
on: on:
repo: solvespace/solvespace repo: solvespace/solvespace
tags: true tags: true
- &deploy-snap
stage: deploy
name: Snap amd64
os: linux
arch: amd64
dist: bionic
addons:
snaps:
- name: snapcraft
confinement: classic
script: ./.travis/build-snap.sh
deploy:
- provider: script
script: sudo ./.travis/deploy-snap.sh edge
skip_cleanup: true
on:
branch: master
tags: false
- provider: script
script: sudo ./.travis/deploy-snap.sh edge,beta
skip_cleanup: true
on:
branch: master
tags: true
- <<: *deploy-snap
name: Snap arm64
arch: arm64

4
.travis/build-snap.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh -xe
sudo apt-get update
sudo ./pkg/snap/build.sh --destructive-mode

8
.travis/deploy-snap.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh -e
channels="$1"
echo "$SNAP_TOKEN" | snapcraft login --with -
for snap in ./pkg/snap/*.snap; do
snapcraft push "$snap" --release "$channels"
done

View File

@ -7,8 +7,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
" mkdir build && cd build && cmake ..") " mkdir build && cd build && cmake ..")
endif() endif()
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
cmake_policy(VERSION 3.11) if(NOT CMAKE_VERSION VERSION_LESS 3.11.0)
cmake_policy(VERSION 3.11.0)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/") "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)

View File

@ -30,6 +30,20 @@ the SolveSpace maintainers for each stable release.
[rel]: https://github.com/solvespace/solvespace/releases [rel]: https://github.com/solvespace/solvespace/releases
### Via Snap Store
Builds from master are automatically released to the `edge` channel in the Snap Store. Those packages contain the latest improvements, but receive less testing than release builds.
Future official releases will appear in the `stable` channel.
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/solvespace)
Or install from a terminal:
```
snap install --edge solvespace
```
### Via third-party binary packages ### Via third-party binary packages
_Third-party_ nightly binary packages for Debian and Ubuntu are available _Third-party_ nightly binary packages for Debian and Ubuntu are available

View File

@ -26,9 +26,10 @@ apps:
extensions: [gnome-3-28] extensions: [gnome-3-28]
plugs: [opengl, unity7, home, removable-media, gsettings, network] plugs: [opengl, unity7, home, removable-media, gsettings, network]
environment: environment:
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/usr/share/glvnd/egl_vendor.d __EGL_VENDOR_LIBRARY_DIRS: $SNAP/gnome-platform/usr/share/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
cli: cli:
command: usr/bin/solvespace-cli command: usr/bin/solvespace-cli
extensions: [gnome-3-28]
plugs: [home, removable-media, network] plugs: [home, removable-media, network]
parts: parts:
@ -71,6 +72,14 @@ parts:
- libglibmm-2.4-1v5 - libglibmm-2.4-1v5
- libpangomm-1.4-1v5 - libpangomm-1.4-1v5
- libsigc++-2.0-0v5 - libsigc++-2.0-0v5
- libglew2.0 cleanup:
- libegl-mesa0 after: [solvespace]
- libdrm2 plugin: nil
build-snaps: [core18, gnome-3-28-1804]
override-prime: |
# Remove all files from snap that are already included in the base snap or in
# any connected content snaps
set -eux
for snap in "core18" "gnome-3-28-1804"; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done

View File

@ -5,8 +5,8 @@
<path d="m152 80h12v74h-12z" fill="#cbcbcb"/> <path d="m152 80h12v74h-12z" fill="#cbcbcb"/>
<path d="m104 140h84v12h-84z" fill="#e40cf2"/> <path d="m104 140h84v12h-84z" fill="#e40cf2"/>
<path d="m140 68h12v74h-12z" fill="#e40cf2"/> <path d="m140 68h12v74h-12z" fill="#e40cf2"/>
<path d="m56 164h36v36h-36z" fill="#43f20c"/>
<path d="m68 32h12v192h-12z"/> <path d="m68 32h12v192h-12z"/>
<path d="m32 176h192v12h-192z"/> <path d="m32 176h192v12h-192z"/>
<path d="m56 164h36v36h-36z" fill="#43f20c"/>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 444 B

View File

@ -196,9 +196,6 @@ void Constraint::MenuConstrain(Command id) {
c.valA = 0; c.valA = 0;
c.ModifyToSatisfy(); c.ModifyToSatisfy();
AddConstraint(&c); AddConstraint(&c);
if (SS.immediatelyEditDimension) {
SS.GW.EditConstraint(c.h);
}
break; break;
} }
@ -610,9 +607,6 @@ void Constraint::MenuConstrain(Command id) {
c.ModifyToSatisfy(); c.ModifyToSatisfy();
AddConstraint(&c); AddConstraint(&c);
if (SS.immediatelyEditDimension) {
SS.GW.EditConstraint(c.h);
}
break; break;
} }
@ -769,6 +763,10 @@ void Constraint::MenuConstrain(Command id) {
} }
} }
if ((id == Command::DISTANCE_DIA || id == Command::ANGLE) && SS.immediatelyEditDimension) {
SS.GW.EditConstraint(c.h);
}
SS.GW.ClearSelection(); SS.GW.ClearSelection();
} }

View File

@ -917,13 +917,13 @@ void SolveSpaceUI::ExportMeshAsQ3doTo(FILE *f, SMesh *sm) {
} }
Vector faceNormal = t.Normal(); Vector faceNormal = t.Normal();
auto a = q3d::Vector3(t.a.x/s, t.a.y/s, t.a.z/s); auto a = q3d::Vector3((float)(t.a.x/s), (float)(t.a.y/s), (float)(t.a.z/s));
auto b = q3d::Vector3(t.b.x/s, t.b.y/s, t.b.z/s); auto b = q3d::Vector3((float)(t.b.x/s), (float)(t.b.y/s), (float)(t.b.z/s));
auto c = q3d::Vector3(t.c.x/s, t.c.y/s, t.c.z/s); auto c = q3d::Vector3((float)(t.c.x/s), (float)(t.c.y/s), (float)(t.c.z/s));
auto fn = q3d::Vector3(faceNormal.x, faceNormal.y, faceNormal.x); auto fn = q3d::Vector3((float)faceNormal.x, (float)faceNormal.y, (float)faceNormal.x);
auto n1 = q3d::Vector3(t.normals[0].x, t.normals[0].y, t.normals[0].z); auto n1 = q3d::Vector3((float)t.normals[0].x, (float)t.normals[0].y, (float)t.normals[0].z);
auto n2 = q3d::Vector3(t.normals[1].x, t.normals[1].y, t.normals[1].z); auto n2 = q3d::Vector3((float)t.normals[1].x, (float)t.normals[1].y, (float)t.normals[1].z);
auto n3 = q3d::Vector3(t.normals[2].x, t.normals[2].y, t.normals[2].z); auto n3 = q3d::Vector3((float)t.normals[2].x, (float)t.normals[2].y, (float)t.normals[2].z);
auto tri = q3d::CreateTriangle(builder, &a, &b, &c, &fn, &n1, &n2, &n3); auto tri = q3d::CreateTriangle(builder, &a, &b, &c, &fn, &n1, &n2, &n3);
materialTriangles[color].push_back(tri); materialTriangles[color].push_back(tri);
} }

View File

@ -16,6 +16,7 @@ using namespace SolveSpace;
+ (NSToolTipManager *)sharedToolTipManager; + (NSToolTipManager *)sharedToolTipManager;
- (void)setInitialToolTipDelay:(double)delay; - (void)setInitialToolTipDelay:(double)delay;
- (void)orderOutToolTip; - (void)orderOutToolTip;
- (void)abortToolTip;
- (void)_displayTemporaryToolTipForView:(id)arg1 withString:(id)arg2; - (void)_displayTemporaryToolTipForView:(id)arg1 withString:(id)arg2;
@end @end
@ -909,7 +910,11 @@ public:
NSToolTipManager *nsToolTipManager = [NSToolTipManager sharedToolTipManager]; NSToolTipManager *nsToolTipManager = [NSToolTipManager sharedToolTipManager];
if(newText.empty()) { if(newText.empty()) {
if ([nsToolTipManager respondsToSelector:@selector(abortToolTip)]) {
[nsToolTipManager abortToolTip];
} else {
[nsToolTipManager orderOutToolTip]; [nsToolTipManager orderOutToolTip];
}
} else { } else {
[nsToolTipManager _displayTemporaryToolTipForView:ssView withString:Wrap(newText)]; [nsToolTipManager _displayTemporaryToolTipForView:ssView withString:Wrap(newText)];
} }

View File

@ -73,7 +73,7 @@ namespace Platform {
void CheckLastError(const char *file, int line, const char *function, const char *expr) { void CheckLastError(const char *file, int line, const char *function, const char *expr) {
if(GetLastError() != S_OK) { if(GetLastError() != S_OK) {
LPWSTR messageW; LPWSTR messageW;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&messageW, 0, NULL); (LPWSTR)&messageW, 0, NULL);
@ -203,7 +203,7 @@ public:
uint32_t ThawInt(const std::string &key, uint32_t defaultValue) { uint32_t ThawInt(const std::string &key, uint32_t defaultValue) {
DWORD value; DWORD value;
DWORD type, length = sizeof(value); DWORD type, length = sizeof(value);
LSTATUS result = RegQueryValueEx(GetKey(), &Widen(key)[0], 0, LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0,
&type, (BYTE *)&value, &length); &type, (BYTE *)&value, &length);
if(result == ERROR_SUCCESS && type == REG_DWORD) { if(result == ERROR_SUCCESS && type == REG_DWORD) {
return value; return value;
@ -219,7 +219,7 @@ public:
double ThawFloat(const std::string &key, double defaultValue) { double ThawFloat(const std::string &key, double defaultValue) {
double value; double value;
DWORD type, length = sizeof(value); DWORD type, length = sizeof(value);
LSTATUS result = RegQueryValueEx(GetKey(), &Widen(key)[0], 0, LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0,
&type, (BYTE *)&value, &length); &type, (BYTE *)&value, &length);
if(result == ERROR_SUCCESS && type == REG_QWORD) { if(result == ERROR_SUCCESS && type == REG_QWORD) {
return value; return value;
@ -237,12 +237,12 @@ public:
std::string ThawString(const std::string &key, const std::string &defaultValue) { std::string ThawString(const std::string &key, const std::string &defaultValue) {
DWORD type, length = 0; DWORD type, length = 0;
LSTATUS result = RegQueryValueEx(GetKey(), &Widen(key)[0], 0, LSTATUS result = RegQueryValueExW(GetKey(), &Widen(key)[0], 0,
&type, NULL, &length); &type, NULL, &length);
if(result == ERROR_SUCCESS && type == REG_SZ) { if(result == ERROR_SUCCESS && type == REG_SZ) {
std::wstring valueW; std::wstring valueW;
valueW.resize(length / 2 - 1); valueW.resize(length / 2 - 1);
sscheck(RegQueryValueEx(GetKey(), &Widen(key)[0], 0, sscheck(RegQueryValueExW(GetKey(), &Widen(key)[0], 0,
&type, (BYTE *)&valueW[0], &length)); &type, (BYTE *)&valueW[0], &length));
return Narrow(valueW); return Narrow(valueW);
} }
@ -538,7 +538,7 @@ public:
static bool registered; static bool registered;
if(registered) return; if(registered) return;
WNDCLASSEX wc = {}; WNDCLASSEXW wc = {};
wc.cbSize = sizeof(wc); wc.cbSize = sizeof(wc);
wc.style = CS_BYTEALIGNCLIENT|CS_BYTEALIGNWINDOW|CS_OWNDC|CS_DBLCLKS; wc.style = CS_BYTEALIGNCLIENT|CS_BYTEALIGNWINDOW|CS_OWNDC|CS_DBLCLKS;
wc.lpfnWndProc = WndProc; wc.lpfnWndProc = WndProc;
@ -549,7 +549,7 @@ public:
IMAGE_ICON, 16, 16, 0); IMAGE_ICON, 16, 16, 0);
wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.lpszClassName = L"SolveSpace"; wc.lpszClassName = L"SolveSpace";
sscheck(RegisterClassEx(&wc)); sscheck(RegisterClassExW(&wc));
registered = true; registered = true;
} }
@ -702,7 +702,7 @@ public:
// The wndproc may be called from within CreateWindowEx, and before we've associated // The wndproc may be called from within CreateWindowEx, and before we've associated
// the window with the WindowImplWin32. In that case, just defer to the default wndproc. // the window with the WindowImplWin32. In that case, just defer to the default wndproc.
if(window == NULL) { if(window == NULL) {
return DefWindowProc(h, msg, wParam, lParam); return DefWindowProcW(h, msg, wParam, lParam);
} }
#if defined(HAVE_SPACEWARE) #if defined(HAVE_SPACEWARE)
@ -999,7 +999,7 @@ public:
sscheck(SetForegroundWindow(hParent)); sscheck(SetForegroundWindow(hParent));
break; break;
} else { } else {
return DefWindowProc(h, msg, wParam, lParam); return DefWindowProcW(h, msg, wParam, lParam);
} }
} }
@ -1042,7 +1042,7 @@ public:
} }
default: default:
return DefWindowProc(h, msg, wParam, lParam); return DefWindowProcW(h, msg, wParam, lParam);
} }
return 0; return 0;
@ -1227,7 +1227,7 @@ public:
} }
void SetCursor(Cursor cursor) override { void SetCursor(Cursor cursor) override {
LPWSTR cursorName; LPWSTR cursorName = IDC_ARROW;
switch(cursor) { switch(cursor) {
case Cursor::POINTER: cursorName = IDC_ARROW; break; case Cursor::POINTER: cursorName = IDC_ARROW; break;
case Cursor::HAND: cursorName = IDC_HAND; break; case Cursor::HAND: cursorName = IDC_HAND; break;
@ -1389,7 +1389,7 @@ WindowRef CreateWindow(Window::Kind kind, WindowRef parentWindow) {
static HWND hSpaceWareDriverClass; static HWND hSpaceWareDriverClass;
void Open3DConnexion() { void Open3DConnexion() {
HWND hSpaceWareDriverClass = FindWindowW(L"SpaceWare Driver Class", NULL); hSpaceWareDriverClass = FindWindowW(L"SpaceWare Driver Class", NULL);
if(hSpaceWareDriverClass != NULL) { if(hSpaceWareDriverClass != NULL) {
SiInitialize(); SiInitialize();
} }

View File

@ -285,8 +285,8 @@ public:
const Camera &GetCamera() const override { return camera; } const Camera &GetCamera() const override { return camera; }
// ViewportCanvas interface. // ViewportCanvas interface.
void SetCamera(const Camera &camera) override { this->camera = camera; } void SetCamera(const Camera &cam) override { this->camera = cam; }
void SetLighting(const Lighting &lighting) override { this->lighting = lighting; } void SetLighting(const Lighting &light) override { this->lighting = light; }
void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override; void DrawLine(const Vector &a, const Vector &b, hStroke hcs) override;
void DrawEdges(const SEdgeList &el, hStroke hcs) override; void DrawEdges(const SEdgeList &el, hStroke hcs) override;

View File

@ -708,8 +708,8 @@ void OpenGl1Renderer::UpdateProjection() {
UnSelectPrimitive(); UnSelectPrimitive();
glViewport(0, 0, glViewport(0, 0,
camera.width * camera.pixelRatio, (GLsizei)(camera.width * camera.pixelRatio),
camera.height * camera.pixelRatio); (GLsizei)(camera.height * camera.pixelRatio));
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@ -821,8 +821,8 @@ void OpenGl1Renderer::FinishFrame() {
} }
std::shared_ptr<Pixmap> OpenGl1Renderer::ReadFrame() { std::shared_ptr<Pixmap> OpenGl1Renderer::ReadFrame() {
int width = camera.width * camera.pixelRatio; int width = (int)(camera.width * camera.pixelRatio);
int height = camera.height * camera.pixelRatio; int height = (int)(camera.height * camera.pixelRatio);
std::shared_ptr<Pixmap> pixmap = std::shared_ptr<Pixmap> pixmap =
Pixmap::Create(Pixmap::Format::RGB, (size_t)width, (size_t)height); Pixmap::Create(Pixmap::Format::RGB, (size_t)width, (size_t)height);
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]);

View File

@ -361,7 +361,7 @@ std::string SolveSpaceUI::MmToStringSI(double v, int dim) {
} }
v /= pow((viewUnits == Unit::INCHES) ? 25.4 : 1000, dim); v /= pow((viewUnits == Unit::INCHES) ? 25.4 : 1000, dim);
int vdeg = floor((log10(fabs(v))) / dim); int vdeg = (int)((log10(fabs(v))) / dim);
std::string unit; std::string unit;
if(fabs(v) > 0.0) { if(fabs(v) > 0.0) {
int sdeg = 0; int sdeg = 0;
@ -371,7 +371,7 @@ std::string SolveSpaceUI::MmToStringSI(double v, int dim) {
: SelectSIPrefixMm(vdeg); : SelectSIPrefixMm(vdeg);
v /= pow(10.0, sdeg * dim); v /= pow(10.0, sdeg * dim);
} }
int pdeg = ceil(log10(fabs(v) + 1e-10)); int pdeg = (int)ceil(log10(fabs(v) + 1e-10));
return ssprintf("%#.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v, return ssprintf("%#.*g%s%s%s", pdeg + UnitDigitsAfterDecimal(), v,
compact ? "" : " ", unit.c_str(), DimToString(dim)); compact ? "" : " ", unit.c_str(), DimToString(dim));
} }
@ -802,7 +802,6 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
case Command::AREA: { case Command::AREA: {
Group *g = SK.GetGroup(SS.GW.activeGroup); Group *g = SK.GetGroup(SS.GW.activeGroup);
SS.GW.GroupSelection(); SS.GW.GroupSelection();
auto const &gs = SS.GW.gs;
if(gs.faces > 0) { if(gs.faces > 0) {
std::vector<uint32_t> faces; std::vector<uint32_t> faces;
@ -844,8 +843,8 @@ void SolveSpaceUI::MenuAnalyze(Command id) {
if(gs.n > 0 && gs.n == gs.entities) { if(gs.n > 0 && gs.n == gs.entities) {
double perimeter = 0.0; double perimeter = 0.0;
for(int i = 0; i < gs.entities; i++) { for(int i = 0; i < gs.entities; i++) {
Entity *e = SK.entity.FindById(gs.entity[i]); Entity *en = SK.entity.FindById(gs.entity[i]);
SEdgeList *el = e->GetOrGenerateEdges(); SEdgeList *el = en->GetOrGenerateEdges();
for(const SEdge &e : el->l) { for(const SEdge &e : el->l) {
perimeter += e.b.Minus(e.a).Magnitude(); perimeter += e.b.Minus(e.a).Magnitude();
} }

View File

@ -646,7 +646,7 @@ void SShell::MakeFromHelicalRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector
// for testing - hard code the axial distance, and number of sections. // for testing - hard code the axial distance, and number of sections.
// distance will need to be parameters in the future. // distance will need to be parameters in the future.
double dist = distf - dists; double dist = distf - dists;
int sections = fabs(anglef - angles) / (PI / 2) + 1; int sections = (int)(fabs(anglef - angles) / (PI / 2) + 1);
double wedge = (anglef - angles) / sections; double wedge = (anglef - angles) / sections;
if(CheckNormalAxisRelationship(sbls, pt, axis, anglef-angles, distf-dists)) { if(CheckNormalAxisRelationship(sbls, pt, axis, anglef-angles, distf-dists)) {

View File

@ -604,7 +604,7 @@ void TextWindow::ScreenStepDimGo(int link, uint32_t v) {
if(time - SS.TW.stepDim.time < STEP_MILLIS) { if(time - SS.TW.stepDim.time < STEP_MILLIS) {
SS.TW.stepDim.timer->RunAfterNextFrame(); SS.TW.stepDim.timer->RunAfterNextFrame();
} else { } else {
SS.TW.stepDim.timer->RunAfter(time - SS.TW.stepDim.time - STEP_MILLIS); SS.TW.stepDim.timer->RunAfter((unsigned)(time - SS.TW.stepDim.time - STEP_MILLIS));
} }
SS.TW.stepDim.time = time; SS.TW.stepDim.time = time;
} else { } else {
@ -758,7 +758,8 @@ void TextWindow::EditControlDone(std::string s) {
Group *g = SK.group.FindByIdNoOops(SS.TW.shown.group); Group *g = SK.group.FindByIdNoOops(SS.TW.shown.group);
if(!g) break; if(!g) break;
g->color = RgbaColor::FromFloat(rgb.x, rgb.y, rgb.z, g->color.alphaF()); g->color = RgbaColor::FromFloat((float)rgb.x, (float)rgb.y, (float)rgb.z,
g->color.alphaF());
SS.MarkGroupDirty(g->h); SS.MarkGroupDirty(g->h);
SS.GW.ClearSuper(); SS.GW.ClearSuper();

View File

@ -219,7 +219,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas,
{ {
if(hitCommand) *hitCommand = icon.command; if(hitCommand) *hitCommand = icon.command;
if(hitX) *hitX = x - boxhw; if(hitX) *hitX = x - boxhw;
if(hitY) *hitY = height - (y + boxhw); if(hitY) *hitY = (int)height - (y + boxhw);
} }
} }