Skip to content

Commit 8014b27

Browse files
authored
Testing a GMT_THEME off solution (#4710)
* Testing a GMT_THEME off solution Goal is to allow suers to override specifics in the theme settings without having the THEME be parsed again and overwrite the changes * Update gmt_init.c
1 parent 899f9c1 commit 8014b27

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/gmt_init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9643,6 +9643,7 @@ GMT_LOCAL int gmtinit_update_theme (struct GMT_CTRL *GMT) {
96439643
char theme_file[PATH_MAX] = {""};
96449644

96459645
if (!GMT->current.setting.update_theme) return GMT_NOERROR; /* Nothing to do */
9646+
if (!strcmp (GMT->current.setting.theme, "off")) return GMT_NOERROR; /* Nothing to do */
96469647

96479648
/* Got a GMT_THEME setting, take delayed action now */
96489649
GMT->current.setting.update_theme = false;
@@ -11297,9 +11298,8 @@ unsigned int gmtlib_setparameter (struct GMT_CTRL *GMT, const char *keyword, cha
1129711298
case GMTCASE_GMT_THEME:
1129811299
if (strlen (value) < GMT_LEN64) {
1129911300
strncpy (GMT->current.setting.theme, value, GMT_LEN64-1);
11300-
GMT->current.setting.update_theme = true;
11301-
if (core == false) /* Must deal with this right away */
11302-
error = gmtinit_update_theme (GMT);
11301+
GMT->current.setting.update_theme = (strcmp (GMT->current.setting.theme, "off") != 0);
11302+
error = gmtinit_update_theme (GMT);
1130311303
}
1130411304
else {
1130511305
GMT_Report (GMT->parent, GMT_MSG_ERROR, "GMT_THEME must be less than %d characters\n", GMT_LEN64);

src/gmtset.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ EXTERN_MSC int GMT_gmtset (void *V_API, int mode, void *args) {
173173

174174
if (gmt_setdefaults (GMT, options)) Return (GMT_PARSE_ERROR); /* Process command line arguments, return error if failures */
175175

176+
strcpy (GMT->current.setting.theme, "off"); /* To preserve changes the user may have set */
177+
176178
gmt_putdefaults (GMT, Ctrl->G.file); /* Write out the revised settings */
177179

178180
Return (GMT_NOERROR);

0 commit comments

Comments
 (0)