Beispiel #1
0
void MVFileDialog::handleEvent(MVEvent& event,phaseType phase)
/****************************************************************************
*
* Function:		MVFileDialog::handleEvent
* Parameters:	event	- Event to handle
*				phase	- Current phase for the event (pre,focus,post)
*
* Description:	Event handling routine for the MVFileDialog class. Attempts
*				to end the modal operation if the open or save buttons
*				are hit.
*
****************************************************************************/
{
	MVDialog::handleEvent(event,phase);

	switch (event.what) {
		case evCommand:
			switch (event.message.command) {
				case cmFileOpen:
				case cmFileSave:
					endModal(event.message.command);
					clearEvent(event);
					break;
				case cmHelp:
					MV_messageBox(dc,"Help not implemented yet",
						mfInformation | mfOKButton | mfOKDefault);
					clearEvent(event);
					break;
				}
			break;
		case evBroadcast:
			switch (event.message.command) {
				case cmListCursorChanged:
					if (event.message.infoPtr == fileList) {
						updateFileLine();
						clearEvent(event);
						}
					break;
				case cmListItemSelected:
					if (event.message.infoPtr == fileList) {
						endModal((flags & fdOpenButton) ?
							cmFileOpen : cmFileSave);
						clearEvent(event);
						}
					else if (event.message.infoPtr == directoryList) {
						changeDirectory();
						clearEvent(event);
						}
					break;
				}
			break;
		}
}
Beispiel #2
0
void TProgram::handleEvent( TEvent& event )
{
    if( event.what == evKeyDown )
        {
        char c = getAltChar( event.keyDown.keyCode );
        if( c >= '1' && c <= '9' )
            {
//  Bug Fix #TV2B-39 --------------------------------------
            if(canMoveFocus())      //<--- Check valid first.
            {
                if( message(deskTop, evBroadcast, cmSelectWindowNum,
                  (void *)(c - '0')) != 0 )
                    clearEvent( event );
            }
            else
                clearEvent( event );
            }
//  end of bug-fix ----------------------------------------
        }

    TGroup::handleEvent( event );
    if( event.what == evCommand && event.message.command == cmQuit )
        {
        endModal( cmQuit );
        clearEvent( event );
        }
}
Beispiel #3
0
void PluginProcessProxy::didClose(IPC::Connection*)
{
#if PLATFORM(MAC)
    if (m_modalWindowIsShowing)
        endModal();

    if (m_fullscreenWindowIsShowing)
        exitFullscreen();
#endif

    const Vector<WebContext*>& contexts = WebContext::allContexts();
    for (size_t i = 0; i < contexts.size(); ++i)
        contexts[i]->sendToAllProcesses(Messages::PluginProcessConnectionManager::PluginProcessCrashed(m_pluginProcessToken));

    // This will cause us to be deleted.
    pluginProcessCrashedOrFailedToLaunch();
}
void TDialog::handleEvent(TEvent& event)
{
    TWindow::handleEvent(event);
    switch (event.what)
        {
        case evKeyDown:
            switch (event.keyDown.keyCode)
                {
                case kbEsc:
                    event.what = evCommand;
                    event.message.command = cmCancel;
                    event.message.infoPtr = 0;
                    putEvent(event);
                    clearEvent(event);
                    break;
                case kbEnter:
                    event.what = evBroadcast;
                    event.message.command = cmDefault;
                    event.message.infoPtr = 0;
                    putEvent(event);
                    clearEvent(event);
                    break;
                }
            break;

        case evCommand:
            switch( event.message.command )
                {
                case cmOK:
                case cmCancel:
                case cmYes:
                case cmNo:
                    if( (state & sfModal) != 0 )
                        {
                        endModal(event.message.command);
                        clearEvent(event);
                        }
                    break;
                }
            break;
        }
}
void TLdrBootDialog::handleEvent( TEvent& event) {
   TDialog::handleEvent(event);
   if (event.what==evCommand) {
      switch (event.message.command)  {
         case cmSelectKernelDialog: 
            endModal(event.message.command);
            clearEvent(event);
            break;
         case cmLaunchLdr: {
            char *ldr = getstr(bf_name);
            if (ldr&&*ldr) {
               opts_loadldr(ldr);
               messageBox("\x03""Failed!",mfError+mfOKButton);
            }
            clearEvent(event);
            break;
         }
      }
   }
}
Beispiel #6
0
void TProgram::handleEvent( TEvent& event )
{
    if( event.what == evKeyDown )
        {
        char c = getAltChar( event.keyDown.keyCode );
        if( c >= '1' && c <= '9' )
            {
            if( message( deskTop,
                         evBroadcast,
                         cmSelectWindowNum,
                         (void *)(c - '0')
                       ) != 0 )
                clearEvent( event );
            }
        }

    TGroup::handleEvent( event );
    if( event.what == evCommand && event.message.command == cmQuit )
        {
        endModal( cmQuit );
        clearEvent( event );
        }
}
Beispiel #7
0
void MVFileDialog::loadFilenames()
/****************************************************************************
*
* Function:		MVFileDialog::loadFilenames
*
* Description:	Loads the dialog box with all the filenames in the
*				current directory.
*
****************************************************************************/
{
	char	buf[PM_MAX_PATH];
	uint	j;
	int		i;
	ibool 	subDir = (strlen(directory) != 1) && !isrootdirectory(filename);

	if (flags & fdDirLoaded)	// Don't reload if already loaded
		return;

	filenames.empty();			// Empty filename and directory collections
	directories.empty();

	// Load all of the filenames for the current directory

	if (!loadfiles(filename,filenames))
		goto memError;
#ifdef	__UNIX__
	PM_makepath(buf,(char*)driveSel->getText(),directory,"*",NULL);
#else
	PM_makepath(buf,(char*)driveSel->getText(),directory,"*",".*");
#endif
	if (!loaddirectories(buf,directories))
    	goto memError;

	// Sort all of the filenames and directories, and insert the data
	// into the appropriate list boxes.

	filenames.sort();
	directories.sort();

	fileList->setDataBounds(MVRect(0,0,1,filenames.numberOfItems()));
	for (j = 0; j < filenames.numberOfItems(); j++)
		fileList->setCell(0,j,*filenames[j]);
	fileList->setHRange(0,0);
	i = filenames.numberOfItems()-1;
	fileList->setVRange(0,MAX(0,i));

	directoryList->setDataBounds(MVRect(0,0,1,directories.numberOfItems()+subDir));
	if (subDir)
		directoryList->setCell(0,0,"..");
	for (j = 0; j < directories.numberOfItems(); j++)
		directoryList->setCell(0,j+subDir,*directories[j]);
	directoryList->setHRange(0,0);
	directoryList->setVRange(0,directories.numberOfItems()-1+subDir);

	fileList->clearSelection();
	fileList->selectCell(0,0);
	fileList->setCurrentCell(0,0);
	directoryList->clearSelection();
	directoryList->selectCell(0,0);
	directoryList->setCurrentCell(0,0);

	// Update the file and directory lists

	fileList->update();
	directoryList->update();

	flags |= fdDirLoaded;		// Flag that directory is now loaded
	return;

memError:
	// Flag that a memory error occurred when loading filenames

	filenames.empty();
	directories.empty();
	MV_messageBox(dc,tooManyFilesText,mfError | mfOKButton | mfOKDefault);
	endModal(cmCancel);
}