3 (* THIS IS TEXT COPY OF BlackBox 1.6-rc6 System/Mod/Controls.odc *)
7 Kernel, Dates, Dialog, Meta, Services, Stores, Views, Properties,
8 Strings, Fonts, Ports, Controllers, Windows, StdCFrames;
11 (** elements of Property.valid **)
12 opt0* = 0; opt1* = 1; opt2* = 2; opt3* = 3; opt4* = 4;
13 link* = 5; label* = 6; guard* = 7; notifier* = 8; level* = 9;
15 default* = opt0; cancel* = opt1;
16 left* = opt0; right* = opt1; multiLine* = opt2; password* = opt3;
18 haslines* = opt1; hasbuttons* = opt2; atroot* = opt3; foldericons* = opt4;
20 minVersion = 0; maxBaseVersion = 4;
21 pbVersion = 0; cbVersion = 0; rbVersion = 0; fldVersion = 0;
22 dfldVersion = 0; tfldVersion = 0; cfldVersion = 0;
23 lbxVersion = 0; sbxVersion = 0; cbxVersion = 0; capVersion = 1; grpVersion = 0;
26 rdel = 07X; ldel = 08X; tab = 09X; ltab = 0AX; lineChar = 0DX; esc = 01BX;
27 arrowLeft = 1CX; arrowRight = 1DX; arrowUp = 1EX; arrowDown = 1FX;
29 update = 2; (* notify options *)
32 flushCaches = 5; (* re-map labels for flushed string resources, after a language change *)
37 Prop* = POINTER TO RECORD (Properties.Property)
38 opt*: ARRAY 5 OF BOOLEAN;
40 label*: Dialog.String;
41 guard*: Dialog.String;
42 notifier*: Dialog.String;
46 Directory* = POINTER TO ABSTRACT RECORD END;
48 Control* = POINTER TO ABSTRACT RECORD (Views.View)
50 disabled-, undef-, readOnly-, customFont-: BOOLEAN;
52 label-: Dialog.String;
54 adr: ARRAY maxAdr OF INTEGER;
58 guardErr, notifyErr: BOOLEAN
61 DefaultsPref* = RECORD (Properties.Preference)
62 disabled*: BOOLEAN; (** OUT, preset to ~c.item.Valid() *)
63 undef*: BOOLEAN; (** OUT, preset to FALSE *)
64 readOnly*: BOOLEAN (** OUT, preset to c.item.vis = readOnly *)
67 PropPref* = RECORD (Properties.Preference)
68 valid*: SET (** OUT, preset to {link, label, guard, notifier, customFont} *)
71 PushButton = POINTER TO RECORD (Control) END;
73 CheckBox = POINTER TO RECORD (Control) END;
75 RadioButton = POINTER TO RECORD (Control) END;
77 Field = POINTER TO RECORD (Control)
81 UpDownField = POINTER TO RECORD (Control)
82 min, max, inc: INTEGER
85 DateField = POINTER TO RECORD (Control)
86 selection: INTEGER (* 0: no selection, 1..n-1: this part selected, -1: part n selected *)
89 TimeField = POINTER TO RECORD (Control)
93 ColorField = POINTER TO RECORD (Control) END;
95 ListBox = POINTER TO RECORD (Control) END;
97 SelectionBox = POINTER TO RECORD (Control) END;
99 ComboBox = POINTER TO RECORD (Control) END;
101 Caption = POINTER TO RECORD (Control) END;
103 Group = POINTER TO RECORD (Control) END;
105 TreeControl = POINTER TO RECORD (Control) END;
107 StdDirectory = POINTER TO RECORD (Directory) END;
109 Op = POINTER TO RECORD (Stores.Operation)
114 FontOp = POINTER TO RECORD (Stores.Operation)
120 NotifyMsg = RECORD (Views.NotifyMsg)
122 op, from, to: INTEGER
125 UpdateCachesMsg = RECORD (Views.UpdateCachesMsg) END;
127 SelectPtr = POINTER TO Dialog.Selection;
129 ProcValue = RECORD (Meta.Value) p*: PROCEDURE END;
130 SelectValue = RECORD (Meta.Value) p*: SelectPtr END;
131 GuardProcVal = RECORD (Meta.Value) p*: Dialog.GuardProc END;
132 NotifyProcValOld = RECORD (Meta.Value) p*: PROCEDURE (op, from, to: INTEGER) END;
133 GuardProcPVal = RECORD (Meta.Value) p*: PROCEDURE(n: INTEGER; VAR p: Dialog.Par) END;
134 NotifyProcPVal = RECORD (Meta.Value) p*: PROCEDURE(n, op, f, t: INTEGER) END;
136 Param = RECORD from, to, i: INTEGER; n: Dialog.String END;
138 TVParam = RECORD l: INTEGER; e: BOOLEAN; nodeIn, nodeOut: Dialog.TreeNode END;
140 Action = POINTER TO RECORD (Services.Action)
142 resolution, cnt: INTEGER
145 TrapCleaner = POINTER TO RECORD (Kernel.TrapCleaner) END;
148 dir-, stdDir-: Directory;
152 cleaner: TrapCleaner;
153 cleanerInstalled: INTEGER;
158 PROCEDURE (c: TrapCleaner) Cleanup;
161 cleanerInstalled := 0
165 PROCEDURE (c: Control) Update- (f: Views.Frame; op, from, to: INTEGER), NEW, EMPTY;
166 PROCEDURE (c: Control) UpdateList- (f: Views.Frame), NEW, EMPTY;
167 PROCEDURE (c: Control) CheckLink- (VAR ok: BOOLEAN), NEW, EMPTY;
168 PROCEDURE (c: Control) HandlePropMsg2- (VAR p: Views.PropMessage), NEW, EMPTY;
169 PROCEDURE (c: Control) HandleViewMsg2- (f: Views.Frame; VAR msg: Views.Message), NEW, EMPTY;
170 PROCEDURE (c: Control) HandleCtrlMsg2- (f: Views.Frame; VAR msg: Views.CtrlMessage;
171 VAR focus: Views.View), NEW, EMPTY;
172 PROCEDURE (c: Control) Externalize2- (VAR wr: Stores.Writer), NEW, EMPTY;
173 PROCEDURE (c: Control) Internalize2- (VAR rd: Stores.Reader), NEW, EMPTY;
176 (* auxiliary procedures *)
178 PROCEDURE IsShortcut (ch: CHAR; c: Control): BOOLEAN;
180 IF (ch >= "a") & (ch <= "z") OR (ch >= 0E0X) THEN ch := CAP(ch) END;
181 RETURN ch = c.shortcut
184 PROCEDURE ExtractShortcut (c: Control);
185 VAR label: Dialog.String; i: INTEGER; ch, sCh: CHAR;
187 Dialog.MapString(c.label, label);
188 i := 0; ch := label[0]; sCh := "&";
190 WHILE (ch # 0X) & (ch # "&") DO INC(i); ch := label[i] END;
191 IF ch = 0X THEN sCh := 0X
192 ELSE INC(i); sCh := label[i]; INC(i); ch := label[i]
195 IF (sCh >= "a") & (sCh <= "z") OR (sCh >= 0E0X) THEN sCh := CAP(sCh) END;
199 PROCEDURE GetGuardProc (name: ARRAY OF CHAR; VAR i: Meta.Item; VAR err: BOOLEAN;
200 VAR par: BOOLEAN; VAR n: INTEGER);
201 VAR j, k, e: INTEGER; num: ARRAY 32 OF CHAR;
204 WHILE (name[j] # 0X) & (name[j] # "(") DO INC(j) END;
205 IF name[j] = "(" THEN
207 WHILE (name[j] # 0X) & (name[j] # ")") DO num[k] := name[j]; INC(j); INC(k) END;
208 IF (name[j] = ")") & (name[j+1] = 0X) THEN
209 num[k] := 0X; Strings.StringToInt(num, n, e);
211 name[j - k - 1] := 0X;
212 Meta.LookupPath(name, i); par := TRUE
215 Dialog.ShowParamMsg("#System:SyntaxErrorIn", name, "", "");
223 Dialog.ShowParamMsg("#System:SyntaxErrorIn", name, "", "");
230 Meta.LookupPath(name, i); par := FALSE
232 IF (i.obj = Meta.procObj) OR (i.obj = Meta.varObj) & (i.typ = Meta.procTyp) THEN (*ok *)
235 IF i.obj = Meta.undef THEN
236 Dialog.ShowParamMsg("#System:NotFound", name, "", "")
238 Dialog.ShowParamMsg("#System:HasWrongType", name, "", "")
246 PROCEDURE CallGuard (c: Control);
247 VAR ok, up: BOOLEAN; n: INTEGER; dpar: Dialog.Par; p: Control;
248 v: GuardProcVal; vp: GuardProcPVal; i: Meta.Item; pref: DefaultsPref;
250 Controllers.SetCurrentPath(Controllers.targetPath);
251 pref.disabled := ~c.item.Valid();
253 pref.readOnly := c.item.vis = Meta.readOnly;
254 Views.HandlePropMsg(c, pref);
255 c.disabled := pref.disabled;
256 c.undef := pref.undef;
257 c.readOnly := pref.readOnly;
258 c.label := c.prop.label$;
259 IF ~c.disabled & (c.prop.guard # "") & ~c.guardErr THEN
260 IF cleanerInstalled = 0 THEN Kernel.PushTrapCleaner(cleaner) END;
261 INC(cleanerInstalled);
263 dpar.disabled := FALSE; dpar.undef := FALSE;
264 dpar.readOnly := c.readOnly;
265 dpar.checked := FALSE; dpar.label := c.label$;
266 GetGuardProc(c.prop.guard, i, c.guardErr, up, n);
267 IF i.obj # Meta.undef THEN
268 IF up THEN (* call with numeric parameter *)
270 IF ok THEN vp.p(n, dpar) END
273 IF ok THEN v.p(dpar) END
276 c.disabled := dpar.disabled;
277 c.undef := dpar.undef;
278 IF dpar.readOnly THEN c.readOnly := TRUE END;
279 IF dpar.label # c.label THEN c.label := dpar.label END
280 ELSIF ~c.guardErr THEN
281 Dialog.ShowParamMsg("#System:HasWrongType", c.prop.guard, "", "");
286 DEC(cleanerInstalled);
287 IF cleanerInstalled = 0 THEN Kernel.PopTrapCleaner(cleaner) END
290 Controllers.ResetCurrentPath()
293 PROCEDURE CallNotifier (c: Control; op, from, to: INTEGER);
294 VAR ok, up: BOOLEAN; n: INTEGER; vold: NotifyProcValOld; vp: NotifyProcPVal;
295 i: Meta.Item; p: Control;
297 IF c.prop.notifier # "" THEN
298 IF cleanerInstalled = 0 THEN Kernel.PushTrapCleaner(cleaner) END;
299 INC(cleanerInstalled);
301 IF c.prop.notifier[0] = "!" THEN
302 IF op = Dialog.pressed THEN
303 c.prop.notifier[0] := " ";
304 Dialog.ShowStatus(c.prop.notifier);
305 c.prop.notifier[0] := "!"
306 ELSIF op = Dialog.released THEN
307 Dialog.ShowStatus("")
310 GetGuardProc(c.prop.notifier, i, c.notifyErr, up, n);
311 IF i.obj # Meta.undef THEN
312 IF up THEN (* call with numeric parameter *)
314 IF ok THEN vp.p(n, op, from, to) END
317 IF ok THEN vold.p(op, from, to) END
319 IF ~ok & ~c.notifyErr THEN
320 Dialog.ShowParamMsg("#System:HasWrongType", c.prop.notifier, "", "");
326 DEC(cleanerInstalled);
327 IF cleanerInstalled = 0 THEN Kernel.PopTrapCleaner(cleaner) END
331 PROCEDURE DCHint (modifiers: SET): INTEGER;
333 IF Controllers.doubleClick IN modifiers THEN RETURN 1
338 PROCEDURE Notify* (c: Control; f: Views.Frame; op, from, to: INTEGER);
341 IF ~c.readOnly & ~ c.disabled THEN
342 CallNotifier(c, op, from, to);
343 IF op >= Dialog.changed THEN
344 msg.id0 := c.item.adr; msg.id1 := msg.id0 + c.item.Size(); msg.frame := f;
345 msg.op := op; msg.from := from; msg.to := to;
346 msg.opts := {update, guardCheck};
352 PROCEDURE NotifyFlushCaches*;
355 msg.opts := {flushCaches}; msg.id0 := 0; msg.id1 := 0;
357 END NotifyFlushCaches;
359 PROCEDURE GetName (VAR path, name: ARRAY OF CHAR; VAR i: INTEGER);
360 VAR j: INTEGER; ch: CHAR;
362 j := 0; ch := path[i];
363 WHILE (j < LEN(name) - 1) & ((ch >= "0") & (ch <= "9") OR (CAP(ch) >= "A") & (CAP(ch) <= "Z")
364 OR (ch >= 0C0X) & (ch # "×") & (ch # "÷") & (ch <= 0FFX) OR (ch = "_")) DO
365 name[j] := ch; INC(i); INC(j); ch := path[i]
367 IF (ch = 0X) OR (ch = ".") OR (ch = "[") OR (ch = "^") THEN name[j] := 0X
372 PROCEDURE LookupPath (path: ARRAY OF CHAR; VAR i: Meta.Item;
373 VAR adr: ARRAY OF INTEGER; VAR num: INTEGER);
374 VAR j, n: INTEGER; name: Meta.Name; ch: CHAR;
376 path[LEN(path) - 1] := 0X; j := 0; num := 0;
377 GetName(path, name, j); Meta.Lookup(name, i);
378 IF (i.obj = Meta.modObj) & (path[j] = ".") THEN
379 INC(j); GetName(path, name, j);
380 i.Lookup(name, i); ch := path[j]; INC(j);
381 WHILE i.obj = Meta.varObj DO
383 IF num < LEN(adr) - 1 THEN INC(num) END;
384 IF ch = 0X THEN RETURN
385 ELSIF i.typ = Meta.ptrTyp THEN
386 IF ch = "^" THEN ch := path[j]; INC(j) END;
388 ELSIF (i.typ = Meta.recTyp) & (ch = ".") THEN
389 GetName(path, name, j); i.Lookup(name, i);
390 ch := path[j]; INC(j)
391 ELSIF (i.typ = Meta.arrTyp) & (ch = "[") THEN
392 ch := path[j]; INC(j); n := 0;
393 WHILE (ch >= "0") & (ch <= "9") DO n := 10 * n + ORD(ch) - ORD("0"); ch := path[j]; INC(j) END;
394 IF ch = "]" THEN ch := path[j]; INC(j); i.Index(n, i) ELSE Meta.Lookup("", i) END
395 ELSE Meta.Lookup("", i)
399 Meta.LookupPath(path, i); num := 0;
400 IF i.obj = Meta.varObj THEN adr[0] := i.adr; num := 1
401 ELSIF i.obj # Meta.procObj THEN Meta.Lookup("", i)
406 PROCEDURE Sort (VAR adr: ARRAY OF INTEGER; num: INTEGER);
407 VAR i, j, p: INTEGER;
412 WHILE (j >= 1) & (adr[j - 1] > p) DO adr[j] := adr[j - 1]; DEC(j) END;
417 PROCEDURE GetTypeName (IN item: Meta.Item; OUT name: Meta.Name);
420 IF (item.typ = Meta.recTyp) THEN
421 item.GetTypeName(mod, name);
422 IF (mod = "Dialog") OR (mod = "Dates") THEN (* ok *)
429 PROCEDURE OpenLink* (c: Control; p: Prop);
432 ASSERT(c # NIL, 20); ASSERT(p # NIL, 21);
434 c.prop := Properties.CopyOf(p)(Prop);
436 IF c.customFont THEN c.font := StdCFrames.defaultLightFont
437 ELSE c.font := StdCFrames.defaultFont
440 c.guardErr := FALSE; c.notifyErr := FALSE;
441 LookupPath(p.link, c.item, c.adr, c.num);
442 IF c.item.obj = Meta.varObj THEN
444 ok := TRUE; c.CheckLink(ok);
446 Meta.Lookup("", c.item);
447 Dialog.ShowParamMsg("#System:HasWrongType", p.link, "", "")
450 Meta.Lookup("", c.item); c.num := 0
459 PROCEDURE (p: Prop) IntersectWith* (q: Properties.Property; OUT equal: BOOLEAN);
463 valid := p.valid * q.valid; equal := TRUE;
464 IF p.link # q.link THEN EXCL(valid, link) END;
465 IF p.label # q.label THEN EXCL(valid, label) END;
466 IF p.guard # q.guard THEN EXCL(valid, guard) END;
467 IF p.notifier # q.notifier THEN EXCL(valid, notifier) END;
468 IF p.level # q.level THEN EXCL(valid, level) END;
469 IF p.opt[0] # q.opt[0] THEN EXCL(valid, opt0) END;
470 IF p.opt[1] # q.opt[1] THEN EXCL(valid, opt1) END;
471 IF p.opt[2] # q.opt[2] THEN EXCL(valid, opt2) END;
472 IF p.opt[3] # q.opt[3] THEN EXCL(valid, opt3) END;
473 IF p.opt[4] # q.opt[4] THEN EXCL(valid, opt4) END;
474 IF p.valid # valid THEN p.valid := valid; equal := FALSE END
481 PROCEDURE (c: Control) CopyFromSimpleView2- (source: Control), NEW, EMPTY;
483 PROCEDURE (c: Control) CopyFromSimpleView- (source: Views.View);
485 WITH source: Control DO
486 c.item := source.item;
489 c.disabled := source.disabled;
490 c.undef := source.undef;
491 c.readOnly := source.readOnly;
492 c.shortcut := source.shortcut;
493 c.customFont := source.customFont;
494 c.font := source.font;
495 c.label := source.label$;
496 c.prop := Properties.CopyOf(source.prop)(Prop);
497 c.CopyFromSimpleView2(source)
499 END CopyFromSimpleView;
501 PROCEDURE (c: Control) Internalize- (VAR rd: Stores.Reader);
502 VAR thisVersion: INTEGER; x, def, canc, sort: BOOLEAN;
505 IF rd.cancelled THEN RETURN END;
506 rd.ReadVersion(minVersion, maxBaseVersion, thisVersion);
507 IF rd.cancelled THEN RETURN END;
509 IF thisVersion >= 3 THEN
510 rd.ReadString(c.prop.link);
511 rd.ReadString(c.prop.label);
512 rd.ReadString(c.prop.guard);
513 rd.ReadString(c.prop.notifier);
514 rd.ReadInt(c.prop.level);
515 rd.ReadBool(c.customFont);
516 rd.ReadBool(c.prop.opt[0]);
517 rd.ReadBool(c.prop.opt[1]);
518 rd.ReadBool(c.prop.opt[2]);
519 rd.ReadBool(c.prop.opt[3]);
520 rd.ReadBool(c.prop.opt[4]);
521 IF c.customFont & (thisVersion = 4) THEN
522 Views.ReadFont(rd, c.font)
525 rd.ReadXString(c.prop.link);
526 rd.ReadXString(c.prop.label);
527 rd.ReadXString(c.prop.guard);
528 c.prop.notifier := "";
529 c.prop.opt[2] := FALSE;
530 c.prop.opt[3] := FALSE;
531 c.prop.opt[4] := FALSE;
533 IF thisVersion = 2 THEN
534 rd.ReadXString(c.prop.notifier);
536 rd.ReadBool(c.prop.opt[multiLine])
537 ELSIF thisVersion = 1 THEN
538 rd.ReadXString(c.prop.notifier);
541 rd.ReadBool(x); (* free, was sed for prop.element *)
544 rd.ReadXInt(c.prop.level);
545 rd.ReadBool(c.customFont);
546 c.prop.opt[default] := def OR sort OR (c IS Field);
547 c.prop.opt[cancel] := canc
553 PROCEDURE (c: Control) Externalize- (VAR wr: Stores.Writer);
556 wr.WriteVersion(maxBaseVersion);
557 wr.WriteString(c.prop.link);
558 wr.WriteString(c.prop.label);
559 wr.WriteString(c.prop.guard);
560 wr.WriteString(c.prop.notifier);
561 wr.WriteInt(c.prop.level);
562 wr.WriteBool(c.customFont);
563 wr.WriteBool(c.prop.opt[0]);
564 wr.WriteBool(c.prop.opt[1]);
565 wr.WriteBool(c.prop.opt[2]);
566 wr.WriteBool(c.prop.opt[3]);
567 wr.WriteBool(c.prop.opt[4]);
568 IF c.customFont THEN Views.WriteFont(wr, c.font) END;
572 PROCEDURE (c: Control) HandleViewMsg- (f: Views.Frame; VAR msg: Views.Message);
573 VAR disabled, undef, readOnly, done, allDone: BOOLEAN; i: INTEGER; lbl: Dialog.String;
575 WITH msg: Views.NotifyMsg DO
576 done := FALSE; allDone := FALSE;
577 IF guardCheck IN msg.opts THEN
578 (* should call c.Update for each frame but Views.Update only once *)
579 WITH f: StdCFrames.Caption DO lbl := f.label$
580 | f: StdCFrames.PushButton DO lbl := f.label$
581 | f: StdCFrames.RadioButton DO lbl := f.label$
582 | f: StdCFrames.CheckBox DO lbl := f.label$
583 | f: StdCFrames.Group DO lbl := f.label$
586 WITH f: StdCFrames.Frame DO
587 disabled := f.disabled; undef := f.undef; readOnly := f.readOnly
589 disabled := c.disabled; undef := c.undef; readOnly := c.readOnly
592 IF (c.disabled # disabled) OR (c.undef # undef)
593 OR (c.readOnly # readOnly) OR (c.label # lbl) THEN
594 WITH f: StdCFrames.Frame DO
596 f.disabled := c.disabled;
598 f.readOnly := c.readOnly;
599 c.Update(f, 0, 0, 0); done := TRUE
600 ELSE Views.Update(c, Views.rebuildFrames); allDone := TRUE
602 ELSE Views.Update(c, Views.keepFrames); done := TRUE
606 IF flushCaches IN msg.opts THEN
607 Views.Update(c, Views.rebuildFrames)
609 i := 0; WHILE (i < c.num) & (c.adr[i] < msg.id0) DO INC(i) END;
610 IF (i < c.num) & (c.adr[i] < msg.id1) & ~allDone THEN
611 IF (update IN msg.opts) & ~done THEN
612 WITH msg: NotifyMsg DO
613 IF msg.frame # f THEN (* don't update origin frame *)
614 c.Update(f, msg.op, msg.from, msg.to)
620 IF listUpdate IN msg.opts THEN
624 | msg: Views.UpdateCachesMsg DO
625 IF c.stamp # stamp THEN
627 IF msg IS UpdateCachesMsg THEN
628 Views.Update(c, Views.rebuildFrames)
633 c.HandleViewMsg2(f, msg)
636 PROCEDURE (c: Control) HandleCtrlMsg* (f: Views.Frame; VAR msg: Controllers.Message;
637 VAR focus: Views.View);
638 VAR sp: Properties.SizeProp; p: Control; dcOk: BOOLEAN;
640 IF cleanerInstalled = 0 THEN Kernel.PushTrapCleaner(cleaner) END;
641 INC(cleanerInstalled);
643 WITH msg: Properties.PollPickMsg DO
645 | msg: Properties.PickMsg DO
646 NEW(sp); sp.known := {Properties.width, Properties.height}; sp.valid := sp.known;
647 c.context.GetSize(sp.width, sp.height);
648 Properties.Insert(msg.prop, sp)
649 | msg: Controllers.TrackMsg DO
652 IF f IS StdCFrames.Frame THEN dcOk := f(StdCFrames.Frame).DblClickOk(msg.x, msg.y) END;
653 IF (DCHint(msg.modifiers) = 1) & dcOk THEN
655 Notify(c, f, Dialog.pressed, 1, 0)
657 Notify(c, f, Dialog.pressed, 0, 0)
662 c.HandleCtrlMsg2(f, msg, focus);
663 WITH msg: Controllers.TrackMsg DO
665 Notify(c, f, Dialog.released, 0, 0)
670 DEC(cleanerInstalled);
671 IF cleanerInstalled = 0 THEN Kernel.PopTrapCleaner(cleaner) END
674 PROCEDURE (c: Control) HandlePropMsg- (VAR msg: Properties.Message);
675 VAR fpref: Properties.FocusPref; stp: Properties.StdProp;
676 cp: Prop; ppref: PropPref; op: Op; valid: SET; p: Properties.Property;
677 fop: FontOp; face: Fonts.Typeface; size, weight: INTEGER; style: SET;
679 WITH msg: Properties.ControlPref DO
680 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
681 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN
682 fpref.hotFocus := FALSE; fpref.setFocus := FALSE; fpref.atLocation := FALSE;
683 Views.HandlePropMsg(c, fpref);
684 IF fpref.setFocus THEN msg.getFocus := TRUE END
686 | msg: Properties.PollMsg DO
687 ppref.valid := {link, label, notifier, guard};
688 Views.HandlePropMsg(c, ppref);
689 cp := Properties.CopyOf(c.prop)(Prop);
690 cp.valid := ppref.valid; cp.known := cp.valid; cp.readOnly := {};
691 Properties.Insert(msg.prop, cp);
693 stp.valid := {Properties.typeface..Properties.weight};
694 stp.known := stp.valid;
695 IF c.customFont THEN stp.typeface := c.font.typeface$
696 ELSE stp.typeface := Fonts.default
698 stp.size := c.font.size; stp.style.val := c.font.style; stp.weight := c.font.weight;
699 stp.style.mask := {Fonts.italic, Fonts.strikeout, Fonts.underline};
700 Properties.Insert(msg.prop, stp)
701 | msg: Properties.SetMsg DO
702 p := msg.prop; op := NIL; fop := NIL;
703 WHILE (p # NIL) & (op = NIL) DO
705 ppref.valid := {link, label, notifier, guard};
706 Views.HandlePropMsg(c, ppref);
707 valid := p.valid * ppref.valid;
711 op.prop := Properties.CopyOf(p)(Prop); op.prop.valid := valid
713 | p: Properties.StdProp DO
714 valid := p.valid * {Properties.typeface..Properties.weight};
716 NEW(fop); fop.ctrl := c;
717 face := c.font.typeface$; size := c.font.size; style := c.font.style; weight := c.font.weight;
718 IF Properties.typeface IN p.valid THEN face := p.typeface$;
719 IF face = Fonts.default THEN face := StdCFrames.defaultFont.typeface END
721 IF Properties.size IN p.valid THEN size := p.size END;
722 IF Properties.style IN p.valid THEN
723 style := (p.style.val * p.style.mask) + (style - p.style.mask)
725 IF Properties.weight IN p.valid THEN weight := p.weight END;
727 fop.font := Fonts.dir.This(face, size, style, weight);
728 IF (fop.font.typeface = StdCFrames.defaultFont.typeface)
729 & (fop.font.size = StdCFrames.defaultFont.size)
730 & (fop.font.style = StdCFrames.defaultFont.style)
731 & (fop.font.weight = StdCFrames.defaultFont.weight) THEN
733 fop.font := StdCFrames.defaultFont
740 IF op # NIL THEN Views.Do(c, "#System:SetProp", op) END;
741 IF fop # NIL THEN Views.Do(c, "#System:SetProp", fop) END
742 | msg: Properties.TypePref DO
743 IF Services.Is(c, msg.type) THEN msg.view := c END
746 c.HandlePropMsg2(msg)
752 PROCEDURE (op: Op) Do;
753 VAR c: Control; prop: Prop;
756 prop := Properties.CopyOf(c.prop)(Prop);
757 prop.valid := op.prop.valid; (* fields to be restored *)
758 IF link IN op.prop.valid THEN c.prop.link := op.prop.link END;
759 IF label IN op.prop.valid THEN c.prop.label := op.prop.label END;
760 IF guard IN op.prop.valid THEN c.prop.guard := op.prop.guard END;
761 IF notifier IN op.prop.valid THEN c.prop.notifier := op.prop.notifier END;
762 IF level IN op.prop.valid THEN c.prop.level := op.prop.level END;
763 IF opt0 IN op.prop.valid THEN c.prop.opt[0] := op.prop.opt[0] END;
764 IF opt1 IN op.prop.valid THEN c.prop.opt[1] := op.prop.opt[1] END;
765 IF opt2 IN op.prop.valid THEN c.prop.opt[2] := op.prop.opt[2] END;
766 IF opt3 IN op.prop.valid THEN c.prop.opt[3] := op.prop.opt[3] END;
767 IF opt4 IN op.prop.valid THEN c.prop.opt[4] := op.prop.opt[4] END;
768 IF c.prop.guard # prop.guard THEN c.guardErr := FALSE END;
769 IF c.prop.notifier # prop.notifier THEN c.notifyErr := FALSE END;
770 IF c.prop.link # prop.link THEN OpenLink(c, c.prop) ELSE CallGuard(c) END;
772 Views.Update(c, Views.rebuildFrames)
775 PROCEDURE (op: FontOp) Do;
776 VAR c: Control; custom: BOOLEAN; font: Fonts.Font;
779 custom := c.customFont; c.customFont := op.custom; op.custom := custom;
780 font := c.font; c.font := op.font; op.font := font;
781 Views.Update(c, Views.rebuildFrames)
785 (* ------------------------- standard controls ------------------------- *)
787 PROCEDURE CatchCtrlMsg (c: Control; f: Views.Frame; VAR msg: Controllers.Message;
788 VAR focus: Views.View);
791 WITH f: StdCFrames.Frame DO
792 WITH msg: Controllers.PollCursorMsg DO
793 f.GetCursor(msg.x, msg.y, msg.modifiers, msg.cursor)
794 | msg: Controllers.PollOpsMsg DO
795 msg.valid := {Controllers.pasteChar}
796 | msg: Controllers.TrackMsg DO
797 f.MouseDown(msg.x, msg.y, msg.modifiers)
798 | msg: Controllers.MarkMsg DO
799 f.Mark(msg.show, msg.focus)
800 |msg: Controllers.WheelMsg DO
801 f.WheelMove(msg.x, msg.y, msg.op, msg.nofLines, msg.done)
811 PROCEDURE (d: Directory) NewPushButton* (p: Prop): Control, NEW, ABSTRACT;
812 PROCEDURE (d: Directory) NewCheckBox* (p: Prop): Control, NEW, ABSTRACT;
813 PROCEDURE (d: Directory) NewRadioButton* (p: Prop): Control, NEW, ABSTRACT;
814 PROCEDURE (d: Directory) NewField* (p: Prop): Control, NEW, ABSTRACT;
815 PROCEDURE (d: Directory) NewUpDownField* (p: Prop): Control, NEW, ABSTRACT;
816 PROCEDURE (d: Directory) NewDateField* (p: Prop): Control, NEW, ABSTRACT;
817 PROCEDURE (d: Directory) NewTimeField* (p: Prop): Control, NEW, ABSTRACT;
818 PROCEDURE (d: Directory) NewColorField* (p: Prop): Control, NEW, ABSTRACT;
819 PROCEDURE (d: Directory) NewListBox* (p: Prop): Control, NEW, ABSTRACT;
820 PROCEDURE (d: Directory) NewSelectionBox* (p: Prop): Control, NEW, ABSTRACT;
821 PROCEDURE (d: Directory) NewComboBox* (p: Prop): Control, NEW, ABSTRACT;
822 PROCEDURE (d: Directory) NewCaption* (p: Prop): Control, NEW, ABSTRACT;
823 PROCEDURE (d: Directory) NewGroup* (p: Prop): Control, NEW, ABSTRACT;
824 PROCEDURE (d: Directory) NewTreeControl* (p: Prop): Control, NEW, ABSTRACT;
829 PROCEDURE Call (c: PushButton);
830 VAR res: INTEGER; p: Control; ok: BOOLEAN; msg: Views.NotifyMsg;
832 IF c.item.Valid() & ((c.item.obj = Meta.procObj) OR (c.item.obj = Meta.varObj) & (c.item.typ = Meta.procTyp)) THEN
833 IF cleanerInstalled = 0 THEN Kernel.PushTrapCleaner(cleaner) END;
834 INC(cleanerInstalled);
835 p := par; c.item.Call(ok); par := p;
836 DEC(cleanerInstalled);
837 IF cleanerInstalled = 0 THEN Kernel.PopTrapCleaner(cleaner) END;
838 IF ~ok THEN Dialog.ShowMsg("#System:BehaviorNotAccessible") END
839 ELSIF c.prop.link # "" THEN
840 IF cleanerInstalled = 0 THEN Kernel.PushTrapCleaner(cleaner) END;
841 INC(cleanerInstalled);
842 p := par; par := c; Dialog.Call(c.prop.link, " ", res); par := p;
843 DEC(cleanerInstalled);
844 IF cleanerInstalled = 0 THEN Kernel.PopTrapCleaner(cleaner) END
845 ELSE Dialog.ShowMsg("#System:NoBehaviorBound")
847 msg.opts := {guardCheck};
851 PROCEDURE Do (f: StdCFrames.PushButton);
853 Call(f.view(PushButton))
856 PROCEDURE (c: PushButton) Internalize2 (VAR rd: Stores.Reader);
857 VAR thisVersion: INTEGER;
859 rd.ReadVersion(minVersion, pbVersion, thisVersion)
862 PROCEDURE (c: PushButton) Externalize2 (VAR wr: Stores.Writer);
864 wr.WriteVersion(pbVersion)
867 PROCEDURE (c: PushButton) GetNewFrame (VAR frame: Views.Frame);
868 VAR f: StdCFrames.PushButton;
870 f := StdCFrames.dir.NewPushButton();
871 f.disabled := c.disabled;
873 f.readOnly := c.readOnly;
876 f.default := c.prop.opt[default];
877 f.cancel := c.prop.opt[cancel];
882 PROCEDURE (c: PushButton) Restore (f: Views.Frame; l, t, r, b: INTEGER);
884 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
887 PROCEDURE (c: PushButton) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
888 VAR focus: Views.View);
891 WITH f: StdCFrames.Frame DO
892 WITH msg: Controllers.EditMsg DO
893 IF (msg.op = Controllers.pasteChar)
894 & ((msg.char = lineChar)
896 OR (msg.char = esc) & c.prop.opt[cancel]
897 OR IsShortcut(msg.char, c)) THEN f.KeyDown(msg.char) END
899 CatchCtrlMsg(c, f, msg, focus)
905 PROCEDURE (c: PushButton) HandlePropMsg2 (VAR msg: Properties.Message);
907 WITH msg: Properties.ControlPref DO
908 msg.accepts := ~c.disabled & ((msg.char = lineChar) & c.prop.opt[default]
909 OR (msg.char = esc) & c.prop.opt[cancel]
910 OR IsShortcut(msg.char, c))
911 | msg: Properties.FocusPref DO
912 IF ~c.disabled & ~ c.readOnly THEN
913 msg.hotFocus := TRUE; msg.setFocus := StdCFrames.setFocus
915 | msg: Properties.SizePref DO
916 StdCFrames.dir.GetPushButtonSize(msg.w, msg.h)
918 msg.valid := {link, label, guard, notifier, default, cancel}
919 | msg: DefaultsPref DO
920 IF c.prop.link # "" THEN msg.disabled := FALSE END
925 PROCEDURE (c: PushButton) Update (f: Views.Frame; op, from, to: INTEGER);
927 f(StdCFrames.PushButton).label := c.label$;
928 f(StdCFrames.Frame).Update
931 PROCEDURE (c: PushButton) CheckLink (VAR ok: BOOLEAN);
933 ok := c.item.typ = Meta.procTyp
939 PROCEDURE GetCheckBox (f: StdCFrames.CheckBox; OUT x: BOOLEAN);
943 c := f.view(CheckBox);
944 IF c.item.Valid() THEN
945 IF c.item.typ = Meta.boolTyp THEN x := c.item.BoolVal()
946 ELSIF c.item.typ = Meta.setTyp THEN x := c.prop.level IN c.item.SetVal()
951 PROCEDURE SetCheckBox (f: StdCFrames.CheckBox; x: BOOLEAN);
952 VAR c: CheckBox; s: SET;
954 c := f.view(CheckBox);
955 IF c.item.Valid() & ~c.readOnly THEN
956 IF c.item.typ = Meta.boolTyp THEN
957 c.item.PutBoolVal(x); Notify(c, f, Dialog.changed, 0, 0)
958 ELSIF c.item.typ = Meta.setTyp THEN
959 s := c.item.SetVal();
960 IF x THEN INCL(s, c.prop.level) ELSE EXCL(s, c.prop.level) END;
962 IF x THEN Notify(c, f, Dialog.included, c.prop.level, c.prop.level)
963 ELSE Notify(c, f, Dialog.excluded, c.prop.level, c.prop.level)
969 PROCEDURE (c: CheckBox) Internalize2 (VAR rd: Stores.Reader);
970 VAR thisVersion: INTEGER;
972 rd.ReadVersion(minVersion, cbVersion, thisVersion)
975 PROCEDURE (c: CheckBox) Externalize2 (VAR wr: Stores.Writer);
977 wr.WriteVersion(cbVersion)
980 PROCEDURE (c: CheckBox) GetNewFrame (VAR frame: Views.Frame);
981 VAR f: StdCFrames.CheckBox;
983 f := StdCFrames.dir.NewCheckBox();
984 f.disabled := c.disabled;
986 f.readOnly := c.readOnly;
989 f.Get := GetCheckBox;
990 f.Set := SetCheckBox;
994 PROCEDURE (c: CheckBox) Restore (f: Views.Frame; l, t, r, b: INTEGER);
996 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
999 PROCEDURE (c: CheckBox) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1000 VAR focus: Views.View);
1002 IF ~c.disabled & ~c.readOnly THEN
1003 WITH f: StdCFrames.Frame DO
1004 WITH msg: Controllers.EditMsg DO
1005 IF (msg.op = Controllers.pasteChar)
1006 & ((msg.char = " ") OR IsShortcut(msg.char, c)) THEN f.KeyDown(msg.char) END
1008 CatchCtrlMsg(c, f, msg, focus)
1014 PROCEDURE (c: CheckBox) HandlePropMsg2 (VAR msg: Properties.Message);
1016 WITH msg: Properties.ControlPref DO
1017 IF ~c.disabled & ~c.readOnly THEN
1018 IF (msg.char = tab) OR (msg.char = ltab) THEN
1019 (* tabs set focus to first checkbox only *)
1020 IF (msg.focus # NIL) & (msg.focus IS CheckBox)
1021 & (msg.focus(CheckBox).item.adr = c.item.adr) THEN
1022 msg.getFocus := FALSE
1024 ELSIF (msg.char >= arrowLeft) & (msg.char <= arrowDown) THEN
1025 (* arrows set focus to next checkbox bound to same variable *)
1026 msg.getFocus := StdCFrames.setFocus
1028 & (msg.focus IS CheckBox)
1029 & (msg.focus(CheckBox).item.adr = c.item.adr);
1030 msg.accepts := msg.getFocus & (msg.focus # c)
1031 ELSIF IsShortcut(msg.char, c) THEN
1032 msg.accepts := TRUE; msg.getFocus := StdCFrames.setFocus
1033 ELSIF msg.char # " " THEN
1034 msg.accepts := FALSE
1037 | msg: Properties.FocusPref DO
1038 IF ~c.disabled & ~c.readOnly THEN
1039 msg.hotFocus := TRUE; msg.setFocus := StdCFrames.setFocus
1041 | msg: Properties.SizePref DO
1042 StdCFrames.dir.GetCheckBoxSize(msg.w, msg.h)
1044 msg.valid := {link, label, guard, notifier, level}
1049 PROCEDURE (c: CheckBox) CheckLink (VAR ok: BOOLEAN);
1051 ok := (c.item.typ = Meta.boolTyp) OR (c.item.typ = Meta.setTyp)
1054 PROCEDURE (c: CheckBox) Update (f: Views.Frame; op, from, to: INTEGER);
1056 IF (op = 0) OR (c.item.typ = Meta.boolTyp) OR (c.prop.level = to) THEN
1057 f(StdCFrames.CheckBox).label := c.label$;
1058 f(StdCFrames.Frame).Update
1065 PROCEDURE GetRadioButton (f: StdCFrames.RadioButton; OUT x: BOOLEAN);
1069 c := f.view(RadioButton);
1070 IF c.item.Valid() THEN
1071 IF c.item.typ = Meta.boolTyp THEN x := c.item.BoolVal() = (c.prop.level # 0)
1072 ELSE x := c.item.IntVal() = c.prop.level
1077 PROCEDURE SetRadioButton (f: StdCFrames.RadioButton; x: BOOLEAN);
1078 VAR c: RadioButton; old: INTEGER;
1081 c := f.view(RadioButton);
1082 IF c.item.Valid() & ~c.readOnly THEN
1083 IF c.item.typ = Meta.boolTyp THEN
1084 IF c.item.BoolVal() THEN old := 1 ELSE old := 0 END;
1085 IF c.prop.level # old THEN
1086 c.item.PutBoolVal(c.prop.level # 0);
1087 Notify(c, f, Dialog.changed, old, c.prop.level)
1090 old := c.item.IntVal();
1091 IF c.prop.level # old THEN
1092 c.item.PutIntVal(c.prop.level);
1093 Notify(c, f, Dialog.changed, old, c.prop.level)
1100 PROCEDURE (c: RadioButton) Internalize2 (VAR rd: Stores.Reader);
1101 VAR thisVersion: INTEGER;
1103 rd.ReadVersion(minVersion, rbVersion, thisVersion)
1106 PROCEDURE (c: RadioButton) Externalize2 (VAR wr: Stores.Writer);
1108 wr.WriteVersion(rbVersion)
1111 PROCEDURE (c: RadioButton) GetNewFrame (VAR frame: Views.Frame);
1112 VAR f: StdCFrames.RadioButton;
1114 f := StdCFrames.dir.NewRadioButton();
1115 f.disabled := c.disabled;
1117 f.readOnly := c.readOnly;
1119 f.label := c.label$;
1120 f.Get := GetRadioButton;
1121 f.Set := SetRadioButton;
1125 PROCEDURE (c: RadioButton) Restore (f: Views.Frame; l, t, r, b: INTEGER);
1127 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
1130 PROCEDURE (c: RadioButton) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1131 VAR focus: Views.View);
1133 IF ~c.disabled & ~c.readOnly THEN
1134 WITH f: StdCFrames.Frame DO
1135 WITH msg: Controllers.EditMsg DO
1136 IF (msg.op = Controllers.pasteChar)
1137 & ((msg.char <= " ") OR IsShortcut(msg.char, c)) THEN f.KeyDown(msg.char) END
1139 CatchCtrlMsg(c, f, msg, focus)
1145 PROCEDURE (c: RadioButton) HandlePropMsg2 (VAR msg: Properties.Message);
1148 WITH msg: Properties.ControlPref DO
1149 IF ~c.disabled & ~c.readOnly THEN
1150 IF (msg.char = tab) OR (msg.char = ltab) THEN
1151 (* tabs set focus to active radio button only *)
1152 IF c.item.Valid() THEN
1153 IF c.item.typ = Meta.boolTyp THEN hot := c.item.BoolVal() = (c.prop.level # 0)
1154 ELSE hot := c.item.IntVal() = c.prop.level
1158 IF ~hot THEN msg.getFocus := FALSE END
1159 ELSIF (msg.char >= arrowLeft) & (msg.char <= arrowDown) THEN
1160 (* arrows set focus to next radio button bound to same variable *)
1161 msg.getFocus := StdCFrames.setFocus
1162 & (msg.focus # NIL) & (msg.focus IS RadioButton)
1163 & (msg.focus(RadioButton).item.adr = c.item.adr);
1164 msg.accepts := msg.getFocus & (msg.focus # c)
1165 ELSIF IsShortcut(msg.char, c) THEN
1166 msg.accepts := TRUE; msg.getFocus := StdCFrames.setFocus
1167 ELSIF msg.char # " " THEN
1168 msg.accepts := FALSE
1171 | msg: Properties.FocusPref DO
1172 IF ~c.disabled & ~c.readOnly THEN
1173 msg.hotFocus := TRUE; msg.setFocus := StdCFrames.setFocus
1175 | msg: Properties.SizePref DO
1176 StdCFrames.dir.GetRadioButtonSize(msg.w, msg.h)
1178 msg.valid := {link, label, guard, notifier, level}
1183 PROCEDURE (c: RadioButton) CheckLink (VAR ok: BOOLEAN);
1184 VAR name: Meta.Name;
1186 GetTypeName(c.item, name);
1187 IF name = "List" THEN c.item.Lookup("index", c.item) END;
1188 ok := (c.item.typ >= Meta.byteTyp) & (c.item.typ <= Meta.intTyp) OR (c.item.typ = Meta.boolTyp)
1191 PROCEDURE (c: RadioButton) Update (f: Views.Frame; op, from, to: INTEGER);
1193 IF (op = 0) OR (c.prop.level = to) OR (c.prop.level = from) THEN
1194 f(StdCFrames.RadioButton).label := c.label$;
1195 f(StdCFrames.Frame).Update
1202 PROCEDURE LongToString (x: LONGINT; OUT s: ARRAY OF CHAR);
1203 VAR d: ARRAY 24 OF CHAR; i, j: INTEGER;
1205 IF x = MIN(LONGINT) THEN
1206 s := "-9223372036854775808"
1209 IF x < 0 THEN s[0] := "-"; i := 1; x := -x END;
1210 REPEAT d[j] := CHR(x MOD 10 + ORD("0")); INC(j); x := x DIV 10 UNTIL x = 0;
1211 WHILE j > 0 DO DEC(j); s[i] := d[j]; INC(i) END;
1216 PROCEDURE StringToLong (IN s: ARRAY OF CHAR; OUT x: LONGINT; OUT res: INTEGER);
1217 VAR i, sign, d: INTEGER;
1219 i := 0; sign := 1; x := 0; res := 0;
1220 WHILE s[i] = " " DO INC(i) END;
1221 IF s[i] = "-" THEN sign := -1; INC(i) END;
1222 WHILE s[i] = " " DO INC(i) END;
1223 IF s[i] = 0X THEN res := 2 END;
1224 WHILE (s[i] >= "0") & (s[i] <= "9") DO
1225 d := ORD(s[i]) - ORD("0"); INC(i);
1226 IF x <= (MAX(LONGINT) - d) DIV 10 THEN x := 10 * x + d
1231 IF s[i] # 0X THEN res := 2 END
1234 PROCEDURE FixToInt (fix: ARRAY OF CHAR; OUT int: ARRAY OF CHAR; scale: INTEGER);
1237 IF scale > 24 THEN scale := 24 ELSIF scale < 0 THEN scale := 0 END;
1239 WHILE (fix[i] # ".") & (fix[i] # 0X) DO int[j] := fix[i]; INC(i); INC(j) END;
1240 IF fix[i] = "." THEN INC(i) END;
1241 WHILE (scale > 0) & (fix[i] >= "0") & (fix[i] <= "9") DO int[j] := fix[i]; INC(i); INC(j); DEC(scale) END;
1242 WHILE scale > 0 DO int[j] := "0"; INC(j); DEC(scale) END;
1246 PROCEDURE IntToFix (int: ARRAY OF CHAR; OUT fix: ARRAY OF CHAR; scale: INTEGER);
1247 VAR i, j, n: INTEGER;
1249 IF scale > 24 THEN scale := 24 ELSIF scale < 0 THEN scale := 0 END;
1250 n := LEN(int$); i := 0; j := 0;
1251 WHILE int[i] < "0" DO fix[j] := int[i]; INC(i); INC(j); DEC(n) END;
1253 WHILE n > scale DO fix[j] := int[i]; INC(i); INC(j); DEC(n) END
1255 fix[j] := "0"; INC(j)
1257 fix[j] := "."; INC(j);
1258 WHILE n < scale DO fix[j] := "0"; INC(j); DEC(scale) END;
1259 WHILE n > 0 DO fix[j] := int[i]; INC(i); INC(j); DEC(n) END;
1263 PROCEDURE GetField (f: StdCFrames.Field; OUT x: ARRAY OF CHAR);
1264 VAR c: Field; ok: BOOLEAN; b, v: Meta.Item; mod, name: Meta.Name;
1268 IF c.item.Valid() THEN
1269 IF c.item.typ = Meta.arrTyp THEN
1270 c.item.GetStringVal(x, ok)
1271 ELSIF c.item.typ IN {Meta.byteTyp, Meta.sIntTyp, Meta.intTyp} THEN
1272 Strings.IntToString(c.item.IntVal(), x);
1273 IF c.prop.level > 0 THEN IntToFix(x, x, c.prop.level) END
1274 ELSIF c.item.typ = Meta.longTyp THEN
1275 LongToString(c.item.LongVal(), x);
1276 IF c.prop.level > 0 THEN IntToFix(x, x, c.prop.level) END
1277 ELSIF c.item.typ = Meta.sRealTyp THEN
1278 IF c.prop.level <= 0 THEN
1279 Strings.RealToStringForm(c.item.RealVal(), 7, 0, c.prop.level, " ", x)
1281 Strings.RealToStringForm(c.item.RealVal(), c.prop.level, 0, 1, " ", x)
1283 ELSIF c.item.typ = Meta.realTyp THEN
1284 IF c.prop.level <= 0 THEN
1285 Strings.RealToStringForm(c.item.RealVal(), 16, 0, c.prop.level, " ", x)
1287 Strings.RealToStringForm(c.item.RealVal(), c.prop.level, 0, 1, " ", x)
1289 ELSIF c.item.typ = Meta.recTyp THEN
1290 c.item.GetTypeName(mod, name);
1291 IF mod = "Dialog" THEN
1292 IF name = "Currency" THEN
1293 c.item.Lookup("val", v); c.item.Lookup("scale", b);
1294 LongToString(v.LongVal(), x); IntToFix(x, x, b.IntVal())
1296 c.item.Lookup("item", v); (* Combo *)
1297 IF v.typ = Meta.arrTyp THEN v.GetStringVal(x, ok) END
1306 PROCEDURE SetField (f: StdCFrames.Field; IN x: ARRAY OF CHAR);
1307 VAR c: Field; ok: BOOLEAN; i, res, old: INTEGER; r, or: REAL; b, v: Meta.Item;
1308 mod, name: Meta.Name; long, long0: LONGINT;
1309 s: ARRAY 1024 OF CHAR;
1312 IF c.item.Valid() & ~c.readOnly THEN
1315 c.item.GetStringVal(s, ok);
1316 IF ~ok OR (s$ # x$) THEN
1317 c.item.PutStringVal(x, ok);
1318 IF ok THEN Notify(c, f, Dialog.changed, 0, 0) ELSE Dialog.Beep END
1321 IF x = "" THEN i := 0; res := 0
1322 ELSIF c.prop.level > 0 THEN FixToInt(x, s, c.prop.level); Strings.StringToInt(s, i, res)
1323 ELSE Strings.StringToInt(x, i, res)
1325 IF (res = 0) & (i >= MIN(BYTE)) & (i <= MAX(BYTE)) THEN
1326 old := c.item.IntVal();
1327 IF i # old THEN c.item.PutIntVal(i); Notify(c, f, Dialog.changed, old, i) END
1332 IF x = "" THEN i := 0; res := 0
1333 ELSIF c.prop.level > 0 THEN FixToInt(x, s, c.prop.level); Strings.StringToInt(s, i, res)
1334 ELSE Strings.StringToInt(x, i, res)
1336 IF (res = 0) & (i >= MIN(SHORTINT)) & (i <= MAX(SHORTINT)) THEN
1337 old := c.item.IntVal();
1338 IF i # old THEN c.item.PutIntVal(i); Notify(c, f, Dialog.changed, old, i) END
1343 IF x = "" THEN i := 0; res := 0
1344 ELSIF c.prop.level > 0 THEN FixToInt(x, s, c.prop.level); Strings.StringToInt(s, i, res)
1345 ELSE Strings.StringToInt(x, i, res)
1348 old := c.item.IntVal();
1349 IF i # old THEN c.item.PutIntVal(i); Notify(c, f, Dialog.changed, old, i) END
1354 IF x = "" THEN long := 0; res := 0
1355 ELSE FixToInt(x, s, c.prop.level); StringToLong(s, long, res)
1358 long0 := c.item.LongVal();
1359 IF long # long0 THEN c.item.PutLongVal(long); Notify(c, f, Dialog.changed, 0, 0) END
1364 IF (x = "") OR (x = "-") THEN r := 0; res := 0 ELSE Strings.StringToReal(x, r, res) END;
1365 IF (res = 0) & (r >= MIN(SHORTREAL)) & (r <= MAX(SHORTREAL)) THEN
1366 or := c.item.RealVal();
1367 IF r # or THEN c.item.PutRealVal(r); Notify(c, f, Dialog.changed, 0, 0) END
1372 IF (x = "") OR (x = "-") THEN r := 0; res := 0 ELSE Strings.StringToReal(x, r, res) END;
1374 or := c.item.RealVal();
1375 IF r # or THEN c.item.PutRealVal(r); Notify(c, f, Dialog.changed, 0, 0) END
1380 c.item.GetTypeName(mod, name);
1381 IF mod = "Dialog" THEN
1382 IF name = "Currency" THEN
1383 c.item.Lookup("val", v); c.item.Lookup("scale", b);
1384 IF x = "" THEN long := 0; res := 0
1385 ELSE FixToInt(x, s, b.IntVal()); StringToLong(s, long, res)
1388 long0 := v.LongVal();
1389 IF long # long0 THEN v.PutLongVal(long); Notify(c, f, Dialog.changed, 0, 0) END
1393 ELSE (* name = "Combo" *)
1394 c.item.Lookup("item", v);
1395 IF v.typ = Meta.arrTyp THEN
1396 v.GetStringVal(s, ok);
1397 IF ~ok OR (s$ # x$) THEN
1398 v.PutStringVal(x, ok);
1399 IF ok THEN Notify(c, f, Dialog.changed, 0, 0) ELSE Dialog.Beep END
1408 PROCEDURE EqualField (f: StdCFrames.Field; IN s1, s2: ARRAY OF CHAR): BOOLEAN;
1409 VAR c: Field; i1, i2, res1, res2: INTEGER; r1, r2: REAL; l1, l2: LONGINT;
1410 mod, name: Meta.Name; t1, t2: ARRAY 64 OF CHAR; b: Meta.Item;
1416 | Meta.byteTyp, Meta.sIntTyp, Meta.intTyp:
1417 IF c.prop.level > 0 THEN
1418 FixToInt(s1, t1, c.prop.level); Strings.StringToInt(t1, i1, res1);
1419 FixToInt(s2, t2, c.prop.level); Strings.StringToInt(t2, i2, res2)
1421 Strings.StringToInt(s1, i1, res1);
1422 Strings.StringToInt(s2, i2, res2)
1424 RETURN (res1 = 0) & (res2 = 0) & (i1 = i2)
1426 IF c.prop.level > 0 THEN
1427 FixToInt(s1, t1, c.prop.level); StringToLong(t1, l1, res1);
1428 FixToInt(s2, t2, c.prop.level); StringToLong(t2, l2, res2)
1430 StringToLong(s1, l1, res1);
1431 StringToLong(s2, l2, res2)
1433 RETURN (res1 = 0) & (res2 = 0) & (l1 = l2)
1434 | Meta.sRealTyp, Meta.realTyp:
1435 Strings.StringToReal(s1, r1, res1);
1436 Strings.StringToReal(s2, r2, res2);
1437 RETURN (res1 = 0) & (res2 = 0) & (r1 = r2)
1439 c.item.GetTypeName(mod, name);
1440 IF mod = "Dialog" THEN
1441 IF name = "Currency" THEN
1442 c.item.Lookup("scale", b); i1 := b.IntVal();
1443 FixToInt(s1, t1, i1); StringToLong(t1, l1, res1);
1444 FixToInt(s2, t2, i1); StringToLong(t2, l2, res2);
1445 RETURN (res1 = 0) & (res2 = 0) & (l1 =l2)
1446 ELSE (* name = "Combo" *)
1454 PROCEDURE (c: Field) CopyFromSimpleView2 (source: Control);
1456 WITH source: Field DO c.maxLen := source.maxLen END
1457 END CopyFromSimpleView2;
1459 PROCEDURE (c: Field) Internalize2 (VAR rd: Stores.Reader);
1460 VAR thisVersion: INTEGER;
1462 rd.ReadVersion(minVersion, fldVersion, thisVersion)
1465 PROCEDURE (c: Field) Externalize2 (VAR wr: Stores.Writer);
1467 wr.WriteVersion(fldVersion)
1470 PROCEDURE (c: Field) GetNewFrame (VAR frame: Views.Frame);
1471 VAR f: StdCFrames.Field;
1473 f := StdCFrames.dir.NewField();
1474 f.disabled := c.disabled;
1476 f.readOnly := c.readOnly;
1478 f.maxLen := c.maxLen;
1479 f.left := c.prop.opt[left];
1480 f.right := c.prop.opt[right];
1481 f.multiLine := c.prop.opt[multiLine];
1482 f.password := c.prop.opt[password];
1485 f.Equal := EqualField;
1489 PROCEDURE (c: Field) Restore (f: Views.Frame; l, t, r, b: INTEGER);
1491 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
1494 PROCEDURE (c: Field) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1495 VAR focus: Views.View);
1496 VAR ch: CHAR; mod, name: Meta.Name;
1498 WITH f: StdCFrames.Field DO
1499 IF ~c.disabled & ~c.readOnly THEN
1500 WITH msg: Controllers.PollOpsMsg DO
1501 msg.selectable := TRUE;
1502 (* should ask Frame if there is a selection for cut or copy! *)
1503 msg.valid := {Controllers.pasteChar, Controllers.cut, Controllers.copy, Controllers.paste}
1504 | msg: Controllers.TickMsg DO
1506 | msg: Controllers.EditMsg DO
1507 IF msg.op = Controllers.pasteChar THEN
1509 IF (ch = ldel) OR (ch = rdel) OR (ch >= 10X) & (ch <= 1FX)
1510 OR ("0" <= ch) & (ch <= "9") OR (ch = "+") OR (ch = "-")
1511 OR (c.item.typ = Meta.arrTyp)
1512 OR (c.item.typ IN {Meta.sRealTyp, Meta.realTyp}) & ((ch = ".") OR (ch = "E"))
1513 OR (c.prop.level > 0) & (ch = ".")
1515 ELSIF c.item.typ = Meta.recTyp THEN
1516 c.item.GetTypeName(mod, name);
1517 IF (mod = "Dialog") & (name = "Combo") OR (ch = ".") THEN
1524 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
1526 | msg: Controllers.SelectMsg DO
1527 IF msg.set THEN f.Select(0, MAX(INTEGER))
1528 ELSE f.Select(-1, -1)
1530 | msg: Controllers.MarkMsg DO
1531 f.Mark(msg.show, msg.focus);
1532 IF ~msg.show & msg.focus THEN f.Update END;
1533 IF msg.show & msg.focus THEN f.Select(0, MAX(INTEGER)) END
1535 CatchCtrlMsg(c, f, msg, focus)
1537 ELSIF ~c.disabled THEN
1538 WITH msg: Controllers.TrackMsg DO
1539 f.MouseDown(msg.x, msg.y, msg.modifiers)
1546 PROCEDURE (c: Field) HandlePropMsg2 (VAR msg: Properties.Message);
1548 WITH msg: Properties.ControlPref DO
1549 IF msg.char = lineChar THEN msg.accepts := c.prop.opt[multiLine] & (msg.focus = c)
1550 ELSIF msg.char = esc THEN msg.accepts := FALSE
1552 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
1553 | msg: Properties.FocusPref DO
1554 IF ~c.disabled & ~c.readOnly THEN
1555 msg.setFocus := TRUE
1556 ELSIF~c.disabled THEN
1557 msg.hotFocus := TRUE
1559 | msg: Properties.SizePref DO
1560 StdCFrames.dir.GetFieldSize(c.maxLen, msg.w, msg.h)
1562 msg.valid := {link, label, guard, level, notifier, left, right, multiLine, password}
1567 PROCEDURE (c: Field) CheckLink (VAR ok: BOOLEAN);
1568 VAR t: INTEGER; name: Meta.Name;
1570 GetTypeName(c.item, name); t := c.item.typ;
1571 IF (t = Meta.arrTyp) & (c.item.BaseTyp() = Meta.charTyp) THEN c.maxLen := SHORT(c.item.Len() - 1)
1572 ELSIF t = Meta.byteTyp THEN c.maxLen := 6
1573 ELSIF t = Meta.sIntTyp THEN c.maxLen := 9
1574 ELSIF t = Meta.intTyp THEN c.maxLen := 13
1575 ELSIF t = Meta.longTyp THEN c.maxLen := 24
1576 ELSIF t = Meta.sRealTyp THEN c.maxLen := 16
1577 ELSIF t = Meta.realTyp THEN c.maxLen := 24
1578 ELSIF name = "Combo" THEN c.maxLen := 64
1579 ELSIF name = "Currency" THEN c.maxLen := 16
1584 PROCEDURE (c: Field) Update (f: Views.Frame; op, from, to: INTEGER);
1586 f(StdCFrames.Frame).Update
1592 PROCEDURE GetUpDownField (f: StdCFrames.UpDownField; OUT val: INTEGER);
1596 c := f.view(UpDownField);
1597 IF c.item.Valid() THEN val := c.item.IntVal() END
1600 PROCEDURE SetUpDownField (f: StdCFrames.UpDownField; val: INTEGER);
1601 VAR c: UpDownField; old: INTEGER;
1603 c := f.view(UpDownField);
1604 IF c.item.Valid() & ~c.readOnly THEN
1605 IF (val >= c.min) & (val <= c.max) THEN
1606 old := c.item.IntVal();
1607 IF old # val THEN c.item.PutIntVal(val); Notify(c, f, Dialog.changed, old, val) END
1613 PROCEDURE (c: UpDownField) CopyFromSimpleView2 (source: Control);
1615 WITH source: UpDownField DO
1616 c.min := source.min;
1617 c.max := source.max;
1620 END CopyFromSimpleView2;
1622 PROCEDURE (c: UpDownField) Internalize2 (VAR rd: Stores.Reader);
1623 VAR thisVersion: INTEGER;
1625 rd.ReadVersion(minVersion, fldVersion, thisVersion)
1628 PROCEDURE (c: UpDownField) Externalize2 (VAR wr: Stores.Writer);
1630 wr.WriteVersion(fldVersion)
1633 PROCEDURE (c: UpDownField) GetNewFrame (VAR frame: Views.Frame);
1634 VAR f: StdCFrames.UpDownField;
1636 f := StdCFrames.dir.NewUpDownField();
1637 f.disabled := c.disabled;
1639 f.readOnly := c.readOnly;
1644 f.Get := GetUpDownField;
1645 f.Set := SetUpDownField;
1649 PROCEDURE (c: UpDownField) Restore (f: Views.Frame; l, t, r, b: INTEGER);
1651 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
1654 PROCEDURE (c: UpDownField) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1655 VAR focus: Views.View);
1658 IF ~c.disabled & ~c.readOnly THEN
1659 WITH f: StdCFrames.UpDownField DO
1660 WITH msg: Controllers.PollOpsMsg DO
1661 msg.selectable := TRUE;
1662 (* should ask view if there is a selection for cut or copy! *)
1663 msg.valid := {Controllers.pasteChar, Controllers.cut, Controllers.copy, Controllers.paste}
1664 | msg: Controllers.TickMsg DO
1666 | msg: Controllers.EditMsg DO
1667 IF msg.op = Controllers.pasteChar THEN
1669 IF (ch = ldel) OR (ch = rdel) OR (ch >= 10X) & (ch <= 1FX)
1670 OR ("0" <= ch) & (ch <= "9") OR (ch = "+") OR (ch = "-")
1671 OR (c.item.typ = Meta.arrTyp)
1676 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
1678 | msg: Controllers.SelectMsg DO
1679 IF msg.set THEN f.Select(0, MAX(INTEGER))
1680 ELSE f.Select(-1, -1)
1682 | msg: Controllers.MarkMsg DO
1683 f.Mark(msg.show, msg.focus);
1684 IF msg.show & msg.focus THEN f.Select(0, MAX(INTEGER)) END
1686 CatchCtrlMsg(c, f, msg, focus)
1692 PROCEDURE (c: UpDownField) HandlePropMsg2 (VAR msg: Properties.Message);
1693 VAR m: INTEGER; n: INTEGER;
1695 WITH msg: Properties.ControlPref DO
1696 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
1697 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
1698 | msg: Properties.FocusPref DO
1699 IF ~c.disabled & ~c.readOnly THEN
1700 msg.setFocus := TRUE
1702 | msg: Properties.SizePref DO
1704 IF c.max > m THEN m := c.max END;
1706 WHILE m > 99 DO INC(n); m := m DIV 10 END;
1707 StdCFrames.dir.GetUpDownFieldSize(n, msg.w, msg.h)
1709 msg.valid := {link, label, guard, notifier}
1714 PROCEDURE (c: UpDownField) CheckLink (VAR ok: BOOLEAN);
1716 IF c.item.typ = Meta.byteTyp THEN c.min := MIN(BYTE); c.max := MAX(BYTE)
1717 ELSIF c.item.typ = Meta.sIntTyp THEN c.min := MIN(SHORTINT); c.max := MAX(SHORTINT)
1718 ELSIF c.item.typ = Meta.intTyp THEN c.min := MIN(INTEGER); c.max := MAX(INTEGER)
1724 PROCEDURE (c: UpDownField) Update (f: Views.Frame; op, from, to: INTEGER);
1726 f(StdCFrames.Frame).Update
1732 PROCEDURE GetDateField (f: StdCFrames.DateField; OUT date: Dates.Date);
1733 VAR c: DateField; v: Meta.Item;
1735 date.year := 1; date.month := 1; date.day := 1;
1736 c := f.view(DateField);
1737 IF c.item.Valid() THEN
1738 c.item.Lookup("year", v); IF v.typ = Meta.intTyp THEN date.year := SHORT(v.IntVal()) END;
1739 c.item.Lookup("month", v); IF v.typ = Meta.intTyp THEN date.month := SHORT(v.IntVal()) END;
1740 c.item.Lookup("day", v); IF v.typ = Meta.intTyp THEN date.day := SHORT(v.IntVal()) END
1744 PROCEDURE SetDateField(f: StdCFrames.DateField; IN date: Dates.Date);
1745 VAR c: DateField; v: Meta.Item;
1747 c := f.view(DateField);
1748 IF c.item.Valid() & ~c.readOnly THEN
1749 c.item.Lookup("year", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.year) END;
1750 c.item.Lookup("month", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.month) END;
1751 c.item.Lookup("day", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.day) END;
1752 Notify(c, f, Dialog.changed, 0, 0)
1756 PROCEDURE GetDateFieldSelection (f: StdCFrames.DateField; OUT sel: INTEGER);
1758 sel := f.view(DateField).selection
1759 END GetDateFieldSelection;
1761 PROCEDURE SetDateFieldSelection (f: StdCFrames.DateField; sel: INTEGER);
1763 f.view(DateField).selection := sel
1764 END SetDateFieldSelection;
1766 PROCEDURE (c: DateField) CopyFromSimpleView2 (source: Control);
1768 WITH source: DateField DO c.selection := source.selection END
1769 END CopyFromSimpleView2;
1771 PROCEDURE (c: DateField) Internalize2 (VAR rd: Stores.Reader);
1772 VAR thisVersion: INTEGER;
1774 rd.ReadVersion(minVersion, dfldVersion, thisVersion);
1778 PROCEDURE (c: DateField) Externalize2 (VAR wr: Stores.Writer);
1780 wr.WriteVersion(dfldVersion)
1783 PROCEDURE (c: DateField) GetNewFrame (VAR frame: Views.Frame);
1784 VAR f: StdCFrames.DateField;
1786 f := StdCFrames.dir.NewDateField();
1787 f.disabled := c.disabled;
1789 f.readOnly := c.readOnly;
1791 f.Get := GetDateField;
1792 f.Set := SetDateField;
1793 f.GetSel := GetDateFieldSelection;
1794 f.SetSel := SetDateFieldSelection;
1798 PROCEDURE (c: DateField) Restore (f: Views.Frame; l, t, r, b: INTEGER);
1800 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
1803 PROCEDURE (c: DateField) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1804 VAR focus: Views.View);
1806 IF ~c.disabled & ~c.readOnly THEN
1807 WITH f: StdCFrames.DateField DO
1808 WITH msg: Controllers.PollOpsMsg DO
1809 msg.valid := {Controllers.pasteChar, Controllers.copy}
1810 | msg: Controllers.EditMsg DO
1811 IF msg.op = Controllers.pasteChar THEN
1814 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
1816 | msg: Controllers.TickMsg DO
1818 IF c.selection = 0 THEN c.selection := 1; Views.Update(c, Views.keepFrames) END
1821 CatchCtrlMsg(c, f, msg, focus)
1827 PROCEDURE (c: DateField) HandlePropMsg2 (VAR msg: Properties.Message);
1829 WITH msg: Properties.ControlPref DO
1830 IF (msg.char = lineChar) OR (msg.char = esc) THEN
1831 msg.accepts := FALSE
1832 ELSIF (msg.char = tab) OR (msg.char = ltab) THEN
1833 msg.accepts := ((msg.focus # c) & (~c.disabled & ~c.readOnly)) OR
1834 (msg.focus = c) & ((msg.char = tab) & (c.selection # -1) OR (msg.char = ltab) & (c.selection # 1));
1835 msg.getFocus := msg.accepts
1837 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
1838 | msg: Properties.FocusPref DO
1839 IF ~c.disabled & ~c.readOnly THEN
1840 msg.setFocus := TRUE
1842 | msg: Properties.SizePref DO
1843 StdCFrames.dir.GetDateFieldSize(msg.w, msg.h)
1845 msg.valid := {link, label, guard, notifier}
1850 PROCEDURE (c: DateField) CheckLink (VAR ok: BOOLEAN);
1851 VAR name: Meta.Name;
1853 GetTypeName(c.item, name);
1857 PROCEDURE (c: DateField) Update (f: Views.Frame; op, from, to: INTEGER);
1859 f(StdCFrames.Frame).Update
1865 PROCEDURE GetTimeField (f: StdCFrames.TimeField; OUT time: Dates.Time);
1866 VAR c: TimeField; v: Meta.Item;
1868 time.hour := 0; time.minute := 0; time.second := 0;
1869 c := f.view(TimeField);
1870 IF c.item.Valid() THEN
1871 c.item.Lookup("hour", v); IF v.typ = Meta.intTyp THEN time.hour := SHORT(v.IntVal()) END;
1872 c.item.Lookup("minute", v); IF v.typ = Meta.intTyp THEN time.minute := SHORT(v.IntVal()) END;
1873 c.item.Lookup("second", v); IF v.typ = Meta.intTyp THEN time.second := SHORT(v.IntVal()) END
1877 PROCEDURE SetTimeField(f: StdCFrames.TimeField; IN date: Dates.Time);
1878 VAR c: TimeField; v: Meta.Item;
1880 c := f.view(TimeField);
1881 IF c.item.Valid() & ~c.readOnly THEN
1882 c.item.Lookup("hour", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.hour) END;
1883 c.item.Lookup("minute", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.minute) END;
1884 c.item.Lookup("second", v); IF v.typ = Meta.intTyp THEN v.PutIntVal(date.second) END;
1885 Notify(c, f, Dialog.changed, 0, 0)
1889 PROCEDURE GetTimeFieldSelection (f: StdCFrames.TimeField; OUT sel: INTEGER);
1891 sel := f.view(TimeField).selection
1892 END GetTimeFieldSelection;
1894 PROCEDURE SetTimeFieldSelection (f: StdCFrames.TimeField; sel: INTEGER);
1896 f.view(TimeField).selection := sel
1897 END SetTimeFieldSelection;
1899 PROCEDURE (c: TimeField) CopyFromSimpleView2 (source: Control);
1901 WITH source: TimeField DO c.selection := source.selection END
1902 END CopyFromSimpleView2;
1904 PROCEDURE (c: TimeField) Internalize2 (VAR rd: Stores.Reader);
1905 VAR thisVersion: INTEGER;
1907 rd.ReadVersion(minVersion, tfldVersion, thisVersion);
1911 PROCEDURE (c: TimeField) Externalize2 (VAR wr: Stores.Writer);
1913 wr.WriteVersion(tfldVersion)
1916 PROCEDURE (c: TimeField) GetNewFrame (VAR frame: Views.Frame);
1917 VAR f: StdCFrames.TimeField;
1919 f := StdCFrames.dir.NewTimeField();
1920 f.disabled := c.disabled;
1922 f.readOnly := c.readOnly;
1924 f.Get := GetTimeField;
1925 f.Set := SetTimeField;
1926 f.GetSel := GetTimeFieldSelection;
1927 f.SetSel := SetTimeFieldSelection;
1931 PROCEDURE (c: TimeField) Restore (f: Views.Frame; l, t, r, b: INTEGER);
1933 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
1936 PROCEDURE (c: TimeField) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
1937 VAR focus: Views.View);
1939 IF ~c.disabled & ~c.readOnly THEN
1940 WITH f: StdCFrames.TimeField DO
1941 WITH msg: Controllers.PollOpsMsg DO
1942 msg.valid := {Controllers.pasteChar, Controllers.copy}
1943 | msg: Controllers.EditMsg DO
1944 IF msg.op = Controllers.pasteChar THEN
1947 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
1949 | msg: Controllers.TickMsg DO
1951 IF c.selection = 0 THEN c.selection := 1; Views.Update(c, Views.keepFrames) END
1954 CatchCtrlMsg(c, f, msg, focus)
1960 PROCEDURE (c: TimeField) HandlePropMsg2 (VAR msg: Properties.Message);
1962 WITH msg: Properties.ControlPref DO
1963 IF (msg.char = lineChar) OR (msg.char = esc) THEN
1964 msg.accepts := FALSE
1965 ELSIF (msg.char = tab) OR (msg.char = ltab) THEN
1966 msg.accepts := (msg.focus # c) OR
1967 ((msg.char = tab) & (c.selection # -1)) OR ((msg.char = ltab) & (c.selection # 1))
1969 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
1970 | msg: Properties.FocusPref DO
1971 IF ~c.disabled & ~c.readOnly THEN
1972 msg.setFocus := TRUE
1974 | msg: Properties.SizePref DO
1975 StdCFrames.dir.GetTimeFieldSize(msg.w, msg.h)
1977 msg.valid := {link, label, guard, notifier}
1982 PROCEDURE (c: TimeField) CheckLink (VAR ok: BOOLEAN);
1983 VAR name: Meta.Name;
1985 GetTypeName(c.item, name);
1989 PROCEDURE (c: TimeField) Update (f: Views.Frame; op, from, to: INTEGER);
1991 f(StdCFrames.Frame).Update
1997 PROCEDURE GetColorField (f: StdCFrames.ColorField; OUT col: INTEGER);
1998 VAR c: ColorField; v: Meta.Item;
2000 col := Ports.defaultColor;
2001 c := f.view(ColorField);
2002 IF c.item.Valid() THEN
2003 IF c.item.typ = Meta.intTyp THEN
2004 col := c.item.IntVal()
2006 c.item.Lookup("val", v); IF v.typ = Meta.intTyp THEN col := v.IntVal() END
2011 PROCEDURE SetColorField(f: StdCFrames.ColorField; col: INTEGER);
2012 VAR c: ColorField; v: Meta.Item; old: INTEGER;
2014 c := f.view(ColorField);
2015 IF c.item.Valid() & ~c.readOnly THEN
2016 IF c.item.typ = Meta.intTyp THEN
2017 old := c.item.IntVal();
2018 IF old # col THEN c.item.PutIntVal(col); Notify(c, f, Dialog.changed, old, col) END
2020 c.item.Lookup("val", v);
2021 IF v.typ = Meta.intTyp THEN
2023 IF old # col THEN v.PutIntVal(col); Notify(c, f, Dialog.changed, old, col) END
2029 PROCEDURE (c: ColorField) Internalize2 (VAR rd: Stores.Reader);
2030 VAR thisVersion: INTEGER;
2032 rd.ReadVersion(minVersion, cfldVersion, thisVersion)
2035 PROCEDURE (c: ColorField) Externalize2 (VAR wr: Stores.Writer);
2037 wr.WriteVersion(cfldVersion)
2040 PROCEDURE (c: ColorField) GetNewFrame (VAR frame: Views.Frame);
2041 VAR f: StdCFrames.ColorField;
2043 f := StdCFrames.dir.NewColorField();
2044 f.disabled := c.disabled;
2046 f.readOnly := c.readOnly;
2048 f.Get := GetColorField;
2049 f.Set := SetColorField;
2053 PROCEDURE (c: ColorField) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2055 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2058 PROCEDURE (c: ColorField) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
2059 VAR focus: Views.View);
2061 IF ~c.disabled & ~c.readOnly THEN
2062 WITH f: StdCFrames.ColorField DO
2063 WITH msg: Controllers.EditMsg DO
2064 IF msg.op = Controllers.pasteChar THEN
2067 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
2070 CatchCtrlMsg(c, f, msg, focus)
2076 PROCEDURE (c: ColorField) HandlePropMsg2 (VAR msg: Properties.Message);
2078 WITH msg: Properties.ControlPref DO
2079 msg.accepts := ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c)
2080 | msg: Properties.FocusPref DO
2081 IF ~c.disabled & ~c.readOnly THEN
2082 msg.hotFocus := TRUE; msg.setFocus := StdCFrames.setFocus
2084 | msg: Properties.SizePref DO
2085 StdCFrames.dir.GetColorFieldSize(msg.w, msg.h)
2090 PROCEDURE (c: ColorField) CheckLink (VAR ok: BOOLEAN);
2091 VAR name: Meta.Name;
2093 GetTypeName(c.item, name);
2094 ok := (name = "Color") OR (c.item.typ = Meta.intTyp)
2097 PROCEDURE (c: ColorField) Update (f: Views.Frame; op, from, to: INTEGER);
2099 f(StdCFrames.Frame).Update
2105 PROCEDURE GetListBox (f: StdCFrames.ListBox; OUT i: INTEGER);
2106 VAR c: ListBox; v: Meta.Item;
2109 c := f.view(ListBox);
2110 IF c.item.Valid() THEN
2111 c.item.Lookup("index", v);
2112 IF v.typ = Meta.intTyp THEN i := v.IntVal() END
2116 PROCEDURE SetListBox (f: StdCFrames.ListBox; i: INTEGER);
2117 VAR c: ListBox; v: Meta.Item; old: INTEGER;
2119 c := f.view(ListBox);
2120 IF c.item.Valid() & ~c.readOnly THEN
2121 c.item.Lookup("index", v);
2122 IF v.typ = Meta.intTyp THEN
2124 IF i # old THEN v.PutIntVal(i); Notify(c, f, Dialog.changed, old, i) END
2129 PROCEDURE GetFName (VAR rec, par: ANYREC);
2132 WITH rec: Dialog.List DO rec.GetItem(par.i, par.n)
2133 | rec: Dialog.Selection DO rec.GetItem(par.i, par.n)
2134 | rec: Dialog.Combo DO rec.GetItem(par.i, par.n)
2140 PROCEDURE GetListName (f: StdCFrames.ListBox; i: INTEGER; VAR name: ARRAY OF CHAR);
2141 VAR c: ListBox; par: Param;
2144 c := f.view(ListBox);
2145 IF c.item.Valid() THEN
2147 c.item.CallWith(GetFName, par)
2152 PROCEDURE (c: ListBox) Internalize2 (VAR rd: Stores.Reader);
2153 VAR thisVersion: INTEGER;
2155 rd.ReadVersion(minVersion, lbxVersion, thisVersion)
2158 PROCEDURE (c: ListBox) Externalize2 (VAR wr: Stores.Writer);
2160 wr.WriteVersion(lbxVersion)
2163 PROCEDURE (c: ListBox) GetNewFrame (VAR frame: Views.Frame);
2164 VAR f: StdCFrames.ListBox;
2166 f := StdCFrames.dir.NewListBox();
2167 f.disabled := c.disabled;
2169 f.readOnly := c.readOnly;
2171 f.sorted := c.prop.opt[sorted];
2172 f.Get := GetListBox;
2173 f.Set := SetListBox;
2174 f.GetName := GetListName;
2178 PROCEDURE (c: ListBox) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2180 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2183 PROCEDURE (c: ListBox) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
2184 VAR focus: Views.View);
2186 WITH f: StdCFrames.ListBox DO
2187 IF ~c.disabled & ~c.readOnly THEN
2188 WITH msg: Controllers.EditMsg DO
2189 IF msg.op = Controllers.pasteChar THEN f.KeyDown(msg.char) END
2191 CatchCtrlMsg(c, f, msg, focus)
2193 ELSIF ~c.disabled THEN
2194 WITH msg: Controllers.TrackMsg DO
2195 f.MouseDown(msg.x, msg.y, msg.modifiers)
2202 PROCEDURE (c: ListBox) HandlePropMsg2 (VAR msg: Properties.Message);
2204 WITH msg: Properties.ControlPref DO
2205 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
2206 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
2207 | msg: Properties.FocusPref DO
2208 IF ~c.disabled & ~c.readOnly THEN
2209 msg.setFocus := TRUE
2210 ELSIF~c.disabled THEN
2211 msg.hotFocus := TRUE
2213 | msg: Properties.SizePref DO
2214 StdCFrames.dir.GetListBoxSize(msg.w, msg.h)
2216 msg.valid := {link, label, guard, notifier, sorted}
2221 PROCEDURE (c: ListBox) CheckLink (VAR ok: BOOLEAN);
2222 VAR name: Meta.Name;
2224 GetTypeName(c.item, name);
2228 PROCEDURE (c: ListBox) Update (f: Views.Frame; op, from, to: INTEGER);
2230 f(StdCFrames.Frame).Update
2233 PROCEDURE (c: ListBox) UpdateList (f: Views.Frame);
2235 f(StdCFrames.Frame).UpdateList
2241 PROCEDURE InLargeSet (VAR rec, par: ANYREC);
2244 WITH rec: Dialog.Selection DO
2245 IF rec.In(par.i) THEN par.i := 1 ELSE par.i := 0 END
2251 PROCEDURE GetSelectionBox (f: StdCFrames.SelectionBox; i: INTEGER; OUT in: BOOLEAN);
2252 VAR c: SelectionBox; lv: SelectValue; par: Param;
2255 c := f.view(SelectionBox);
2256 IF c.item.Valid() THEN
2257 IF c.item.Is(lv) THEN
2259 c.item.CallWith(InLargeSet, par);
2263 END GetSelectionBox;
2265 PROCEDURE InclLargeSet (VAR rec, par: ANYREC);
2268 WITH rec: Dialog.Selection DO
2269 IF (par.from # par.to) OR ~rec.In(par.from) THEN
2270 rec.Incl(par.from, par.to); par.i := 1
2278 PROCEDURE InclSelectionBox (f: StdCFrames.SelectionBox; from, to: INTEGER);
2279 VAR c: SelectionBox; lv: SelectValue; par: Param;
2281 c := f.view(SelectionBox);
2282 IF c.item.Valid() & ~c.readOnly THEN
2283 IF c.item.Is(lv) THEN
2284 par.from := from; par.to := to;
2285 c.item.CallWith(InclLargeSet, par);
2286 IF par.i # 0 THEN Notify(c, f, Dialog.included, from, to) END
2289 END InclSelectionBox;
2291 PROCEDURE ExclLargeSet (VAR rec, par: ANYREC);
2294 WITH rec: Dialog.Selection DO
2295 IF (par.from # par.to) OR rec.In(par.from) THEN
2296 rec.Excl(par.from, par.to); par.i := 1
2304 PROCEDURE ExclSelectionBox (f: StdCFrames.SelectionBox; from, to: INTEGER);
2305 VAR c: SelectionBox; lv: SelectValue; par: Param;
2307 c := f.view(SelectionBox);
2308 IF c.item.Valid() & ~c.readOnly THEN
2309 IF c.item.Is(lv) THEN
2310 par.from := from; par.to := to;
2311 c.item.CallWith(ExclLargeSet, par);
2312 IF par.i # 0 THEN Notify(c, f, Dialog.excluded, from, to) END
2315 END ExclSelectionBox;
2317 PROCEDURE SetSelectionBox (f: StdCFrames.SelectionBox; from, to: INTEGER);
2318 VAR c: SelectionBox; lv: SelectValue; par: Param;
2320 c := f.view(SelectionBox);
2321 IF c.item.Valid() & ~c.readOnly THEN
2322 IF c.item.Is(lv) THEN
2323 par.from := 0; par.to := MAX(INTEGER);
2324 c.item.CallWith(ExclLargeSet, par);
2325 par.from := from; par.to := to;
2326 c.item.CallWith(InclLargeSet, par);
2327 Notify(c, f, Dialog.set, from, to)
2330 END SetSelectionBox;
2332 PROCEDURE GetSelName (f: StdCFrames.SelectionBox; i: INTEGER; VAR name: ARRAY OF CHAR);
2333 VAR c: SelectionBox; par: Param;
2336 c := f.view(SelectionBox);
2337 IF c.item.Valid() THEN
2339 c.item.CallWith(GetFName, par)
2344 PROCEDURE (c: SelectionBox) Internalize2 (VAR rd: Stores.Reader);
2345 VAR thisVersion: INTEGER;
2347 rd.ReadVersion(minVersion, sbxVersion, thisVersion)
2350 PROCEDURE (c: SelectionBox) Externalize2 (VAR wr: Stores.Writer);
2352 wr.WriteVersion(sbxVersion)
2355 PROCEDURE (c: SelectionBox) GetNewFrame (VAR frame: Views.Frame);
2356 VAR f: StdCFrames.SelectionBox;
2358 f := StdCFrames.dir.NewSelectionBox();
2359 f.disabled := c.disabled;
2361 f.readOnly := c.readOnly;
2363 f.sorted := c.prop.opt[sorted];
2364 f.Get := GetSelectionBox;
2365 f.Incl := InclSelectionBox;
2366 f.Excl := ExclSelectionBox;
2367 f.Set := SetSelectionBox;
2368 f.GetName := GetSelName;
2372 PROCEDURE (c: SelectionBox) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2374 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2377 PROCEDURE (c: SelectionBox) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
2378 VAR focus: Views.View);
2380 WITH f: StdCFrames.SelectionBox DO
2381 IF ~c.disabled & ~c.readOnly THEN
2382 WITH msg: Controllers.EditMsg DO
2383 IF msg.op = Controllers.pasteChar THEN f.KeyDown(msg.char) END
2384 | msg: Controllers.SelectMsg DO
2385 IF msg.set THEN f.Select(0, MAX(INTEGER))
2386 ELSE f.Select(-1, -1)
2389 CatchCtrlMsg(c, f, msg, focus)
2391 ELSIF ~c.disabled THEN
2392 WITH msg: Controllers.TrackMsg DO
2393 f.MouseDown(msg.x, msg.y, msg.modifiers)
2400 PROCEDURE (c: SelectionBox) HandlePropMsg2 (VAR msg: Properties.Message);
2402 WITH msg: Properties.ControlPref DO
2403 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
2404 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) OR msg.getFocus THEN
2405 msg.getFocus := StdCFrames.setFocus
2407 | msg: Properties.FocusPref DO
2408 IF ~c.disabled & ~c.readOnly THEN
2409 msg.setFocus := TRUE
2410 ELSIF~c.disabled THEN
2411 msg.hotFocus := TRUE
2413 | msg: Properties.SizePref DO
2414 StdCFrames.dir.GetSelectionBoxSize(msg.w, msg.h)
2416 msg.valid := {link, label, guard, notifier, sorted}
2421 PROCEDURE (c: SelectionBox) CheckLink (VAR ok: BOOLEAN);
2422 VAR name: Meta.Name;
2424 GetTypeName(c.item, name);
2425 ok := name = "Selection"
2428 PROCEDURE (c: SelectionBox) Update (f: Views.Frame; op, from, to: INTEGER);
2430 IF (op >= Dialog.included) & (op <= Dialog.set) THEN
2431 f(StdCFrames.SelectionBox).UpdateRange(op, from, to)
2433 f(StdCFrames.Frame).Update
2437 PROCEDURE (c: SelectionBox) UpdateList (f: Views.Frame);
2439 f(StdCFrames.Frame).UpdateList
2445 PROCEDURE GetComboBox (f: StdCFrames.ComboBox; OUT x: ARRAY OF CHAR);
2446 VAR c: ComboBox; ok: BOOLEAN; v: Meta.Item;
2449 c := f.view(ComboBox);
2450 IF c.item.Valid() THEN
2451 c.item.Lookup("item", v);
2452 IF v.typ = Meta.arrTyp THEN v.GetStringVal(x, ok) END
2456 PROCEDURE SetComboBox (f: StdCFrames.ComboBox; IN x: ARRAY OF CHAR);
2457 VAR c: ComboBox; ok: BOOLEAN; v: Meta.Item; s: ARRAY 1024 OF CHAR;
2459 c := f.view(ComboBox);
2460 IF c.item.Valid() & ~c.readOnly THEN
2461 c.item.Lookup("item", v);
2462 IF v.typ = Meta.arrTyp THEN
2463 v.GetStringVal(s, ok);
2464 IF ~ok OR (s$ # x$) THEN
2465 v.PutStringVal(x, ok);
2466 IF ok THEN Notify(c, f, Dialog.changed, 0, 0) END
2472 PROCEDURE GetComboName (f: StdCFrames.ComboBox; i: INTEGER; VAR name: ARRAY OF CHAR);
2473 VAR c: ComboBox; par: Param;
2476 c := f.view(ComboBox);
2477 IF c.item.Valid() THEN
2479 c.item.CallWith(GetFName, par)
2484 PROCEDURE (c: ComboBox) Internalize2 (VAR rd: Stores.Reader);
2485 VAR thisVersion: INTEGER;
2487 rd.ReadVersion(minVersion, cbxVersion, thisVersion)
2490 PROCEDURE (c: ComboBox) Externalize2 (VAR wr: Stores.Writer);
2492 wr.WriteVersion(cbxVersion)
2495 PROCEDURE (c: ComboBox) GetNewFrame (VAR frame: Views.Frame);
2496 VAR f: StdCFrames.ComboBox;
2498 f := StdCFrames.dir.NewComboBox();
2499 f.disabled := c.disabled;
2501 f.readOnly := c.readOnly;
2503 f.sorted := c.prop.opt[sorted];
2504 f.Get := GetComboBox;
2505 f.Set := SetComboBox;
2506 f.GetName := GetComboName;
2510 PROCEDURE (c: ComboBox) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2512 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2515 PROCEDURE (c: ComboBox) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
2516 VAR focus: Views.View);
2518 WITH f: StdCFrames.ComboBox DO
2519 IF ~c.disabled & ~c.readOnly THEN
2520 WITH msg: Controllers.PollOpsMsg DO
2521 msg.selectable := TRUE;
2522 (* should ask Frame if there is a selection for cut or copy! *)
2523 msg.valid := {Controllers.pasteChar, Controllers.cut, Controllers.copy, Controllers.paste}
2524 | msg: Controllers.TickMsg DO
2526 | msg: Controllers.EditMsg DO
2527 IF msg.op = Controllers.pasteChar THEN
2530 f.Edit(msg.op, msg.view, msg.w, msg.h, msg.isSingle, msg.clipboard)
2532 | msg: Controllers.SelectMsg DO
2533 IF msg.set THEN f.Select(0, MAX(INTEGER))
2534 ELSE f.Select(-1, -1)
2536 | msg: Controllers.MarkMsg DO
2537 f.Mark(msg.show, msg.focus);
2538 IF msg.show & msg.focus THEN f.Select(0, MAX(INTEGER)) END
2539 | msg: Controllers.TrackMsg DO
2540 f.MouseDown(msg.x, msg.y, msg.modifiers)
2542 CatchCtrlMsg(c, f, msg, focus)
2548 PROCEDURE (c: ComboBox) HandlePropMsg2 (VAR msg: Properties.Message);
2550 WITH msg: Properties.ControlPref DO
2551 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
2552 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) THEN msg.getFocus := TRUE END
2553 | msg: Properties.FocusPref DO
2554 IF ~c.disabled & ~c.readOnly THEN
2555 msg.setFocus := TRUE
2557 | msg: Properties.SizePref DO
2558 StdCFrames.dir.GetComboBoxSize(msg.w, msg.h)
2560 msg.valid := {link, label, guard, notifier, sorted}
2565 PROCEDURE (c: ComboBox) CheckLink (VAR ok: BOOLEAN);
2566 VAR name: Meta.Name;
2568 GetTypeName(c.item, name);
2569 ok := name = "Combo"
2572 PROCEDURE (c: ComboBox) Update (f: Views.Frame; op, from, to: INTEGER);
2574 f(StdCFrames.Frame).Update
2577 PROCEDURE (c: ComboBox) UpdateList (f: Views.Frame);
2579 f(StdCFrames.Frame).UpdateList
2585 PROCEDURE (c: Caption) Internalize2 (VAR rd: Stores.Reader);
2586 VAR thisVersion: INTEGER;
2588 rd.ReadVersion(minVersion, capVersion, thisVersion);
2589 IF thisVersion < 1 THEN c.prop.opt[left] := TRUE END
2592 PROCEDURE (c: Caption) Externalize2 (VAR wr: Stores.Writer);
2594 (* Save old version for captions that are compatible with the old version *)
2595 IF c.prop.opt[left] THEN wr.WriteVersion(0) ELSE wr.WriteVersion(capVersion) END
2598 PROCEDURE (c: Caption) GetNewFrame (VAR frame: Views.Frame);
2599 VAR f: StdCFrames.Caption;
2601 f := StdCFrames.dir.NewCaption();
2602 f.disabled := c.disabled;
2604 f.readOnly := c.readOnly;
2606 f.label := c.label$;
2607 f.left := c.prop.opt[left];
2608 f.right := c.prop.opt[right];
2612 PROCEDURE (c: Caption) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2614 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2617 PROCEDURE (c: Caption) HandlePropMsg2 (VAR msg: Properties.Message);
2619 WITH msg: Properties.SizePref DO
2620 StdCFrames.dir.GetCaptionSize(msg.w, msg.h)
2622 msg.valid := {link, label, guard, left, right}
2623 | msg: DefaultsPref DO
2624 IF c.prop.link = "" THEN msg.disabled := FALSE END
2629 PROCEDURE (c: Caption) Update (f: Views.Frame; op, from, to: INTEGER);
2631 f(StdCFrames.Caption).label := c.label$;
2632 f(StdCFrames.Frame).Update
2638 PROCEDURE (c: Group) Internalize2 (VAR rd: Stores.Reader);
2639 VAR thisVersion: INTEGER;
2641 rd.ReadVersion(minVersion, grpVersion, thisVersion)
2644 PROCEDURE (c: Group) Externalize2 (VAR wr: Stores.Writer);
2646 wr.WriteVersion(grpVersion)
2649 PROCEDURE (c: Group) GetNewFrame (VAR frame: Views.Frame);
2650 VAR f: StdCFrames.Group;
2652 f := StdCFrames.dir.NewGroup();
2653 f.disabled := c.disabled;
2655 f.readOnly := c.readOnly;
2657 f.label := c.label$;
2661 PROCEDURE (c: Group) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2663 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2666 PROCEDURE (c: Group) HandlePropMsg2 (VAR msg: Properties.Message);
2668 WITH msg: Properties.SizePref DO
2669 StdCFrames.dir.GetGroupSize(msg.w, msg.h)
2671 msg.valid := {link, label, guard}
2672 | msg: DefaultsPref DO
2673 IF c.prop.link = "" THEN msg.disabled := FALSE END
2678 PROCEDURE (c: Group) Update (f: Views.Frame; op, from, to: INTEGER);
2680 f(StdCFrames.Group).label := c.label$;
2681 f(StdCFrames.Frame).Update
2687 PROCEDURE (c: TreeControl) Internalize2 (VAR rd: Stores.Reader);
2688 VAR thisVersion: INTEGER;
2690 rd.ReadVersion(minVersion, tfVersion, thisVersion)
2693 PROCEDURE (c: TreeControl) Externalize2 (VAR wr: Stores.Writer);
2695 wr.WriteVersion(tfVersion)
2698 PROCEDURE TVNofNodesF (VAR rec, par: ANYREC);
2700 WITH par: TVParam DO
2701 WITH rec: Dialog.Tree DO par.l := rec.NofNodes()
2707 PROCEDURE TVNofNodes (f: StdCFrames.TreeFrame): INTEGER;
2708 VAR c: TreeControl; par: TVParam;
2710 c := f.view(TreeControl); par.l := 0;
2711 IF c.item.Valid() THEN c.item.CallWith(TVNofNodesF, par) END;
2715 PROCEDURE TVChildF (VAR rec, par: ANYREC);
2717 WITH par: TVParam DO
2718 WITH rec: Dialog.Tree DO par.nodeOut := rec.Child(par.nodeIn, Dialog.firstPos)
2719 ELSE par.nodeOut := NIL
2724 PROCEDURE TVChild (f: StdCFrames.TreeFrame; node: Dialog.TreeNode): Dialog.TreeNode;
2725 VAR c: TreeControl; par: TVParam;
2727 c := f.view(TreeControl); par.nodeIn := node; par.nodeOut := NIL;
2728 IF c.item.Valid() THEN c.item.CallWith(TVChildF, par) END;
2732 PROCEDURE TVParentF (VAR rec, par: ANYREC);
2734 WITH par: TVParam DO
2735 WITH rec: Dialog.Tree DO par.nodeOut := rec.Parent(par.nodeIn)
2736 ELSE par.nodeOut := NIL
2741 PROCEDURE TVParent (f: StdCFrames.TreeFrame; node: Dialog.TreeNode): Dialog.TreeNode;
2742 VAR c: TreeControl; par: TVParam;
2744 c := f.view(TreeControl); par.nodeIn := node; par.nodeOut := NIL;
2745 IF c.item.Valid() THEN c.item.CallWith(TVParentF, par) END;
2749 PROCEDURE TVNextF (VAR rec, par: ANYREC);
2751 WITH par: TVParam DO
2752 WITH rec: Dialog.Tree DO par.nodeOut := rec.Next(par.nodeIn)
2753 ELSE par.nodeOut := NIL
2758 PROCEDURE TVNext (f: StdCFrames.TreeFrame; node: Dialog.TreeNode): Dialog.TreeNode;
2759 VAR c: TreeControl; par: TVParam;
2761 c := f.view(TreeControl); par.nodeIn := node; par.nodeOut := NIL;
2762 IF c.item.Valid() THEN c.item.CallWith(TVNextF, par) END;
2766 PROCEDURE TVSelectF (VAR rec, par: ANYREC);
2768 WITH par: TVParam DO
2769 WITH rec: Dialog.Tree DO rec.Select(par.nodeIn) END
2773 PROCEDURE TVSelect (f: StdCFrames.TreeFrame; node: Dialog.TreeNode);
2774 VAR c: TreeControl; par: TVParam;
2776 c := f.view(TreeControl); par.nodeIn := node;
2777 IF c.item.Valid() THEN
2778 c.item.CallWith(TVSelectF, par);
2779 Notify(c, f, Dialog.changed, 0, 0)
2783 PROCEDURE TVSelectedF (VAR rec, par: ANYREC);
2785 WITH par: TVParam DO
2786 WITH rec: Dialog.Tree DO par.nodeOut := rec.Selected()
2787 ELSE par.nodeOut := NIL
2792 PROCEDURE TVSelected (f: StdCFrames.TreeFrame): Dialog.TreeNode;
2793 VAR c: TreeControl; par: TVParam;
2795 c := f.view(TreeControl); par.nodeOut := NIL;
2796 IF c.item.Valid() THEN c.item.CallWith(TVSelectedF, par) END;
2800 PROCEDURE TVSetExpansionF (VAR rec, par: ANYREC);
2802 WITH par: TVParam DO
2803 par.nodeIn.SetExpansion(par.e)
2805 END TVSetExpansionF;
2807 PROCEDURE TVSetExpansion (f: StdCFrames.TreeFrame; tn: Dialog.TreeNode; expanded: BOOLEAN);
2808 VAR c: TreeControl; par: TVParam;
2810 c := f.view(TreeControl); par.e := expanded; par.nodeIn := tn;
2811 IF c.item.Valid() THEN c.item.CallWith(TVSetExpansionF, par) END
2814 PROCEDURE (c: TreeControl) GetNewFrame (VAR frame: Views.Frame);
2815 VAR f: StdCFrames.TreeFrame;
2817 f := StdCFrames.dir.NewTreeFrame();
2818 f.disabled := c.disabled;
2820 f.readOnly := c.readOnly;
2822 f.sorted := c.prop.opt[sorted];
2823 f.haslines := c.prop.opt[haslines];
2824 f.hasbuttons := c.prop.opt[hasbuttons];
2825 f.atroot := c.prop.opt[atroot];
2826 f.foldericons := c.prop.opt[foldericons];
2827 f.NofNodes := TVNofNodes;
2829 f.Parent := TVParent;
2831 f.Select := TVSelect;
2832 f.Selected := TVSelected;
2833 f.SetExpansion := TVSetExpansion;
2837 PROCEDURE (c: TreeControl) UpdateList (f: Views.Frame);
2839 f(StdCFrames.Frame).UpdateList()
2842 PROCEDURE (c: TreeControl) Restore (f: Views.Frame; l, t, r, b: INTEGER);
2844 WITH f: StdCFrames.Frame DO f.Restore(l, t, r, b) END
2847 PROCEDURE (c: TreeControl) HandleCtrlMsg2 (f: Views.Frame; VAR msg: Controllers.Message;
2848 VAR focus: Views.View);
2850 WITH f: StdCFrames.TreeFrame DO
2851 IF ~c.disabled & ~c.readOnly THEN
2852 WITH msg: Controllers.EditMsg DO
2853 IF (msg.op = Controllers.pasteChar) THEN
2857 CatchCtrlMsg(c, f, msg, focus)
2859 ELSIF ~c.disabled THEN
2860 WITH msg: Controllers.TrackMsg DO
2861 f.MouseDown(msg.x, msg.y, msg.modifiers)
2868 PROCEDURE (c: TreeControl) HandlePropMsg2 (VAR msg: Properties.Message);
2870 WITH msg: Properties.ControlPref DO
2871 IF (msg.char = lineChar) OR (msg.char = esc) THEN msg.accepts := FALSE END;
2872 IF ~c.disabled & ~c.readOnly & IsShortcut(msg.char, c) OR msg.getFocus THEN
2873 msg.getFocus := StdCFrames.setFocus
2875 | msg: Properties.FocusPref DO
2876 IF ~c.disabled & ~c.readOnly THEN
2877 msg.setFocus := TRUE
2878 ELSIF~c.disabled THEN
2879 msg.hotFocus := TRUE
2881 | msg: Properties.SizePref DO
2882 StdCFrames.dir.GetTreeFrameSize(msg.w, msg.h)
2884 msg.valid := {link, label, guard, notifier, sorted, haslines, hasbuttons, atroot, foldericons}
2885 | msg: Properties.ResizePref DO
2886 msg.horFitToWin := TRUE; msg.verFitToWin := TRUE
2891 PROCEDURE (c: TreeControl) CheckLink (VAR ok: BOOLEAN);
2892 VAR name: Meta.Name;
2894 GetTypeName(c.item, name);
2898 PROCEDURE (c: TreeControl) Update (f: Views.Frame; op, from, to: INTEGER);
2900 f(StdCFrames.Frame).Update
2906 PROCEDURE (d: StdDirectory) NewPushButton (p: Prop): Control;
2909 NEW(c); OpenLink(c, p); RETURN c
2912 PROCEDURE (d: StdDirectory) NewCheckBox (p: Prop): Control;
2915 NEW(c); OpenLink(c, p); RETURN c
2918 PROCEDURE (d: StdDirectory) NewRadioButton (p: Prop): Control;
2921 NEW(c); OpenLink(c, p); RETURN c
2924 PROCEDURE (d: StdDirectory) NewField (p: Prop): Control;
2927 NEW(c); OpenLink(c, p); RETURN c
2930 PROCEDURE (d: StdDirectory) NewUpDownField (p: Prop): Control;
2933 NEW(c); OpenLink(c, p); RETURN c
2936 PROCEDURE (d: StdDirectory) NewDateField (p: Prop): Control;
2939 NEW(c); OpenLink(c, p); RETURN c
2942 PROCEDURE (d: StdDirectory) NewTimeField (p: Prop): Control;
2945 NEW(c); OpenLink(c, p); RETURN c
2948 PROCEDURE (d: StdDirectory) NewColorField (p: Prop): Control;
2951 NEW(c); OpenLink(c, p); RETURN c
2954 PROCEDURE (d: StdDirectory) NewListBox (p: Prop): Control;
2957 NEW(c); OpenLink(c, p); RETURN c
2960 PROCEDURE (d: StdDirectory) NewSelectionBox (p: Prop): Control;
2961 VAR c: SelectionBox;
2963 NEW(c); OpenLink(c, p); RETURN c
2964 END NewSelectionBox;
2966 PROCEDURE (d: StdDirectory) NewComboBox (p: Prop): Control;
2969 NEW(c); OpenLink(c, p); RETURN c
2972 PROCEDURE (d: StdDirectory) NewCaption (p: Prop): Control;
2975 NEW(c); OpenLink(c, p); RETURN c
2978 PROCEDURE (d: StdDirectory) NewGroup (p: Prop): Control;
2981 NEW(c); OpenLink(c, p); RETURN c
2984 PROCEDURE (d: StdDirectory) NewTreeControl (p: Prop): Control;
2987 NEW(c); OpenLink(c, p); RETURN c
2990 PROCEDURE SetDir* (d: Directory);
2992 ASSERT(d # NIL, 20); dir := d
2995 PROCEDURE InitProp (VAR p: Prop);
2998 p.link := ""; p.label := ""; p.guard := ""; p.notifier := "";
3000 p.opt[0] := FALSE; p.opt[1] := FALSE;
3001 p.opt[2] := FALSE; p.opt[3] := FALSE;
3005 PROCEDURE DepositPushButton*;
3009 p.label := "#System:untitled";
3010 Views.Deposit(dir.NewPushButton(p))
3011 END DepositPushButton;
3013 PROCEDURE DepositCheckBox*;
3017 p.label := "#System:untitled";
3018 Views.Deposit(dir.NewCheckBox(p))
3019 END DepositCheckBox;
3021 PROCEDURE DepositRadioButton*;
3025 p.label := "#System:untitled";
3026 Views.Deposit(dir.NewRadioButton(p))
3027 END DepositRadioButton;
3029 PROCEDURE DepositField*;
3032 InitProp(p); p.opt[left] := TRUE;
3033 Views.Deposit(dir.NewField(p))
3036 PROCEDURE DepositUpDownField*;
3040 Views.Deposit(dir.NewUpDownField(p))
3041 END DepositUpDownField;
3043 PROCEDURE DepositDateField*;
3047 Views.Deposit(dir.NewDateField(p))
3048 END DepositDateField;
3050 PROCEDURE DepositTimeField*;
3054 Views.Deposit(dir.NewTimeField(p))
3055 END DepositTimeField;
3057 PROCEDURE DepositColorField*;
3061 Views.Deposit(dir.NewColorField(p))
3062 END DepositColorField;
3064 PROCEDURE DepositListBox*;
3068 Views.Deposit(dir.NewListBox(p))
3071 PROCEDURE DepositSelectionBox*;
3075 Views.Deposit(dir.NewSelectionBox(p))
3076 END DepositSelectionBox;
3078 PROCEDURE DepositComboBox*;
3082 Views.Deposit(dir.NewComboBox(p))
3083 END DepositComboBox;
3085 PROCEDURE DepositCancelButton*;
3089 p.link := "StdCmds.CloseDialog"; p.label := "#System:Cancel"; p.opt[cancel] := TRUE;
3090 Views.Deposit(dir.NewPushButton(p))
3091 END DepositCancelButton;
3093 PROCEDURE DepositCaption*;
3096 InitProp(p); p.opt[left] := TRUE;
3097 p.label := "#System:Caption";
3098 Views.Deposit(dir.NewCaption(p))
3101 PROCEDURE DepositGroup*;
3105 p.label := "#System:Caption";
3106 Views.Deposit(dir.NewGroup(p))
3109 PROCEDURE DepositTreeControl*;
3113 p.opt[haslines] := TRUE; p.opt[hasbuttons] := TRUE; p.opt[atroot] := TRUE; p.opt[foldericons] := TRUE;
3114 Views.Deposit(dir.NewTreeControl(p))
3115 END DepositTreeControl;
3118 VAR msg: UpdateCachesMsg;
3126 VAR d: StdDirectory;
3128 par := NIL; stamp := 0;
3129 NEW(d); stdDir := d; dir := d;
3130 NEW(cleaner); cleanerInstalled := 0
3134 (* check guards action *)
3136 PROCEDURE (a: Action) Do;
3137 VAR msg: Views.NotifyMsg;
3139 IF Windows.dir # NIL THEN
3142 msg.id0 := 0; msg.id1 := 0; msg.opts := {guardCheck};
3143 IF a.w.seq # NIL THEN a.w.seq.Handle(msg) END;
3144 a.w := Windows.dir.Next(a.w);
3145 WHILE (a.w # NIL) & a.w.sub DO a.w := Windows.dir.Next(a.w) END
3147 IF a.cnt = 0 THEN a.resolution := Services.resolution
3148 ELSE a.resolution := Services.resolution DIV a.cnt DIV 2
3151 a.w := Windows.dir.First();
3152 WHILE (a.w # NIL) & a.w.sub DO a.w := Windows.dir.Next(a.w) END
3155 Services.DoLater(a, Services.Ticks() + a.resolution)
3160 NEW(action); action.w := NIL; action.cnt := 0; Services.DoLater(action, Services.now)
3162 Services.RemoveAction(action)