Ignore:
Timestamp:
06/20/08 12:55:35 (16 years ago)
Author:
ra33
Message:

Made a whole lot of changes...

Including using polyLine etc for drawing rectangles nicer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameIO.java

    r104 r105  
    99import java.io.FileWriter;
    1010import java.io.IOException;
     11import java.sql.Time;
    1112import java.util.HashMap;
    1213
     
    629630         *
    630631         * @param toSave
    631          *            The Frame to save to disk in KMS format.
     632         *            The Frame to save to disk
    632633         */
    633634        public static String SaveFrame(Frame toSave) {
     
    645646         *
    646647         * @param toSave
    647          *            The Frame to save to disk in KMS format.
     648         *            The Frame to save to disk
    648649         * @param inc
    649650         *            True if the saved frames counter should be incremented, false
     
    655656                        boolean checkBackup) {
    656657
    657                 if (toSave == null)
     658                // TODO When loading a frame maybe append onto the event history too- with a
     659                // break to indicate the end of a session
     660
     661                if (toSave == null ||!toSave.hasChanged() || toSave.isSaved()){
     662                        SessionStats.NewFrameSession();
    658663                        return "";
    659 
    660                 if (!toSave.hasChanged() || toSave.isSaved())
    661                         return "";
    662 
     664                }
    663665                // Get the full path only to determine which format to use for saving
    664666                // the frame
     
    672674                                && toSave.getNameItem().Permission < Item.PERMISSION_TDFC) {
    673675                        _Cache.remove(toSave.getName().toLowerCase());
     676                        SessionStats.NewFrameSession();
    674677                        return "";
    675678                }
     
    694697                        }
    695698                        // Check if we are trying to save an out of date version
    696                         if (savedVersion > toSave.getVersion(false)
     699                        if (savedVersion > toSave.getVersion()
    697700                                        && !toSave.getFramesetName().equalsIgnoreCase(
    698701                                                        FrameGraphics.MESSAGES_FRAMESET_NAME)) {
     
    741744                                ResumeCache();
    742745                        }
    743                         toSave.setActiveTime(SessionStats.getFrameActiveTime());
    744                         toSave.setDarkTime(SessionStats.getFrameDarkTime());
     746                        // Update general stuff about frame
    745747                        toSave.setLastModifyDate(Logger.EasyDateFormat("ddMMMyyyy:HHmm"));
    746748                        toSave.setLastModifyUser(UserSettings.Username);
     749                        toSave.setVersion(toSave.getVersion() + 1);
     750                        Time darkTime = new Time(SessionStats.getFrameDarkTime().getTime()
     751                                        + toSave.getDarkTime().getTime());
     752                        Time activeTime = new Time(SessionStats.getFrameActiveTime()
     753                                        .getTime()
     754                                        + toSave.getActiveTime().getTime());
     755                        toSave.setDarkTime(darkTime);
     756                        toSave.setActiveTime(activeTime);
     757
    747758                        writer.writeFrame(toSave);
    748759                        toSave.setSaved();
    749                         if (inc)
     760                        if (inc) {
    750761                                SessionStats.SavedFrame(toSave.getName());
     762                        }
    751763
    752764                        // avoid out-of-sync frames (when in TwinFrames mode)
Note: See TracChangeset for help on using the changeset viewer.