//////////////////////////////////////////////////////////////// TEditorClient ------------- Check that the number of selected objects is between min and max. If min==0, no minimum number If max==0, no maximum number
| 3157 | // If min==0, no minimum number |
| 3158 | // If max==0, no maximum number |
| 3159 | BOOL TEditorClient::CheckSelection (SHORT min, SHORT max) |
| 3160 | { |
| 3161 | BOOL rc = TRUE; |
| 3162 | SHORT count = 0; |
| 3163 | |
| 3164 | // Select CurObject is no selection |
| 3165 | SetupSelection (TRUE); |
| 3166 | |
| 3167 | // Count selected objects |
| 3168 | for (SelPtr cur = Selected ; cur != NULL ; cur = cur->next) |
| 3169 | count ++; |
| 3170 | |
| 3171 | // Must select an EXACT number of objects |
| 3172 | if ( min >= 1 && min == max && count != min ) |
| 3173 | { |
| 3174 | Beep(); |
| 3175 | Notify ("You must select exactly %d %s !", |
| 3176 | min, |
| 3177 | min == 1 ? GetObjectTypeName (EditMode) : |
| 3178 | GetObjectsTypeName (EditMode)); |
| 3179 | rc = FALSE; |
| 3180 | } |
| 3181 | // Must select a MINIMUM number of objects |
| 3182 | else if ( min >= 1 && count < min ) |
| 3183 | { |
| 3184 | Beep(); |
| 3185 | Notify ("You must select at least %d %s !", |
| 3186 | min, |
| 3187 | min == 1 ? GetObjectTypeName (EditMode) : |
| 3188 | GetObjectsTypeName (EditMode)); |
| 3189 | rc = FALSE; |
| 3190 | } |
| 3191 | // Must select less than a MAXIMUM number of objects |
| 3192 | else if ( max >= 1 && count > max ) |
| 3193 | { |
| 3194 | Beep(); |
| 3195 | Notify ("You must select LESS than %d %s !", |
| 3196 | min, |
| 3197 | min == 1 ? GetObjectTypeName (EditMode) : |
| 3198 | GetObjectsTypeName (EditMode)); |
| 3199 | rc = FALSE; |
| 3200 | } |
| 3201 | |
| 3202 | // Restore selection |
| 3203 | if ( rc == FALSE ) |
| 3204 | SetupSelection (FALSE); |
| 3205 | |
| 3206 | return rc; |
| 3207 | } |
| 3208 | |
| 3209 | |
| 3210 | ///////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected