Esempio n. 1
0
        public PictureHolderEditorForm()
        {
            InitializeComponent();
            MinimumSize = Size;

            C1ThemeController.ApplyThemeToControlTree(this, MainForm.TheMainForm.CachedTheme);
        }
Esempio n. 2
0
        // Applies current C1Theme to the controls
        void IThemeable.ThemeChanged()
        {
            _updating = true;
            LockWindowUpdate(Handle);

            ribbonToggleLight.Pressed = SampleHelper.Instance.Theme == "Material";
            C1MaterialThemeSettings settings = Helper.C1Theme.GetSettings() as C1MaterialThemeSettings;

            if (settings != null)
            {
                ribbonColorPicker1.DefaultColor = ribbonColorPicker1.Color = settings.PrimaryColor;
                ribbonColorPicker2.DefaultColor = ribbonColorPicker2.Color = settings.SecondaryColor;
            }
            C1ThemeController.ApplyThemeToControlTree(this, Helper.C1Theme);

            ((IThemeable)_appThemePanel).ThemeChanged();
            ((IThemeable)_appRibbonPanel).ThemeChanged();
            ((IThemeable)flexChart1).ThemeChanged();
            ((IThemeable)flexChart2).ThemeChanged();
            ((IThemeable)c1FlexGrid1).ThemeChanged();
            ((IThemeable)formDemo1).ThemeChanged();
            ((IThemeable)_about)?.ThemeChanged();

            LockWindowUpdate(IntPtr.Zero);
            _updating = false;
        }
Esempio n. 3
0
        public AllowedValuesDefinitionEditorForm()
        {
            InitializeComponent();
            btnOK.Click     += btnOK_Click;
            btnCancel.Click += btnCancel_Click;

            C1ThemeController.ApplyThemeToControlTree(this, MainForm.TheMainForm.CachedTheme);
        }
 private void ApplyTheme()
 {
     if (cmbThemes.SelectedItem != null && _selectedControl != null)
     {
         var displayText = cmbThemes.SelectedItem.DisplayText;
         cmbThemes.Text = displayText;
         C1ThemeController.ApplyThemeToControlTree(_selectedControl, C1ThemeController.GetThemeByName(displayText, false), null, true);
     }
 }
 private void cmbThemes_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbThemes.SelectedIndex == -1)
     {
         return;
     }
     cmbThemes.Text = cmbThemes.SelectedItem.DisplayText;
     C1ThemeController.ApplyThemeToControlTree(pnlSample, C1ThemeController.GetThemeByName((string)cmbThemes.SelectedItem.Value, false), null, true);
 }
Esempio n. 6
0
        public AddSortDefForm(DataSource ds)
            : this()
        {
            C1ThemeController.ApplyThemeToControlTree(this, MainForm.TheMainForm.CachedTheme);

            if (ds.IsDataSourceInfoFetched)
            {
                _cmbSort.Items.Clear();
                ds.DataSourceInfo.TextFields.ForEach(tf_ => _cmbSort.Items.Add(tf_.Name));
            }
        }
Esempio n. 7
0
 public void ManageLayoutDialog()
 {
     using (var dialog = new ManageLayoutForm(this))
     {
         if (Theme != null)
         {
             C1ThemeController.ApplyThemeToControlTree(dialog, C1ThemeController.GetThemeByName(Theme, false));
         }
         dialog.ShowDialog();
     }
 }
Esempio n. 8
0
 private void ApplyTheme(Control control)
 {
     if (!string.IsNullOrEmpty(ThemeName))
     {
         var theme = C1ThemeController.GetThemeByName(ThemeName, false);
         if (theme != null)
         {
             C1ThemeController.ApplyThemeToControlTree(control, theme);
         }
     }
 }
Esempio n. 9
0
        public ParameterValuesEditorForm()
        {
            InitializeComponent();


            c1FlexGrid1.StartEdit      += c1FlexGrid1_StartEdit;
            c1FlexGrid1.AfterEdit      += c1FlexGrid1_AfterEdit;
            c1FlexGrid1.LeaveEdit      += c1FlexGrid1_LeaveEdit;
            c1FlexGrid1.AfterSelChange += c1FlexGrid1_AfterSelChange;
            c1FlexGrid1.KeyPressEdit   += c1FlexGrid1_KeyPressEdit;
            C1ThemeController.ApplyThemeToControlTree(this, MainForm.TheMainForm.CachedTheme);
        }
Esempio n. 10
0
 public void RenameLayout(string name)
 {
     using (var dialog = new SaveLayoutForm(name))
     {
         dialog.Text = "Rename Layout";
         if (Theme != null)
         {
             C1ThemeController.ApplyThemeToControlTree(dialog, C1ThemeController.GetThemeByName(Theme, false));
         }
         if (dialog.ShowDialog() == DialogResult.OK && Directory.Exists(_layoutsDir))
         {
             File.Move(GetLayoutPath(name), GetLayoutPath(dialog.FileName));
         }
     }
 }
 private void ApplyTheme(Control control)
 {
     if (!string.IsNullOrEmpty(ThemeName))
     {
         var theme = C1ThemeController.GetThemeByName(ThemeName, false);
         if (theme != null)
         {
             C1ThemeController.ApplyThemeToControlTree(control, theme);
         }
         c1TrueDBGrid1.SuspendLayout();
         for (int i = 0; i < c1TrueDBGrid1.Splits[0].Rows.Count; i++)
         {
             c1TrueDBGrid1.Splits[0].Rows[i].AutoSize();
         }
         c1TrueDBGrid1.ResumeLayout();
     }
 }
Esempio n. 12
0
        private void ribbonStyleCombo_ChangeCommitted(object sender, EventArgs e)
        {
            this.SuspendPainting();
            C1Theme theme = null;

            try
            {
                theme = C1ThemeController.GetThemeByName(ribbonStyleCombo.Text, false);
            }
            catch
            {
            }
            if (theme != null)
            {
                C1ThemeController.ApplyThemeToControlTree(this, theme);
            }
            this.ResumePainting();
            this.Activate();
        }
Esempio n. 13
0
 public bool SaveLayoutDialog(out string filePath)
 {
     filePath = null;
     using (var dialog = new SaveLayoutForm())
     {
         if (Theme != null)
         {
             C1ThemeController.ApplyThemeToControlTree(dialog, C1ThemeController.GetThemeByName(Theme, false));
         }
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             if (!Directory.Exists(_layoutsDir))
             {
                 Directory.CreateDirectory(_layoutsDir);
             }
             filePath = _layoutsDir + @"\" + dialog.FileName + ".xml";
             return(true);
         }
     }
     return(false);
 }
Esempio n. 14
0
        public void Init(FlexDesignerHostServices provider, ReportParameterValues parameterValues)
        {
            Debug.Assert(parameterValues != null);

            _provider = provider;
            C1FlexReport anotherReport;

            GetReportParameterValuesEnviroment(parameterValues, out _scriptNamePrefix, out anotherReport);
            _report = parameterValues.Report;

            _updating = true;

            _valueEditor = new ValueEditor(c1FlexGrid1);
            _valueEditor.Init(provider, _report.DataSourceName, "");
            C1ThemeController.ApplyThemeToControlTree(_valueEditor, MainForm.TheMainForm.CachedTheme);
            _nameEditor = new NameEditor(c1FlexGrid1);
            _nameEditor.Init(provider, anotherReport);
            C1ThemeController.ApplyThemeToControlTree(_nameEditor, MainForm.TheMainForm.CachedTheme);

            var labelIndex = c1FlexGrid1.Cols.Fixed;
            var valueIndex = labelIndex + 1;

            foreach (var item in parameterValues)
            {
                var row = c1FlexGrid1.Rows.Add();
                row[labelIndex] = ScriptValueHelper.ToString(item.Name);
                row[valueIndex] = ScriptValueHelper.ToString(item.Value);
            }

            c1FlexGrid1.Col = labelIndex;
            if (parameterValues.Count > 0)
            {
                c1FlexGrid1.Row = c1FlexGrid1.Rows.Fixed;
            }

            UpdateButtonsSatus();

            _updating = false;
        }
Esempio n. 15
0
        private void EnsureEditorAdded(int selectedIndex)
        {
            switch (selectedIndex)
            {
            case 0:
                if (dtpWebColors.Controls.IndexOf(_webColorsEditor) < 0)
                {
                    dtpWebColors.Controls.Add(_webColorsEditor);
                    C1ThemeController.ApplyThemeToControlTree(_webColorsEditor, MainForm.TheMainForm.CachedTheme);
                }
                break;

            case 1:
                if (dtpSystemColors.Controls.IndexOf(_systemColorsEditor) < 0)
                {
                    dtpSystemColors.Controls.Add(_systemColorsEditor);
                    C1ThemeController.ApplyThemeToControlTree(_systemColorsEditor, MainForm.TheMainForm.CachedTheme);
                }
                break;

            case 2:
                if (dtpCustom.Controls.IndexOf(_customColorEditor) < 0)
                {
                    dtpCustom.Controls.Add(_customColorEditor);
                    C1ThemeController.ApplyThemeToControlTree(_customColorEditor, MainForm.TheMainForm.CachedTheme);
                }
                break;

            case 3:
                if (dtpGradient.Controls.IndexOf(_gradientEditor) < 0)
                {
                    dtpGradient.Controls.Add(_gradientEditor);
                    C1ThemeController.ApplyThemeToControlTree(_gradientEditor, MainForm.TheMainForm.CachedTheme);
                }
                break;
            }
        }
Esempio n. 16
0
 public BackgroundEditorControl()
 {
     InitializeComponent();
     C1ThemeController.ApplyThemeToControlTree(this, MainForm.TheMainForm.CachedTheme);
 }
Esempio n. 17
0
        public static void ApplyTheme(Control control)
        {
            var theme = Theme;

            if (theme != null)
            {
                if (control == TheExplorer)
                {
                    // color all icons according to the new loaded theme
                    Color foreground      = Theme.GetColor(@"BaseThemeProperties\ControlText");
                    bool  needUpdateIcons = foreground != TheExplorer._icons.Foreground;
                    if (needUpdateIcons)
                    {
                        TheExplorer._icons.Foreground = foreground;
                        // Data Visualization group
                        ApplyTileImages(TheExplorer.tilesControlDV.Groups[0].Tiles);
                        // Grids and Data Management group
                        ApplyTileImages(TheExplorer.tilesControlGDM.Groups[0].Tiles);
                        // Input and Editing group
                        ApplyTileImages(TheExplorer.tilesControlIaE.Groups[0].Tiles);
                        // Navigation and Layout group
                        ApplyTileImages(TheExplorer.tilesControlNaL.Groups[0].Tiles);
                        // Reporting and Documents group
                        ApplyTileImages(TheExplorer.tilesControlRaD.Groups[0].Tiles);
                        // Scheduling group
                        ApplyTileImages(TheExplorer.tilesControlSch.Groups[0].Tiles);
                        // Utilities group
                        ApplyTileImages(TheExplorer.tilesControlUtil.Groups[0].Tiles);

                        // new
                        ApplyTileImages(TheExplorer.tilesNew.Groups[0].Tiles);
                        // favorites
                        ApplyTileImages(TheExplorer.tilesPopular.Groups[0].Tiles);
                    }
                    TheExplorer.UpdateStyles();
                }

                if (control.FindForm() == TheExplorer)
                {
                    // Controls that rely on specific colors to be visible/usable:
                    List <Control> noTheming = new List <Control>()
                    {
                        TheExplorer.pnlInputPanel,
                    };
                    C1ThemeController.ApplyThemeToControlTree(control, theme, (c) => !noTheming.Contains(c) && (!(c is C1DemoForm) || ((C1DemoForm)c).IsThemeable));
                }
                else
                {
                    var demoForm = control as C1DemoForm;
                    if (demoForm == null || demoForm.IsThemeable)
                    {
                        C1ThemeController.ApplyThemeToControlTree(control, theme);
                    }
                }

                // Style non themable controls for uniformity
                StyleForNonThemableControls();

                if (control == TheExplorer)
                {
                    OnThemeApplied(EventArgs.Empty);
                }
            }
        }
Esempio n. 18
0
        public ScriptEditorFormEx(
            MainForm mainForm,
            C1FlexReport report,
            string scriptContextName,
            // either this:
            ITypeDescriptorContext typeDescriptorContext,
            // or these two:
            object propertyOwner,
            string propertyName,
            // if non-null, used instead of derived name for display ONLY (does not affect script item key)
            string displayName,
            //
            bool isScript)
            : this()
        {
            System.Diagnostics.Debug.Assert(typeDescriptorContext != null || (propertyOwner != null && !string.IsNullOrEmpty(propertyName)));

            AutoScaleMode       = AutoScaleMode.None;
            Font                = MainForm.DefaultAppFont;
            _mainForm           = mainForm;
            _report             = report;
            _contexts           = new EditorScriptContextCollection(this, report, _mainForm.FlexDesigner);
            _activeScriptEditor = _scriptEditor0;
            //
            rbnMain.BeginUpdate();
            //
            _scriptEditor1.TextBox.Font          = _scriptEditor0.TextBox.Font = _mainForm._scriptEditorFont;
            _scriptEditor1.EditorBackgroundColor = _scriptEditor0.EditorBackgroundColor = _mainForm._scriptEditorBackColor;
            _scriptEditor1.EditorTextColor       = _scriptEditor0.EditorTextColor = _mainForm._scriptEditorForeColor;
            _scriptEditor1.SyntaxAutoCheck       = _scriptEditor0.SyntaxAutoCheck = _mainForm._syntaxCheck;
            _scriptEditor1.AutoSaveCurrentScript = _scriptEditor0.AutoSaveCurrentScript = _mainForm._scriptEditorAutoSave;
            // init options in ribbon UI:
            rbEditorFontName.Text             = _mainForm._scriptEditorFont.Name;
            rbBackgroundColor.Color           = _mainForm._scriptEditorBackColor;
            rbTextColor.Color                 = _mainForm._scriptEditorForeColor;
            rbSyntaxHighlight.Checked         = _mainForm._syntaxColoring;
            rbSyntaxAutoCheck.Checked         = _mainForm._syntaxCheck;
            rbAutoSave.Checked                = _mainForm._scriptEditorAutoSave;
            rbDataSourceFilterWarning.Checked = _mainForm._scriptEditorDataSourceFilterWarning;
            // font size:
            for (int i = c_minFontSize; i <= c_maxFontSize; ++i)
            {
                rbFontSize.Items.Add(i.ToString());
            }
            rbFontSize.Text = ((int)Math.Round(_scriptEditor0.EditorFont.Size)).ToString();

            _scriptEditor0.TextBox.GotFocus         += ScriptEditorGotFocus;
            _scriptEditor0.CurrentScriptItemChanged += CurrentScriptItemChanged;
            _scriptEditor0.CurrentScriptTextChanged += CurrentScriptTextChanged;
            _scriptEditor0.ScriptWritten            += ScriptWritten;
            _scriptEditor0.TextSelectionChanged     += TextSelectionChanged;
            _scriptEditor0.SyntaxCheckNeeded        += SyntaxCheckNeeded;

            _scriptEditor1.TextBox.GotFocus         += ScriptEditorGotFocus;
            _scriptEditor1.CurrentScriptItemChanged += CurrentScriptItemChanged;
            _scriptEditor1.CurrentScriptTextChanged += CurrentScriptTextChanged;
            _scriptEditor1.ScriptWritten            += ScriptWritten;
            _scriptEditor1.TextSelectionChanged     += TextSelectionChanged;
            _scriptEditor1.SyntaxCheckNeeded        += SyntaxCheckNeeded;

            _scriptItems = new EditorScriptItemCollection(_report, _contexts, _mainForm.FlexDesigner);

            // initial mode we start with:
            bool splitWindowMode = _mainForm._scriptEditorSplitWindowDistance > 0;

            // script data context:
            EditorScriptContextBase context = _contexts.GetContext(scriptContextName);

            System.Diagnostics.Debug.Assert(context != null);

            // this is patchy but will do for now:
            // - if we are being called from prop grid, then we have EditContext and edit that;
            // - else, if we are called to edit an expression - this is creating a new field;
            // - else, the big "Edit Scripts" button was pressed, and we default to GlobalScripts.

            EditorScriptItem scriptItem;

            if (typeDescriptorContext != null)
            {
                scriptItem = EditorScriptItem.FromTypeDescriptorContext(typeDescriptorContext, context, isScript, displayName);
            }
            else
            {
                scriptItem = EditorScriptItem.FromObjectProperty(propertyOwner, propertyName, context, isScript, displayName);
            }

            // A script item may not be "collected" if it is a new calc field being added, or e.g. in Maps there are many expressions:
            if (!_scriptItems.ContainsKey(scriptItem.Key))
            {
                scriptItem.EnsureTopKey();
                _scriptItems.Add(scriptItem.Key, scriptItem);
            }

            _scriptEditor0.Init(mainForm, _report, _scriptItems);
            _scriptEditor1.Init(mainForm, _report, _scriptItems);

            // _scriptItemKey is used ONLY for returning the script with which we were called:
            _scriptItemKey = scriptItem.Key;
            if (splitWindowMode)
            {
                _scriptEditor1.SetCurrentScriptItem(_scriptItemKey, Forms.ScriptEditorControl.SetCurrentScriptItemContext.Initial);
                if (_scriptItems.ContainsKey(_mainForm._scriptEditorLastItemKey0))
                {
                    _scriptEditor0.SetCurrentScriptItem(_mainForm._scriptEditorLastItemKey0, Forms.ScriptEditorControl.SetCurrentScriptItemContext.Initial);
                }
                else
                {
                    _scriptEditor0.SetCurrentScriptItem(_scriptItemKey, Forms.ScriptEditorControl.SetCurrentScriptItemContext.Initial);
                }
            }
            else
            {
                _scriptEditor0.SetCurrentScriptItem(_scriptItemKey, Forms.ScriptEditorControl.SetCurrentScriptItemContext.Initial);
                _scriptEditor1.SetCurrentScriptItem(_scriptItemKey, Forms.ScriptEditorControl.SetCurrentScriptItemContext.Initial);
            }

            // Apply main window's theme:
            var tl    = new C1ThemeLocator(_mainForm.Theme);
            var theme = tl.GetTheme();

            if (theme != null)
            {
                C1ThemeController.ApplyThemeToControlTree(this, theme);
                C1ThemeController.ApplyThemeToObject(contextMenu, theme);
            }

            // Set up script editors' glyphs - splitter and close window:
            _scriptEditor0.GlyphBox.Cursor = Cursors.HSplit;
            _scriptEditor1.GlyphBox.Image  = Properties.Resources.SplitWindowClose_16x16;

            _splitter.SplitterMoved                     += Splitter_SplitterMoved;
            _scriptEditor0.GlyphBox.MouseEnter          += GlyphBox0_MouseEnter;
            _scriptEditor0.GlyphBox.MouseLeave          += GlyphBox0_MouseLeave;
            _scriptEditor0.GlyphBox.MouseDown           += GlyphBox0_MouseDown;
            _scriptEditor0.GlyphBox.MouseMove           += GlyphBox0_MouseMove;
            _scriptEditor0.GlyphBox.MouseUp             += GlyphBox0_MouseUp;
            _scriptEditor0.GlyphBox.MouseCaptureChanged += GlyphBox0_MouseCaptureChanged;
            _scriptEditor1.GlyphBox.MouseDown           += GlyphBox1_MouseDown;

            // Ready to start:
            UpdateStatusBar();
            //
            rbnMain.EndUpdate();
            //
        }