Skip to content

Commit daed668

Browse files
authored
Merge pull request #18 from schwicke/config
add new functions to set the hardcopy scale factor
2 parents 84b8804 + 8785af9 commit daed668

File tree

4 files changed

+79
-8
lines changed

4 files changed

+79
-8
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ Notes:
7676
* There is no support for PostScript at the moment.
7777
* The hardcopy types are available in Fortran. C-Bindings have not been tested with them
7878

79-
### (Extension) Display/Color
80-
There is some support for transparency.
81-
* PSALCH(REAL VALUE): set ALPHA channel to Value. Value is between 0(fully transparent) and 1 (opaque). Added to the current structure.
82-
* pset_alpha_channel(float value): C-Binding for PSALCH. Added to the current structure.
83-
8479
### Input devices
8580
Openphigs behaviour on echo modes is summarized below.
8681

@@ -137,9 +132,21 @@ Extensions:
137132
* as 4 but
138133
* echo area is given as a fraction of the root window
139134

135+
## Extensions
136+
### There is some support for transparency.
137+
#### Fortran bindings
138+
* PXNDEF(STRING NAME): set the configuration location and file name
139+
* PXHCSF(INTEGER IWK, REAL VALUE): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened
140+
141+
* PSALCH(REAL VALUE): set ALPHA channel to Value. Value is between 0(fully transparent) and 1 (opaque). Added to the current structure.
142+
#### C-bindings
143+
* pxset_conf_file_name(char* path): set the configuration location and file name
144+
* pxset_conf_hcsf(WKID, float value): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened
145+
146+
* pset_alpha_channel(float value): C-Binding for PSALCH. Added to the current structure.
147+
140148
## Versions
141149
* 0.0.1-1: Revised code from upstream
142150
* 0.0.2-1: Implement additional extend C and Fortran bindings for CERN specific purposes
143-
* 0.0.2-1: Implement additional extend C and Fortran bindings for CERN specific purposes
144151
* v0.1-1: Fixes for exotic hardware
145152
* v0.2-1: Introduce scale factor for hardcopies

src/include/phigs/phigs.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,6 +4144,29 @@ void pmessage(
41444144
char* message
41454145
);
41464146

4147+
/*******************************************************************************
4148+
* Extension: set config file name
4149+
*
4150+
* DESCR: set config file name
4151+
* RETURNS: N/A
4152+
* Note: extending the standard
4153+
*/
4154+
void pxset_conf_file_name(
4155+
char * name
4156+
);
4157+
4158+
/*******************************************************************************
4159+
* Extension: set hardcopy scale factor
4160+
*
4161+
* DESCR: set harcopy scale factor for workstation
4162+
* RETURNS: N/A
4163+
* Note: extending the standard
4164+
*/
4165+
void pxset_conf_hcsf(
4166+
Pint wkid,
4167+
Pfloat hcsf
4168+
);
4169+
41474170
#ifdef __cplusplus
41484171
}
41494172
#endif /* __cplusplus */

src/libphigs/c_binding/cb_conf.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,34 @@
1919
*******************************************************************************/
2020
#include <string.h>
2121
#include <stdlib.h>
22+
#include <stdio.h>
2223
#include "phconf.h"
2324

24-
/* configuration file name */
25-
void pxset_conf_file_name(char * name) {
25+
/*******************************************************************************
26+
* pxset_conf_file_name
27+
*
28+
* DESCR: set the configuration path and name
29+
* RETURNS: N/A
30+
*/
31+
void pxset_conf_file_name(
32+
char * name)
33+
{
2634
read_config(name);
2735
}
36+
37+
38+
void pxset_conf_hcsf(
39+
Pint wkid,
40+
Pfloat hcsf
41+
){
42+
if (wkid >=0 && wkid <100){
43+
if (hcsf > 0. && hcsf <= 32){
44+
config[wkid].hcsf = hcsf;
45+
} else {
46+
printf("ERROR: configuration error. Ignoring unreasonable scale factor of: %f\n", hcsf);
47+
}
48+
} else {
49+
printf("FATAL: configuration error. Work station ID out of range: %d\n", wkid);
50+
exit(1);
51+
}
52+
}

src/libphigs/f_binding/fb_conf.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@ FTN_SUBROUTINE(pxndef)(
4949
printf("WARNING: Configuration file name is too long\n");
5050
}
5151
}
52+
53+
/*******************************************************************************
54+
* pxhcsf
55+
*
56+
* DESCR: set the hardcopy scale factor for workstation
57+
* RETURNS: N/A
58+
*/
59+
FTN_SUBROUTINE(pxhcsf)(
60+
FTN_INTEGER(wkid),
61+
FTN_REAL(hcsf)
62+
)
63+
{
64+
Pint ws_id = FTN_INTEGER_GET(wkid);
65+
Pfloat hc_sf = FTN_REAL_GET(hcsf);
66+
pxset_conf_hcsf(ws_id, hc_sf);
67+
}

0 commit comments

Comments
 (0)