* Creates a new window * https://stackoverflow.com/questions/5887615/creating-an-array-of-object-pointers-c */
| 341 | * https://stackoverflow.com/questions/5887615/creating-an-array-of-object-pointers-c |
| 342 | */ |
| 343 | int CsvApplication::createNewWindow() { |
| 344 | int newWindowIndex = -1; |
| 345 | |
| 346 | // Look for an unused window slot |
| 347 | for(int slot = 0; slot < TCRUNCHER_MAX_WINDOWS; ++slot) { |
| 348 | if( !windows[slot].getWindowSlotUsed() ) { |
| 349 | newWindowIndex = slot; |
| 350 | break; |
| 351 | } |
| 352 | } |
| 353 | if( newWindowIndex == -1 ) { |
| 354 | #ifdef DEBUG |
| 355 | dumpWindows(); |
| 356 | #endif |
| 357 | CsvApplication::myFlChoice("", "Maximum number of windows already open.", {"Okay"}); |
| 358 | return -1; |
| 359 | } |
| 360 | windows[newWindowIndex].create(createdWindowCount++); |
| 361 | updateMenu(newWindowIndex); |
| 362 | #ifdef __APPLE__ |
| 363 | remainOpenWin->hide(); |
| 364 | #endif |
| 365 | // setMenuBar(windows[newWindowIndex].win); |
| 366 | windows[newWindowIndex].win->show(); |
| 367 | return newWindowIndex; |
| 368 | } |
| 369 | |
| 370 | |
| 371 | size_t CsvApplication::getCreatedWindowCount() { |
no test coverage detected