Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release v0.46.0

See merge request Scientific-IT-Systems/gr!344
  • Loading branch information
FlorianRhiem committed Jan 27, 2020
2 parents e17b60a + 9f8e9d5 commit 510fd6e
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 86 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
0785e7f81b7bb39dfc0cf9e9c9faea8336a83022
# Commit which applied the coding style guidelines for CMake files
1b886d02d4e32be1060e5330e1e756a4a04aa63f
# Commit which applied the new coding style of `cmake-format` version `0.6.7`
97151f7590c1c2e7893e6e3282cb01e8c1c62e7b
7 changes: 4 additions & 3 deletions .setup_cmakeformat.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

CMAKE_FORMAT_VERSION="0.6.7"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
VENV_NAME=".cmakeformat_venv"

Expand All @@ -9,16 +10,16 @@ install_cmakeformat () {
python3 -m venv "${VENV_NAME}" || return
fi
source "${VENV_NAME}/bin/activate" && \
pip -qqq install -U cmake_format six && \
# Guarantee that all team members use the same version (of dependent packages)
pip -qqq install --upgrade --upgrade-strategy eager "cmake_format==${CMAKE_FORMAT_VERSION}" && \
deactivate && \
echo "$(cd "${VENV_NAME}" && pwd)/bin/cmake-format"
}


main () {
cd "${SCRIPT_DIR}"
# If `cmake-format` is already installed on the system, use that version
command -v "cmake-format" && return
# Always use a pinned version of `cmake-format`
install_cmakeformat
}

Expand Down
20 changes: 8 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,8 @@ if(Qt4_FOUND)
set_target_properties(qt4gr PROPERTIES AUTOMOC OFF AUTORCC OFF)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${QT4_MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx
COMMAND ${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${QT4_MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.cxx
)
target_sources(qt5gr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx)
Expand All @@ -634,9 +633,8 @@ if(Qt5Widgets_FOUND
set_target_properties(qt5gr PROPERTIES AUTOMOC OFF AUTORCC OFF)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_qt5_grwidget.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${QT5_MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_qt5_grwidget.cxx
COMMAND ${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${QT5_MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_qt5_grwidget.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.cxx
)
target_sources(qt5gr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_qt5_grwidget.cxx)
Expand Down Expand Up @@ -714,16 +712,14 @@ if(Qt4_FOUND
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_gkswidget.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gkswidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_gkswidget.cxx
COMMAND ${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gkswidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_gkswidget.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gkswidget.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_gksserver.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gksserver.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_gksserver.cxx
COMMAND ${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gksserver.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_gksserver.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/qt/gksserver.h
)
add_custom_command(
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindFfmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ if(FFMPEG_INCLUDE_DIR
if(APPLE)
list(
APPEND
FFMPEG_LIBRARIES
"-framework VideoToolbox;-framework CoreVideo;-framework CoreFoundation;-framework CoreServices;-framework CoreMedia"
FFMPEG_LIBRARIES
"-framework VideoToolbox;-framework CoreVideo;-framework CoreFoundation;-framework CoreServices;-framework CoreMedia"
)
endif()
try_compile(
Expand All @@ -116,7 +116,7 @@ if(FFMPEG_INCLUDE_DIR
AND FFMPEG_LIBRARY_OPENH264
)
list(APPEND FFMPEG_LIBRARIES
"${FFMPEG_LIBRARY_THEORA};${FFMPEG_LIBRARY_OGG};${FFMPEG_LIBRARY_VPX};${FFMPEG_LIBRARY_OPENH264}"
"${FFMPEG_LIBRARY_THEORA};${FFMPEG_LIBRARY_OGG};${FFMPEG_LIBRARY_VPX};${FFMPEG_LIBRARY_OPENH264}"
)
try_compile(
FFMPEG_TEST_COMPILED ${CMAKE_CURRENT_BINARY_DIR}/ffmpeg_test ${CMAKE_CURRENT_LIST_DIR}/ffmpeg_test.cxx
Expand Down
1 change: 1 addition & 0 deletions lib/gks/gksquartz.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef struct
double swidth, sheight;
double a, b, c, d;
double window[4], viewport[4];
double nominal_size;
CGColorRef rgb[MAX_COLOR];
int family, capheight;
double angle;
Expand Down
10 changes: 6 additions & 4 deletions lib/gks/pdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ typedef unsigned long uLong;
#define MAX_FONT 31
#define HATCH_STYLE 108
#define PATTERNS 120
#define NOMINAL_SIZE 558.0 / 500

#define MEMORY_INCREMENT 32768

Expand Down Expand Up @@ -136,6 +135,7 @@ typedef struct ws_state_list_t
double red[MAX_COLOR], green[MAX_COLOR], blue[MAX_COLOR];
int color, fillcolor, alpha, ltype, font, size, pt;
double lwidth, angle;
double nominal_size;
PDF_stream *stream;
long object_number;
long info, root, outlines, pages;
Expand Down Expand Up @@ -762,6 +762,7 @@ static void set_xform(void)

p->width = nint(p->a * (p->window[1] - p->window[0]));
p->height = nint(p->c * (p->window[3] - p->window[2]));
p->nominal_size = min(p->width, p->height) / 500.0;
}

static void seg_xform(double *x, double *y)
Expand Down Expand Up @@ -853,6 +854,7 @@ static void open_ws(int fd, int wstype)
p->viewport[0] = p->viewport[2] = 0;
p->viewport[1] = p->viewport[3] = 0.1984;
p->width = p->height = 558;
p->nominal_size = 558 / 500.0;

p->empty = 1;

Expand Down Expand Up @@ -996,7 +998,7 @@ static void set_linetype(int ltype, double lwidth)

if (p->ltype != ltype || p->lwidth != lwidth)
{
gks_get_dash(ltype, lwidth * NOMINAL_SIZE, dash);
gks_get_dash(ltype, lwidth * p->nominal_size, dash);
pdf_setdash(p, dash);
p->ltype = ltype;
}
Expand All @@ -1006,7 +1008,7 @@ static void set_linewidth(double lwidth)
{
if (p->lwidth != lwidth)
{
pdf_setlinewidth(p, lwidth * NOMINAL_SIZE);
pdf_setlinewidth(p, lwidth * p->nominal_size);
p->lwidth = lwidth;
}
}
Expand Down Expand Up @@ -1042,7 +1044,7 @@ static void draw_marker(double xn, double yn, int mtype, double mscale, int mcol

static double cy[4][3] = {{-1, -0.5523, 0}, {0.5523, 1, 1}, {1, 0.5523, 0}, {-0.5523, -1, -1}};

mscale *= NOMINAL_SIZE;
mscale *= p->nominal_size;
r = (int)(3 * mscale);
scale = 0.01 * mscale / 3.0;

Expand Down
3 changes: 2 additions & 1 deletion lib/gks/plugin/cairoplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@ void gks_cairoplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, doub
p->mw = p->w * 2.54 / 100 / p->dpi;
p->mh = p->h * 2.54 / 100 / p->dpi;
resize(width, height);
p->nominal_size = 2400 / 500.0;
p->nominal_size = min(width, height) / 500.0;
}
else if (p->wtype == 150)
{
Expand Down Expand Up @@ -2107,6 +2107,7 @@ void gks_cairoplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, doub
{
p->width = p->viewport[1] * p->w / p->mw;
p->height = p->viewport[3] * p->h / p->mh;
p->nominal_size = fmin(p->width, p->height) / 500.0;
}
close_page();
open_page();
Expand Down
30 changes: 17 additions & 13 deletions lib/gks/plugin/gsplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ typedef struct ws_state_list_t

int ltype;
double cwidth, csize, cangle, cheight;
int font, height;
int font;

gs_main_instance *gs_instance;
int gs_argc;
char *gs_argv[NUM_GS_ARGS];
int gs_position;

double width, height, nominal_size;
} ws_state_list;

static ws_state_list *p;
Expand Down Expand Up @@ -477,7 +479,7 @@ static unsigned int LZWEncodeImage(unsigned int number_pixels, unsigned char *pi
return (0);
}

static void set_xform(double *wn, double *vp, int *height)
static void set_xform(double *wn, double *vp)
{
p->e = (vp[1] - vp[0]) / (wn[1] - wn[0]);
p->f = (6750 - 1) / 0.28575;
Expand All @@ -492,7 +494,9 @@ static void set_xform(double *wn, double *vp, int *height)
p->mw = p->a * (wn[1] - wn[0]);
p->mh = p->c * (wn[3] - wn[2]);

*height = (int)p->c;
p->width = p->a;
p->height = p->c;
p->nominal_size = MIN(p->width, p->height) / 500.0 * 72 / 600;

p->stroke = 0;
}
Expand Down Expand Up @@ -625,7 +629,7 @@ static void set_linewidth(double width)
if (fabs(width - p->cwidth) > FEPS)
{
p->cwidth = fabs(width);
sprintf(buffer, "%.4g lw", p->cwidth * 600 / 72 * 558.0 / 500);
sprintf(buffer, "%.4g lw", p->cwidth * 600 / 72 * p->nominal_size);
packb(buffer);
}
}
Expand All @@ -637,7 +641,7 @@ static void set_markersize(double size)
if (fabs(size - p->csize) > FEPS)
{
p->csize = fabs(size);
sprintf(buffer, "%.4g ms", p->csize * 558.0 / 500);
sprintf(buffer, "%.4g ms", p->csize * p->nominal_size);
packb(buffer);
}
}
Expand Down Expand Up @@ -843,7 +847,7 @@ static void set_clipping(double *clrt)
packb(buffer);
}

static void set_font(int font, int height)
static void set_font(int font)
{

double scale, w, h, ux, uy, chh;
Expand Down Expand Up @@ -873,7 +877,7 @@ static void set_font(int font, int height)
else
font = 8;

p->ysize = p->cheight * height;
p->ysize = p->cheight * p->height;
size = MIN(MAX((int)(p->ysize / caps[font]), 1), 7200);

if (font != 12 && font != 29 && font != 30)
Expand Down Expand Up @@ -1170,7 +1174,7 @@ static void ps_init(int *pages)
set_linewidth(-1.0);
set_markersize(-1.0);
packb("0 ma");
set_font(-1, p->height);
set_font(-1);
set_clipping(p->window);
packb("%%EndPageSetup");
update();
Expand Down Expand Up @@ -1270,7 +1274,7 @@ static void set_connection(int conid, char *path, int wtype)
p->viewpt[2] = 0;
p->viewpt[3] = p->viewpt[1];

set_xform(p->window, p->viewpt, &p->height);
set_xform(p->window, p->viewpt);

p->pages = 0;
p->init = 0;
Expand Down Expand Up @@ -1977,7 +1981,7 @@ void gks_gsplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double
y = 1.0;
seg_xform_rel(&x, &y);
size *= sqrt(x * x + y * y);
set_markersize(23 * size / 24);
set_markersize(size);
angle = -atan2(x, y) * 180.0 / M_PI;
set_markerangle(angle);
set_linewidth(1.0);
Expand All @@ -2002,7 +2006,7 @@ void gks_gsplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double
font = gkss->asf[6] ? gkss->txfont : predef_font[gkss->tindex - 1];
prec = gkss->asf[6] ? gkss->txprec : predef_prec[gkss->tindex - 1];
if (prec != GKS_K_TEXT_PRECISION_STROKE)
set_font(font, p->height);
set_font(font);
else
set_linewidth(1.0);
color = gkss->asf[9] ? gkss->txcoli : 1;
Expand Down Expand Up @@ -2108,7 +2112,7 @@ void gks_gsplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double
p->window[1] = r1[1];
p->window[2] = r2[0];
p->window[3] = r2[1];
set_xform(p->window, p->viewpt, &p->height);
set_xform(p->window, p->viewpt);
init_norm_xform();
if (p->init) set_clipping(p->window);
break;
Expand All @@ -2119,7 +2123,7 @@ void gks_gsplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double
p->viewpt[1] = r1[1];
p->viewpt[2] = r2[0];
p->viewpt[3] = r2[1];
set_xform(p->window, p->viewpt, &p->height);
set_xform(p->window, p->viewpt);
init_norm_xform();
break;

Expand Down
13 changes: 9 additions & 4 deletions lib/gks/plugin/pgfplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ typedef struct ws_state_list_t
double window[4], viewport[4];
char rgb[MAX_COLOR][7];
int width, height;
double nominal_size;
int color, linewidth;
double alpha, angle;
int family, capheight;
Expand Down Expand Up @@ -259,6 +260,7 @@ static void draw_marker(double xn, double yn, int mtype, double mscale)

#include "marker.h"

mscale *= p->nominal_size;
r = (int)(3 * mscale);
scale = 0.01 * mscale / 3.0;

Expand Down Expand Up @@ -362,7 +364,7 @@ static void polymarker(int n, double *px, double *py)
mk_size = gkss->asf[4] ? gkss->mszsc : 1;
mk_color = gkss->asf[5] ? gkss->pmcoli : 1;

p->linewidth = 1;
p->linewidth = nint(p->nominal_size);

pgf_printf(p->stream, "\\definecolor{mycolor}{HTML}{%s}\n", p->rgb[mk_color]);

Expand Down Expand Up @@ -521,7 +523,7 @@ static void fillarea(int n, double *px, double *py)
int fl_color;

fl_color = gkss->asf[12] ? gkss->facoli : 1;
p->linewidth = 1;
p->linewidth = nint(p->nominal_size);

pgf_printf(p->stream, "\\definecolor{mycolor}{HTML}{%s}\n", p->rgb[fl_color]);

Expand All @@ -545,7 +547,7 @@ static void polyline(int n, double *px, double *py)
ln_width = gkss->asf[1] ? gkss->lwidth : 1;
ln_color = gkss->asf[2] ? gkss->plcoli : 1;

width = nint(ln_width);
width = nint(ln_width * p->nominal_size);
if (width < 1) width = 0;

p->linewidth = width;
Expand Down Expand Up @@ -888,7 +890,6 @@ static void open_page(void)
"thickness/.code={\\thickness=#1},\n"
"thickness=1pt\n}\n");
gks_write_file(fd, buf, strlen(buf));
gks_write_file(fd, p->patternstream->buffer, p->patternstream->length);
}
else
{
Expand All @@ -904,6 +905,8 @@ static void write_page(void)
{
p->page_counter++;
p->png_counter = 0;
gks_write_file(p->tex_file, p->patternstream->buffer, p->patternstream->length);
pgf_clear_stream(p->patternstream);
sprintf(buf,
"\\begin{tikzpicture}[yscale=-1, "
"every node/.style={inner sep=0pt, outer sep=1pt, anchor=base west}]\n"
Expand Down Expand Up @@ -1192,6 +1195,7 @@ void gks_pgfplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double

p->height = 500;
p->width = 500;
p->nominal_size = 1;
p->window[0] = p->window[2] = 0.0;
p->window[1] = p->window[3] = 1.0;
p->viewport[0] = p->viewport[2] = 0;
Expand Down Expand Up @@ -1384,6 +1388,7 @@ void gks_pgfplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double

p->width = p->viewport[1] * WIDTH / MWIDTH;
p->height = p->viewport[3] * HEIGHT / MHEIGHT;
p->nominal_size = min(p->width, p->height) / 500.0;

set_xform();
init_norm_xform();
Expand Down
Loading

0 comments on commit 510fd6e

Please sign in to comment.