Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
merge develop into master

See merge request Scientific-IT-Systems/gr!1336
  • Loading branch information
jheinen committed Oct 14, 2024
2 parents a8f4f0b + 447fc21 commit 2393775
Show file tree
Hide file tree
Showing 47 changed files with 6,771 additions and 4,106 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/tiff/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ifeq ($(strip $(PREFIX)),)
override PREFIX = $(abspath $(CURDIR)/../build)
endif

VERSION = 4.5.1
VERSION = 4.7.0
TIFF_EXTRA_CONFIGURE_FLAGS ?=
ifeq ($(shell uname),Darwin)
TIFF_EXTRA_CONFIGURE_FLAGS += CFLAGS=-mmacosx-version-min=10.15
Expand Down
34 changes: 32 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(GR_DIRECTORY
CACHE STRING "Default value for GRDIR"
)
option(GR_BUILD_DEMOS "Build demos for GR" OFF)
option(GR_BUILD_GKSM "Build GKS metafile reader for GR" OFF)
option(GR_INSTALL "Create installation target for GR" ON)
option(GR_USE_BUNDLED_LIBRARIES "Use thirdparty libraries bundled with GR" OFF)
option(GR_MANUAL_MOC_AND_RCC "Manually run moc and rcc instead of relying on AUTOMOC and AUTORCC" OFF)
Expand Down Expand Up @@ -1243,6 +1244,8 @@ if((Qt6Widgets_FOUND
lib/grm/grplot/gredit/Bounding_logic.cpp
lib/grm/grplot/gredit/Bounding_object.cpp
lib/grm/grplot/gredit/CustomTreeWidgetItem.cpp
lib/grm/grplot/gredit/EditElementWidget.cpp
lib/grm/grplot/gredit/TableWidget.cpp
lib/grm/grplot/gredit/TreeWidget.cpp
lib/grm/grplot/grplot.cxx
lib/grm/grplot/grplot_mainwindow.cxx
Expand Down Expand Up @@ -1353,15 +1356,33 @@ if((Qt6Widgets_FOUND
${CMAKE_CURRENT_BINARY_DIR}/moc_AddElementWidget.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/AddElementWidget.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_EditElementWidget.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/EditElementWidget.h -o
${CMAKE_CURRENT_BINARY_DIR}/moc_EditElementWidget.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/EditElementWidget.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_TableWidget.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TableWidget.h -o
${CMAKE_CURRENT_BINARY_DIR}/moc_TableWidget.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TableWidget.h
)
target_sources(
grplot
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_grplot_mainwindow.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_grplot_widget.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_AddElementWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_logic.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_object.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_CustomTreeWidgetItem.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_EditElementWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_TableWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_TreeWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_AddElementWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_grm_args_t_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_receiver_thread.cpp
)
Expand All @@ -1371,11 +1392,13 @@ if((Qt6Widgets_FOUND
grplot
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/grplot_mainwindow.hxx
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/grplot_widget.hxx
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/AddElementWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_logic.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_object.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/CustomTreeWidgetItem.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/EditElementWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TableWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TreeWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/AddElementWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/qtterm/grm_args_t_wrapper.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/qtterm/receiver_thread.h
)
Expand Down Expand Up @@ -1418,6 +1441,13 @@ if(GR_BUILD_DEMOS)
add_subdirectory(lib/grm/test/internal_api/grm grm_test_internal_api)
endif()

if(GR_BUILD_GKSM)
add_executable(gksm lib/gks/gksm.c)
target_link_libraries(gksm PUBLIC gks_static)
target_compile_options(gksm PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(gksm PROPERTIES C_STANDARD 90 C_EXTENSIONS OFF C_STANDARD_REQUIRED ON)
endif()

if(GR_INSTALL)
install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR}/)
install(
Expand Down
14 changes: 12 additions & 2 deletions lib/gks/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ void gks_dl_write_item(gks_display_list_t *d, int fctid, int dx, int dy, int dim
COPY(f_arr_1, sizeof(double));
break;

case 32: /* set character up vector */
case 32: /* set character up vector */
case 212: /* set clip sector */

len = 2 * sizeof(int) + 2 * sizeof(double);
if (d->nbytes + len > d->size) reallocate(d, len);
Expand Down Expand Up @@ -551,7 +552,7 @@ int gks_dl_read_item(char *dl, gks_state_list_t **gkss,
break;

case 32: /* set character up vector */
case 252: /* move selection */
case 212: /* set clip sector */
RESOLVE(r1, double, sizeof(double));
RESOLVE(r2, double, sizeof(double));
break;
Expand Down Expand Up @@ -585,6 +586,11 @@ int gks_dl_read_item(char *dl, gks_state_list_t **gkss,

case 251: /* end selection */
break;

case 252: /* move selection */
RESOLVE(r1, double, sizeof(double));
RESOLVE(r2, double, sizeof(double));
break;
}

switch (*fctid)
Expand Down Expand Up @@ -696,6 +702,10 @@ int gks_dl_read_item(char *dl, gks_state_list_t **gkss,
case 211:
(*gkss)->clip_region = ia[0];
break;
case 212:
(*gkss)->clip_start_angle = r1[0];
(*gkss)->clip_end_angle = r2[0];
break;
}

fn(*fctid, *dx, *dy, *dimx, ia, 0, r1, 0, r2, *lc, chars, (void **)gkss);
Expand Down
6 changes: 6 additions & 0 deletions lib/gks/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ const char *gks_function_name(int routine)
case 211:
name = "SET_CLIP_REGION";
break;
case 212:
name = "SET_CLIP_SECTOR";
break;
case 250:
name = "BEGIN_SELECTION";
break;
Expand Down Expand Up @@ -476,6 +479,9 @@ void gks_report_error(int routine, int errnum)
case 165:
message = "Clip region type is invalid in routine %s";
break;
case 166:
message = "Clip sector angles are invalid in routine %s";
break;
case 401:
message = "Dimensions of image are invalid in routine %s";
break;
Expand Down
33 changes: 32 additions & 1 deletion lib/gks/gks.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,10 @@ void gks_init_gks(void)
s->bwidth = 1;
s->bcoli = 0;
s->clip_tnr = 0;
s->resize_behaviour = GKS_K_RESIZE;
s->clip_region = GKS_K_REGION_RECTANGLE;
s->clip_start_angle = 0;
s->clip_end_angle = 360;
s->resize_behaviour = GKS_K_RESIZE;
s->aspect_ratio = 1;

s->callback = NULL;
Expand Down Expand Up @@ -4556,6 +4558,35 @@ void gks_inq_clip_region(int *errind, int *region)
*region = s->clip_region;
}

void gks_set_clip_sector(double start_angle, double end_angle)
{
if (state >= GKS_K_GKOP)
{
if (start_angle >= 0 && end_angle > start_angle && end_angle <= 360)
{
s->clip_start_angle = f_arr_1[0] = start_angle;
s->clip_end_angle = f_arr_2[0] = end_angle;

/* call the device driver link routine */
gks_ddlk(SET_CLIP_SECTOR, 0, 0, 0, i_arr, 1, f_arr_1, 1, f_arr_2, 0, c_arr, NULL);
}
else
/* clip sector angles are invalid */
gks_report_error(SET_CLIP_SECTOR, 166);
}
else
/* GKS not in proper state. GKS must be in one of the states
GKOP, WSOP, WSAC or SGOP */
gks_report_error(SET_CLIP_SECTOR, 8);
}

void gks_inq_clip_sector(int *errind, double *start_angle, double *end_angle)
{
*errind = GKS_K_NO_ERROR;
*start_angle = s->clip_start_angle;
*end_angle = s->clip_end_angle;
}

void gks_set_resize_behaviour(int flag)
{
if (state >= GKS_K_GKOP)
Expand Down
3 changes: 3 additions & 0 deletions lib/gks/gks.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ DLLEXPORT void gks_inq_resize_behaviour(int *flag);
DLLEXPORT void gks_set_clip_region(int region);
DLLEXPORT void gks_inq_clip_region(int *errind, int *region);

DLLEXPORT void gks_set_clip_sector(double start_angle, double end_angle);
DLLEXPORT void gks_inq_clip_sector(int *errind, double *start_angle, double *end_angle);

/* Entry point definitions */

#define gsetlinecolorind gsetlinecolourind
Expand Down
4 changes: 3 additions & 1 deletion lib/gks/gkscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ extern "C" {
#define INQ_WS_STATE 209
#define SAMPLE_LOCATOR 210
#define SET_CLIP_REGION 211
#define SET_CLIP_SECTOR 212

#define BEGIN_SELECTION 250
#define END_SELECTION 251
Expand Down Expand Up @@ -170,9 +171,10 @@ typedef struct
double bwidth;
int bcoli;
int clip_tnr;
int clip_region;
double clip_start_angle, clip_end_angle;
int resize_behaviour;
double aspect_ratio;
int clip_region;
char *(*callback)(const char *);
int debug;
} gks_state_list_t;
Expand Down
10 changes: 8 additions & 2 deletions lib/gks/mf.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ static void write_item(int fctid, int dx, int dy, int dimx, int *i_arr, int len_
COPY(f_arr_1, sizeof(double));
break;

case 32: /* set character up vector */
case 32: /* set character up vector */
case 212: /* set clip sector */

len = 2 * sizeof(int) + 2 * sizeof(double);
if (p->nbytes + len > p->size) reallocate(len);
Expand Down Expand Up @@ -389,6 +390,7 @@ void gks_drv_mo(int fctid, int dx, int dy, int dimx, int *i_arr, int len_farr_1,
case 207:
case 208:
case 211:
case 212:

if (p->state == GKS_K_WS_ACTIVE)
{
Expand Down Expand Up @@ -575,7 +577,8 @@ static void interp(char *str)
RESOLVE(f_arr_1, double, sizeof(double));
break;

case 32: /* set character up vector */
case 32: /* set character up vector */
case 212: /* set clip sector */

RESOLVE(f_arr_1, double, sizeof(double));
RESOLVE(f_arr_2, double, sizeof(double));
Expand Down Expand Up @@ -760,6 +763,9 @@ static void interp(char *str)
case 211:
gks_set_clip_region(i_arr[0]);
break;
case 212:
gks_set_clip_sector(f_arr_1[0], f_arr_2[0]);
break;
}

RESOLVE(len, int, sizeof(int));
Expand Down
Loading

0 comments on commit 2393775

Please sign in to comment.