~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos/Shortcuts_.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function Shortcuts_()
 
2
%rr=lines()
 
3
lines(0)
 
4
disp(%scicos_short)
 
5
lines(%rr(2));
 
6
xpause(1000)
 
7
xinfo('Select an item in a menu to set shortcut')
 
8
[btn,xc,yc,cwin,Cmenu]=cosclick()
 
9
if Cmenu<>'Quit' then
 
10
  %okay=%f
 
11
  if Cmenu<>[] then
 
12
    %koko=find(%scicos_short(:,2)==Cmenu)
 
13
    if %koko<>[] then
 
14
      txt=x_mdialog(['Edit the short cut (a-z)';'only lower case letters allowed'],..
 
15
          %scicos_short(%koko,2),%scicos_short(%koko,1))
 
16
      if txt<>[] then 
 
17
        if txt<>emptystr() then txt=part(txt(1),1);end
 
18
        if find(txt==%scicos_short(:,1))<>[] then
 
19
          message(txt+' already in use for '+..
 
20
              %scicos_short( find(txt==%scicos_short(:,1)),2))
 
21
        elseif txt==emptystr() then
 
22
          %scicos_short=[%scicos_short(1:%koko-1,:);
 
23
              %scicos_short(%koko+1:$,:)];%okay=%t;
 
24
        elseif ascii(txt)>122|ascii(txt)<97 then
 
25
          message(txt+' is not in a-z')
 
26
        else
 
27
          %scicos_short(%koko,1)=txt;%okay=%t;
 
28
        end
 
29
      end
 
30
    else
 
31
      %koko=find(%cor_item_exec(:,1)==Cmenu)
 
32
      if %koko<>[] then
 
33
        txt=x_mdialog(['Add new short cut (a-z)';'only lower case letters allowed'],..
 
34
            %cor_item_exec(%koko,1),emptystr())
 
35
        if txt<>[] then 
 
36
          txt=part(txt(1),1)
 
37
          if find(txt==%scicos_short(:,1))<>[] then
 
38
            message(txt+' already in use for '+..
 
39
                %scicos_short( find(txt==%scicos_short(:,1)),2))
 
40
          elseif ascii(txt)>122|ascii(txt)<97 then
 
41
            message(txt+' is not in a-z')
 
42
          else
 
43
            %scicos_short=[%scicos_short;..
 
44
                [part(txt(1),1),%cor_item_exec(%koko,1)]];
 
45
            %okay=%t
 
46
          end
 
47
        end
 
48
      end
 
49
    end 
 
50
    if %okay then 
 
51
      errcatch(-1,'continue')
 
52
      save('.scicos_short',%scicos_short)
 
53
      errcatch(-1)
 
54
      if iserror(-1) then
 
55
        errclear(-1)
 
56
        message('Cannot save .scicos_short in current directory')
 
57
      end
 
58
      %tableau=emptystr([1:100]);
 
59
      for %Y=1:size(%scicos_short,1)
 
60
        %tableau(-31+ascii(%scicos_short(%Y,1)))=%scicos_short(%Y,2);
 
61
      end
 
62
    end
 
63
    Cmenu=[]
 
64
  end
 
65
  xinfo(' ')
 
66
end
 
67