/** \fn GalleryView::MenuMain() * \brief Shows the main menu when the MENU button was pressed * \return void */ void GalleryView::MenuMain() { // Create the main menu that // will contain the submenus above MythMenu *menu = new MythMenu(tr("Image Options"), this, "mainmenu"); // Depending on the status of the sync show either the // start sync or stop sync. The user can decide if he // wants to stop the sync before leaving the main screen. if (!m_syncStatusThread->isSyncRunning()) menu->AddItem(tr("Start Syncronization"), SLOT(ConfirmStartSync())); else menu->AddItem(tr("Stop Syncronization"), SLOT(ConfirmStopSync())); // Add the available submenus to the main menu. The methods will // check if the requirements for showing the menu item is fulfilled MenuMetadata(menu); MenuSelection(menu); MenuFile(menu); menu->AddItem(tr("Settings"), SLOT(MenuSettings())); m_menuPopup = new MythDialogBox(menu, m_popupStack, "menuPopup"); if (!m_menuPopup->Create()) { delete m_menuPopup; m_menuPopup = NULL; return; } m_popupStack->AddScreen(m_menuPopup); }
int main( int argc, char *argv[] ) { event_pollmask mask; if ( argc > 1 && !stricmp(argv[1],"-iconbar") ) iconbar = TRUE; mask.value = 0; mask.data.null = 1; wimpinit(); while (!quitapp) { if (ackpending) mask.data.null = 0; else mask.data.null = 1; Wimp_Poll(mask,&e); switch (e.type) { case event_NULL: if (ackpending) { ackpending = FALSE; _kernel_oscli("delete <Wimp$Scrap>"); Error_Report2( 0, "Data transfer failed - receiver died" ); } break; case event_OPEN: Wimp_OpenWindow( &e.data.openblock ); break; case event_CLOSE: if ( e.data.openblock.window == wh && !iconbar ) quitapp = TRUE; else if ( e.data.openblock.window == palh ) palette_open = FALSE; else if ( e.data.openblock.window == spropth ) spropt_open = FALSE; Wimp_CloseWindow( e.data.openblock.window ); break; case event_KEY: if ( e.data.key.caret.window == wh && e.data.key.caret.icon == igicon_SAVENAME && e.data.key.code == 13 ) SaveFile( savename ); else if ( e.data.key.caret.window == wCFSI && e.data.key.code == 13 ) { GetCFSIData(); Wimp_CloseWindow( wCFSI ); cfsi_open = FALSE; } else Wimp_ProcessKey( e.data.key.code ); break; case event_BUTTON: WimpButton(); break; case event_MENU: MenuSelection( e.data.selection ); break; case event_USERDRAG: if (draggingfile) { mouse_block mb; DragASprite_Stop(); draggingfile = FALSE; Wimp_GetPointerInfo( &mb ); e.type = event_SEND; e.data.message.header.action = message_DATASAVE; e.data.message.header.yourref = 0; e.data.message.header.size = 256; e.data.message.data.datasave.window = mb.window; e.data.message.data.datasave.icon = mb.icon; e.data.message.data.datasave.pos = mb.pos; e.data.message.data.datasave.estsize = 0; e.data.message.data.datasave.filetype = 0x695; strcpy( e.data.message.data.datasave.leafname, Leaf( savename ) ); Wimp_SendMessage( event_SEND, &e.data.message, (message_destinee) mb.window, mb.icon ); } break; case event_SEND: case event_SENDWANTACK: switch (e.data.message.header.action) { case message_DATASAVEACK: SaveFile( e.data.message.data.datasaveack.filename ); break; case message_DATALOAD: if ( e.data.message.data.dataload.filetype == 0xFED && e.data.message.data.dataload.window == palh ) { LoadPalette( e.data.message.data.dataload.filename ); } else if ( e.data.message.data.dataload.filetype == 0xFF9 || e.data.message.data.dataload.filetype == 0xC2A || e.data.message.data.dataload.filetype == 0x695 || e.data.message.data.dataload.filetype == 0xAFF || cfsi ) { if ( e.data.message.data.dataload.window < 0 ) OpenMainWindow(); LoadFile( e.data.message.data.dataload.filename, e.data.message.data.dataload.filetype ); } break; case message_DATALOADACK: ackpending = FALSE; break; case message_QUIT: quitapp=TRUE; break; } break; } } Wimp_CloseDown(me); return 0; }
//------------------------------------------------------------------------------ // Main Program //------------------------------------------------------------------------------ int main() { // Table dimensions variables int iRow, iColumn; // Get dimensions while(1) { system("cls"); // Clear Screen printf("Give array dimensions.\nRows:"); scanf("%d", &iRow); printf("Columns:"); scanf("%d", &iColumn); if ((iRow > 1 && iRow <= MAX_ROW) && (iColumn > 1 && iColumn <= MAX_COLUMN)) break; } // Create the array int** iArray = Allocate_2D_Array(iRow, iColumn); // Create list's head pointer struct node* pHead = NULL; // Create list's tail pointer struct node* pTail = NULL; // Create the first node which contains the array's dimensions // pHead now points to that node if (! AddNode(&pHead, iRow, iColumn, 0)) exit(1); // Get array values int i, j; for (i = 0; i < iRow; i++) { for (j = 0; j < iColumn; j++) { printf("Give the [%d][%d] element:", i, j); scanf("%d", &iArray[i][j]); // If not a zero value then add node if (iArray[i][j] != 0) { // Locate the tail node and store its address in pTail LocateTail(pHead, &pTail); // Add new node after the last node (tail node) if (! AddNode(&pTail->m_pNext, i, j, iArray[i][j])) exit(1); } } printf("\n"); } // Show msg printf("Single Linked List created successfully\n\n"); int quit = FALSE; while (quit == FALSE) { printf("Press any key to continue..."); getch(); switch(MenuSelection()) { case 1: { DisplayArray(iArray, iRow, iColumn); break; } case 2: { DisplayList(pHead); break; } case 3: { int** iArrayTwo = Allocate_2D_Array(pHead->m_iX_Pos, pHead->m_iY_Pos); for (i = 0; i < pHead->m_iX_Pos; i++) for (j = 0; j < pHead->m_iY_Pos; j++) iArrayTwo[i][j] = 0; struct node* pCurrent = pHead; while (pCurrent != NULL) { if (pCurrent->m_iData != 0) iArrayTwo[pCurrent->m_iX_Pos][pCurrent->m_iY_Pos] = pCurrent->m_iData; pCurrent = pCurrent->m_pNext; } printf("New Array created successfully: \n\n"); DisplayArray(iArrayTwo, pHead->m_iX_Pos, pHead->m_iY_Pos); printf("\nThe program will now exit\n\n"); DeleteDynArray(iArrayTwo, pHead->m_iX_Pos); quit = TRUE; break; } case 4: { quit = TRUE; break; } } } // Free dynamic allocated memory - 2D Arrays + List DeleteDynArray(iArray, iRow); DeleteList(pHead); system("pause"); return 0; }