• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Installation Manager Tool


コミットメタ情報

リビジョンeac14c5e252cbb3bf27a85c625258016e28a191a (tree)
日時2012-12-06 21:41:38
作者Keith Marshall <keithmarshall@user...>
コミッターKeith Marshall

ログメッセージ

Implement enhanced action item enumeration capability.

変更サマリ

差分

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
1+2012-12-06 Keith Marshall <keithmarshall@users.sourceforge.net>
2+
3+ Implement enhanced action item enumeration capability.
4+
5+ * src/pkgbase.h (pkgActionItem::EnumeratePendingActions): New public
6+ method; declare it. It provides the capability to enumerate scheduled
7+ actions, filtered by action classification; when invoked such that it
8+ selects all actions, it may be used as a replacement for...
9+ (pkgActionItem::Unapplied): ...this; delete declaration.
10+
11+ * src/pkgdata.cpp (pkgActionItem::EnumeratePendingActions): Implement
12+ it; it is derived, with enhancement, from original implementation...
13+ (pkgActionItem::Unapplied): ...of this; delete it, and...
14+ (AppWindowMaker::OnClose): ...update calling reference accordingly.
15+
116 2012-12-05 Keith Marshall <keithmarshall@users.sourceforge.net>
217
318 Implement PTY display emulation for GUI mode DMH.
--- a/src/pkgbase.h
+++ b/src/pkgbase.h
@@ -302,9 +302,10 @@ class pkgActionItem
302302 inline unsigned long CancelScheduledAction( void );
303303 inline void SetPrimary( pkgActionItem* );
304304
305- /* Method to check for residual unapplied changes.
305+ /* Method to enumerate and identify pending changes,
306+ * and/or check for residual unapplied changes.
306307 */
307- inline unsigned long Unapplied( void );
308+ unsigned long EnumeratePendingActions( int = 0 );
308309
309310 /* Methods for defining the selection criteria for
310311 * packages to be processed.
--- a/src/pkgdata.cpp
+++ b/src/pkgdata.cpp
@@ -1165,7 +1165,7 @@ long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
11651165 return EXIT_SUCCESS;
11661166 }
11671167
1168-inline unsigned long pkgActionItem::Unapplied( void )
1168+unsigned long pkgActionItem::EnumeratePendingActions( int classified )
11691169 {
11701170 /* Helper method to count the pending actions in a
11711171 * scheduled action list.
@@ -1173,33 +1173,64 @@ inline unsigned long pkgActionItem::Unapplied( void )
11731173 unsigned long count = 0;
11741174 if( this != NULL )
11751175 {
1176- /* Assuming that the initial 'this' pointer is closer
1177- * to the end of the list, than to the beginning...
1176+ /* Regardless of the position of the 'this' pointer,
1177+ * within the list of scheduled actions...
11781178 */
11791179 pkgActionItem *item = this;
1180- while( item->next != NULL )
1180+ while( item->prev != NULL )
11811181 /*
1182- * ...advance, to ensure we have located the very
1183- * last item in the schedule.
1182+ * ...we want to get a reference to the first
1183+ * item in the list.
11841184 */
1185- item = item->next;
1185+ item = item->prev;
11861186
1187- /* Now, working back from end to beginning...
1187+ /* Now, working through the list...
11881188 */
11891189 while( item != NULL )
11901190 {
11911191 /* ...note items with any scheduled action...
11921192 */
1193- if( item->flags & ACTION_MASK )
1194- /*
1195- * ...and count them...
1193+ int action;
1194+ if( (action = item->flags & ACTION_MASK) != 0 )
1195+ {
1196+ /* ...and, when one is found...
11961197 */
1197- ++count;
1198-
1199- /* ...then move on, to consider the preceding
1200- * entry, if any.
1198+ if( action == classified )
1199+ {
1200+ /* ...and it matches the classification in which
1201+ * we are interested, then we retrieve the tarname
1202+ * for the related package...
1203+ */
1204+ pkgXmlNode *selected = (classified & ACTION_REMOVE)
1205+ ? item->Selection( to_remove )
1206+ : item->Selection();
1207+ const char *notification = (selected != NULL)
1208+ ? selected->GetPropVal( tarname_key, NULL )
1209+ : NULL;
1210+ if( notification != NULL )
1211+ {
1212+ /* ...and, provided it is valid, we append it to
1213+ * the DMH driven dialogue in which the enumeration
1214+ * is being reported...
1215+ */
1216+ dmh_printf( "%s\n", notification );
1217+ /*
1218+ * ...and include it in the accumulated count...
1219+ */
1220+ ++count;
1221+ }
1222+ }
1223+ else if( classified == 0 )
1224+ /*
1225+ * ...otherwise, when we aren't interested in any
1226+ * particular class of action, just count all those
1227+ * which are found, regardless of classification.
1228+ */
1229+ ++count;
1230+ }
1231+ /* ...then move on, to consider the next entry, if any.
12011232 */
1202- item = item->prev;
1233+ item = item->next;
12031234 }
12041235 }
12051236 /* Ultimately, return the count of pending actions,
@@ -1215,7 +1246,7 @@ long AppWindowMaker::OnClose()
12151246 * option for the termination request, so that the user
12161247 * has an opportunity to complete such actions.
12171248 */
1218- if( (pkgData->Schedule()->Unapplied() > 0)
1249+ if( (pkgData->Schedule()->EnumeratePendingActions() > 0)
12191250 && (MessageBox( AppWindow,
12201251 "You have marked changes which have not been applied;\n"
12211252 "these will be lost, if you quit without applying them.\n\n"