1 /*
2  *			GPAC - Multimedia Framework C SDK
3  *
4  *			Authors: Jean Le Feuvre
5  *			Copyright (c) Telecom ParisTech 2006-2012
6  *					All rights reserved
7  *
8  *  This file is part of GPAC / Symbian GUI player
9  *
10  *  GPAC is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU Lesser General Public License as published by
12  *  the Free Software Foundation; either version 2, or (at your option)
13  *  any later version.
14  *
15  *  GPAC is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; see the file COPYING.  If not, write to
22  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 
26 
27 // INCLUDE FILES
28 #include <avkon.hrh>
29 #include <eikmenup.h>
30 #include <akntitle.h>
31 
32 #include <stringloader.h>
33 #include <osmo4.rsg>
34 #include <f32file.h>
35 #include <s32file.h>
36 #include <bacline.h>
37 #include <eikbtgps.h>
38 #include <aknquerydialog.h>
39 
40 
41 #include "osmo4_ui.h"
42 #include "osmo4_view.h"
43 #include "playlist.h"
44 
45 #include <gpac/utf.h>
46 #include <gpac/options.h>
47 
48 
49 
50 // ============================ MEMBER FUNCTIONS ===============================
51 
52 
53 // -----------------------------------------------------------------------------
54 // Cosmo4AppUi::ConstructL()
55 // Symbian 2nd phase constructor can leave.
56 // -----------------------------------------------------------------------------
57 //
ConstructL()58 void COsmo4AppUi::ConstructL()
59 {
60 	// Initialise app UI with standard value.
61 	BaseConstructL(CAknAppUi::EAknEnableSkin);
62 
63 	/*Create display*/
64 	iAppView = COsmo4AppView::NewL( ClientRect() );
65 	AddToStackL(iAppView);
66 
67 	/*create playlist*/
68 #ifndef GPAC_GUI_ONLY
69 	iPlaylist = CPlaylist::NewL( ClientRect(), iAppView->GetUser() );
70 
71 	iPlaylist->MakeVisible(EFalse);
72 #endif
73 
74 	iAppView->MakeVisible(ETrue);
75 	view_mode = 0;
76 
77 	m_title = NULL;
78 
79 	//StatusPane ()->SwitchLayoutL ( R_AVKON_STATUS_PANE_LAYOUT_SMALL );
80 
81 	nb_keys = 0;
82 	CaptureKeys(1);
83 
84 
85 
86 	CCommandLineArguments *args = CCommandLineArguments::NewL();
87 #ifndef GPAC_GUI_ONLY
88 	if (args->Count() > 1) {
89 		TPtrC url = args->Arg(1);
90 #if defined(_UNICODE)
91 		char szURL[1024];
92 		u16 szURLUTF16[1024];
93 		size_t len;
94 		len = url.Size();
95 		memcpy(szURLUTF16, url.Ptr(), sizeof(u8)*len);
96 		szURLUTF16[len/2] = 0;
97 		const u16 *sptr = szURLUTF16;
98 		len = gf_utf8_wcstombs(szURL, 512, &sptr);
99 		if (len != (size_t) -1) {
100 			szURL[len] = 0;
101 			iAppView->Connect((const char *)szURL);
102 		}
103 #else
104 		iAppView->Connect((const char *)url.Ptr());
105 #endif
106 	}
107 #endif
108 	delete args;
109 }
110 
111 // -----------------------------------------------------------------------------
112 // COsmo4AppUi::COsmo4AppUi()
113 // C++ default constructor can NOT contain any code, that might leave.
114 // -----------------------------------------------------------------------------
115 //
COsmo4AppUi()116 COsmo4AppUi::COsmo4AppUi()
117 {
118 	// No implementation required
119 }
120 
121 // -----------------------------------------------------------------------------
122 // COsmo4AppUi::~COsmo4AppUi()
123 // Destructor.
124 // -----------------------------------------------------------------------------
125 //
~COsmo4AppUi()126 COsmo4AppUi::~COsmo4AppUi()
127 {
128 	CaptureKeys(0);
129 
130 	switch (view_mode) {
131 	case 0:
132 		if (iAppView) RemoveFromStack(iAppView);
133 		break;
134 	case 1:
135 		if (iPlaylist) RemoveFromStack(iPlaylist);
136 		break;
137 	}
138 	if (iAppView) delete iAppView;
139 	if (iPlaylist) delete iPlaylist;
140 	if (m_title) gf_free(m_title);
141 	m_title = NULL;
142 }
143 
144 
CaptureKey(TInt32 code,TInt32 scancode)145 void COsmo4AppUi::CaptureKey(TInt32 code, TInt32 scancode)
146 {
147 	RWindowGroup iWG = CCoeEnv::Static()->RootWin();
148 	if (nb_keys>=MAX_KEY_CAP) return;
149 	keys[nb_keys].key_cap = iWG.CaptureKey(code, 0, 0);
150 	keys[nb_keys].key_cap_ud = iWG.CaptureKeyUpAndDowns(scancode, 0, 0);
151 	nb_keys++;
152 }
153 /*
154 possible meaning for key codes:
155 EStdKeyYes          -Call
156 EStdKeyNo           -End
157 EStdKeyApplication0 -Apps key
158 EStdKeyDevice0      -Left softkey
159 EStdKeyDevice1      -Right softkey
160 EStdKeyDevice2      -Power
161 EStdKeyDevice3      -Button press
162 EStdKeyDevice4      -Flip - Open
163 EStdKeyDevice5      -Flip - Close
164 EStdKeyDevice6      -Side key
165 
166 EStdKeyDeviceD		-Jog Dial forward
167 EStdKeyDeviceE		-Jog Dial back
168 */
CaptureKeys(int do_capture)169 void COsmo4AppUi::CaptureKeys(int do_capture)
170 {
171 	if (do_capture) {
172 		CaptureKey(EKeyIncVolume, EStdKeyIncVolume);
173 		CaptureKey(EKeyDecVolume, EStdKeyDecVolume);
174 	} else {
175 		RWindowGroup iWG = CCoeEnv::Static()->RootWin();
176 		for (int i=0; i<nb_keys; i++) {
177 			iWG.CancelCaptureKey(keys[i].key_cap);
178 			iWG.CancelCaptureKeyUpAndDowns(keys[i].key_cap_ud);
179 		}
180 		nb_keys = 0;
181 	}
182 }
183 
184 
HandleForegroundEventL(TBool aForeground)185 void COsmo4AppUi::HandleForegroundEventL(TBool aForeground)
186 {
187 	CaptureKeys(aForeground ? 1 : 0);
188 	CAknAppUi::HandleForegroundEventL(aForeground);
189 }
190 
191 // -----------------------------------------------------------------------------
192 // COsmo4AppUi::HandleCommandL()
193 // Takes care of command handling.
194 // -----------------------------------------------------------------------------
195 //
HandleCommandL(TInt aCommand)196 void COsmo4AppUi::HandleCommandL( TInt aCommand )
197 {
198 	GF_Err e;
199 #ifndef GPAC_GUI_ONLY
200 	switch( aCommand ) {
201 	case EAknSoftkeyBack:
202 		if (view_mode==1) TogglePlaylist();
203 		break;
204 	case EEikCmdExit:
205 	case EAknSoftkeyExit:
206 		iAppView->Shutdown();
207 		Exit();
208 		break;
209 	/*PLAYLIST commands*/
210 	case EOsmo4PlayListAdd:
211 		iPlaylist->PlaylistAct(Osmo4PLAdd);
212 		break;
213 	case EOsmo4PlayListRem:
214 		iPlaylist->PlaylistAct(Osmo4PLRem);
215 		break;
216 	case EOsmo4PlayListMoveUp:
217 		iPlaylist->PlaylistAct(Osmo4PLMoveUp);
218 		break;
219 	case EOsmo4PlayListMoveDown:
220 		iPlaylist->PlaylistAct(Osmo4PLMoveDown);
221 		break;
222 	case EOsmo4PlayListClear:
223 		iPlaylist->PlaylistAct(Osmo4PLClear);
224 		break;
225 	case EOsmo4PlayListMode:
226 		iPlaylist->PlaylistAct(Osmo4PLToggleMode);
227 		break;
228 	case EOsmo4PlayListAllFiles:
229 		iPlaylist->PlaylistAct(Osmo4PLToggleAllFiles);
230 		break;
231 
232 	/*FILE menu command*/
233 	case EOsmo4PlayListView:
234 		TogglePlaylist();
235 		break;
236 	case EOsmo4OpenURL:
237 		break;
238 	case EOsmo4Fullscreen:
239 		break;
240 	case EOsmo4ViewMaxSize:
241 	{
242 		CEikStatusPane* statusPane = StatusPane();
243 		if (statusPane->IsVisible()) statusPane->MakeVisible(EFalse);
244 		else statusPane->MakeVisible(ETrue);
245 	}
246 	break;
247 	case EOsmo4AROriginal:
248 		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_KEEP);
249 		break;
250 	case EOsmo4ARFillScreen:
251 		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_FILL_SCREEN);
252 		break;
253 	case EOsmo4AR4_3:
254 		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_4_3);
255 		break;
256 	case EOsmo4AR16_9:
257 		gf_term_set_option(iAppView->m_term, GF_OPT_ASPECT_RATIO, GF_ASPECT_RATIO_16_9);
258 		break;
259 
260 	case EOsmo4NavReset:
261 		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE, 0);
262 		break;
263 	case EOsmo4NavNone:
264 		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_NONE);
265 		break;
266 	case EOsmo4NavSlide:
267 		e = gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_SLIDE);
268 		if (e) {
269 			GF_LOG(GF_LOG_ERROR, GF_LOG_CORE, ("Cannot set navigation: %s", gf_error_to_string(e) ));
270 		}
271 		break;
272 	case EOsmo4NavWalk:
273 		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_WALK);
274 		break;
275 	case EOsmo4NavFly:
276 		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_FLY);
277 		break;
278 	case EOsmo4NavExamine:
279 		gf_term_set_option(iAppView->m_term, GF_OPT_NAVIGATION, GF_NAVIGATE_EXAMINE);
280 		break;
281 	case EOsmo4NavHeadlight:
282 		gf_term_set_option(iAppView->m_term, GF_OPT_HEADLIGHT, !gf_term_get_option(iAppView->m_term, GF_OPT_HEADLIGHT) );
283 		break;
284 	case EOsmo4CollideNone:
285 		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NONE);
286 		break;
287 	case EOsmo4CollideSimple:
288 		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_NORMAL);
289 		break;
290 	case EOsmo4CollideDisp:
291 		gf_term_set_option(iAppView->m_term, GF_OPT_COLLISION, GF_COLLISION_DISPLACEMENT);
292 		break;
293 	case EOsmo4NavGravity:
294 		gf_term_set_option(iAppView->m_term, GF_OPT_GRAVITY, !gf_term_get_option(iAppView->m_term, GF_OPT_GRAVITY));
295 		break;
296 	case EOsmo4ViewRTI:
297 		iAppView->show_rti = !iAppView->show_rti;
298 		break;
299 
300 	case EOsmo4OptEnableLogs:
301 	{
302 		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "General", "Logs");
303 		if (opt && !stricmp(opt, "@debug")) {
304 			gf_cfg_set_key(iAppView->m_user.config, "General", "Logs", "all@error");
305 		} else {
306 			gf_cfg_set_key(iAppView->m_user.config, "General", "Logs", "all@debug");
307 		}
308 		iAppView->SetupLogs();
309 	}
310 	break;
311 	case EOsmo4OptOpenGL:
312 	{
313 		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "ForceOpenGL");
314 		Bool use_gl = (opt && !strcmp(opt, "yes")) ? 1 : 0;
315 		gf_cfg_set_key(iAppView->m_user.config, "Compositor", "ForceOpenGL", use_gl ? "no" : "yes");
316 		gf_term_set_option(iAppView->m_term, GF_OPT_USE_OPENGL, !use_gl);
317 	}
318 	break;
319 	case EOsmo4OptDirectDraw:
320 	{
321 		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "DirectDraw");
322 		Bool use_dd = (opt && !strcmp(opt, "yes")) ? 1 : 0;
323 		gf_cfg_set_key(iAppView->m_user.config, "Compositor", "DirectDraw", use_dd ? "no" : "yes");
324 		gf_term_set_option(iAppView->m_term, GF_OPT_DIRECT_DRAW, !use_dd);
325 	}
326 	break;
327 	case EOsmo4OptXMLProgressive:
328 	{
329 		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "SAXLoader", "Progressive");
330 		Bool use_prog = (opt && !strcmp(opt, "yes")) ? 1 : 0;
331 		gf_cfg_set_key(iAppView->m_user.config, "SAXLoader", "Progressive", use_prog ? "no" : "yes");
332 		gf_cfg_set_key(iAppView->m_user.config, "SAXLoader", "MaxDuration", "100");
333 	}
334 	break;
335 
336 	default:
337 		if ((aCommand>=EOsmo4OpenRecentFirst) && (aCommand<=EOsmo4OpenRecentLast)) {
338 			const char *sOpt = gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", aCommand - EOsmo4OpenRecentFirst);
339 			if (sOpt) iAppView->Connect(sOpt);
340 		} else {
341 			iAppView->MessageBox("Unandled command - panic", "Osmo4");
342 			Panic( EOsmo4Ui );
343 		}
344 		break;
345 	}
346 #endif
347 }
348 
349 
350 // -----------------------------------------------------------------------------
351 //  Called by the framework when the application status pane
352 //  size is changed.  Passes the new client rectangle to the
353 //  AppView
354 // -----------------------------------------------------------------------------
355 //
HandleStatusPaneSizeChange()356 void COsmo4AppUi::HandleStatusPaneSizeChange()
357 {
358 	iAppView->SetRect( ClientRect() );
359 #ifndef GPAC_GUI_ONLY
360 	iPlaylist->SetRect( ClientRect() );
361 #endif
362 }
363 
TogglePlaylist()364 void COsmo4AppUi::TogglePlaylist()
365 {
366 	CEikButtonGroupContainer* cba= CEikButtonGroupContainer::Current();
367 
368 #ifndef GPAC_GUI_ONLY
369 	switch (view_mode) {
370 	case 0:
371 		RemoveFromStack(iAppView);
372 		iAppView->ShowHide(0);
373 		AddToStackL(iPlaylist);
374 		if (cba) {
375 			cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
376 			cba->DrawDeferred();
377 		}
378 		view_was_max = StatusPane()->IsVisible() ? 0 : 1;
379 		if (view_was_max) StatusPane()->MakeVisible(ETrue);
380 		iPlaylist->ShowHide(1);
381 		view_mode = 1;
382 		break;
383 	case 1:
384 		RemoveFromStack(iPlaylist);
385 		iPlaylist->ShowHide(0);
386 		AddToStackL(iAppView);
387 		if (cba) {
388 			cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
389 			cba->DrawDeferred();
390 		}
391 		iAppView->ShowHide(1);
392 		if (view_was_max) StatusPane()->MakeVisible(EFalse);
393 		view_was_max = 0;
394 		view_mode = 0;
395 		break;
396 	}
397 #endif
398 }
399 
PlayURL(const char * url)400 void COsmo4AppUi::PlayURL(const char *url)
401 {
402 	if (view_mode) {
403 		TogglePlaylist();
404 	}
405 	if (url) {
406 		char *sep;
407 		iAppView->Connect(url);
408 		sep = strrchr(url, '\\');
409 		SetTitle(sep ? sep+1 : url);
410 	}
411 }
412 
SetTitleInfo(const char * title)413 void COsmo4AppUi::SetTitleInfo(const char *title)
414 {
415 #if 1
416 	CEikStatusPane* statusPane = StatusPane();
417 	CAknTitlePane *iTitlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
418 
419 	if (!title) title = "Osmo4";
420 
421 	HBufC *htitle = HBufC::NewL( strlen(title)+1);
422 	htitle->Des().Copy( TPtrC8(( TText8* ) title) );
423 	iTitlePane->SetText(htitle);
424 #endif
425 }
426 
SetTitle(const char * title,int store_it)427 void COsmo4AppUi::SetTitle(const char *title, int store_it)
428 {
429 	if (store_it) {
430 		if (m_title) gf_free(m_title);
431 		m_title = NULL;
432 		if (title) m_title = gf_strdup(title);
433 	}
434 	SetTitleInfo(title ? title : m_title);
435 }
436 
SetInfo(const char * info)437 void COsmo4AppUi::SetInfo(const char *info)
438 {
439 	if (view_mode) return;
440 	if (info) {
441 		char szTitle[200];
442 		sprintf(szTitle, "%s\n%s", info, m_title ? m_title : "Osmo4");
443 		SetTitleInfo(szTitle);
444 	} else {
445 		SetTitleInfo(m_title);
446 	}
447 }
448 
449 
450 #define DECLARE_MENU_ITEM(__text, __com, __check, __res, has_sep)	\
451 		item.iText = __text;	\
452 		item.iCommandId = __com;	\
453 		item.iFlags = has_sep ? EEikMenuItemSeparatorAfter : 0;	\
454 		if (__check) item.iFlags |= EEikMenuItemCheckBox | EEikMenuItemSymbolOn; \
455 		item.iCascadeId = __res;	\
456 		aMenuPane->AddMenuItemL(item);
457 
458 
DynInitMenuPaneL(TInt aResourceId,CEikMenuPane * aMenuPane)459 void COsmo4AppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
460 {
461 	CEikMenuPaneItem::SData item;
462 
463 	if (aResourceId==R_OSMO4_MENU) {
464 
465 		aMenuPane->Reset();
466 
467 		if (view_mode==1) {
468 #ifndef GPAC_GUI_ONLY
469 			Bool is_file = iPlaylist->SelectionIsFile();
470 			Bool in_pl = (is_file && iPlaylist->IsInPlaylist()) ? 1 : 0;
471 
472 			if (iPlaylist->PlaylistMode()) {
473 				DECLARE_MENU_ITEM(_L("Up"), EOsmo4PlayListMoveUp, 0, 0, 0);
474 				DECLARE_MENU_ITEM(_L("Down"), EOsmo4PlayListMoveDown, 0, 0, 0);
475 				DECLARE_MENU_ITEM(_L("Remove"), EOsmo4PlayListRem, 0, 0, 0);
476 				DECLARE_MENU_ITEM(_L("Clear"), EOsmo4PlayListClear, 0, 0, 1);
477 			} else if (!in_pl) {
478 				DECLARE_MENU_ITEM(_L("Add to PlayList"), EOsmo4PlayListAdd, 0, 0, 1);
479 			} else if (is_file) {
480 				DECLARE_MENU_ITEM(_L("Remove from Playlist"), EOsmo4PlayListRem, 0, 0, 1);
481 			}
482 
483 			if (! iPlaylist->PlaylistMode()) {
484 				DECLARE_MENU_ITEM(iPlaylist->ViewAllFiles() ? _L("View known files") : _L("View all files"), EOsmo4PlayListAllFiles, 0, 0, 1);
485 			} else {
486 				DECLARE_MENU_ITEM(_L("Sort"), 0, 0, R_OSMO4_SM1, 1);
487 			}
488 			DECLARE_MENU_ITEM(iPlaylist->PlaylistMode() ? _L("Browse") : _L("Playlist"), EOsmo4PlayListMode, 0, 0, 0);
489 #endif
490 		} else {
491 			/*open*/
492 			DECLARE_MENU_ITEM(_L("File"), 0, 0, R_OSMO4_SM1, 0);
493 			DECLARE_MENU_ITEM(_L("View"), 0, 0, R_OSMO4_SM2, 0);
494 			DECLARE_MENU_ITEM(_L("Options"), 0, 0, R_OSMO4_SM3, 0);
495 			//DECLARE_MENU_ITEM(_L("Exit"), EEikCmdExit, 0, 0, 0);
496 		}
497 		smenu_id = 0;
498 		return;
499 	}
500 	else if (aResourceId==R_OSMO4_SM1) {
501 		aMenuPane->Reset();
502 		/*sort menu*/
503 		if (view_mode==1) {
504 		}
505 		/*file menu*/
506 		else {
507 			DECLARE_MENU_ITEM(_L("Open local"), EOsmo4PlayListView, 0, 0, 0);
508 			DECLARE_MENU_ITEM(_L("Open URL"), EOsmo4OpenURL, 0, 0, 1);
509 #ifndef GPAC_GUI_ONLY
510 			if (gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", 0) != NULL) {
511 				DECLARE_MENU_ITEM(_L("Recent"), 0, 0, R_OSMO4_SSM1, 0);
512 			}
513 #endif
514 		}
515 		smenu_id = 1;
516 		return;
517 	}
518 	/*not used*/
519 	if (view_mode==1) return;
520 
521 	/*View menu*/
522 	if (aResourceId==R_OSMO4_SM2) {
523 		aMenuPane->Reset();
524 #ifndef GPAC_GUI_ONLY
525 		/*content view menu*/
526 		if (gf_term_get_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE) != GF_NAVIGATE_TYPE_NONE) {
527 			DECLARE_MENU_ITEM(_L("Navigate"), 0, 0, R_OSMO4_SSM1, 1);
528 		}
529 #endif
530 		DECLARE_MENU_ITEM(_L("Fullscreen"), EOsmo4Fullscreen, 0, 0, 0);
531 		/*don't allow content AR modification by user*/
532 		//DECLARE_MENU_ITEM(_L("Aspect Ratio"), 0, 0, R_OSMO4_SSM2, 1);
533 		DECLARE_MENU_ITEM(_L("Maximize size"), EOsmo4ViewMaxSize, (StatusPane()->IsVisible() ? 0 : 1), 0, 1);
534 		DECLARE_MENU_ITEM(_L("CPU Usage"), EOsmo4ViewRTI, iAppView->show_rti, 0, 0);
535 		smenu_id = 2;
536 		return;
537 	}
538 	/*Option menu*/
539 	if (aResourceId==R_OSMO4_SM3) {
540 #ifndef GPAC_GUI_ONLY
541 		const char *opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "ForceOpenGL");
542 		DECLARE_MENU_ITEM(_L("Use 2D OpenGL"), EOsmo4OptOpenGL, (opt && !strcmp(opt, "yes")) ? 1 : 0, 0, 0);
543 		opt = gf_cfg_get_key(iAppView->m_user.config, "Compositor", "DirectDraw");
544 		DECLARE_MENU_ITEM(_L("Direct Draw"), EOsmo4OptDirectDraw, (opt && !strcmp(opt, "yes")) ? 1 : 0, 0, 0);
545 		opt = gf_cfg_get_key(iAppView->m_user.config, "SAXLoader", "Progressive");
546 		DECLARE_MENU_ITEM(_L("Progressive XML"), EOsmo4OptXMLProgressive, (opt && !strcmp(opt, "yes")) ? 1 : 0, 0, 0);
547 
548 #endif
549 
550 		DECLARE_MENU_ITEM(_L("Enable Logs"), EOsmo4OptEnableLogs, iAppView->do_log, 0, 0);
551 		return;
552 	}
553 
554 	if (aResourceId==R_OSMO4_SSM1) {
555 		aMenuPane->Reset();
556 		if (smenu_id == 1) {
557 			u32 i = 0;
558 #ifndef GPAC_GUI_ONLY
559 			while (1) {
560 				const char *opt = gf_cfg_get_key_name(iAppView->m_user.config, "RecentFiles", i);
561 				if (!opt) break;
562 				const char *sep = strrchr(opt, '\\');
563 				if (!sep) sep = strrchr(opt, '/');
564 				if (!sep) sep = opt;
565 				else sep += 1;
566 				item.iText.Copy( TPtrC8(( TText8* ) sep)  );
567 				item.iCommandId = EOsmo4OpenRecentFirst + i;
568 				item.iFlags = 0;
569 				item.iCascadeId = 0;
570 				aMenuPane->AddMenuItemL(item);
571 				i++;
572 				if (i>=10) break;
573 			}
574 			if (!i) {
575 				DECLARE_MENU_ITEM(_L("_"), 0, 0, 0, 0);
576 			}
577 #endif
578 		} else if (smenu_id == 2) {
579 			DECLARE_MENU_ITEM(_L("Reset"), EOsmo4NavReset, 0, 0, 1);
580 			DECLARE_MENU_ITEM(_L("None"), EOsmo4NavNone, 0, 0, 0);
581 			DECLARE_MENU_ITEM(_L("Slide"), EOsmo4NavSlide, 0, 0, 0);
582 
583 #ifndef GPAC_GUI_ONLY
584 			if (gf_term_get_option(iAppView->m_term, GF_OPT_NAVIGATION_TYPE) == GF_NAVIGATE_TYPE_3D) {
585 				DECLARE_MENU_ITEM(_L("Walk"), EOsmo4NavWalk, 0, 0, 0);
586 				DECLARE_MENU_ITEM(_L("Fly"), EOsmo4NavFly, 0, 0, 0);
587 				DECLARE_MENU_ITEM(_L("Examine"), EOsmo4NavExamine, 0, 0, 1);
588 				DECLARE_MENU_ITEM(_L("Headlight"), EOsmo4NavHeadlight, 0, 0, 0);
589 				DECLARE_MENU_ITEM(_L("Gravity"), EOsmo4NavGravity, 0, 0, 0);
590 			}
591 #endif
592 		}
593 		return;
594 	}
595 
596 	if (aResourceId==R_OSMO4_SSM2) {
597 		aMenuPane->Reset();
598 		DECLARE_MENU_ITEM(_L("Keep Original"), EOsmo4AROriginal, 0, 0, 0);
599 		DECLARE_MENU_ITEM(_L("Fill Screen"), EOsmo4ARFillScreen, 0, 0, 0);
600 		DECLARE_MENU_ITEM(_L("Ratio 4-3"), EOsmo4AR4_3, 0, 0, 0);
601 		DECLARE_MENU_ITEM(_L("Ratio 16-9"), EOsmo4AR16_9, 0, 0, 0);
602 		return;
603 	}
604 }
605 
606