~ubuntu-branches/ubuntu/karmic/gmsh/karmic

« back to all changes in this revision

Viewing changes to Fltk/GUI.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Daniel Leidert
  • Date: 2008-05-18 12:46:05 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080518124605-716xqbqeo07o497k
Tags: 2.2.0-2
[Christophe Prud'homme]
* Bug fix: "gmsh ships no .desktop", thanks to Vassilis Pandis (Closes:
  #375770). Applied the Ubuntu patch.

[Daniel Leidert]
* debian/control (Vcs-Svn): Fixed.
  (Build-Depends): Use texlive instead of tetex-bin.
* debian/gmsh.doc-base (Section): Fixed accordingly to doc-base (>= 0.8.10).
* debian/rules: Removed some variable declarations, that lead to double
  configuration and seem to be useless.
  (build/gmsh): Try to avoid multiple runs by using a stamp.
  (orig-tarball): Renamed to get-orig-source and changed to use uscan.
* debian/watch: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: GUI.cpp,v 1.623 2007-06-12 07:04:08 geuzaine Exp $
 
1
// $Id: GUI.cpp,v 1.680 2008-04-16 15:15:22 sabarieg Exp $
2
2
//
3
 
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 
3
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
4
4
//
5
5
// This program is free software; you can redistribute it and/or modify
6
6
// it under the terms of the GNU General Public License as published by
19
19
// 
20
20
// Please report all bugs and problems to <gmsh@geuz.org>.
21
21
 
22
 
#include "Gmsh.h"
 
22
#include <string>
 
23
#include <sstream>
23
24
#include "GmshUI.h"
24
25
#include "GmshDefines.h"
 
26
#include "Message.h"
25
27
#include "Numeric.h"
26
28
#include "Context.h"
27
29
#include "Options.h"
35
37
#include "Solvers.h"
36
38
#include "PluginManager.h"
37
39
#include "Shortcut_Window.h"
 
40
#include "PView.h"
 
41
#include "Field.h"
 
42
#include "GModel.h"
 
43
#include "GeoStringInterface.h"
38
44
 
39
45
#define NB_BUTT_SCROLL 25
40
46
#define NB_HISTORY_MAX 1000
158
164
      {0} 
159
165
    };  
160
166
        Context_Item menu_geometry_elementary_add[] = {
161
 
          {"0Geometry>Elementary>Add", NULL} ,
 
167
          {"0Geometry>Elementary>Add", NULL} ,
162
168
          {"New",       (Fl_Callback *)geometry_elementary_add_new_cb} ,
163
 
          {"Translate", (Fl_Callback *)geometry_elementary_add_translate_cb} ,
164
 
          {"Rotate",    (Fl_Callback *)geometry_elementary_add_rotate_cb} ,
165
 
          {"Scale",     (Fl_Callback *)geometry_elementary_add_scale_cb} ,
166
 
          {"Symmetry",  (Fl_Callback *)geometry_elementary_add_symmetry_cb} ,
167
 
          {0} 
168
 
        };  
 
169
          {"Translate", (Fl_Callback *)geometry_elementary_add_translate_cb} ,
 
170
          {"Rotate",    (Fl_Callback *)geometry_elementary_add_rotate_cb} ,
 
171
          {"Scale",     (Fl_Callback *)geometry_elementary_add_scale_cb} ,
 
172
          {"Symmetry",  (Fl_Callback *)geometry_elementary_add_symmetry_cb} ,
 
173
          {0} 
 
174
        };  
169
175
            Context_Item menu_geometry_elementary_add_new[] = {
170
 
              {"0Geometry>Elementary>Add>New", NULL} ,
 
176
              {"0Geometry>Elementary>Add>New", NULL} ,
171
177
              {"Parameter",     (Fl_Callback *)geometry_elementary_add_new_parameter_cb} ,
172
 
              {"Point",         (Fl_Callback *)geometry_elementary_add_new_point_cb} ,
173
 
              {"Straight line", (Fl_Callback *)geometry_elementary_add_new_line_cb} ,
174
 
              {"Spline",        (Fl_Callback *)geometry_elementary_add_new_spline_cb} ,
175
 
              {"B-Spline",      (Fl_Callback *)geometry_elementary_add_new_bspline_cb} ,
176
 
              {"Circle arc",    (Fl_Callback *)geometry_elementary_add_new_circle_cb} ,
177
 
              {"Ellipse arc",   (Fl_Callback *)geometry_elementary_add_new_ellipse_cb} ,
178
 
              {"Plane surface", (Fl_Callback *)geometry_elementary_add_new_planesurface_cb} ,
179
 
              {"Ruled surface", (Fl_Callback *)geometry_elementary_add_new_ruledsurface_cb} ,
180
 
              {"Volume",        (Fl_Callback *)geometry_elementary_add_new_volume_cb} ,
181
 
              {0} 
182
 
            };  
 
178
              {"Point",         (Fl_Callback *)geometry_elementary_add_new_point_cb} ,
 
179
              {"Straight line", (Fl_Callback *)geometry_elementary_add_new_line_cb} ,
 
180
              {"Spline",        (Fl_Callback *)geometry_elementary_add_new_spline_cb} ,
 
181
              {"B-Spline",      (Fl_Callback *)geometry_elementary_add_new_bspline_cb} ,
 
182
              {"Circle arc",    (Fl_Callback *)geometry_elementary_add_new_circle_cb} ,
 
183
              {"Ellipse arc",   (Fl_Callback *)geometry_elementary_add_new_ellipse_cb} ,
 
184
              {"Plane surface", (Fl_Callback *)geometry_elementary_add_new_planesurface_cb} ,
 
185
              {"Ruled surface", (Fl_Callback *)geometry_elementary_add_new_ruledsurface_cb} ,
 
186
              {"Volume",        (Fl_Callback *)geometry_elementary_add_new_volume_cb} ,
 
187
              {0} 
 
188
            };  
183
189
            Context_Item menu_geometry_elementary_add_translate[] = {
184
 
              {"0Geometry>Elementary>Add>Translate", NULL} ,
 
190
              {"0Geometry>Elementary>Add>Translate", NULL} ,
185
191
              {"Point",   (Fl_Callback *)geometry_elementary_add_translate_point_cb} ,
186
 
              {"Line",    (Fl_Callback *)geometry_elementary_add_translate_line_cb} ,
187
 
              {"Surface", (Fl_Callback *)geometry_elementary_add_translate_surface_cb} ,
188
 
              {0} 
189
 
            };  
 
192
              {"Line",    (Fl_Callback *)geometry_elementary_add_translate_line_cb} ,
 
193
              {"Surface", (Fl_Callback *)geometry_elementary_add_translate_surface_cb} ,
 
194
              {0} 
 
195
            };  
190
196
            Context_Item menu_geometry_elementary_add_rotate[] = {
191
 
              {"0Geometry>Elementary>Add>Rotate", NULL} ,
 
197
              {"0Geometry>Elementary>Add>Rotate", NULL} ,
192
198
              {"Point",   (Fl_Callback *)geometry_elementary_add_rotate_point_cb} ,
193
 
              {"Line",    (Fl_Callback *)geometry_elementary_add_rotate_line_cb} ,
194
 
              {"Surface", (Fl_Callback *)geometry_elementary_add_rotate_surface_cb} ,
195
 
              {0} 
196
 
            };  
 
199
              {"Line",    (Fl_Callback *)geometry_elementary_add_rotate_line_cb} ,
 
200
              {"Surface", (Fl_Callback *)geometry_elementary_add_rotate_surface_cb} ,
 
201
              {0} 
 
202
            };  
197
203
            Context_Item menu_geometry_elementary_add_scale[] = {
198
 
              {"0Geometry>Elementary>Add>Scale", NULL} ,
199
 
              {"Point",   (Fl_Callback *)geometry_elementary_add_scale_point_cb} ,
200
 
              {"Line",    (Fl_Callback *)geometry_elementary_add_scale_line_cb} ,
201
 
              {"Surface", (Fl_Callback *)geometry_elementary_add_scale_surface_cb} ,
202
 
              {0} 
203
 
            };  
 
204
              {"0Geometry>Elementary>Add>Scale", NULL} ,
 
205
              {"Point",   (Fl_Callback *)geometry_elementary_add_scale_point_cb} ,
 
206
              {"Line",    (Fl_Callback *)geometry_elementary_add_scale_line_cb} ,
 
207
              {"Surface", (Fl_Callback *)geometry_elementary_add_scale_surface_cb} ,
 
208
              {0} 
 
209
            };  
204
210
            Context_Item menu_geometry_elementary_add_symmetry[] = {
205
 
              {"0Geometry>Elementary>Add>Symmetry", NULL} ,
206
 
              {"Point",   (Fl_Callback *)geometry_elementary_add_symmetry_point_cb} ,
207
 
              {"Line",    (Fl_Callback *)geometry_elementary_add_symmetry_line_cb} ,
208
 
              {"Surface", (Fl_Callback *)geometry_elementary_add_symmetry_surface_cb} ,
209
 
              {0} 
210
 
            };  
 
211
              {"0Geometry>Elementary>Add>Symmetry", NULL} ,
 
212
              {"Point",   (Fl_Callback *)geometry_elementary_add_symmetry_point_cb} ,
 
213
              {"Line",    (Fl_Callback *)geometry_elementary_add_symmetry_line_cb} ,
 
214
              {"Surface", (Fl_Callback *)geometry_elementary_add_symmetry_surface_cb} ,
 
215
              {0} 
 
216
            };  
211
217
        Context_Item menu_geometry_elementary_translate[] = {
212
 
          {"0Geometry>Elementary>Translate", NULL} ,
213
 
          {"Point",   (Fl_Callback *)geometry_elementary_translate_point_cb} ,
214
 
          {"Line",    (Fl_Callback *)geometry_elementary_translate_line_cb} ,
215
 
          {"Surface", (Fl_Callback *)geometry_elementary_translate_surface_cb} ,
216
 
          {0} 
217
 
        };  
 
218
          {"0Geometry>Elementary>Translate", NULL} ,
 
219
          {"Point",   (Fl_Callback *)geometry_elementary_translate_point_cb} ,
 
220
          {"Line",    (Fl_Callback *)geometry_elementary_translate_line_cb} ,
 
221
          {"Surface", (Fl_Callback *)geometry_elementary_translate_surface_cb} ,
 
222
          {0} 
 
223
        };  
218
224
        Context_Item menu_geometry_elementary_rotate[] = {
219
 
          {"0Geometry>Elementary>Rotate", NULL} ,
220
 
          {"Point",   (Fl_Callback *)geometry_elementary_rotate_point_cb} ,
221
 
          {"Line",    (Fl_Callback *)geometry_elementary_rotate_line_cb} ,
222
 
          {"Surface", (Fl_Callback *)geometry_elementary_rotate_surface_cb} ,
223
 
          {0} 
224
 
        };  
 
225
          {"0Geometry>Elementary>Rotate", NULL} ,
 
226
          {"Point",   (Fl_Callback *)geometry_elementary_rotate_point_cb} ,
 
227
          {"Line",    (Fl_Callback *)geometry_elementary_rotate_line_cb} ,
 
228
          {"Surface", (Fl_Callback *)geometry_elementary_rotate_surface_cb} ,
 
229
          {0} 
 
230
        };  
225
231
        Context_Item menu_geometry_elementary_scale[] = {
226
 
          {"0Geometry>Elementary>Scale", NULL} ,
227
 
          {"Point",   (Fl_Callback *)geometry_elementary_scale_point_cb} ,
228
 
          {"Line",    (Fl_Callback *)geometry_elementary_scale_line_cb} ,
229
 
          {"Surface", (Fl_Callback *)geometry_elementary_scale_surface_cb} ,
230
 
          {0} 
231
 
        };  
 
232
          {"0Geometry>Elementary>Scale", NULL} ,
 
233
          {"Point",   (Fl_Callback *)geometry_elementary_scale_point_cb} ,
 
234
          {"Line",    (Fl_Callback *)geometry_elementary_scale_line_cb} ,
 
235
          {"Surface", (Fl_Callback *)geometry_elementary_scale_surface_cb} ,
 
236
          {0} 
 
237
        };  
232
238
        Context_Item menu_geometry_elementary_symmetry[] = {
233
 
          {"0Geometry>Elementary>Symmetry", NULL} ,
234
 
          {"Point",   (Fl_Callback *)geometry_elementary_symmetry_point_cb} ,
235
 
          {"Line",    (Fl_Callback *)geometry_elementary_symmetry_line_cb} ,
236
 
          {"Surface", (Fl_Callback *)geometry_elementary_symmetry_surface_cb} ,
237
 
          {0} 
238
 
        };  
 
239
          {"0Geometry>Elementary>Symmetry", NULL} ,
 
240
          {"Point",   (Fl_Callback *)geometry_elementary_symmetry_point_cb} ,
 
241
          {"Line",    (Fl_Callback *)geometry_elementary_symmetry_line_cb} ,
 
242
          {"Surface", (Fl_Callback *)geometry_elementary_symmetry_surface_cb} ,
 
243
          {0} 
 
244
        };  
239
245
        Context_Item menu_geometry_elementary_extrude[] = {
240
 
          {"0Geometry>Elementary>Extrude", NULL} ,
241
 
          {"Translate", (Fl_Callback *)geometry_elementary_extrude_translate_cb} ,
242
 
          {"Rotate",    (Fl_Callback *)geometry_elementary_extrude_rotate_cb} ,
243
 
          {0} 
244
 
        };  
 
246
          {"0Geometry>Elementary>Extrude", NULL} ,
 
247
          {"Translate", (Fl_Callback *)geometry_elementary_extrude_translate_cb} ,
 
248
          {"Rotate",    (Fl_Callback *)geometry_elementary_extrude_rotate_cb} ,
 
249
          {0} 
 
250
        };  
245
251
            Context_Item menu_geometry_elementary_extrude_translate[] = {
246
 
              {"0Geometry>Elementary>Extrude>Translate", NULL} ,
247
 
              {"Point",   (Fl_Callback *)geometry_elementary_extrude_translate_point_cb} ,
248
 
              {"Line",    (Fl_Callback *)geometry_elementary_extrude_translate_line_cb} ,
249
 
              {"Surface", (Fl_Callback *)geometry_elementary_extrude_translate_surface_cb} ,
250
 
              {0} 
251
 
            };  
 
252
              {"0Geometry>Elementary>Extrude>Translate", NULL} ,
 
253
              {"Point",   (Fl_Callback *)geometry_elementary_extrude_translate_point_cb} ,
 
254
              {"Line",    (Fl_Callback *)geometry_elementary_extrude_translate_line_cb} ,
 
255
              {"Surface", (Fl_Callback *)geometry_elementary_extrude_translate_surface_cb} ,
 
256
              {0} 
 
257
            };  
252
258
            Context_Item menu_geometry_elementary_extrude_rotate[] = {
253
 
              {"0Geometry>Elementary>Extrude>Rotate", NULL} ,
254
 
              {"Point",   (Fl_Callback *)geometry_elementary_extrude_rotate_point_cb} ,
255
 
              {"Line",    (Fl_Callback *)geometry_elementary_extrude_rotate_line_cb} ,
256
 
              {"Surface", (Fl_Callback *)geometry_elementary_extrude_rotate_surface_cb} ,
257
 
              {0} 
258
 
            };  
 
259
              {"0Geometry>Elementary>Extrude>Rotate", NULL} ,
 
260
              {"Point",   (Fl_Callback *)geometry_elementary_extrude_rotate_point_cb} ,
 
261
              {"Line",    (Fl_Callback *)geometry_elementary_extrude_rotate_line_cb} ,
 
262
              {"Surface", (Fl_Callback *)geometry_elementary_extrude_rotate_surface_cb} ,
 
263
              {0} 
 
264
            };  
259
265
        Context_Item menu_geometry_elementary_delete[] = {
260
 
          {"0Geometry>Elementary>Delete", NULL} ,
261
 
          {"Point",   (Fl_Callback *)geometry_elementary_delete_point_cb} ,
262
 
          {"Line",    (Fl_Callback *)geometry_elementary_delete_line_cb} ,
263
 
          {"Surface", (Fl_Callback *)geometry_elementary_delete_surface_cb} ,
264
 
          {0} 
265
 
        };  
 
266
          {"0Geometry>Elementary>Delete", NULL} ,
 
267
          {"Point",   (Fl_Callback *)geometry_elementary_delete_point_cb} ,
 
268
          {"Line",    (Fl_Callback *)geometry_elementary_delete_line_cb} ,
 
269
          {"Surface", (Fl_Callback *)geometry_elementary_delete_surface_cb} ,
 
270
          {0} 
 
271
        };  
266
272
    Context_Item menu_geometry_physical[] = {
267
273
      {"0Geometry>Physical", NULL} ,
268
274
      {"Add",    (Fl_Callback *)geometry_physical_add_cb} ,
269
275
      {0} 
270
276
    };  
271
277
        Context_Item menu_geometry_physical_add[] = {
272
 
          {"0Geometry>Physical>Add", NULL} ,
273
 
          {"Point",   (Fl_Callback *)geometry_physical_add_point_cb  } ,
274
 
          {"Line",    (Fl_Callback *)geometry_physical_add_line_cb  } ,
275
 
          {"Surface", (Fl_Callback *)geometry_physical_add_surface_cb  } ,
276
 
          {"Volume",  (Fl_Callback *)geometry_physical_add_volume_cb  } ,
277
 
          {0} 
278
 
        };  
 
278
          {"0Geometry>Physical>Add", NULL} ,
 
279
          {"Point",   (Fl_Callback *)geometry_physical_add_point_cb  } ,
 
280
          {"Line",    (Fl_Callback *)geometry_physical_add_line_cb  } ,
 
281
          {"Surface", (Fl_Callback *)geometry_physical_add_surface_cb  } ,
 
282
          {"Volume",  (Fl_Callback *)geometry_physical_add_volume_cb  } ,
 
283
          {0} 
 
284
        };  
279
285
 
280
286
Context_Item menu_mesh[] = {
281
287
  {"1Mesh", NULL} ,
282
288
  {"Define",       (Fl_Callback *)mesh_define_cb} ,
283
289
  {"Inspect",      (Fl_Callback *)mesh_inspect_cb} , 
284
 
  {"Edit",         (Fl_Callback *)mesh_edit_cb} , 
 
290
  {"Delete",       (Fl_Callback *)mesh_delete_cb} , 
285
291
  {"1D",           (Fl_Callback *)mesh_1d_cb} ,
286
292
  {"2D",           (Fl_Callback *)mesh_2d_cb} , 
287
293
  {"3D",           (Fl_Callback *)mesh_3d_cb} , 
288
294
  {"First order",  (Fl_Callback *)mesh_degree_cb, (void*)1 } , 
289
295
  {"Second order", (Fl_Callback *)mesh_degree_cb, (void*)2 } , 
 
296
  {"Optimize", (Fl_Callback *)mesh_optimize_cb} , 
290
297
#if defined(HAVE_NETGEN)
291
 
  {"Optimize quality", (Fl_Callback *)mesh_optimize_cb} , 
292
 
#endif
 
298
  {"Optimize (Netgen)", (Fl_Callback *)mesh_optimize_netgen_cb} , 
 
299
#endif
 
300
#if defined(HAVE_FOURIER_MODEL)
 
301
  {"Reparameterize",   (Fl_Callback *)mesh_parameterize_cb} , 
 
302
#endif
 
303
  //  {"Reclassify",   (Fl_Callback *)mesh_classify_cb} , 
293
304
  {"Save",         (Fl_Callback *)mesh_save_cb} ,
294
305
  {0} 
295
306
};  
296
 
    Context_Item menu_mesh_edit[] = {
297
 
      {"1Mesh>Edit", NULL} ,
298
 
      {"Delete", (Fl_Callback *)mesh_delete_cb} ,
299
 
      //{"Update edges",   (Fl_Callback *)mesh_update_edges_cb} ,
300
 
      {"Reparameterize", (Fl_Callback *)mesh_parameterize_cb} ,
301
 
      //{"Remesh 2D",      (Fl_Callback *)mesh_remesh_cb} , 
302
 
      {0} 
303
 
    };  
304
 
        Context_Item menu_mesh_delete[] = {
305
 
          {"1Mesh>Edit>Delete", NULL} ,
306
 
          {"Elements", (Fl_Callback *)mesh_delete_parts_cb, (void*)"elements"} ,
307
 
          {"Lines",    (Fl_Callback *)mesh_delete_parts_cb, (void*)"lines"} ,
308
 
          {"Surfaces", (Fl_Callback *)mesh_delete_parts_cb, (void*)"surfaces"} ,
309
 
          {"Volumes",  (Fl_Callback *)mesh_delete_parts_cb, (void*)"volumes"} ,
310
 
          {0} 
311
 
        };  
312
307
    Context_Item menu_mesh_define[] = {
313
308
      {"1Mesh>Define", NULL} ,
 
309
      {"Fields",      (Fl_Callback *)view_field_cb, (void*)(-1) },
314
310
      {"Characteristic length", (Fl_Callback *)mesh_define_length_cb  } ,
315
311
      {"Recombine",   (Fl_Callback *)mesh_define_recombine_cb  } ,
316
312
      {"Transfinite", (Fl_Callback *)mesh_define_transfinite_cb  } , 
317
313
      {0} 
318
314
    };  
319
315
        Context_Item menu_mesh_define_transfinite[] = {
320
 
          {"1Mesh>Define>Transfinite", NULL} ,
321
 
          {"Line",    (Fl_Callback *)mesh_define_transfinite_line_cb} ,
322
 
          {"Surface", (Fl_Callback *)mesh_define_transfinite_surface_cb} ,
323
 
          {"Volume",  (Fl_Callback *)mesh_define_transfinite_volume_cb} , 
324
 
          {0} 
325
 
        };  
 
316
          {"1Mesh>Define>Transfinite", NULL} ,
 
317
          {"Line",    (Fl_Callback *)mesh_define_transfinite_line_cb} ,
 
318
          {"Surface", (Fl_Callback *)mesh_define_transfinite_surface_cb} ,
 
319
          {"Volume",  (Fl_Callback *)mesh_define_transfinite_volume_cb} , 
 
320
          {0} 
 
321
        };  
 
322
    Context_Item menu_mesh_delete[] = {
 
323
      {"1Mesh>Edit>Delete", NULL} ,
 
324
      {"Elements", (Fl_Callback *)mesh_delete_parts_cb, (void*)"elements"} ,
 
325
      {"Lines",    (Fl_Callback *)mesh_delete_parts_cb, (void*)"lines"} ,
 
326
      {"Surfaces", (Fl_Callback *)mesh_delete_parts_cb, (void*)"surfaces"} ,
 
327
      {"Volumes",  (Fl_Callback *)mesh_delete_parts_cb, (void*)"volumes"} ,
 
328
      {0} 
 
329
    };  
326
330
 
327
331
// FIXME: should create MAXSOLVERS items...
328
332
Context_Item menu_solver[] = {
348
352
  {0}
349
353
};
350
354
 
 
355
static Fl_Menu_Item menu_point_display_post[] = {
 
356
  {"Color dot",      0, 0, 0},
 
357
  {"3D sphere",      0, 0, 0},
 
358
  {"Scaled sphere", 0, 0, 0},
 
359
  {0}
 
360
};
 
361
 
351
362
static Fl_Menu_Item menu_line_display[] = {
352
363
  {"Color segment", 0, 0, 0},
353
364
  {"3D cylinder",   0, 0, 0},
354
365
  {0}
355
366
};
356
367
 
 
368
static Fl_Menu_Item menu_line_display_post[] = {
 
369
  {"Color segment",    0, 0, 0},
 
370
  {"3D cylinder",      0, 0, 0},
 
371
  {"Tapered cylinder", 0, 0, 0},
 
372
  {0}
 
373
};
 
374
 
 
375
static Fl_Menu_Item menu_surface_display[] = {
 
376
  {"Cross",     0, 0, 0},
 
377
  {"Wireframe", 0, 0, 0},
 
378
  {"Solid",     0, 0, 0},
 
379
  {0}
 
380
};
 
381
 
357
382
static Fl_Menu_Item menu_axes_mode[] = {
358
 
  {"None", 0, 0, 0},
 
383
  {"None",        0, 0, 0},
359
384
  {"Simple axes", 0, 0, 0},
360
 
  {"Box", 0, 0, 0},
361
 
  {"Full grid", 0, 0, 0},
362
 
  {"Open grid", 0, 0, 0},
363
 
  {"Ruler", 0, 0, 0},
 
385
  {"Box",         0, 0, 0},
 
386
  {"Full grid",   0, 0, 0},
 
387
  {"Open grid",   0, 0, 0},
 
388
  {"Ruler",       0, 0, 0},
364
389
  {0}
365
390
};
366
391
 
385
410
  {0}
386
411
};
387
412
 
388
 
int GetFontIndex(char *fontname)
 
413
int GetFontIndex(const char *fontname)
389
414
{
390
415
  if(fontname){
391
416
    for(int i = 0; i < NUM_FONTS; i++)
392
417
      if(!strcmp(menu_font_names[i].label(), fontname))
393
 
        return i;
 
418
        return i;
394
419
  }
395
420
  Msg(GERROR, "Unknown font \"%s\" (using \"Helvetica\" instead)", fontname);
396
421
  Msg(INFO, "Available fonts:");
406
431
  return FL_HELVETICA;
407
432
}
408
433
 
409
 
char *GetFontName(int index)
 
434
const char *GetFontName(int index)
410
435
{
411
436
  if(index >= 0 && index < NUM_FONTS)
412
 
    return (char*)menu_font_names[index].label();
 
437
    return menu_font_names[index].label();
413
438
  return "Helvetica";
414
439
}
415
440
 
416
 
int GetFontAlign(char *alignstr)
 
441
int GetFontAlign(const char *alignstr)
417
442
{
418
443
  if(alignstr){
419
444
    if(!strcmp(alignstr, "BottomLeft") || !strcmp(alignstr, "Left") ||
420
445
       !strcmp(alignstr, "left"))
421
446
      return 0;
422
447
    else if(!strcmp(alignstr, "BottomCenter") || !strcmp(alignstr, "Center") ||
423
 
            !strcmp(alignstr, "center"))
 
448
            !strcmp(alignstr, "center"))
424
449
      return 1;
425
450
    else if(!strcmp(alignstr, "BottomRight") || !strcmp(alignstr, "Right") ||
426
 
            !strcmp(alignstr, "right"))
 
451
            !strcmp(alignstr, "right"))
427
452
      return 2;
428
453
    else if(!strcmp(alignstr, "TopLeft"))
429
454
      return 3;
458
483
    return CTX.fontsize;
459
484
  }
460
485
  else{
461
 
    int x, y, w, h;
462
 
    Fl::screen_xywh(x, y, w, h);
 
486
    int w = Fl::w();
463
487
    if(w <= 860)       return 11;
464
488
    else if(w <= 1024) return 12;
465
489
    else if(w <= 1440) return 13;
472
496
 
473
497
int GUI::global_shortcuts(int event)
474
498
{
475
 
  int i, j;
476
 
 
477
499
  // we only handle shortcuts here
478
500
  if(event != FL_SHORTCUT)
479
501
    return 0;
536
558
    undo_selection = 1;
537
559
    return 0;   // trick: do as if we didn't use it
538
560
  }
 
561
  else if(Fl::test_shortcut('i')) {
 
562
    invert_selection = 1;
 
563
    return 0;   // trick: do as if we didn't use it
 
564
  }
539
565
  else if(Fl::test_shortcut('q')) {
540
566
    quit_selection = 1;
541
567
    return 0;   // trick: do as if we didn't use it
545
571
    return 0;   // trick: do as if we didn't use it
546
572
  }
547
573
  else if(Fl::test_shortcut(FL_Escape) ||
548
 
          Fl::test_shortcut(FL_META + FL_Escape) ||
549
 
          Fl::test_shortcut(FL_SHIFT + FL_Escape) ||
550
 
          Fl::test_shortcut(FL_CTRL + FL_Escape) ||
551
 
          Fl::test_shortcut(FL_ALT + FL_Escape)) {
 
574
          Fl::test_shortcut(FL_META + FL_Escape) ||
 
575
          Fl::test_shortcut(FL_SHIFT + FL_Escape) ||
 
576
          Fl::test_shortcut(FL_CTRL + FL_Escape) ||
 
577
          Fl::test_shortcut(FL_ALT + FL_Escape)) {
552
578
    if(g_opengl_window->LassoMode){
553
579
      g_opengl_window->LassoMode = false;
554
580
      redraw_opengl();
583
609
    return 1;
584
610
  }
585
611
  else if(Fl::test_shortcut(FL_SHIFT + 'w')) {
586
 
    if(List_Nbr(CTX.post.list))
587
 
      if(view_number >= 0 && view_number < List_Nbr(CTX.post.list))
588
 
        create_view_options_window(view_number);
 
612
    if(PView::list.size()){
 
613
      if(view_number >= 0 && view_number < (int)PView::list.size())
 
614
        create_view_options_window(view_number);
589
615
      else
590
 
        create_view_options_window(0);
 
616
        create_view_options_window(0);
 
617
    }
591
618
    return 1;
592
619
  }
593
620
  else if(Fl::test_shortcut(FL_SHIFT + 'u')) {
594
 
    if(List_Nbr(CTX.post.list))
595
 
      if(view_number >= 0 && view_number < List_Nbr(CTX.post.list))
596
 
        create_plugin_window(view_number);
 
621
    if(PView::list.size()){
 
622
      if(view_number >= 0 && view_number < (int)PView::list.size())
 
623
        create_plugin_window(view_number);
597
624
      else
598
 
        create_plugin_window(0);
 
625
        create_plugin_window(0);
 
626
    }
599
627
    return 1;
600
628
  }
601
629
  else if(Fl::test_shortcut(FL_ALT + 'f')) {
602
630
    opt_general_fast_redraw(0, GMSH_SET | GMSH_GUI,
603
 
                            !opt_general_fast_redraw(0, GMSH_GET, 0));
 
631
                            !opt_general_fast_redraw(0, GMSH_GET, 0));
604
632
    redraw_opengl();
605
633
    return 1;
606
634
  }
607
635
  else if(Fl::test_shortcut(FL_ALT + 'b')) {
608
636
    opt_general_draw_bounding_box(0, GMSH_SET | GMSH_GUI,
609
 
                                  !opt_general_draw_bounding_box(0, GMSH_GET, 0));
 
637
                                  !opt_general_draw_bounding_box(0, GMSH_GET, 0));
610
638
    redraw_opengl();
611
639
    return 1;
612
640
  }
613
641
  else if(Fl::test_shortcut(FL_ALT + 'i')) {
614
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
642
    for(unsigned int i = 0; i < PView::list.size(); i++)
615
643
      if(opt_view_visible(i, GMSH_GET, 0))
616
 
        opt_view_show_scale(i, GMSH_SET | GMSH_GUI,
617
 
                            !opt_view_show_scale(i, GMSH_GET, 0));
 
644
        opt_view_show_scale(i, GMSH_SET | GMSH_GUI,
 
645
                            !opt_view_show_scale(i, GMSH_GET, 0));
618
646
    redraw_opengl();
619
647
    return 1;
620
648
  }
626
654
  }
627
655
  else if(Fl::test_shortcut(FL_ALT + 'w')) {
628
656
    opt_geometry_light(0, GMSH_SET | GMSH_GUI,
629
 
                       !opt_geometry_light(0, GMSH_GET, 0));
 
657
                       !opt_geometry_light(0, GMSH_GET, 0));
630
658
    opt_mesh_light(0, GMSH_SET | GMSH_GUI,
631
 
                   !opt_mesh_light(0, GMSH_GET, 0));
632
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
659
                   !opt_mesh_light(0, GMSH_GET, 0));
 
660
    for(unsigned int i = 0; i < PView::list.size(); i++)
633
661
      if(opt_view_visible(i, GMSH_GET, 0))
634
 
        opt_view_light(i, GMSH_SET | GMSH_GUI,
635
 
                       !opt_view_light(i, GMSH_GET, 0));
 
662
        opt_view_light(i, GMSH_SET | GMSH_GUI,
 
663
                       !opt_view_light(i, GMSH_GET, 0));
636
664
    redraw_opengl();
637
665
    return 1;
638
666
  }
639
667
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'w')) {
640
668
    opt_mesh_reverse_all_normals(0, GMSH_SET | GMSH_GUI,
641
 
                                 !opt_mesh_reverse_all_normals(0, GMSH_GET, 0));
 
669
                                 !opt_mesh_reverse_all_normals(0, GMSH_GET, 0));
642
670
    redraw_opengl();
643
671
    return 1;
644
672
  }
645
673
  else if(Fl::test_shortcut(FL_ALT + 'x') || 
646
 
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'x')) {
 
674
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'x')) {
647
675
    status_xyz1p_cb(0, (void *)"x");
648
676
    return 1;
649
677
  }
650
678
  else if(Fl::test_shortcut(FL_ALT + 'y') ||
651
 
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'y')) {
 
679
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'y')) {
652
680
    status_xyz1p_cb(0, (void *)"y");
653
681
    return 1;
654
682
  }
655
683
  else if(Fl::test_shortcut(FL_ALT + 'z') ||
656
 
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'z')) {
 
684
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'z')) {
657
685
    status_xyz1p_cb(0, (void *)"z");
658
686
    return 1;
659
687
  }
660
688
  else if(Fl::test_shortcut(FL_ALT + 'o') ||
661
 
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'o')) {
 
689
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'o')) {
662
690
    status_xyz1p_cb(0, (void *)"p");
663
691
    return 1;
664
692
  }
665
693
  else if(Fl::test_shortcut(FL_ALT + 'a')) {
666
694
    opt_general_axes(0, GMSH_SET | GMSH_GUI, 
667
 
                     opt_general_axes(0, GMSH_GET, 0) + 1);
668
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
695
                     opt_general_axes(0, GMSH_GET, 0) + 1);
 
696
    for(unsigned int i = 0; i < PView::list.size(); i++)
669
697
      if(opt_view_visible(i, GMSH_GET, 0))
670
698
        opt_view_axes(i, GMSH_SET | GMSH_GUI, opt_view_axes(i, GMSH_GET, 0)+1);
671
699
    redraw_opengl();
708
736
  }
709
737
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'l')) {
710
738
    opt_mesh_lines(0, GMSH_SET | GMSH_GUI, 
711
 
                   !opt_mesh_lines(0, GMSH_GET, 0));
 
739
                   !opt_mesh_lines(0, GMSH_GET, 0));
712
740
    redraw_opengl();
713
741
    return 1;
714
742
  }
715
743
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 's')) {
716
744
    opt_mesh_surfaces_edges(0, GMSH_SET | GMSH_GUI,
717
 
                            !opt_mesh_surfaces_edges(0, GMSH_GET, 0));
 
745
                            !opt_mesh_surfaces_edges(0, GMSH_GET, 0));
718
746
    redraw_opengl();
719
747
    return 1;
720
748
  }
721
749
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'v')) {
722
750
    opt_mesh_volumes_edges(0, GMSH_SET | GMSH_GUI,
723
 
                           !opt_mesh_volumes_edges(0, GMSH_GET, 0));
724
 
    redraw_opengl();
725
 
    return 1;
726
 
  }
727
 
  else if(Fl::test_shortcut(FL_ALT + 'd') ||
728
 
          Fl::test_shortcut(FL_ALT + FL_SHIFT + 'd')) {
 
751
                           !opt_mesh_volumes_edges(0, GMSH_GET, 0));
 
752
    redraw_opengl();
 
753
    return 1;
 
754
  }
 
755
  else if(Fl::test_shortcut(FL_ALT + 'd')){
 
756
    opt_geometry_surface_type(0, GMSH_SET | GMSH_GUI,
 
757
                              opt_geometry_surface_type(0, GMSH_GET, 0) + 1);
 
758
    redraw_opengl();
 
759
    return 1;
 
760
  }
 
761
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'd')) {
729
762
    opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI,
730
 
                            !opt_mesh_surfaces_faces(0, GMSH_GET, 0));
 
763
                            !opt_mesh_surfaces_faces(0, GMSH_GET, 0));
731
764
    redraw_opengl();
732
765
    return 1;
733
766
  }
734
767
  else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'b')) {
735
768
    opt_mesh_volumes_faces(0, GMSH_SET | GMSH_GUI,
736
 
                           !opt_mesh_volumes_faces(0, GMSH_GET, 0));
 
769
                           !opt_mesh_volumes_faces(0, GMSH_GET, 0));
737
770
    redraw_opengl();
738
771
    return 1;
739
772
  }
752
785
    return 1;
753
786
  }
754
787
  else if(Fl::test_shortcut(FL_ALT + 't')) {
755
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++) {
756
 
      if(opt_view_visible(i, GMSH_GET, 0)) {
757
 
        j = (int)opt_view_intervals_type(i, GMSH_GET, 0);
 
788
    for(unsigned int i = 0; i < PView::list.size(); i++)
 
789
      if(opt_view_visible(i, GMSH_GET, 0))
758
790
        opt_view_intervals_type(i, GMSH_SET | GMSH_GUI,
759
 
                                (j == DRAW_POST_ISO) ? DRAW_POST_DISCRETE :
760
 
                                (j == DRAW_POST_DISCRETE) ? DRAW_POST_CONTINUOUS :
761
 
                                DRAW_POST_ISO);
762
 
      }
763
 
    }
 
791
                                opt_view_intervals_type(i, GMSH_GET, 0) + 1);
764
792
    redraw_opengl();
765
793
    return 1;
766
794
  }
767
795
  else if(Fl::test_shortcut(FL_ALT + 'r')) {
768
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++) {
769
 
      if(opt_view_visible(i, GMSH_GET, 0)) {
770
 
        j = (int)opt_view_range_type(i, GMSH_GET, 0);
 
796
    for(unsigned int i = 0; i < PView::list.size(); i++)
 
797
      if(opt_view_visible(i, GMSH_GET, 0))
771
798
        opt_view_range_type(i, GMSH_SET | GMSH_GUI,
772
 
                            (j == DRAW_POST_RANGE_DEFAULT) ? DRAW_POST_RANGE_PER_STEP :
773
 
                            (j == DRAW_POST_RANGE_PER_STEP) ? DRAW_POST_RANGE_CUSTOM :
774
 
                            DRAW_POST_RANGE_DEFAULT);
775
 
      }
776
 
    }
 
799
                            opt_view_range_type(i, GMSH_GET, 0) + 1);
777
800
    redraw_opengl();
778
801
    return 1;
779
802
  }
780
803
  else if(Fl::test_shortcut(FL_ALT + 'n')) {
781
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
804
    for(unsigned int i = 0; i < PView::list.size(); i++)
782
805
      if(opt_view_visible(i, GMSH_GET, 0))
783
806
        opt_view_draw_strings(i, GMSH_SET | GMSH_GUI,
784
807
                              !opt_view_draw_strings(i, GMSH_GET, 0));
786
809
    return 1;
787
810
  }
788
811
  else if(Fl::test_shortcut(FL_ALT + 'e')) {
789
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
812
    for(unsigned int i = 0; i < PView::list.size(); i++)
790
813
      if(opt_view_visible(i, GMSH_GET, 0))
791
814
        opt_view_show_element(i, GMSH_SET | GMSH_GUI,
792
815
                              !opt_view_show_element(i, GMSH_GET, 0));
795
818
  }
796
819
  else if(Fl::test_shortcut(FL_ALT + 'h')) {
797
820
    static int show = 0;
798
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++)
 
821
    for(unsigned int i = 0; i < PView::list.size(); i++)
799
822
      opt_view_visible(i, GMSH_SET | GMSH_GUI, show);
800
823
    redraw_opengl();
801
824
    show = !show;
838
861
GUI::GUI(int argc, char **argv)
839
862
{
840
863
  // initialize static windows
 
864
  g_window = NULL;
841
865
  m_window = NULL;
842
 
  g_window = NULL;
843
866
  opt_window = NULL;
844
867
  plugin_window = NULL;
 
868
  field_window = NULL;
845
869
  stat_window = NULL;
846
870
  msg_window = NULL;
847
871
  vis_window = NULL;
901
925
  create_graphic_window();
902
926
 
903
927
#if defined(WIN32)
904
 
  m_window->icon((char *)LoadImage(fl_display, MAKEINTRESOURCE(IDI_ICON),
 
928
  g_window->icon((char *)LoadImage(fl_display, MAKEINTRESOURCE(IDI_ICON),
905
929
                                   IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR));
906
930
#elif defined(__APPLE__)
907
931
  // Nothing to do here
919
943
    0x08, 0x00, 0xff, 0x1f, 0x08, 0x00, 0xff, 0x1f, 0x04, 0x40, 0xfd, 0x3f,
920
944
    0x04, 0xa8, 0xea, 0x3f, 0x02, 0x55, 0x55, 0x7f, 0xa2, 0xaa, 0xaa, 0x7a,
921
945
    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
 
946
  g_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
 
947
                                              gmsh32x32, 32, 32));
922
948
  m_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
923
 
                                              gmsh32x32, 32, 32));
924
 
  g_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
925
 
                                              gmsh32x32, 32, 32));
 
949
                                              gmsh32x32, 32, 32));
926
950
#endif
927
 
  
928
 
  // we must show() m_window first (at least on Win32, since the icon
929
 
  // is associated with m_window); and besides, it's probably better
930
 
  // to have the initial focus on g_window so that we can directly
931
 
  // process graphical shortcuts (e.g. for time step selection)
932
 
  m_window->show(1, argv);
 
951
 
 
952
  // open graphics window first for correct non-modal behaviour on windows
933
953
  g_window->show(1, argv);
 
954
  m_window->show();
 
955
 
 
956
  // graphic window should have the initial focus (so we can
 
957
  // e.g. directly loop through time steps with the keyboard)
934
958
  g_opengl_window->take_focus();
935
959
  
936
960
  create_option_window();
937
961
  create_plugin_window(0);
 
962
  create_field_window(0);
938
963
  create_message_window();
939
964
  create_statistics_window();
940
965
  create_visibility_window();
1004
1029
  }
1005
1030
#endif
1006
1031
 
1007
 
  m_window = new Main_Window(width, MH + NB_BUTT_SCROLL * BH, "Gmsh");
 
1032
  m_window = new Main_Window(width, MH + NB_BUTT_SCROLL * BH, CTX.non_modal_windows, "Gmsh");
1008
1033
  m_window->box(GMSH_WINDOW_BOX);
1009
1034
  m_window->callback(file_quit_cb);
1010
1035
 
1066
1091
  m_window->size(width, MH);
1067
1092
  m_window->position(CTX.position[0], CTX.position[1]);
1068
1093
  
1069
 
  // force always on top
1070
 
  //m_window->set_non_modal();
1071
 
 
1072
1094
  m_window->end();
1073
1095
}
1074
1096
 
1131
1153
    menu[5].label = opt_solver_name4(0, GMSH_GET, 0);
1132
1154
    for(int i = 0; i < MAXSOLVERS; i++) {
1133
1155
      if(!strlen(menu[i + 1].label))
1134
 
        menu[i + 1].label = NULL;
 
1156
        menu[i + 1].label = NULL;
1135
1157
    }
1136
1158
  }
1137
1159
  else if(menu[0].label[0] == '3'){
1208
1230
  // construct the dynamic menu
1209
1231
  int nb = 0;
1210
1232
  if(m_module_butt->value() == 3){ // post-processing context
1211
 
    for(nb = 0; nb < List_Nbr(CTX.post.list); nb++) {
1212
 
      Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, nb);
 
1233
    for(nb = 0; nb < (int)PView::list.size(); nb++) {
 
1234
      PViewData *data = PView::list[nb]->getData();
 
1235
      PViewOptions *opt = PView::list[nb]->getOptions();
1213
1236
      
1214
1237
      Fl_Light_Button *b1 = new Fl_Light_Button(0, MH + nb * BH, width - popw, BH);
1215
1238
      b1->callback(view_toggle_cb, (void *)nb);
1216
1239
      b1->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
1217
 
      b1->value(v->Visible);
1218
 
      b1->label(v->Name);
1219
 
      b1->tooltip(v->FileName);
 
1240
      b1->value(opt->Visible);
 
1241
      b1->label(data->getName().c_str());
 
1242
      b1->tooltip(data->getFileName().c_str());
1220
1243
      
1221
1244
      char *tmp = new char[32];
1222
1245
      sprintf(tmp, "[%d]@#-1>", nb);
1232
1255
      p[1]->type(Fl_Menu_Button::POPUP3);
1233
1256
  
1234
1257
      for(int j = 0; j < 2; j++) {
1235
 
        p[j]->add("Reload/View", 'r', 
1236
 
                  (Fl_Callback *) view_reload_cb, (void *)nb, 0);
1237
 
        p[j]->add("Reload/Visible Views", 0, 
1238
 
                  (Fl_Callback *) view_reload_visible_cb, (void *)nb, 0);
1239
 
        p[j]->add("Reload/All Views", 0, 
1240
 
                  (Fl_Callback *) view_reload_all_cb, (void *)nb, 0);
1241
 
        p[j]->add("Remove/View", FL_Delete, 
1242
 
                  (Fl_Callback *) view_remove_cb, (void *)nb, 0);
1243
 
        p[j]->add("Remove/Other Views", 0, 
1244
 
                  (Fl_Callback *) view_remove_other_cb, (void *)nb, 0);
1245
 
        p[j]->add("Remove/Visible Views", 0, 
1246
 
                  (Fl_Callback *) view_remove_visible_cb, (void *)nb, 0);
1247
 
        p[j]->add("Remove/Invisible Views", 0, 
1248
 
                  (Fl_Callback *) view_remove_invisible_cb, (void *)nb, 0);
1249
 
        p[j]->add("Remove/Empty Views", 0, 
1250
 
                  (Fl_Callback *) view_remove_empty_cb, (void *)nb, 0);
1251
 
        p[j]->add("Remove/All Views", 0, 
1252
 
                  (Fl_Callback *) view_remove_all_cb, (void *)nb, 0);
1253
 
        p[j]->add("Alias/View without Options", 0, 
1254
 
                  (Fl_Callback *) view_alias_cb, (void *)nb, 0);
1255
 
        p[j]->add("Alias/View with Options", 0, 
1256
 
                  (Fl_Callback *) view_alias_with_options_cb, (void *)nb, 0);
1257
 
        p[j]->add("Combine/Elements from Visible Views", 0, 
1258
 
                  (Fl_Callback *) view_combine_space_visible_cb, (void *)nb, 0);
1259
 
        p[j]->add("Combine/Elements from All Views", 0, 
1260
 
                  (Fl_Callback *) view_combine_space_all_cb, (void *)nb, 0);
1261
 
        p[j]->add("Combine/Elements by View Name", 0, 
1262
 
                  (Fl_Callback *) view_combine_space_by_name_cb, (void *)nb, 0);
1263
 
        p[j]->add("Combine/Time Steps from Visible Views", 0, 
1264
 
                  (Fl_Callback *) view_combine_time_visible_cb, (void *)nb, 0);
1265
 
        p[j]->add("Combine/Time Steps from All Views", 0, 
1266
 
                  (Fl_Callback *) view_combine_time_all_cb, (void *)nb, 0);
1267
 
        p[j]->add("Combine/Time Steps by View Name", 0, 
1268
 
                 (Fl_Callback *) view_combine_time_by_name_cb, (void *)nb, 0);
1269
 
        p[j]->add("Set Visibility/All On", 0, 
1270
 
                  (Fl_Callback *) view_all_visible_cb, (void *)1, 0);
1271
 
        p[j]->add("Set Visibility/All Off", 0, 
1272
 
                  (Fl_Callback *) view_all_visible_cb, (void *)0, 0);
1273
 
        p[j]->add("Set Visibility/Invert", 0, 
1274
 
                  (Fl_Callback *) view_all_visible_cb, (void *)-1, 0);
1275
 
        p[j]->add("Save As/Parsed View...", 0, 
1276
 
                  (Fl_Callback *) view_save_parsed_cb, (void *)nb, 0);
1277
 
        p[j]->add("Save As/ASCII View...", 0, 
1278
 
                  (Fl_Callback *) view_save_ascii_cb, (void *)nb, 0);
1279
 
        p[j]->add("Save As/Binary View...", 0, 
1280
 
                  (Fl_Callback *) view_save_binary_cb, (void *)nb, 0);
1281
 
        p[j]->add("Save As/STL Triangulation...", 0, 
1282
 
                  (Fl_Callback *) view_save_stl_cb, (void *)nb, 0);
1283
 
        p[j]->add("Save As/Raw Text...", 0, 
1284
 
                  (Fl_Callback *) view_save_txt_cb, (void *)nb, 0);
1285
 
        p[j]->add("Save As/Gmsh Mesh...", 0, 
1286
 
                  (Fl_Callback *) view_save_msh_cb, (void *)nb, 0);
1287
 
        p[j]->add("Apply As Background Mesh", 0, 
1288
 
                  (Fl_Callback *) view_applybgmesh_cb, (void *)nb, FL_MENU_DIVIDER);
1289
 
        p[j]->add("Options...", 'o', 
1290
 
                  (Fl_Callback *) view_options_cb, (void *)nb, 0);
1291
 
        p[j]->add("Plugins...", 'p', 
1292
 
                  (Fl_Callback *) view_plugin_cb, (void *)nb, 0);
 
1258
        p[j]->add("Reload/View", 'r', 
 
1259
                  (Fl_Callback *) view_reload_cb, (void *)nb, 0);
 
1260
        p[j]->add("Reload/Visible Views", 0, 
 
1261
                  (Fl_Callback *) view_reload_visible_cb, (void *)nb, 0);
 
1262
        p[j]->add("Reload/All Views", 0, 
 
1263
                  (Fl_Callback *) view_reload_all_cb, (void *)nb, 0);
 
1264
        p[j]->add("Remove/View", FL_Delete, 
 
1265
                  (Fl_Callback *) view_remove_cb, (void *)nb, 0);
 
1266
        p[j]->add("Remove/Other Views", 0, 
 
1267
                  (Fl_Callback *) view_remove_other_cb, (void *)nb, 0);
 
1268
        p[j]->add("Remove/Visible Views", 0, 
 
1269
                  (Fl_Callback *) view_remove_visible_cb, (void *)nb, 0);
 
1270
        p[j]->add("Remove/Invisible Views", 0, 
 
1271
                  (Fl_Callback *) view_remove_invisible_cb, (void *)nb, 0);
 
1272
        p[j]->add("Remove/Empty Views", 0, 
 
1273
                  (Fl_Callback *) view_remove_empty_cb, (void *)nb, 0);
 
1274
        p[j]->add("Remove/All Views", 0, 
 
1275
                  (Fl_Callback *) view_remove_all_cb, (void *)nb, 0);
 
1276
        p[j]->add("Alias/View without Options", 0, 
 
1277
                  (Fl_Callback *) view_alias_cb, (void *)nb, 0);
 
1278
        p[j]->add("Alias/View with Options", 0, 
 
1279
                  (Fl_Callback *) view_alias_with_options_cb, (void *)nb, 0);
 
1280
        p[j]->add("Combine Elements/From Visible Views", 0, 
 
1281
                  (Fl_Callback *) view_combine_space_visible_cb, (void *)nb, 0);
 
1282
        p[j]->add("Combine Elements/From All Views", 0, 
 
1283
                  (Fl_Callback *) view_combine_space_all_cb, (void *)nb, 0);
 
1284
        p[j]->add("Combine Elements/By View Name", 0, 
 
1285
                  (Fl_Callback *) view_combine_space_by_name_cb, (void *)nb, 0);
 
1286
        p[j]->add("Combine Time Steps/From Visible Views", 0, 
 
1287
                  (Fl_Callback *) view_combine_time_visible_cb, (void *)nb, 0);
 
1288
        p[j]->add("Combine Time Steps/From All Views", 0, 
 
1289
                  (Fl_Callback *) view_combine_time_all_cb, (void *)nb, 0);
 
1290
        p[j]->add("Combine Time Steps/By View Name", 0, 
 
1291
                 (Fl_Callback *) view_combine_time_by_name_cb, (void *)nb, 0);
 
1292
        p[j]->add("Set Visibility/All On", 0, 
 
1293
                  (Fl_Callback *) view_all_visible_cb, (void *)1, 0);
 
1294
        p[j]->add("Set Visibility/All Off", 0, 
 
1295
                  (Fl_Callback *) view_all_visible_cb, (void *)0, 0);
 
1296
        p[j]->add("Set Visibility/Invert", 0, 
 
1297
                  (Fl_Callback *) view_all_visible_cb, (void *)-1, 0);
 
1298
        p[j]->add("Save As/Parsed View...", 0, 
 
1299
                  (Fl_Callback *) view_save_parsed_cb, (void *)nb, 0);
 
1300
        p[j]->add("Save As/ASCII View...", 0, 
 
1301
                  (Fl_Callback *) view_save_ascii_cb, (void *)nb, 0);
 
1302
        p[j]->add("Save As/Binary View...", 0, 
 
1303
                  (Fl_Callback *) view_save_binary_cb, (void *)nb, 0);
 
1304
        p[j]->add("Save As/STL Triangulation...", 0, 
 
1305
                  (Fl_Callback *) view_save_stl_cb, (void *)nb, 0);
 
1306
        p[j]->add("Save As/Raw Text...", 0, 
 
1307
                  (Fl_Callback *) view_save_txt_cb, (void *)nb, 0);
 
1308
        p[j]->add("Save As/Gmsh Mesh...", 0, 
 
1309
                  (Fl_Callback *) view_save_msh_cb, (void *)nb, 0);
 
1310
#if defined(HAVE_MED)
 
1311
        p[j]->add("Save As/MED file...", 0, 
 
1312
                  (Fl_Callback *) view_save_med_cb, (void *)nb, 0);
 
1313
#endif
 
1314
        p[j]->add("Apply As Background Mesh", 0, 
 
1315
                  (Fl_Callback *) view_applybgmesh_cb, (void *)nb, FL_MENU_DIVIDER);
 
1316
        p[j]->add("Options...", 'o', 
 
1317
                  (Fl_Callback *) view_options_cb, (void *)nb, 0);
 
1318
        p[j]->add("Plugins...", 'p', 
 
1319
                  (Fl_Callback *) view_plugin_cb, (void *)nb, 0);
1293
1320
      }
1294
1321
 
1295
1322
      m_toggle_butt.push_back(b1);
1383
1410
  fl_begin_polygon(); vv(0.5,0.6); vv(-0.1,0.9); vv(-0.1,0.3); fl_end_polygon();
1384
1411
}
1385
1412
 
 
1413
void gmsh_models(Fl_Color c)
 
1414
{
 
1415
  fl_color(c);
 
1416
  bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,-0.3); vv(-0.8,-0.3); el;
 
1417
  bl; vv(0.3,-0.8); vv(0.8,-0.8); vv(0.8,-0.3); vv(0.3,-0.3); el;
 
1418
  bl; vv(-0.8,0.3); vv(-0.3,0.3); vv(-0.3,0.8); vv(-0.8,0.8); el;
 
1419
  bl; vv(0.3,0.3); vv(0.8,0.3); vv(0.8,0.8); vv(0.3,0.8); el;
 
1420
}
 
1421
 
1386
1422
#undef vv
1387
1423
#undef bl
1388
1424
#undef el
1401
1437
  fl_add_symbol("gmsh_forward", gmsh_forward, 1);
1402
1438
  fl_add_symbol("gmsh_ortho", gmsh_ortho, 1);
1403
1439
  fl_add_symbol("gmsh_rotate", gmsh_rotate, 1);
 
1440
  fl_add_symbol("gmsh_models", gmsh_models, 1);
1404
1441
 
1405
1442
  int sh = 2 * fontsize - 4;    // status bar height
1406
1443
  int sw = fontsize + 3;        // status button width
1408
1445
  int glheight = CTX.viewport[3] - CTX.viewport[1];
1409
1446
  int height = glheight + sh;
1410
1447
 
1411
 
  g_window = new Main_Window(width, height);
 
1448
  // the graphic window is the main window: it should be a normal
 
1449
  // window (neither modal nor non-modal)
 
1450
  g_window = new Main_Window(width, height, false);
1412
1451
  g_window->callback(file_quit_cb);
1413
1452
 
1414
1453
  // bottom button bar
1419
1458
  int x = 2;
1420
1459
  int sht = sh - 4; // leave a 2 pixel border at the bottom
1421
1460
 
 
1461
  g_status_butt[5] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_models");
 
1462
  x += sw;
 
1463
  g_status_butt[5]->callback(status_xyz1p_cb, (void *)"model");
 
1464
  g_status_butt[5]->tooltip("Switch current model");
 
1465
 
1422
1466
  g_status_butt[0] = new Fl_Button(x, glheight + 2, sw, sht, "X");
1423
1467
  x += sw;
1424
1468
  g_status_butt[0]->callback(status_xyz1p_cb, (void *)"x");
1452
1496
  g_status_butt[9] = new Fl_Button(x, glheight + 2, sw, sht, "S");
1453
1497
  x += sw;
1454
1498
  g_status_butt[9]->callback(status_xyz1p_cb, (void *)"S");
1455
 
  g_status_butt[9]->tooltip("Toggle mouse selection ON/OFF (Escape or Shift+Escape)");
1456
 
 
1457
 
  g_status_butt[5] = new Fl_Button(x, glheight + 2, sw, sht, "?");
1458
 
  x += sw;
1459
 
  g_status_butt[5]->callback(status_xyz1p_cb, (void *)"?");
1460
 
  g_status_butt[5]->tooltip("Show current options");
 
1499
  g_status_butt[9]->tooltip("Toggle mouse selection ON/OFF (Escape)");
1461
1500
 
1462
1501
  g_status_butt[6] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_rewind");
1463
1502
  x += sw;
1524
1563
 
1525
1564
// Set graphic window title
1526
1565
 
1527
 
void GUI::set_title(char *str)
 
1566
void GUI::set_title(const char *str)
1528
1567
{
1529
1568
  g_window->label(str);
1530
1569
}
1531
1570
 
 
1571
// Update GUI when views get added or deleted
 
1572
 
 
1573
void GUI::update_views()
 
1574
{
 
1575
  check_anim_buttons();
 
1576
  if(get_context() == 3)
 
1577
    set_context(menu_post, 0);
 
1578
  reset_option_browser();
 
1579
  reset_plugin_view_browser();
 
1580
  reset_clip_browser();
 
1581
  reset_external_view_list();
 
1582
}
 
1583
 
1532
1584
// Set animation button
1533
1585
 
1534
1586
void GUI::set_anim_buttons(int mode)
1545
1597
 
1546
1598
void GUI::check_anim_buttons()
1547
1599
{
1548
 
  int i, play = 0;
1549
 
  if(CTX.post.anim_cycle) {
1550
 
    play = 1;
 
1600
  bool play = false;
 
1601
  if(CTX.post.anim_cycle){
 
1602
    play = true;
1551
1603
  }
1552
 
  else {
1553
 
    for(i = 0; i < List_Nbr(CTX.post.list); i++) {
1554
 
      if((*(Post_View **) List_Pointer(CTX.post.list, i))->NbTimeStep > 1) {
1555
 
        play = 1;
 
1604
  else{
 
1605
    for(unsigned int i = 0; i < PView::list.size(); i++){
 
1606
      if(PView::list[i]->getData()->getNumTimeSteps() > 1){
 
1607
        play = true;
1556
1608
        break;
1557
1609
      }
1558
1610
    }
1559
1611
  }
1560
 
  if(!play) {
 
1612
  if(play){
 
1613
    g_status_butt[6]->activate();
 
1614
    g_status_butt[7]->activate();
 
1615
    g_status_butt[10]->activate();
 
1616
    g_status_butt[11]->activate();
 
1617
  }
 
1618
  else{
1561
1619
    g_status_butt[6]->deactivate();
1562
1620
    g_status_butt[7]->deactivate();
1563
1621
    g_status_butt[10]->deactivate();
1564
1622
    g_status_butt[11]->deactivate();
1565
1623
  }
1566
 
  else {
1567
 
    g_status_butt[6]->activate();
1568
 
    g_status_butt[7]->activate();
1569
 
    g_status_butt[10]->activate();
1570
 
    g_status_butt[11]->activate();
1571
 
  }
1572
1624
}
1573
1625
 
1574
1626
// Set the status messages
1575
1627
 
1576
 
void GUI::set_status(char *msg, int num)
 
1628
void GUI::set_status(const char *msg, int num)
1577
1629
{
1578
1630
  if(num == 0 || num == 1){
1579
1631
    g_status_label[num]->label(msg);
1595
1647
  }
1596
1648
}
1597
1649
 
1598
 
void GUI::add_multiline_in_browser(Fl_Browser * o, char *prefix, char *str)
 
1650
void GUI::add_multiline_in_browser(Fl_Browser * o, const char *prefix, const char *str)
1599
1651
{
1600
1652
  int start = 0, len;
1601
1653
  char *buff;
1711
1763
  opt_browser->add("Mesh");
1712
1764
  opt_browser->add("Solver");
1713
1765
  opt_browser->add("Post-processing");
1714
 
  for(int i = 0; i < List_Nbr(CTX.post.list); i++) {
 
1766
  for(unsigned int i = 0; i < PView::list.size(); i++) {
1715
1767
    sprintf(str, "View [%d]", i);
1716
1768
    opt_browser->add(str);
1717
1769
  }
1736
1788
  view_choice[11]->clear();
1737
1789
  view_choice[10]->add("Self");
1738
1790
  view_choice[11]->add("Self");
1739
 
  for(int i = 0; i < List_Nbr(CTX.post.list); i++) {
 
1791
  for(unsigned int i = 0; i < PView::list.size(); i++) {
1740
1792
    sprintf(str, "View [%d]", i);
1741
1793
    view_choice[10]->add(str, 0, NULL);
1742
1794
    view_choice[11]->add(str, 0, NULL);
1758
1810
    return;
1759
1811
  }
1760
1812
 
1761
 
  opt_window = new Dialog_Window(width, height);
 
1813
  opt_window = new Dialog_Window(width, height, CTX.non_modal_windows);
1762
1814
  opt_window->box(GMSH_WINDOW_BOX);
1763
1815
 
1764
1816
  // Buttons
1819
1871
      gen_butt[2]->type(FL_TOGGLE_BUTTON);
1820
1872
      gen_butt[2]->callback(general_options_ok_cb, (void*)"fast_redraw");
1821
1873
 
1822
 
      gen_butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Enable double buffering");
 
1874
      gen_butt[11] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Enable mouse hover over meshes");
 
1875
      gen_butt[11]->type(FL_TOGGLE_BUTTON);
 
1876
      gen_butt[11]->callback(general_options_ok_cb);
 
1877
 
 
1878
      gen_butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable double buffering");
1823
1879
      gen_butt[3]->type(FL_TOGGLE_BUTTON);
1824
1880
      gen_butt[3]->callback(general_options_ok_cb);
1825
1881
 
1826
 
      gen_butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable antialiasing");
 
1882
      gen_butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Enable antialiasing");
1827
1883
      gen_butt[12]->type(FL_TOGGLE_BUTTON);
1828
1884
      gen_butt[12]->callback(general_options_ok_cb);
1829
1885
 
1830
 
      gen_butt[5] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Use trackball rotation mode instead of Euler angles");
 
1886
      gen_butt[5] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Use trackball rotation mode instead of Euler angles");
1831
1887
      gen_butt[5]->type(FL_TOGGLE_BUTTON);
1832
1888
      gen_butt[5]->callback(general_options_ok_cb);
1833
1889
 
1834
 
      gen_butt[15] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Rotate around pseudo center of mass");
 
1890
      gen_butt[15] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 9 * BH, BW, BH, "Rotate around pseudo center of mass");
1835
1891
      gen_butt[15]->type(FL_TOGGLE_BUTTON);
1836
1892
      gen_butt[15]->callback(general_options_ok_cb, (void*)"rotation_center");
1837
1893
 
1838
 
      gen_push_butt[0] = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 9 * BH, BB, BH, "Select");
 
1894
      gen_push_butt[0] = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 10 * BH, BB, BH, "Select");
1839
1895
      gen_push_butt[0]->callback(general_options_rotation_center_select_cb);
1840
1896
 
1841
 
      gen_value[8] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 9 * BH, IW / 3, BH);
 
1897
      gen_value[8] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW / 3, BH);
1842
1898
      gen_value[8]->callback(general_options_ok_cb, (void*)"rotation_center_coord");
1843
 
      gen_value[9] = new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 9 * BH, IW / 3, BH);
 
1899
      gen_value[9] = new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 10 * BH, IW / 3, BH);
1844
1900
      gen_value[9]->callback(general_options_ok_cb, (void*)"rotation_center_coord");
1845
 
      gen_value[10] = new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 9 * BH, IW / 3, BH, "Rotation center");
 
1901
      gen_value[10] = new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 10 * BH, IW / 3, BH, "Rotation center");
1846
1902
      gen_value[10]->align(FL_ALIGN_RIGHT);
1847
1903
      gen_value[10]->callback(general_options_ok_cb, (void*)"rotation_center_coord");
1848
1904
 
1857
1913
      gen_choice[4]->tooltip("(Alt+a)");
1858
1914
      gen_choice[4]->callback(general_options_ok_cb, (void*)"general_axes");
1859
1915
 
 
1916
      gen_butt[16] = new Fl_Check_Button(L + width / 2 + 4 * WB, 2 * WB + 1 * BH, IW, BH, "Mikado style");
 
1917
      gen_butt[16]->type(FL_TOGGLE_BUTTON);
 
1918
      gen_butt[16]->callback(general_options_ok_cb);
 
1919
 
1860
1920
      gen_value[17] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW/3, BH);
1861
1921
      gen_value[17]->minimum(0.);
1862
1922
      gen_value[17]->step(1);
1981
2041
      o->hide();
1982
2042
 
1983
2043
      static Fl_Menu_Item menu_projection[] = {
1984
 
        {"Orthographic", 0, 0, 0},
1985
 
        {"Perspective", 0, 0, 0},
1986
 
        {0}
 
2044
        {"Orthographic", 0, 0, 0},
 
2045
        {"Perspective", 0, 0, 0},
 
2046
        {0}
1987
2047
      };
1988
2048
      gen_choice[2] = new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Projection mode");
1989
2049
      gen_choice[2]->menu(menu_projection);
2038
2098
      gen_value[7]->callback(general_options_ok_cb);
2039
2099
      
2040
2100
      static Fl_Menu_Item menu_genvectype[] = {
2041
 
        {"Line", 0, 0, 0},
2042
 
        {"Arrow", 0, 0, 0},
2043
 
        {"Pyramid", 0, 0, 0},
2044
 
        {"3D arrow", 0, 0, 0},
2045
 
        {0}
 
2101
        {"Line", 0, 0, 0},
 
2102
        {"Arrow", 0, 0, 0},
 
2103
        {"Pyramid", 0, 0, 0},
 
2104
        {"3D arrow", 0, 0, 0},
 
2105
        {0}
2046
2106
      };
2047
2107
      gen_choice[0] = new Fl_Choice(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Vector display");
2048
2108
      gen_choice[0]->menu(menu_genvectype);
2120
2180
      o->hide();
2121
2181
 
2122
2182
      static Fl_Menu_Item menu_color_scheme[] = {
2123
 
        {"Dark", 0, 0, 0},
2124
 
        {"Light", 0, 0, 0},
2125
 
        {"Grayscale", 0, 0, 0},
2126
 
        {0}
 
2183
        {"Dark", 0, 0, 0},
 
2184
        {"Light", 0, 0, 0},
 
2185
        {"Grayscale", 0, 0, 0},
 
2186
        {0}
2127
2187
      };
2128
2188
 
2129
2189
      gen_choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Predefined color scheme");
2133
2193
      gen_choice[3]->callback(general_options_color_scheme_cb);
2134
2194
 
2135
2195
      static Fl_Menu_Item menu_bg_grad[] = {
2136
 
        {"None", 0, 0, 0},
2137
 
        {"Vertical", 0, 0, 0},
2138
 
        {"Horizontal", 0, 0, 0},
2139
 
        {"Radial", 0, 0, 0},
2140
 
        {0}
 
2196
        {"None", 0, 0, 0},
 
2197
        {"Vertical", 0, 0, 0},
 
2198
        {"Horizontal", 0, 0, 0},
 
2199
        {"Radial", 0, 0, 0},
 
2200
        {0}
2141
2201
      };
2142
2202
 
2143
2203
      gen_choice[5] = new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Background gradient");
2279
2339
 
2280
2340
      geo_choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line display");
2281
2341
      geo_choice[1]->menu(menu_line_display);
2282
 
      geo_choice[1]->align(FL_ALIGN_RIGHT);     
 
2342
      geo_choice[1]->align(FL_ALIGN_RIGHT);     
2283
2343
      geo_choice[1]->callback(geometry_options_ok_cb);
2284
2344
 
2285
2345
      geo_value[4] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Line width");
2296
2356
      geo_value[6]->align(FL_ALIGN_RIGHT);
2297
2357
      geo_value[6]->callback(geometry_options_ok_cb);
2298
2358
 
 
2359
      geo_choice[2] = new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Surface display");
 
2360
      geo_choice[2]->menu(menu_surface_display);
 
2361
      geo_choice[2]->align(FL_ALIGN_RIGHT);     
 
2362
      geo_choice[2]->callback(geometry_options_ok_cb);
 
2363
      geo_choice[2]->tooltip("(Alt+d)");
 
2364
 
2299
2365
      o->end();
2300
2366
    }
2301
2367
    {
2307
2373
      geo_butt[9]->tooltip("(Alt+w)");
2308
2374
      geo_butt[9]->callback(geometry_options_ok_cb);
2309
2375
 
 
2376
      geo_butt[14] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Use two-side lighting");
 
2377
      geo_butt[14]->type(FL_TOGGLE_BUTTON);
 
2378
      geo_butt[14]->callback(geometry_options_ok_cb);
 
2379
 
2310
2380
      o->end();
2311
2381
    }
2312
2382
    {
2343
2413
      o->hide();
2344
2414
 
2345
2415
      static Fl_Menu_Item menu_2d_algo[] = {
2346
 
        {"MeshAdapt", 0, 0, 0},
 
2416
        {"Frontal", 0, 0, 0},
2347
2417
        {"Delaunay", 0, 0, 0},
2348
2418
        {"MeshAdapt+Delaunay", 0, 0, 0},
2349
2419
        {0}
2390
2460
      mesh_value[2]->align(FL_ALIGN_RIGHT);
2391
2461
      mesh_value[2]->callback(mesh_options_ok_cb);
2392
2462
 
2393
 
      mesh_value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Element order");
 
2463
      mesh_value[25] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Minimum characteristic length");
 
2464
      mesh_value[25]->align(FL_ALIGN_RIGHT);
 
2465
      mesh_value[25]->callback(mesh_options_ok_cb);
 
2466
 
 
2467
      mesh_value[26] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Maximum characteristic length");
 
2468
      mesh_value[26]->align(FL_ALIGN_RIGHT);
 
2469
      mesh_value[26]->callback(mesh_options_ok_cb);
 
2470
 
 
2471
      mesh_value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Element order");
2394
2472
      mesh_value[3]->minimum(1);
2395
2473
      // FIXME: this makes it possible to set > 2 by hand, but not by
2396
2474
      // dragging (>2 is too buggy for general use)
2399
2477
      mesh_value[3]->align(FL_ALIGN_RIGHT);
2400
2478
      mesh_value[3]->callback(mesh_options_ok_cb);
2401
2479
 
2402
 
      mesh_butt[4] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Use incomplete high order elements (8-node quads, etc.)");
 
2480
      mesh_butt[4] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 9 * BH, BW, BH, "Use incomplete high order elements (8-node quads, etc.)");
2403
2481
      mesh_butt[4]->type(FL_TOGGLE_BUTTON);
2404
2482
      mesh_butt[4]->callback(mesh_options_ok_cb);
2405
2483
 
2410
2488
      Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Advanced");
2411
2489
      o->hide();
2412
2490
 
2413
 
      mesh_butt[1] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Compute characteritic lengths from curvatures" );
 
2491
      mesh_butt[1] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Compute characteristic lengths from curvature" );
2414
2492
      mesh_butt[1]->type(FL_TOGGLE_BUTTON);
2415
2493
      mesh_butt[1]->callback(mesh_options_ok_cb);
2416
2494
 
2417
 
      mesh_butt[5] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Constrain background mesh with other length fields");
 
2495
      mesh_butt[5] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Compute characteristic lengths from values at points");
2418
2496
      mesh_butt[5]->type(FL_TOGGLE_BUTTON);
2419
2497
      mesh_butt[5]->callback(mesh_options_ok_cb);
2420
2498
 
2421
2499
      mesh_butt[2] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Optimize quality of tetrahedra");
2422
2500
      mesh_butt[2]->type(FL_TOGGLE_BUTTON);
 
2501
      mesh_butt[2]->callback(mesh_options_ok_cb);
 
2502
 
 
2503
      mesh_butt[24] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Optimize quality of tetrahedra with Netgen");
 
2504
      mesh_butt[24]->type(FL_TOGGLE_BUTTON);
2423
2505
#if !defined(HAVE_NETGEN)
2424
 
      mesh_butt[2]->deactivate();
 
2506
      mesh_butt[24]->deactivate();
2425
2507
#endif
2426
 
      mesh_butt[2]->callback(mesh_options_ok_cb);
 
2508
      mesh_butt[24]->callback(mesh_options_ok_cb);
2427
2509
 
2428
 
      mesh_butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Optimize high order mesh (only for 2D-plane)");
 
2510
      mesh_butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Optimize high order mesh (only for 2D-plane)");
2429
2511
      mesh_butt[3]->type(FL_TOGGLE_BUTTON);
2430
2512
      mesh_butt[3]->callback(mesh_options_ok_cb);
2431
2513
 
2432
 
      mesh_butt[21] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Impose C1 continuity (only for 2D-plane, order 2 and 3)");
 
2514
      mesh_butt[21] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Impose C1 continuity (only for 2D-plane, order 2 and 3)");
2433
2515
      mesh_butt[21]->type(FL_TOGGLE_BUTTON);
2434
2516
      mesh_butt[21]->callback(mesh_options_ok_cb);
2435
2517
 
2507
2589
      mesh_value[12]->callback(mesh_options_ok_cb);
2508
2590
 
2509
2591
      static Fl_Menu_Item menu_mesh_element_types[] = {
2510
 
        {"Triangles",   0, 0, 0, FL_MENU_TOGGLE},
2511
 
        {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE},
2512
 
        {"Tetrahedra",  0, 0, 0, FL_MENU_TOGGLE},
2513
 
        {"Hexahedra",   0, 0, 0, FL_MENU_TOGGLE},
2514
 
        {"Prisms",      0, 0, 0, FL_MENU_TOGGLE},
2515
 
        {"Pyramids",    0, 0, 0, FL_MENU_TOGGLE},
2516
 
        {0}
 
2592
        {"Triangles",   0, 0, 0, FL_MENU_TOGGLE},
 
2593
        {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE},
 
2594
        {"Tetrahedra",  0, 0, 0, FL_MENU_TOGGLE},
 
2595
        {"Hexahedra",   0, 0, 0, FL_MENU_TOGGLE},
 
2596
        {"Prisms",      0, 0, 0, FL_MENU_TOGGLE},
 
2597
        {"Pyramids",    0, 0, 0, FL_MENU_TOGGLE},
 
2598
        {0}
2517
2599
      };
2518
2600
 
2519
2601
      mesh_menu_butt = new Fl_Menu_Button(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Elements");
2738
2820
    Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB);
2739
2821
    {
2740
2822
      {
2741
 
        Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General");
2742
 
 
2743
 
        solver_value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Maximum delay for solver response");
2744
 
        solver_value[0]->minimum(0);
2745
 
        solver_value[0]->maximum(10);
2746
 
        solver_value[0]->step(1);
2747
 
        solver_value[0]->align(FL_ALIGN_RIGHT);
2748
 
        solver_value[0]->callback(solver_options_ok_cb);
2749
 
 
2750
 
        solver_input[0] = new Fl_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Socket name");
2751
 
        solver_input[0]->align(FL_ALIGN_RIGHT);
2752
 
        solver_input[0]->callback(solver_options_ok_cb);
2753
 
 
2754
 
        solver_butt[0] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Always listen to incoming connection requests");
2755
 
        solver_butt[0]->type(FL_TOGGLE_BUTTON);
2756
 
        solver_butt[0]->callback(solver_options_ok_cb);
2757
 
        
2758
 
        o->end();
 
2823
        Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General");
 
2824
 
 
2825
        solver_value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Maximum delay for solver response");
 
2826
        solver_value[0]->minimum(0);
 
2827
        solver_value[0]->maximum(10);
 
2828
        solver_value[0]->step(1);
 
2829
        solver_value[0]->align(FL_ALIGN_RIGHT);
 
2830
        solver_value[0]->callback(solver_options_ok_cb);
 
2831
 
 
2832
        solver_input[0] = new Fl_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Socket name");
 
2833
        solver_input[0]->align(FL_ALIGN_RIGHT);
 
2834
        solver_input[0]->callback(solver_options_ok_cb);
 
2835
 
 
2836
        solver_butt[0] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Always listen to incoming connection requests");
 
2837
        solver_butt[0]->type(FL_TOGGLE_BUTTON);
 
2838
        solver_butt[0]->callback(solver_options_ok_cb);
 
2839
        
 
2840
        o->end();
2759
2841
      }
2760
2842
    }
2761
2843
    o->end();
2821
2903
      Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General");
2822
2904
 
2823
2905
      static Fl_Menu_Item menu_plot_type[] = {
2824
 
        {"3D", 0, 0, 0},
2825
 
        {"2D space", 0, 0, 0},
2826
 
        {"2D time", 0, 0, 0},
2827
 
        {0}
 
2906
        {"3D", 0, 0, 0},
 
2907
        {"2D space", 0, 0, 0},
 
2908
        {"2D time", 0, 0, 0},
 
2909
        {0}
2828
2910
      };
2829
2911
      view_choice[13] = new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Plot type");
2830
2912
      view_choice[13]->menu(menu_plot_type);
2862
2944
      
2863
2945
      static Fl_Menu_Item menu_iso[] = {
2864
2946
        {"Iso-values", 0, 0, 0},
 
2947
        {"Continuous map", 0, 0, 0},
2865
2948
        {"Filled iso-values", 0, 0, 0},
2866
 
        {"Continuous map", 0, 0, 0},
2867
2949
        {"Numeric values", 0, 0, 0},
2868
2950
        {0}
2869
2951
      };
2875
2957
 
2876
2958
      static Fl_Menu_Item menu_range[] = {
2877
2959
        {"Default", 0, 0, 0},
 
2960
        {"Custom", 0, 0, 0},
2878
2961
        {"Per time step", 0, 0, 0},
2879
 
        {"Custom", 0, 0, 0},
2880
2962
        {0}
2881
2963
      };
2882
2964
      view_choice[7] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Range mode");
2933
3015
      view_choice[8]->tooltip("(Alt+a)");
2934
3016
      view_choice[8]->callback(view_options_ok_cb, (void*)"view_axes");
2935
3017
 
 
3018
      view_butt[3] = new Fl_Check_Button(L + width / 2 + 4 * WB, 2 * WB + 1 * BH, IW, BH, "Mikado style");
 
3019
      view_butt[3]->type(FL_TOGGLE_BUTTON);
 
3020
      view_butt[3]->callback(view_options_ok_cb);
 
3021
 
2936
3022
      view_value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW/3, BH);
2937
3023
      view_value[3]->minimum(0.);
2938
3024
      view_value[3]->step(1);
3026
3112
      view_butt[4]->callback(view_options_ok_cb);
3027
3113
 
3028
3114
      static Fl_Menu_Item time_display[] = {
3029
 
        {"None", 0, 0, 0},
3030
 
        {"Value if multi-step", 0, 0, 0},
3031
 
        {"Value", 0, 0, 0},
3032
 
        {"Step if multi-step", 0, 0, 0},
3033
 
        {"Step", 0, 0, 0},
3034
 
        {0}
 
3115
        {"None", 0, 0, 0},
 
3116
        {"Value if multi-step", 0, 0, 0},
 
3117
        {"Value", 0, 0, 0},
 
3118
        {"Step if multi-step", 0, 0, 0},
 
3119
        {"Step", 0, 0, 0},
 
3120
        {0}
3035
3121
      };
3036
3122
      view_choice[12] = new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Time display mode");
3037
3123
      view_choice[12]->menu(time_display);
3043
3129
      view_butt[5]->type(FL_TOGGLE_BUTTON);
3044
3130
      view_butt[5]->callback(view_options_ok_cb);
3045
3131
 
3046
 
      view_butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Draw element outlines");
 
3132
      view_butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW / 2, BH, "Draw element outlines");
3047
3133
      view_butt[10]->tooltip("(Alt+e)");
3048
3134
      view_butt[10]->type(FL_TOGGLE_BUTTON);
3049
3135
      view_butt[10]->callback(view_options_ok_cb);
3050
3136
 
 
3137
      view_butt[2] = new Fl_Check_Button(L + 2 * WB + BW / 2, 2 * WB + 4 * BH, BW / 2, BH, "Draw 3D skin only");
 
3138
      view_butt[2]->type(FL_TOGGLE_BUTTON);
 
3139
      view_butt[2]->callback(view_options_ok_cb);
 
3140
 
3051
3141
      static Fl_Menu_Item menu_view_element_types[] = {
3052
 
        {"Points",      0, 0, 0, FL_MENU_TOGGLE},
3053
 
        {"Lines",       0, 0, 0, FL_MENU_TOGGLE},
3054
 
        {"Triangles",   0, 0, 0, FL_MENU_TOGGLE},
3055
 
        {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE},
3056
 
        {"Tetrahedra",  0, 0, 0, FL_MENU_TOGGLE},
3057
 
        {"Hexahedra",   0, 0, 0, FL_MENU_TOGGLE},
3058
 
        {"Prisms",      0, 0, 0, FL_MENU_TOGGLE},
3059
 
        {"Pyramids",    0, 0, 0, FL_MENU_TOGGLE},
3060
 
        {0}
 
3142
        {"Points",      0, 0, 0, FL_MENU_TOGGLE},
 
3143
        {"Lines",       0, 0, 0, FL_MENU_TOGGLE},
 
3144
        {"Triangles",   0, 0, 0, FL_MENU_TOGGLE},
 
3145
        {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE},
 
3146
        {"Tetrahedra",  0, 0, 0, FL_MENU_TOGGLE},
 
3147
        {"Hexahedra",   0, 0, 0, FL_MENU_TOGGLE},
 
3148
        {"Prisms",      0, 0, 0, FL_MENU_TOGGLE},
 
3149
        {"Pyramids",    0, 0, 0, FL_MENU_TOGGLE},
 
3150
        {0}
3061
3151
      };
3062
3152
 
3063
3153
      view_menu_butt[1] = new Fl_Menu_Button(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Elements");
3065
3155
      view_menu_butt[1]->callback(view_options_ok_cb);
3066
3156
      
3067
3157
      static Fl_Menu_Item menu_boundary[] = {
3068
 
        {"None", 0, 0, 0},
3069
 
        {"Dimension - 1", 0, 0, 0},
3070
 
        {"Dimension - 2", 0, 0, 0},
3071
 
        {"Dimension - 3", 0, 0, 0},
3072
 
        {0}
 
3158
        {"None", 0, 0, 0},
 
3159
        {"Dimension - 1", 0, 0, 0},
 
3160
        {"Dimension - 2", 0, 0, 0},
 
3161
        {"Dimension - 3", 0, 0, 0},
 
3162
        {0}
3073
3163
      };
3074
3164
      view_choice[9] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Element boundary mode");
3075
3165
      view_choice[9]->menu(menu_boundary);
3093
3183
      view_value[1]->callback(view_options_ok_cb);
3094
3184
 
3095
3185
      static Fl_Menu_Item menu_view_field_types[] = {
3096
 
        {"Scalar", 0, 0, 0, FL_MENU_TOGGLE},
3097
 
        {"Vector", 0, 0, 0, FL_MENU_TOGGLE},
3098
 
        {"Tensor", 0, 0, 0, FL_MENU_TOGGLE},
3099
 
        {0}
 
3186
        {"Scalar", 0, 0, 0, FL_MENU_TOGGLE},
 
3187
        {"Vector", 0, 0, 0, FL_MENU_TOGGLE},
 
3188
        {"Tensor", 0, 0, 0, FL_MENU_TOGGLE},
 
3189
        {0}
3100
3190
      };
3101
3191
 
3102
3192
      view_menu_butt[0] = new Fl_Menu_Button(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Fields");
3106
3196
      view_value[33] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Maximum recursion level");
3107
3197
      view_value[33]->align(FL_ALIGN_RIGHT);
3108
3198
      view_value[33]->minimum(0);
3109
 
      view_value[33]->maximum(MAX_LEVEL_OF_ZOOM);
 
3199
      view_value[33]->maximum(8);
3110
3200
      view_value[33]->step(1);
3111
 
      view_value[33]->value(0);
3112
3201
      view_value[33]->when(FL_WHEN_RELEASE);
3113
3202
      view_value[33]->callback(view_options_ok_cb);
3114
3203
 
3115
3204
      view_value[34] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Target error");
3116
3205
      view_value[34]->align(FL_ALIGN_RIGHT);
3117
 
      view_value[34]->minimum(0);
3118
 
      view_value[34]->maximum(1);
3119
 
      view_value[34]->value(1.e-2);
 
3206
      view_value[34]->minimum(0.);
 
3207
      view_value[34]->maximum(1.);
 
3208
      view_value[34]->step(1.e-3);
3120
3209
      view_value[34]->when(FL_WHEN_RELEASE);
3121
3210
      view_value[34]->callback(view_options_ok_cb);
3122
3211
 
3152
3241
      view_value[44] = new Fl_Value_Input(L + 2 * WB + 2 * IW-WB, 2 * WB + 3 * BH, 7*IW/10, BH, "Y");
3153
3242
      view_value[45] = new Fl_Value_Input(L + 2 * WB + 2 * IW-WB, 2 * WB + 4 * BH, 7*IW/10, BH, "Z");
3154
3243
 
3155
 
      for(int i = 40; i <= 45; i++){
3156
 
        view_value[i]->align(FL_ALIGN_RIGHT);
3157
 
        view_value[i]->when(FL_WHEN_RELEASE);
3158
 
        view_value[i]->callback(view_options_ok_cb);
 
3244
      view_value[46] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, 3*ss, BH, "Normal raise");
 
3245
 
 
3246
      for(int i = 40; i <= 46; i++){
 
3247
        view_value[i]->align(FL_ALIGN_RIGHT);
 
3248
        view_value[i]->when(FL_WHEN_RELEASE);
 
3249
        view_value[i]->callback(view_options_ok_cb);
3159
3250
      }
3160
3251
      for(int i = 51; i <= 59; i++){
3161
 
        view_value[i]->minimum(-1.);
3162
 
        view_value[i]->maximum(1.);
3163
 
        view_value[i]->step(0.1);
3164
 
        view_value[i]->align(FL_ALIGN_RIGHT);
3165
 
        view_value[i]->when(FL_WHEN_RELEASE);
3166
 
        view_value[i]->callback(view_options_ok_cb);
 
3252
        view_value[i]->minimum(-1.);
 
3253
        view_value[i]->maximum(1.);
 
3254
        view_value[i]->step(0.1);
 
3255
        view_value[i]->align(FL_ALIGN_RIGHT);
 
3256
        view_value[i]->when(FL_WHEN_RELEASE);
 
3257
        view_value[i]->callback(view_options_ok_cb);
3167
3258
      }
3168
3259
 
3169
 
      view_butt[6] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Use general transformation expressions");
 
3260
      view_butt[6] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Use general transformation expressions");
3170
3261
      view_butt[6]->type(FL_TOGGLE_BUTTON);
3171
3262
      view_butt[6]->callback(view_options_ok_cb, (void*)"general_transform");
3172
3263
 
3173
 
      view_choice[11] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Data source");
 
3264
      view_choice[11] = new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Data source");
3174
3265
      view_choice[11]->align(FL_ALIGN_RIGHT);
3175
3266
      view_choice[11]->add("Self");
3176
3267
      view_choice[11]->callback(view_options_ok_cb);
3177
3268
 
3178
 
      view_value[2] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Factor");
 
3269
      view_value[2] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Factor");
3179
3270
      view_value[2]->align(FL_ALIGN_RIGHT);
3180
3271
      view_value[2]->when(FL_WHEN_RELEASE);
3181
3272
      view_value[2]->callback(view_options_ok_cb);
3182
3273
 
3183
 
      view_input[4] = new Fl_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "X expression");
 
3274
      view_input[4] = new Fl_Input(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "X expression");
3184
3275
      view_input[4]->align(FL_ALIGN_RIGHT);
3185
3276
      view_input[4]->callback(view_options_ok_cb);
3186
3277
 
3187
 
      view_input[5] = new Fl_Input(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Y expression");
 
3278
      view_input[5] = new Fl_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Y expression");
3188
3279
      view_input[5]->align(FL_ALIGN_RIGHT);
3189
3280
      view_input[5]->callback(view_options_ok_cb);
3190
3281
 
3191
 
      view_input[6] = new Fl_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Z expression");
 
3282
      view_input[6] = new Fl_Input(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Z expression");
3192
3283
      view_input[6]->align(FL_ALIGN_RIGHT);
3193
3284
      view_input[6]->callback(view_options_ok_cb);
3194
3285
 
3207
3298
      view_value[12]->callback(view_options_ok_cb);
3208
3299
 
3209
3300
      view_choice[5] = new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point display");
3210
 
      view_choice[5]->menu(menu_point_display);
 
3301
      view_choice[5]->menu(menu_point_display_post);
3211
3302
      view_choice[5]->align(FL_ALIGN_RIGHT);
3212
3303
      view_choice[5]->callback(view_options_ok_cb);
3213
3304
 
3219
3310
      view_value[61]->callback(view_options_ok_cb);
3220
3311
 
3221
3312
      view_choice[6] = new Fl_Choice(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line display");
3222
 
      view_choice[6]->menu(menu_line_display);
 
3313
      view_choice[6]->menu(menu_line_display_post);
3223
3314
      view_choice[6]->align(FL_ALIGN_RIGHT);
3224
3315
      view_choice[6]->callback(view_options_ok_cb);
3225
3316
 
3244
3335
        view_choice[2] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Vector display");
3245
3336
        view_choice[2]->menu(menu_vectype);
3246
3337
        view_choice[2]->align(FL_ALIGN_RIGHT);
3247
 
        view_choice[2]->callback(view_options_ok_cb);
 
3338
        view_choice[2]->callback(view_options_ok_cb);
3248
3339
 
3249
 
        view_push_butt[0] = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 6 * BH, (int)(1.5*BB), BH, "Edit arrow shape");
 
3340
        view_push_butt[0] = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 6 * BH, (int)(1.5*BB), BH, "Edit arrow shape");
3250
3341
        view_push_butt[0]->callback(view_arrow_param_cb);
3251
3342
 
3252
3343
        view_value[60] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Arrow size");
3254
3345
        view_value[60]->maximum(500);
3255
3346
        view_value[60]->step(1);
3256
3347
        view_value[60]->align(FL_ALIGN_RIGHT);
3257
 
        view_value[60]->callback(view_options_ok_cb);
 
3348
        view_value[60]->callback(view_options_ok_cb);
3258
3349
 
3259
 
        view_butt[0] = new Fl_Check_Button(L + 2 * IW - 2 * WB, 2 * WB + 7 * BH, (int)(1.5*BB), BH, "Proportional");
3260
 
        view_butt[0]->type(FL_TOGGLE_BUTTON);
3261
 
        view_butt[0]->callback(view_options_ok_cb);
 
3350
        view_butt[0] = new Fl_Check_Button(L + 2 * IW - 2 * WB, 2 * WB + 7 * BH, (int)(1.5*BB), BH, "Proportional");
 
3351
        view_butt[0]->type(FL_TOGGLE_BUTTON);
 
3352
        view_butt[0]->callback(view_options_ok_cb);
3262
3353
 
3263
3354
        view_value[63] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Displacement factor");
3264
3355
        view_value[63]->minimum(0.);
3265
3356
        view_value[63]->maximum(1.);
3266
3357
        view_value[63]->step(0.01);
3267
3358
        view_value[63]->align(FL_ALIGN_RIGHT);
3268
 
        view_value[63]->when(FL_WHEN_RELEASE);
3269
 
        view_value[63]->callback(view_options_ok_cb);
 
3359
        view_value[63]->when(FL_WHEN_RELEASE);
 
3360
        view_value[63]->callback(view_options_ok_cb);
3270
3361
 
3271
3362
        view_choice[10] = new Fl_Choice(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Data source");
3272
3363
        view_choice[10]->align(FL_ALIGN_RIGHT);
3273
 
        view_choice[10]->add("Self");
3274
 
        view_choice[10]->callback(view_options_ok_cb);
 
3364
        view_choice[10]->add("Self");
 
3365
        view_choice[10]->callback(view_options_ok_cb);
3275
3366
 
3276
3367
        view_vector->end();
3277
3368
      }
3278
3369
 
3279
3370
      static Fl_Menu_Item menu_vecloc[] = {
3280
 
        {"Barycenter", 0, 0, 0},
3281
 
        {"Vertex", 0, 0, 0},
3282
 
        {0}
 
3371
        {"Barycenter", 0, 0, 0},
 
3372
        {"Vertex", 0, 0, 0},
 
3373
        {0}
3283
3374
      };
3284
3375
      view_choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Glyph location");
3285
3376
      view_choice[3]->menu(menu_vecloc);
3286
3377
      view_choice[3]->align(FL_ALIGN_RIGHT);
3287
3378
      view_choice[3]->callback(view_options_ok_cb);
 
3379
 
 
3380
      view_butt[1] = new Fl_Check_Button(L + 2 * IW - 2 * WB, 2 * WB + 10 * BH, (int)(1.5*BB), BH, "Center glyphs");
 
3381
      view_butt[1]->type(FL_TOGGLE_BUTTON);
 
3382
      view_butt[1]->callback(view_options_ok_cb);
3288
3383
      
3289
3384
      static Fl_Menu_Item menu_tensor[] = {
3290
 
        {"Von-Mises", 0, 0, 0},
3291
 
        {"LMGC90", 0, 0, 0}, 
3292
 
        {"LMGC90 Type", 0, 0, 0}, 
3293
 
        {"LMGC90 Coordinance", 0, 0, 0}, 
3294
 
        {"LMGC90 Pression", 0, 0, 0}, 
3295
 
        {"LMGC90 Normal stress", 0, 0, 0}, 
3296
 
        {"LMGC90 X displacement", 0, 0, 0}, 
3297
 
        {"LMGC90 Y displacement", 0, 0, 0}, 
3298
 
        {"LMGC90 Z displacement", 0, 0, 0}, 
3299
 
        {"LMGC90 Average displacement", 0, 0, 0}, 
3300
 
        {"LMGC90 Norm of displacement", 0, 0, 0}, 
3301
 
        {0}
 
3385
        {"Von-Mises", 0, 0, 0},
 
3386
        {0}
3302
3387
      };
3303
3388
      view_choice[4] = new Fl_Choice(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Tensor display");
3304
3389
      view_choice[4]->menu(menu_tensor);
3381
3466
 
3382
3467
void GUI::update_view_window(int num)
3383
3468
{
3384
 
  if(num < 0 || num >= List_Nbr(CTX.post.list))
3385
 
    return;
 
3469
  if(num < 0 || num >= (int)PView::list.size()) return;
3386
3470
 
3387
3471
  view_number = num;
3388
 
  Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, num);
3389
 
 
3390
 
  double maxval = MAX(fabs(v->Min), fabs(v->Max));
 
3472
 
 
3473
  PView *view = PView::list[num];
 
3474
  PViewData *data = view->getData();
 
3475
  PViewOptions *opt = view->getOptions();
 
3476
 
 
3477
  double maxval = MAX(fabs(data->getMin()), fabs(data->getMax()));
3391
3478
  if(!maxval) maxval = 1.;
3392
3479
  double val1 = 10. * CTX.lc;
3393
3480
  double val2 = 2. * CTX.lc / maxval;
3398
3485
  opt_view_show_scale(num, GMSH_GUI, 0);
3399
3486
  opt_view_draw_strings(num, GMSH_GUI, 0);
3400
3487
 
3401
 
  opt_view_max_recursion_level (num, GMSH_GUI, 0);
3402
 
  opt_view_target_error (num, GMSH_GUI, 0);
3403
 
  if(v->adaptive){
 
3488
  opt_view_max_recursion_level(num, GMSH_GUI, 0);
 
3489
  opt_view_target_error(num, GMSH_GUI, 0);
 
3490
  if(data->isAdaptive()){
3404
3491
    view_value[33]->activate();
3405
3492
    view_value[34]->activate();
3406
3493
  }
3409
3496
    view_value[34]->deactivate();
3410
3497
  }
3411
3498
 
3412
 
  if(v->NbSP) {
 
3499
  if(data->getNumPoints() || data->getNumLines()){
3413
3500
    ((Fl_Menu_Item*)view_choice[13]->menu())[1].activate();
3414
3501
    ((Fl_Menu_Item*)view_choice[13]->menu())[2].activate();
3415
3502
  }
3425
3512
  opt_view_size1(num, GMSH_GUI, 0);
3426
3513
 
3427
3514
  opt_view_axes(num, GMSH_GUI, 0);
 
3515
  opt_view_axes_mikado(num, GMSH_GUI, 0);
3428
3516
  opt_view_axes_format0(num, GMSH_GUI, NULL);
3429
3517
  opt_view_axes_format1(num, GMSH_GUI, NULL);
3430
3518
  opt_view_axes_format2(num, GMSH_GUI, NULL);
3447
3535
    view_value[i]->maximum(CTX.lc);
3448
3536
  }
3449
3537
 
3450
 
  if(v->TextOnly) {
 
3538
  if(data->getNumElements()) {
 
3539
    view_range->activate();
 
3540
    ((Fl_Menu_Item*)view_choice[13]->menu())[0].activate();
 
3541
  }
 
3542
  else {
3451
3543
    view_range->deactivate();
3452
3544
    ((Fl_Menu_Item*)view_choice[13]->menu())[0].deactivate();
3453
3545
  }
3454
 
  else {
3455
 
    view_range->activate();
3456
 
    ((Fl_Menu_Item*)view_choice[13]->menu())[0].activate();
3457
 
  }
3458
3546
  opt_view_show_element(num, GMSH_GUI, 0);
 
3547
  opt_view_draw_skin_only(num, GMSH_GUI, 0);
3459
3548
  opt_view_light(num, GMSH_GUI, 0);
3460
3549
  opt_view_light_two_side(num, GMSH_GUI, 0);
3461
3550
  opt_view_light_lines(num, GMSH_GUI, 0);
3505
3594
  opt_view_raise0(num, GMSH_GUI, 0);
3506
3595
  opt_view_raise1(num, GMSH_GUI, 0);
3507
3596
  opt_view_raise2(num, GMSH_GUI, 0);
3508
 
  for(int i = 43; i <= 45; i++) {
 
3597
  opt_view_normal_raise(num, GMSH_GUI, 0);
 
3598
  for(int i = 43; i <= 46; i++) {
3509
3599
    view_value[i]->step(val2/100.);
3510
3600
    view_value[i]->minimum(-val2);
3511
3601
    view_value[i]->maximum(val2);
3520
3610
  view_value[2]->minimum(-val2);
3521
3611
  view_value[2]->maximum(val2);
3522
3612
 
3523
 
  if(v->NbTimeStep == 1) {
 
3613
  if(data->getNumTimeSteps() == 1) {
3524
3614
    view_value[50]->deactivate();
3525
3615
    view_butt_rep[0]->deactivate();
3526
3616
    view_butt_rep[1]->deactivate();
3530
3620
    view_butt_rep[0]->activate();
3531
3621
    view_butt_rep[1]->activate();
3532
3622
  }
3533
 
  view_value[50]->maximum(v->NbTimeStep - 1);
 
3623
  view_value[50]->maximum(data->getNumTimeSteps() - 1);
3534
3624
  opt_view_timestep(num, GMSH_GUI, 0);
3535
3625
  opt_view_show_time(num, GMSH_GUI, 0);
3536
3626
 
3537
 
  if(v->ScalarOnly)
 
3627
  if(data->getNumVectors() || data->getNumTensors())
 
3628
    view_vector->activate();
 
3629
  else
3538
3630
    view_vector->deactivate();
3539
 
  else
3540
 
    view_vector->activate();
 
3631
 
3541
3632
  opt_view_point_size(num, GMSH_GUI, 0);
3542
3633
  opt_view_point_type(num, GMSH_GUI, 0);
3543
3634
  opt_view_line_width(num, GMSH_GUI, 0);
3553
3644
 
3554
3645
  opt_view_external_view(num, GMSH_GUI, 0);
3555
3646
  opt_view_glyph_location(num, GMSH_GUI, 0);
 
3647
  opt_view_center_glyphs(num, GMSH_GUI, 0);
3556
3648
  opt_view_tensor_type(num, GMSH_GUI, 0);
3557
3649
 
3558
3650
  opt_view_fake_transparency(num, GMSH_GUI, 0);
3571
3663
  opt_view_color_text3d(num, GMSH_GUI, 0);
3572
3664
  opt_view_color_axes(num, GMSH_GUI, 0);
3573
3665
 
3574
 
  view_colorbar_window->update(v->Name, v->Min, v->Max, &v->CT, &v->Changed);
 
3666
  view_colorbar_window->update(data->getName().c_str(), data->getMin(), 
 
3667
                               data->getMax(), &opt->CT, &view->getChanged());
3575
3668
}
3576
3669
 
3577
3670
// Create the plugin manager window
3599
3692
        p->dialogBox->input[i] = new Fl_Input(x + WB, y + WB + (k + 1) * BH, IW, BH, sxs->str);
3600
3693
        p->dialogBox->input[i]->align(FL_ALIGN_RIGHT);
3601
3694
        p->dialogBox->input[i]->value(sxs->def);
3602
 
        k++;
 
3695
        k++;
3603
3696
      }
3604
3697
      for(int i = 0; i < n; i++) {
3605
3698
        StringXNumber *sxn = p->getOption(i);
3606
3699
        p->dialogBox->value[i] = new Fl_Value_Input(x + WB, y + WB + (k + 1) * BH, IW, BH, sxn->str);
3607
3700
        p->dialogBox->value[i]->align(FL_ALIGN_RIGHT);
3608
3701
        p->dialogBox->value[i]->value(sxn->def);
3609
 
        k++;
 
3702
        k++;
3610
3703
      }
3611
3704
 
3612
3705
      s->end();
3654
3747
  char str[128];
3655
3748
  plugin_view_browser->clear();
3656
3749
 
3657
 
  if(List_Nbr(CTX.post.list)){
 
3750
  if(PView::list.size()){
3658
3751
    plugin_view_browser->activate();
3659
 
    for(int i = 0; i < List_Nbr(CTX.post.list); i++) {
 
3752
    for(unsigned int i = 0; i < PView::list.size(); i++) {
3660
3753
      sprintf(str, "View [%d]", i);
3661
3754
      plugin_view_browser->add(str);
3662
3755
    }
3663
3756
    for(int i = 0; i < plugin_view_browser->size(); i++){
3664
 
      if(i < state.size() && state[i])
3665
 
        plugin_view_browser->select(i + 1);
 
3757
      if(i < (int)state.size() && state[i])
 
3758
        plugin_view_browser->select(i + 1);
3666
3759
    }
3667
3760
  }
3668
3761
  else{
3683
3776
 
3684
3777
  if(plugin_window) {
3685
3778
    reset_plugin_view_browser();
3686
 
    if(numview >= 0 && numview < List_Nbr(CTX.post.list)){
 
3779
    if(numview >= 0 && numview < (int)PView::list.size()){
3687
3780
      plugin_view_browser->deselect();
3688
3781
      plugin_view_browser->select(numview + 1);
3689
3782
      view_plugin_browser_cb(NULL, NULL);
3692
3785
    return;
3693
3786
  }
3694
3787
 
3695
 
  plugin_window = new Dialog_Window(width, height, "Plugins");
 
3788
  plugin_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Plugins");
3696
3789
  plugin_window->box(GMSH_WINDOW_BOX);
3697
3790
 
3698
3791
  {
3723
3816
      create_plugin_dialog_box(p, 2 * WB + L1 + L2, WB, width - L1 - L2 - 3 * WB, height - 3 * WB - BH);
3724
3817
      // select first plugin by default
3725
3818
      if(it == GMSH_PluginManager::instance()->begin()){
3726
 
        plugin_browser->select(1);
3727
 
        p->dialogBox->group->show();
 
3819
        plugin_browser->select(1);
 
3820
        p->dialogBox->group->show();
3728
3821
      }
3729
3822
    }
3730
3823
  }
3737
3830
  plugin_window->end();
3738
3831
}
3739
3832
 
 
3833
void FieldDialogBox::save_values()
 
3834
{
 
3835
  std::list<Fl_Widget*>::iterator input=inputs.begin();
 
3836
  Field *f=current_field;
 
3837
  std::ostringstream sstream;
 
3838
  std::istringstream istream;
 
3839
  int i;
 
3840
  char a;
 
3841
  sstream.precision(16);
 
3842
  for(std::map<const char*,FieldOption*>::iterator it=f->options.begin();it!=f->options.end();it++){
 
3843
    FieldOption *option=it->second;
 
3844
    sstream.str("");
 
3845
    switch(option->get_type()){
 
3846
    case FIELD_OPTION_STRING:
 
3847
    case FIELD_OPTION_PATH:
 
3848
      sstream<<"\""<<((Fl_Input*)*input)->value()<<"\"";
 
3849
      break;
 
3850
    case FIELD_OPTION_INT:
 
3851
      sstream<<(int)((Fl_Value_Input*)*input)->value();
 
3852
      break;
 
3853
    case FIELD_OPTION_DOUBLE:
 
3854
      sstream<<((Fl_Value_Input*)*input)->value();
 
3855
      break;
 
3856
    case FIELD_OPTION_BOOL:
 
3857
      sstream<<(bool)((Fl_Check_Button*)*input)->value();
 
3858
      break;
 
3859
    case FIELD_OPTION_LIST:
 
3860
      sstream<<"{";
 
3861
      istream.str(((Fl_Input*)*input)->value());
 
3862
      while(istream>>i){
 
3863
        sstream<<i;
 
3864
        if(istream>>a){
 
3865
          if(a!=',')
 
3866
            Msg(GERROR, "Unexpected character \'%c\' while parsing option '%s' of field \'%s\'",a,it->first,f->id);
 
3867
          sstream<<", ";
 
3868
        }
 
3869
      }
 
3870
      sstream<<"}";
 
3871
      break;
 
3872
    }
 
3873
    if((*input)->changed()){
 
3874
      add_field_option(f->id,it->first,sstream.str().c_str(),CTX.filename);
 
3875
      (*input)->clear_changed();
 
3876
    }
 
3877
    input++;
 
3878
  }
 
3879
}
 
3880
 
 
3881
void FieldDialogBox::load_field(Field *f)
 
3882
{
 
3883
  current_field=f;
 
3884
  std::list<Fl_Widget*>::iterator input=inputs.begin();
 
3885
  for(std::map<const char*,FieldOption*>::iterator it=f->options.begin();it!=f->options.end();it++){
 
3886
    FieldOption *option=it->second;
 
3887
    std::ostringstream vstr;
 
3888
    std::list<int>::iterator list_it;;
 
3889
    switch(option->get_type()){
 
3890
    case FIELD_OPTION_STRING:
 
3891
    case FIELD_OPTION_PATH:
 
3892
      ((Fl_Input*)(*input))->value(option->string().c_str());
 
3893
      break;
 
3894
    case FIELD_OPTION_INT:
 
3895
    case FIELD_OPTION_DOUBLE:
 
3896
      ((Fl_Value_Input*)(*input))->value(option->numerical_value());
 
3897
      break;
 
3898
    case FIELD_OPTION_BOOL:
 
3899
      ((Fl_Check_Button*)(*input))->value((int)option->numerical_value());
 
3900
      break;
 
3901
    case FIELD_OPTION_LIST:
 
3902
      vstr.str("");
 
3903
      for(list_it=option->list().begin();list_it!=option->list().end();list_it++){
 
3904
        if(list_it!=option->list().begin())
 
3905
          vstr<<", ";
 
3906
        vstr<<*list_it;
 
3907
      }
 
3908
      ((Fl_Input*)(*input))->value(vstr.str().c_str());
 
3909
      break;
 
3910
    }
 
3911
    input++;
 
3912
  }
 
3913
  if(PView::list.size()){
 
3914
    put_on_view_btn->activate();
 
3915
    for(unsigned int i = 0; i < PView::list.size(); i++) {
 
3916
      std::ostringstream s;
 
3917
      s<<"View ["<<i<<"]";
 
3918
      put_on_view_btn->add(s.str().c_str());
 
3919
    }
 
3920
  }
 
3921
  else{
 
3922
    put_on_view_btn->deactivate();
 
3923
  }
 
3924
  set_size_btn->value(GModel::current()->getFields()->background_field==f->id);
 
3925
}
 
3926
 
 
3927
FieldDialogBox::FieldDialogBox(Field *f, int x, int y, int width, int height,int fontsize)
 
3928
{
 
3929
  current_field=NULL;
 
3930
  group=new Fl_Group(x, y, width, height);
 
3931
  {
 
3932
    Fl_Box *b = new Fl_Box(x, y, width, BH,f->get_name());
 
3933
    b->labelfont(FL_BOLD);
 
3934
    Fl_Tabs *o = new Fl_Tabs(x, y + BH + WB, width, height-2*BH-2*WB);
 
3935
    group->resizable(o);
 
3936
    {
 
3937
      Fl_Group *g = new Fl_Group(x, y + 2*BH + WB, width, height - 2*BH-3*WB, "Options");
 
3938
      apply_btn = new Fl_Return_Button(x+width - BB-WB ,y+ height - 2*BH -2*WB, BB, BH, "Apply");
 
3939
      apply_btn->callback(view_field_apply_cb,this);
 
3940
      revert_btn = new Fl_Button(x+width - 2*BB-2*WB ,y+ height - 2*BH -2*WB, BB, BH, "Revert");
 
3941
      revert_btn->callback(view_field_revert_cb,this);
 
3942
      Fl_Scroll *s = new Fl_Scroll(x + WB, y + 2*WB + 2*BH, width - 2 * WB, height - 4*BH - 5 * WB);
 
3943
      int yy=y+3*WB+2*BH;
 
3944
      for(std::map<const char*,FieldOption*>::iterator it=f->options.begin();it!=f->options.end();it++){
 
3945
        Fl_Widget *input;
 
3946
        switch(it->second->get_type()){
 
3947
        case FIELD_OPTION_INT:
 
3948
        case FIELD_OPTION_DOUBLE:
 
3949
          input=new Fl_Value_Input(x+WB,yy,IW,BH,it->first);
 
3950
          break;
 
3951
        case FIELD_OPTION_BOOL:
 
3952
          input=new Fl_Check_Button(x+WB,yy,BH,BH,it->first);
 
3953
          break;
 
3954
        case FIELD_OPTION_PATH:
 
3955
        case FIELD_OPTION_STRING:
 
3956
          input=new Fl_Input(x+WB,yy,IW,BH,it->first);
 
3957
          break;
 
3958
        case FIELD_OPTION_LIST:
 
3959
        default:
 
3960
          /*{
 
3961
            Fl_Button *b=new Fl_Button(x+WB,yy,BH,BH);
 
3962
            b->label("@+");
 
3963
            b->callback(view_field_select_node_cb);
 
3964
            }
 
3965
            input=new Fl_Input(x+WB+2*BH,yy,IW-2*BH,BH,it->first);*/
 
3966
          input=new Fl_Input(x+WB,yy,IW,BH,it->first);
 
3967
          break;
 
3968
        }
 
3969
        input->align(FL_ALIGN_RIGHT);
 
3970
        inputs.push_back(input);
 
3971
        yy+=WB+BH;
 
3972
      }
 
3973
      o->resizable(g); // to avoid ugly resizing of tab labels
 
3974
      g->resizable(s);
 
3975
      s->end();
 
3976
      g->end();
 
3977
    }
 
3978
    {
 
3979
      Fl_Group *g = new Fl_Group(x, y + 2*BH + WB, width, height - 2*BH-3*WB, "Help");
 
3980
      Fl_Browser *o = new Fl_Browser(x + WB, y + 2*WB + 2*BH, width - 2 * WB, height - 4 * WB - 3 * BH);
 
3981
      
 
3982
      //    char name[1024], copyright[256], author[256], help[4096];
 
3983
      //    p->getName(name);
 
3984
      //    p->getInfos(author, copyright, help);
 
3985
      
 
3986
      o->add(" ");
 
3987
      //   add_multiline_in_browser(o, "@c@b@.", name);
 
3988
      o->add(" ");
 
3989
      //  add_multiline_in_browser(o, "", help);
 
3990
      o->add(" ");
 
3991
      //add_multiline_in_browser(o, "Author: ", author);
 
3992
      //add_multiline_in_browser(o, "Copyright (C) ", copyright);
 
3993
      o->add(" ");
 
3994
      
 
3995
      g->end();
 
3996
    }
 
3997
    o->end();
 
3998
  }
 
3999
  {
 
4000
    Fl_Button *b = new Fl_Button(x+width - BB,y+ height - BH , BB, BH, "Delete");
 
4001
    b->callback(view_field_delete_cb,this);
 
4002
  }
 
4003
  put_on_view_btn = new Fl_Menu_Button(x+BB*3/2+WB,y+ height - BH ,BB*3/2,BH,"Put on view");
 
4004
  put_on_view_btn->callback(view_field_put_on_view_cb,this);
 
4005
  
 
4006
  set_size_btn = new Fl_Check_Button(x,y+ height - BH ,BB*3/2,BH,"Background size");
 
4007
  set_size_btn->callback(view_field_set_size_btn_cb,this);
 
4008
  
 
4009
  group->end();
 
4010
  group->hide();
 
4011
}
 
4012
 
 
4013
void GUI::create_field_window(int numfield)
 
4014
{
 
4015
  int width0 = 40 * fontsize;
 
4016
  int height0 = 13 * BH + 5 * WB;
 
4017
  
 
4018
  int width = (CTX.field_size[0] < width0) ? width0 : CTX.field_size[0];
 
4019
  int height = (CTX.field_size[1] < height0) ? height0 : CTX.field_size[1];
 
4020
  
 
4021
  int L1 = BB;
 
4022
  int i_entry=1;
 
4023
  if(field_window) {
 
4024
    width=field_window->w();
 
4025
    height=field_window->h();
 
4026
    FieldManager &fields=*GModel::current()->getFields();
 
4027
    field_browser->clear();
 
4028
    for(FieldManager::iterator it=fields.begin();it!=fields.end();it++){
 
4029
      Field *field=it->second;
 
4030
      std::ostringstream sstream;
 
4031
      if(it->first==fields.background_field)
 
4032
        sstream<<"*";
 
4033
      sstream<<it->first;
 
4034
      sstream<<" "<<field->get_name();
 
4035
      field_browser->add(sstream.str().c_str(),field);
 
4036
      if(!field->dialog_box()){
 
4037
        field_window->begin();
 
4038
        field->dialog_box()=new FieldDialogBox(field, 2 * WB + L1 , WB, width - L1 - 3 * WB, height - 2*WB  ,fontsize);
 
4039
        field_window->end();
 
4040
      }
 
4041
      if(it->second->id==numfield){
 
4042
        field_browser->select(i_entry);
 
4043
        field_browser->do_callback();
 
4044
      }
 
4045
      i_entry++;
 
4046
    }
 
4047
    field_window->show();
 
4048
    return;
 
4049
  }
 
4050
  
 
4051
  selected_field_dialog_box=NULL;
 
4052
  field_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Fields");
 
4053
  field_window->box(GMSH_WINDOW_BOX);
 
4054
  Fl_Group *resize_box = new Fl_Group(2*WB+L1, 2*WB+BB,width-3*WB-L1, height - 3 * WB-BB);
 
4055
  resize_box->end();
 
4056
  {
 
4057
    Fl_Menu_Button *b= new Fl_Menu_Button(WB,WB,L1,BH,"New");
 
4058
    FieldManager &fields=*GModel::current()->getFields();
 
4059
    std::map<const std::string, FieldFactory*>::iterator it;
 
4060
    for(it=fields.map_type_name.begin();it!=fields.map_type_name.end();it++)
 
4061
      b->add(it->first.c_str());
 
4062
    b->callback(view_field_new_cb);
 
4063
  }
 
4064
  field_browser = new Fl_Hold_Browser(WB, 2*WB+BH, L1, height - 3 * WB - BH);
 
4065
  field_browser->callback(view_field_browser_cb);
 
4066
  field_window->resizable(resize_box);
 
4067
  field_window->size_range(width0, height0);
 
4068
  field_window->position(CTX.field_position[0], CTX.field_position[1]);
 
4069
  field_window->end();
 
4070
}
 
4071
 
3740
4072
// Create the window for the statistics
3741
4073
 
3742
4074
void GUI::create_statistics_window()
3762
4094
  int width = 26 * fontsize;
3763
4095
  int height = 5 * WB + 17 * BH;
3764
4096
 
3765
 
  stat_window = new Dialog_Window(width, height, "Statistics");
 
4097
  stat_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Statistics");
3766
4098
  stat_window->box(GMSH_WINDOW_BOX);
3767
4099
  {
3768
4100
    Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH);
3792
4124
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 12 * BH, IW, BH, "Time for 3D mesh");
3793
4125
 
3794
4126
      stat_value[num] = new Fl_Output(2 * WB, 2 * WB + 13 * BH, IW, BH, "Gamma"); 
3795
 
      stat_value[num]->tooltip("~ volume / sum_face_area / max_edge_length"); num++;
 
4127
      stat_value[num]->tooltip("~ inscribed_radius / circumscribed_radius"); num++;
3796
4128
      stat_value[num] = new Fl_Output(2 * WB, 2 * WB + 14 * BH, IW, BH, "Eta");
3797
4129
      stat_value[num]->tooltip("~ volume^(2/3) / sum_edge_length^2"); num++;
3798
4130
      stat_value[num] = new Fl_Output(2 * WB, 2 * WB + 15 * BH, IW, BH, "Rho");
3810
4142
    {
3811
4143
      g[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Post-processing");
3812
4144
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 1 * BH, IW, BH, "Views");
3813
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Visible points");
3814
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Visible lines");
3815
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Visible triangles");
3816
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Visible quadrangles");
3817
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Visible tetrahedra");
3818
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Visible hexahedra");
3819
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Visible prisms");
3820
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Visible pyramids");
3821
 
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Visible strings");
 
4145
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Points");
 
4146
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Lines");
 
4147
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles");
 
4148
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles");
 
4149
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra");
 
4150
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra");
 
4151
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Prisms");
 
4152
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Pyramids");
 
4153
      stat_value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Strings");
3822
4154
      g[2]->end();
3823
4155
    }
3824
4156
    o->end();
3902
4234
 
3903
4235
  // post
3904
4236
  sprintf(label[num], "%g", s[26]); stat_value[num]->value(label[num]); num++;
3905
 
  sprintf(label[num], "%g/%g", s[36], s[27]); stat_value[num]->value(label[num]); num++;
3906
 
  sprintf(label[num], "%g/%g", s[37], s[28]); stat_value[num]->value(label[num]); num++;
3907
 
  sprintf(label[num], "%g/%g", s[38], s[29]); stat_value[num]->value(label[num]); num++;
3908
 
  sprintf(label[num], "%g/%g", s[39], s[30]); stat_value[num]->value(label[num]); num++;
3909
 
  sprintf(label[num], "%g/%g", s[40], s[31]); stat_value[num]->value(label[num]); num++;
3910
 
  sprintf(label[num], "%g/%g", s[41], s[32]); stat_value[num]->value(label[num]); num++;
3911
 
  sprintf(label[num], "%g/%g", s[42], s[33]); stat_value[num]->value(label[num]); num++;
3912
 
  sprintf(label[num], "%g/%g", s[43], s[34]); stat_value[num]->value(label[num]); num++;
3913
 
  sprintf(label[num], "%g/%g", s[44], s[35]); stat_value[num]->value(label[num]); num++;
 
4237
  sprintf(label[num], "%g", s[27]); stat_value[num]->value(label[num]); num++;
 
4238
  sprintf(label[num], "%g", s[28]); stat_value[num]->value(label[num]); num++;
 
4239
  sprintf(label[num], "%g", s[29]); stat_value[num]->value(label[num]); num++;
 
4240
  sprintf(label[num], "%g", s[30]); stat_value[num]->value(label[num]); num++;
 
4241
  sprintf(label[num], "%g", s[31]); stat_value[num]->value(label[num]); num++;
 
4242
  sprintf(label[num], "%g", s[32]); stat_value[num]->value(label[num]); num++;
 
4243
  sprintf(label[num], "%g", s[33]); stat_value[num]->value(label[num]); num++;
 
4244
  sprintf(label[num], "%g", s[34]); stat_value[num]->value(label[num]); num++;
 
4245
  sprintf(label[num], "%g", s[35]); stat_value[num]->value(label[num]); num++;
3914
4246
}
3915
4247
 
3916
4248
 
3930
4262
  int width = CTX.msg_size[0];
3931
4263
  int height = CTX.msg_size[1];
3932
4264
 
3933
 
  msg_window = new Dialog_Window(width, height, "Message Console");
 
4265
  msg_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Message Console");
3934
4266
  msg_window->box(GMSH_WINDOW_BOX);
3935
4267
 
3936
4268
  msg_browser = new Fl_Browser(WB, WB, width - 2 * WB, height - 3 * WB - BH);
3937
4269
  msg_browser->textfont(FL_COURIER);
 
4270
  msg_browser->textsize(fontsize - 1);
3938
4271
  msg_browser->type(FL_MULTI_BROWSER);
3939
4272
  msg_browser->callback(message_copy_cb);
3940
4273
 
3967
4300
  msg_browser->bottomline(msg_browser->size());
3968
4301
}
3969
4302
 
3970
 
void GUI::save_message(char *filename)
 
4303
void GUI::save_message(const char *filename)
3971
4304
{
3972
4305
  FILE *fp;
3973
4306
 
3988
4321
  fclose(fp);
3989
4322
}
3990
4323
 
3991
 
void GUI::fatal_error(char *filename)
 
4324
void GUI::fatal_error(const char *filename)
3992
4325
{
3993
4326
  fl_alert("A fatal error has occurred which will force Gmsh to abort.\n"
3994
4327
           "The error messages have been saved in the following file:\n\n%s",
4014
4347
      switch(Fl::event_key()) {
4015
4348
      case FL_Enter:
4016
4349
      case FL_KP_Enter:
4017
 
        visibility_ok_cb(NULL, NULL);
4018
 
        return 1;
 
4350
        visibility_ok_cb(NULL, NULL);
 
4351
        return 1;
4019
4352
      }
4020
4353
    }
4021
4354
    return Fl_Browser::handle(event);
4047
4380
  int height = 18 * BH;
4048
4381
  int brw = width - 4 * WB;
4049
4382
 
4050
 
  vis_window = new Dialog_Window(width, height, "Visibility");
 
4383
  vis_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Visibility");
4051
4384
  vis_window->box(GMSH_WINDOW_BOX);
4052
4385
 
4053
4386
  vis_type = new Fl_Choice(WB, WB, (width - 3 * WB) / 2, BH);
4054
4387
  vis_type->menu(type_table);
4055
4388
  
4056
4389
  vis_butt[0] = new Fl_Check_Button(WB + (width - 3 * WB) / 2 + WB, WB, (width - 3 * WB) / 2, BH, 
4057
 
                                    "Set visibility recursively");
 
4390
                                    "Set visibility recursively");
4058
4391
  vis_butt[0]->type(FL_TOGGLE_BUTTON);
4059
4392
  vis_butt[0]->value(1);
4060
4393
 
4153
4486
    int ll = width/2 - BH - WB - IW;
4154
4487
 
4155
4488
    Fl_Box *b2 = new Fl_Box(FL_NO_BOX, ll, 3 * WB + 2 * BH, IW, BH, 
4156
 
                            "Hide with the mouse:");
 
4489
                            "Hide with the mouse:");
4157
4490
    b2->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
4158
4491
 
4159
4492
    Fl_Button *butt1 = new Fl_Button(ll, 3 * WB + 3 * BH, IW, BH, "Elements");
4173
4506
    int ll2 = ll + IW + WB + 2*BH + WB;
4174
4507
 
4175
4508
    Fl_Box *b12 = new Fl_Box(FL_NO_BOX, ll2, 3 * WB + 2 * BH, IW, BH, 
4176
 
                             "Show with the mouse:");
 
4509
                             "Show with the mouse:");
4177
4510
    b12->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
4178
4511
 
4179
4512
    Fl_Button *butt11 = new Fl_Button(ll2, 3 * WB + 3 * BH, IW, BH, "Elements");
4214
4547
  clip_browser->clear();
4215
4548
  clip_browser->add("Geometry");
4216
4549
  clip_browser->add("Mesh");
4217
 
  for(int i = 0; i < List_Nbr(CTX.post.list); i++) {
 
4550
  for(unsigned int i = 0; i < PView::list.size(); i++) {
4218
4551
    sprintf(str, "View [%d]", i);
4219
4552
    clip_browser->add(str);
4220
4553
  }
4269
4602
  int brw = 105;
4270
4603
  int BW = width - brw - 3 * WB - 3 * fontsize;
4271
4604
 
4272
 
  clip_window = new Dialog_Window(width, height, "Clipping Planes");
 
4605
  clip_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Clipping Planes");
4273
4606
  clip_window->box(GMSH_WINDOW_BOX);
4274
4607
 
4275
4608
  clip_browser = new Fl_Multi_Browser(1 * WB, 1 * WB, brw, height - BH - 3 * WB);
4374
4707
  int width = 4 * BB + 2 * WB;
4375
4708
  int height = 5 * BH + 3 * WB;
4376
4709
 
4377
 
  manip_window = new Dialog_Window(width, height, "Manipulator");
 
4710
  manip_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Manipulator");
4378
4711
  manip_window->box(GMSH_WINDOW_BOX);
4379
4712
 
4380
4713
  Fl_Box *top[3], *left[3];
4441
4774
  int width = 28 * fontsize;
4442
4775
  int height = 15 * BH + BH/2;
4443
4776
 
4444
 
  about_window = new Dialog_Window(width, height, "About Gmsh");
 
4777
  about_window = new Dialog_Window(width, height, CTX.non_modal_windows, "About Gmsh");
4445
4778
  about_window->box(GMSH_WINDOW_BOX);
4446
4779
 
4447
4780
  {
4452
4785
    o->add("@c@.A three-dimensional finite element mesh generator");
4453
4786
    o->add("@c@.with built-in pre- and post-processing facilities");
4454
4787
    o->add(" ");
4455
 
    o->add("@c@.Copyright (C) 1997-2007");
 
4788
    o->add("@c@.Copyright (C) 1997-2008");
4456
4789
#if defined(__APPLE__)
4457
4790
    o->add("@c@.Christophe Geuzaine and Jean-Francois Remacle");
4458
4791
#else
4467
4800
    sprintf(buffer, "@c@.License: %s", Get_GmshShortLicense());
4468
4801
    o->add(buffer);
4469
4802
    sprintf(buffer, "@c@.Graphical user interface toolkit: FLTK %d.%d.%d", 
4470
 
            FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION);
 
4803
            FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION);
4471
4804
    o->add(buffer);
4472
4805
    sprintf(buffer, "@c@.Build OS: %s", Get_GmshBuildOS());
4473
4806
    o->add(buffer);
4480
4813
      strcpy(str1, Get_BuildOptions());
4481
4814
      unsigned int len = 30;
4482
4815
      if(strlen(str1) > len){
4483
 
        int split;
4484
 
        for(split = len - 1; split >= 0; split--){
4485
 
          if(str1[split] == ' '){
4486
 
            str1[split] = '\0';
4487
 
            break;
4488
 
          }
4489
 
        }
4490
 
        sprintf(buffer, "@c@.Build options: %s", str1);
4491
 
        o->add(buffer);
4492
 
        sprintf(buffer, "@c@.%s", &str1[split+1]);
4493
 
        o->add(buffer);
 
4816
        int split;
 
4817
        for(split = len - 1; split >= 0; split--){
 
4818
          if(str1[split] == ' '){
 
4819
            str1[split] = '\0';
 
4820
            break;
 
4821
          }
 
4822
        }
 
4823
        sprintf(buffer, "@c@.Build options: %s", str1);
 
4824
        o->add(buffer);
 
4825
        sprintf(buffer, "@c@.%s", &str1[split+1]);
 
4826
        o->add(buffer);
4494
4827
      }
4495
4828
      else{
4496
 
        sprintf(buffer, "@c@.Options: %s", str1);
4497
 
        o->add(buffer);
 
4829
        sprintf(buffer, "@c@.Options: %s", str1);
 
4830
        o->add(buffer);
4498
4831
      }
4499
4832
    }
4500
4833
    sprintf(buffer, "@c@.Packaged by: %s", Get_GmshPackager());
4516
4849
  }
4517
4850
 
4518
4851
  about_window->position(Fl::x() + Fl::w()/2 - width / 2,
4519
 
                         Fl::y() + Fl::h()/2 - height / 2);
 
4852
                         Fl::y() + Fl::h()/2 - height / 2);
4520
4853
  about_window->end();
4521
4854
}
4522
4855
 
4539
4872
  int width = 31 * fontsize;
4540
4873
  int height = 5 * WB + 9 * BH;
4541
4874
 
4542
 
  context_geometry_window = new Dialog_Window(width, height, "Contextual Geometry Definitions");
 
4875
  context_geometry_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Contextual Geometry Definitions");
4543
4876
  context_geometry_window->box(GMSH_WINDOW_BOX);
4544
4877
  {
4545
4878
    Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH);
4699
5032
  int width = 29 * fontsize;
4700
5033
  int height = 5 * WB + 5 * BH;
4701
5034
 
4702
 
  context_mesh_window = new Dialog_Window(width, height, "Contextual Mesh Definitions");
 
5035
  context_mesh_window = new Dialog_Window(width, height, CTX.non_modal_windows, "Contextual Mesh Definitions");
4703
5036
  context_mesh_window->box(GMSH_WINDOW_BOX);
4704
5037
  {
4705
5038
    Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH);
4759
5092
 
4760
5093
void GUI::create_solver_window(int num)
4761
5094
{
4762
 
  int i, nbbutts = 0, newrow = 0;
4763
 
  static Fl_Group *g[10];
4764
 
 
4765
 
  int LL = (int)(1.75 * IW);
4766
 
  int BBS = (5 * fontsize + 1); // smaller width of a button with internal label
4767
 
 
4768
5095
  if(solver[num].window) {
4769
5096
    solver[num].window->show();
4770
5097
    return;
4771
5098
  }
4772
5099
 
4773
 
  for(i = 0; i < MAXSOLVERS; i++)
 
5100
  for(int i = 0; i < MAXSOLVERS; i++)
4774
5101
    if(strlen(SINFO[num].option_name[i]))
4775
5102
      SINFO[num].nboptions = i + 1;
4776
5103
 
4777
 
  for(i = 0; i < MAXSOLVERS; i++)
4778
 
    if(strlen(SINFO[num].button_name[i]))
4779
 
      nbbutts++;
4780
 
  if(nbbutts > 3)
4781
 
    newrow = 1;
4782
 
 
4783
 
  int width = 5 * BBS + 6 * WB;
4784
 
  int height = (8 + SINFO[num].nboptions + newrow) * WB + (6 + SINFO[num].nboptions + newrow) * BH;
4785
 
  if(height < 8 * WB + 8 * BH)
4786
 
    height = 8 * WB + 8 * BH;   //minimum height required by Options tab
4787
 
 
4788
 
  solver[num].window = new Dialog_Window(width, height);
 
5104
  int LL = 2 * IW;
 
5105
  int width = LL + BB + BB / 3 + 4 * WB;
 
5106
  int height = (8 + SINFO[num].nboptions) * BH + 6 * WB;
 
5107
  int BBS = (width - 8 * WB) / 5;
 
5108
  
 
5109
  solver[num].window = new Dialog_Window(width, height, CTX.non_modal_windows);
4789
5110
  solver[num].window->box(GMSH_WINDOW_BOX);
4790
5111
  {
4791
 
    Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - (3 + newrow) * WB - (1 + newrow) * BH);
 
5112
    Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - 1 * BH);
4792
5113
    {
4793
 
      g[0] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - (3 + newrow) * WB - (2 + newrow) * BH, "General");
4794
 
 
4795
 
      solver[num].input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, LL, BH, "Problem");
4796
 
      Fl_Button *b1 = new Fl_Button(2 * WB, 3 * WB + 2 * BH, BB, BH, "Choose");
4797
 
      b1->callback(solver_file_open_cb, (void *)num);
4798
 
      Fl_Button *b2 = new Fl_Button(3 * WB + BB, 3 * WB + 2 * BH, BB, BH, "Edit");
4799
 
      b2->callback(solver_file_edit_cb, (void *)num);
4800
 
 
4801
 
      solver[num].input[1] = new Fl_Input(2 * WB, 4 * WB + 3 * BH, LL, BH, "Mesh");
4802
 
      Fl_Button *b3 = new Fl_Button(2 * WB, 5 * WB + 4 * BH, BB, BH, "Choose");
4803
 
      b3->callback(solver_choose_mesh_cb, (void *)num);
4804
 
 
4805
 
      for(i = 0; i < 2; i++) {
 
5114
      Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Controls");
 
5115
 
 
5116
      solver[num].input[2] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, LL, BH, "Solver");
 
5117
      solver[num].input[2]->callback(solver_ok_cb, (void *)num);
 
5118
 
 
5119
      Fl_Button *b1 = new Fl_Button(width - 2 * WB - BBS, 2 * WB + 1 * BH, BBS, BH, "Choose");
 
5120
      b1->callback(solver_choose_executable_cb, (void *)num);
 
5121
      Fl_Button *b2 = new Fl_Button(width - 2 * WB - BBS, 2 * WB + 2 * BH, BBS, BH, "Save");
 
5122
      b2->callback(options_save_cb);
 
5123
 
 
5124
      int ww = (LL - WB) / 2;
 
5125
      solver[num].butt[2] = new Fl_Check_Button(2 * WB, 2 * WB + 2 * BH, ww, BH, "Client/server");
 
5126
      solver[num].butt[0] = new Fl_Check_Button(2 * WB, 2 * WB + 3 * BH, ww, BH, "Pop-up messages");
 
5127
      solver[num].butt[1] = new Fl_Check_Button(3 * WB + ww, 2 * WB + 2 * BH, ww, BH, "Auto-load results");
 
5128
      
 
5129
      for(int i = 0; i < 3; i++){
 
5130
        solver[num].butt[i]->type(FL_TOGGLE_BUTTON);
 
5131
        solver[num].butt[i]->callback(solver_ok_cb, (void *)num);
 
5132
      }
 
5133
 
 
5134
      solver[num].input[0] = new Fl_Input(2 * WB + BB / 2, 2 * WB + 4 * BH, LL - BB / 2, BH, "Input");
 
5135
      Fl_Button *b3 = new Fl_Button(width - 2 * WB - BBS, 2 * WB + 4 * BH, BBS, BH, "Choose");
 
5136
      b3->callback(solver_file_open_cb, (void *)num);
 
5137
 
 
5138
      Fl_Button *b4 = new Fl_Button(2 * WB, 2 * WB + 4 * BH, BB / 2, BH, "Edit");
 
5139
      b4->callback(solver_file_edit_cb, (void *)num);
 
5140
 
 
5141
      solver[num].input[1] = new Fl_Input(2 * WB, 2 * WB + 5 * BH, LL, BH, "Mesh");
 
5142
      Fl_Button *b5 = new Fl_Button(width - 2 * WB - BBS, 2 * WB + 5 * BH, BBS, BH, "Choose");
 
5143
      b5->callback(solver_choose_mesh_cb, (void *)num);
 
5144
 
 
5145
      for(int i = 0; i < 3; i++) {
4806
5146
        solver[num].input[i]->align(FL_ALIGN_RIGHT);
4807
5147
      }
4808
5148
 
4809
 
      for(i = 0; i < SINFO[num].nboptions; i++) {
4810
 
        solver[num].choice[i] = new Fl_Choice(2 * WB, (6 + i) * WB + (5 + i) * BH, LL, BH, SINFO[num].option_name[i]);
 
5149
      for(int i = 0; i < SINFO[num].nboptions; i++) {
 
5150
        solver[num].choice[i] = new Fl_Choice(2 * WB, 2 * WB + (6 + i) * BH, LL, BH,
 
5151
                                              SINFO[num].option_name[i]);
4811
5152
        solver[num].choice[i]->align(FL_ALIGN_RIGHT);
4812
5153
      }
4813
5154
 
4814
 
      g[0]->end();
4815
 
    }
4816
 
    {
4817
 
      g[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - (3 + newrow) * WB - (2 + newrow) * BH, "Options");
4818
 
 
4819
 
      solver[num].input[2] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, LL, BH, "Executable");
4820
 
      solver[num].input[2]->align(FL_ALIGN_RIGHT);
4821
 
      solver[num].input[2]->callback(solver_ok_cb);
4822
 
 
4823
 
      Fl_Button *b = new Fl_Button(2 * WB, 3 * WB + 2 * BH, BB, BH, "Choose");
4824
 
      b->callback(solver_choose_executable_cb, (void *)num);
4825
 
 
4826
 
      solver[num].butt[2] = new Fl_Check_Button(2 * WB, 4 * WB + 3 * BH, LL, BH, "Enable client-server connection");
4827
 
      solver[num].butt[2]->type(FL_TOGGLE_BUTTON);
4828
 
      solver[num].butt[2]->callback(solver_ok_cb);
4829
 
      solver[num].butt[0] = new Fl_Check_Button(2 * WB, 4 * WB + 4 * BH, LL, BH, "Display client messages");
4830
 
      solver[num].butt[0]->type(FL_TOGGLE_BUTTON);
4831
 
      solver[num].butt[0]->callback(solver_ok_cb);
4832
 
      solver[num].butt[1] = new Fl_Check_Button(2 * WB, 4 * WB + 5 * BH, LL, BH, "Merge views automatically");
4833
 
      solver[num].butt[1]->type(FL_TOGGLE_BUTTON);
4834
 
      solver[num].butt[1]->callback(solver_ok_cb);
4835
 
 
4836
 
      {
4837
 
        Fl_Button *o = new Fl_Button(width - BB - 2 * WB,
4838
 
                                     height - (3 + newrow) * WB - (2 + newrow) * BH,
4839
 
                                     BB, BH, "Save");
4840
 
        o->callback(options_save_cb);
 
5155
      static int arg[MAXSOLVERS][5][2];
 
5156
      for(int i = 0; i < 5; i++) {
 
5157
        if(strlen(SINFO[num].button_name[i])) {
 
5158
          arg[num][i][0] = num;
 
5159
          arg[num][i][1] = i;
 
5160
          solver[num].command[i] = new Fl_Button((2 + i) * WB + i * BBS, 
 
5161
                                                 3 * WB + (6 + SINFO[num].nboptions) * BH,
 
5162
                                                 BBS, BH, SINFO[num].button_name[i]);
 
5163
          solver[num].command[i]->callback(solver_command_cb, (void *)arg[num][i]);
 
5164
        }
4841
5165
      }
4842
 
      g[1]->end();
 
5166
 
 
5167
      g->end();
4843
5168
    }
4844
5169
    {
4845
 
      g[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - (3 + newrow) * WB - (2 + newrow) * BH, "About");
 
5170
      Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "About");
4846
5171
 
4847
5172
      Fl_Browser *o = new Fl_Browser(2 * WB, 2 * WB + 1 * BH, width - 4 * WB,
4848
 
                                     height - (5 + newrow) * WB - (2 + newrow) * BH);
 
5173
                                     height - 5 * WB - 2 * BH);
4849
5174
      o->add(" ");
4850
5175
      add_multiline_in_browser(o, "@c@b@.", SINFO[num].name);
4851
5176
      o->add(" ");
4852
5177
      add_multiline_in_browser(o, "@c@. ", SINFO[num].help);
4853
5178
 
4854
 
      g[2]->end();
 
5179
      g->end();
4855
5180
    }
4856
5181
    o->end();
4857
5182
  }
4858
5183
 
4859
 
  static int arg[MAXSOLVERS][5][2];
4860
 
  int nb = 0;
4861
 
  for(i = 4; i >= 0; i--) {
4862
 
    if(strlen(SINFO[num].button_name[i])) {
4863
 
      arg[num][i][0] = num;
4864
 
      arg[num][i][1] = i;
4865
 
      solver[num].command[nb] = new Fl_Button(width - (1 + nb + 2 * !newrow) * BBS - (1 + nb + 2 * !newrow) * WB,
4866
 
                                              height - (1 + newrow) * BH - (1 + newrow) * WB, BBS, BH,
4867
 
                                              SINFO[num].button_name[i]);
4868
 
      solver[num].command[nb]->callback(solver_command_cb, (void *)arg[num][i]);
4869
 
      nb++;
4870
 
    }
4871
 
  }
4872
 
 
4873
 
  {
4874
 
    Fl_Button *o = new Fl_Button(width - 2 * BBS - 2 * WB, height - BH - WB, BBS, BH, "Kill");
4875
 
    o->callback(solver_kill_cb, (void *)num);
4876
 
  }
4877
 
  {
4878
 
    Fl_Button *o = new Fl_Button(width - BBS - WB, height - BH - WB, BBS, BH, "Cancel");
4879
 
    o->callback(cancel_cb, (void *)solver[num].window);
 
5184
  {
 
5185
    Fl_Button *b1 = new Fl_Button(width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Kill solver");
 
5186
    b1->callback(solver_kill_cb, (void *)num);
 
5187
    Fl_Button *b2 = new Fl_Button(width - BB - WB, height - BH - WB, BB, BH, "Cancel");
 
5188
    b2->callback(cancel_cb, (void *)solver[num].window);
4880
5189
  }
4881
5190
 
4882
5191
  solver[num].window->position(CTX.solver_position[0], CTX.solver_position[1]);