File: scicos.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (701 lines) | stat: -rw-r--r-- 18,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
function [scs_m,newparameters,needcompile,edited]=scicos(scs_m,menus)
// scicos - block diagram graphic editor
//%SYNTAX
// scs_m=scicos(scs_m,job)
//%PARAMETERS
// scs_m    : scilab list, scicos main data structure
//      scs_m(1) contains system name and other infos
//      scs_m(i+1) contains description of ith block diagram element
// menus : vector of character strings,optional parameter giving usable menus 
//!
// Copyright INRIA
[lhs,rhs]=argn(0)
//check if superblock editing mode
[l,mac]=where()
slevel=prod(size(find(mac=='scicos')))
super_block=slevel>1
if ~super_block then
  // define scicos libraries
  if exists('scicoslib')==0 then load('SCI/macros/scicos/lib'),end
  if exists('blockslib')==0 then load('SCI/macros/scicos_blocks/lib'),end
end

if rhs>1 then 
  win=xget('window')
  systshow(scs_m,win),
  xset('window',win);
  return,
end

scicos_ver='scicos2.4' // set current version of scicos

//Initialisation
newparameters=list()
enable_undo=%f
edited=%f
path='./'


if ~super_block then // global variables
  pal_mode=%f // Palette edition mode
  newblocks=[] // table of added functions in pal_mode
  super_path=[] // path to the currently opened superblock
end
//
if rhs>=1 then
  if type(scs_m)==10 then //diagram is given by its filename
    fil=scs_m
    alreadyran=%f
    [ok,scs_m,cpr,edited]=do_load(fil,'diagram')
    if ~ok then return,end
    if size(cpr)==0 then
      needcompile=4
      state0=list()
    else
      state0=cpr(1);
      needcompile=0
    end
  else //diagram is given by its data structure
    if ~super_block then 
      cpr=list();needcompile=4;alreadyran=%f,state0=list()
    end
  end
else
  scs_m=empty_diagram()
  cpr=list();needcompile=4;alreadyran=%f;state0=list()
end
//
if type(scs_m)<>15 then error('first argument must be a scicos list'),end



//Menu definitions
 
menu_e=['Palettes','Context','Smart Move','Move','Copy','Copy Region',..
	'Replace','Align','Link','Delete','Delete Region','Add new block',..
	'Flip','Undo']
menu_s=['Setup','Compile','Eval','Run']
menu_f=['Replot','New','Region to Super Block','Purge','Rename','Save','Save As',..
	'Load','Load as Palette','Save as Palette','Save as Interf. Func.',..
	'Set Diagram Info','Navigator','Exit']
menu_b=['Open/Set','Resize','Icon','Color','Label','Get Info','Set block ID']
menu_v=['Window','Background color','Default link colors','ID fonts','3D aspect',..
	'Add color','Focus','Shift','Zoom in','Zoom out','Help','Calc']

menus=list(['Edit','Simulate','Diagram','Object','Misc'],..
    menu_e,menu_s,menu_f,menu_b,menu_v)
//Create callbacks
w='menus(2)(';rpar=')'
Edit=w(ones(menu_e))+string(1:size(menu_e,'*'))+rpar(ones(menu_e))
w='menus(3)(';rpar=')'
Simulate=w(ones(menu_s))+string(1:size(menu_s,'*'))+rpar(ones(menu_s))
w='menus(4)(';rpar=')'
Diagram=w(ones(menu_f))+string(1:size(menu_f,'*'))+rpar(ones(menu_f))
w='menus(5)(';rpar=')'
Object=w(ones(menu_b))+string(1:size(menu_b,'*'))+rpar(ones(menu_b))
w='menus(6)(';rpar=')'
Misc=w(ones(menu_v))+string(1:size(menu_v,'*'))+rpar(ones(menu_v))
 



//viewport
wpar=scs_m(1)
wsiz=wpar(1)
options=wpar(7)

if ~super_block then
  xset('window',0);
  curwin=xget('window');
  palettes=list();
  noldwin=0
  windows=[1 curwin]
  pixmap=xget('pixmap')==1
else
  noldwin=size(windows,1)
  windows=[windows;slevel curwin]
  palettes=palettes;
end

//initialize graphics
xdel(curwin)
xset('window',curwin);

xset('default')
xbasc();
if pixmap then xset('pixmap',1); end
xset('pattern',1)
xset('dashes',1)
if ~set_cmap(options('Cmap')) then // add colors if required
  options('3D')(1)=%f //disable 3D block shape
end
if pixmap then xset('wwpc');end
xbasc();xselect()
dr=driver();driver('Rec');
set_background()

wech=[1100/1085 790/705]  // ration between xset and xget wdim
//wdm=xget('wdim').*wech
wsiz=wpar(1)
xset('wdim',wsiz(1),wsiz(2))
if size(wsiz,'*')<5 then wsiz(5)=wsiz(1);wsiz(6)=wsiz(2);end
xsetech([-1 -1 8 8]/6,[wsiz(3),wsiz(4),wsiz(3)+wsiz(5),wsiz(4)+wsiz(6)])
xset('alufunction',6)



unsetmenu(curwin,'File',1) //clear
unsetmenu(curwin,'File',2) //select
//unsetmenu(curwin,'File',7) //close
unsetmenu(curwin,'File',6) //load
unsetmenu(curwin,'3D Rot.')

execstr('Edit_'+string(curwin)+'=Edit')
execstr('Simulate_'+string(curwin)+'=Simulate')
execstr('Object_'+string(curwin)+'=Object')
execstr('Misc_'+string(curwin)+'=Misc')
execstr('Diagram_'+string(curwin)+'=Diagram')

scs_m(1)(1)(2)=maxi(scs_m(1)(1)(2),450)

//draw diagram and menus
drawobjs(scs_m)

if pixmap then xset('wshow'),end

menubar(curwin,menus)
if ~super_block then
  delmenu(curwin,'stop')
  addmenu(curwin,'stop',list(1,'haltscicos'))
  unsetmenu(curwin,'stop')
else
  unsetmenu(curwin,'Simulate')
end

//set context (variable definition...)
if size(scs_m(1))>4 then 
  if type(scs_m(1)(5))==10 then
    execstr(scs_m(1)(5)) ,
  else
    scs_m(1)(5)=' ' 
  end
end

Cmenu='Open/Set'
while %t
  while %t do
    if Cmenu==[] then
      [btn,xc,yc,win,Cmenu]=getclick()
      pt=[xc,yc]
    end
    if Cmenu<> [] then break,end
  end
  Cmenu1=Cmenu
  select Cmenu
  case 'Exit' then  // OK
    Cmenu=[]
    wdm12=round(xget('wdim').*wech)
    if maxi(abs(scs_m(1)(1)(1:2)-wdm12))>10 then
      scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);
      edited=%t
    end

    do_exit()
    break
  case 'Palettes' then
    Cmenu=[]
    [palettes,windows]=do_palettes(palettes,windows)
  case 'New' then
    Cmenu=[]
    r=1
    if edited then
      r=message(['Diagram has not been saved';
	  'Really exit?'],['Yes';'No'])
    end
    if r==1 then
      if alreadyran then do_terminate(),end  //terminate current simulation
      scs_m=empty_diagram()
      wpar=scs_m(1);wsiz=wpar(1);
      xsetech([-1 -1 8 8]/6,[wsiz(3),wsiz(4),wsiz(3)+wsiz(5),wsiz(4)+wsiz(6)])
      xbasc();drawobjs(scs_m)
      edited=%f
    end
  case 'Smart Move' then  // Move
    xinfo('Click object to move, drag and click (left to fix, right to cancel)')
    scs_m=do_move(scs_m)
    xinfo(' ')
  case 'Move' then  // Move
    xinfo('Click object to move, drag and click (left to fix, right to cancel)')
    scs_m=do_stupidmove(scs_m)
    xinfo(' ')

//    edited=%t
  case 'Copy' then  // Copy
    xinfo('Click on the object to copy, drag, click (left to copy, right to cancel)')
    [scs_m,needcompile]=do_copy(scs_m,needcompile);
    xinfo(' ')
//    edited=%t
  case 'Copy Region' then  // Copy Region
    xinfo('Copy Region: Click, drag region, click (left to fix, right to cancel)')
    [scs_m,needcompile]=do_copy_region(scs_m,needcompile);
    xinfo(' ')
//    edited=%t 
  case 'Replace' then  // Replace
    Cmenu=[]
    xinfo('Click on new object , click on object to be replaced')
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    [scs_m,needcompile]=do_replace(scs_m,needcompile);
    xinfo(' ')
//    edited=%t
  case 'Align' then
    Cmenu=[]
    xinfo('Click on an a port , click on a port of object to be moved')
    scs_m_save=scs_m;nc_save=needcompile;
    scs_m=prt_align(scs_m)
    xinfo(' ')
//    edited=%t
  case 'Link' then  // Link
    xinfo('Click link origin, drag, click left for final or intermediate points or right to cancel')
    [scs_m,needcompile]=getlink(scs_m,needcompile);
    xinfo(' ')
//    edited=%t
  case 'Delete' then  // Delete
    xinfo('Delete: Click on the object to delete')
    [scs_m,needcompile]=do_delete(scs_m,needcompile);
    xinfo(' ')
//    edited=%t
  case 'Delete Region' then  // Delete region
    xinfo('Delete Region: Click, drag region and click (left to delete, right to cancel)')
    [scs_m,needcompile]=do_delete_region(scs_m,needcompile);
    xinfo(' ')
//    edited=%t
  case 'Flip' then
    Cmenu=[]
    xinfo('Click on block to be flipped')
    scs_m_save=scs_m;nc_save=needcompile;
    scs_m=do_tild(scs_m)
    xinfo(' ')
//    edited=%t
  case 'Undo' then
    Cmenu=[]
    if enable_undo then
      disablemenus()
      scs_m=scs_m_save;needcompile=nc_save
      wpar=scs_m(1)
      wdm=wpar(1)
      do_xsetech(wdm)
      drawobjs(scs_m),
      xset('alufunction',6);
      if pixmap then xset('wshow'),end
      enable_undo=%f
      enablemenus()
    end
  case 'Replot' then
    Cmenu='Open/Set'
    disablemenus()
    xset('alufunction',3);xbasc();xselect();xset('alufunction',6);
    wdm12=round(xget('wdim').*wech)
    scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);
    wdm=scs_m(1)(1)
    xsetech([-1 -1 8 8]/6,[wdm(3),wdm(4),wdm(3)+wdm(5),wdm(4)+wdm(6)])
    drawobjs(scs_m),
    enablemenus()
  case 'Window' then
    Cmenu=[]
    disablemenus()
    wdm12=round(xget('wdim').*wech)
    scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);
    wpar=scs_m(1);wd=wpar(1);
    wpar=do_window(wpar)
    edited=or(wpar<>scs_m(1))
    if or(wd<>wpar(1)) then
      xset('alufunction',3);xbasc();xselect();xset('alufunction',6);
      wd=wpar(1)
      xset('wdim',wd(1),wd(2)),
      wdm12=round(xget('wdim').*wech)
      scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);
      wdm=scs_m(1)(1)
      xsetech([-1 -1 8 8]/6,[wdm(3),wdm(4),wdm(3)+wdm(5),wdm(4)+wdm(6)])
      drawobjs(scs_m),
      if pixmap then xset('wshow'),end
    end
    scs_m(1)=wpar
    enablemenus()
  case 'Setup' then
    Cmenu=[]
    wpar=do_setup(scs_m(1))
    scs_m(1)=wpar
  case 'Context' then
    Cmenu=[]
    while %t do
      [context,ok]=do_context(scs_m(1)(5))
      if ~ok then break,end
      ierr=execstr(context,'errcatch')
      if ierr==0 then 
	scs_m(1)(5)=context;break,
      else
	message(['Incorrect context definition,';
	         'see message in Scilab window'])
      end
    end
  case 'Compile' then
    Cmenu=[]
    [cpr,ok]=do_compile(scs_m)
    if ok then
      newparameters=list()
      tcur=0 //temps courant de la simulation
      alreadyran=%f
      state0=cpr(1);
      needcompile=0;
    else
      needcompile=4,
    end
  case 'Run' then
    Cmenu=[]
    ok=%t
    [ok,tcur,cpr,alreadyran,needcompile,state0]=do_run(cpr)
    if ok then newparameters=list(),end
  case 'Rename' then
    Cmenu=[]
    scs_m=do_rename(scs_m) 
  case 'Save' then
    Cmenu=[]
    wdm12=round(xget('wdim').*wech)
    scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);

    ok=do_save(scs_m) 
    if ok then edited=%f,end
  case 'Save As' then
    wdm12=round(xget('wdim').*wech)
    scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);
    disablemenus()
    Cmenu=[]
    [scs_m,edited]=do_SaveAs()
    enablemenus()
  case 'FSave' then
    wdm12=round(xget('wdim').*wech)
    scs_m(1)(1)(1)=wdm12(1);scs_m(1)(1)(2)=wdm12(2);

    Cmenu=[]
    ok=do_fsave(fscs_m)
    edited=edited&~ok
  case 'Load' then
    Cmenu='Open/Set'
    disablemenus()
    [ok,scs_m,cpr,edited]=do_load()
    if ok then
      wpar=scs_m(1);
      options=wpar(7)
      if ~set_cmap(options('Cmap')) then 
	options('3D')(1)=%f //disable 3D block shape
      end
      wdm=wpar(1)
      xset('alufunction',3);xbasc();xselect();
      xset('wdim',wdm(1),wdm(2))
      if size(wdm,'*')<5 then wdm(5)=wdm(1);wdm(6)=wdm(2);scs_m(1)(1)=wdm;end
      xsetech([-1 -1 8 8]/6,[wdm(3),wdm(4),wdm(3)+wdm(5),wdm(4)+wdm(6)])
      xselect();
      set_background()
      xset('alufunction',6)
      drawobjs(scs_m),
      execstr(scs_m(1)(5)) ,
      if size(cpr)==0 then
	needcompile=4
	alreadyran=%f
      else
	state0=cpr(1)
	needcompile=0
	alreadyran=%f
      end
    end
    enablemenus()
  case 'Purge' then
    Cmenu=[]
    scs_m=do_purge(scs_m);
    needcompile=4;
    edited=%t

  case 'Shift' then
    Cmenu='Open/Set'
    xinfo('Click on the point you want to put in the middle of the window')
    wdm=do_view(scs_m)
    do_xsetech(wdm)
    wpar=scs_m(1)
    scs_m_save=scs_m,nc_save=needcompile,enable_undo=%t,edited=%t
    wpar(1)=wdm;scs_m(1)=wpar
    drawobjs(scs_m),
    xinfo(' ')
    if pixmap then xset('wshow'),end

  case 'Focus' then
    Cmenu='Open/Set'
    xinfo('Select rectangle to focus into')
    wdm=do_focus(scs_m)
    do_xsetech(wdm)
    wpar=scs_m(1)
    scs_m_save=scs_m,nc_save=needcompile,enable_undo=%t,edited=%t
    wpar(1)=wdm;scs_m(1)=wpar
    drawobjs(scs_m),
    xinfo(' ')
    if pixmap then xset('wshow'),end

  case 'Zoom in' then
    Cmenu='Open/Set'
    xinfo('Zoom in')
    wdm=do_zoomin(scs_m)
    do_xsetech(wdm)
    wpar=scs_m(1)
    scs_m_save=scs_m,nc_save=needcompile,enable_undo=%t,edited=%t
    wpar(1)=wdm;scs_m(1)=wpar
    drawobjs(scs_m),
    xinfo(' ')
    if pixmap then xset('wshow'),end

  case 'Zoom out' then
    Cmenu='Open/Set'
    xinfo('Zoom out')
    wdm=do_zoomout(scs_m)
    do_xsetech(wdm)
    wpar=scs_m(1)
    scs_m_save=scs_m,nc_save=needcompile,enable_undo=%t,edited=%t
    wpar(1)=wdm;scs_m(1)=wpar
    drawobjs(scs_m),
    xinfo(' ')
    if pixmap then xset('wshow'),end

  case 'Calc' then
    Cmenu=[]
    xinfo('You may enter any Scilab instruction. enter return to terminate')
    scs_gc=save_scs_gc()
    disablemenus()
    pause
    //xinfo(' ')
    restore_scs_gc(scs_gc);scs_gc=null()
    enablemenus()
  case 'Save as Interf. Func.' then
    Cmenu=[]
    ok=%f
    while ~ok then
      fname=xgetfile('*.sci')
      if fname<>emptystr() then 
	[dir,name,ext]=splitfilepath(fname)
	select ext
	case 'sci' then
	  ok=%t
	else
	  message('Only *.sci files allowed');
	  ok=%f
	end
      else
	ok=%t
      end
    end
    if fname<>emptystr() then
      scs_m(1)(2)(1)=name
      [ok,wh]=getvalue(['Enter path of the directory';
	  'and the type of Interf. Func. to create'],..
	  ['Block(0) or SuperBlock(1)'],list('vec','1'),..
	  ['1'])
      if ok then
	scs_m(1)(2)(1)=name
	if wh==0 then
	  path=save_csuper(scs_m,dir)
	else
	  path=save_super(scs_m,dir)
	end
	if path<>[] then getf(path),end
      end
    end
  case 'Region to Super Block' then
    xinfo(' Click, drag region and click (left to fix, right to cancel)')
    scs_m=do_region2block(scs_m)
  case 'Nyquist' then
    syst=analyse(scs_m)
    sl=bloc2ss(syst)
    xset('window',curwin+1);xbasc()
    nyquist(sl)
    xset('window',curwin);
  case 'Open/Set' then
    xinfo('Click object to open or set')
    k=[]
    while %t 
      [btn,xc,yc,win,Cmenu]=getclick()
      if Cmenu==[] then
	disablemenus()
	if windows(find(win==windows(:,2)),1)==100000 then
	  //click in navigator
	  [Path,k,ok]=whereintree(Tree,xc,yc)
	  if ok&k<>[] then Path($)=null();Path($)=null();end
	  if ~ok then k=[],end
	else
	  k=getobj(scs_m,[xc;yc])
	  Path=k
	end
      else
	break
      end
      if k<>[] then
	super_path=[super_path,k] 
	[o,modified,newparametersb,needcompileb,editedb]=clickin(scs_m(Path))
	if needcompileb==4 then
	  kw=find(windows(:,1)==100000)
	  if kw<>[] then
	    xdel(windows(kw,2))
	    Tree=list()
	  end
	end
	edited=edited|editedb
	super_path($-size(k,2)+1:$)=[]
	if editedb then
	  scs_m_save=scs_m;nc_save=needcompile
	  if ~pal_mode then
	    needcompile=max(needcompile,needcompileb)
	  end
	  scs_m=update_redraw_obj(scs_m,Path,o)
	end

	//note if block parameters have been modified
	if modified&~pal_mode  then
	  model=o(3)
	  newparameters=mark_newpars(k,newparametersb,newparameters)
	end
      end
      enablemenus()
    end
    xinfo(' ')
  case 'Resize' then
    Cmenu=[]
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    xinfo('Click block to resize')
    scs_m=do_resize(scs_m)
    xinfo(' ')
    edited=%t
  case 'Icon' then
    Cmenu=[]
    xinfo('Click on block to edit its icon')
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    scs_m=do_block(scs_m)
    xinfo(' ')
    edited=%t
  case 'Icon Editor' then
    Cmenu=[]
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    disablemenus()
    scs_m=do_icon_edit(scs_m)
    Cmenu=[]
    enablemenus()
    xinfo(' ')
    edited=%t  
  case 'Color' then
    xinfo('Click on object to paint')
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    scs_m=do_color(scs_m)
    xinfo(' ')
    edited=%t
  case 'Label' then
    Cmenu=[]
    xinfo('Click block to label')
    scs_m_save=scs_m;nc_save=needcompile;enable_undo=%t
    [mod,scs_m]=do_label(scs_m)
    edited=edited|mod
    xinfo(' ')
  case 'Eval' then
    Cmenu=[]
    disablemenus()
    [scs_m,cpr,needcompile,ok]=do_eval(scs_m,cpr)
    if needcompile<>4 then state0=cpr(1),end
    alreadyran=%f
    enablemenus()
  case 'Help' then
    Cmenu=[]
    xinfo('Click on object or menu to get help')
    do_help()
    xinfo(' ')
  case 'Add new block' then
    Cmenu='Open/Set'
    [scs_m,fct]=do_addnew(scs_m)
    if fct<>[] then 
      getf(fct),
      newblocks=[newblocks;fct]
    end
  case 'Pal editor..' then
    Cmenu=[]
    [newblocks,pals_changed]=do_edit_pal()
    if pals_changed then exec('~/scicos_pal.exe',-1),end
  case 'Load as Palette' then
    Cmenu=[]
    [palettes,windows]=do_load_as_palette(palettes,windows)
  case 'Save as Palette' then
    Cmenu=[]
    spmode=pal_mode
    pal_mode=%t
    [scs_m,edited]=do_SaveAs()
    pal_mode=spmode
  case 'FSave as Palette' then
    Cmenu=[]
    spmode=pal_mode
    pal_mode=%t
    ok=do_fsave(scs_m)
    edited=edited&~ok
    pal_mode=spmode
  case 'Background color' then
    Cmenu=[]
    [edited,options]=do_options(scs_m(1)(7),'Background')
    scs_m(1)(7)=options
    if edited then
      scs_m(1)(7)=options
      set_background()
      Cmenu='Replot'
    end
  case 'Default link colors' then
    Cmenu=[]
    [edited,options]=do_options(scs_m(1)(7),'LinkColor')
    scs_m(1)(7)=options,
    if edited then Cmenu='Replot',end
  case 'ID fonts' then
    Cmenu=[]
    [edited,options]=do_options(scs_m(1)(7),'ID')
    scs_m(1)(7)=options
    if edited then Cmenu='Replot',end
  case '3D aspect' then
    Cmenu=[]
    [edited,options]=do_options(scs_m(1)(7),'3D')
    scs_m(1)(7)=options
    if edited then Cmenu='Replot',end
  case 'Add color' then
    Cmenu=[]
    [edited,options]=do_options(scs_m(1)(7),'Cmap')
    if edited then 
      scs_m(1)(7)=options
      set_cmap(options('Cmap'))
      set_background()
      Cmenu='Replot'
    end       
  case 'Get Info' then   
    xinfo('Click on object  to get information on it')
    do_block_info()
    xinfo(' ')
  case 'Set Diagram Info' then
    Cmenu=[]
    [ok,info]=do_set_info(scs_m(1)(10))
    if ok then scs_m(1)(10)=info,end
  case 'Set block ID' then
    xinfo('Click on the object to set ID')
    scs_m = do_ident(scs_m)
    xinfo(' ')
  case 'Navigator' then
    [Tree,windows]=do_navigator(scs_m,windows)
    Cmenu='Open/Set'
  else
    Cmenu=[]
  end
  if pixmap then xset('wshow'),end
end