// Text of project Thumbnail written on 11/25/95 at 3:55 PM
// Beginning of file EditView Thumbnail.t

// Before Script for "remoteApp"
/*
**      Newton Developer Technical Support Sample Code
**
**      Thumbnail-1, Shows how to use clRemoteView with a "live" clEditView
**
**      by Bob Ebert, Newton Developer Technical Support
**
**      Copyright © 1995 by Apple Computer, Inc.  All rights reserved.
**
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/

remoteApp :=
    {title: "EditView Thumbnail",
     viewBounds: {top: 0, left: 0, right: 240, bottom: 320},
     viewFlags: 134217733,
     viewFormat: nil,
     declareSelf: 'base,
     viewSetupFormScript:
       func()
       begin
       	local b := GetAppParams();
       	constant kMaxWidth := 240;
       	constant kMaxHeight := 336;
       	self.viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
       		MIN(b.appAreaWidth, kMaxWidth), MIN(b.appAreaHeight, kMaxHeight));
       end,
     debug: "remoteApp",
     viewClass: 74
    };

theEditView :=
    {viewFlags: 33553953,
     viewFormat: 8529,
     viewBounds: {top: 16, left: 8, right: -8, bottom: -24},
     viewLineSpacing: 28,
     viewChangedScript:
       func(slot, view)
       if call kViewIsOpenFunc with (theFloater) then
       	begin
       		// this may be overkill, some changes may not
       		// cause changes in the children, or could be
       		// handled by theFloater.theRemoteView:Dirty(),
       		// but performance doesn't seem bad, so why bother?
       		theFloater.theRemoteView:Close();
       		theFloater.theRemoteView:Open();
       	end,
     viewDropChildScript:
       func(oldOne)
       begin
       	AddDeferredAction(func(v) v:viewChangedScript('viewChildren, v), [self]);
       	nil;
       end,
     viewAddChildScript:
       func(newOne)
       begin
       	AddDeferredAction(func(v) v:viewChangedScript('viewChildren, v), [self]);
       	nil;
       end,
     viewJustify: 240,
     debug: "theEditView",
     viewClass: 77
    };
AddStepForm(remoteApp, theEditView);
StepDeclare(remoteApp, theEditView, 'theEditView);



theFloater :=
    {viewBounds: {top: -118, left: -62, right: -7, bottom: -32},
     viewClickScript:
       func(unit)
       begin
       	:Drag(unit, :Parent():GlobalBox());
       	theRemoteView:Close();
       	theRemoteView:Open();
       end,
     viewFlags: 609,
     viewJustify: 160,
     debug: "theFloater",
     _proto: @180
    };
AddStepForm(remoteApp, theFloater);
StepDeclare(remoteApp, theFloater, 'theFloater);

theRemoteView :=
    {viewBounds: {left: 1, top: 1, right: 57, bottom: 71},
     viewFlags: 49,
     viewFormat: nil,
     viewSetupChildrenScript:
       func()
       begin
       	local box := theEditView:LocalBox();
       	self.viewChildren := [
       		{	// wrapper layer 2
       			viewClass: clView,
       			viewBounds: box,
       			viewFlags: vVisible,
       			viewChildren: [
       				{	// wrapper layer 1
       					viewClass: clView,
       					viewBounds: box,
       					viewFlags: vVisible,
       					viewChildren: [
       						{	// this is the "real" container for the edit view stuff
       							viewClass: clView,
       							viewBounds: box,
       							viewFlags: vVisible,
       							viewFormat: theEditView.viewFormat,
       							viewLineSpacing: theEditView.viewLineSpacing,
       							viewChildren: theEditView.viewChildren,	// OK because remote view is read only
       						}
       					]
       				}
       			]
       		}
       	];
       end,
     viewJustify: 0,
     debug: "theRemoteView",
     viewClass: 88
    };
AddStepForm(theFloater, theRemoteView);
StepDeclare(theFloater, theRemoteView, 'theRemoteView);





_view000 := {_proto: @229};
AddStepForm(remoteApp, _view000);



_view001 := {_proto: @220};
AddStepForm(remoteApp, _view001);

_view002 := {_proto: @163};
AddStepForm(_view001, _view002);



_view003 :=
    {
     buttonClickScript:
       func()
       	theFloater:Toggle();,
     text: "Thumbnail",
     viewBounds: {top: 0, left: -69, right: -7, bottom: 13},
     viewJustify: 8390662,
     _proto: @226
    };
AddStepForm(_view001, _view003);



_view004 := {_proto: @234};
AddStepForm(_view001, _view004);






constant |layout_EditView Thumbnail.t| := remoteApp;
// End of file EditView Thumbnail.t



