public override void Resize(int width, int height) { title.SetLeft(2); title.SetTop(2); title.SetWidth(width - 4); title.SetHeight(width - 4); title.SetText(ll.GetTrans("game.title") + "\n" + ll.GetTrans("game.keybindings1") + "\n" + ll.GetTrans("game.keybindings2") + "\n" + ll.GetTrans("game.keybindings3") + "\n" + ll.GetTrans("game.keybindings4")); }
public StartScreen(LL ll, int width, int height) : base("StartScreen") { this.ll = ll; title = new BrailleIOViewRange(2, 2, width - 4, height - 4); title.SetText(ll.GetTrans("game.title") + "\n" + ll.GetTrans("game.keybindings1") + "\n" + ll.GetTrans("game.keybindings2") + "\n" + ll.GetTrans("game.keybindings3") + "\n" + ll.GetTrans("game.keybindings4")); AddViewRange(title); }
/// <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> /// Creats a group object /// </summary> /// <returns>The Shape observer for the newly created group or <c>null</c>.</returns> private OoShapeObserver createGroup() { OoShapeObserver group = null; OoAccessibleDocWnd draw = null; OoDrawPagesObserver doc = null; OoDrawPageObserver page = null; if (IsShapeSelected && LastSelectedShape != null) { page = LastSelectedShape.Page; doc = page.PagesObserver; draw = doc.DocWnd; } else { // TODO: how to get those things } if (doc != null && draw != null && draw.DrawPageSupplier != null) { Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[DRAWING]\t[CREATE]\t" + "build group shape"); var grpShape = OoDrawUtils.CreateGroupShape_anonymous(draw.DrawPageSupplier); OoUtils.SetStringProperty(grpShape, "Name", LL.GetTrans("tangram.oomanipulation.shape.group")); if (page != null && page.DrawPage_anonymouse != null) { var pageObj = page.DrawPage_anonymouse; OoDrawUtils.AddShapeToDrawPageUndoable(grpShape, pageObj, draw.DrawPageSupplier); group = doc.RegisterNewShape(grpShape); } } return(group); }
/// <summary> /// Gets a compressed textual description for Braille text output for a polygon point. /// </summary> /// <param name="pointsObs">The points observer.</param> /// <returns>a string suitable for short Braille output.</returns> public static string GetPointText(OoPolygonPointsObserver pointsObs) { if (pointsObs != null) { int index; var point = pointsObs.Current(out index); if (!point.Equals(default(PolyPointDescriptor))) { index += 1; string nodeType = LL.GetTrans("tangram.oomanipulation.element_speaker.label." + point.Flag.ToString()); // remove one point from count if first and last point is equal int count = pointsObs.Count - (pointsObs.FirstPointEqualsLastPoint() ? 1 : 0); String text = LL.GetTrans("tangram.oomanipulation.element_speaker.text.point", nodeType, index, count, (((float)point.X / 1000f)).ToString("0.##cm"), (((float)point.Y / 1000f)).ToString("0.##cm") ); //point.Flag.ToString() + " (" + index + "/" + pointsObs.Count + ") - x:" + point.X + " y:" + point.Y; return(text); } } return(String.Empty); }
/// <summary> /// Initializes the audio renderer. /// Set the Voice to 'Steffi' if available. Play a sound and speak welcome message. /// </summary> private void initializeAudioRenderer() { logger.Log(LogPriority.DEBUG, this, "Installed voices: [" + String.Join("] [", audioRenderer.GetVoices()) + "]"); // get voice from user-settings String stdVoice = Properties.Settings.Default.sound_voice; if (!String.IsNullOrWhiteSpace(stdVoice)) { logger.Log(LogPriority.DEBUG, this, "User setting 'sound_voice': " + stdVoice); audioRenderer.SetStandardVoiceName(stdVoice); } // get speed from user-settings int vSpeed = Properties.Settings.Default.sound_speed; logger.Log(LogPriority.DEBUG, this, "User setting 'sound_speed': " + vSpeed); AudioRenderer.Speed = vSpeed; // get volume from user-settings int vVolume = Properties.Settings.Default.sound_volume; logger.Log(LogPriority.DEBUG, this, "User setting 'sound_volume': " + vVolume); AudioRenderer.Volume = vVolume; audioRenderer.PlayWave(StandardSounds.Start); audioRenderer.PlaySound(LL.GetTrans("tangram.lector.bio.welcome")); }
/// <summary> /// Gets an audio description for auditory output for a polygon point. /// </summary> /// <param name="pointsObs">The points observer.</param> /// <returns>a string suitable for auditory output.</returns> public static string GetPointAudio(OoPolygonPointsObserver pointsObs) { if (pointsObs != null) { int index; var point = pointsObs.Current(out index); if (!point.Equals(default(PolyPointDescriptor))) { index += 1; string nodeType = LL.GetTrans("tangram.oomanipulation.element_speaker.label." + point.Flag.ToString()); // remove one point from count if first and last point is equal int count = pointsObs.Count - (pointsObs.FirstPointEqualsLastPoint() ? 1 : 0); String audio = LL.GetTrans("tangram.oomanipulation.element_speaker.audio.point", nodeType, index, count ); return(audio); } } return(String.Empty); }
public static string PlayElementTitleAndDescriptionImmediately(OoShapeObserver element) { String text = GetElementAudioText(element); if (!String.IsNullOrWhiteSpace(element.Description)) { text += " - " + LL.GetTrans("tangram.oomanipulation.element_speaker.description", element.Description); } if (!String.IsNullOrWhiteSpace(text)) { audio.PlaySoundImmediately(text); } return(text); }
/// <summary> /// Brings the last selected shape to the audio output. /// <param name="immediately">determine if the text should palyed immediately or not.</param> /// </summary> public void SayLastSelectedShape(bool immediately = true) { if (LastSelectedShape != null) { if (immediately) { OoElementSpeaker.PlayElementImmediately(LastSelectedShape, LL.GetTrans("tangram.oomanipulation.selected")); } else { OoElementSpeaker.PlayElement(LastSelectedShape, LL.GetTrans("tangram.oomanipulation.selected")); } } else { play(LL.GetTrans("tangram.oomanipulation.no_element_selected"), immediately); } }
/// <summary> /// Initializes this instance. /// </summary> static void init() { if (ll != null) { if (String.IsNullOrEmpty(Separator)) { Separator = ll.GetTrans("breadcrumb.seperator"); } if (String.IsNullOrEmpty(Suppressor)) { Suppressor = ll.GetTrans("breadcrumb.suppressor"); } if (String.IsNullOrEmpty(Omission)) { Omission = ll.GetTrans("breadcrumb.omission"); } } }
private void jumpToTopBorder(BrailleIOViewRange center) { if (center != null) { center.SetYOffset(0); io.RefreshDisplay(); audioRenderer.PlaySoundImmediately(LL.GetTrans("tangram.lector.wm.panning.jump.up")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION] jump to top"); } }
// TODO: correct toggle function for active detail area view range private void toggleFullDetailScreen() { BrailleIOScreen vs = GetVisibleScreen(); BrailleIOViewRange detailVR = vs.GetViewRange(VR_DETAIL_NAME); // TODO: ImageData class creates own detail area --> do not use global detailarea BrailleIOViewRange topVR = vs.GetViewRange(VR_TOP_NAME); detailVR.SetHeight(deviceSize.Height - topVR.GetHeight()); detailVR.SetTop(topVR.GetHeight() - 3); io.RefreshDisplay(); audioRenderer.PlaySoundImmediately(LL.GetTrans("tangram.lector.wm.views.detail_maximize")); }
/// <summary> /// Groups the current selected obejct into a group /// </summary> /// <returns><c>true</c> if the shape was added to a group successfully; otherwise, <c>false</c>.</returns> private bool grouping() { if (IsShapeSelected && LastSelectedShape != null) { OoAccessibleDocWnd draw = null; OoDrawPagesObserver doc = null; OoDrawPageObserver page = null; page = LastSelectedShape.Page; if (page != null) { doc = page.PagesObserver; if (doc != null) { draw = doc.DocWnd; if (draw != null && draw.DrawPageSupplier != null) { var undoManager = draw.DrawPageSupplier; if (_group == null) // start grouping { _group = createGroup(); } if (_group != null && _group.IsGroup) { // set Title bar // size & position var size = LastSelectedShape.Size; var pos = LastSelectedShape.Position; // TODO: check if this is a group if (OoDrawUtils.AddShapeToGroupUndoable(_group.DomShape, LastSelectedShape.DomShape, undoManager, "Add shape to group")) { LastSelectedShape.Size = size; LastSelectedShape.Position = pos; var b = _group.Bounds; _group.Position = b.Location; play(LL.GetTrans("tangram.oomanipulation.group.added", OoElementSpeaker.GetElementAudioText(LastSelectedShape)), false); LastSelectedShape = _group; // sayLastSelectedShape(false); return(true); } return(false); } } } } } return(false); }
private void jumpToRightBorder(BrailleIOViewRange center) { if (center != null) { int offset = center.ContentWidth - center.ContentBox.Width; center.SetXOffset(-offset); io.RefreshDisplay(); audioRenderer.PlaySoundImmediately(LL.GetTrans("tangram.lector.wm.panning.jump.right")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION] jump to right"); } }
public Question_Dialog( string title, string id, DialogType type = DialogType.Question, string question = "", QuestionDialogType qType = QuestionDialogType.Unknown, bool isActivated = false, Dialog parentDialog = null) : base(title, id, type, isActivated, parentDialog) { Question = new SelfRenderingDialogEntry(id + "_Question", ll.GetTrans("question.qType." + qType.ToString()) + ": " + question, ll.GetTrans("question.question.help.question"), DialogEntryType.Label); QuestionType = qType; setQuestionDialogEntryTypes(qType); addQuestionDialogEntries(id); }
/// <summary> /// Stops the grouping mode /// </summary> private void stopGrouing() { if (_group != null) { Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[MANIPULATION]\t" + "quit grouping"); var b = _group.Bounds; _group.Position = b.Location; play(LL.GetTrans("tangram.oomanipulation.group.end")); LastSelectedShape = _group; //this.sayLastSelectedShape(false); _group = null; } }
/// <summary> /// Sets the Braille focus to that element which currently has the Mouse (GUI) focus. /// </summary> private void chooseElementWithGuiFocus() { if (OoConnection != null) { OoShapeObserver shape = OoConnection.GetCurrentDrawSelection() as OoShapeObserver; if (shape != null && shape.IsValid()) { Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "synchronize with GUI focus"); AudioRenderer.Instance.Abort(); // stop current audio to return the shape change LastSelectedShape = shape; AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.oomanipulation.set_braille_focus", LastSelectedShape.Name)); return; } } playError(); }
/// <summary> /// Switch between minimap and currently visible screen. /// </summary> private void toggleMinimap() { BrailleIOScreen vs = GetVisibleScreen(); if (vs != null) { if (vs.Name.Equals(BS_MINIMAP_NAME)) // exit minimap mode { BrailleIOScreen ms = screenBeforeMinimap; if (ms != null) { BrailleIOViewRange ocvr = vs.GetViewRange(VR_CENTER_NAME); BrailleIOViewRange ncvr = ms.GetViewRange(VR_CENTER_NAME); if (ocvr != null && ncvr != null) { syncContrastSettings(ocvr, ncvr); } } io.HideView(vs.Name); io.ShowView(ms.Name); SetDetailRegionContent(GetLastDetailRegionContent()); } else // show minimap { screenBeforeMinimap = vs; BrailleIOScreen ms = io.GetView(BS_MINIMAP_NAME) as BrailleIOScreen; if (ms != null) { BrailleIOViewRange ocvr = vs.GetViewRange(VR_CENTER_NAME); BrailleIOViewRange ncvr = ms.GetViewRange(VR_CENTER_NAME); if (ocvr != null && ncvr != null) { syncContrastSettings(ocvr, ncvr); } } io.HideView(vs.Name); io.ShowView(BS_MINIMAP_NAME); BrailleIOViewRange vr = vs.GetViewRange(VR_CENTER_NAME); if (vr != null) { SetDetailRegionContent(LL.GetTrans("tangram.lector.wm.zooming.current.short", ((int)(vr.GetZoom() * 100)).ToString())); } } } }
/// <summary> /// Renders a content object into an boolean matrix; /// while <c>true</c> values indicating raised pins and <c>false</c> values indicating lowered pins /// </summary> /// <param name="view">The frame to render in. This gives access to the space to render and other parameters. Normally this is a IBrailleIOViewRange.</param> /// <param name="content">The content to render.</param> /// <returns> /// A two dimensional boolean M x N matrix (bool[M,N]) where M is the count of rows (this is height) /// and N is the count of columns (which is the width). /// Positions in the Matrix are of type [i,j] /// while i is the index of the row (is the y position) /// and j is the index of the column (is the x position). /// In the matrix <c>true</c> values indicating raised pins and <c>false</c> values indicating lowered pins /// </returns> public bool[,] RenderMatrix(IViewBoxModel view, object content) { if (view != null && content != null && content is DialogEntry && BrailleRenderer != null) { if (((DialogEntry)content).Help.Equals(lastHelp) && ((DialogEntry)content).Title.Equals(lastTitle)) { Size currentSize = view.ContentBox.Size; if (currentSize.Equals(lastViewSize)) { if (!_lastRendereinresult.Equals(emptyMatrix)) { view.ContentHeight = _lastRendereinresult.GetLength(0); view.ContentWidth = _lastRendereinresult.GetLength(1); return(_lastRendereinresult); } } else { lastViewSize = currentSize; } } else { lastHelp = ((DialogEntry)content).Help; lastTitle = ((DialogEntry)content).Title; } string text = lastHelp; // Add header if (Properties.HasFlag(HelpRenderingProperties.ShowHaeder)) { text = ll.GetTrans("help.header", lastTitle) + "\r\n" + text; } _lastRendereinresult = BrailleRenderer.RenderMatrix(view, text); } view.ContentHeight = _lastRendereinresult.GetLength(0); view.ContentWidth = _lastRendereinresult.GetLength(1); return(_lastRendereinresult); }
void shape_ObserverDisposing(object sender, EventArgs e) { if (sender == LastSelectedShape) { try { string name = OoElementSpeaker.GetElementAudioText(LastSelectedShape); play(LL.GetTrans("tangram.oomanipulation.shape.deleted", name), true); } catch (ObjectDisposedException) { play(LL.GetTrans("tangram.oomanipulation.shape.deleted", LL.GetTrans("tangram.oomanipulation.shape")), true); } catch (Exception ex) { } resetSelectedShapeProperties(true); LastSelectedShape = null; } }
/// <summary> /// Speaks name and type of the UIA element. /// </summary> /// <param name="element">UIA element</param> public static void SpeakElement(AutomationElement element) { if (element != null) { try { var typeName = element.Current.ControlType.ProgrammaticName; string type = ll.GetTrans("Name." + (String.IsNullOrWhiteSpace(typeName) ? "ControlType.unknown" : typeName)); if (String.IsNullOrWhiteSpace(type)) { System.Diagnostics.Debug.WriteLine("ATTENTION: Unknown ControlType requested for UIA.SpeakElement: '" + typeName + "'"); } AudioRenderer.Instance.PlaySoundImmediately(type + " " + (String.IsNullOrWhiteSpace(element.Current.Name) ? element.Current.ClassName : element.Current.Name)); } catch (Exception) { } } }
private void sayInteractionModeChange(FollowFocusModes oldValue, FollowFocusModes newValue) { switch (FocusMode) { case FollowFocusModes.NONE: if (oldValue == FollowFocusModes.FOLLOW_BRAILLE_FOCUS) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION MODE] end Braille focus following mode"); string msg = LL.GetTrans("tangram.lector.wm.modes.end", LL.GetTrans("tangram.lector.wm.modes.FOLLOW_BRAILLE_FOCUS")); play(msg); ShowTemporaryMessageInDetailRegion(msg); } else if (oldValue == FollowFocusModes.FOLLOW_MOUSE_FOCUS) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION MODE] end Mouse focus following mode"); string msg = LL.GetTrans("tangram.lector.wm.modes.end", LL.GetTrans("tangram.lector.wm.modes.FOLLOW_MOUSE_FOCUS")); play(msg); ShowTemporaryMessageInDetailRegion(msg); } break; case FollowFocusModes.FOLLOW_BRAILLE_FOCUS: Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION MODE] start Braille focus following mode"); string msg2 = LL.GetTrans("tangram.lector.wm.modes.start", LL.GetTrans("tangram.lector.wm.modes.FOLLOW_BRAILLE_FOCUS")); play(msg2); ShowTemporaryMessageInDetailRegion(msg2); break; case FollowFocusModes.FOLLOW_MOUSE_FOCUS: Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION MODE] start Mouse focus following mode"); string msg3 = LL.GetTrans("tangram.lector.wm.modes.start", LL.GetTrans("tangram.lector.wm.modes.FOLLOW_MOUSE_FOCUS")); play(msg3); ShowTemporaryMessageInDetailRegion(msg3); break; default: break; } }
protected override void im_ButtonCombinationReleased(object sender, ButtonReleasedEventArgs e) { if (Active) { #region global button commands if ((e.ReleasedGenericKeys.Count == 1 && e.ReleasedGenericKeys[0] == "clc") || // center the focused element // handling if the cursor-key-pad is wrongly pressed with another key of this pad (e.ReleasedGenericKeys.Count == 2 && e.ReleasedGenericKeys.Contains("clc") && (e.ReleasedGenericKeys.Contains("clu") || e.ReleasedGenericKeys.Contains("cll") || e.ReleasedGenericKeys.Contains("clr") || e.ReleasedGenericKeys.Contains("cld")))) { if (jumpToDomFocus()) { AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.center_element")); } else { AudioRenderer.Instance.PlayWaveImmediately(StandardSounds.End); } Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] center focused shape"); e.Cancel = true; } else if (e.ReleasedGenericKeys.Count == 2 && e.ReleasedGenericKeys.Contains("l") && e.ReleasedGenericKeys.Contains("lr")) { if (!shapeManipulatorFunctionProxy.IsShapeSelected /* .LastSelectedShape == null*/) { AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.no_element")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] mark Braille focus in GUI - no element focused"); } else { InitBrailleDomFocusHighlightMode(); // retriggers focus highlighting AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.mark_in_gui")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] mark Braille focus in GUI"); } e.Cancel = true; } #endregion #region InteractionMode.Normal if (InteractionManager.Instance.Mode == InteractionMode.Normal) { switch (e.ReleasedGenericKeys.Count) { #region 1 Key //TODO: stop blinking only if a manipulation mode is active //TODO: stop blinking for diagonal interaction case 1: switch (e.ReleasedGenericKeys[0]) { // DE/ACTIVATE BRAILLE TEXT ADDITION case "k6": string text = LL.GetTrans("tangram.lector.oo_observer.text.braille_replacement") + " "; if (this.TextRendererHook.CanBeActivated()) { this.TextRendererHook.Active = !this.TextRendererHook.Active; if (this.TextRendererHook.Active) { text += LL.GetTrans("tangram.lector.oo_observer.activated"); } else { text += LL.GetTrans("tangram.lector.oo_observer.deactivated"); } AudioRenderer.Instance.PlaySoundImmediately(text); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] show Braille font in drawing: " + this.TextRendererHook.Active.ToString()); } else { AudioRenderer.Instance.PlaySoundImmediately(text + LL.GetTrans("tangram.lector.oo_observer.text.braille_replacement.exception")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] can't show Braille font in drawing"); } break; // TOGGLE FOCUS BLINKING case "k8": if (blinkFocusActive) { StopFocusHighlightModes(); AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.blinking") + " " + LL.GetTrans("tangram.lector.oo_observer.deactivated")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] blinking Braille focus frame off"); } else { StartFocusHighlightModes(); AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.lector.oo_observer.focus.blinking") + " " + LL.GetTrans("tangram.lector.oo_observer.activated")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] blinking Braille focus frame on"); } e.Cancel = true; break; case "cru": if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) { PauseFocusHighlightModes(); } break; case "crr": if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) { PauseFocusHighlightModes(); } break; case "crd": if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) { PauseFocusHighlightModes(); } break; case "crl": if (shapeManipulatorFunctionProxy.Mode != ModificationMode.Unknown) { PauseFocusHighlightModes(); } break; case "crc": // PauseFocusHighlightModes(); break; default: break; } break; #endregion #region 2 Keys case 2: #region crc with direction button if (e.ReleasedGenericKeys.Contains("crc")) { PauseFocusHighlightModes(); } #endregion #region Diagonal Interactions else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "cru", "crr" }).ToList().Count == 2) { PauseFocusHighlightModes(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "cru", "crl" }).ToList().Count == 2) { PauseFocusHighlightModes(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "crd", "crr" }).ToList().Count == 2) { PauseFocusHighlightModes(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "crd", "crl" }).ToList().Count == 2) { PauseFocusHighlightModes(); } #endregion break; #endregion #region 3 Keys case 3: // follow DOM focus mode // if (e.ReleasedGenericKeys.Intersect(new List <String> { "k1", "k2", "k4" }).ToList().Count == 3) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] jump to DOM focus"); WindowManager.Instance.FocusMode = WindowManager.Instance.FocusMode != FollowFocusModes.FOLLOW_BRAILLE_FOCUS ? FollowFocusModes.FOLLOW_BRAILLE_FOCUS : FollowFocusModes.NONE; if (WindowManager.Instance.FocusMode == FollowFocusModes.FOLLOW_BRAILLE_FOCUS) { bool success = jumpToDomFocus(); if (!success) { audioRenderer.PlaySoundImmediately( LL.GetTrans("tangram.lector.oo_observer.focus.folowing_braille") + " " + LL.GetTrans("tangram.lector.oo_observer.activated") + ". " + LL.GetTrans("tangram.lector.oo_observer.selected_no")); } } e.Cancel = true; } break; #endregion #region 4 Keys case 4: // open title/description dialog if (e.ReleasedGenericKeys.Intersect(new List <String> { "k2", "k3", "k4", "k5" }).ToList().Count == 4) { PauseFocusHighlightModes(); openTitleDescDialog(); Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] open title and description dialog"); e.Cancel = true; } break; #endregion default: break; } } #endregion } }
public void ShowImageDetailView(string detailViewName, int heightOffSet, int widthOffSet, Property property, bool loadFromShape = false) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[SHAPE EDIT DIALOG] open title + description dialog"); string speak = ""; gui_Menu = new GUI_Menu(); //init GUI MENU //create entry for dic createDetailView(detailViewName, 0, 48, 120, 12, true); detailViewDic[detailViewName].SetVisibility(true); //load data from selected Shape if (loadFromShape) { loadImageData(); } //as default title is selected and show activeProperty = property; selectedPropertyMenuItem = property; setContent(detailViewName, property); switch (property) { case Property.Title: speak = LL.GetTrans("tangram.lector.image_data.title"); break; case Property.Description: speak = LL.GetTrans("tangram.lector.image_data.desc"); break; } audioRenderer.PlaySoundImmediately(LL.GetTrans("tangram.lector.image_data.generic_property_value", speak, propertiesDic[activeProperty.ToString().ToLower()])); isOpen = true; }
public Game() { #if DEBUG // set the logger 'sensitivity': In DEBUG compilation every Message should be logged. // in release compilation the normal 'sensitivity' LogPriority.MIDDLE is used. if (logger != null) { logger.Priority = LogPriority.DEBUG; } #endif initLL(); // Setup menu structure mainMenuModel = new UpDownMenu(() => GoToScreen(startScreen), new UpDownMenuItem[] { new UpDownMenuItem(startTutorial, ll.GetTrans("game.menu.tutorial")), new UpDownMenuItem(startNewGame, ll.GetTrans("game.menu.new")), new UpDownMenuItem(() => GoToScreen(loadMenuScreen), ll.GetTrans("game.menu.load")), new UpDownMenuItem(exitApplication, ll.GetTrans("game.menu.exit")), }); pauseMenuModel = new UpDownMenu(() => GoToScreen(gameScreen), new UpDownMenuItem[] { new UpDownMenuItem(() => GoToScreen(gameScreen), ll.GetTrans("game.pause.resume")), new UpDownMenuItem(() => GoToScreen(saveMenuScreen), ll.GetTrans("game.pause.save")), new UpDownMenuItem(() => GoToScreen(mainMenuScreen), ll.GetTrans("game.pause.exit")), }); saveMenuModel = new UpDownMenu(() => GoToScreen(pauseMenuScreen), new UpDownMenuItem[] { new UpDownMenuItem(() => saveGame(0), ll.GetTrans("game.save.savetoslot") + " 1"), new UpDownMenuItem(() => saveGame(1), ll.GetTrans("game.save.savetoslot") + " 2"), new UpDownMenuItem(() => saveGame(2), ll.GetTrans("game.save.savetoslot") + " 3"), new UpDownMenuItem(() => saveGame(3), ll.GetTrans("game.save.savetoslot") + " 4"), new UpDownMenuItem(() => saveGame(4), ll.GetTrans("game.save.savetoslot") + " 5"), new UpDownMenuItem(() => saveGame(5), ll.GetTrans("game.save.savetoslot") + " 6"), }); loadMenuModel = new UpDownMenu(() => GoToScreen(mainMenuScreen), new UpDownMenuItem[] { new UpDownMenuItem(() => loadGame(0), ll.GetTrans("game.load.loadfromslot") + " 1"), new UpDownMenuItem(() => loadGame(1), ll.GetTrans("game.load.loadfromslot") + " 2"), new UpDownMenuItem(() => loadGame(2), ll.GetTrans("game.load.loadfromslot") + " 3"), new UpDownMenuItem(() => loadGame(3), ll.GetTrans("game.load.loadfromslot") + " 4"), new UpDownMenuItem(() => loadGame(4), ll.GetTrans("game.load.loadfromslot") + " 5"), new UpDownMenuItem(() => loadGame(5), ll.GetTrans("game.load.loadfromslot") + " 6"), }); initializeTui(); // Insert desired screen GoToScreen(startScreen); }
private bool handleButtonCombination(Object sender, ButtonReleasedEventArgs e) { #region InteractionMode.Normal if (InteractionManager.Instance.Mode == InteractionMode.Normal) { switch (e.ReleasedGenericKeys.Count) { #region 1 Key case 1: switch (e.ReleasedGenericKeys[0]) { case "k4": Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] set Braille focus to mouse focus"); chooseElementWithGuiFocus(); e.Cancel = true; break; case "k5": // TODO: Taste ist noch frei break; case "cru": Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle up button"); e.Cancel = handleUP(); break; case "crr": Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle right button"); e.Cancel = handleRIGHT(); break; case "crd": Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down button"); e.Cancel = handleDOWN(); break; case "crl": Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle left button"); e.Cancel = handleLEFT(); break; case "crc": if (_group != null) { Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[MANIPULATION]\t" + "start grouping"); grouping(); } else { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] rotate element manipulation dialog"); RotateThroughModes(); } e.Cancel = true; //TODO: open element manipulation dialog break; case "hbr": // start gesture recognition for tabs break; default: break; } break; #endregion #region 2 Keys case 2: if (e.ReleasedGenericKeys.Intersect(new List <String> { "k4", "k5" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose next element"); ChooseNextElement(); e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k1", "k2" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose previous element"); ChoosePreviousElement(); e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k5", "k6" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] speak description"); string desc = OoElementSpeaker.GetElementDescriptionText(LastSelectedShape); if (!String.IsNullOrEmpty(desc)) { sendTextNotification(desc); sendAudioFeedback(desc); } e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k3", "k6" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] send element to background"); if (sentToBackground()) { sendAudioFeedback(LL.GetTrans("tangram.oomanipulation.zOrder.toBackground")); } else { playError(); } e.Cancel = true; } #region crc with direction button else if (e.ReleasedGenericKeys.Contains("crc")) { if (e.ReleasedGenericKeys.Contains("cru") || e.ReleasedGenericKeys.Contains("crr") || e.ReleasedGenericKeys.Contains("crd") || e.ReleasedGenericKeys.Contains("crl") ) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] rotate element manipulation dialog (weak handling)"); RotateThroughModes(); e.Cancel = true; } } #endregion #region Diagonal Interactions else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "cru", "crr" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle top right"); e.Cancel = handleUP_RIGHT(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "cru", "crl" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle top left"); e.Cancel = handleUP_LEFT(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "crd", "crr" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down right"); e.Cancel = handleDOWN_RIGHT(); } else if (e.ReleasedGenericKeys.Intersect(new List <String>(2) { "crd", "crl" }).ToList().Count == 2) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] handle down left"); e.Cancel = handleDOWN_LEFT(); } #endregion break; #endregion #region 3 Keys case 3: if (e.ReleasedGenericKeys.Intersect(new List <String> { "k1", "k2", "k3" }).ToList().Count == 3) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose parent group"); ChooseParentOfElement(); e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k4", "k5", "k6" }).ToList().Count == 3) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] choose first child in group"); ChooseFirstChildOfElement(); e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k1", "k4", "k5" }).ToList().Count == 3) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] delete selected shape"); deleteSelectedObject(); e.Cancel = true; } else if (e.ReleasedGenericKeys.Intersect(new List <String> { "k2", "k3", "k5" }).ToList().Count == 3) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] bring element to front"); if (bringToFront()) { sendAudioFeedback(LL.GetTrans("tangram.oomanipulation.zOrder.toFront")); } else { playError(); } e.Cancel = true; } break; #endregion #region 4 Keys case 4: // unfocus DOM element (no element is selected on the pin device) // if (e.ReleasedGenericKeys.Intersect(new List <String> { "k1", "k2", "k4", "k5" }).ToList().Count == 4) { Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] unfocus DOM element"); LastSelectedShape = null; playEdit(); AudioRenderer.Instance.PlaySoundImmediately(LL.GetTrans("tangram.oomanipulation.clear_braille_focus")); sentTextFeedback(LL.GetTrans("tangram.oomanipulation.no_element_selected")); e.Cancel = true; } break; #endregion #region 5 Keys case 5: string command = String.Join(",", e.ReleasedGenericKeys); switch (command) { case "k1,k2,k4,k5,k7": if (_group == null) { play(LL.GetTrans("tangram.oomanipulation.group.start")); if (!grouping()) { playError(); } } else { stopGrouing(); } break; default: break; } break; #endregion default: break; } } #endregion return(e != null ? e.Cancel : false); }
void shapeManipulatorFunctionProxy_SelectedShapeChanged(object sender, SelectedShapeChangedEventArgs e) { if (sender != null && sender is OpenOfficeDrawShapeManipulator) { StopFocusHighlightModes(); try { if (e.Reason != ChangeReson.Property) { ((OpenOfficeDrawShapeManipulator)sender).SayLastSelectedShape(false); } if (((OpenOfficeDrawShapeManipulator)sender).IsShapeSelected) { OoShapeObserver _shape = ((OpenOfficeDrawShapeManipulator)sender).LastSelectedShape; if (_shape != null) { if (e.Reason != ChangeReson.Property) // shape changed { BrailleDomFocusRenderer.CurrentPolyPoint = null; focusHighlightPaused = false; } InitBrailleDomFocusHighlightMode(null, e.Reason != ChangeReson.Property); if (e.Reason != ChangeReson.Property && ((OpenOfficeDrawShapeManipulator)sender).LastSelectedShapePolygonPoints == null) // in other cases the detailed infos for the point is sent by the manipulator itself { WindowManager.Instance.SetDetailRegionContent(OoElementSpeaker.GetElementAudioText(_shape)); } if (WindowManager.Instance.FocusMode == FollowFocusModes.FOLLOW_BRAILLE_FOCUS) { jumpToDomFocus(); } Logger.Instance.Log(LogPriority.MIDDLE, this, "[DRAW INTERACTION] new DOM focus " + _shape.Name + " " + _shape.Text); } } else { WindowManager.Instance.SetDetailRegionContent(LL.GetTrans("tangram.lector.oo_observer.selected_no")); } } catch (System.Exception ex) { Logger.Instance.Log(LogPriority.OFTEN, this, "[DRAW INTERACTION] new DOM focus error --> shape is null", ex); } } }
/// <summary> /// Aborts all audio output. /// </summary> public void AbortAudio() { AudioRenderer.Instance.Abort(); ShowTemporaryMessageInDetailRegion(LL.GetTrans("tangram.lector.wm.audio.stop")); Logger.Instance.Log(LogPriority.MIDDLE, this, "[INTERACTION] abort speech output"); }
/// <summary> /// Loads the level from a txt file at a given path /// </summary> /// <param name="levelName"></param> /// <returns></returns> public static Level Load(string levelName, LL ll) { worldObjects = new Dictionary <string, WorldObject>(); dialogues = new Dictionary <string, Phrase[]>(); // Create XML reader settings XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; // Exclude comments // Create reader based on settings XmlReader reader = XmlReader.Create("Resources/levels/" + levelName + ".xml", settings); XmlDocument doc = new XmlDocument(); doc.Load(reader); XmlNode objectNode = doc.DocumentElement.SelectSingleNode("definition/objects"); foreach (XmlNode node in objectNode.ChildNodes) { WorldObject obj = new WorldObject() { Name = XmlUtil.Get(node, "name", ll.GetTrans("resource.default.name")), Description = XmlUtil.Get(node, "desc", ll.GetTrans("resource.default.desc")), BlocksPath = XmlUtil.Get(node, "block", true), Texture = BooleanTexture.FromFile("Resources/" + XmlUtil.Get(node, "img", ll.GetTrans("resource.default.texture"))), }; string id = XmlUtil.Get(node, "id", "error"); if (!worldObjects.ContainsKey(id)) { worldObjects.Add(id, obj); } } XmlNode levelNode = doc.DocumentElement; Level result = new Level(); result.OnLoadTrigger = XmlUtil.Get(levelNode, "onload", string.Empty); result.Name = levelName; Character character = new Character() { BlocksPath = true, Id = "avatar", Name = "Avatar", Description = "This is me!", Texture = BooleanTexture.FromFile("Resources/bmps/avatar_self.bmp"), }; result.Avatar = character; XmlNode eventNode = doc.DocumentElement.SelectSingleNode("definition/events"); if (eventNode != null) { foreach (XmlNode node in eventNode.ChildNodes) { string name = node.Name; if (name == "eventgroup") { EventGroup group = new EventGroup(); group.id = XmlUtil.Get(node, "id", string.Empty); group.conditions = XmlUtil.GetArray(node, "if", ' '); group.inverseConditions = XmlUtil.GetArray(node, "not", ' '); foreach (XmlNode childNode in node.ChildNodes) { group.events.Add(loadEvent(childNode)); } result.Events.Add(group); } if (name == "event") { result.Events.Add(loadEvent(node)); } } } XmlNode triggerNode = doc.DocumentElement.SelectSingleNode("triggers"); if (triggerNode != null) { foreach (XmlNode node in triggerNode.ChildNodes) { EventTrigger trigger = new EventTrigger(); trigger.x = Constants.TILE_SIZE * XmlUtil.Get(node, "x", 0); trigger.y = Constants.TILE_SIZE * XmlUtil.Get(node, "y", 0); trigger.width = Constants.TILE_SIZE * XmlUtil.Get(node, "width", 1); trigger.height = Constants.TILE_SIZE * XmlUtil.Get(node, "height", 1); trigger.levelEvent = XmlUtil.Get(node, "event", string.Empty); if (result.Events.FirstOrDefault(e => e.id.Equals(trigger.levelEvent)) == null) { Console.WriteLine("WARNING: Trigger " + trigger.levelEvent + " pointing to unkown event!"); } result.Triggers.Add(trigger); } } XmlNode decoNode = doc.DocumentElement.SelectSingleNode("decos"); if (decoNode != null) { foreach (XmlNode node in decoNode.ChildNodes) { if (node.Name.Equals(S_RANGE)) { int x = XmlUtil.Get(node, "x", 0); int y = XmlUtil.Get(node, "y", 0); int width = XmlUtil.Get(node, "width", 1); int height = XmlUtil.Get(node, "height", 1); WorldObject blueprint = worldObjects[XmlUtil.Get(node.ChildNodes[0], "obj", "default")]; int dimX = blueprint.Width / Constants.TILE_SIZE; int dimY = blueprint.Height / Constants.TILE_SIZE; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { result.Objects.Add(createDeco(node.ChildNodes[0], x + i * dimX, y + j * dimY)); } } } else { int x = XmlUtil.Get(node, "x", 0); int y = XmlUtil.Get(node, "y", 0); result.Objects.Add(createDeco(node, x, y)); } } } XmlNode itemNode = doc.DocumentElement.SelectSingleNode("items"); if (itemNode != null) { foreach (XmlNode node in itemNode.ChildNodes) { WorldObject blueprint = worldObjects[XmlUtil.Get(node, "obj", "default")]; Item item = new Item() { X = Constants.TILE_SIZE * XmlUtil.Get(node, "x", 0), Y = Constants.TILE_SIZE * XmlUtil.Get(node, "y", 0), Conditions = XmlUtil.GetArray(node, "if", ' '), InverseConditions = XmlUtil.GetArray(node, "not", ' '), Id = XmlUtil.Get(node, "id", "object"), Rotation = XmlUtil.Get(node, "r", Direction.DOWN), BlocksPath = blueprint.BlocksPath, Texture = blueprint.Texture, Name = blueprint.Name, Description = blueprint.Description, }; string eventId = "pick_up_" + item.Id; Event pickUpEvent = new Event(); pickUpEvent.id = eventId; pickUpEvent.conditions = new string[0]; pickUpEvent.inverseConditions = new string[] { item.Id + "_gefunden" }; pickUpEvent.actions.Add(new PickItem(item)); EventTrigger trigger = new EventTrigger(); trigger.x = item.X; trigger.y = item.Y; trigger.levelEvent = eventId; trigger.height = 1; trigger.width = 1; result.Triggers.Add(trigger); result.Events.Add(pickUpEvent); if (!Game.HasKnowledge(item.Id + "_gefunden")) { Phrase talk = new Phrase() { text = "Du hast " + blueprint.Name + " gefunden.", sets = new string[] { "hat_" + item.Id, item.Id + "_gefunden" } }; item.Event = new Event(talk); result.Objects.Add(item); } } } //XmlNode containerNode = doc.DocumentElement.SelectSingleNode("containers"); //foreach (XmlNode node in containerNode.ChildNodes) //{ // WorldObject blueprint = worldObjects[XmlUtil.Get(node, "obj", "default")]; // Container container = new Container() // { // Id = XmlUtil.Get(node, "id", "object"), // X = Constants.TILE_SIZE * XmlUtil.Get(node, "x", 0), // Y = Constants.TILE_SIZE * XmlUtil.Get(node, "y", 0), // Rotation = XmlUtil.Get(node, "r", Direction.DOWN), // BlocksPath = blueprint.BlocksPath, // Texture = blueprint.Texture, // Name = blueprint.Name, // Description = blueprint.Description, // IsLocked = Boolean.Parse(node.Attributes["locked"].Value), // KeyIds = XmlUtil.Get(node, "key", new char[] { ' ' }) // }; // foreach (XmlNode item in node.ChildNodes) // { // WorldObject itemBlueprint = worldObjects[XmlUtil.Get(item, "obj", "default")]; // container.Items.Add(new Item() // { // Id = XmlUtil.Get(node, "id", "object"), // X = container.X, // Y = container.Y, // Rotation = container.Rotation, // BlocksPath = itemBlueprint.BlocksPath, // Texture = itemBlueprint.Texture, // Name = itemBlueprint.Name, // Description = itemBlueprint.Description // }); // } // result.Objects.Add(container); //} XmlNode doorNode = doc.DocumentElement.SelectSingleNode("doors"); if (doorNode != null) { foreach (XmlNode node in doorNode.ChildNodes) { WorldObject blueprint = worldObjects[XmlUtil.Get(node, "obj", "default")]; Door door = new Door() { X = Constants.TILE_SIZE * XmlUtil.Get(node, "x", 0), Y = Constants.TILE_SIZE * XmlUtil.Get(node, "y", 0), Conditions = XmlUtil.GetArray(node, "if", ' '), InverseConditions = XmlUtil.GetArray(node, "not", ' '), Rotation = XmlUtil.Get(node, "r", Direction.DOWN), Target = XmlUtil.Get(node, "target", ""), TargetX = Constants.TILE_SIZE * XmlUtil.Get(node, "targetX", 0), TargetY = Constants.TILE_SIZE * XmlUtil.Get(node, "targetY", 0), BlocksPath = blueprint.BlocksPath, Texture = blueprint.Texture, Name = blueprint.Name, Description = blueprint.Description, }; result.Objects.Add(door); } } XmlNode npcNode = doc.DocumentElement.SelectSingleNode("npcs"); if (npcNode != null) { foreach (XmlNode node in npcNode.ChildNodes) { WorldObject blueprint = worldObjects[XmlUtil.Get(node, "obj", "default")]; NPC npc = new NPC() { Id = XmlUtil.Get(node, "id", "object"), X = Constants.TILE_SIZE * XmlUtil.Get(node, "x", 0), Y = Constants.TILE_SIZE * XmlUtil.Get(node, "y", 0), Conditions = XmlUtil.GetArray(node, "if", ' '), InverseConditions = XmlUtil.GetArray(node, "not", ' '), Rotation = XmlUtil.Get(node, "r", Direction.DOWN), BlocksPath = blueprint.BlocksPath, Texture = blueprint.Texture, Name = blueprint.Name, Description = blueprint.Description, Trigger = XmlUtil.Get(node, "trigger", string.Empty) }; result.Objects.Add(npc); } } result.OnKnowledgeChanged(); return(result); }
protected virtual bool[,] renderDialogEntry(IViewBoxModel view) { int i = 0; while (_isRendering && i++ < 10) { Thread.Sleep(5); } if (i >= 10) { return(cachedResult); } try { bool[,] m = cachedResult; lock (_synckLock) { _isRendering = true; if (HasChanged && Entry != null && view != null && view.ContentBox.Width > 0) // renew rendering result { bool[,] icon = emptyMatrix; // get icon if (IconRenderer != null) { icon = IconRenderer.RenderMatrix(view, Entry); } // calculate the space for the text to start int padding_left = (icon != null && icon.GetLength(1) > 0) ? icon.GetLength(1) + IconTextSpace : 0; // adapt the view IViewBoxModel view2 = new DummyViewBox(view); if (padding_left > 0) { var contentBox = view2.ContentBox; contentBox.Width = contentBox.Width - padding_left; view2.ContentBox = contentBox; } bool[,] text = emptyMatrix; if (BrailleRenderer != null) { string title = Entry.Title; if (Entry.Type == DialogEntryType.Group) { title = ll.GetTrans("grp.title.wrap", title); } text = BrailleRenderer.RenderMatrix(view2, title); } m = combineMatrices(icon, text, view); // TODO: set content dimensions? } cachedResult = m; HasChanged = false; } return(m); } finally { _isRendering = false; } }