49
49
#define COLUMN_STATUS 2
50
50
#define COLUMN_CPUTIME 3
51
51
#define COLUMN_TOCOMPLETION 4
52
- #define COLUMN_ESTIMATEDCOMPLETION 5
53
- #define COLUMN_DEADLINEDIFF 6
54
- #define COLUMN_REPORTDEADLINE 7
55
- #define COLUMN_APPLICATION 8
56
- #define COLUMN_NAME 9
52
+ #define COLUMN_REPORTDEADLINE 5
53
+ #define COLUMN_APPLICATION 6
54
+ #define COLUMN_NAME 7
55
+ #define COLUMN_ESTIMATEDCOMPLETION 8
56
+ // #define COLUMN_DEADLINEDIFF 9
57
57
58
58
59
59
// DefaultShownColumns is an array containing the
@@ -198,9 +198,9 @@ static bool CompareViewWorkItems(int iRowIndex1, int iRowIndex2) {
198
198
result = 1 ;
199
199
}
200
200
break ;
201
- case COLUMN_DEADLINEDIFF:
201
+ // case COLUMN_DEADLINEDIFF:
202
202
// SOMETHING GOES IN HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
203
- break ;
203
+ // break;
204
204
}
205
205
206
206
// Always return FALSE for equality (result == 0)
@@ -282,10 +282,11 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
282
282
m_aStdColNameOrder->Insert (_ (" Status" ), COLUMN_STATUS);
283
283
m_aStdColNameOrder->Insert (_ (" Elapsed" ), COLUMN_CPUTIME);
284
284
m_aStdColNameOrder->Insert (_ (" Remaining (estimated)" ), COLUMN_TOCOMPLETION);
285
- m_aStdColNameOrder->Insert (_ (" Estimated Completion" ), COLUMN_ESTIMATEDCOMPLETION);
286
285
m_aStdColNameOrder->Insert (_ (" Deadline" ), COLUMN_REPORTDEADLINE);
287
286
m_aStdColNameOrder->Insert (_ (" Application" ), COLUMN_APPLICATION);
288
287
m_aStdColNameOrder->Insert (_ (" Name" ), COLUMN_NAME);
288
+ m_aStdColNameOrder->Insert (_ (" Estimated Completion" ), COLUMN_ESTIMATEDCOMPLETION);
289
+ // m_aStdColNameOrder->Insert(_("Completion Before Deadline"), COLUMN_DEADLINEDIFF);
289
290
290
291
// m_iStdColWidthOrder is an array of the width for each column.
291
292
// Entries must be in order of ascending Column ID. We initialize
@@ -299,10 +300,11 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
299
300
m_iStdColWidthOrder.Insert (135 , COLUMN_STATUS);
300
301
m_iStdColWidthOrder.Insert (80 , COLUMN_CPUTIME);
301
302
m_iStdColWidthOrder.Insert (100 , COLUMN_TOCOMPLETION);
302
- m_iStdColWidthOrder.Insert (150 , COLUMN_ESTIMATEDCOMPLETION);
303
303
m_iStdColWidthOrder.Insert (150 , COLUMN_REPORTDEADLINE);
304
304
m_iStdColWidthOrder.Insert (95 , COLUMN_APPLICATION);
305
305
m_iStdColWidthOrder.Insert (285 , COLUMN_NAME);
306
+ m_iStdColWidthOrder.Insert (150 , COLUMN_ESTIMATEDCOMPLETION);
307
+ // m_iStdColWidthOrder.Insert(150, COLUMN_DEADLINEDIFF);
306
308
307
309
wxASSERT (m_iStdColWidthOrder.size () == m_aStdColNameOrder->size ());
308
310
@@ -357,10 +359,10 @@ void CViewWork::AppendColumn(int columnID){
357
359
m_pListPane->AppendColumn ((*m_aStdColNameOrder)[COLUMN_ESTIMATEDCOMPLETION],
358
360
wxLIST_FORMAT_LEFT, m_iStdColWidthOrder[COLUMN_ESTIMATEDCOMPLETION]);
359
361
break ;
360
- case COLUMN_DEADLINEDIFF:
362
+ /* case COLUMN_DEADLINEDIFF:
361
363
m_pListPane->AppendColumn((*m_aStdColNameOrder)[COLUMN_DEADLINEDIFF],
362
364
wxLIST_FORMAT_LEFT, m_iStdColWidthOrder[COLUMN_DEADLINEDIFF]);
363
- break ;
365
+ break; */
364
366
}
365
367
}
366
368
@@ -783,30 +785,14 @@ wxString CViewWork::OnListGetItemText(long item, long column) const {
783
785
strBuffer = work->m_strStatus ;
784
786
break ;
785
787
case COLUMN_ESTIMATEDCOMPLETION:
786
- // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
787
- // Need to fix the following:
788
- // - replace "running"
789
- // - See how strBuffer should be addressed? Why is this not refereshing properly?
790
- if ((work->m_fCPUTime > 0 ) && (work->m_strStatus .Contains (" Running" ))) {
791
- wxDateTime now = wxDateTime::Now ();
792
- wxTimeSpan time_to_completion = convert_to_timespan (work->m_fTimeToCompletion );
793
- wxDateTime estimated_completion = now.Add (time_to_completion);
794
- FormatDateTime (estimated_completion.GetTicks (), strBuffer);
795
- // Only display the Estimated Completion time if the task has
796
- // been started and is currently running.
797
- } else {
798
- strBuffer = FormatTime (0 );
799
- // If the task has not started (CPUTime <= 0) or is not currently
800
- // running, pass 0 to FormatTime to display "---" as the Estimated
801
- // Completion time
802
- }
788
+ strBuffer = work->m_strEstimatedCompletion ;
803
789
break ;
804
- case COLUMN_DEADLINEDIFF:
790
+ // case COLUMN_DEADLINEDIFF:
805
791
// Fill out something here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
806
- break ;
792
+ // break;
807
793
}
808
794
}
809
-
795
+
810
796
return strBuffer;
811
797
}
812
798
@@ -1054,7 +1040,7 @@ void CViewWork::UpdateSelection() {
1054
1040
bool CViewWork::SynchronizeCacheItem (wxInt32 iRowIndex, wxInt32 iColumnIndex) {
1055
1041
wxString strDocumentText = wxEmptyString;
1056
1042
wxString strDocumentText2 = wxEmptyString;
1057
- double x = 0.0 ;
1043
+ double x = 0.0 ;
1058
1044
time_t tDocumentTime = (time_t )0 ;
1059
1045
CWork* work;
1060
1046
@@ -1063,9 +1049,9 @@ bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) {
1063
1049
if (GetWorkCacheAtIndex (work, m_iSortedIndexes[iRowIndex])) {
1064
1050
return false ;
1065
1051
}
1066
-
1052
+
1067
1053
if (iColumnIndex < 0 ) return false ;
1068
-
1054
+
1069
1055
switch (m_iColumnIndexToColumnID[iColumnIndex]) {
1070
1056
case COLUMN_PROJECT:
1071
1057
GetDocProjectName (m_iSortedIndexes[iRowIndex], strDocumentText);
@@ -1122,6 +1108,26 @@ bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) {
1122
1108
return true ;
1123
1109
}
1124
1110
break ;
1111
+ case COLUMN_ESTIMATEDCOMPLETION:
1112
+ // TODO: NEED TO ADD A WAY TO DISPLAY '---' if the date is the original date.
1113
+ // Also todo: Let's change all time_t pointers from 'time' to something else, like 'pt'.
1114
+ // Function to pass 0 (to read '---' is: strBuffer = FormatTime(0)
1115
+ // TODO: Figure out logic to be most efficient for this case.
1116
+ // - what happens if time returned in 0 (because task is not active)
1117
+ // - what happens if no change in time
1118
+ // -what happens if there is a change in time.
1119
+ GetDocEstCompletionDate (m_iSortedIndexes[iRowIndex], tDocumentTime);
1120
+ if (tDocumentTime != work->m_tEstimatedCompletion ) {
1121
+ work->m_tEstimatedCompletion = tDocumentTime;
1122
+ if (work->m_tEstimatedCompletion = 0 ) {
1123
+ work->m_strEstimatedCompletion << 0 ;
1124
+ }
1125
+ else {
1126
+ FormatDateTime (tDocumentTime, work->m_strEstimatedCompletion );
1127
+ }
1128
+ return true ;
1129
+ }
1130
+ break ;
1125
1131
case COLUMN_STATUS:
1126
1132
int i = m_iSortedIndexes[iRowIndex];
1127
1133
RESULT* result = wxGetApp ().GetDocument ()->result (i);
@@ -1283,6 +1289,41 @@ void CViewWork::GetDocReportDeadline(wxInt32 item, time_t& time) const {
1283
1289
}
1284
1290
}
1285
1291
1292
+ // Calculates the estimated date and time a task will be completed.
1293
+ // This is only calculated for active tasks. If a task is not active,
1294
+ // time pt will remain at zero. The intent is for the command calling this
1295
+ // function to use that value to display '---', not the epoch time.
1296
+ //
1297
+ void CViewWork::GetDocEstCompletionDate (wxInt32 item, time_t & pt) const {
1298
+ RESULT* result = wxGetApp ().GetDocument ()->result (item);
1299
+ pt = 0 ;
1300
+ if (result->active_task_state == 1 ) {
1301
+ time_t ttime = time (0 );
1302
+ pt = ttime;
1303
+ pt += (time_t )result->estimated_cpu_time_remaining ;
1304
+ }
1305
+
1306
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1307
+ // Figure out what "strBuffer" needs to be down below.
1308
+ // double check what passing variables need to be.
1309
+ // Add function to header
1310
+ /* RESULT* result = wxGetApp().GetDocument()->result(m_iSortedIndexes[item]);
1311
+ if ((work->m_fCPUTime > 0) && (result->active_task_state == 1)) {
1312
+ wxDateTime now = wxDateTime::Now();
1313
+ wxTimeSpan time_to_completion = convert_to_timespan(work->m_fTimeToCompletion);
1314
+ wxDateTime estimated_completion = now.Add(time_to_completion);
1315
+ FormatDateTime(estimated_completion.GetTicks(), strBuffer);
1316
+ // Only display the Estimated Completion time if the task has
1317
+ // been started and is currently running.
1318
+ }
1319
+ else {
1320
+ strBuffer = FormatTime(0);
1321
+ // If the task has not started (CPUTime <= 0) or is not currently
1322
+ // running, pass 0 to FormatTime to display "---" as the Estimated
1323
+ // Completion time
1324
+ }*/
1325
+ }
1326
+
1286
1327
1287
1328
wxInt32 CViewWork::FormatDateTime (time_t datetime, wxString& strBuffer) const {
1288
1329
#ifdef __WXMAC__
0 commit comments