public string GetIndentedText(string indent, TabSettings tabSettings) { LineSubdivider subdivider = new LineSubdivider(text, true); StringBuilder builder = new StringBuilder(); bool first = true; foreach (string line in subdivider.GetLines()) { if (!first) { builder.Append(indent); } first = false; if (tabSettings.useSpaces && line.StartsWith("\t")) { string tab = tabSettings.Tab; int count = 0; while (count < line.Length && line[count] == '\t') { ++count; builder.Append(tab); } builder.Append(line.Substring(count)); } else { builder.Append(line); } } return(builder.ToString()); }
private void RestoreTabs() { string tabs = GlobalSettings.Default.OpenTabs; if (tabs == null) { return; } IReadOnlyCollection <TabSettings> ts = TabSettings.FromString(tabs); foreach (TabSettings t in ts) { ConnectedAccount sa = ConnectedAccount.RootFolder.FindConnectedAccountById(t.AccountId); if (sa == null) { continue; } AddTab(sa, t.Settings, false); if (t.IsActive) { SelectedAccount = ActiveStorageAccounts.Last(); } } }
private UserTabStateModel GetUserTabsAsync(ClaimsPrincipal user) { TabSettings tabSettings = new TabSettings("Home", "/"); List <TabSettings> listTabSettngs = new List <TabSettings>(); listTabSettngs.Add(tabSettings); var userTabState = new UserTabStateModel(user, listTabSettngs); return(userTabState); }
private void SaveTabs() { string s = TabSettings.ToString(ActiveStorageAccounts.Select( asa => new TabSettings( asa.Account.Id, asa.Account.Id == SelectedAccount.Account.Id, asa.GetSettings()))); GlobalSettings.Default.OpenTabs = s; }
/** * Constructs a <CODE>PdfChunk</CODE>-object. * * @param chunk the original <CODE>Chunk</CODE>-object * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE> * @param tabSettings the Phrase tab settings */ internal PdfChunk(Chunk chunk, PdfAction action, TabSettings tabSettings) : this(chunk, action) { if (tabSettings != null) { if (!attributes.ContainsKey(Chunk.TABSETTINGS) || attributes[Chunk.TABSETTINGS] == null) { attributes[Chunk.TABSETTINGS] = tabSettings; } } }
public static TabSettings GetTabSetting(this XElement element, string id) { var tabItem = new TabSettings(); tabItem.TabName = element.Attribute("TabName").Value; tabItem.TabId = id; tabItem.AccessRoles = (from item in element.Attribute("AccessRoles").Value.Split(';') where item.Length > 0 select item).ToList(); return tabItem; }
public MainForm() { InitializeComponent(); // create tab modules _tabModule[tabPageScripting] = tabScripting = new TabScripting(this); _tabModule[tabPageSampling] = tabSampling = new TabSampling(this); _tabModule[tabPageMonitor] = tabMonitor = new TabMonitor(this); _tabModule[tabPageSettings] = tabSettings = new TabSettings(this); formController = new FormController(new ControllerAdapter(this)); formProjection = new FormProjection(this); }
public ToolTab(string id, ToolTabModel model, UIElement tabContent, TabControl container, TabSettings settings) : this() { Id = id; Model = model; TabContent = tabContent; Container = container; CreateBindings(); MainGrid.Children.Add(tabContent); Settings = settings; GotFocus += (sender, args) => { IsaacDashSerializer.Settings.GeneralSettings.TabWithFocus = Id; IsaacDashSerializer.MarkToSave(); }; }
public UserTabStateModel GetTabSettingsTest() { // NOTE TO SELF: Self contained view componenets // https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components?view=aspnetcore-2.1 // TODO: Self contained view componenets List <TabSettings> tabs = new List <TabSettings>(); TabSettings t1 = new TabSettings("About", "\\about", new Microsoft.AspNetCore.Http.QueryString("?test=nope&woot=9000")); TabSettings t2 = new TabSettings("Home", ""); TabSettings t3 = new TabSettings("Privacy", "\\privacy"); tabs.Add(t1); tabs.Add(t2); tabs.Add(t3); UserTabStateModel userTabState = new UserTabStateModel(User, tabs); return(userTabState); }
internal static TabStop GetTabStop(PdfChunk tab, float tabPosition) { TabStop tabStop = null; object o; if (tab.attributes.TryGetValue(Chunk.TAB, out o)) { float tabInterval = (float)((object[])o)[0]; if (float.IsNaN(tabInterval)) { object obj; tab.attributes.TryGetValue(Chunk.TABSETTINGS, out obj); tabStop = TabSettings.getTabStopNewInstance(tabPosition, (TabSettings)obj); } else { tabStop = TabStop.NewInstance(tabPosition, tabInterval); } } return(tabStop); }
public MainWindow() { InitializeComponent(); PreviewKeyDown += new KeyEventHandler(HandleEsc); // Close when escape pressed // Find all subclasses of 'Tab' and create a new instance for each Tabs = typeof(Tab) .Assembly.GetTypes() .Where(t => t.IsSubclassOf(typeof(Tab)) && !t.IsAbstract && t != typeof(TabSettings)) .OrderBy(t => t.Name) .Select(t => (Tab)Activator.CreateInstance(t)) .ToList(); TabControl.Items.Add(new TabItem() // Creates a hidden tab to fill the gap between the left and right-aligned Tabs { Visibility = Visibility.Hidden }); Tab settings = new TabSettings(); // Creates the Settings Tab TabItem TabItem = new TabItem() { Content = settings.RootElement, Header = settings.Header, Background = new SolidColorBrush(settings.PrimaryColor) }; DockPanel.SetDock(TabItem, Dock.Right); // Align to the right TabItem.HorizontalAlignment = HorizontalAlignment.Right; settings.TabItem = TabItem; TabControl.Items.Add(TabItem); foreach (Tab tab in Tabs) // Creates a new TabItem for each Tab and display it in the TabControl { AddTab(tab); } TabControl.SelectionChanged += TabControl_SelectionChanged; // Listen to Tab selection changes to change headers color }
/** * Constructs a <CODE>PdfChunk</CODE>-object. * * @param chunk the original <CODE>Chunk</CODE>-object * @param action the <CODE>PdfAction</CODE> if the <CODE>Chunk</CODE> comes from an <CODE>Anchor</CODE> * @param tabSettings the Phrase tab settings */ internal PdfChunk(Chunk chunk, PdfAction action, TabSettings tabSettings) : this(chunk, action) { if (tabSettings != null) { if (!attributes.ContainsKey(Chunk.TABSETTINGS) || attributes[Chunk.TABSETTINGS] == null) attributes[Chunk.TABSETTINGS] = tabSettings; } }
public PortalSettings() { ActiveTab = new TabSettings(); DesktopTabs = new List<TabSettings>(); }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { TabSettings tab = portalSettings.ActiveTab; // Populate Tab Names, etc. tabName.Text = "New Tab"; mobileTabName.Text = ""; showMobile.Checked = false; // Populate the "ParentTab" Data TabsDB t = new TabsDB(); SqlDataReader dr = t.GetTabsParent(portalSettings.PortalID, TabID); parentTab.DataSource = dr; parentTab.DataBind(); dr.Close(); //by Manu, fixed bug 807858 // added by Jonathan Fong 05/08/2004 to support LDAP // www.gt.com.au bool useMemberList = HttpContext.Current.User is System.Security.Principal.WindowsPrincipal; useMemberList |= System.Configuration.ConfigurationSettings.AppSettings["LDAPLogin"] != null ? true : false; if (useMemberList) { memRoles.Visible = true; authRoles.Visible = false; memRoles.Members = tab.AuthorizedRoles; } else { // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab UsersDB users = new UsersDB(); SqlDataReader roles = users.GetPortalRoles(portalSettings.PortalID); // Clear existing items in checkboxlist authRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authRoles.Items.Add(allItem); // Authenticated user role added // 15 nov 2002 - by manudea ListItem authItem = new ListItem(); authItem.Text = "Authenticated Users"; if (tab.AuthorizedRoles.LastIndexOf("Authenticated Users") > -1) { authItem.Selected = true; } authRoles.Items.Add(authItem); // end authenticated user role added while (roles.Read()) { ListItem item = new ListItem(); item.Text = (string)roles["RoleName"]; item.Value = roles["RoleID"].ToString(); if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } roles.Close(); //by Manu, fixed bug 807858 } }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { TabSettings tab = portalSettings.ActiveTab; // Populate Tab Names, etc. tabName.Text = tab.TabName; mobileTabName.Text = tab.MobileTabName; showMobile.Checked = tab.ShowMobile; // Populate the "ParentTab" Data TabsDB t = new TabsDB(); SqlDataReader dr = t.GetTabsParent(portalSettings.PortalID, TabID); parentTab.DataSource = dr; parentTab.DataBind(); dr.Close(); //by Manu, fixed bug 807858 if (parentTab.Items.FindByValue(tab.ParentTabID.ToString()) != null) { parentTab.Items.FindByValue(tab.ParentTabID.ToString()).Selected = true; } // Translate if (parentTab.Items.FindByText(" ROOT_LEVEL") != null) { parentTab.Items.FindByText(" ROOT_LEVEL").Text = Esperantus.Localize.GetString("ROOT_LEVEL", "Root Level", parentTab); } // added by Jonathan Fong 05/08/2004 to support LDAP // www.gt.com.au bool useMemberList = HttpContext.Current.User is System.Security.Principal.WindowsPrincipal; useMemberList |= System.Configuration.ConfigurationSettings.AppSettings["LDAPLogin"] != null ? true : false; if (useMemberList) { memRoles.Visible = true; authRoles.Visible = false; memRoles.Members = tab.AuthorizedRoles; } else { // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab UsersDB users = new UsersDB(); SqlDataReader roles = users.GetPortalRoles(portalSettings.PortalID); // Clear existing items in checkboxlist authRoles.Items.Clear(); ListItem allItem = new ListItem(); allItem.Text = "All Users"; if (tab.AuthorizedRoles.LastIndexOf("All Users") > -1) { allItem.Selected = true; } authRoles.Items.Add(allItem); // Authenticated user role added // 15 nov 2002 - by manudea ListItem authItem = new ListItem(); authItem.Text = "Authenticated Users"; if (tab.AuthorizedRoles.LastIndexOf("Authenticated Users") > -1) { authItem.Selected = true; } authRoles.Items.Add(authItem); // end authenticated user role added while (roles.Read()) { ListItem item = new ListItem(); item.Text = (string)roles["RoleName"]; item.Value = roles["RoleID"].ToString(); if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } roles.Close(); //by Manu, fixed bug 807858 } // Populate the "Add Module" Data ModulesDB m = new ModulesDB(); SqlDataReader drCurrentModuleDefinitions = m.GetCurrentModuleDefinitions(portalSettings.PortalID); try { while (drCurrentModuleDefinitions.Read()) { if (PortalSecurity.IsInRoles("Admins") == true || !(bool.Parse(drCurrentModuleDefinitions["Admin"].ToString()))) { moduleType.Items.Add(new ListItem(drCurrentModuleDefinitions["FriendlyName"].ToString(), drCurrentModuleDefinitions["ModuleDefID"].ToString())); } } } finally { drCurrentModuleDefinitions.Close(); } // Populate Right Hand Module Data rightList = GetModules("RightPane"); rightPane.DataBind(); // Populate Content Pane Module Data contentList = GetModules("ContentPane"); contentPane.DataBind(); // Populate Left Hand Pane Module Data leftList = GetModules("LeftPane"); leftPane.DataBind(); }
private void EditTable_UpdateControl(object sender, Rainbow.Configuration.SettingsTableEventArgs e) { TabSettings.UpdateTabSettings(TabID, e.CurrentItem.EditControl.ID, e.CurrentItem.Value); }
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { ButtonRefresh.Visibility = TabSettings.Equals(((TabControl)sender).SelectedItem) ? Visibility.Hidden : Visibility.Visible; }
/** * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>. * * @param element the element to add * @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not. * @throws DocumentException when a document isn't open yet, or has been closed */ public override bool Add(IElement element) { if (writer != null && writer.IsPaused()) { return false; } if (element.Type != Element.DIV) { FlushFloatingElements(); } switch (element.Type) { // Information (headers) case Element.HEADER: info.Addkey(((Meta)element).Name, ((Meta)element).Content); break; case Element.TITLE: info.AddTitle(((Meta)element).Content); break; case Element.SUBJECT: info.AddSubject(((Meta)element).Content); break; case Element.KEYWORDS: info.AddKeywords(((Meta)element).Content); break; case Element.AUTHOR: info.AddAuthor(((Meta)element).Content); break; case Element.CREATOR: info.AddCreator(((Meta)element).Content); break; case Element.LANGUAGE: SetLanguage(((Meta)element).Content); break; case Element.PRODUCER: // you can not change the name of the producer info.AddProducer(); break; case Element.CREATIONDATE: // you can not set the creation date, only reset it info.AddCreationDate(); break; // content (text) case Element.CHUNK: { // if there isn't a current line available, we make one if (line == null) { CarriageReturn(); } // we cast the element to a chunk PdfChunk chunk = new PdfChunk((Chunk) element, anchorAction, tabSettings); // we try to add the chunk to the line, until we succeed { PdfChunk overflow; while ((overflow = line.Add(chunk)) != null) { CarriageReturn(); bool newlineSplit = chunk.IsNewlineSplit(); chunk = overflow; if (!newlineSplit) chunk.TrimFirstSpace(); } } pageEmpty = false; if (chunk.IsAttribute(Chunk.NEWPAGE)) { NewPage(); } break; } case Element.ANCHOR: { Anchor anchor = (Anchor) element; String url = anchor.Reference; leading = anchor.Leading; PushLeading(); if (url != null) { anchorAction = new PdfAction(url); } // we process the element element.Process(this); anchorAction = null; PopLeading(); break; } case Element.ANNOTATION: { if (line == null) { CarriageReturn(); } Annotation annot = (Annotation) element; Rectangle rect = new Rectangle(0, 0); if (line != null) rect = new Rectangle(annot.GetLlx(IndentRight - line.WidthLeft), annot.GetUry(IndentTop - currentHeight - 20), annot.GetUrx(IndentRight - line.WidthLeft + 20), annot.GetLly(IndentTop - currentHeight)); PdfAnnotation an = PdfAnnotationsImp.ConvertAnnotation(writer, annot, rect); annotationsImp.AddPlainAnnotation(an); pageEmpty = false; break; } case Element.PHRASE: { TabSettings backupTabSettings = tabSettings; if (((Phrase)element).TabSettings != null) tabSettings = ((Phrase)element).TabSettings; // we cast the element to a phrase and set the leading of the document leading = ((Phrase) element).TotalLeading; PushLeading(); // we process the element element.Process(this); tabSettings = backupTabSettings; PopLeading(); break; } case Element.PARAGRAPH: { TabSettings backupTabSettings = tabSettings; if (((Phrase)element).TabSettings != null) tabSettings = ((Phrase)element).TabSettings; // we cast the element to a paragraph Paragraph paragraph = (Paragraph) element; if (IsTagged(writer)) { FlushLines(); text.OpenMCBlock(paragraph); } AddSpacing(paragraph.SpacingBefore, leading, paragraph.Font); // we adjust the parameters of the document alignment = paragraph.Alignment; leading = paragraph.TotalLeading; PushLeading(); CarriageReturn(); // we don't want to make orphans/widows if (currentHeight + line.Height + leading > IndentTop - IndentBottom) { NewPage(); } indentation.indentLeft += paragraph.IndentationLeft; indentation.indentRight += paragraph.IndentationRight; CarriageReturn(); IPdfPageEvent pageEvent = writer.PageEvent; if (pageEvent != null && !isSectionTitle) pageEvent.OnParagraph(writer, this, IndentTop - currentHeight); // if a paragraph has to be kept together, we wrap it in a table object if (paragraph.KeepTogether) { CarriageReturn(); PdfPTable table = new PdfPTable(1); table.KeepTogether = paragraph.KeepTogether; table.WidthPercentage = 100f; PdfPCell cell = new PdfPCell(); cell.AddElement(paragraph); cell.Border = Rectangle.NO_BORDER; cell.Padding = 0; table.AddCell(cell); indentation.indentLeft -= paragraph.IndentationLeft; indentation.indentRight -= paragraph.IndentationRight; this.Add(table); indentation.indentLeft += paragraph.IndentationLeft; indentation.indentRight += paragraph.IndentationRight; } else { line.SetExtraIndent(paragraph.FirstLineIndent); element.Process(this); CarriageReturn(); AddSpacing(paragraph.SpacingAfter, paragraph.TotalLeading, paragraph.Font); } if (pageEvent != null && !isSectionTitle) pageEvent.OnParagraphEnd(writer, this, IndentTop - currentHeight); alignment = Element.ALIGN_LEFT; indentation.indentLeft -= paragraph.IndentationLeft; indentation.indentRight -= paragraph.IndentationRight; CarriageReturn(); tabSettings = backupTabSettings; PopLeading(); if (IsTagged(writer)) { FlushLines(); text.CloseMCBlock(paragraph); } break; } case Element.SECTION: case Element.CHAPTER: { // Chapters and Sections only differ in their constructor // so we cast both to a Section Section section = (Section) element; IPdfPageEvent pageEvent = writer.PageEvent; bool hasTitle = section.NotAddedYet && section.Title != null; // if the section is a chapter, we begin a new page if (section.TriggerNewPage) { NewPage(); } if (hasTitle) { float fith = IndentTop - currentHeight; int rotation = pageSize.Rotation; if (rotation == 90 || rotation == 180) fith = pageSize.Height - fith; PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith); while (currentOutline.Level >= section.Depth) { currentOutline = currentOutline.Parent; } PdfOutline outline = new PdfOutline(currentOutline, destination, section.GetBookmarkTitle(), section.BookmarkOpen); currentOutline = outline; } // some values are set CarriageReturn(); indentation.sectionIndentLeft += section.IndentationLeft; indentation.sectionIndentRight += section.IndentationRight; if (section.NotAddedYet && pageEvent != null) if (element.Type == Element.CHAPTER) pageEvent.OnChapter(writer, this, IndentTop - currentHeight, section.Title); else pageEvent.OnSection(writer, this, IndentTop - currentHeight, section.Depth, section.Title); // the title of the section (if any has to be printed) if (hasTitle) { isSectionTitle = true; Add(section.Title); isSectionTitle = false; } indentation.sectionIndentLeft += section.Indentation; // we process the section element.Process(this); // some parameters are set back to normal again indentation.sectionIndentLeft -= (section.IndentationLeft + section.Indentation); indentation.sectionIndentRight -= section.IndentationRight; if (section.ElementComplete && pageEvent != null) if (element.Type == Element.CHAPTER) pageEvent.OnChapterEnd(writer, this, IndentTop - currentHeight); else pageEvent.OnSectionEnd(writer, this, IndentTop - currentHeight); break; } case Element.LIST: { // we cast the element to a List List list = (List) element; if (IsTagged(writer)) { FlushLines(); text.OpenMCBlock(list); } if (list.Alignindent) { list.NormalizeIndentation(); } // we adjust the document indentation.listIndentLeft += list.IndentationLeft; indentation.indentRight += list.IndentationRight; // we process the items in the list element.Process(this); // some parameters are set back to normal again indentation.listIndentLeft -= list.IndentationLeft; indentation.indentRight -= list.IndentationRight; CarriageReturn(); if (IsTagged(writer)) { FlushLines(); text.CloseMCBlock(list); } break; } case Element.LISTITEM: { // we cast the element to a ListItem ListItem listItem = (ListItem) element; if (IsTagged(writer)) { FlushLines(); text.OpenMCBlock(listItem); } AddSpacing(listItem.SpacingBefore, leading, listItem.Font); // we adjust the document alignment = listItem.Alignment; indentation.listIndentLeft += listItem.IndentationLeft; indentation.indentRight += listItem.IndentationRight; leading = listItem.TotalLeading; PushLeading(); CarriageReturn(); // we prepare the current line to be able to show us the listsymbol line.ListItem = listItem; // we process the item element.Process(this); AddSpacing(listItem.SpacingAfter, listItem.TotalLeading, listItem.Font); // if the last line is justified, it should be aligned to the left if (line.HasToBeJustified()) { line.ResetAlignment(); } // some parameters are set back to normal again CarriageReturn(); indentation.listIndentLeft -= listItem.IndentationLeft; indentation.indentRight -= listItem.IndentationRight; PopLeading(); if (IsTagged(writer)) { FlushLines(); text.CloseMCBlock(listItem.ListBody); text.CloseMCBlock(listItem); } break; } case Element.RECTANGLE: { Rectangle rectangle = (Rectangle) element; graphics.Rectangle(rectangle); pageEmpty = false; break; } case Element.PTABLE: { PdfPTable ptable = (PdfPTable)element; if (ptable.Size <= ptable.HeaderRows) break; //nothing to do // before every table, we add a new line and flush all lines EnsureNewLine(); FlushLines(); AddPTable(ptable); pageEmpty = false; NewLine(); break; } case Element.JPEG: case Element.JPEG2000: case Element.JBIG2: case Element.IMGRAW: case Element.IMGTEMPLATE: { //carriageReturn(); suggestion by Marc Campforts if(IsTagged(writer)) { FlushLines(); text.OpenMCBlock((Image)element); } Add((Image)element); if(IsTagged(writer)) { FlushLines(); text.CloseMCBlock((Image)element); } break; } case Element.YMARK: { IDrawInterface zh = (IDrawInterface)element; zh.Draw(graphics, IndentLeft, IndentBottom, IndentRight, IndentTop, IndentTop - currentHeight - (leadingStack.Count > 0 ? leading : 0)); pageEmpty = false; break; } case Element.MARKED: { MarkedObject mo; if (element is MarkedSection) { mo = ((MarkedSection)element).Title; if (mo != null) { mo.Process(this); } } mo = (MarkedObject)element; mo.Process(this); break; } case Element.WRITABLE_DIRECT: if (null != writer) { ((IWriterOperation)element).Write(writer, this); } break; case Element.DIV: EnsureNewLine(); FlushLines(); AddDiv((PdfDiv)element); pageEmpty = false; //newLine(); break; default: return false; } lastElementType = element.Type; return true; }
private void CreateTab(string id, string iconREsource, string label, UIElement content, TabSettings settings) { var tabModel = new ToolTabModel(iconREsource, label); var tab = new ToolTab(id, tabModel, content, Tabs, settings); Tabs.Items.Add(tab); if (settings.IsWindowed == true) { tab.ToExtraWindow(); } else { var focusedTab = IsaacDashSerializer.Settings.GeneralSettings.TabWithFocus; if (!string.IsNullOrEmpty(focusedTab) && id.Equals(focusedTab)) { tab.Focus(); } } }