Remove Windows-isms and add a CMake buildsystem.
This commit is contained in:
parent
2ecc612801
commit
479c406d2b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build*
|
67
CMakeLists.txt
Normal file
67
CMakeLists.txt
Normal file
|
@ -0,0 +1,67 @@
|
|||
# cmake configuration
|
||||
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
cmake_policy(VERSION 3.1.0)
|
||||
|
||||
# project
|
||||
|
||||
project(solvespace)
|
||||
|
||||
# common compiler flags
|
||||
|
||||
if(MINGW)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
# solvespace-only compiler flags
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_SCL_SECURE_NO_WARNINGS
|
||||
-D_WIN32_WINNT=0x500
|
||||
-D_WIN32_IE=_WIN32_WINNT
|
||||
-DISOLATION_AWARE_ENABLED
|
||||
-DWIN32
|
||||
-DWIN32_LEAN_AND_MEAN
|
||||
-DUNICODE
|
||||
-D_UNICODE
|
||||
-DNOMINMAX
|
||||
-D_USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Many versions of MSVC do not have the (C99) inline keyword, instead
|
||||
# they have their own __inline; this breaks `static inline` functions.
|
||||
# We do not want to care and so we fix this with a definition.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
|
||||
# Same for the (C99) __func__ special variable; we use it only in C++ code.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__func__=__FUNCTION__")
|
||||
|
||||
# We rely on these /we flags. They correspond to the GNU-style flags below as
|
||||
# follows: /w4062=-Wswitch
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} /we4062")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wfloat-conversion")
|
||||
endif()
|
||||
# We rely on these -Werror flags.
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Werror=switch")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
|
||||
|
||||
# components
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(exposed)
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
// Copyright 2008-2013 Jonathan Westhues.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "slvs.h"
|
||||
|
|
8
exposed/CMakeLists.txt
Normal file
8
exposed/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
add_executable(CDemo
|
||||
CDemo.c)
|
||||
|
||||
target_link_libraries(CDemo
|
||||
slvs)
|
|
@ -10,20 +10,26 @@
|
|||
#ifndef __SLVS_H
|
||||
#define __SLVS_H
|
||||
|
||||
#ifdef EXPORT_DLL
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#ifdef slvs_EXPORTS
|
||||
#define DLL __declspec( dllexport )
|
||||
#else
|
||||
#define DLL __declspec( dllimport )
|
||||
#endif
|
||||
#else
|
||||
#define DLL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef DWORD Slvs_hParam;
|
||||
typedef DWORD Slvs_hEntity;
|
||||
typedef DWORD Slvs_hConstraint;
|
||||
typedef DWORD Slvs_hGroup;
|
||||
typedef uint32_t Slvs_hParam;
|
||||
typedef uint32_t Slvs_hEntity;
|
||||
typedef uint32_t Slvs_hConstraint;
|
||||
typedef uint32_t Slvs_hGroup;
|
||||
|
||||
// To obtain the 3d (not projected into a workplane) of a constraint or
|
||||
// an entity, specify this instead of the workplane.
|
37
src/CMakeLists.txt
Normal file
37
src/CMakeLists.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
# platform utilities
|
||||
|
||||
if(WIN32)
|
||||
set(util_SOURCES
|
||||
platform/w32util.cpp)
|
||||
else()
|
||||
set(util_SOURCES
|
||||
platform/unixutil.cpp)
|
||||
endif()
|
||||
|
||||
# libslvs
|
||||
|
||||
set(libslvs_SOURCES
|
||||
util.cpp
|
||||
entity.cpp
|
||||
expr.cpp
|
||||
constraint.cpp
|
||||
constrainteq.cpp
|
||||
system.cpp)
|
||||
|
||||
set(libslvs_HEADERS
|
||||
solvespace.h)
|
||||
|
||||
add_library(slvs SHARED
|
||||
${libslvs_SOURCES}
|
||||
${libslvs_HEADERS}
|
||||
${util_SOURCES}
|
||||
lib.cpp)
|
||||
|
||||
target_compile_definitions(slvs
|
||||
PRIVATE -DLIBRARY)
|
||||
|
||||
target_include_directories(slvs
|
||||
PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties(slvs PROPERTIES
|
||||
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/slvs.h)
|
|
@ -9,7 +9,7 @@
|
|||
char *Constraint::DescriptionString(void) {
|
||||
static char ret[1024];
|
||||
|
||||
char *s;
|
||||
const char *s;
|
||||
switch(type) {
|
||||
case POINTS_COINCIDENT: s = "pts-coincident"; break;
|
||||
case PT_PT_DISTANCE: s = "pt-pt-distance"; break;
|
||||
|
@ -52,6 +52,8 @@ char *Constraint::DescriptionString(void) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifndef LIBRARY
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Delete all constraints with the specified type, entityA, ptA. We use this
|
||||
// when auto-removing constraints that would become redundant.
|
||||
|
@ -707,3 +709,5 @@ void Constraint::MenuConstrain(int id) {
|
|||
InvalidateGraphics();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
#ifndef __DSC_H
|
||||
#define __DSC_H
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
class Vector;
|
||||
class Vector4;
|
||||
class Point2d;
|
||||
|
@ -232,8 +229,8 @@ public:
|
|||
int n;
|
||||
int elemsAllocated;
|
||||
|
||||
DWORD MaximumId(void) {
|
||||
DWORD id = 0;
|
||||
uint32_t MaximumId(void) {
|
||||
uint32_t id = 0;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < n; i++) {
|
||||
|
|
12
src/expr.cpp
12
src/expr.cpp
|
@ -372,10 +372,10 @@ Expr *Expr::PartialWrt(hParam p) {
|
|||
}
|
||||
}
|
||||
|
||||
QWORD Expr::ParamsUsed(void) {
|
||||
QWORD r = 0;
|
||||
if(op == PARAM) r |= ((QWORD)1 << (x.parh.v % 61));
|
||||
if(op == PARAM_PTR) r |= ((QWORD)1 << (x.parp->h.v % 61));
|
||||
uint64_t Expr::ParamsUsed(void) {
|
||||
uint64_t r = 0;
|
||||
if(op == PARAM) r |= ((uint64_t)1 << (x.parh.v % 61));
|
||||
if(op == PARAM_PTR) r |= ((uint64_t)1 << (x.parp->h.v % 61));
|
||||
|
||||
int c = Children();
|
||||
if(c >= 1) r |= a->ParamsUsed();
|
||||
|
@ -519,12 +519,12 @@ hParam Expr::ReferencedParams(ParamList *pl) {
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
static char StringBuffer[4096];
|
||||
void Expr::App(char *s, ...) {
|
||||
void Expr::App(const char *s, ...) {
|
||||
va_list f;
|
||||
va_start(f, s);
|
||||
vsprintf(StringBuffer+strlen(StringBuffer), s, f);
|
||||
}
|
||||
char *Expr::Print(void) {
|
||||
const char *Expr::Print(void) {
|
||||
if(!this) return "0";
|
||||
|
||||
StringBuffer[0] = '\0';
|
||||
|
|
|
@ -12,7 +12,7 @@ class Expr;
|
|||
|
||||
class Expr {
|
||||
public:
|
||||
DWORD marker;
|
||||
uint32_t marker;
|
||||
|
||||
// A parameter, by the hParam handle
|
||||
static const int PARAM = 0;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
Expr *PartialWrt(hParam p);
|
||||
double Eval(void);
|
||||
QWORD ParamsUsed(void);
|
||||
uint64_t ParamsUsed(void);
|
||||
bool DependsOn(hParam p);
|
||||
static bool Tol(double a, double b);
|
||||
Expr *FoldConstants(void);
|
||||
|
@ -94,8 +94,8 @@ public:
|
|||
|
||||
void ParamsToPointers(void);
|
||||
|
||||
void App(char *str, ...);
|
||||
char *Print(void);
|
||||
void App(const char *str, ...);
|
||||
const char *Print(void);
|
||||
void PrintW(void); // worker
|
||||
|
||||
// number of child nodes: 0 (e.g. constant), 1 (sqrt), or 2 (+)
|
||||
|
|
|
@ -17,7 +17,7 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *l) {
|
|||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
void DoMessageBox(char *str, int rows, int cols, BOOL error)
|
||||
void DoMessageBox(char *str, int rows, int cols, bool error)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
81
src/platform/unixutil.cpp
Normal file
81
src/platform/unixutil.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Utility functions that run on Unix. Notably, our memory allocation;
|
||||
// we use two separate allocators, one for long-lived stuff and one for
|
||||
// stuff that gets freed after every regeneration of the model, to save us
|
||||
// the trouble of freeing the latter explicitly.
|
||||
//
|
||||
// Copyright 2016 whitequark@whitequark.org.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../solvespace.h"
|
||||
|
||||
void dbp(const char *str, ...)
|
||||
{
|
||||
va_list f;
|
||||
static char buf[1024*50];
|
||||
va_start(f, str);
|
||||
vsnprintf(buf, sizeof(buf), str, f);
|
||||
va_end(f);
|
||||
|
||||
fputs(buf, stderr);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
void GetAbsoluteFilename(char *file)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A separate heap, on which we allocate expressions. Maybe a bit faster,
|
||||
// since no fragmentation issues whatsoever, and it also makes it possible
|
||||
// to be sloppy with our memory management, and just free everything at once
|
||||
// at the end.
|
||||
//-----------------------------------------------------------------------------
|
||||
struct HeapList {
|
||||
HeapList *next;
|
||||
};
|
||||
|
||||
static HeapList *TempHeap;
|
||||
|
||||
void *AllocTemporary(int n)
|
||||
{
|
||||
HeapList *l = (HeapList*)malloc(n + sizeof(HeapList));
|
||||
if(!l) oops();
|
||||
l->next = TempHeap;
|
||||
TempHeap = l;
|
||||
return (void*)((intptr_t)l + sizeof(HeapList));
|
||||
}
|
||||
void FreeTemporary(void *p) {
|
||||
}
|
||||
void FreeAllTemporary(void)
|
||||
{
|
||||
while(TempHeap) {
|
||||
HeapList *next = TempHeap->next;
|
||||
free(TempHeap);
|
||||
TempHeap = next;
|
||||
}
|
||||
}
|
||||
|
||||
void *MemRealloc(void *p, int n) {
|
||||
if(!p) {
|
||||
return MemAlloc(n);
|
||||
}
|
||||
|
||||
p = realloc(p, n);
|
||||
if(!p) oops();
|
||||
return p;
|
||||
}
|
||||
void *MemAlloc(int n) {
|
||||
void *p = malloc(n);
|
||||
if(!p) oops();
|
||||
return p;
|
||||
}
|
||||
void MemFree(void *p) {
|
||||
free(p);
|
||||
}
|
||||
|
||||
void vl(void) {
|
||||
}
|
||||
|
||||
void InitHeaps(void) {
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "solvespace.h"
|
||||
#include "../solvespace.h"
|
||||
|
||||
static HANDLE PermHeap, TempHeap;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
DWORD face;
|
||||
uint32_t face;
|
||||
int color;
|
||||
} STriMeta;
|
||||
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
bool IsEmpty(void);
|
||||
void RemapFaces(Group *g, int remap);
|
||||
|
||||
DWORD FirstIntersectionWith(Point2d mp);
|
||||
uint32_t FirstIntersectionWith(Point2d mp);
|
||||
};
|
||||
|
||||
// A linked list of triangles
|
||||
|
@ -282,7 +282,7 @@ public:
|
|||
|
||||
void FindEdgeOn(Vector a, Vector b, int *n, int cnt, bool coplanarIsInter,
|
||||
bool *inter, bool *fwd,
|
||||
DWORD *face);
|
||||
uint32_t *face);
|
||||
static const int NAKED_OR_SELF_INTER_EDGES = 100;
|
||||
static const int SELF_INTER_EDGES = 200;
|
||||
static const int TURNING_EDGES = 300;
|
||||
|
|
38
src/sketch.h
38
src/sketch.h
|
@ -26,7 +26,7 @@ class Equation;
|
|||
class hGroup {
|
||||
public:
|
||||
// bits 15: 0 -- group index
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline hEntity entity(int i);
|
||||
inline hParam param(int i);
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
class hRequest {
|
||||
public:
|
||||
// bits 15: 0 -- request index
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline hEntity entity(int i);
|
||||
inline hParam param(int i);
|
||||
|
@ -46,7 +46,7 @@ class hEntity {
|
|||
public:
|
||||
// bits 15: 0 -- entity index
|
||||
// 31:16 -- request index
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline bool isFromRequest(void);
|
||||
inline hRequest request(void);
|
||||
|
@ -57,20 +57,20 @@ class hParam {
|
|||
public:
|
||||
// bits 15: 0 -- param index
|
||||
// 31:16 -- request index
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline hRequest request(void);
|
||||
};
|
||||
|
||||
class hStyle {
|
||||
public:
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
};
|
||||
|
||||
|
||||
class EntityId {
|
||||
public:
|
||||
DWORD v; // entity ID, starting from 0
|
||||
uint32_t v; // entity ID, starting from 0
|
||||
};
|
||||
class EntityMap {
|
||||
public:
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
double valA;
|
||||
double valB;
|
||||
double valC;
|
||||
DWORD color;
|
||||
uint32_t color;
|
||||
|
||||
struct {
|
||||
int how;
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
void GenerateDisplayItems(void);
|
||||
void DrawDisplayItems(int t);
|
||||
void Draw(void);
|
||||
DWORD GetLoopSetFillColor(SBezierLoopSet *sbls,
|
||||
uint32_t GetLoopSetFillColor(SBezierLoopSet *sbls,
|
||||
bool *allSame, Vector *errorAt);
|
||||
void FillLoopSetAsPolygon(SBezierLoopSet *sbls);
|
||||
void DrawFilledPaths(void);
|
||||
|
@ -505,7 +505,7 @@ public:
|
|||
|
||||
class hConstraint {
|
||||
public:
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline hEquation equation(int i);
|
||||
};
|
||||
|
@ -640,7 +640,7 @@ public:
|
|||
|
||||
class hEquation {
|
||||
public:
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
|
||||
inline bool isFromConstraint(void);
|
||||
inline hConstraint constraint(void);
|
||||
|
@ -695,9 +695,9 @@ public:
|
|||
static const int ORIGIN_TOP = 0x08;
|
||||
int textOrigin;
|
||||
double textAngle;
|
||||
DWORD color;
|
||||
uint32_t color;
|
||||
bool filled;
|
||||
DWORD fillColor;
|
||||
uint32_t fillColor;
|
||||
bool visible;
|
||||
bool exportable;
|
||||
|
||||
|
@ -706,7 +706,7 @@ public:
|
|||
typedef struct {
|
||||
hStyle h;
|
||||
char *cnfPrefix;
|
||||
DWORD color;
|
||||
uint32_t color;
|
||||
double width;
|
||||
} Default;
|
||||
static const Default Defaults[];
|
||||
|
@ -720,16 +720,16 @@ public:
|
|||
static void FreezeDefaultStyles(void);
|
||||
static void LoadFactoryDefaults(void);
|
||||
|
||||
static void AssignSelectionToStyle(DWORD v);
|
||||
static DWORD CreateCustomStyle(void);
|
||||
static void AssignSelectionToStyle(uint32_t v);
|
||||
static uint32_t CreateCustomStyle(void);
|
||||
|
||||
static DWORD RewriteColor(DWORD rgb);
|
||||
static uint32_t RewriteColor(uint32_t rgb);
|
||||
|
||||
static Style *Get(hStyle hs);
|
||||
static DWORD Color(hStyle hs, bool forExport=false);
|
||||
static DWORD FillColor(hStyle hs, bool forExport=false);
|
||||
static uint32_t Color(hStyle hs, bool forExport=false);
|
||||
static uint32_t FillColor(hStyle hs, bool forExport=false);
|
||||
static float Width(hStyle hs);
|
||||
static DWORD Color(int hs, bool forExport=false);
|
||||
static uint32_t Color(int hs, bool forExport=false);
|
||||
static float Width(int hs);
|
||||
static double WidthMm(int hs);
|
||||
static double TextHeight(hStyle hs);
|
||||
|
|
154
src/solvespace.h
154
src/solvespace.h
|
@ -51,19 +51,13 @@ inline double ffabs(double v) { return (v > 0) ? v : (-v); }
|
|||
|
||||
#define isforname(c) (isalnum(c) || (c) == '_' || (c) == '-' || (c) == '#')
|
||||
|
||||
typedef unsigned __int64 QWORD;
|
||||
typedef signed __int64 SQWORD;
|
||||
typedef signed long SDWORD;
|
||||
typedef signed short SWORD;
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <windows.h> // required for GL stuff
|
||||
#include <gl/gl.h>
|
||||
#include <gl/glu.h>
|
||||
|
||||
inline double Random(double vmax) {
|
||||
return (vmax*rand()) / RAND_MAX;
|
||||
|
@ -76,6 +70,15 @@ class ExprQuaternion;
|
|||
|
||||
//================
|
||||
// From the platform-specific code.
|
||||
#if !defined(WIN32)
|
||||
#include <limits.h>
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
||||
#include <algorithm>
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
#define MAX_RECENT 8
|
||||
#define RECENT_OPEN (0xf000)
|
||||
#define RECENT_IMPORT (0xf100)
|
||||
|
@ -116,22 +119,22 @@ int SaveFileYesNoCancel(void);
|
|||
// Comma-separated value, like a spreadsheet would use
|
||||
#define CSV_PATTERN "CSV File (*.csv)\0*.csv\0All Files (*)\0*\0\0"
|
||||
#define CSV_EXT "csv"
|
||||
BOOL GetSaveFile(char *file, char *defExtension, char *selPattern);
|
||||
BOOL GetOpenFile(char *file, char *defExtension, char *selPattern);
|
||||
bool GetSaveFile(char *file, char *defExtension, char *selPattern);
|
||||
bool GetOpenFile(char *file, char *defExtension, char *selPattern);
|
||||
void GetAbsoluteFilename(char *file);
|
||||
void LoadAllFontFiles(void);
|
||||
|
||||
void OpenWebsite(char *url);
|
||||
|
||||
void CheckMenuById(int id, BOOL checked);
|
||||
void EnableMenuById(int id, BOOL checked);
|
||||
void CheckMenuById(int id, bool checked);
|
||||
void EnableMenuById(int id, bool checked);
|
||||
|
||||
void ShowGraphicsEditControl(int x, int y, char *s);
|
||||
void HideGraphicsEditControl(void);
|
||||
BOOL GraphicsEditControlIsVisible(void);
|
||||
bool GraphicsEditControlIsVisible(void);
|
||||
void ShowTextEditControl(int x, int y, char *s);
|
||||
void HideTextEditControl(void);
|
||||
BOOL TextEditControlIsVisible(void);
|
||||
bool TextEditControlIsVisible(void);
|
||||
void MoveTextScrollbarTo(int pos, int maxPos, int page);
|
||||
|
||||
#define CONTEXT_SUBMENU (-1)
|
||||
|
@ -140,31 +143,31 @@ void AddContextMenuItem(char *legend, int id);
|
|||
void CreateContextSubmenu(void);
|
||||
int ShowContextMenu(void);
|
||||
|
||||
void ShowTextWindow(BOOL visible);
|
||||
void ShowTextWindow(bool visible);
|
||||
void InvalidateText(void);
|
||||
void InvalidateGraphics(void);
|
||||
void PaintGraphics(void);
|
||||
void GetGraphicsWindowSize(int *w, int *h);
|
||||
void GetTextWindowSize(int *w, int *h);
|
||||
SDWORD GetMilliseconds(void);
|
||||
SQWORD GetUnixTime(void);
|
||||
int32_t GetMilliseconds(void);
|
||||
int64_t GetUnixTime(void);
|
||||
|
||||
void dbp(char *str, ...);
|
||||
void dbp(const char *str, ...);
|
||||
#define DBPTRI(tri) \
|
||||
dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \
|
||||
CO((tri).a), CO((tri).b), CO((tri).c))
|
||||
|
||||
void SetWindowTitle(char *str);
|
||||
void SetMousePointerToHand(bool yes);
|
||||
void DoMessageBox(char *str, int rows, int cols, BOOL error);
|
||||
void DoMessageBox(char *str, int rows, int cols, bool error);
|
||||
void SetTimerFor(int milliseconds);
|
||||
void ExitNow(void);
|
||||
|
||||
void CnfFreezeString(char *str, char *name);
|
||||
void CnfFreezeDWORD(DWORD v, char *name);
|
||||
void CnfFreezeuint32_t(uint32_t v, char *name);
|
||||
void CnfFreezeFloat(float v, char *name);
|
||||
void CnfThawString(char *str, int maxLen, char *name);
|
||||
DWORD CnfThawDWORD(DWORD v, char *name);
|
||||
uint32_t CnfThawuint32_t(uint32_t v, char *name);
|
||||
float CnfThawFloat(float v, char *name);
|
||||
|
||||
void *AllocTemporary(int n);
|
||||
|
@ -202,11 +205,16 @@ void glxVertex3v(Vector u);
|
|||
void glxAxisAlignedQuad(double l, double r, double t, double b);
|
||||
void glxAxisAlignedLineLoop(double l, double r, double t, double b);
|
||||
#define DEFAULT_TEXT_HEIGHT (11.5)
|
||||
#if defined(WIN32)
|
||||
#define GLX_CALLBACK __stdcall
|
||||
#else
|
||||
#define GLX_CALLBACK
|
||||
#endif
|
||||
typedef void GLX_CALLBACK glxCallbackFptr(void);
|
||||
struct GLUtesselator;
|
||||
void glxTesselatePolygon(GLUtesselator *gt, SPolygon *p);
|
||||
void glxFillPolygon(SPolygon *p);
|
||||
void glxFillMesh(int color, SMesh *m, DWORD h, DWORD s1, DWORD s2);
|
||||
void glxFillMesh(int color, SMesh *m, uint32_t h, uint32_t s1, uint32_t s2);
|
||||
void glxDebugPolygon(SPolygon *p);
|
||||
void glxDrawEdges(SEdgeList *l, bool endpointsToo);
|
||||
void glxDebugMesh(SMesh *m);
|
||||
|
@ -218,14 +226,14 @@ void glxWriteTextRefCenter(char *str, double h, Vector t, Vector u, Vector v,
|
|||
glxLineFn *fn, void *fndata);
|
||||
double glxStrWidth(char *str, double h);
|
||||
double glxStrHeight(double h);
|
||||
void glxLockColorTo(DWORD rgb);
|
||||
void glxLockColorTo(uint32_t rgb);
|
||||
void glxFatLine(Vector a, Vector b, double width);
|
||||
void glxUnlockColor(void);
|
||||
void glxColorRGB(DWORD rgb);
|
||||
void glxColorRGBa(DWORD rgb, double a);
|
||||
void glxColorRGB(uint32_t rgb);
|
||||
void glxColorRGBa(uint32_t rgb, double a);
|
||||
void glxDepthRangeOffset(int units);
|
||||
void glxDepthRangeLockToFront(bool yes);
|
||||
void glxDrawPixelsWithTexture(BYTE *data, int w, int h);
|
||||
void glxDrawPixelsWithTexture(uint8_t *data, int w, int h);
|
||||
void glxCreateBitmapFont(void);
|
||||
void glxBitmapText(char *str, Vector p);
|
||||
void glxBitmapCharQuad(char c, double x, double y);
|
||||
|
@ -242,12 +250,12 @@ void MakeMatrix(double *mat, double a11, double a12, double a13, double a14,
|
|||
double a21, double a22, double a23, double a24,
|
||||
double a31, double a32, double a33, double a34,
|
||||
double a41, double a42, double a43, double a44);
|
||||
void MakePathRelative(char *base, char *path);
|
||||
void MakePathAbsolute(char *base, char *path);
|
||||
bool StringAllPrintable(char *str);
|
||||
bool StringEndsIn(char *str, char *ending);
|
||||
void Message(char *str, ...);
|
||||
void Error(char *str, ...);
|
||||
void MakePathRelative(const char *base, char *path);
|
||||
void MakePathAbsolute(const char *base, char *path);
|
||||
bool StringAllPrintable(const char *str);
|
||||
bool StringEndsIn(const char *str, const char *ending);
|
||||
void Message(const char *str, ...);
|
||||
void Error(const char *str, ...);
|
||||
|
||||
class System {
|
||||
public:
|
||||
|
@ -327,8 +335,8 @@ public:
|
|||
typedef struct {
|
||||
bool onCurve;
|
||||
bool lastInContour;
|
||||
SWORD x;
|
||||
SWORD y;
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} FontPoint;
|
||||
|
||||
typedef struct {
|
||||
|
@ -373,9 +381,9 @@ public:
|
|||
Vector origin, u, v;
|
||||
|
||||
int Getc(void);
|
||||
int GetBYTE(void);
|
||||
int GetWORD(void);
|
||||
int GetDWORD(void);
|
||||
int Getuint8_t(void);
|
||||
int Getuint16_t(void);
|
||||
int Getuint32_t(void);
|
||||
|
||||
void LoadGlyph(int index);
|
||||
bool LoadFontFromFile(bool nameOnly);
|
||||
|
@ -433,10 +441,10 @@ public:
|
|||
void BezierAsPwl(SBezier *sb);
|
||||
void BezierAsNonrationalCubic(SBezier *sb, int depth=0);
|
||||
|
||||
virtual void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb) = 0;
|
||||
virtual void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb) = 0;
|
||||
virtual void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb) = 0;
|
||||
virtual void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb) = 0;
|
||||
virtual void Bezier(SBezier *sb) = 0;
|
||||
virtual void Triangle(STriangle *tr) = 0;
|
||||
virtual void StartFile(void) = 0;
|
||||
|
@ -445,10 +453,10 @@ public:
|
|||
};
|
||||
class DxfFileWriter : public VectorFileWriter {
|
||||
public:
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -460,10 +468,10 @@ public:
|
|||
Vector prevPt;
|
||||
void MaybeMoveTo(Vector s, Vector f);
|
||||
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -472,15 +480,15 @@ public:
|
|||
};
|
||||
class PdfFileWriter : public VectorFileWriter {
|
||||
public:
|
||||
DWORD xref[10];
|
||||
DWORD bodyStart;
|
||||
uint32_t xref[10];
|
||||
uint32_t bodyStart;
|
||||
Vector prevPt;
|
||||
void MaybeMoveTo(Vector s, Vector f);
|
||||
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -492,10 +500,10 @@ public:
|
|||
Vector prevPt;
|
||||
void MaybeMoveTo(Vector s, Vector f);
|
||||
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -505,10 +513,10 @@ public:
|
|||
class HpglFileWriter : public VectorFileWriter {
|
||||
public:
|
||||
static double MmToHpglUnits(double mm);
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -517,10 +525,10 @@ public:
|
|||
};
|
||||
class Step2dFileWriter : public VectorFileWriter {
|
||||
StepFileWriter sfw;
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -530,10 +538,10 @@ class Step2dFileWriter : public VectorFileWriter {
|
|||
class GCodeFileWriter : public VectorFileWriter {
|
||||
public:
|
||||
SEdgeList sel;
|
||||
void StartPath( DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void FinishPath(DWORD strokeRgb, double lineWidth,
|
||||
bool filled, DWORD fillRgb);
|
||||
void StartPath( uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void FinishPath(uint32_t strokeRgb, double lineWidth,
|
||||
bool filled, uint32_t fillRgb);
|
||||
void Triangle(STriangle *tr);
|
||||
void Bezier(SBezier *sb);
|
||||
void StartFile(void);
|
||||
|
@ -618,7 +626,7 @@ public:
|
|||
int drawBackFaces;
|
||||
int checkClosedContour;
|
||||
int showToolbar;
|
||||
DWORD backgroundColor;
|
||||
uint32_t backgroundColor;
|
||||
int exportShadedTriangles;
|
||||
int exportPwlCurves;
|
||||
int exportCanvasSizeAuto;
|
||||
|
@ -736,7 +744,7 @@ public:
|
|||
Vector ptB;
|
||||
} extraLine;
|
||||
struct {
|
||||
BYTE *fromFile;
|
||||
uint8_t *fromFile;
|
||||
int w, h;
|
||||
int rw, rh;
|
||||
double scale; // pixels per mm
|
||||
|
|
|
@ -56,12 +56,12 @@ class SShell;
|
|||
|
||||
class hSSurface {
|
||||
public:
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
};
|
||||
|
||||
class hSCurve {
|
||||
public:
|
||||
DWORD v;
|
||||
uint32_t v;
|
||||
};
|
||||
|
||||
// Stuff for rational polynomial curves, of degree one to three. These are
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
Vector start;
|
||||
Vector finish;
|
||||
|
||||
static STrimBy STrimBy::EntireCurve(SShell *shell, hSCurve hsc, bool bkwds);
|
||||
static STrimBy EntireCurve(SShell *shell, hSCurve hsc, bool bkwds);
|
||||
};
|
||||
|
||||
// An intersection point between a line and a surface
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
hSSurface newH;
|
||||
|
||||
int color;
|
||||
DWORD face;
|
||||
uint32_t face;
|
||||
|
||||
int degm, degn;
|
||||
Vector ctrl[4][4];
|
||||
|
@ -275,7 +275,7 @@ public:
|
|||
void EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
|
||||
Vector *pt, Vector *enin, Vector *enout,
|
||||
Vector *surfn,
|
||||
DWORD auxA,
|
||||
uint32_t auxA,
|
||||
SShell *shell, SShell *sha, SShell *shb);
|
||||
void FindChainAvoiding(SEdgeList *src, SEdgeList *dest, SPointList *avoid);
|
||||
SSurface MakeCopyTrimAgainst(SShell *parent, SShell *a, SShell *b,
|
||||
|
|
|
@ -45,10 +45,10 @@ bool System::WriteJacobian(int tag) {
|
|||
f = f->FoldConstants();
|
||||
|
||||
// Hash table (61 bits) to accelerate generation of zero partials.
|
||||
QWORD scoreboard = f->ParamsUsed();
|
||||
uint64_t scoreboard = f->ParamsUsed();
|
||||
for(j = 0; j < mat.n; j++) {
|
||||
Expr *pd;
|
||||
if(scoreboard & ((QWORD)1 << (mat.param[j].v % 61)) &&
|
||||
if(scoreboard & ((uint64_t)1 << (mat.param[j].v % 61)) &&
|
||||
f->DependsOn(mat.param[j]))
|
||||
{
|
||||
pd = f->PartialWrt(mat.param[j]);
|
||||
|
@ -449,7 +449,7 @@ int System::Solve(Group *g, int *dof, List<hConstraint> *bad,
|
|||
|
||||
EvalJacobian();
|
||||
|
||||
int rank = CalculateRank();
|
||||
int rank; rank = CalculateRank();
|
||||
if(rank != mat.m) {
|
||||
if(andFindBad) {
|
||||
FindWhichToRemoveToFixJacobian(g, bad);
|
||||
|
|
146
src/ui.h
146
src/ui.h
|
@ -47,14 +47,14 @@ public:
|
|||
int scrollPos; // The scrollbar position, in half-row units
|
||||
int halfRows; // The height of our window, in half-row units
|
||||
|
||||
BYTE text[MAX_ROWS][MAX_COLS];
|
||||
typedef void LinkFunction(int link, DWORD v);
|
||||
uint8_t text[MAX_ROWS][MAX_COLS];
|
||||
typedef void LinkFunction(int link, uint32_t v);
|
||||
static const int NOT_A_LINK = 0;
|
||||
struct {
|
||||
char fg;
|
||||
int bg;
|
||||
int link;
|
||||
DWORD data;
|
||||
uint32_t data;
|
||||
LinkFunction *f;
|
||||
LinkFunction *h;
|
||||
} meta[MAX_ROWS][MAX_COLS];
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
// The row of icons at the top of the text window, to hide/show things
|
||||
typedef struct {
|
||||
bool *var;
|
||||
BYTE *icon;
|
||||
uint8_t *icon;
|
||||
char *tip;
|
||||
} HideShowIcon;
|
||||
static HideShowIcon hideShowIcons[];
|
||||
|
@ -89,8 +89,8 @@ public:
|
|||
HideShowIcon *hoveredIcon, *tooltippedIcon;
|
||||
|
||||
Vector HsvToRgb(Vector hsv);
|
||||
BYTE *HsvPattern2d(void);
|
||||
BYTE *HsvPattern1d(double h, double s);
|
||||
uint8_t *HsvPattern2d(void);
|
||||
uint8_t *HsvPattern1d(double h, double s);
|
||||
void ColorPickerDone(void);
|
||||
bool DrawOrHitTestColorPicker(int how, bool leftDown, double x, double y);
|
||||
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
int col;
|
||||
|
||||
struct {
|
||||
DWORD rgb;
|
||||
uint32_t rgb;
|
||||
double h, s, v;
|
||||
bool show;
|
||||
bool picker1dActive;
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
|
||||
void HideEditControl(void);
|
||||
void ShowEditControl(int halfRow, int col, char *s);
|
||||
void ShowEditControlWithColorPicker(int halfRow, int col, DWORD rgb);
|
||||
void ShowEditControlWithColorPicker(int halfRow, int col, uint32_t rgb);
|
||||
|
||||
void ClearSuper(void);
|
||||
|
||||
|
@ -230,82 +230,82 @@ public:
|
|||
|
||||
// All of these are callbacks from the GUI code; first from when
|
||||
// we're describing an entity
|
||||
static void ScreenEditTtfText(int link, DWORD v);
|
||||
static void ScreenSetTtfFont(int link, DWORD v);
|
||||
static void ScreenUnselectAll(int link, DWORD v);
|
||||
static void ScreenEditTtfText(int link, uint32_t v);
|
||||
static void ScreenSetTtfFont(int link, uint32_t v);
|
||||
static void ScreenUnselectAll(int link, uint32_t v);
|
||||
|
||||
// and the rest from the stuff in textscreens.cpp
|
||||
static void ScreenSelectGroup(int link, DWORD v);
|
||||
static void ScreenActivateGroup(int link, DWORD v);
|
||||
static void ScreenToggleGroupShown(int link, DWORD v);
|
||||
static void ScreenHowGroupSolved(int link, DWORD v);
|
||||
static void ScreenShowGroupsSpecial(int link, DWORD v);
|
||||
static void ScreenDeleteGroup(int link, DWORD v);
|
||||
static void ScreenSelectGroup(int link, uint32_t v);
|
||||
static void ScreenActivateGroup(int link, uint32_t v);
|
||||
static void ScreenToggleGroupShown(int link, uint32_t v);
|
||||
static void ScreenHowGroupSolved(int link, uint32_t v);
|
||||
static void ScreenShowGroupsSpecial(int link, uint32_t v);
|
||||
static void ScreenDeleteGroup(int link, uint32_t v);
|
||||
|
||||
static void ScreenHoverConstraint(int link, DWORD v);
|
||||
static void ScreenHoverRequest(int link, DWORD v);
|
||||
static void ScreenSelectRequest(int link, DWORD v);
|
||||
static void ScreenSelectConstraint(int link, DWORD v);
|
||||
static void ScreenHoverConstraint(int link, uint32_t v);
|
||||
static void ScreenHoverRequest(int link, uint32_t v);
|
||||
static void ScreenSelectRequest(int link, uint32_t v);
|
||||
static void ScreenSelectConstraint(int link, uint32_t v);
|
||||
|
||||
static void ScreenChangeGroupOption(int link, DWORD v);
|
||||
static void ScreenColor(int link, DWORD v);
|
||||
static void ScreenChangeGroupOption(int link, uint32_t v);
|
||||
static void ScreenColor(int link, uint32_t v);
|
||||
|
||||
static void ScreenShowListOfStyles(int link, DWORD v);
|
||||
static void ScreenShowStyleInfo(int link, DWORD v);
|
||||
static void ScreenDeleteStyle(int link, DWORD v);
|
||||
static void ScreenChangeStyleYesNo(int link, DWORD v);
|
||||
static void ScreenCreateCustomStyle(int link, DWORD v);
|
||||
static void ScreenLoadFactoryDefaultStyles(int link, DWORD v);
|
||||
static void ScreenAssignSelectionToStyle(int link, DWORD v);
|
||||
static void ScreenBackgroundImage(int link, DWORD v);
|
||||
static void ScreenShowListOfStyles(int link, uint32_t v);
|
||||
static void ScreenShowStyleInfo(int link, uint32_t v);
|
||||
static void ScreenDeleteStyle(int link, uint32_t v);
|
||||
static void ScreenChangeStyleYesNo(int link, uint32_t v);
|
||||
static void ScreenCreateCustomStyle(int link, uint32_t v);
|
||||
static void ScreenLoadFactoryDefaultStyles(int link, uint32_t v);
|
||||
static void ScreenAssignSelectionToStyle(int link, uint32_t v);
|
||||
static void ScreenBackgroundImage(int link, uint32_t v);
|
||||
|
||||
static void ScreenShowConfiguration(int link, DWORD v);
|
||||
static void ScreenShowEditView(int link, DWORD v);
|
||||
static void ScreenGoToWebsite(int link, DWORD v);
|
||||
static void ScreenShowConfiguration(int link, uint32_t v);
|
||||
static void ScreenShowEditView(int link, uint32_t v);
|
||||
static void ScreenGoToWebsite(int link, uint32_t v);
|
||||
|
||||
static void ScreenChangeFixExportColors(int link, DWORD v);
|
||||
static void ScreenChangeBackFaces(int link, DWORD v);
|
||||
static void ScreenChangeCheckClosedContour(int link, DWORD v);
|
||||
static void ScreenChangePwlCurves(int link, DWORD v);
|
||||
static void ScreenChangeCanvasSizeAuto(int link, DWORD v);
|
||||
static void ScreenChangeCanvasSize(int link, DWORD v);
|
||||
static void ScreenChangeShadedTriangles(int link, DWORD v);
|
||||
static void ScreenChangeFixExportColors(int link, uint32_t v);
|
||||
static void ScreenChangeBackFaces(int link, uint32_t v);
|
||||
static void ScreenChangeCheckClosedContour(int link, uint32_t v);
|
||||
static void ScreenChangePwlCurves(int link, uint32_t v);
|
||||
static void ScreenChangeCanvasSizeAuto(int link, uint32_t v);
|
||||
static void ScreenChangeCanvasSize(int link, uint32_t v);
|
||||
static void ScreenChangeShadedTriangles(int link, uint32_t v);
|
||||
|
||||
static void ScreenStepDimSteps(int link, DWORD v);
|
||||
static void ScreenStepDimFinish(int link, DWORD v);
|
||||
static void ScreenStepDimGo(int link, DWORD v);
|
||||
static void ScreenStepDimSteps(int link, uint32_t v);
|
||||
static void ScreenStepDimFinish(int link, uint32_t v);
|
||||
static void ScreenStepDimGo(int link, uint32_t v);
|
||||
|
||||
static void ScreenChangeTangentArc(int link, DWORD v);
|
||||
static void ScreenChangeTangentArc(int link, uint32_t v);
|
||||
|
||||
static void ScreenPasteTransformed(int link, DWORD v);
|
||||
static void ScreenPasteTransformed(int link, uint32_t v);
|
||||
|
||||
static void ScreenHome(int link, DWORD v);
|
||||
static void ScreenHome(int link, uint32_t v);
|
||||
|
||||
// These ones do stuff with the edit control
|
||||
static void ScreenChangeExprA(int link, DWORD v);
|
||||
static void ScreenChangeGroupName(int link, DWORD v);
|
||||
static void ScreenChangeGroupScale(int link, DWORD v);
|
||||
static void ScreenChangeLightDirection(int link, DWORD v);
|
||||
static void ScreenChangeLightIntensity(int link, DWORD v);
|
||||
static void ScreenChangeColor(int link, DWORD v);
|
||||
static void ScreenChangeChordTolerance(int link, DWORD v);
|
||||
static void ScreenChangeMaxSegments(int link, DWORD v);
|
||||
static void ScreenChangeCameraTangent(int link, DWORD v);
|
||||
static void ScreenChangeGridSpacing(int link, DWORD v);
|
||||
static void ScreenChangeDigitsAfterDecimal(int link, DWORD v);
|
||||
static void ScreenChangeExportScale(int link, DWORD v);
|
||||
static void ScreenChangeExportOffset(int link, DWORD v);
|
||||
static void ScreenChangeGCodeParameter(int link, DWORD v);
|
||||
static void ScreenChangeStyleName(int link, DWORD v);
|
||||
static void ScreenChangeStyleWidthOrTextHeight(int link, DWORD v);
|
||||
static void ScreenChangeStyleTextAngle(int link, DWORD v);
|
||||
static void ScreenChangeStyleColor(int link, DWORD v);
|
||||
static void ScreenChangeBackgroundColor(int link, DWORD v);
|
||||
static void ScreenChangeBackgroundImageScale(int link, DWORD v);
|
||||
static void ScreenChangePasteTransformed(int link, DWORD v);
|
||||
static void ScreenChangeViewScale(int link, DWORD v);
|
||||
static void ScreenChangeViewOrigin(int link, DWORD v);
|
||||
static void ScreenChangeViewProjection(int link, DWORD v);
|
||||
static void ScreenChangeExprA(int link, uint32_t v);
|
||||
static void ScreenChangeGroupName(int link, uint32_t v);
|
||||
static void ScreenChangeGroupScale(int link, uint32_t v);
|
||||
static void ScreenChangeLightDirection(int link, uint32_t v);
|
||||
static void ScreenChangeLightIntensity(int link, uint32_t v);
|
||||
static void ScreenChangeColor(int link, uint32_t v);
|
||||
static void ScreenChangeChordTolerance(int link, uint32_t v);
|
||||
static void ScreenChangeMaxSegments(int link, uint32_t v);
|
||||
static void ScreenChangeCameraTangent(int link, uint32_t v);
|
||||
static void ScreenChangeGridSpacing(int link, uint32_t v);
|
||||
static void ScreenChangeDigitsAfterDecimal(int link, uint32_t v);
|
||||
static void ScreenChangeExportScale(int link, uint32_t v);
|
||||
static void ScreenChangeExportOffset(int link, uint32_t v);
|
||||
static void ScreenChangeGCodeParameter(int link, uint32_t v);
|
||||
static void ScreenChangeStyleName(int link, uint32_t v);
|
||||
static void ScreenChangeStyleWidthOrTextHeight(int link, uint32_t v);
|
||||
static void ScreenChangeStyleTextAngle(int link, uint32_t v);
|
||||
static void ScreenChangeStyleColor(int link, uint32_t v);
|
||||
static void ScreenChangeBackgroundColor(int link, uint32_t v);
|
||||
static void ScreenChangeBackgroundImageScale(int link, uint32_t v);
|
||||
static void ScreenChangePasteTransformed(int link, uint32_t v);
|
||||
static void ScreenChangeViewScale(int link, uint32_t v);
|
||||
static void ScreenChangeViewOrigin(int link, uint32_t v);
|
||||
static void ScreenChangeViewProjection(int link, uint32_t v);
|
||||
|
||||
bool EditControlDoneForStyles(char *s);
|
||||
bool EditControlDoneForConfiguration(char *s);
|
||||
|
@ -620,7 +620,7 @@ public:
|
|||
static const int CMNU_SNAP_TO_GRID = 0x140;
|
||||
static const int CMNU_FIRST_STYLE = 0x40000000;
|
||||
void ContextMenuListStyles(void);
|
||||
SDWORD contextMenuCancelTime;
|
||||
int32_t contextMenuCancelTime;
|
||||
|
||||
// The toolbar, in toolbar.cpp
|
||||
bool ToolbarDrawOrHitTest(int x, int y, bool paint, int *menu);
|
||||
|
@ -667,7 +667,7 @@ public:
|
|||
bool KeyDown(int c);
|
||||
void EditControlDone(char *s);
|
||||
|
||||
SDWORD lastSpaceNavigatorTime;
|
||||
int32_t lastSpaceNavigatorTime;
|
||||
hGroup lastSpaceNavigatorGroup;
|
||||
void SpaceNavigatorMoved(double tx, double ty, double tz,
|
||||
double rx, double ry, double rz, bool shiftDown);
|
||||
|
|
18
src/util.cpp
18
src/util.cpp
|
@ -6,10 +6,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
#include "solvespace.h"
|
||||
|
||||
void MakePathRelative(char *basep, char *pathp)
|
||||
void MakePathRelative(const char *basep, char *pathp)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
const char *p;
|
||||
char base[MAX_PATH], path[MAX_PATH], out[MAX_PATH];
|
||||
|
||||
// Convert everything to lowercase
|
||||
|
@ -65,7 +65,7 @@ void MakePathRelative(char *basep, char *pathp)
|
|||
strcpy(pathp, out);
|
||||
}
|
||||
|
||||
void MakePathAbsolute(char *basep, char *pathp) {
|
||||
void MakePathAbsolute(const char *basep, char *pathp) {
|
||||
char out[MAX_PATH];
|
||||
strcpy(out, basep);
|
||||
|
||||
|
@ -83,9 +83,9 @@ void MakePathAbsolute(char *basep, char *pathp) {
|
|||
strcpy(pathp, out);
|
||||
}
|
||||
|
||||
bool StringAllPrintable(char *str)
|
||||
bool StringAllPrintable(const char *str)
|
||||
{
|
||||
char *t;
|
||||
const char *t;
|
||||
for(t = str; *t; t++) {
|
||||
if(!(isalnum(*t) || *t == '-' || *t == '_')) {
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ bool StringAllPrintable(char *str)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool StringEndsIn(char *str, char *ending)
|
||||
bool StringEndsIn(const char *str, const char *ending)
|
||||
{
|
||||
int i, ls = strlen(str), le = strlen(ending);
|
||||
|
||||
|
@ -135,7 +135,7 @@ void MakeMatrix(double *mat, double a11, double a12, double a13, double a14,
|
|||
// Word-wrap the string for our message box appropriately, and then display
|
||||
// that string.
|
||||
//-----------------------------------------------------------------------------
|
||||
static void DoStringForMessageBox(char *str, va_list f, bool error)
|
||||
static void DoStringForMessageBox(const char *str, va_list f, bool error)
|
||||
{
|
||||
char inBuf[1024*50];
|
||||
vsprintf(inBuf, str, f);
|
||||
|
@ -190,14 +190,14 @@ static void DoStringForMessageBox(char *str, va_list f, bool error)
|
|||
// And then display the text with our actual longest line length.
|
||||
DoMessageBox(outBuf, rows, cols, error);
|
||||
}
|
||||
void Error(char *str, ...)
|
||||
void Error(const char *str, ...)
|
||||
{
|
||||
va_list f;
|
||||
va_start(f, str);
|
||||
DoStringForMessageBox(str, f, true);
|
||||
va_end(f);
|
||||
}
|
||||
void Message(char *str, ...)
|
||||
void Message(const char *str, ...)
|
||||
{
|
||||
va_list f;
|
||||
va_start(f, str);
|
||||
|
|
Loading…
Reference in New Issue
Block a user