Reset parser in grace_set_project().
[grace.git] / src / region_ui.c
blob9f09e26422fab1f523b5c256542f4dca132d5fc6
1 /*
2 * Grace - GRaphing, Advanced Computation and Exploration of data
3 *
4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/
5 *
6 * Copyright (c) 2004 Grace Development Team
7 *
8 * Maintained by Evgeny Stambulchik
9 *
11 * All Rights Reserved
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 /* Region UI */
30 #include <stdlib.h>
32 #include "explorer.h"
33 #include "protos.h"
35 RegionUI *create_region_ui(ExplorerUI *eui)
37 RegionUI *ui;
38 Widget form;
40 form = CreateVContainer(eui->scrolled_window);
41 AddHelpCB(form, "doc/UsersGuide.html#region-properties");
43 ui = xmalloc(sizeof(ProjectUI));
45 ui->top = form;
47 ui->type = CreateOptionChoiceVA(form, "Type:",
48 "Polygon", REGION_POLYGON,
49 "Band", REGION_BAND,
50 /* "Formula", REGION_FORMULA, */
51 NULL);
52 AddOptionChoiceCB(ui->type, oc_explorer_cb, eui);
54 ui->color = CreateColorChoice(form, "Color:");
55 AddOptionChoiceCB(ui->color, oc_explorer_cb, eui);
57 return ui;
60 void update_region_ui(RegionUI *ui, Quark *q)
62 region *r = region_get_data(q);
63 if (ui && r) {
64 SetOptionChoice(ui->type, r->type);
65 SetOptionChoice(ui->color, r->color);
69 int set_region_data(RegionUI *ui, Quark *q, void *caller)
71 int retval = RETURN_SUCCESS;
73 if (ui && q) {
74 if (!caller || caller == ui->type) {
75 region_set_type(q, GetOptionChoice(ui->type));
77 if (!caller || caller == ui->color) {
78 region_set_color(q, GetOptionChoice(ui->color));
82 return retval;