private void LoadFormState() { // Bounds are empty when the application is minimized while the form is constructed. if (Bounds.IsEmpty) { return; } int sidebarWidth = wbContext.read_state("sidebar_width", "model_diagram", 200); if (sidebarWidth < 0) { sidebarWidth = 200; } if (sidebarWidth > mainSplitContainer.Width) { sidebarWidth = mainSplitContainer.Width / 2; } mainSplitContainer.SplitterDistance = sidebarWidth; sidebarWidth = wbContext.read_state("secondary_sidebar_width", "model_diagram", mainContentSplitContainer.Width - 200); if (mainContentSplitContainer.Width - sidebarWidth < 200) { sidebarWidth = mainContentSplitContainer.Width - 200; } if (sidebarWidth > mainContentSplitContainer.Width) { sidebarWidth = mainContentSplitContainer.Width / 2; } mainContentSplitContainer.SplitterDistance = sidebarWidth; }
private void LoadFormState() { Logger.LogDebug("WQE.net", 1, "Loading form state\n"); // Object side bar. int splitterDistance = wbContext.read_state("sidebar_width", "query_editor", 200); if (splitterDistance < 0) { splitterDistance = 200; } SafeAssignSplitterDistance(mainSplitContainer, splitterDistance); // Output tab. Distance measured from bottom (for easy default value). int storedSize = wbContext.read_state("output_height", "query_editor", 200); SafeAssignSplitterDistance(contentSplitContainer, contentSplitContainer.Height - contentSplitContainer.SplitterWidth - storedSize); // Support side bar. Distance measured from right (for easy default value). storedSize = wbContext.read_state("support_sidebar_width", "query_editor", 200); SafeAssignSplitterDistance(mainContentSplitContainer, mainContentSplitContainer.Width - mainContentSplitContainer.SplitterWidth - storedSize); // Visibility of the sidebar/output areas. bool visible = wbContext.read_state("sidebar_visible", "query_editor", true); dbSqlEditorBE.set_tool_item_checked("wb.toggleSidebar", visible); mainSplitContainer.Panel1Collapsed = !visible; outputIsVisible = wbContext.read_state("output_visible", "query_editor", true); dbSqlEditorBE.set_tool_item_checked("wb.toggleOutputArea", outputIsVisible); contentSplitContainer.Panel2Collapsed = !outputIsVisible; secondarySidebarIsVisible = wbContext.read_state("support_sidebar_visible", "query_editor", true); dbSqlEditorBE.set_tool_item_checked("wb.toggleSecondarySidebar", secondarySidebarIsVisible); mainContentSplitContainer.Panel2Collapsed = !secondarySidebarIsVisible; }