Changeset 241 for trunk/hiptop
- Timestamp:
- 07/08/06 22:29:07 (18 years ago)
- Location:
- trunk/hiptop/pester
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hiptop/pester/locale/en_US/Pester.rsrc
r240 r241 67 67 menu ID_PERIOD_UNITS_MENU 68 68 menuItem 69 id = ID_PERIOD_SECONDS 69 70 title = "second(s)" 70 id = 1 71 event = EVENT_PERIOD_UNIT 72 eventData = 1 71 73 menuItem 74 id = ID_PERIOD_MINUTES 72 75 title = "minute(s)" 73 id = 60 76 event = EVENT_PERIOD_UNIT 77 eventData = 60 74 78 menuItem 79 id = ID_PERIOD_HOURS 75 80 title = "hour(s)" 76 id = 3600 81 event = EVENT_PERIOD_UNIT 82 eventData = 3600 77 83 endMenu 78 84 -
trunk/hiptop/pester/net/sabi/pester/Alarm.java
r240 r241 19 19 20 20 // transient 21 private int mStat us;21 private int mState; 22 22 23 23 public Alarm() { 24 mStat us = STATUS_INVALID;24 mState = STATE_INVALID; 25 25 } 26 26 … … 91 91 92 92 void beginEditing() { 93 mStat us = STATUS_EDITING;93 mState = STATE_EDITING; 94 94 } 95 95 96 96 void endEditing() { 97 mStat us = STATUS_SCHEDULED;97 mState = STATE_SCHEDULED; 98 98 DEBUG.p("schedule alarm: " + mMessage); 99 99 switch (mType) { … … 115 115 public static final int TYPE_DATE = 2; 116 116 117 public static final int STAT US_INVALID = 0;118 public static final int STAT US_EDITING = 1;119 public static final int STAT US_SCHEDULED = 2;120 public static final int STAT US_EXPIRED = 3;117 public static final int STATE_INVALID = 0; 118 public static final int STATE_EDITING = 1; 119 public static final int STATE_SCHEDULED = 2; 120 public static final int STATE_EXPIRED = 3; 121 121 } -
trunk/hiptop/pester/net/sabi/pester/AlarmListView.java
r240 r241 10 10 import danger.ui.DatePicker; 11 11 import danger.ui.DialogWindow; 12 import danger.ui.Menu; 13 import danger.ui.MenuItem; 12 14 import danger.ui.NumberEditor; 13 15 import danger.ui.PopupMenu; … … 31 33 private RadioButton sInButton, sAtButton; 32 34 private NumberEditor sPeriodField; 35 private Menu sPeriodUnitsMenu; 33 36 private PopupMenu sPeriodUnitsPopup; 34 37 private CheckBox sRepeatCheckBox; … … 54 57 sAtButton = (RadioButton)sEditWindow.getDescendantWithID(ID_AT_BUTTON); 55 58 sPeriodField = (NumberEditor)sEditWindow.getDescendantWithID(ID_PERIOD_FIELD); 59 sPeriodUnitsMenu = (Menu)sEditWindow.getDescendantWithID(ID_PERIOD_UNITS_MENU); 56 60 sPeriodUnitsPopup = (PopupMenu)sEditWindow.getDescendantWithID(ID_PERIOD_UNITS_POPUP); 57 61 sRepeatCheckBox = (CheckBox)sEditWindow.getDescendantWithID(ID_PERIOD_REPEAT_CHECKBOX); … … 81 85 if (usesPeriod) { 82 86 int period = alarm.getPeriod(); 83 int unitsPerSec = 1;84 DEBUG.p("period is " + period);85 87 for (int i = sPeriodUnitsPopup.itemCount() - 1 ; i >= 0 ; --i) { 86 unitsPerSec = 87 sPeriodUnitsPopup.getIDOfItem(sPeriodUnitsPopup.getItem(i)); 88 DEBUG.p("unitsPerSec = " + unitsPerSec); 89 if (period % unitsPerSec == 0) break; 90 } 91 sPeriodField.setValue(period / unitsPerSec); 92 sPeriodUnitsPopup.setValueWithItemID(unitsPerSec); 88 MenuItem item = sPeriodUnitsPopup.getItem(i); 89 int unitsPerSec = item.getEvent().data; 90 if (period % unitsPerSec == 0) { 91 sPeriodUnitsPopup.setValueWithItemID(sPeriodUnitsMenu.getIDOfItem(item)); 92 sPeriodField.setValue(period / unitsPerSec); 93 break; 94 } 95 } 93 96 sRepeatCheckBox.setValue(alarm.getRepeating() ? 1 : 0); 94 97 } … … 139 142 sEditingAlarm.setMessage(sMessageField.toString()); 140 143 if (sInButton.getValue() == 1) { 141 DEBUG.p("period: " + sPeriodField.getValue());142 DEBUG.p(" units: " + sPeriodUnitsPopup.getValueAsItemID());143 sEditingAlarm.setPeriod(sPeriodField.getValue() *144 sPeriodUnitsPopup.getValueAsItemID(),144 int itemID = sPeriodUnitsPopup.getValueAsItemID(); 145 MenuItem itemWithID = sPeriodUnitsMenu.getItemWithID(itemID); 146 Event event = itemWithID.getEvent(); 147 sEditingAlarm.setPeriod(sPeriodField.getValue() * event.data, 145 148 sRepeatCheckBox.getValue() == 1); 146 149 } else { … … 150 153 sAlarmList.addItem(sEditingAlarm); 151 154 setFocusedItem(sEditingAlarm); 155 sFocusedAlarm = sEditingAlarm; // XXX do we need this? 152 156 } else { 153 157 sEditingAlarm.update(); 154 158 } 155 159 case EVENT_CANCEL_ALARM: 156 // XXX (re)schedule alarm 157 sEditingAlarm.endEditing(); 160 if (sEditingAlarm == sFocusedAlarm) { // existing alarm 161 // XXX (re)schedule alarm 162 sEditingAlarm.endEditing(); 163 } 164 sEditingAlarm = null; 158 165 return true; 159 166 case EVENT_DISCARD_ALARM:
Note:
See TracChangeset
for help on using the changeset viewer.