Example #1
0
bool MainApp::perform (const InvocationInfo& info)
{
  switch (info.commandID)
  {
  case cmdSettings:
    {
      SettingsWindow* w = new SettingsWindow;
      w->setVisible (true);
    }
    return true;

  case cmdAbout:
    {
      AlertWindow::showMessageBox (AlertWindow::InfoIcon,
        TRANS("About"),
        TRANS(
          "DSP Filters Demo\n"
          "by Vinnie Falco,\n"
          "One Guy Group, Inc.\n"
          "Copyright(C) 2010\nAll Rights Reserved Worldwide."),
        TRANS("OK"),
        m_mainWindow);
    }
    return true;
  };

  return JUCEApplication::perform (info);
}
Example #2
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // This is a hack to prevent some OS to pause executing the program when the window is not visible
    a.setQuitOnLastWindowClosed(false);

    // The settings window allows the user to control the program
    SettingsWindow window;
    window.show();

    // The Screen Analyzer class outputs a single color based on the image displayed on the screen
    ScreenAnalyzer analyzer;

    // LEDOS Talker communicates color from the Screen Analyzer to LEDOS
    LEDOSTalker talker;

    // Whenever the user "starts" the program, start the analysis thread
    QObject::connect( &window, SIGNAL(start()), &analyzer, SLOT(start()) );

    // And stop it when the user doesn't need it anymore
    QObject::connect( &window, SIGNAL(stop()), &analyzer, SLOT(stop()) );

    // Close the program when the window is closed
    QObject::connect( &window, SIGNAL(quit()), &a, SLOT(quit()) );

    // When a serial port is selected, update it in the LEDOS Talker instance
    QObject::connect( &window, SIGNAL(serial(QString)), &talker, SLOT(serial(QString)) );

    // Every time a color is ready to be sent pass it to the LEDOS Talker
    QObject::connect( &analyzer, SIGNAL(color(QColor)), &talker, SLOT(color(QColor)) );

    return a.exec();
}
Example #3
0
void
CronoView::MessageReceived(BMessage *message)
{
	switch(message->what)
	{
		case MSG_CLOSE:
		{
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		}

		case MSG_ABOUT:
		{
			AboutRequested();
			break;
		}

		case MSG_HOMEPAGE:
		{
			const char* homepage = CRONO_HOMEPAGE_URL;
			be_roster->Launch("text/html",1, const_cast<char**>(&homepage));
			break;
		}

		case MSG_HELP:
		{
			const char* guide = CRONO_USERGUIDE_URL;
			be_roster->Launch("text/html",1, const_cast<char**>(&guide));
			break;
		}

		case MSG_SETTINGS:
		{
			BRect windowRect(150,150,460,445);
			SettingsWindow *settWindow = new SettingsWindow(windowRect, fCore);
			settWindow->Show();
			break;
		}

		case MSG_START:
		{
			status_t ret = fCore->Start();
			if (ret != B_OK) {
				BString str("\nError starting Crono :\n");
				str << strerror(ret);
				BAlert *alert = new BAlert("Error", 
					str.String(),
					"OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_EVEN_SPACING,
					B_INFO_ALERT);
					alert->Go();
				break;
			}
			fStartButton->SetEnabled(false);
			fStopButton->SetEnabled(true);
			fStopButton->MakeDefault(true);
			fEditMenu->FindItem(MSG_SETTINGS)->SetEnabled(false);
			fFileMenu->FindItem(MSG_START)->SetEnabled(false);
			fFileMenu->FindItem(MSG_STOP)->SetEnabled(true);
			break;
		}

		case MSG_STOP:
		{
			fCore->Stop();
			fStopButton->SetEnabled(false);
			fStartButton->SetEnabled(true);
			fStartButton->MakeDefault(true);
			fEditMenu->FindItem(MSG_SETTINGS)->SetEnabled(true);
			fFileMenu->FindItem(MSG_START)->SetEnabled(true);
			fFileMenu->FindItem(MSG_STOP)->SetEnabled(false);
			break;
		}

		case MSG_VOLUME:
		{
			float position = fVolumeSlider->Position();
			fCore->SetVolume(position);
			fVolumeSlider->SetLabel(BString() << position);
			break;
		}

		case MSG_METER_RADIO:
		{
			int selected = _GetCurrentMeter();

			// If "Other" is selected, enable the fTempoEntry
			if (fTempoRadios[4]->Value() == true) {
				fTempoEntry->SetEnabled(true);
			} else {
				fTempoEntry->SetEnabled(false);
			}
			fCore->SetMeter(selected);

			if (gCronoSettings.AccentTable)
				_SetAccentCheckBox(selected);
			break;
		}

		case MSG_METER_ENTRY:
		{
			int position = abs(atoi(fTempoEntry->Text()));
			if (position < 1) {
				fTempoEntry->SetText("1");
				position = 1;
				return;
			} else if (position > 100) {
				fTempoEntry->SetText("100");
				position = 100;		
			}

			fCore->SetMeter(position);
			_SetAccentCheckBox(position);
			break;
		}

		case MSG_SPEED_ENTRY:
		{
			unsigned bpm = abs(atoi(fSpeedEntry->Text()));

			if (bpm > MAX_SPEED) {
				fSpeedEntry->SetText(BString() << MAX_SPEED);
				bpm = MAX_SPEED;
			} else if (bpm < MIN_SPEED) {
				fSpeedEntry->SetText(BString() << MIN_SPEED);
				bpm = MIN_SPEED;
			}

			fCore->SetSpeed(((int) bpm));
			fSpeedSlider->SetPosition(((float) bpm / MAX_SPEED));
			printf("Crono Speed: %s %d\n", fSpeedEntry->Text(), bpm);
			_UpdateTempoName(bpm);
			break;
		}

		case MSG_SPEED_SLIDER:
		{
			int v = fSpeedSlider->Value();

			BString str;
			fSpeedEntry->SetText(str << v);
			fCore->SetSpeed(v);
			_UpdateTempoName(v);
			break;
		}

		case MSG_ACCENT_TABLE:
		{
			bool marked = !fAccentTableItem->IsMarked();
			gCronoSettings.AccentTable = marked;

			_ShowTable(marked);
			break;
		}

		default:
			BView::MessageReceived(message);
	}
}
Example #4
0
File: main.cpp Project: PyroOS/Pyro
void BrowserWindow::HandleMessage( Message * pcMsg )
{
	BrowserWebView *pcWebView = GetCurrentWebView();

	switch( pcMsg->GetCode() )
	{
		case ID_URL_CHANGED:
		{
			bool bFinal = false;
			pcMsg->FindBool( "final", &bFinal );

			if( bFinal )
			{
				String cURL = "";
				int nSelection = -1;
				if( pcMsg->FindInt32( "selection", &nSelection ) == EOK )
					cURL = m_pcUrlEdit->GetItem( nSelection );
				else
				{
					cURL = m_pcUrlEdit->GetCurrentString();
					m_pcUrlEdit->AppendItem( cURL );
				}

				OpenURL( cURL );
			}
			break;
		}
		case ID_SET_STATUS_BAR_TEXT:
		{
			String cText;
			if( pcMsg->FindString( "text", &cText ) == EOK )
				m_pcStatusBar->SetText( "text", cText );
			break;
		}
		case ID_CLEAR_STATUS_BAR_TEXT:
		{
			m_pcStatusBar->SetText( "text", "" );
			break;
		}
		case ID_CREATE_WINDOW:
		{
			BrowserWindow *pcWindow;
			String cURL;
			Rect cFrame;

			/* Use the supplied dimensions if they've been provided, otherwise
			   clone the current Window */
			if( pcMsg->FindRect( "frame", &cFrame ) != EOK )
				cFrame = GetFrame();

			pcWindow = new BrowserWindow( cFrame );

			if( pcMsg->FindString( "url", &cURL ) == EOK )
				pcWindow->OpenURL( cURL );

			pcWindow->Show();
			pcWindow->MakeFocus();

			/* Tell BrowserApp about the new window */
			Application::GetInstance()->PostMessage( ID_WINDOW_OPENED );

			if( pcMsg->IsSourceWaiting() )
			{
				WebCore::Page *pcPage;
				View *pcTab;

				/* The new window will only have one tab at this stage so it's safe to always get tab #0 */
				pcTab = pcWindow->m_pcTabView->GetTabView( 0 );
				pcPage = static_cast<BrowserWebView*>( pcTab )->GetWebCoreFrame()->page();

				Message cReply( ID_CREATE_WINDOW_REPLY );
				cReply.AddPointer( "page", pcPage );

				pcMsg->SendReply( &cReply );
			}

			break;
		}
		case ID_CREATE_TAB:
		{
			String cURL;
			if( pcMsg->FindString( "url", &cURL ) == EOK )
			{
				uint nTabIndex;

				nTabIndex = CreateTab( cURL );

				if( pcMsg->IsSourceWaiting() )
				{
					WebCore::Page *pcPage;
					View *pcTab;

					pcTab = m_pcTabView->GetTabView( nTabIndex );
					pcPage = static_cast<BrowserWebView*>( pcTab )->GetWebCoreFrame()->page();

					Message cReply( ID_CREATE_WINDOW_REPLY );
					cReply.AddPointer( "page", pcPage );

					pcMsg->SendReply( &cReply );
				}
			}

			break;
		}
		case ID_BUTTON_BACK:
		{
			pcWebView->GoBack();

			UpdateButtonState( false );
			break;
		}
		case ID_BUTTON_FORWARD:
		{
			pcWebView->GoForward();

			UpdateButtonState( false );
			break;
		}
		case ID_BUTTON_RELOAD:
		{
			pcWebView->Reload();
			break;
		}
		case ID_BUTTON_STOP:
		{
			pcWebView->Stop();

			UpdateButtonState( false );
			break;
		}
		case ID_BUTTON_HOME:
		{
			OpenURL( m_pcSettings->GetString( "homepage", "about:blank" ) );
			break;
		}
		case ID_MENU_APP_ABOUT:
		{
			Alert* pcAbout = new Alert( "About Webster",
										"Webster " WEBSTER_VERSION " (Alpha)\nA WebCore based web browser\n\n© Copyright Kristian Van Der Vliet, 2008\nArno Klenke, 2004-2007\nKurt Skauen, 2001\n"
										"\nWebster is released under the Gnu Public License (GPL)\n",
										Alert::ALERT_INFO, 0x00, "Ok", NULL );
			pcAbout->Go( NULL );

			break;
		}
		case ID_MENU_WIN_NEW_TAB:
		{
			CreateTab( "" );
			break;
		}
		case ID_MENU_WIN_CLOSE_TAB:
		{
			DestroyTab( m_pcTabView->GetSelection() );
			break;
		}
		case ID_MENU_EDIT_CUT:
		{
			pcWebView->Cut();
			break;
		}
		case ID_MENU_EDIT_COPY:
		{
			pcWebView->Copy();
			break;
		}
		case ID_MENU_EDIT_PASTE:
		{
			pcWebView->Paste();
			break;
		}
		case ID_MENU_EDIT_DELETE:
		{
			pcWebView->Delete();
			break;
		}
		case ID_MENU_SETTINGS_CONFIGURE:
		{
			Rect cSettingsFrame = m_pcGuiSettings->GetRect( "settings", m_cSettingsFrame );
			SettingsWindow *pcSettingsWindow = new SettingsWindow( cSettingsFrame, "Webster settings", this, m_pcWebSettings, m_pcSettings, m_pcGuiSettings );
			pcSettingsWindow->Show();
			pcSettingsWindow->MakeFocus();

			break;
		}
		case ID_SETTINGS_SAVE:
		{
			Settings *pcSettings;
			if( pcMsg->FindPointer( "settings", (void**)&pcSettings ) == EOK )
			{
				delete m_pcSettings;
				m_pcSettings = pcSettings;

				m_pcSettings->Save();
			}

			WebSettings *pcWebSettings;
			if( pcMsg->FindPointer( "web_settings", (void**)&pcWebSettings ) == EOK )
			{
				delete m_pcWebSettings;
				m_pcWebSettings = pcWebSettings;
			}

			break;
		}
		case ID_SETTINGS_APPLY:
		{
			Settings *pcSettings;
			if( pcMsg->FindPointer( "settings", (void**)&pcSettings ) == EOK )
			{
				delete m_pcSettings;
				m_pcSettings = pcSettings;
			}

			WebSettings *pcWebSettings;
			if( pcMsg->FindPointer( "web_settings", (void**)&pcWebSettings ) == EOK )
			{
				delete m_pcWebSettings;
				m_pcWebSettings = pcWebSettings;
			}

			break;
		}
		case ID_MENU_BOOKMARKS_ADD:
		{
			String cShortTitle, cLongTitle, cURL;

			pcWebView->GetTitle( cShortTitle, cLongTitle );
			cURL = pcWebView->GetCurrentURL();

			m_pcBookmarksManager->AddBookmark( cLongTitle, cURL );

			break;
		}
		case ID_MENU_BOOKMARKS_MANAGE:
		{
			String cPath;
			if( pcMsg->FindString( "path", &cPath ) != EOK )
				break;

			/* XXXKV: This is a really rubbish way to manage bookmarks: we should have
			   a proper in-application dialog to do it */

			/* Open a filebrowser window */
			if( fork() == 0 )
			{
				set_thread_priority( -1, 0 );
				execlp( "/system/bin/FileBrowser", "/system/bin/FileBrowser", cPath.c_str(), NULL );
			}
			break;
		}
		case ID_BOOKMARK_GO:
		{
			String cURL;

			if( pcMsg->FindString( "url", &cURL ) == EOK )
				OpenURL( cURL );

			break;
		}
		case ID_TAB_CHANGED:
		{
			ChangeTab( m_pcTabView->GetSelection() );
			break;
		}
		case ID_WEBVIEW_SET_TITLE:
		{
			String cShortTitle, cLongTitle;
			uint nTabIndex;

			if( pcMsg->FindString( "short", &cShortTitle ) == EOK &&
				pcMsg->FindString( "long", &cLongTitle ) == EOK &&
				pcMsg->FindInt32( "index", (int32*)&nTabIndex ) == EOK )
			{
				m_pcTabView->SetTabTitle( nTabIndex, cShortTitle );

				/* If this is the currently selected tab, set the Window title to the full page title */
				if( nTabIndex == m_pcTabView->GetSelection() )
					SetTitle( cLongTitle );
			}

			break;
		}
		case ID_WEBVIEW_LOAD_STARTED:
		{
			String cURL;
			uint nTabIndex;

			if( pcMsg->FindString( "url", &cURL ) == EOK &&
				pcMsg->FindInt32( "index", (int32*)&nTabIndex ) == EOK )
			{
				if( nTabIndex == m_pcTabView->GetSelection() )
				{
					m_pcUrlEdit->SetCurrentString( cURL.c_str() );
					UpdateButtonState( true );
				}
			}
			break;
		}
		case ID_WEBVIEW_LOAD_FINISHED:
		{
			uint nTabIndex;
			if( pcMsg->FindInt32( "index", (int32*)&nTabIndex ) == EOK )
				if( nTabIndex == m_pcTabView->GetSelection() )
					UpdateButtonState( false );
			break;
		}
		default:
		{
			fprintf( stderr, "Unknown message with code #%d\n", pcMsg->GetCode() );
			Window::HandleMessage( pcMsg );
			break;
		}
	}
}
Example #5
0
void MainWindow::Settings()
{
    SettingsWindow * window = new SettingsWindow(this);
    window->show();
}
Example #6
0
void MainWindow::settingsWinShow()
{
  SettingsWindow *settingsWindow;
  settingsWindow = new SettingsWindow(this);
  settingsWindow->show();
}
Example #7
0
void PolycodeIDEApp::handleEvent(Event *event) {

	if(event->getDispatcher() == frame->fileDialog) {
		if(event->getEventCode() == UIEvent::OK_EVENT && event->getEventType() == "UIEvent") {
			String path = frame->fileDialog->getSelection();
			if(path != "") {
				PolycodeProject *project = projectManager->openProject(path);
				if(project) {
					projectManager->setActiveProject(project);
					OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
					openFile(projectEntry);			
				}
				
			}
		}
	}

	if(event->getDispatcher() == menuBar) {
		String action = menuBar->getSelectedItem();
	
		if(action == "new_file") {
			newFile();
		} else if(action == "new_project") {
			newProject();
		} else if(action == "new_folder") {
			newGroup();
		} else if(action == "open_project") {
			openProject();
		} else if(action == "close_project") {
			closeProject();
		} else if(action == "close_file") {
			closeFile();
		} else if(action == "remove_file") {
			removeFile();
		} else if(action == "refresh_project") {
			refreshProject();
		} else if(action == "save_file") {
			saveFile();
		} else if(action == "browse_examples") {
			browseExamples();
		} else if(action == "quit") {
			core->Shutdown();
		} else if(action == "run_project") {
			runProject();
		} else if(action == "export_project") {
			exportProject();
		} else if(action == "show_api") {
			openDocs();
		} else if(action == "show_about") {
			showAbout();
		} else if(action == "toggle_console") {
			toggleConsole();
		} else if(action == "settings") {
			showSettings();
		} else if(action == "find") {
			findText();
		}
	}

	if(event->getDispatcher() == frame->console->backtraceWindow) {
		if(event->getEventType() == "BackTraceEvent" && event->getEventCode() == BackTraceEvent::EVENT_BACKTRACE_SELECTED) {
			BackTraceEvent *btEvent = (BackTraceEvent*) event;
			openFileInProject(btEvent->project, btEvent->fileName);
			
			PolycodeEditor *editor = editorManager->getCurrentEditor();
			if(editor) {
				if(editor->getEditorType() == "PolycodeTextEditor") {
					PolycodeTextEditor *textEditor = (PolycodeTextEditor*) editor;
					textEditor->highlightLine(btEvent->lineNumber);
				}
				
			}	
		}
	}

	if(event->getDispatcher() == core) {
		switch(event->getEventCode()) {
			case Core::EVENT_LOST_FOCUS:
				core->setFramerate(3);
			break;		
			case Core::EVENT_GAINED_FOCUS:
				core->setFramerate(90);			
			break;					
			case Core::EVENT_CORE_RESIZE:
				if(menuBar) {
					frame->Resize(core->getXRes(), core->getYRes()-25);
					menuBar->Resize(core->getXRes(), 25);
				} else {
					frame->Resize(core->getXRes(), core->getYRes());
				}
			break;
		}
	}
	
	if(event->getDispatcher()  == frame->getProjectBrowser()) {
		
		if(event->getEventType() == "PolycodeProjectBrowserEvent") {
			switch(event->getEventCode()) {
				case PolycodeProjectBrowserEvent::HANDLE_MENU_COMMAND:
					PolycodeProjectBrowserEvent *bEvent = (PolycodeProjectBrowserEvent*) event;
					
					if(bEvent->command == "add_new_file") {					
						newFile();
					} else if(bEvent->command == "add_files") {
						addFiles();
					} else if(bEvent->command == "add_new_project") {
						newProject();
					} else if(bEvent->command == "add_new_folder") {				
						newGroup();
					} else if(bEvent->command == "refresh") {
						refreshProject();
					} else if(bEvent->command == "rename") {
						renameFile();
					} else if(bEvent->command == "remove") {
						removeFile();
					}																				
				break;
			}
		}
		
		if(event->getEventCode() == Event::CHANGE_EVENT) {
			PolycodeProjectBrowser *pb = frame->getProjectBrowser();
			BrowserUserData *selectedData = pb->getSelectedData();
						
			if(selectedData->type == 3) {
				projectManager->activeFolder = selectedData->parentProject->getRootFolder();
				projectManager->selectedFile = "";				
			} else if(selectedData->type == 0) {
				projectManager->activeFolder = "";
				projectManager->selectedFile = "";
			} else {
				projectManager->selectedFileEntry = selectedData->fileEntry;
				projectManager->selectedFile = selectedData->fileEntry.fullPath;
				if(selectedData->fileEntry.type == OSFileEntry::TYPE_FILE) {
					projectManager->activeFolder = selectedData->fileEntry.basePath;
				} else {
					projectManager->activeFolder = selectedData->fileEntry.fullPath;
				}			
			}
			
			projectManager->setActiveProject(selectedData->parentProject);
			
			if(selectedData->type == 0)
				return;			
			
			// don't open the editor if the selection was made by UITreeContainer arrow-key navigation
			if (selectedData && pb->treeContainer->getRootNode()->getSelectedNode()->isSelectedByKey() == false) {
				openFile(selectedData->fileEntry);
			}
		}
	}
	
	if(event->getDispatcher() == frame->playButton) {	
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
			willRunProject = true;
		}
	}

	if(event->getDispatcher() == frame->stopButton) {	
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
			stopProject();
		}
	}

	if(event->getDispatcher() == frame->yesNoCancelPopup) {
		if(frame->yesNoCancelPopup->action == "closeFile") {
			switch(event->getEventCode()) {
				case UIEvent::YES_EVENT:
				{
					PolycodeEditor *editor = editorManager->getCurrentEditor();
					if(editor) {
						editor->saveFile();
						closeFile();
					}
					frame->yesNoCancelPopup->action = "";
					frame->hideModal();					
				}
				break;
				case UIEvent::NO_EVENT:
				{
					PolycodeEditor *editor = editorManager->getCurrentEditor();
					if(editor) {
						editor->setHasChanges(false);
						closeFile();
					}
					frame->yesNoCancelPopup->action = "";					
					frame->hideModal();
				}
				break;
				case UIEvent::CANCEL_EVENT:
				break;
			}
		} else if(frame->yesNoCancelPopup->action == "closeQuitFile") {
			switch(event->getEventCode()) {
				case UIEvent::YES_EVENT:
				{
					PolycodeEditor *editor = editorManager->getCurrentEditor();
					if(editor) {
						editor->saveFile();
						closeFile();
					}
					frame->yesNoCancelPopup->action = "";
					frame->hideModal();
					if(quitApp()) {
						core->Shutdown();
					}
				}
				break;
				case UIEvent::NO_EVENT:
				{
					PolycodeEditor *editor = editorManager->getCurrentEditor();
					if(editor) {
						editor->setHasChanges(false);
						closeFile();
					}
					frame->yesNoCancelPopup->action = "";					
					frame->hideModal();
					if(quitApp()) {
						core->Shutdown();
					}					
				}
				break;
				case UIEvent::CANCEL_EVENT:
					quittingApp = false;
				break;
			}					
		} else if (frame->yesNoCancelPopup->action == "closeProject") {
			switch (event->getEventCode()) {
				case UIEvent::YES_EVENT:
					saveFiles(tempEditorStore);
					doCloseProject();
					break;
				case UIEvent::NO_EVENT:
					doCloseProject();
					break;
				case UIEvent::CANCEL_EVENT:
					break;
			}
			frame->yesNoCancelPopup->action = "";
			frame->hideModal();
		}
		
		else if (frame->yesNoCancelPopup->action == "closeFiles") {
			switch (event->getEventCode()) {
				case UIEvent::YES_EVENT:
					saveFiles(tempEditorStore);
					doCloseFiles(tempEditorStore);
					break;
				case UIEvent::NO_EVENT:
					doCloseFiles(tempEditorStore);
					break;
				case UIEvent::CANCEL_EVENT:
					break;
			}
			frame->yesNoCancelPopup->action = "";
			frame->hideModal();
		}
	} else if(event->getDispatcher() == frame->yesNoPopup) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CANCEL_EVENT) {
			if(frame->yesNoPopup->action == "saveAndRun") {
				runNextFrame = true;			
			}
			
			frame->hideModal();
			frame->yesNoPopup->action = "";		
		}
	
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
			if(frame->yesNoPopup->action == "removeFile") {
				doRemoveFile();
			}
			
			if(frame->yesNoPopup->action == "saveAndRun") {
				editorManager->saveFilesForProject(projectManager->getActiveProject());
				runNextFrame = true;
			}
			
			frame->hideModal();
			frame->yesNoPopup->action = "";
		}
	}
	
	if(event->getDispatcher() == frame->textInputPopup) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
						
			if(frame->textInputPopup->action == "newGroup") {	
				core->createFolder(projectManager->activeFolder+"/"+frame->textInputPopup->getValue());
				if(projectManager->getActiveProject()) {
					frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
				}			
			}
			
			if(frame->textInputPopup->action == "renameFile") {		
				core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());			
				if(projectManager->getActiveProject()) {
					frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
				}
				
				PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
				if(editor) {
					editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
				}
				
				projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
				projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();				
			}
			
			frame->hideModal();			
		}
	}	

	if(event->getDispatcher() == frame->settingsWindow) {
		if(event->getEventType() == "UIEvent") {
			Config *config = CoreServices::getInstance()->getConfig();
			SettingsWindow *settingsWindow = frame->settingsWindow;

			if(event->getEventCode() == UIEvent::OK_EVENT) {
				config->setStringValue("Polycode", "useExternalTextEditor", settingsWindow->useExternalTextEditorBox->isChecked() ? "true" : "false");
				config->setStringValue("Polycode", "externalTextEditorCommand", settingsWindow->externalTextEditorCommand->getText());
			
				frame->hideModal();
			}
			if(event->getEventCode() == UIEvent::CLOSE_EVENT) {
				settingsWindow->updateUI();
			}
		}
	}

	if(event->getDispatcher() == frame->exportProjectWindow) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
			projectManager->exportProject(projectManager->getActiveProject(), frame->exportProjectWindow->projectLocationInput->getText(), frame->exportProjectWindow->macCheckBox->isChecked(), frame->exportProjectWindow->winCheckBox->isChecked(), frame->exportProjectWindow->linCheckBox->isChecked(), frame->exportProjectWindow->compileCheckBox->isChecked());
			frame->hideModal();			
		}
	}

	
	if(event->getDispatcher() == frame->newProjectWindow) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
			projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());
			frame->hideModal();			
		}
	}

	if(event->getDispatcher() == frame->newFileWindow) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
			projectManager->createNewFile(frame->newFileWindow->getTemplatePath(), frame->newFileWindow->getFileName());
			frame->hideModal();			
			
			if(projectManager->getActiveProject()) {
				frame->projectBrowser->refreshProject(projectManager->getActiveProject());
			}			
		}
	}
	
	if(event->getDispatcher() == frame->exampleBrowserWindow) {
		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
			String fullPath = String(core->getDefaultWorkingDirectory()+"/"+frame->exampleBrowserWindow->getExamplePath());
			PolycodeProject* project = projectManager->openProject(fullPath);
			OSFileEntry projectEntry =	OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
			projectManager->setActiveProject(project);
			openFile(projectEntry);			
			
			frame->hideModal();			
		}
	}
	
	// close files and editors after the close file button is pressed
	if (event->getDispatcher() == frame->closeFileButton) {
		if (event->getEventCode() == UIEvent::CLICK_EVENT) {
			if (core->getInput()->getKeyState(KEY_RSHIFT) || core->getInput()->getKeyState(KEY_LSHIFT))
				closeFiles(editorManager->openEditors);
			else
				closeFile();
		}
	}
	
	// open an editor/file if project browser has focus and user hits enter or right-arrow key
	if (event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) {
		if (event->getEventCode() == InputEvent::EVENT_KEYDOWN && frame->getProjectBrowser()->treeContainer->hasFocus) {
			InputEvent *inEvent = (InputEvent*)event;
			if (inEvent->keyCode() == KEY_RETURN || inEvent->keyCode() == KEY_RIGHT) {
				BrowserUserData *selectedData = frame->getProjectBrowser()->getSelectedData();
				if (selectedData)
					openFile(selectedData->fileEntry);
			}
		}
	}
}