示例#1
0
void FarPlugin::KeyConfig()
{
	//int res = Info.MacroControl(&MainGuid, MCTL_SAVEALL, 0, NULL);
	//
	BindAll();
	ShowMessage("", "Hotkeys binded", FMSG_MB_OK);
	return;
#if 0
	FarDialog& dlg = Dialogs()["KeysDialog"];
	dlg.ResetControls();

	bool bind = Binded("F5") && Binded("F6") && Binded("ShiftF5") && Binded("ShiftF6");
	bool altShift = bind && Binded("AltShiftF5") && Binded("AltShiftF6");
	bool ctrlShift = bind && Binded("CtrlShiftF5") && Binded("CtrlShiftF6");
	bool ctrlAlt = bind && Binded("CtrlAltF5") && Binded("CtrlAltF6");
	if(!altShift && !ctrlShift && !ctrlAlt)
		altShift = true;

	dlg["BindToF5"]("Selected") = bind;
	dlg["AltShiftF5"]("Selected") = altShift;
	dlg["CtrlShiftF5"]("Selected") = ctrlShift;
	dlg["CtrlAltF5"]("Selected") = ctrlAlt;

	if(dlg.Execute() == -1)
		return;

	if(dlg["BindToF5"]("Selected") == bind
		&& dlg["AltShiftF5"]("Selected") == altShift
		&& dlg["CtrlShiftF5"]("Selected") == ctrlShift
		&& dlg["CtrlAltF5"]("Selected") == ctrlAlt)
		return;

	// MacroCommand(MCMD_SAVEALL); // XXX

	Unbind("KEY_F5");	Unbind("ShiftF5");
	Unbind("KEY_F5");			Unbind("ShiftF6");
	Unbind("AltShiftF5");	Unbind("AltShiftF6");
	Unbind("CtrlShiftF5");	Unbind("CtrlShiftF6");
	Unbind("CtrlAltF5");	Unbind("CtrlAltF6");

	if(dlg["BindToF5"]("Selected"))
	{
		Bind("F5", "Plugin.Call(\"16990c75-cb7a-43df-8d7e-d6bf3683c3f1\", 0)", "", 0);
		Bind("F6", "Plugin.Call(\"16990c75-cb7a-43df-8d7e-d6bf3683c3f1\", 1)", "", 0);
		Bind("ShiftF5", "Plugin.Call(\"16990c75-cb7a-43df-8d7e-d6bf3683c3f1\", 0)", "", 0);
		Bind("ShiftF6", "Plugin.Call(\"16990c75-cb7a-43df-8d7e-d6bf3683c3f1\", 1)", "", 0);

		/*
		String key;
		if(dlg["AltShiftF5"]("Selected")) key = "AltShift";
		else if(dlg["CtrlShiftF5"]("Selected")) key = "CtrlShift";
		else if(dlg["CtrlAltF5"]("Selected")) key = "CtrlAlt";
		Bind(key + "F5", "F5");
		Bind(key + "F6", "F6");
		*/
	}
	// MacroCommand(MCMD_LOADALL); // XXX
#endif
}
示例#2
0
void FarPlugin::KeyConfig()
{
    //int res = Info.MacroControl(&MainGuid, MCTL_SAVEALL, 0, nullptr);
    //
    //BindAll();
    //ShowMessage(L"", L"Hotkeys binded", FMSG_MB_OK);
    //return;
    FarDialog & dlg = plugin->Dialogs()[L"KeysDialog"];
    dlg.ResetControls();

    bool bind = Bound(L"F5") && Bound(L"F6") && Bound(L"ShiftF5") && Bound(L"ShiftF6");
    bool altShift = bind && Bound(L"AltShiftF5") && Bound(L"AltShiftF6");
    bool ctrlShift = bind && Bound(L"CtrlShiftF5") && Bound(L"CtrlShiftF6");
    bool ctrlAlt = bind && Bound(L"CtrlAltF5") && Bound(L"CtrlAltF6");
    if (!altShift && !ctrlShift && !ctrlAlt)
        altShift = true;

    dlg[L"BindToF5"](L"Selected") = bind;
    dlg[L"AltShiftF5"](L"Selected") = altShift;
    dlg[L"CtrlShiftF5"](L"Selected") = ctrlShift;
    dlg[L"CtrlAltF5"](L"Selected") = ctrlAlt;

    if (dlg.Execute() == -1)
        return;

    if (dlg[L"BindToF5"](L"Selected") == bind &&
            dlg[L"AltShiftF5"](L"Selected") == altShift &&
            dlg[L"CtrlShiftF5"](L"Selected") == ctrlShift &&
            dlg[L"CtrlAltF5"](L"Selected") == ctrlAlt)
        return;

    Unbind(L"F5");
    Unbind(L"ShiftF5");
    Unbind(L"F6");
    Unbind(L"ShiftF6");
    Unbind(L"AltShiftF5");
    Unbind(L"AltShiftF6");
    Unbind(L"CtrlShiftF5");
    Unbind(L"CtrlShiftF6");
    Unbind(L"CtrlAltF5");
    Unbind(L"CtrlAltF6");

    if (dlg[L"BindToF5"](L"Selected"))
    {
        BindAll();

        String key;
        if (dlg[L"AltShiftF5"](L"Selected"))
            key = L"AltShift";
        else if (dlg[L"CtrlShiftF5"](L"Selected"))
            key = L"CtrlShift";
        else if (dlg[L"CtrlAltF5"](L"Selected"))
            key = L"CtrlAlt";
        Bind(key + L"F5", L"Keys(\"F5\")", L"FileCopyEx3 - Standard copy dialog", 0);
        Bind(key + L"F6", L"Keys(\"F6\")", L"FileCopyEx3 - Standard move dialog", 0);
    }
}
示例#3
0
文件: lightmap.cpp 项目: paud/d2x-xl
int CLightmapManager::Create (int nLevel)
{
if (!(gameStates.render.bUsePerPixelLighting))
	return 0;
if ((gameStates.render.bUsePerPixelLighting == 1) && !CreateLightmapShader (0))
	return gameStates.render.bUsePerPixelLighting = 0;
#if !DBG
if (gameOpts->render.nLightmapQuality > 3)
	gameOpts->render.nLightmapQuality = 3;
#endif
Destroy ();
int nLights = Init (0);
if (nLights < 0)
	return 0;
if (Load (nLevel))
	return 1;
if (gameStates.render.bPerPixelLighting && gameData.segs.nFaces) {
	if (nLights) {
		lightManager.Transform (1, 0);
		int nSaturation = gameOpts->render.color.nSaturation;
		gameOpts->render.color.nSaturation = 1;
		gameStates.render.bHaveLightmaps = 1;
		//gameData.render.fAttScale [0] = 2.0f;
		lightManager.Index (0)[0].nFirst = MAX_SHADER_LIGHTS;
		lightManager.Index (0)[0].nLast = 0;
		if (gameStates.app.bProgressBars && gameOpts->menus.nStyle) {
			nFace = 0;
			ProgressBar (TXT_CALC_LIGHTMAPS, 0, PROGRESS_STEPS (gameData.segs.nFaces), CreatePoll);
			}
		else {
			messageBox.Show (TXT_CALC_LIGHTMAPS);
			BuildAll (-1);
			messageBox.Clear ();
			}
		//gameData.render.fAttScale [0] = (gameStates.render.bPerPixelLighting == 2) ? 1.0f : 2.0f;
		gameStates.render.bHaveLightmaps = 0;
		gameStates.render.nState = 0;
		gameOpts->render.color.nSaturation = nSaturation;
		Realloc ((m_list.nLightmaps + LIGHTMAP_BUFSIZE - 1) / LIGHTMAP_BUFSIZE);
		}
	else {
		CreateSpecial (m_data.texColor, 0, 0);
		m_list.nLightmaps = 1;
		for (int i = 0; i < gameData.segs.nFaces; i++)
			FACES.faces [i].nLightmap = 0;
		}
	BindAll ();
	Save (nLevel);
	}
return 1;
}