Download Thesis

Transcript
Appendix C
235
# Add observers to the new model.
SLogger.addObserversToModel()
end
end
class SLogger
@@current_active_model = nil
def SLogger.getActiveModel
return @@current_active_model
end
def SLogger.addObserversToModel
@@current_active_model = Sketchup.active_model
@@tool_observer = MyToolsObserver.new
Sketchup.active_model.tools.add_observer(@@tool_observer)
@@entities_observer = MyEntitiesObserver.new
Sketchup.active_model.entities.add_observer(@@entities_observer)
@@model_observer = MyModelObserver.new
Sketchup.active_model.add_observer(@@model_observer)
end
end
app_observer = MyAppObserver.new
Sketchup.add_observer (app_observer)
SLogger.addObserversToModel
C.2 Detecting backtracking events in Adobe Photoshop
We instrumented Photoshop using its built-in “history log” function available from the
preferences menu. The history log records a list of commands executed by the user, storing
them in a user-specified text file. It is important to enable the history log in the
“EditPreferencesGeneral…” dialog box, and set the “Edit Log Items” to “Detailed”.
The resulting file will contain a list of commands executed, but it does not contain
any timestamp information. We wrote a Ruby program to monitor the Photoshop history
log text file, detecting when each line is added to the file. When a backtracking command is
added to the file, we attach a timestamp and output a line to a second log file. With