home *** CD-ROM | disk | FTP | other *** search
- -- 2000.03.06
- -- Clive Green <clivegreen@atlas.co.uk>
-
- ------------------------------------------------------------------------------------------------------
-
- -- this displays a text feedback message string in a miaw (if the miaw file is available).
-
- ------------------------------------------------------------------------------------------------------
-
- -- declare properties:
- property main -- main code directory object
- property miawFileName -- the director movie file name to open
- property miaw -- a reference to the Director MIAW entity
- property miawLeft,miawTop -- the onscreen position of the miaw
- property miawShown -- flags whether the miaw is visible or not
-
- ------------------------------------------------------------------------------------------------------
-
- on new me,L
-
- -- (1) extract and check arguments:
-
- -- check for a parameter list:
- if ilk(L) <> #propList then return [#error:#noParamListSupplied, #msg:"feedbackService:new"]
-
- -- a reference to the parent codebase is REQUIRED:
- main = L[#main]
- if (ilk(main) <> #instance) then return [#error:#noMainObjectSupplied, #msg:"feedbackService:new"]
-
- --------------------
-
- -- (2) store my miaw's position data:
-
- -- what is the top-left corner of my miaw?
- miawLeft = the stageLeft
- miawTop = the stageBottom + 10
-
- --------------------
-
- -- (3) obtain my miaw's filepath:
-
- -- obtain the filePath of the miaw we want:
- dm = main.getDataManager()
- dL = dm.getData([#set:#filePaths, #item:#feedBackWin])
- f = dL[#filePath]
-
- -- parse filepath for the current platform:
- um = main.getUtilityMethods()
- f = um.parseFilePath(f)
-
- -- prefix the filePath with the root directory path:
- r = dm.getRootPath()
-
- -- finally - store the compiled filePath:
- miawFileName = (r & f)
-
- --------------------
-
- -- (4) check that the miaw file actually exists:
-
- xm = main.getXtrasManager()
- buddy = xm.getBuddyAPIxtra()
-
- if (ilk(buddy) <> #instance) then return ¬
- [#error:#xtraControllerMissing, #msg:"feedbackService:openFeedback needs buddyAPIxtra"]
-
- -- determine miaw file's existence:
- f = buddy.fileExists(miawFileName)
-
- -- clear invalidated filePath as needed:
- if not stringP(f) then miawFileName = 0
-
- --------------------
-
- -- flag miaw is initially 'invisible':
- miawShown = 0
-
- --------------------
-
- -- pass back my address:
- return me
-
- ----------------------------------------------------------------------------------------------------
-
- on openFeedback me
-
- -- first check that the required file exists:
- if miawFileName = 0 then return 0
-
- -- special keypress required for feedback:
- if not(the SHIFTDOWN) then return 0
-
- --------------------
-
- -- reference the miaw movie:
- miaw = window(miawFileName)
-
- -- position window area, and open:
- r = miaw.rect
- w = r[3]-r[1]
- h = r[4]-r[2]
-
- r = rect(miawLeft,miawTop,miawLeft + w,miawTop + h)
- miaw.rect = r
-
- --------------------
-
- -- we'll use a windowType with no titleBar:
- miaw.windowType = 2
- open miaw
-
- -- flag miaw is now 'visible':
- miawShown = 1
-
- -- :
- me.feedbackMsg("READY")
-
- ----------------------------------------------------------------------------------------------------
-
- on clearFeedback me
-
- -- clean up and close window as neeeded:
- if not(miawShown) then return 0
-
- close miaw
- forget miaw
-
- -- flag miaw is 'invisible':
- miawShown = 0
-
- ----------------------------------------------------------------------------------------------------
-
- on feedbackMsg me,s
-
- -- pass the feedback message string to the miaw if possible:
- if not(miawShown) then return 0
-
- tell miaw to displayFeedback(s)
-
- ----------------------------------------------------------------------------------------------------