~ubuntu-branches/ubuntu/raring/gdis/raring-proposed

« back to all changes in this revision

Viewing changes to elem.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Leidert (dale)
  • Date: 2009-04-06 17:12:18 UTC
  • mfrom: (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090406171218-uizoe126jrq09ytt
Tags: 0.90-1
* New upstream release 0.90.
* Acknowledge NMU (closes: #492994). Thanks to Neil Williams.

* makefile.debian: Upstream doesn't provide a Makefile to edit - so created
  our own.
* debian/compat: Added and set to be 5.
* debian/control: Added Homepage, Vcs* and DM-Upload-Allowed fields.
  (Maintainer): Set to the debichem team with approval by Noèl.
  (Uploaders): Added myself.
  (Build-Depends): Increased debhelper version to 5. Removed glutg3-dev.
  Added dpatch.
  (Standards-Version): Bumped to 3.8.1.
  (Description): Removed homepage. Fixed a typo.
* debian/copyright: Updated, completed and adjusted.
* debian/dirs: Dropped useless file.
* debian/docs: Renamed to debian/gdis.docs.
* debian/menu: Renamed to debian/gdis.menu.
  (section): Fixed accordingly to policy.
* debian/gdis.1: Just some formatting changes.
* debian/gdis.desktop: Added file (with small fixes) provided by Phill Bull
  (LP: #111353).
* debian/gdis.install: Added.
* debian/rules: Cleaned. Installation is now done by dh_install. Make sure,
  the CVS directory is not copied. Added dh_desktop call.
* debian/source.lintian-overrides: makefile.debian is created for Debian but
  lives outside debian/.
* debian/watch: Added.
* debian/README.build: Dropped.
* debian/README.source: Added to be compliant to the policy v3.8.
* debian/patches/Debian_make.dpatch: Added.
  - gdis.h (ELEM_FILE): Moved fix for gdis.elemts path (#399132) to this
    patch.
* debian/patches/00list: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include "surface.h"
38
38
#include "select.h"
39
39
#include "interface.h"
40
 
#include "shortcuts.h"
 
40
#include "gui_shorts.h"
41
41
#include "opengl.h"
42
42
 
43
43
/* main structures */
318
318
          found++;
319
319
        break;
320
320
 
 
321
      case LABEL_FF:
 
322
        if (g_ascii_strcasecmp(types->data, core->atom_type) == 0)
 
323
          found++;
 
324
        break;
 
325
 
321
326
      case LABEL:
322
327
      case LABEL_NORMAL:
323
328
      case LABEL_GHOST:
338
343
        unique = g_slist_prepend(unique, GINT_TO_POINTER(core->atom_code));
339
344
        break;
340
345
      case LABEL:
341
 
        unique = g_slist_prepend(unique, g_strdup(core->atom_label));
 
346
        if (core->atom_label)
 
347
          unique = g_slist_prepend(unique, g_strdup(core->atom_label));
342
348
        break;
343
349
      case LABEL_NORMAL:
344
 
        if (!core->ghost)
345
 
          unique = g_slist_prepend(unique, g_strdup(core->atom_label));
 
350
        if (core->atom_label)
 
351
          if (!core->ghost)
 
352
            unique = g_slist_prepend(unique, g_strdup(core->atom_label));
346
353
        break;
347
354
      case LABEL_GHOST:
348
 
        if (core->ghost)
349
 
          unique = g_slist_prepend(unique, g_strdup(core->atom_label));
 
355
        if (core->atom_label)
 
356
          if (core->ghost)
 
357
            unique = g_slist_prepend(unique, g_strdup(core->atom_label));
 
358
        break;
 
359
      case LABEL_FF:
 
360
        if (core->atom_type)
 
361
          unique = g_slist_prepend(unique, g_strdup(core->atom_type));
350
362
        break;
351
363
      }
352
364
    }
364
376
    case LABEL:
365
377
    case LABEL_NORMAL:
366
378
    case LABEL_GHOST:
 
379
    case LABEL_FF:
367
380
      printf("[%s] ", (gchar *) types->data);
368
381
      break;
369
382
    }
803
816
  }
804
817
}
805
818
 
806
 
/* globals for the atom properties dialog */
807
 
GtkWidget *apd_label, *apd_type, *apd_charge, *apd_x, *apd_y, *apd_z;
808
 
GtkWidget *apd_growth, *apd_region, *apd_translate;
809
 
struct model_pak *apd_data=NULL;
810
 
struct core_pak *apd_core=NULL;
811
 
 
812
819
/*************************************************************/
813
820
/* get the nth colour in a sequence (eg sample RGB spectrum) */
814
821
/*************************************************************/
949
956
  }
950
957
}
951
958
 
952
 
/***********************************************/
953
 
/* change the properties of all selected atoms */
954
 
/***********************************************/
955
 
/* NB: this is a bit dangerous as you change everything in the */
956
 
/* selection to the specified value - even (eg) incompatible elements */
957
 
void selection_properties_change(gint type)
958
 
{
959
 
gint n, growth, region, translate;
960
 
gdouble charge;
961
 
const gchar *text;
962
 
GSList *list;
963
 
struct elem_pak edata;
964
 
struct model_pak *model;
965
 
struct core_pak *core;
966
 
 
967
 
model = sysenv.active_model;
968
 
if (!model)
969
 
  return;
970
 
if (!model->selection)
971
 
  return;
972
 
 
973
 
switch (type)
974
 
  {
975
 
  case NAME:
976
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_label));
977
 
    n = elem_symbol_test(text);
978
 
    if (n)
979
 
      {
980
 
      get_elem_data(n, &edata, model);
981
 
/* make sure we alow enough space for the string and the \0 */
982
 
      n = (LABEL_SIZE-1 > strlen(text)) ? strlen(text) : LABEL_SIZE-1;
983
 
      for (list=model->selection ; list ; list=g_slist_next(list))
984
 
        {
985
 
        core = list->data;
986
 
        g_free(core->atom_label);
987
 
        core->atom_label = g_strdup(text);
988
 
/* update atttached shell */
989
 
        if (core->shell)
990
 
          {
991
 
          struct shel_pak *shell = core->shell;
992
 
          g_free(shell->shell_label);
993
 
          shell->shell_label = g_strdup(text);
994
 
          }
995
 
/* NEW - don't update element specific data if the element type was not */
996
 
/* changed - ie the user has just made a labelling change (eg C -> C1) */
997
 
        if (edata.number != core->atom_code)
998
 
          {
999
 
          core->atom_code = edata.number;
1000
 
          core->bond_cutoff = edata.cova;
1001
 
          }
1002
 
        init_atom_colour(core, model);
1003
 
        init_atom_charge(core, model);
1004
 
        }
1005
 
/* model updates */
1006
 
      g_slist_free(model->unique_atom_list);
1007
 
      model->unique_atom_list = find_unique(ELEMENT, model);
1008
 
      calc_emp(model);
1009
 
      }
1010
 
    break;
1011
 
 
1012
 
  case CHARGE:
1013
 
    charge = str_to_float(gtk_entry_get_text(GTK_ENTRY(apd_charge)));
1014
 
    for (list=model->selection ; list ; list=g_slist_next(list))
1015
 
      {
1016
 
      core = list->data;
1017
 
/* core updates */
1018
 
      core->charge = charge;
1019
 
      core->lookup_charge = FALSE;
1020
 
      }
1021
 
    calc_emp(model);
1022
 
    break;
1023
 
 
1024
 
  case CORE_GROWTH_SLICE:
1025
 
    growth = str_to_float(gtk_entry_get_text(GTK_ENTRY(apd_growth)));
1026
 
    growth = CLAMP(growth, 0, 1);
1027
 
    for (list=model->selection ; list ; list=g_slist_next(list))
1028
 
      {
1029
 
      core = list->data;
1030
 
      core->growth = growth;
1031
 
      if (model->colour_scheme == GROWTH_SLICE)
1032
 
        atom_colour_scheme(GROWTH_SLICE, core, model);
1033
 
      }
1034
 
    break;
1035
 
 
1036
 
  case CORE_REGION:
1037
 
    region = str_to_float(gtk_entry_get_text(GTK_ENTRY(apd_region)));
1038
 
    if (region > model->region_max)
1039
 
      model->region_max = region;
1040
 
 
1041
 
    for (list=model->selection ; list ; list=g_slist_next(list))
1042
 
      {
1043
 
      core = list->data;
1044
 
      core->region = region;
1045
 
      if (core->shell)
1046
 
        (core->shell)->region = region;
1047
 
 
1048
 
      if (model->colour_scheme == REGION)
1049
 
        atom_colour_scheme(REGION, core, model);
1050
 
      }
1051
 
    break;
1052
 
 
1053
 
  case CORE_TRANSLATE:
1054
 
    translate = str_to_float(gtk_entry_get_text(GTK_ENTRY(apd_translate)));
1055
 
    translate = CLAMP(translate, 0, 1);
1056
 
    for (list=model->selection ; list ; list=g_slist_next(list))
1057
 
      {
1058
 
      core = list->data;
1059
 
      core->translate = translate;
1060
 
      if (core->shell)
1061
 
        (core->shell)->translate = translate;
1062
 
 
1063
 
      if (model->colour_scheme == TRANSLATE)
1064
 
        atom_colour_scheme(TRANSLATE, core, model);
1065
 
      }
1066
 
    break;
1067
 
 
1068
 
  case CORE_FF:
1069
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_type));
1070
 
    for (list=model->selection ; list ; list=g_slist_next(list))
1071
 
      {
1072
 
      core = list->data;
1073
 
      if (core->atom_type)
1074
 
        g_free(core->atom_type);
1075
 
      core->atom_type = g_strdup(text);
1076
 
      }
1077
 
    break;
1078
 
  }
1079
 
 
1080
 
gui_refresh(GUI_MODEL_PROPERTIES);
1081
 
gui_refresh(GUI_CANVAS);
1082
 
}
1083
 
 
1084
 
/*****************************/
1085
 
/* commit changes to an atom */
1086
 
/*****************************/
1087
 
void atom_properties_change(GtkWidget *w, gint type)
1088
 
{
1089
 
gint n, growth, region, translate;
1090
 
const gchar *text;
1091
 
struct elem_pak edata;
1092
 
struct model_pak *model;
1093
 
 
1094
 
model = sysenv.active_model;
1095
 
if (!model)
1096
 
  return;
1097
 
 
1098
 
/* act on multiple atoms? */
1099
 
if (g_slist_length(model->selection) > 1)
1100
 
  {
1101
 
  selection_properties_change(type);
1102
 
  return;
1103
 
  }
1104
 
 
1105
 
if (!apd_core)
1106
 
  return;
1107
 
 
1108
 
switch(type)
1109
 
  {
1110
 
  case NAME:
1111
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_label));
1112
 
    g_free(apd_core->atom_label);
1113
 
    apd_core->atom_label = g_strdup(text);
1114
 
    n = elem_symbol_test(text);
1115
 
 
1116
 
/* update atttached shell */
1117
 
if (apd_core->shell)
1118
 
  {
1119
 
  struct shel_pak *shell = apd_core->shell;
1120
 
  g_free(shell->shell_label);
1121
 
  shell->shell_label = g_strdup(text);
1122
 
  }
1123
 
 
1124
 
/* if recognized -> update */
1125
 
    if (n)
1126
 
      {
1127
 
      get_elem_data(n, &edata, model);
1128
 
 
1129
 
/* NEW - don't update element specific data if the element type was not */
1130
 
/* changed - ie the user has just made a labelling change (eg C -> C1) */
1131
 
      if (n != apd_core->atom_code)
1132
 
        {
1133
 
        apd_core->atom_code = n;
1134
 
        apd_core->bond_cutoff = edata.cova;
1135
 
        }
1136
 
      init_atom_colour(apd_core, model);
1137
 
      init_atom_charge(apd_core, model);
1138
 
 
1139
 
      g_slist_free(model->unique_atom_list);
1140
 
      model->unique_atom_list = find_unique(ELEMENT, model);
1141
 
      calc_emp(model);
1142
 
 
1143
 
/* REFRESH */
1144
 
      gui_refresh(GUI_MODEL_PROPERTIES);
1145
 
      }
1146
 
    break;
1147
 
 
1148
 
  case CORE_FF:
1149
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_type));
1150
 
    if (apd_core->atom_type)
1151
 
      g_free(apd_core->atom_type);
1152
 
    apd_core->atom_type = g_strdup(text);
1153
 
    break;
1154
 
 
1155
 
  case CHARGE:
1156
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_charge));
1157
 
    apd_core->charge = str_to_float(text);
1158
 
    apd_core->lookup_charge = FALSE;
1159
 
    calc_emp(model);
1160
 
    break;
1161
 
 
1162
 
  case COORD_X:
1163
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_x));
1164
 
    apd_core->x[0] = str_to_float(text);
1165
 
    coords_compute(model);
1166
 
    break;
1167
 
 
1168
 
  case COORD_Y:
1169
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_y));
1170
 
    apd_core->x[1] = str_to_float(text);
1171
 
    coords_compute(model);
1172
 
    break;
1173
 
 
1174
 
  case COORD_Z:
1175
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_z));
1176
 
    apd_core->x[2] = str_to_float(text);
1177
 
    coords_compute(model);
1178
 
    break;
1179
 
 
1180
 
  case CORE_GROWTH_SLICE:
1181
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_growth));
1182
 
    growth = CLAMP(str_to_float(text), 0, 1);
1183
 
    apd_core->growth = growth;
1184
 
    if (model->colour_scheme == GROWTH_SLICE)
1185
 
      atom_colour_scheme(GROWTH_SLICE, apd_core, model);
1186
 
    break;
1187
 
 
1188
 
  case CORE_REGION:
1189
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_region));
1190
 
    region = str_to_float(text);
1191
 
    if (region > model->region_max)
1192
 
      model->region_max = region;
1193
 
    apd_core->region = region;
1194
 
    if (apd_core->shell)
1195
 
      (apd_core->shell)->region = region;
1196
 
    if (model->colour_scheme == REGION)
1197
 
      atom_colour_scheme(REGION, apd_core, model);
1198
 
    break;
1199
 
 
1200
 
  case CORE_TRANSLATE:
1201
 
    text = gtk_entry_get_text(GTK_ENTRY(apd_translate));
1202
 
    translate = CLAMP(str_to_float(text), 0, 1);
1203
 
    apd_core->translate = translate;
1204
 
    if (apd_core->shell)
1205
 
      (apd_core->shell)->translate = translate;
1206
 
    if (model->colour_scheme == TRANSLATE)
1207
 
      atom_colour_scheme(TRANSLATE, apd_core, model);
1208
 
    break;
1209
 
 
1210
 
  default:
1211
 
    printf("Not yet modifiable...\n");
1212
 
  }
1213
 
gui_refresh(GUI_CANVAS);
1214
 
}
1215
 
 
1216
 
/*************************************/
1217
 
/* updates the dialog for a new atom */
1218
 
/*************************************/
1219
 
void gui_refresh_selection(void)
1220
 
{
1221
 
gdouble q;
1222
 
gchar *element, *label, *type, *charge, *x, *y, *z, *growth, *region, *translate;
1223
 
struct core_pak *core;
1224
 
struct model_pak *model;
1225
 
 
1226
 
model = sysenv.active_model;
1227
 
core = NULL;
1228
 
if (model)
1229
 
  {
1230
 
  GSList *list = model->selection;
1231
 
  if (g_slist_length(list) == 1)
1232
 
    core = list->data;
1233
 
  }
1234
 
 
1235
 
if (core && model)
1236
 
  {
1237
 
/* data available */
1238
 
  element = g_strdup(elements[core->atom_code].symbol);
1239
 
  label = g_strdup(core->atom_label);
1240
 
 
1241
 
  if (core->atom_type)
1242
 
    type = g_strdup(core->atom_type);
1243
 
  else
1244
 
    type = g_strdup("");
1245
 
 
1246
 
  q = atom_charge(core); /* Replaced by C. Fisher 2004 */
1247
 
  charge = g_strdup_printf("%9.4f", q);
1248
 
 
1249
 
  x = g_strdup_printf("%9.4f", core->x[0]);
1250
 
  y = g_strdup_printf("%9.4f", core->x[1]);
1251
 
  z = g_strdup_printf("%9.4f", core->x[2]);
1252
 
 
1253
 
  growth = g_strdup_printf("%d", core->growth);
1254
 
  region = g_strdup_printf("%d", core->region);
1255
 
  translate = g_strdup_printf("%d", core->translate);
1256
 
 
1257
 
  apd_core = core;
1258
 
  }
1259
 
else
1260
 
  {
1261
 
/* otherwise defaults */
1262
 
  element = g_strdup("");
1263
 
  label = g_strdup("");
1264
 
  type = g_strdup("");
1265
 
  charge = g_strdup("");
1266
 
  x = g_strdup("");
1267
 
  y = g_strdup("");
1268
 
  z = g_strdup("");
1269
 
  growth = g_strdup("");
1270
 
  region = g_strdup("");
1271
 
  translate = g_strdup("");
1272
 
  }
1273
 
 
1274
 
/* prevent changes from messing up the atom_properties_change() callback */
1275
 
apd_data = NULL;
1276
 
 
1277
 
/* entry updates */
1278
 
gtk_entry_set_text(GTK_ENTRY(apd_label), label);
1279
 
gtk_entry_set_text(GTK_ENTRY(apd_type), type);
1280
 
gtk_entry_set_text(GTK_ENTRY(apd_charge), charge);
1281
 
gtk_entry_set_text(GTK_ENTRY(apd_x), x);
1282
 
gtk_entry_set_text(GTK_ENTRY(apd_y), y);
1283
 
gtk_entry_set_text(GTK_ENTRY(apd_z), z);
1284
 
gtk_entry_set_text(GTK_ENTRY(apd_growth), growth);
1285
 
gtk_entry_set_text(GTK_ENTRY(apd_region), region);
1286
 
gtk_entry_set_text(GTK_ENTRY(apd_translate), translate);
1287
 
 
1288
 
apd_data = model;
1289
 
 
1290
 
/* cleanup */
1291
 
g_free(element);
1292
 
g_free(label);
1293
 
g_free(type);
1294
 
g_free(charge);
1295
 
g_free(x);
1296
 
g_free(y);
1297
 
g_free(z);
1298
 
g_free(growth);
1299
 
g_free(region);
1300
 
g_free(translate);
1301
 
}
1302
 
 
1303
 
/*******************************************/
1304
 
/* display the properties of a single atom */
1305
 
/*******************************************/
1306
 
void gui_edit_widget(GtkWidget *box)
1307
 
{
1308
 
GtkWidget *frame, *hbox, *vbox, *entry;
1309
 
 
1310
 
/* checks */
1311
 
g_return_if_fail(box != NULL);
1312
 
 
1313
 
/* two column element data display */
1314
 
hbox = gtk_hbox_new(FALSE, 0);
1315
 
gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 0);
1316
 
 
1317
 
/* left vbox - titles */
1318
 
vbox = gtk_vbox_new(TRUE, 0);
1319
 
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
1320
 
 
1321
 
/* TODO - put in a for loop? */
1322
 
 
1323
 
entry = gtk_entry_new();
1324
 
gtk_entry_set_text(GTK_ENTRY(entry), "Label");
1325
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1326
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1327
 
 
1328
 
entry = gtk_entry_new();
1329
 
gtk_entry_set_text(GTK_ENTRY(entry), "FF Type");
1330
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1331
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1332
 
 
1333
 
entry = gtk_entry_new();
1334
 
gtk_entry_set_text(GTK_ENTRY(entry), "X");
1335
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1336
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1337
 
 
1338
 
entry = gtk_entry_new();
1339
 
gtk_entry_set_text(GTK_ENTRY(entry), "Y");
1340
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1341
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1342
 
 
1343
 
entry = gtk_entry_new();
1344
 
gtk_entry_set_text(GTK_ENTRY(entry), "Z");
1345
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1346
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1347
 
 
1348
 
entry = gtk_entry_new();
1349
 
gtk_entry_set_text(GTK_ENTRY(entry), "Charge");
1350
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1351
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1352
 
 
1353
 
entry = gtk_entry_new();
1354
 
gtk_entry_set_text(GTK_ENTRY(entry), "Growth");
1355
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1356
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1357
 
 
1358
 
entry = gtk_entry_new();
1359
 
gtk_entry_set_text(GTK_ENTRY(entry), "Region");
1360
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1361
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1362
 
 
1363
 
entry = gtk_entry_new();
1364
 
gtk_entry_set_text(GTK_ENTRY(entry), "Translate");
1365
 
gtk_entry_set_editable(GTK_ENTRY(entry), FALSE);
1366
 
gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
1367
 
 
1368
 
/* right vbox - data */
1369
 
vbox = gtk_vbox_new(TRUE, 0);
1370
 
gtk_box_pack_end(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
1371
 
 
1372
 
apd_label = gtk_entry_new();
1373
 
gtk_box_pack_start(GTK_BOX(vbox), apd_label, FALSE, FALSE, 0);
1374
 
 
1375
 
apd_type = gtk_entry_new();
1376
 
gtk_box_pack_start(GTK_BOX(vbox), apd_type, FALSE, FALSE, 0);
1377
 
 
1378
 
apd_x = gtk_entry_new();
1379
 
gtk_box_pack_start(GTK_BOX(vbox), apd_x, FALSE, FALSE, 0);
1380
 
 
1381
 
apd_y = gtk_entry_new();
1382
 
gtk_box_pack_start(GTK_BOX(vbox), apd_y, FALSE, FALSE, 0);
1383
 
 
1384
 
apd_z = gtk_entry_new();
1385
 
gtk_box_pack_start(GTK_BOX(vbox), apd_z, FALSE, FALSE, 0);
1386
 
 
1387
 
apd_charge = gtk_entry_new();
1388
 
gtk_box_pack_start(GTK_BOX(vbox), apd_charge, FALSE, FALSE, 0);
1389
 
 
1390
 
apd_growth = gtk_entry_new();
1391
 
gtk_box_pack_start(GTK_BOX(vbox), apd_growth, FALSE, FALSE, 0);
1392
 
 
1393
 
apd_region = gtk_entry_new();
1394
 
gtk_box_pack_start(GTK_BOX(vbox), apd_region, FALSE, FALSE, 0);
1395
 
 
1396
 
apd_translate = gtk_entry_new();
1397
 
gtk_box_pack_start(GTK_BOX(vbox), apd_translate, FALSE, FALSE, 0);
1398
 
 
1399
 
/* attach callbacks (NB: set initial data first) */
1400
 
g_signal_connect(GTK_OBJECT(apd_label), "activate",
1401
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(NAME));
1402
 
g_signal_connect(GTK_OBJECT(apd_type), "activate",
1403
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(CORE_FF));
1404
 
 
1405
 
g_signal_connect(GTK_OBJECT(apd_x), "activate",
1406
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(COORD_X));
1407
 
g_signal_connect(GTK_OBJECT(apd_y), "activate",
1408
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(COORD_Y));
1409
 
g_signal_connect(GTK_OBJECT(apd_z), "activate",
1410
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(COORD_Z));
1411
 
 
1412
 
g_signal_connect(GTK_OBJECT(apd_charge), "activate",
1413
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(CHARGE));
1414
 
 
1415
 
g_signal_connect(GTK_OBJECT(apd_growth), "activate",
1416
 
                 GTK_SIGNAL_FUNC(atom_properties_change),
1417
 
                 GINT_TO_POINTER(CORE_GROWTH_SLICE));
1418
 
 
1419
 
g_signal_connect(GTK_OBJECT(apd_region), "activate",
1420
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(CORE_REGION));
1421
 
g_signal_connect(GTK_OBJECT(apd_translate), "activate",
1422
 
                 GTK_SIGNAL_FUNC(atom_properties_change), GINT_TO_POINTER(CORE_TRANSLATE));
1423
 
 
1424
 
/* CURRENT */
1425
 
frame = gtk_frame_new(NULL);
1426
 
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0);
1427
 
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
1428
 
vbox = gtk_vbox_new(TRUE, 1);
1429
 
gtk_container_add(GTK_CONTAINER(frame), vbox);
1430
 
 
1431
 
gui_button_x("Add atoms", gtk_mode_switch, (gpointer) ATOM_ADD, vbox);
1432
 
gui_button_x("Add bonds", gtk_mode_switch, (gpointer) BOND_SINGLE, vbox);
1433
 
gui_button_x("Delete bonds", gtk_mode_switch, (gpointer) BOND_DELETE, vbox);
1434
 
gui_button_x("Normal mode", gtk_mode_switch, (gpointer) FREE, vbox);
1435
 
 
1436
 
frame = gtk_frame_new(NULL);
1437
 
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0);
1438
 
gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING);
1439
 
vbox = gtk_vbox_new(TRUE, 1);
1440
 
gtk_container_add(GTK_CONTAINER(frame), vbox);
1441
 
 
1442
 
gui_button_x("Mark as ghost", select_flag_ghost, NULL, vbox);
1443
 
gui_button_x("Mark as normal", select_flag_normal, NULL, vbox);
1444
 
}