Exemple #1
0
        /// <summary>
        /// SelectedIndexChanged Event handler for the tabControl object.
        /// </summary>
        /// <param name="sender">The source object of this event.</param>
        /// <param name="e">Event parameters.</param>
        private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (isTextValidating)
            {
                return;
            }

            buttonAddFont.Visible    = false;
            buttonRemoveFont.Visible = false;

            if (tabControl.SelectedIndex == 0)
            {
                ValidateTextContents();
                buttonSave.Enabled = styleLibraryChanged;
            }
            else if (tabControl.SelectedIndex == 1)
            {
                string txt = StyleLibrary.LoadTextContents();
                if (scintillaControl.Text != txt)
                {
                    isInitStyleLibText    = true;
                    scintillaControl.Text = txt;
                    SetMargins();

                    if (caretPos > 0)
                    {
                    }

                    textChanged        = false;
                    isInitStyleLibText = false;
                }
                scintillaControl.Focus();
                textChanged        = false;
                buttonSave.Enabled = styleLibraryChanged;
            }
            else if (tabControl.SelectedIndex == 2)
            {
                buttonSave.Enabled = false;
            }
            else if (tabControl.SelectedIndex == 3)
            {
                buttonSave.Enabled       = false;
                buttonAddFont.Visible    = true;
                buttonRemoveFont.Visible = true;
                buttonRemoveFont.Enabled = (listViewFonts.SelectedItems.Count > 0);
            }

            if (tabControl.SelectedIndex != 3 && fontsetChanged)
            {
                if (MessageBox.Show("Do you wish to save the modifications of the symbolset?", "MapManager", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SaveFontset();
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Saving the symbolset to file
 /// </summary>
 private void SaveSymbolset()
 {
     if (StyleLibrary.SymbolsetFileName != null && symbolsetChanged)
     {
         File.WriteAllText(StyleLibrary.SymbolsetFileName, scintillaControlSymbolset.Text);
         // reconstruct the in memory style lib with this new symbolset (without writing a file)
         string text = StyleLibrary.LoadTextContents();
         StyleLibrary.ApplyTextContents(text);
         layerControlStyles.Target = StyleLibrary.Styles;
         SetSymbolsetModified(false);
     }
 }
Exemple #3
0
 /// <summary>
 /// Saving the fontset to file
 /// </summary>
 private void SaveFontset()
 {
     if (StyleLibrary.FontsetFileName != null && fontsetChanged)
     {
         StringBuilder fontsetContents = new StringBuilder();
         foreach (ListViewItem item in listViewFonts.Items)
         {
             fontsetContents.AppendLine(String.Format("{0}\t{1}", item.Text, item.SubItems[1].Text));
         }
         File.WriteAllText(StyleLibrary.FontsetFileName, fontsetContents.ToString());
         // reconstruct the in memory style lib with this new fontset (without writing a file)
         string text = StyleLibrary.LoadTextContents();
         StyleLibrary.ApplyTextContents(text);
         layerControlStyles.Target = StyleLibrary.Styles;
         SetFontsetModified(false);
     }
 }