~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychHardware/Daq/Utilities/ConfirmInfo.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
%                           figure is modal)
28
28
%          3/31/08    mpr   added check to make sure search for appropriate
29
29
%                           space does not overrun number of spaces
 
30
%          5/20/13    mk Add text only fallback for Octave and non-GUI.
30
31
 
31
32
DoModal = 1;
32
 
if nargin < 3 | isempty(HowLongToWait)
 
33
if nargin < 3 || isempty(HowLongToWait)
33
34
  HowLongToWait = Inf;
34
35
end
35
36
 
 
37
% Provide text fallback for non-GUI mode or Octave:
 
38
if ~IsGUI || IsOctave
 
39
  fprintf('%s\nPress any key to continue.\n', TheQuestion);
 
40
  [secs, keyCode] = KbStrokeWait (-1, GetSecs + HowLongToWait);
 
41
  if any(keyCode)
 
42
    ReturnFigh = 1;
 
43
  else
 
44
    ReturnFigh = 0;
 
45
  end
 
46
  return;
 
47
end
 
48
 
36
49
ThisVersion = version;
37
50
if str2num(ThisVersion(1)) < 7
38
51
        if ~isinf(HowLongToWait)
44
57
        HowLongToWait = Inf;
45
58
end
46
59
 
47
 
if nargin < 2 | isempty(ButtonString)
 
60
if nargin < 2 || isempty(ButtonString)
48
61
        ButtonString = 'Okay';
49
62
end     
50
63
 
93
106
        SpaceLocs = find(TheQuestion == 32);
94
107
  
95
108
  if TextExt(3) > 3
96
 
    while TextExt(3) > 3 & get(th,'FontSize') > 8
 
109
    while TextExt(3) > 3 && get(th,'FontSize') > 8
97
110
      set(th,'FontSize',get(th,'FontSize')-1);
98
111
      TextExt = get(th,'Extent');
99
112
    end
118
131
    TheQuestion(SpaceLocs(SpaceEnd-1)) = NLChar;
119
132
    set(th,'String',TheQuestion);
120
133
    TextExt = get(th,'Extent');
121
 
    while TextExt(3) > 0.95 & get(th,'FontSize') > 8
 
134
    while TextExt(3) > 0.95 && get(th,'FontSize') > 8
122
135
      set(th,'FontSize',get(th,'FontSize')-1);
123
136
      TextExt = get(th,'Extent');
124
137
    end
126
139
      error('Question too large!');
127
140
    end
128
141
  elseif TextExt(3) > 2
129
 
    while TextExt(3) > 2 & get(th,'FontSize') > 8
 
142
    while TextExt(3) > 2 && get(th,'FontSize') > 8
130
143
      set(th,'FontSize',get(th,'FontSize')-1)
131
144
      TextExt = get(th,'Extent');
132
145
    end
145
158
    TheQuestion(SpaceLocs(SpaceEnd-1)) = NLChar;
146
159
    set(th,'String',TheQuestion);
147
160
    TextExt = get(th,'Extent');
148
 
    while TextExt(3) > 0.95 & get(th,'FontSize') > 8
 
161
    while TextExt(3) > 0.95 && get(th,'FontSize') > 8
149
162
      set(th,'FontSize',get(th,'FontSize')-1);
150
163
      TextExt = get(th,'Extent');
151
164
    end
170
183
                        set(th,'String',TheQuestion);
171
184
                        TextExt = get(th,'Extent');
172
185
                        EndSpace = length(SpaceLocs);
173
 
                        while TextExt(3) > 0.95 & EndSpace > SpaceEnd
 
186
                        while TextExt(3) > 0.95 && EndSpace > SpaceEnd
174
187
                                TheQuestion(SpaceLocs(EndSpace)) = ' ';
175
188
                                EndSpace = EndSpace-1;
176
189
                                TheQuestion(SpaceLocs(EndSpace)) = NLChar;