コード例 #1
0
ファイル: qglimagegpuwidget.cpp プロジェクト: mwerlberger/imp
//-----------------------------------------------------------------------------
void QGLImageGpuWidget::slotZoom0p5()
{
  setZoom(0.5f);
  emit zoomChanged(zoom_);
}
コード例 #2
0
void Camera::zoom(float dz)
{
	setZoom(m_zoom - CAM_ZOOM_SPEED * dz);
}
コード例 #3
0
bool JucerDocumentEditor::perform (const InvocationInfo& info)
{
    ComponentLayout* const currentLayout = getCurrentLayout();
    PaintRoutine* const currentPaintRoutine = getCurrentPaintRoutine();

    document->beginTransaction();

    if (info.commandID >= JucerCommandIDs::newComponentBase
         && info.commandID < JucerCommandIDs::newComponentBase + ObjectTypes::numComponentTypes)
    {
        addComponent (info.commandID - JucerCommandIDs::newComponentBase);
        return true;
    }

    if (info.commandID >= JucerCommandIDs::newElementBase
         && info.commandID < JucerCommandIDs::newElementBase + ObjectTypes::numElementTypes)
    {
        addElement (info.commandID - JucerCommandIDs::newElementBase);
        return true;
    }

    switch (info.commandID)
    {
        case StandardApplicationCommandIDs::undo:
            document->getUndoManager().undo();
            document->dispatchPendingMessages();
            break;

        case StandardApplicationCommandIDs::redo:
            document->getUndoManager().redo();
            document->dispatchPendingMessages();
            break;

        case JucerCommandIDs::test:
            TestComponent::showInDialogBox (*document);
            break;

        case JucerCommandIDs::enableSnapToGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       ! document->isSnapActive (false),
                                       document->isSnapShown());
            break;

        case JucerCommandIDs::showGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       document->isSnapActive (false),
                                       ! document->isSnapShown());
            break;

        case JucerCommandIDs::editCompLayout:
            showLayout();
            break;

        case JucerCommandIDs::editCompGraphics:
            showGraphics (0);
            break;

        case JucerCommandIDs::zoomIn:      setZoom (snapToIntegerZoom (getZoom() * 2.0)); break;
        case JucerCommandIDs::zoomOut:     setZoom (snapToIntegerZoom (getZoom() / 2.0)); break;
        case JucerCommandIDs::zoomNormal:  setZoom (1.0); break;

        case JucerCommandIDs::spaceBarDrag:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
                panel->dragKeyHeldDown (info.isKeyDown);

            break;

        case JucerCommandIDs::compOverlay0:
        case JucerCommandIDs::compOverlay33:
        case JucerCommandIDs::compOverlay66:
        case JucerCommandIDs::compOverlay100:
            {
                int amount = 0;

                if (info.commandID == JucerCommandIDs::compOverlay33)
                    amount = 33;
                else if (info.commandID == JucerCommandIDs::compOverlay66)
                    amount = 66;
                else if (info.commandID == JucerCommandIDs::compOverlay100)
                    amount = 100;

                document->setComponentOverlayOpacity (amount * 0.01f);
            }
            break;

        case JucerCommandIDs::bringBackLostItems:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
            {
                int w = panel->getComponentArea().getWidth();
                int h = panel->getComponentArea().getHeight();

                if (currentPaintRoutine != nullptr)
                    currentPaintRoutine->bringLostItemsBackOnScreen (panel->getComponentArea());
                else if (currentLayout != nullptr)
                    currentLayout->bringLostItemsBackOnScreen (w, h);
            }

            break;

        case JucerCommandIDs::toFront:
            if (currentLayout != nullptr)
                currentLayout->selectedToFront();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToFront();

            break;

        case JucerCommandIDs::toBack:
            if (currentLayout != nullptr)
                currentLayout->selectedToBack();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToBack();

            break;

        case JucerCommandIDs::group:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->groupSelected();
            break;

        case JucerCommandIDs::ungroup:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->ungroupSelected();
            break;

        case StandardApplicationCommandIDs::cut:
            if (currentLayout != nullptr)
            {
                currentLayout->copySelectedToClipboard();
                currentLayout->deleteSelected();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->copySelectedToClipboard();
                currentPaintRoutine->deleteSelected();
            }

            break;

        case StandardApplicationCommandIDs::copy:
            if (currentLayout != nullptr)
                currentLayout->copySelectedToClipboard();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->copySelectedToClipboard();

            break;

        case StandardApplicationCommandIDs::paste:
            {
                ScopedPointer<XmlElement> doc (XmlDocument::parse (SystemClipboard::getTextFromClipboard()));

                if (doc != nullptr)
                {
                    if (doc->hasTagName (ComponentLayout::clipboardXmlTag))
                    {
                        if (currentLayout != nullptr)
                            currentLayout->paste();
                    }
                    else if (doc->hasTagName (PaintRoutine::clipboardXmlTag))
                    {
                        if (currentPaintRoutine != nullptr)
                            currentPaintRoutine->paste();
                    }
                }
            }
            break;

        case StandardApplicationCommandIDs::del:
            if (currentLayout != nullptr)
                currentLayout->deleteSelected();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->deleteSelected();
            break;

        case StandardApplicationCommandIDs::selectAll:
            if (currentLayout != nullptr)
                currentLayout->selectAll();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectAll();
            break;

        case StandardApplicationCommandIDs::deselectAll:
            if (currentLayout != nullptr)
            {
                currentLayout->getSelectedSet().deselectAll();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->getSelectedElements().deselectAll();
                currentPaintRoutine->getSelectedPoints().deselectAll();
            }

            break;

        default:
            return false;
    }

    document->beginTransaction();
    return true;
}
コード例 #4
0
ファイル: scene.cpp プロジェクト: chapayGhub/Chipmunk-Sandbox
void Scene::actualZoom() {
    setZoom(1.0f);
}
コード例 #5
0
ファイル: wwaveformviewer.cpp プロジェクト: AlbanBedel/mixxx
void WWaveformViewer::onZoomChange(double zoom) {
    //qDebug() << "WaveformWidgetRenderer::onZoomChange" << this << zoom;
    setZoom(zoom);
    //notify back the factory to sync zoom if needed
    WaveformWidgetFactory::instance()->notifyZoomChange(this);
}
コード例 #6
0
ファイル: map.cpp プロジェクト: ppiecuch/mapbox-gl-native
void Map::resetZoom() {
    setZoom(0);
}
コード例 #7
0
ファイル: scene.cpp プロジェクト: chapayGhub/Chipmunk-Sandbox
void Scene::incrementZoom() {
    setZoom(m_zoom*2);
}
コード例 #8
0
ファイル: bandscope_control.c プロジェクト: joeradtke/ghpsdr
//-------------------------------------------------------------------------------------------
//
// build the GUI
//
GtkWidget* buildBandscope_controlUI() {
    GtkWidget* label;


    zoomFixed=gtk_fixed_new();
    gtk_widget_modify_bg(zoomFixed,GTK_STATE_NORMAL,&background);

    buttonOff = gtk_button_new_with_label ("Off");
    gtk_widget_modify_bg(buttonOff, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonOff);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonOff),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonOff),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonOff);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonOff,0,0);

    // zoom buttons
    buttonZoom1 = gtk_button_new_with_label ("Zoom x1");
    gtk_widget_modify_bg(buttonZoom1, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonZoom1);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonZoom1),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonZoom1),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonZoom1);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonZoom1,75,0);

    buttonZoom2 = gtk_button_new_with_label ("Zoom x2");
    gtk_widget_modify_bg(buttonZoom2, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonZoom2);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonZoom2),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonZoom2),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonZoom2);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonZoom2,150,0);

    if(BANDSCOPE_MULTIPLIER>2) {
    buttonZoom4 = gtk_button_new_with_label ("Zoom x4");
    gtk_widget_modify_bg(buttonZoom4, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonZoom4);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonZoom4),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonZoom4),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonZoom4);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonZoom4,225,0);
    }

    if(BANDSCOPE_MULTIPLIER>4) {
    buttonZoom8 = gtk_button_new_with_label ("Zoom x8");
    gtk_widget_modify_bg(buttonZoom8, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonZoom8);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonZoom8),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonZoom8),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonZoom8);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonZoom8,300,0);
    gtk_widget_set_size_request(GTK_WIDGET(zoomFixed),375,BUTTON_HEIGHT);
    }

    if(BANDSCOPE_MULTIPLIER>8) {
    buttonZoom16 = gtk_button_new_with_label ("Zoom x16");
    gtk_widget_modify_bg(buttonZoom16, GTK_STATE_NORMAL, &buttonBackground);
    label=gtk_bin_get_child((GtkBin*)buttonZoom16);
    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
    gtk_widget_set_size_request(GTK_WIDGET(buttonZoom16),75,BUTTON_HEIGHT);
    g_signal_connect(G_OBJECT(buttonZoom16),"clicked",G_CALLBACK(zoomCallback),NULL);
    gtk_widget_show(buttonZoom16);
    gtk_fixed_put((GtkFixed*)zoomFixed,buttonZoom16,375,0);
    gtk_widget_set_size_request(GTK_WIDGET(zoomFixed),450,BUTTON_HEIGHT);
    }

    gtk_widget_show(zoomFixed);

    setZoom(bandscopeZoom);

    return zoomFixed;
  
}
コード例 #9
0
ファイル: Settings.cpp プロジェクト: zmeyc/mapmaker
void Settings::setZoom100()
{
    setZoom(1.0);
}
コード例 #10
0
ファイル: WndMainWindow.cpp プロジェクト: jimmyw/ppsspp
	LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)	{
		int wmId, wmEvent;
		std::string fn;

		switch (message) {
		case WM_CREATE:
			break;

		case WM_MOVE:
			SavePosition();
			ResizeDisplay();
			break;

		case WM_SIZE:
			SavePosition();
			ResizeDisplay();
			break;

		case WM_TIMER:
			// Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode.
			switch (wParam) {
			case TIMER_CURSORUPDATE:
				CorrectCursor();
				return 0;

			case TIMER_CURSORMOVEUPDATE:
				hideCursor = true;
				KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
				return 0;
			}
			break;

		// For some reason, need to catch this here rather than in DisplayProc.
		case WM_MOUSEWHEEL:
			{
				int wheelDelta = (short)(wParam >> 16);
				KeyInput key;
				key.deviceId = DEVICE_ID_MOUSE;

				if (wheelDelta < 0) {
					key.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN;
					wheelDelta = -wheelDelta;
				} else {
					key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
				}
				// There's no separate keyup event for mousewheel events, let's pass them both together.
				// This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something.
				key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16);
				NativeKey(key);
			}
			break;

		case WM_COMMAND:
			{
				if (!EmuThread_Ready())
					return DefWindowProc(hWnd, message, wParam, lParam);
				I18NCategory *g = GetI18NCategory("Graphics");

				wmId    = LOWORD(wParam); 
				wmEvent = HIWORD(wParam); 
				// Parse the menu selections:
				switch (wmId) {
				case ID_FILE_LOAD:
					BrowseAndBoot("");
					break;

				case ID_FILE_LOAD_DIR:
					BrowseAndBoot("",true);
					break;

				case ID_FILE_LOAD_MEMSTICK:
					{
						std::string memStickDir, flash0dir;
						GetSysDirectories(memStickDir, flash0dir);
						memStickDir += "PSP\\GAME\\";
						BrowseAndBoot(memStickDir);
					}
					break;

				case ID_FILE_MEMSTICK:
					{
						std::string memStickDir, flash0dir;
						GetSysDirectories(memStickDir, flash0dir);
						ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW);
					}
					break;

				case ID_TOGGLE_PAUSE:
					if (globalUIState == UISTATE_PAUSEMENU) {
						NativeMessageReceived("run", "");
						if (disasmWindow[0])
							SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
					}
					else if (Core_IsStepping()) { // It is paused, then continue to run.
						if (disasmWindow[0])
							SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
						else
							Core_EnableStepping(false);
					} else {
						if (disasmWindow[0])
							SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOPGO, 0);
						else
							Core_EnableStepping(true);
					}
					break;

				case ID_EMULATION_STOP:
					if (memoryWindow[0]) {
						SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
					}
					if (disasmWindow[0]) {
						SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
					}
					if (Core_IsStepping()) {
						Core_EnableStepping(false);
					}
					NativeMessageReceived("stop", "");
					SetPlaying(0);
					Update();
					break;

				case ID_EMULATION_RESET:
					NativeMessageReceived("reset", "");
					break;

				case ID_EMULATION_SPEEDLIMIT:
					g_Config.bSpeedLimit = !g_Config.bSpeedLimit;
					break;

				case ID_EMULATION_RENDER_MODE_OGL:
					g_Config.bSoftwareRendering = false;
					break;

				case ID_EMULATION_RENDER_MODE_SOFT:
					g_Config.bSoftwareRendering = true;
					break;

				case ID_FILE_LOADSTATEFILE:
					if (W32Util::BrowseForFileName(true, hWnd, "Load state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) {
						SetCursor(LoadCursor(0, IDC_WAIT));
						SaveState::Load(fn, SaveStateActionFinished);
					}
					break;

				case ID_FILE_SAVESTATEFILE:
					if (W32Util::BrowseForFileName(false, hWnd, "Save state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) {
						SetCursor(LoadCursor(0, IDC_WAIT));
						SaveState::Save(fn, SaveStateActionFinished);
					}
					break;

				// TODO: Improve UI for multiple slots
				case ID_FILE_SAVESTATE_NEXT_SLOT:
				{
					currentSavestateSlot = (currentSavestateSlot + 1)%SaveState::SAVESTATESLOTS;
					char msg[30];
					sprintf(msg, "Using save state slot %d.", currentSavestateSlot + 1);
					osm.Show(msg);
					break;
				}

				case ID_FILE_QUICKLOADSTATE:
					SetCursor(LoadCursor(0, IDC_WAIT));
					SaveState::LoadSlot(currentSavestateSlot, SaveStateActionFinished);
					break;

				case ID_FILE_QUICKSAVESTATE:
					SetCursor(LoadCursor(0, IDC_WAIT));
					SaveState::SaveSlot(currentSavestateSlot, SaveStateActionFinished);
					break;

				case ID_OPTIONS_SCREEN1X:
					setZoom(ZOOM_NATIVE);
					break;

				case ID_OPTIONS_SCREEN2X:
					setZoom(ZOOM_2X);
					break;

				case ID_OPTIONS_SCREEN3X:
					setZoom(ZOOM_3X);
					break;

				case ID_OPTIONS_SCREEN4X:
					setZoom(ZOOM_MAX);
					break;

				case ID_OPTIONS_SCREENDUMMY:
					g_Config.iWindowZoom = ++g_Config.iWindowZoom > ZOOM_MAX ? ZOOM_NATIVE : g_Config.iWindowZoom;

					setZoom(g_Config.iWindowZoom);
					break;

				case ID_OPTIONS_MIPMAP:
					g_Config.bMipMap = !g_Config.bMipMap;
					break;

				case ID_OPTIONS_VSYNC:
					g_Config.bVSync = !g_Config.bVSync;
					break;

				case ID_TEXTURESCALING_OFF:
					setTexScalingMultiplier(TEXSCALING_OFF);
					break;

				case ID_TEXTURESCALING_2X:
					setTexScalingMultiplier(TEXSCALING_2X);
					break;

				case ID_TEXTURESCALING_3X:
					setTexScalingMultiplier(TEXSCALING_3X);
					break;

				case ID_TEXTURESCALING_4X:
					setTexScalingMultiplier(TEXSCALING_4X);
					break;

				case ID_TEXTURESCALING_5X:
					setTexScalingMultiplier(TEXSCALING_MAX);
					break;

				case ID_TEXTURESCALING_XBRZ:
					setTexScalingType(TextureScaler::XBRZ);
					break;

				case ID_TEXTURESCALING_HYBRID:
					setTexScalingType(TextureScaler::HYBRID);
					break;

				case ID_TEXTURESCALING_BICUBIC:
					setTexScalingType(TextureScaler::BICUBIC);
					break;

				case ID_TEXTURESCALING_HYBRID_BICUBIC:
					setTexScalingType(TextureScaler::HYBRID_BICUBIC);
					break;

				case ID_TEXTURESCALING_DEPOSTERIZE:
					g_Config.bTexDeposterize = !g_Config.bTexDeposterize;
					if(gpu) gpu->ClearCacheNextFrame();
					break;

				case ID_OPTIONS_NONBUFFEREDRENDERING:
					setRenderingMode(FB_NON_BUFFERED_MODE);
					break;

				case ID_OPTIONS_BUFFEREDRENDERING:
					setRenderingMode(FB_BUFFERED_MODE);
					break;

				case ID_OPTIONS_READFBOTOMEMORYCPU:
					setRenderingMode(FB_READFBOMEMORY_CPU);
					break;

				case ID_OPTIONS_READFBOTOMEMORYGPU:
					setRenderingMode(FB_READFBOMEMORY_GPU);
					break;

				// Dummy option to let the buffered rendering hotkey cycle through all the options.
				case ID_OPTIONS_BUFFEREDRENDERINGDUMMY:
					g_Config.iRenderingMode = ++g_Config.iRenderingMode > FB_READFBOMEMORY_GPU ? FB_NON_BUFFERED_MODE : g_Config.iRenderingMode;

					setRenderingMode(g_Config.iRenderingMode);
					break;

				case ID_OPTIONS_SHOWDEBUGSTATISTICS:
					g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
					break;

				case ID_OPTIONS_HARDWARETRANSFORM:
					g_Config.bHardwareTransform = !g_Config.bHardwareTransform;
					osm.ShowOnOff(g->T("Hardware Transform"), g_Config.bHardwareTransform);
					break;

				case ID_OPTIONS_STRETCHDISPLAY:
					g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay;
					if (gpu)
						gpu->Resized();  // Easy way to force a clear...
					break;

				case ID_OPTIONS_FRAMESKIP_0:
					setFrameSkipping(FRAMESKIP_OFF);
					break;

				case ID_OPTIONS_FRAMESKIP_1:
					setFrameSkipping(FRAMESKIP_1);
					break;

				case ID_OPTIONS_FRAMESKIP_2:
					setFrameSkipping(FRAMESKIP_2);
					break;

				case ID_OPTIONS_FRAMESKIP_3:
					setFrameSkipping(FRAMESKIP_3);
					break;
				
				case ID_OPTIONS_FRAMESKIP_4:
					setFrameSkipping(FRAMESKIP_4);
					break;

				case ID_OPTIONS_FRAMESKIP_5:
					setFrameSkipping(FRAMESKIP_5);
					break;

				case ID_OPTIONS_FRAMESKIP_6:
					setFrameSkipping(FRAMESKIP_6);
					break;

				case ID_OPTIONS_FRAMESKIP_7:
					setFrameSkipping(FRAMESKIP_7);
					break;

				case ID_OPTIONS_FRAMESKIP_8:
					setFrameSkipping(FRAMESKIP_8);
					break;

				case ID_OPTIONS_FRAMESKIP_9:
					setFrameSkipping(FRAMESKIP_MAX);
					break;

				case ID_OPTIONS_FRAMESKIPDUMMY:
					g_Config.iFrameSkip = ++g_Config.iFrameSkip > FRAMESKIP_MAX ? FRAMESKIP_OFF : g_Config.iFrameSkip;

					setFrameSkipping(g_Config.iFrameSkip);
					break;

				case ID_FILE_EXIT:
					DestroyWindow(hWnd);
					break;

				case ID_CPU_DYNAREC:
					g_Config.bJit = true;
					osm.ShowOnOff(g->T("Dynarec", "Dynarec (JIT)"), g_Config.bJit);
					break;

				case ID_CPU_INTERPRETER:
					g_Config.bJit = false;
					break;

				case ID_CPU_MULTITHREADED:
					g_Config.bSeparateCPUThread = !g_Config.bSeparateCPUThread;
					break;

				case ID_IO_MULTITHREADED:
					g_Config.bSeparateIOThread = !g_Config.bSeparateIOThread;
					break;

				case ID_EMULATION_RUNONLOAD:
					g_Config.bAutoRun = !g_Config.bAutoRun;
					break;

				case ID_DEBUG_DUMPNEXTFRAME:
					if (gpu)
						gpu->DumpNextFrame();
					break;

				case ID_DEBUG_LOADMAPFILE:
					if (W32Util::BrowseForFileName(true, hWnd, "Load .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) {
						symbolMap.LoadSymbolMap(fn.c_str());

						if (disasmWindow[0])
							disasmWindow[0]->NotifyMapLoaded();

						if (memoryWindow[0])
							memoryWindow[0]->NotifyMapLoaded();
					}
					break;

				case ID_DEBUG_SAVEMAPFILE:
					if (W32Util::BrowseForFileName(false, hWnd, "Save .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn))
						symbolMap.SaveSymbolMap(fn.c_str());
					break;
		
				case ID_DEBUG_RESETSYMBOLTABLE:
					symbolMap.ResetSymbolMap();

					for (int i=0; i<numCPUs; i++)
						if (disasmWindow[i])
							disasmWindow[i]->NotifyMapLoaded();

					for (int i=0; i<numCPUs; i++)
						if (memoryWindow[i])
							memoryWindow[i]->NotifyMapLoaded();
					break;

				case ID_DEBUG_DISASSEMBLY:
					if (disasmWindow[0])
						disasmWindow[0]->Show(true);
					break;

				case ID_DEBUG_MEMORYVIEW:
					if (memoryWindow[0])
						memoryWindow[0]->Show(true);
					break;

				case ID_DEBUG_LOG:
					LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
					break;

				case ID_OPTIONS_IGNOREILLEGALREADS:
					g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess;
					break;

				case ID_OPTIONS_FULLSCREEN:
					g_Config.bFullScreen = !g_Config.bFullScreen ;
					if(g_bFullScreen) {
						_ViewNormal(hWnd); 
					} else {
						_ViewFullScreen(hWnd);
					}
					break;

				case ID_OPTIONS_VERTEXCACHE:
					g_Config.bVertexCache = !g_Config.bVertexCache;
					break;

				case ID_OPTIONS_SHOWFPS:
					g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter;
					break;

				case ID_OPTIONS_FASTMEMORY:
					g_Config.bFastMemory = !g_Config.bFastMemory;
					break;

				case ID_OPTIONS_TEXTUREFILTERING_AUTO:
					setTexFiltering(AUTO);
					break;

				case ID_OPTIONS_NEARESTFILTERING:
					setTexFiltering(NEAREST);
					break;

				case ID_OPTIONS_LINEARFILTERING:
					setTexFiltering(LINEAR);
					break;

				case ID_OPTIONS_LINEARFILTERING_CG:
					setTexFiltering(LINEARFMV);
					break;

				case ID_OPTIONS_TOPMOST:
					g_Config.bTopMost = !g_Config.bTopMost;
					W32Util::MakeTopMost(hWnd, g_Config.bTopMost);
					break;

				case ID_OPTIONS_ANTIALIASING:
					g_Config.bAntiAliasing = !g_Config.bAntiAliasing;
					ResizeDisplay(true);
					break;

				case ID_OPTIONS_CONTROLS:
					MessageBox(hWnd, "Control mapping has been moved to the in-window Settings menu.\n", "Sorry", 0);
					break;

				case ID_EMULATION_SOUND:
					g_Config.bEnableSound = !g_Config.bEnableSound;
					if(!g_Config.bEnableSound) {
						EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
						if(!IsAudioInitialised())
							Audio_Init();
					} else {
						if(Atrac3plus_Decoder::IsInstalled())
							EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED);
					}
					break;

				case ID_EMULATION_ATRAC3_SOUND:
					g_Config.bEnableAtrac3plus = !g_Config.bEnableAtrac3plus;

					if(Atrac3plus_Decoder::IsInstalled()) {
						if(g_Config.bEnableAtrac3plus)
							Atrac3plus_Decoder::Init();
						else Atrac3plus_Decoder::Shutdown();
					} else {
						EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
					}
					break;

				case ID_HELP_OPENWEBSITE:
					ShellExecute(NULL, "open", "http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
					break;

				case ID_HELP_OPENFORUM:
					ShellExecute(NULL, "open", "http://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL);
					break;

				case ID_HELP_ABOUT:
					DialogManager::EnableAll(FALSE);
					DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
					DialogManager::EnableAll(TRUE);
					break;

				case ID_DEBUG_TAKESCREENSHOT:
					g_TakeScreenshot = true;
					break;

				default:
					MessageBox(hwndMain,"Unimplemented","Sorry",0);
					break;
				}
			}
			break;

		case WM_INPUT:
			{
				UINT dwSize;
				GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
				if (!rawInputBuffer) {
					rawInputBuffer = malloc(dwSize);
					rawInputBufferSize = dwSize;
				}
				if (dwSize > rawInputBufferSize) {
					rawInputBuffer = realloc(rawInputBuffer, dwSize);
				}
				GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER));
				RAWINPUT* raw = (RAWINPUT*)rawInputBuffer;
				if (raw->header.dwType == RIM_TYPEKEYBOARD) {
					KeyInput key;
					key.deviceId = DEVICE_ID_KEYBOARD;
					if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) {
						key.flags = KEY_DOWN;
						key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
						if (key.keyCode) {
							NativeKey(key);
						}
					} else if (raw->data.keyboard.Message == WM_KEYUP) {
						key.flags = KEY_UP;
						key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
						if (key.keyCode) {
							NativeKey(key);	
						}
					}
				} else if (raw->header.dwType == RIM_TYPEMOUSE) {
					mouseDeltaX += raw->data.mouse.lLastX;
					mouseDeltaY += raw->data.mouse.lLastY;

					// TODO : Smooth and translate to an axis every frame.
					// NativeAxis()
				}
			}
			return 0;

		case WM_DROPFILES:
			{
				if (!EmuThread_Ready())
					return DefWindowProc(hWnd, message, wParam, lParam);

				HDROP hdrop = (HDROP)wParam;
				int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0);
				if (count != 1) {
					MessageBox(hwndMain,"You can only load one file at a time","Error",MB_ICONINFORMATION);
				}
				else
				{
					TCHAR filename[512];
					DragQueryFile(hdrop,0,filename,512);
					TCHAR *type = filename+_tcslen(filename)-3;

					SendMessage(hWnd, WM_COMMAND, ID_EMULATION_STOP, 0);
					// Ugly, need to wait for the stop message to process in the EmuThread.
					Sleep(20);
					
					MainWindow::SetPlaying(filename);
					MainWindow::Update();

					NativeMessageReceived("boot", filename);
				}
			}
			break;

		case WM_CLOSE:
			EmuThread_Stop();

			return DefWindowProc(hWnd,message,wParam,lParam);

		case WM_DESTROY:
			KillTimer(hWnd, TIMER_CURSORUPDATE);
			KillTimer(hWnd, TIMER_CURSORMOVEUPDATE);
			PostQuitMessage(0);
			break;

		case WM_USER+1:
			if (disasmWindow[0])
				SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);
			if (memoryWindow[0])
				SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0);

			disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
			DialogManager::AddDlg(disasmWindow[0]);
			disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad);
			if (g_Config.bFullScreen)
				_ViewFullScreen(hWnd);
			memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
			DialogManager::AddDlg(memoryWindow[0]);
			if (disasmWindow[0])
				disasmWindow[0]->NotifyMapLoaded();
			if (memoryWindow[0])
				memoryWindow[0]->NotifyMapLoaded();

			SetForegroundWindow(hwndMain);
			break;

		case WM_USER_SAVESTATE_FINISH:
			SetCursor(LoadCursor(0, IDC_ARROW));
			break;

		case WM_USER_LOG_STATUS_CHANGED:
			if(!g_Config.bEnableLogging) {
				LogManager::GetInstance()->GetConsoleListener()->Show(false);
				EnableMenuItem(menu, ID_DEBUG_LOG, MF_GRAYED);
			} else {
				LogManager::GetInstance()->GetConsoleListener()->Show(true);
				EnableMenuItem(menu, ID_DEBUG_LOG, MF_ENABLED);
			}
			break;

		case WM_USER_ATRAC_STATUS_CHANGED:
			if(g_Config.bEnableAtrac3plus && Atrac3plus_Decoder::IsInstalled())
				EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED);
			else
				EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
			break;

		case WM_MENUSELECT:
			// Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states
			// with corresponding menu items.
			UpdateMenus();
			break;

		// Turn off the screensaver.
		// Note that if there's a screensaver password, this simple method
		// doesn't work on Vista or higher.
		case WM_SYSCOMMAND:
			{
				switch (wParam) {
				case SC_SCREENSAVE:  
					return 0;
				case SC_MONITORPOWER:
					return 0;      
				}
				return DefWindowProc(hWnd, message, wParam, lParam);
			}

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		return 0;
	}
コード例 #11
0
ファイル: SimulatorWin.cpp プロジェクト: hugohuang1111/Bird
int SimulatorWin::run()
{
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    parseCocosProjectConfig(_project);

    // load project config from command line args
    vector<string> args;
    for (int i = 0; i < __argc; ++i)
    {
        wstring ws(__wargv[i]);
        string s;
        s.assign(ws.begin(), ws.end());
        args.push_back(s);
    }
    _project.parseCommandLine(args);

    if (_project.getProjectDir().empty())
    {
        if (args.size() == 2)
        {
            // for Code IDE before RC2
            _project.setProjectDir(args.at(1));
            _project.setDebuggerType(kCCRuntimeDebuggerCodeIDE);
        }
    }

    // create the application instance
    _app = new AppDelegate();
    RuntimeEngine::getInstance()->setProjectConfig(_project);

#if (SIMULATOR_WITH_CONSOLE_AND_MENU > 0)
    // create console window
    if (_project.isShowConsole())
    {
        AllocConsole();
        _hwndConsole = GetConsoleWindow();
        if (_hwndConsole != NULL)
        {
            ShowWindow(_hwndConsole, SW_SHOW);
            BringWindowToTop(_hwndConsole);
            freopen("CONOUT$", "wt", stdout);
            freopen("CONOUT$", "wt", stderr);

            HMENU hmenu = GetSystemMenu(_hwndConsole, FALSE);
            if (hmenu != NULL)
            {
                DeleteMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
            }
        }
    }
#endif

    // log file
    if (_project.isWriteDebugLogToFile())
    {
        const string debugLogFilePath = _project.getDebugLogFilePath();
        _writeDebugLogFile = fopen(debugLogFilePath.c_str(), "w");
        if (!_writeDebugLogFile)
        {
            CCLOG("Cannot create debug log file %s", debugLogFilePath.c_str());
        }
    }

    // set environments
    SetCurrentDirectoryA(_project.getProjectDir().c_str());
    FileUtils::getInstance()->setDefaultResourceRootPath(_project.getProjectDir());
    FileUtils::getInstance()->setWritablePath(_project.getWritableRealPath().c_str());

    // check screen DPI
    HDC screen = GetDC(0);
    int dpi = GetDeviceCaps(screen, LOGPIXELSX);
    ReleaseDC(0, screen);

    // set scale with DPI
    //  96 DPI = 100 % scaling
    // 120 DPI = 125 % scaling
    // 144 DPI = 150 % scaling
    // 192 DPI = 200 % scaling
    // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#dpi_and_the_desktop_scaling_factor
    //
    // enable DPI-Aware with DeclareDPIAware.manifest
    // http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#declaring_dpi_awareness
    float screenScale = 1.0f;
    if (dpi >= 120 && dpi < 144)
    {
        screenScale = 1.25f;
    }
    else if (dpi >= 144 && dpi < 192)
    {
        screenScale = 1.5f;
    }
    else if (dpi >= 192)
    {
        screenScale = 2.0f;
    }
    CCLOG("SCREEN DPI = %d, SCREEN SCALE = %0.2f", dpi, screenScale);

    // create opengl view
    Size frameSize = _project.getFrameSize();
    float frameScale = 1.0f;
    if (_project.isRetinaDisplay())
    {
        frameSize.width *= screenScale;
        frameSize.height *= screenScale;
    }
    else
    {
        frameScale = screenScale;
    }

    const Rect frameRect = Rect(0, 0, frameSize.width, frameSize.height);
    ConfigParser::getInstance()->setInitViewSize(frameSize);
    const bool isResize = _project.isResizeWindow();
    std::stringstream title;
    title << "Cocos Simulator - " << ConfigParser::getInstance()->getInitViewName();
    initGLContextAttrs();
    auto glview = GLViewImpl::createWithRect(title.str(), frameRect, frameScale);
    _hwnd = glview->getWin32Window();
    player::PlayerWin::createWithHwnd(_hwnd);
    DragAcceptFiles(_hwnd, TRUE);
    //SendMessage(_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
    //SendMessage(_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon);
    //FreeResource(icon);

    auto director = Director::getInstance();
    director->setOpenGLView(glview);

    director->setAnimationInterval(1.0 / 60.0);

    // set window position
    if (_project.getProjectDir().length())
    {
        setZoom(_project.getFrameScale());
    }
    Vec2 pos = _project.getWindowOffset();
    if (pos.x != 0 && pos.y != 0)
    {
        RECT rect;
        GetWindowRect(_hwnd, &rect);
        MoveWindow(_hwnd, pos.x, pos.y, rect.right - rect.left, rect.bottom - rect.top, FALSE);
    }

    // path for looking Lang file, Studio Default images
    FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str());

#if SIMULATOR_WITH_CONSOLE_AND_MENU > 0
    // init player services
    setupUI();
    DrawMenuBar(_hwnd);
#endif

    // prepare
    FileUtils::getInstance()->setPopupNotify(false);
    _project.dump();
    auto app = Application::getInstance();

    g_oldWindowProc = (WNDPROC)SetWindowLong(_hwnd, GWL_WNDPROC, (LONG)SimulatorWin::windowProc);

    // startup message loop
    return app->run();
}
コード例 #12
0
ファイル: editorview.cpp プロジェクト: Galatamon/Drawpile
/**
 * You should use this function instead calling rotate() directly
 * to keep track of the rotation angle.
 * @param angle new rotation angle
 */
void EditorView::setRotation(qreal angle)
{
    rotate_ = angle;
    setZoom(zoom_);
}
コード例 #13
0
ファイル: paparazzi.cpp プロジェクト: tangrams/paparazzi
// prime_server stuff
worker_t::result_t Paparazzi::work (const std::list<zmq::message_t>& job, void* request_info){
    //false means this is going back to the client, there is no next stage of the pipeline
    worker_t::result_t result{false};

    //this type differs per protocol hence the void* fun
    auto& info = *static_cast<http_request_t::info_t*>(request_info);

    // Try to generate a response 
    http_response_t response;
    try {
        // double start_call = getTime();

        //TODO: 
        //   - actually use/validate the request parameters
        auto request = http_request_t::from_string(static_cast<const char*>(job.front().data()), job.front().size());

        if (request.path == "/check") {
            // ELB check
            response = http_response_t(200, "OK", "OK", headers_t{CORS, TXT_MIME});
        } else {
            //  SCENE
            //  ---------------------
            auto scene_itr = request.query.find("scene");
            if (scene_itr == request.query.cend() || scene_itr->second.size() == 0) {
                // If there is NO SCENE QUERY value 
                if (request.body.empty()) 
                    // if there is not POST body content return error...
                    throw std::runtime_error("scene is required punk");

                // ... other whise load content
                setSceneContent(request.body);
                // The size of the custom scene is unique enough
                result.heart_beat = std::to_string(request.body.size());
            }
            else {
                // If there IS a SCENE QUERRY value load it
                setScene(scene_itr->second.front());
                result.heart_beat = scene_itr->second.front();
            }

            bool size_and_pos = true;
            float pixel_density = 1.0f;

            //  SIZE
            //  ---------------------
            auto width_itr = request.query.find("width");
            if (width_itr == request.query.cend() || width_itr->second.size() == 0)
                size_and_pos = false;
            auto height_itr = request.query.find("height");
            if (height_itr == request.query.cend() || height_itr->second.size() == 0)
                size_and_pos = false;
            auto density_itr = request.query.find("density");
            if (density_itr != request.query.cend() && density_itr->second.size() > 0)
                pixel_density = fmax(1.,std::stof(density_itr->second.front()));
            //  POSITION
            //  ---------------------
            auto lat_itr = request.query.find("lat");
            if (lat_itr == request.query.cend() || lat_itr->second.size() == 0)
                size_and_pos = false;
            auto lon_itr = request.query.find("lon");
            if (lon_itr == request.query.cend() || lon_itr->second.size() == 0)
                size_and_pos = false;
            auto zoom_itr = request.query.find("zoom");
            if (zoom_itr == request.query.cend() || zoom_itr->second.size() == 0)
                size_and_pos = false;
            

            if (size_and_pos) {
                // Set Map and OpenGL context size
                setSize(std::stoi(width_itr->second.front()), std::stoi(height_itr->second.front()), pixel_density);
                setPosition(std::stod(lon_itr->second.front()), std::stod(lat_itr->second.front()));
                setZoom(std::stof(zoom_itr->second.front()));
            } else {
                const std::regex re("\\/(\\d*)\\/(\\d*)\\/(\\d*)\\.png");
                std::smatch match;

                if (std::regex_search(request.path, match, re) && match.size() == 4) {
                    setSize(256,256, pixel_density);

                    int tile_coord[3] = {0,0,0};
                    for (int i = 0; i < 3; i++) {
                        std::istringstream cur(match.str(i+1));
                        cur >> tile_coord[i];
                    }
                    futile_coord_s tile;
                    tile.z = tile_coord[0];
                    setZoom(tile.z);

                    tile.x = tile_coord[1];
                    tile.y = tile_coord[2];
                    futile_bounds_s bounds;
                    futile_coord_to_bounds(&tile, &bounds);

                    setPosition(bounds.minx + (bounds.maxx-bounds.minx)*0.5,bounds.miny + (bounds.maxy-bounds.miny)*0.5);
                }
                else {
                    throw std::runtime_error("not enought data to construct image");
                }
            }

            //  OPTIONAL tilt and rotation
            //  ---------------------
            auto tilt_itr = request.query.find("tilt");
            if (tilt_itr != request.query.cend() && tilt_itr->second.size() != 0) {
                // If TILT QUERRY is provided assigned ...
                setTilt(std::stof(tilt_itr->second.front()));
            }
            else {
                // othewise use default (0.)
                setTilt(0.0f);
            }

            auto rotation_itr = request.query.find("rotation");
            if (rotation_itr != request.query.cend() && rotation_itr->second.size() != 0) {
                // If ROTATION QUERRY is provided assigned ...
                setRotation(std::stof(rotation_itr->second.front()));
            }
            else {
                // othewise use default (0.)
                setRotation(0.0f);
            }

            // Time to render
            //  ---------------------
            std::string image;
            if (m_map) {
                update();

                // Render Tangram Scene
                m_aab->bind();
                m_map->render();
                m_aab->unbind();
   
                // Once the main FBO is draw take a picture
                m_aab->getPixelsAsString(image);
                // double total_time = getTime()-start_call;
                // LOG("TOTAL CALL: %f", total_time);
                // LOG("TOTAL speed: %f millisec per pixel", (total_time/((m_width * m_height)/1000.0)));
            }

            response = http_response_t(200, "OK", image, headers_t{CORS, PNG_MIME});
        }
コード例 #14
0
ファイル: qglimagegpuwidget.cpp プロジェクト: mwerlberger/imp
//-----------------------------------------------------------------------------
void QGLImageGpuWidget::slotZoom4()
{
  setZoom(4.0f);
  emit zoomChanged(zoom_);
}
コード例 #15
0
ファイル: imageview.cpp プロジェクト: GinZhu/xdog-demo
void ImageView::restoreSettings(QSettings& settings) {
    setZoom(settings.value("zoom", 1.0).toDouble());
    setResolution(settings.value("resolution", 1.0).toDouble());
    setOriginX(settings.value("originX", 0).toFloat());
    setOriginY(settings.value("originY", 0).toFloat());
}
コード例 #16
0
ファイル: Settings.cpp プロジェクト: zmeyc/mapmaker
void Settings::setZoom200()
{
    setZoom(2.0);
}
コード例 #17
0
/****************************************************************************
**
** Copyright (C) 2016 - 2017
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include <float.h>
#include <QMessageBox>
#include <QSettings>
#include "constants.h"
#include "hlms_node_samplerblock.h"
#include "hlms_node_porttypes.h"

//****************************************************************************/
HlmsNodeSamplerblock::HlmsNodeSamplerblock(QString title, QGraphicsItem* parent) :
    Magus::QtNode(title, parent),
    mTextureType(0),
    mTextureIndex(0),
    mSamplerblockEnabled(true),
    mTextureAddressingModeU(0),
    mTextureAddressingModeV(0),
    mTextureAddressingModeW(0),
    mMipLodBias(0.0f),
    mMaxAnisotropy(1.0f),
    mCompareFunction(8),
    mMinLod(-FLT_MAX),
    mMaxLod(FLT_MAX),
    mBorderColourRed(255.0f),
    mBorderColourGreen(255.0f),
    mBorderColourBlue(255.0f),
    mUvSet(0),
    mBlendMode(0),
    mMapWeight(1.0f),
    mEmissiveColourRed(0.0f),
    mEmissiveColourGreen(0.0f),
    mEmissiveColourBlue(0.0f),
    mAnimationEnabled(false),
    mSequenceNumber(-1)
{
    mFileNameTexture = QString("");
    mBaseNameTexture = QString("");
    mPathTexture = QString("");
    mOffset = QVector2D(0.0f, 0.0f);
    mScale = QVector2D(1.0f, 1.0f);
    mAnimationScale = QVector2D(1.0f, 1.0f);
    mAnimationTranslate = QVector2D(0.0f, 0.0f);

    // Define the connection policy
    HlmsPbsDatablockSamplerblockPortType hlmsPbsDatablockSamplerblockPortType;
    HlmsSamplerblockDatablockPortType hlmsSamplerblockDatablockPortType;
    hlmsPbsDatablockSamplerblockPortType.addPortTypeToConnectionPolicy(hlmsSamplerblockDatablockPortType);

    // Apply values from settings.cfg
    QSettings settings(FILE_SETTINGS, QSettings::IniFormat);
    mTextureMinFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
    mTextureMagFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
    mTextureMipFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();

    // Custome node settings
    setTitleColor(Qt::white);
    setHeaderTitleIcon(ICON_SAMPLERBLOCK);
    setAction1Icon(ICON_MINMAX);
    setAction2Icon(ICON_CLOSE);
    alignTitle(Magus::ALIGNED_LEFT);
    setHeaderColor(QColor("#874E96"));
    mPort = createPort(PORT_ID_SAMPLERBLOCK,
                       PORT_DATABLOCK,
                       hlmsPbsDatablockSamplerblockPortType,
                       QColor("#874E96"),
                       Magus::PORT_SHAPE_CIRCLE,
                       Magus::ALIGNED_LEFT,
                       QColor("#874E96"));

    setPortNameColor(Qt::white);
    setZoom(0.9);
}
コード例 #18
0
ファイル: Settings.cpp プロジェクト: zmeyc/mapmaker
void Settings::setZoom300()
{
    setZoom(3.0);
}
コード例 #19
0
ファイル: webview.cpp プロジェクト: JoseAngelMuyoz/QupZilla
void WebView::setPage(QWebPage* page)
{
    QWebView::setPage(page);

    setZoom(WebViewSettings::defaultZoom);
}
コード例 #20
0
ファイル: Settings.cpp プロジェクト: zmeyc/mapmaker
void Settings::setZoom400()
{
    setZoom(4.0);
}
コード例 #21
0
ファイル: scene.cpp プロジェクト: chapayGhub/Chipmunk-Sandbox
void Scene::decrementZoom() {
    setZoom(m_zoom/2);
}
コード例 #22
0
ファイル: zoompos.cpp プロジェクト: frachop/hts-opengl
	bool CZoomPos::incZoom(bool bInc)
	{
		return setZoom( (bInc) ? (getZoom() * m_zoomStep) : getZoom() / m_zoomStep );
	}
コード例 #23
0
ファイル: drawzone.cpp プロジェクト: serghei/kde3-kdewebdev
void DrawZone::setPicture(const QImage &_image) {
	image=_image;
//-	zoomedImage.convertFromImage(image);
	setZoom(_zoom);
}
コード例 #24
0
ファイル: LogGraph.cpp プロジェクト: tlogger/TMon
void CLogGraph::OnLButtonDown(UINT nFlags, CPoint point)
{
	CMenu menu;

	
	
	if (hitRect(point, m_rectHome)) {
		m_nCurrentPos = 0; 
		redraw();
		setNavMode(true);
	}
	else if (hitRect(point, m_rectPgUp)) {
		if (m_nCurrentPos - getWndQueLength() < 0) 
			m_nCurrentPos = 0;
		else 
			m_nCurrentPos -= getWndQueLength();

		redraw();
		setNavMode(true);
	}
	else if (hitRect(point, m_rectPgDn)) {
		int mqlast = getLast();
		if (m_nCurrentPos + getWndQueLength() >= mqlast) {
			m_nCurrentPos = mqlast - getWndQueLength();
			if (m_nCurrentPos < 0)
				m_nCurrentPos = 0;
		}
		else
			m_nCurrentPos += getWndQueLength();
		redraw();
		setNavMode(true);
	}
	else if (hitRect(point, m_rectEnd)) {
		m_nCurrentPos = getLast() - getWndQueLength();
		if (m_nCurrentPos < 0)
			m_nCurrentPos = 0;
		redraw();
		setNavMode(false);
		sendMsg(LG_NAV_END);
	}
	else if (hitRect(point, m_rectZoom)) {
		if (!menu.CreatePopupMenu())
			return;
		menu.AppendMenu(MF_STRING, 1, "Zoom Fit");
		menu.AppendMenu(MF_SEPARATOR);
		menu.AppendMenu(MF_STRING, 2, "Zoom 1:1");
		menu.AppendMenu(MF_STRING, 3, "Zoom 2:1");
		menu.AppendMenu(MF_STRING, 4, "Zoom 4:1");
		menu.AppendMenu(MF_STRING, 5, "Zoom 10:1");
		menu.AppendMenu(MF_STRING, 6, "Zoom 60:1");
		menu.AppendMenu(MF_STRING, 7, "Zoom 3600:1");
		ClientToScreen(&point);
		int n = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, point.x, point.y, this);

		menu.DestroyMenu();
		switch (n) {
			case 2: setZoom(1.0); redraw(); break;
			case 3: setZoom(2.0); redraw(); break;
			case 4: setZoom(4.0); redraw(); break;
			case 5: setZoom(10.0); redraw(); break;
			case 6: setZoom(60.0); redraw(); break;
			case 7: setZoom(3600.0); redraw(); break;
			case 1: setZoomFit(); redraw(); break;
				break;
		}
	//	if (!m_bNav)
	//		goLast();
//		setNavMode();
	}
	else if (hitRect(point, m_rectHeader)) {
		TRACE("header click\n");
	}
	else if (hitRect(point, m_rectScale)) {
		TRACE("scale click\n");
	}else {
		m_bLdown = true;
		m_ptStMouse = point;
	}

//	TRACE("%s : cpos %d\n", __FUNCTION__, m_nCurrentPos);
	CWnd::OnLButtonDown(nFlags, point);
}
コード例 #25
0
void ContentWindowGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
    // handle mouse movements differently depending on selected mode of item
    if(windowState_ == UNSELECTED)
    {
        if(event->buttons().testFlag(Qt::LeftButton) == true)
        {
            if(resizing_ == true)
            {
                QRectF r = rect();
                QPointF eventPos = event->pos();

                r.setBottomRight(eventPos);

                QRectF sceneRect = mapRectToScene(r);

                double w = sceneRect.width();
                double h = sceneRect.height();

                setSize(w, h);
            }
            else
            {
                QPointF delta = event->pos() - event->lastPos();

                double x = x_ + delta.x();
                double y = y_ + delta.y();

                setPosition(x, y);
            }
        }
    }
    else if(windowState_ == SELECTED)
    {
        // handle zooms / pans
        QPointF delta = event->scenePos() - event->lastScenePos();

        if(event->buttons().testFlag(Qt::RightButton) == true)
        {
            // increment zoom

            // if this is a touch event, use cross-product for determining change in zoom (counterclockwise rotation == zoom in, etc.)
            // otherwise, use y as the change in zoom
            double zoomDelta;

            if(event->modifiers().testFlag(Qt::AltModifier) == true)
            {
                zoomDelta = (event->scenePos().x()-0.5) * delta.y() - (event->scenePos().y()-0.5) * delta.x();
                zoomDelta *= 2.;
            }
            else
            {
                zoomDelta = delta.y();
            }

            double zoom = zoom_ * (1. - zoomDelta);

            setZoom(zoom);
        }
        else if(event->buttons().testFlag(Qt::LeftButton) == true)
        {
            // pan (move center coordinates)
            double centerX = centerX_ + 2.*delta.x() / zoom_;
            double centerY = centerY_ + 2.*delta.y() / zoom_;

            setCenter(centerX, centerY);
        }

        // force a redraw to update window info label
        update();
    }
    else if(windowState_ == INTERACTION)
    {
        QRectF r = rect();
        QPointF eventPos = event->pos();

        InteractionState interactionState = interactionState_;

        interactionState.mouseX_ = (eventPos.x() - r.x()) / r.width();
        interactionState.mouseY_ = (eventPos.y() - r.y()) / r.height();

        if(event->buttons().testFlag(Qt::LeftButton) == true)
            interactionState.mouseLeft_ = true;
        else
            interactionState.mouseLeft_ = false;

        if(event->buttons().testFlag(Qt::MiddleButton) == true)
            interactionState.mouseMiddle_ = true;
        else
            interactionState.mouseMiddle_ = false;

        if(event->buttons().testFlag(Qt::RightButton) == true)
            interactionState.mouseRight_ = true;
        else
            interactionState.mouseRight_ = false;

        setInteractionState(interactionState);

        // force a redraw to update window info label
        update();
    }
}
コード例 #26
0
ファイル: imageview.cpp プロジェクト: GinZhu/xdog-demo
void ImageView::zoomIn() {
    setZoom(m_zoom * 2);
}
コード例 #27
0
ファイル: ge_waveform.cpp プロジェクト: micahscopes/giada
void gWaveform::openEditMenu() {

	if (selectionA == selectionB)
		return;

	menuOpen = true;

	Fl_Menu_Item menu[] = {
		{"Cut"},
		{"Trim"},
		{"Silence"},
		{"Fade in"},
		{"Fade out"},
		{"Smooth edges"},
		{"Set start/end here"},
		{0}
	};

	if (chan->status == STATUS_PLAY) {
		menu[0].deactivate();
		menu[1].deactivate();
	}

	Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50);
	b->box(G_BOX);
	b->textsize(11);
	b->textcolor(COLOR_TEXT_0);
	b->color(COLOR_BG_0);

	const Fl_Menu_Item *m = menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b);
	if (!m) {
		menuOpen = false;
		return;
	}

	/* straightSel() to ensure that point A is always lower than B */

	straightSel();

	if (strcmp(m->label(), "Silence") == 0) {
		wfx_silence(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		selectionA = 0;
		selectionB = 0;

		stretchToWindow();
		redraw();
		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Set start/end here") == 0) {

		glue_setBeginEndChannel(
				(gdEditor *) window(), // parent
				chan,
				absolutePoint(selectionA) * 2,  // stereo!
				absolutePoint(selectionB) * 2,  // stereo!
				false, // no recalc (we do it here)
				false  // don't check
				);

		selectionA     = 0;
		selectionB     = 0;
		selectionA_abs = 0;
		selectionB_abs = 0;

		recalcPoints();
		redraw();
		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Cut") == 0) {
		wfx_cut(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		/* for convenience reset start/end points */

		glue_setBeginEndChannel(
			(gdEditor *) window(),
			chan,
			0,
			chan->wave->size,
			false);

		selectionA     = 0;
		selectionB     = 0;
		selectionA_abs = 0;
		selectionB_abs = 0;

		setZoom(0);

		menuOpen = false;
		return;
	}

	if (strcmp(m->label(), "Trim") == 0) {
		wfx_trim(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		glue_setBeginEndChannel(
			(gdEditor *) window(),
			chan,
			0,
			chan->wave->size,
			false);

		selectionA     = 0;
		selectionB     = 0;
		selectionA_abs = 0;
		selectionB_abs = 0;

		stretchToWindow();
		menuOpen = false;
		redraw();
		return;
	}

	if (!strcmp(m->label(), "Fade in") || !strcmp(m->label(), "Fade out")) {

		int type = !strcmp(m->label(), "Fade in") ? 0 : 1;
		wfx_fade(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB), type);

		selectionA = 0;
		selectionB = 0;

		stretchToWindow();
		redraw();
		menuOpen = false;
		return;
	}

	if (!strcmp(m->label(), "Smooth edges")) {

		wfx_smooth(chan->wave, absolutePoint(selectionA), absolutePoint(selectionB));

		selectionA = 0;
		selectionB = 0;

		stretchToWindow();
		redraw();
		menuOpen = false;
		return;
	}
}
コード例 #28
0
ファイル: imageview.cpp プロジェクト: GinZhu/xdog-demo
void ImageView::zoomOut() {
    setZoom(m_zoom / 2);
}
コード例 #29
0
//-----------------------------------------------------------------------------
// zoom()
//-----------------------------------------------------------------------------
void LLPreviewAnimation::zoom(F32 zoom_delta)
{
	setZoom(mCameraZoom + zoom_delta);
}
コード例 #30
0
ファイル: qglimagegpuwidget.cpp プロジェクト: mwerlberger/imp
//-----------------------------------------------------------------------------
void QGLImageGpuWidget::slotZoomReset()
{
  setZoom(1.0f);
  emit zoomChanged(zoom_);
}