bildschirmformat umschaltung unter roter taste

Das Original Benutzerinterface Neutrino-SD incl. zapit, sectionsd, yWeb etc...
wittinobi
Einsteiger
Einsteiger
Beiträge: 116
Registriert: Montag 29. März 2004, 22:00

bildschirmformat umschaltung unter roter taste

Beitrag von wittinobi »

huhu,
also eigentlich will ich nur den menu punkt "einstellungen > video > bildschirmformat" zusätzlich noch unter roter taste (epg/vorschau) einfügen.

der menu-punkt sollte diese stelle in neutrino.cpp sein (zeile 2155-2262 rot markierter bereich):

Code: Alles auswählen

#define VIDEOMENU_VIDEOSIGNAL_OPTION_COUNT 5
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOSIGNAL_OPTIONS[VIDEOMENU_VIDEOSIGNAL_OPTION_COUNT] =
{
	{ 1, LOCALE_VIDEOMENU_VIDEOSIGNAL_RGB       },
	{ 2, LOCALE_VIDEOMENU_VIDEOSIGNAL_SVIDEO    },
	{ 3, LOCALE_VIDEOMENU_VIDEOSIGNAL_YUV_V     },
	{ 4, LOCALE_VIDEOMENU_VIDEOSIGNAL_YUV_C     },
	{ 0, LOCALE_VIDEOMENU_VIDEOSIGNAL_COMPOSITE }
};

#define VIDEOMENU_VCRSIGNAL_OPTION_COUNT 2
const CMenuOptionChooser::keyval VIDEOMENU_VCRSIGNAL_OPTIONS[VIDEOMENU_VCRSIGNAL_OPTION_COUNT] =
{
	{ 2, LOCALE_VIDEOMENU_VCRSIGNAL_SVIDEO    },
	{ 0, LOCALE_VIDEOMENU_VCRSIGNAL_COMPOSITE }
};

[color=red]#define VIDEOMENU_VIDEOFORMAT_OPTION_COUNT 4
const CMenuOptionChooser::keyval VIDEOMENU_VIDEOFORMAT_OPTIONS[VIDEOMENU_VIDEOFORMAT_OPTION_COUNT] =
{
	{ 2, LOCALE_VIDEOMENU_VIDEOFORMAT_43         },
	{ 3, LOCALE_VIDEOMENU_VIDEOFORMAT_431        },
	{ 1, LOCALE_VIDEOMENU_VIDEOFORMAT_169        },
	{ 0, LOCALE_VIDEOMENU_VIDEOFORMAT_AUTODETECT }
};[/color]

class CVideoSettings : public CMenuWidget, CChangeObserver
{
	CMenuForwarder *   SyncControlerForwarder;
	CMenuOptionChooser * VcrVideoOutSignalOptionChooser;
	CRGBCSyncControler RGBCSyncControler;
	CScreenSetup       ScreenSetup;
	int                video_out_signal;
	int                vcr_video_out_signal;

public:
	CVideoSettings() : CMenuWidget(LOCALE_VIDEOMENU_HEAD, "video.raw"), RGBCSyncControler(LOCALE_VIDEOMENU_RGB_CENTERING, &g_settings.video_csync)
		{
			addItem(GenericMenuSeparator);
			addItem(GenericMenuBack);
			addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VIDEOMENU_TV_SCART));

			addItem(new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOSIGNAL, &video_out_signal, VIDEOMENU_VIDEOSIGNAL_OPTIONS, VIDEOMENU_VIDEOSIGNAL_OPTION_COUNT, true, this));

			[color=red]CMenuOptionChooser * oj = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this);

			if (g_settings.video_Format == CControldClient::VIDEOFORMAT_AUTO)
			{
				changeNotify(LOCALE_VIDEOMENU_VIDEOFORMAT, NULL);
			}

			addItem(oj);[/color]

			SyncControlerForwarder = new CMenuForwarder(LOCALE_VIDEOMENU_RGB_CENTERING, false, NULL, &RGBCSyncControler);
			addItem(SyncControlerForwarder);

			addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VIDEOMENU_VCR_SCART));
			// Switching VCR Output presently does not work on the Philips.
			if (g_info.box_Type != CControld::TUXBOX_MAKER_PHILIPS)
			{
				VcrVideoOutSignalOptionChooser = new CMenuOptionChooser(LOCALE_VIDEOMENU_VCRSIGNAL, &vcr_video_out_signal, VIDEOMENU_VCRSIGNAL_OPTIONS, VIDEOMENU_VCRSIGNAL_OPTION_COUNT, false, this);
				addItem(VcrVideoOutSignalOptionChooser);
			}
			else
				VcrVideoOutSignalOptionChooser = 0;
			addItem(new CMenuOptionChooser(LOCALE_VIDEOMENU_VCRSWITCH, &g_settings.vcr_AutoSwitch, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));

			addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_VIDEOMENU_OSD));
			addItem(new CMenuForwarder(LOCALE_VIDEOMENU_SCREENSETUP, true, NULL, &ScreenSetup));
		};

	virtual bool changeNotify(const neutrino_locale_t OptionName, void *)
		{
			if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOSIGNAL))
			{
				while ((vcr_video_out_signal) == CControldClient::VIDEOOUTPUT_SVIDEO && (video_out_signal != CControldClient::VIDEOOUTPUT_SVIDEO) && (video_out_signal != CControldClient::VIDEOOUTPUT_COMPOSITE) )
					video_out_signal = (video_out_signal + 1) % 5;
				g_Controld->setVideoOutput(video_out_signal);
				if (VcrVideoOutSignalOptionChooser)
					VcrVideoOutSignalOptionChooser->setActive((video_out_signal == CControldClient::VIDEOOUTPUT_COMPOSITE) || (video_out_signal == CControldClient::VIDEOOUTPUT_SVIDEO));
				SyncControlerForwarder->setActive((video_out_signal == CControldClient::VIDEOOUTPUT_RGB) || (video_out_signal == CControldClient::VIDEOOUTPUT_YUV_VBS) || (video_out_signal == CControldClient::VIDEOOUTPUT_YUV_CVBS));
			}
			else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VCRSIGNAL))
			{
				g_Controld->setVCROutput(vcr_video_out_signal);
			}
			[color=red]else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOFORMAT))
			{
				g_Controld->setVideoFormat(g_settings.video_Format);
			}[/color]

			return true;
		};

	virtual void paint()
		{
			video_out_signal = g_Controld->getVideoOutput();
			vcr_video_out_signal = g_Controld->getVCROutput();

			if (VcrVideoOutSignalOptionChooser)
				VcrVideoOutSignalOptionChooser->active = ((video_out_signal == CControldClient::VIDEOOUTPUT_COMPOSITE) || (video_out_signal == CControldClient::VIDEOOUTPUT_SVIDEO));
			SyncControlerForwarder->active = ((video_out_signal == CControldClient::VIDEOOUTPUT_RGB) || (video_out_signal == CControldClient::VIDEOOUTPUT_YUV_VBS) || (video_out_signal ==  CControldClient::VIDEOOUTPUT_YUV_CVBS));

			[color=red]g_settings.video_Format = g_Controld->getVideoFormat();[/color]

			CMenuWidget::paint();
		};
};
hab jetzt die gesamte epg_menu.cpp mit in neutrino.cpp aufgenommen und um diesen menu-punkt (bildschirmformat) erweitert.
sieht so aus:

Code: Alles auswählen

void CNeutrinoApp::ShowEPGmenu()
{
	CMenuWidget EPGSelector(LOCALE_EPGMENU_HEAD, "features.raw", 350);

	// EPGSelector.addItem(GenericMenuSeparator);

	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, new CEventListHandler(), NULL, CRCInput::RC_red   , NEUTRINO_ICON_BUTTON_RED   ), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS   , true, NULL, new CEPGplusHandler()  , NULL, CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN ), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, new CEPGDataHandler()  , NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, new CStreamInfo2Handler()     , NULL, CRCInput::RC_blue  , NEUTRINO_ICON_BUTTON_BLUE  ), false);

	// Videoformat-Umschaltung
	EPGSelector.addItem(GenericMenuSeparatorLine);
	g_settings.video_Format = g_Controld->getVideoFormat();
	char old_video_format;
	old_video_format = g_settings.video_Format;
	CMenuOptionChooser * oj = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, NULL, CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL);
	if (g_settings.video_Format == CControldClient::VIDEOFORMAT_AUTO)
	{
		changeNotify(LOCALE_VIDEOMENU_VIDEOFORMAT, NULL);
	}
	if (g_settings.video_Format != old_video_format)
	{
		g_Controld->setVideoFormat(g_settings.video_Format);
	}
	EPGSelector.addItem(oj);
	EPGSelector.addItem(GenericMenuSeparator);

	EPGSelector.exec(NULL, "");
}
also die anzeige stimmt damit schonmal.
ich kann auch die verschiedenen formate auswählen.
aber die einstellungen werden einfach nicht übernommen.
jemand einen tip woran das liegt, oder was ich dabei überseh oder falsch mach ?

mfg
wittinobi
wittinobi
Einsteiger
Einsteiger
Beiträge: 116
Registriert: Montag 29. März 2004, 22:00

Beitrag von wittinobi »

huhu,
also inzwischen werden die einstellungen zwar übernommen, aber leider immer erst beim verlassen des menus.
der code sieht so aus (in neutrino.cpp):

Code: Alles auswählen

void CNeutrinoApp::ShowEPGmenu()
{
	CMenuWidget EPGSelector(LOCALE_EPGMENU_HEAD, "features.raw", 350);

	// EPGSelector.addItem(GenericMenuSeparator);

	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, new CEventListHandler(), NULL, CRCInput::RC_red   , NEUTRINO_ICON_BUTTON_RED   ), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS   , true, NULL, new CEPGplusHandler()  , NULL, CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN ), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, new CEPGDataHandler()  , NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
	EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, new CStreamInfo2Handler()     , NULL, CRCInput::RC_blue  , NEUTRINO_ICON_BUTTON_BLUE  ), false);

	// Bildschirmformat-Umschaltung
	EPGSelector.addItem(GenericMenuSeparatorLine);
	g_settings.video_Format = g_Controld->getVideoFormat();
	CMenuOptionChooser * oj = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this, CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL);
	if (g_settings.video_Format == CControldClient::VIDEOFORMAT_AUTO)
	{
		changeNotify(LOCALE_VIDEOMENU_VIDEOFORMAT, NULL);
	}
	EPGSelector.addItem(oj);
	EPGSelector.addItem(GenericMenuSeparator);

	EPGSelector.exec(NULL, "");

	g_Controld->setVideoFormat(g_settings.video_Format);
}
also wo könnte ich diesen befehl:

Code: Alles auswählen

g_Controld->setVideoFormat(g_settings.video_Format);
am besten platzieren, damit die einstellungen gleich beim auswählen übernommen werden, und nicht erst beim verlassen des menus.

kann mir da vielleicht jemand weiterhelfen ?

mfg
wittinobi
Günther
Developer
Beiträge: 587
Registriert: Freitag 9. September 2005, 21:48

Beitrag von Günther »

CMenuOptionChooser() bietet einen Parameter vom Typ CChangeObserver. Du mußte nur eine Klasse hiervon ableiten und in die Funktion changeNotify kannst Du dann das Umschalten einbauen (der aktuelle Wert wird in Data übergeben). Also in etwa so:

Code: Alles auswählen

class CFormatNotifier : public CChangeObserver
{
	private:
	public:
		CFormatNotifier ();
		bool changeNotify(const neutrino_locale_t, void *Data);
};
Ist alles ein bisschen verwurstelt, ich habe auch ein wenig gebraucht bis ich das gerafft hatte :) .

Günther
wittinobi
Einsteiger
Einsteiger
Beiträge: 116
Registriert: Montag 29. März 2004, 22:00

Beitrag von wittinobi »

huhu,
wollte noch danke für den tip sagen.
habs inzwischen so hinbekommen:

Code: Alles auswählen

class ShowmyEPGmenu : public CMenuWidget, CChangeObserver
{
	public:
		ShowmyEPGmenu()
		{
			CMenuWidget EPGSelector(LOCALE_EPGMENU_HEAD, "features.raw", 350);
			EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, new CEventListHandler(), NULL, CRCInput::RC_red   , NEUTRINO_ICON_BUTTON_RED   ), false);
			EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS   , true, NULL, new CEPGplusHandler()  , NULL, CRCInput::RC_green , NEUTRINO_ICON_BUTTON_GREEN ), false);
			EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, new CEPGDataHandler()  , NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
			EPGSelector.addItem(new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, new CStreamInfo2Handler()     , NULL, CRCInput::RC_blue  , NEUTRINO_ICON_BUTTON_BLUE  ), false);

			EPGSelector.addItem(GenericMenuSeparatorLine);
			CMenuOptionChooser * oj = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this, CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL);

			if (g_settings.video_Format == CControldClient::VIDEOFORMAT_AUTO)
			{
				changeNotify(LOCALE_VIDEOMENU_VIDEOFORMAT, NULL);
			}

			EPGSelector.addItem(oj);
			EPGSelector.addItem(GenericMenuSeparator);

			EPGSelector.exec(NULL, "");
		};

		virtual bool changeNotify(const neutrino_locale_t OptionName, void *)
		{
			if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_VIDEOFORMAT))
			{
				g_Controld->setVideoFormat(g_settings.video_Format);
			}
			return true;
		};

		virtual void paint()
		{
			g_settings.video_Format = g_Controld->getVideoFormat();
			CMenuWidget::paint();
		};
};

void CNeutrinoApp::ShowEPGmenu()
{
	ShowmyEPGmenu::ShowmyEPGmenu();
}
mfg
wittinobi