/// <summary> /// Generates the main screen consisting of title (top region), detail region and center region. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="view">The view of the main region.</param> /// <returns></returns> BrailleIOScreen buildMainScreen(int width, int height, LectorView view) { BrailleIOScreen mainScreen = new BrailleIOScreen(BS_MAIN_NAME); mainScreen.SetHeight(height); mainScreen.SetWidth(width); var center = getMainScreenCenterRegion(0, 0, width, height); center.ShowScrollbars = true; var center2 = getMainScreenCenter2Region(0, 0, width, height); center2.ShowScrollbars = true; center2.SetVisibility(false); center2.SetZoom(1); var top = getMainTopRegion(0, 0, width, 7); var status = getMainStatusRegion(width - 12, 0, 12, 5); status.SetText(LectorStateNames.STANDARD_MODE); var detail = getMainDetailRegion(0, height - 7, width, 7); detail.ShowScrollbars = true; // make the region scrollable // make the BrailleRenderer to ignore the last line space detail.SetText(LL.GetTrans("tangram.lector.wm.no_element_selected")); // set text to enable the BrailleRenderer var renderer = detail.ContentRender; if (renderer != null && renderer is MatrixBrailleRenderer) { ((MatrixBrailleRenderer)renderer).RenderingProperties |= RenderingProperties.IGNORE_LAST_LINESPACE; } mainScreen.AddViewRange(VR_CENTER_2_NAME, center2); mainScreen.AddViewRange(VR_CENTER_NAME, center); mainScreen.AddViewRange(VR_TOP_NAME, top); mainScreen.AddViewRange(VR_STATUS_NAME, status); mainScreen.AddViewRange(VR_DETAIL_NAME, detail); setRegionContent(mainScreen, VR_TOP_NAME, MAINSCREEN_TITLE); setRegionContent(mainScreen, VR_DETAIL_NAME, LL.GetTrans("tangram.lector.wm.no_element_selected")); currentView = view; fillMainCenterContent(mainScreen); if (io != null) { io.AddView(BS_MAIN_NAME, mainScreen); io.ShowView(BS_MAIN_NAME); io.RefreshDisplay(true); } return(mainScreen); }
/// <summary> /// Change view and interaction mode. /// </summary> /// <param name="view">new mode</param> public bool ChangeLectorView(LectorView view) { if (!view.Equals(currentView)) { currentView = view; if (view.Equals(LectorView.Braille)) { //InteractionManager.ChangeMode(InteractionMode.Braille); } else if (view.Equals(LectorView.Drawing)) { InteractionManager.ChangeMode(InteractionMode.Normal); } updateStatusRegionContent(); return(true); } else { return(false); } }
/// <summary> /// Generates the main screen consisting of title (top region), detail region and center region. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="view">The view of the main region.</param> /// <returns></returns> BrailleIOScreen buildMainScreen(int width, int height, LectorView view) { BrailleIOScreen mainScreen = new BrailleIOScreen(BS_MAIN_NAME); mainScreen.SetHeight(height); mainScreen.SetWidth(width); var center = getMainScreenCenterRegion(0, 0, width, height); center.ShowScrollbars = true; var center2 = getMainScreenCenter2Region(0, 0, width, height); center2.ShowScrollbars = true; center2.SetVisibility(false); center2.SetZoom(1); var top = getMainTopRegion(0, 0, width, 7); var status = getMainStatusRegion(width -12, 0, 12, 5); status.SetText(LectorStateNames.STANDARD_MODE); var detail = getMainDetailRegion(0, height-7, width, 7); detail.ShowScrollbars = true; // make the region scrollable // make the BrailleRenderer to ignore the last line space detail.SetText(LL.GetTrans("tangram.lector.wm.no_element_selected")); // set text to enable the BrailleRenderer var renderer = detail.ContentRender; if (renderer != null && renderer is MatrixBrailleRenderer) { ((MatrixBrailleRenderer)renderer).RenderingProperties |= RenderingProperties.IGNORE_LAST_LINESPACE; } mainScreen.AddViewRange(VR_CENTER_2_NAME, center2); mainScreen.AddViewRange(VR_CENTER_NAME, center); mainScreen.AddViewRange(VR_TOP_NAME, top); mainScreen.AddViewRange(VR_STATUS_NAME, status); mainScreen.AddViewRange(VR_DETAIL_NAME, detail); setRegionContent(mainScreen, VR_TOP_NAME, MAINSCREEN_TITLE); setRegionContent(mainScreen, VR_DETAIL_NAME, LL.GetTrans("tangram.lector.wm.no_element_selected")); currentView = view; fillMainCenterContent(mainScreen); if (io != null) { io.AddView(BS_MAIN_NAME, mainScreen); io.ShowView(BS_MAIN_NAME); io.RefreshDisplay(true); } return mainScreen; }
/// <summary> /// Change view and interaction mode. /// </summary> /// <param name="view">new mode</param> public bool ChangeLectorView(LectorView view) { if (!view.Equals(currentView)) { currentView = view; if (view.Equals(LectorView.Braille)) { InteractionManager.ChangeMode(InteractionMode.Braille); } else if (view.Equals(LectorView.Drawing)) { InteractionManager.ChangeMode(InteractionMode.Normal); } updateStatusRegionContent(); return true; } else return false; }