Commit 544f5295 authored by Drew DeVault's avatar Drew DeVault Committed by Leo

testing/solvespace: new aport

parent 01420bf2
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=solvespace
pkgver=2.3
pkgrel=0
_dxtlibver=0b7b7b709d9299565db603f878214656ef5e9ddf
_solvespace_commit=7c1ca460769fc8cbef26d296338d4bbc6f2ef6d0
pkgdesc="A parametric 3D CAD program"
options="!check" # No testsuite
arch="all"
url="https://solvespace.com"
license="GPL-3.0-only"
makedepends="cmake glew-dev gtkmm-dev json-c-dev"
subpackages="$pkgname-dev"
source="
$pkgname-$pkgver.tar.gz::https://github.com/solvespace/solvespace/archive/v$pkgver.tar.gz
dtxlib-$_dxtlibver.tar.gz::https://github.com/solvespace/libdxfrw/archive/$_dxtlibver.tar.gz
textwindow.patch
"
prepare() {
default_prepare
rm -r extlib/libdxfrw
ln -s "$srcdir"/libdxfrw-$_dxtlibver extlib/libdxfrw
sed -i CMakeLists.txt \
-e 's/include(GetGitCommitHash)/#\0/g' \
-e "s/# set(GIT_COMMIT_HASH.*/set(GIT_COMMIT_HASH $_solvespace_commit)/g"
}
build() {
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib/"$pkgname" \
-DCMAKE_BUILD_TYPE=None
make
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="9d22e467337591cd9a4935124d18733b8337f5785ab5738f4a94300f283ffe7d313569e379ae77e509d14182ffde8c9db7beaebb46ea7c0507c6b05010fe1a56 solvespace-2.3.tar.gz
9ab498aa7f369be79d800e8ca5ec55fa54be79d0778937b81d4c8da776b3419cb8a75400b54b205efc338da32e2e781afd0bed1bd8efed1a0b212dc8682a2615 dtxlib-0b7b7b709d9299565db603f878214656ef5e9ddf.tar.gz
ae690f0e40c8d934fd454ad243804eecab9058eaac3e04bebf50a4fe4544f688f7a11af93b1911d19e4015a5b991a66b90149fc965248463328346e95502957c textwindow.patch"
From 7c2417ab735cf05960939647a2a016fb51f88135 Mon Sep 17 00:00:00 2001
From: whitequark <whitequark@whitequark.org>
Date: Thu, 6 Apr 2017 06:59:00 +0000
Subject: [PATCH] Rename TextWindow::CHAR_WIDTH to CHAR_WIDTH_.
glibc defines a CHAR_WIDTH macro in limits.h since about 6.3.*.
This is apparently added as a part of ISO TS 18661-1:2014, which
I cannot read because it is not publicly available, and which covers
some sort of floating-point extensions. This is one of those changes
that should never have been done yet here we are.
---
src/textwin.cpp | 18 +++++++++---------
src/toolbar.cpp | 2 +-
src/ui.h | 2 +-
src/win32/w32main.cpp | 6 +++---
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/textwin.cpp b/src/textwin.cpp
index 656ac626..b229beb3 100644
--- a/src/textwin.cpp
+++ b/src/textwin.cpp
@@ -85,7 +85,7 @@ void TextWindow::ShowEditControl(int col, const std::string &str, int halfRow) {
editControl.halfRow = halfRow;
editControl.col = col;
- int x = LEFT_MARGIN + CHAR_WIDTH*col;
+ int x = LEFT_MARGIN + CHAR_WIDTH_*col;
int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
ShowTextEditControl(x, y + 18, str);
@@ -447,7 +447,7 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my)
double ox = oldMousePos.x, oy = oldMousePos.y - LINE_HEIGHT;
ox += 3;
oy -= 3;
- int tw = (str.length() + 1)*(CHAR_WIDTH - 1);
+ int tw = (str.length() + 1)*(CHAR_WIDTH_ - 1);
ox = min(ox, (double) (width - 25) - tw);
oy = max(oy, 5.0);
@@ -583,7 +583,7 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
int width, height;
GetTextWindowSize(&width, &height);
- int px = LEFT_MARGIN + CHAR_WIDTH*editControl.col;
+ int px = LEFT_MARGIN + CHAR_WIDTH_*editControl.col;
int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
py += LINE_HEIGHT + 5;
@@ -842,8 +842,8 @@ void TextWindow::Paint(void) {
if(ltop < (scrollPos-1)) continue;
if(ltop > scrollPos+halfRows) break;
- for(c = 0; c < min((width/CHAR_WIDTH)+1, (int) MAX_COLS); c++) {
- int x = LEFT_MARGIN + c*CHAR_WIDTH;
+ for(c = 0; c < min((width/CHAR_WIDTH_)+1, (int) MAX_COLS); c++) {
+ int x = LEFT_MARGIN + c*CHAR_WIDTH_;
int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4;
int fg = meta[r][c].fg;
@@ -866,7 +866,7 @@ void TextWindow::Paint(void) {
// Move the quad down a bit, so that the descenders
// still have the correct background.
y += adj;
- ssglAxisAlignedQuad(x, x + CHAR_WIDTH, y, y + bh, false);
+ ssglAxisAlignedQuad(x, x + CHAR_WIDTH_, y, y + bh, false);
y -= adj;
}
} else if(a == 1) {
@@ -912,8 +912,8 @@ void TextWindow::Paint(void) {
glLineWidth(1);
glBegin(GL_LINES);
int yp = y + CHAR_HEIGHT;
- glVertex2d(LEFT_MARGIN + cs*CHAR_WIDTH, yp);
- glVertex2d(LEFT_MARGIN + cf*CHAR_WIDTH, yp);
+ glVertex2d(LEFT_MARGIN + cs*CHAR_WIDTH_, yp);
+ glVertex2d(LEFT_MARGIN + cf*CHAR_WIDTH_, yp);
glEnd();
glEnable(GL_TEXTURE_2D);
@@ -979,7 +979,7 @@ void TextWindow::MouseEvent(bool leftClick, bool leftDown, double x, double y) {
hoveredCol = 0;
// Find the corresponding character in the text buffer
- int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH);
+ int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH_);
int hh = (LINE_HEIGHT)/2;
y += scrollPos*hh;
int r;
diff --git a/src/toolbar.cpp b/src/toolbar.cpp
index 77f795f0..1c3544b8 100644
--- a/src/toolbar.cpp
+++ b/src/toolbar.cpp
@@ -218,7 +218,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
}
}
- int tw = str.length() * (SS.TW.CHAR_WIDTH - 1) + 10,
+ int tw = str.length() * (SS.TW.CHAR_WIDTH_ - 1) + 10,
th = SS.TW.LINE_HEIGHT + 2;
double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
diff --git a/src/ui.h b/src/ui.h
index a041ed36..81f5aea5 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -27,7 +27,7 @@ class TextWindow {
float fgColorTable[256*3];
enum {
- CHAR_WIDTH = 9,
+ CHAR_WIDTH_ = 9,
CHAR_HEIGHT = 16,
LINE_HEIGHT = 20,
LEFT_MARGIN = 6,
diff --git a/src/win32/w32main.cpp b/src/win32/w32main.cpp
index 562499bd..88ff95d4 100644
--- a/src/win32/w32main.cpp
+++ b/src/win32/w32main.cpp
@@ -138,7 +138,7 @@ void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error)
RECT r;
GetWindowRect(GraphicsWnd, &r);
const char *title = error ? "SolveSpace - Error" : "SolveSpace - Message";
- int width = cols*SS.TW.CHAR_WIDTH + 20,
+ int width = cols*SS.TW.CHAR_WIDTH_ + 20,
height = rows*SS.TW.LINE_HEIGHT + 60;
MessageWidth = width;
MessageHeight = height;
@@ -546,7 +546,7 @@ LRESULT CALLBACK TextWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
r->top += extra;
break;
}
- int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_WIDTH) -
+ int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_WIDTH_) -
(r->right - r->left);
if(tooNarrow >= 0) {
switch(wParam) {
@@ -1367,7 +1367,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
InitCommonControls();
// A monospaced font
- FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_WIDTH, 0, 0,
+ FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_WIDTH_, 0, 0,
FW_REGULAR, false,
false, false, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FF_DONTCARE, L"Lucida Console");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment