Пример #1
0
PLUGIN_API int XPluginStart(
						char *		outName,
						char *		outSig,
						char *		outDesc)
{
        int		PluginSubMenuItem;
	int             ChecklistsSubMenuItem;

         xcDebug("Xchecklist: ver " VERSION_NUMBER "\n");

        /* First set up our plugin info. */
        strcpy(outName, "Xchecklist ver " VERSION_NUMBER);
        strcpy(outSig, "Michal_Bill.Example.Xchecklist");
        strcpy(outDesc, "A plugin to display checklists in a widget window.");


  ext_view = XPLMFindDataRef("sim/graphics/view/view_is_external");

// Create our menu
        PluginSubMenuItem = XPLMAppendMenuItem(
                    XPLMFindPluginsMenu(),
                    "Xchecklist",
                    NULL,
                    1);

        PluginMenu = XPLMCreateMenu(
                    "Xchecklist",
                    XPLMFindPluginsMenu(),
                    PluginSubMenuItem,
                    xCheckListMenuHandler,
                    (void *)0);

        XPLMAppendMenuItem(PluginMenu, "Open CheckList", (void *) "checklist", 1);
        XPLMAppendMenuItem(PluginMenu, "Open Setup", (void *) "setup", 1);

        ChecklistsSubMenuItem = XPLMAppendMenuItem(
                    PluginMenu,
                    "CheckLists",
                    NULL,
                    1);

        checklistsMenu = XPLMCreateMenu(
                    "CheckLists",
                    PluginMenu,
                    ChecklistsSubMenuItem,
                    xCheckListMenuHandler,
                    (void *)1);

        XPLMAppendMenuItem(checklistsMenu, "CheckList1", (void *) 0, 1);
        XPLMAppendMenuItem(checklistsMenu, "CheckList2", (void *) 1, 1);


        cmdcheckitem = XPLMCreateCommand("bgood/xchecklist/check_item","Check Item");
        cmdnextchecklist = XPLMCreateCommand("bgood/xchecklist/next_checklist","Next Checklist");
        cmdprevchecklist = XPLMCreateCommand("bgood/xchecklist/prev_checklist","Prev Checklist");
        cmdhidechecklist = XPLMCreateCommand("bgood/xchecklist/hide_checklist","Hide Checklist");

        XPLMRegisterCommandHandler(
                    cmdcheckitem,
                    MyCommandCallback,
                    true,
                    (void *)CHECK_ITEM_COMMAND);

        XPLMRegisterCommandHandler(
                    cmdnextchecklist,
                    MyCommandCallback,
                    true,
                    (void *)NEXT_CHECKLIST_COMMAND);

        XPLMRegisterCommandHandler(
                    cmdprevchecklist,
                    MyCommandCallback,
                    true,
                    (void *)PREV_CHECKLIST_COMMAND);

        XPLMRegisterCommandHandler(
                    cmdhidechecklist,
                    MyCommandCallback,
                    true,
                    (void *)HIDE_CHECKLIST_COMMAND);

        return 1;
}
Пример #2
0
void sp_init() {
//	XPLMDebugString("-> CP: sp_controller.sp_init.\n");
    gSpMagnetosOff1CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_1_CR);
    gSpMagnetosOff2CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_2_CR);
    gSpMagnetosOff3CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_3_CR);
    gSpMagnetosOff4CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_4_CR);
    gSpMagnetosOff5CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_5_CR);
    gSpMagnetosOff6CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_6_CR);
    gSpMagnetosOff7CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_7_CR);
    gSpMagnetosOff8CmdRef  = XPLMFindCommand(sSP_MAGNETOS_OFF_8_CR);
    gSpMagnetosRight1CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_1_CR);
    gSpMagnetosRight2CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_2_CR);
    gSpMagnetosRight3CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_3_CR);
    gSpMagnetosRight4CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_4_CR);
    gSpMagnetosRight5CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_5_CR);
    gSpMagnetosRight6CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_6_CR);
    gSpMagnetosRight7CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_7_CR);
    gSpMagnetosRight8CmdRef  = XPLMFindCommand(sSP_MAGNETOS_RIGHT_8_CR);
    gSpMagnetosLeft1CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_1_CR);
    gSpMagnetosLeft2CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_2_CR);
    gSpMagnetosLeft3CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_3_CR);
    gSpMagnetosLeft4CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_4_CR);
    gSpMagnetosLeft5CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_5_CR);
    gSpMagnetosLeft6CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_6_CR);
    gSpMagnetosLeft7CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_7_CR);
    gSpMagnetosLeft8CmdRef  = XPLMFindCommand(sSP_MAGNETOS_LEFT_8_CR);
    gSpMagnetosBoth1CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_1_CR);
    gSpMagnetosBoth2CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_2_CR);
    gSpMagnetosBoth3CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_3_CR);
    gSpMagnetosBoth4CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_4_CR);
    gSpMagnetosBoth5CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_5_CR);
    gSpMagnetosBoth6CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_6_CR);
    gSpMagnetosBoth7CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_7_CR);
    gSpMagnetosBoth8CmdRef  = XPLMFindCommand(sSP_MAGNETOS_BOTH_8_CR);
    gSpEngineStart1CmdRef  = XPLMFindCommand(sSP_ENGINE_START_1_CR);
    gSpEngineStart2CmdRef  = XPLMFindCommand(sSP_ENGINE_START_2_CR);
    gSpEngineStart3CmdRef  = XPLMFindCommand(sSP_ENGINE_START_3_CR);
    gSpEngineStart4CmdRef  = XPLMFindCommand(sSP_ENGINE_START_4_CR);
    gSpEngineStart5CmdRef  = XPLMFindCommand(sSP_ENGINE_START_5_CR);
    gSpEngineStart6CmdRef  = XPLMFindCommand(sSP_ENGINE_START_6_CR);
    gSpEngineStart7CmdRef  = XPLMFindCommand(sSP_ENGINE_START_7_CR);
    gSpEngineStart8CmdRef  = XPLMFindCommand(sSP_ENGINE_START_8_CR);

    // battery
    gSpMasterBatteryOnCmdRef  = XPLMFindCommand(sSP_MASTER_BATTERY_ON_CR);
    gSpMasterBatteryOffCmdRef  = XPLMFindCommand(sSP_MASTER_BATTERY_OFF_CR);
    gSpMasterAltBatteryOnCmdRef  = XPLMFindCommand(sSP_MASTER_ALT_BATTERY_ON_CR);
    gSpMasterAltBatteryOffCmdRef  = XPLMFindCommand(sSP_MASTER_ALT_BATTERY_OFF_CR);

    gSpGeneratorOn1CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_1_CR);
    gSpGeneratorOff1CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_1_CR);
    gSpGeneratorOn2CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_2_CR);
    gSpGeneratorOff2CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_2_CR);
    gSpGeneratorOn3CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_3_CR);
    gSpGeneratorOff3CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_3_CR);
    gSpGeneratorOn4CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_4_CR);
    gSpGeneratorOff4CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_4_CR);
    gSpGeneratorOn5CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_5_CR);
    gSpGeneratorOff5CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_5_CR);
    gSpGeneratorOn6CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_6_CR);
    gSpGeneratorOff6CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_6_CR);
    gSpGeneratorOn7CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_7_CR);
    gSpGeneratorOff7CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_7_CR);
    gSpGeneratorOn8CmdRef = XPLMFindCommand(sSP_GENERATOR_ON_8_CR);
    gSpGeneratorOff8CmdRef = XPLMFindCommand(sSP_GENERATOR_OFF_8_CR);

    // various
    gSpMasterAvionicsOnCmdRef  = XPLMFindCommand(sSP_MASTER_AVIONICS_ON_CR);
    gSpMasterAvionicsOffCmdRef  = XPLMFindCommand(sSP_MASTER_AVIONICS_OFF_CR);
    gSpFuelPumpOn1CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_1_CR);
    gSpFuelPumpOff1CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_1_CR);
    gSpFuelPumpOn2CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_2_CR);
    gSpFuelPumpOff2CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_2_CR);
    gSpFuelPumpOn3CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_3_CR);
    gSpFuelPumpOff3CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_3_CR);
    gSpFuelPumpOn4CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_4_CR);
    gSpFuelPumpOff4CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_4_CR);
    gSpFuelPumpOn5CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_5_CR);
    gSpFuelPumpOff5CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_5_CR);
    gSpFuelPumpOn6CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_6_CR);
    gSpFuelPumpOff6CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_6_CR);
    gSpFuelPumpOn7CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_7_CR);
    gSpFuelPumpOff7CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_7_CR);
    gSpFuelPumpOn8CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_ON_8_CR);
    gSpFuelPumpOff8CmdRef  = XPLMFindCommand(sSP_FUEL_PUMP_OFF_8_CR);
    gSpDeIceOnCmdRef  = XPLMFindCommand(sSP_DE_ICE_ON_CR);
    gSpDeIceOffCmdRef  = XPLMFindCommand(sSP_DE_ICE_OFF_CR);
    gSpPitotHeatOnCmdRef  = XPLMFindCommand(sSP_PITOT_HEAT_ON_CR);
    gSpPitotHeatOffCmdRef  = XPLMFindCommand(sSP_PITOT_HEAT_OFF_CR);

    gSpCowlClosedCmdRef  = XPLMFindCommand(sSP_COWL_CLOSED_CR);
    gSpCowlOpenCmdRef  = XPLMFindCommand(sSP_COWL_OPEN_CR);

    // lights
    gSpLightsPanelOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_PANEL_ON_CR);
    gSpLightsPanelOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_PANEL_OFF_CR);
    gSpLightsBeaconOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_BEACON_ON_CR);
    gSpLightsBeaconOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_BEACON_OFF_CR);
    gSpLightsNavOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_NAV_ON_CR);
    gSpLightsNavOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_NAV_OFF_CR);
    gSpLightsStrobeOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_STROBE_ON_CR);
    gSpLightsStrobeOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_STROBE_OFF_CR);
    gSpLightsTaxiOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_TAXI_ON_CR);
    gSpLightsTaxiOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_TAXI_OFF_CR);
    gSpLightsLandingOnCmdRef  = XPLMFindCommand(sSP_LIGHTS_LANDING_ON_CR);
    gSpLightsLandingOffCmdRef  = XPLMFindCommand(sSP_LIGHTS_LANDING_OFF_CR);

    // landing gear
    gSpLandingGearUpCmdRef  = XPLMFindCommand(sSP_LANDING_GEAR_UP_CR);
    gSpLandingGearDownCmdRef  = XPLMFindCommand(sSP_LANDING_GEAR_DOWN_CR);

    XPLMRegisterCommandHandler(gSpMagnetosOff1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MAGNETOS_OFF);
    XPLMRegisterCommandHandler(gSpMagnetosRight1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MAGNETOS_RIGHT);
    XPLMRegisterCommandHandler(gSpMagnetosLeft1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MAGNETOS_LEFT);
    XPLMRegisterCommandHandler(gSpMagnetosBoth1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MAGNETOS_BOTH);
    XPLMRegisterCommandHandler(gSpEngineStart1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_ENGINE_START);
    XPLMRegisterCommandHandler(gSpMasterBatteryOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_BATTERY_ON);
    XPLMRegisterCommandHandler(gSpMasterBatteryOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_BATTERY_OFF);
    XPLMRegisterCommandHandler(gSpMasterAltBatteryOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_ALT_BATTERY_ON);
    XPLMRegisterCommandHandler(gSpMasterAltBatteryOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_ALT_BATTERY_OFF);
    XPLMRegisterCommandHandler(gSpGeneratorOn1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_GENERATOR_ON);
    XPLMRegisterCommandHandler(gSpGeneratorOff1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_GENERATOR_OFF);
    XPLMRegisterCommandHandler(gSpMasterAvionicsOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_AVIONICS_ON);
    XPLMRegisterCommandHandler(gSpMasterAvionicsOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_MASTER_AVIONICS_OFF);
    XPLMRegisterCommandHandler(gSpFuelPumpOn1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_FUEL_PUMP_ON);
    XPLMRegisterCommandHandler(gSpFuelPumpOff1CmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_FUEL_PUMP_OFF);
    XPLMRegisterCommandHandler(gSpDeIceOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_DEICE_ON);
    XPLMRegisterCommandHandler(gSpDeIceOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_DEICE_OFF);
    XPLMRegisterCommandHandler(gSpPitotHeatOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_PITOT_HEAT_ON);
    XPLMRegisterCommandHandler(gSpPitotHeatOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_PITOT_HEAT_OFF);
    XPLMRegisterCommandHandler(gSpCowlClosedCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_COWL_CLOSED);
    XPLMRegisterCommandHandler(gSpCowlOpenCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_COWL_OPEN);

    XPLMRegisterCommandHandler(gSpLightsPanelOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_PANEL_ON);
    XPLMRegisterCommandHandler(gSpLightsPanelOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_PANEL_OFF);
    XPLMRegisterCommandHandler(gSpLightsBeaconOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_BEACON_ON);
    XPLMRegisterCommandHandler(gSpLightsBeaconOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_BEACON_OFF);
    XPLMRegisterCommandHandler(gSpLightsNavOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_NAV_ON);
    XPLMRegisterCommandHandler(gSpLightsNavOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_NAV_OFF);
    XPLMRegisterCommandHandler(gSpLightsStrobeOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_STROBE_ON);
    XPLMRegisterCommandHandler(gSpLightsStrobeOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_STROBE_OFF);
    XPLMRegisterCommandHandler(gSpLightsTaxiOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_TAXI_ON);
    XPLMRegisterCommandHandler(gSpLightsTaxiOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_TAXI_OFF);
    XPLMRegisterCommandHandler(gSpLightsLandingOnCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_LANDING_ON);
    XPLMRegisterCommandHandler(gSpLightsLandingOffCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LIGHTS_LANDING_OFF);
    XPLMRegisterCommandHandler(gSpLandingGearUpCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LANDING_GEAR_UP);
    XPLMRegisterCommandHandler(gSpLandingGearDownCmdRef, SwitchPanelCommandHandler, CMD_HNDLR_PROLOG, (void *) SP_CMD_LANDING_GEAR_DOWN);

    /*----- SwitchPanel Data Ref Assignment -----*/
    gSpNumberOfBatteriesDataRef = XPLMFindDataRef(sSP_NUMBER_OF_BATTERIES_DR);
    gSpNumberOfGeneratorsDataRef = XPLMFindDataRef(sSP_NUMBER_OF_GENERATORS_DR);
    gSpNumberOfEnginesDataRef = XPLMFindDataRef(sSP_NUMBER_OF_ENGINES_DR);
    gSpGearRetractDataRef = XPLMFindDataRef(sSP_GEAR_RETRACT_DR);
    gSpOnGroundDataRef = XPLMFindDataRef(sSP_ON_GROUND_DR);
    gSpLandingGearStatusDataRef = XPLMFindDataRef(sSP_LANDING_GEAR_STATUS_DR);
    gSpGear1FailDataRef = XPLMFindDataRef(sSP_GEAR_1_FAIL_DR);
    gSpGear2FailDataRef = XPLMFindDataRef(sSP_GEAR_2_FAIL_DR);
    gSpGear3FailDataRef = XPLMFindDataRef(sSP_GEAR_3_FAIL_DR);
    gSpAntiIceDataRef = XPLMFindDataRef(sSP_ANTI_ICE_DR);
    gSpCowlFlapsDataRef = XPLMFindDataRef(sSP_COWL_FLAPS_DR);
    gSpCockpitLightsDataRef = XPLMFindDataRef(sSP_COCKPIT_LIGHTS_DR);
    gSpBatteryArrayOnDataRef = XPLMFindDataRef(sSP_BATTERY_ARRAY_ON_DR);
    sp_update_datarefs();
}