Пример #1
0
        // }}}
        // Close {{{
        new protected void Close()
        {
            // OK
            if (result == DialogResult.OK)
            {
                // ...activate shortcut
                np.Type = NotePane.TYPE_SHORTCUT;
                TabsCollection.Clone_selection_Type(np);

                // ...transfer changes made to the clone back to the the stem
                //  if(!np._tb.Rtf       .Equals( np_clone._tb.Rtf        )                                 ) { np._tb.Rtf        = np_clone._tb.Rtf;                                      TabsCollection.Clone_selection_Rtf       ( np ); }
                if (!np._tb.Text.Equals(np_clone._tb.Text))
                {
                    np._tb.Text = np_clone._tb.Text.Replace(Environment.NewLine, @"\n"); TabsCollection.Clone_selection_Text(np);
                }
                if (!np._tb.ZoomFactor.Equals(np_clone._tb.ZoomFactor))
                {
                    np._tb.ZoomFactor = np_clone._tb.ZoomFactor;                               TabsCollection.Clone_selection_ZoomFactor(np);
                }
                if (!np.zoom.Equals(np_clone.zoom))
                {
                    np.zoom = np_clone.zoom;                                         TabsCollection.Clone_selection_zoom(np);
                }
                if (!np.color.Equals(np_clone.color) || collection_color_has_been_set)
                {
                    np.color = np_clone.color;                                        TabsCollection.Clone_selection_color(np);
                }
                if (!np.shape.Equals(np_clone.shape) || collection_shape_has_been_set)
                {
                    np.shape = np_clone.shape;                                        TabsCollection.Clone_selection_shape(np);
                }
            }
            // ESCAPE
            else if (result == DialogResult.Ignore)
            {
                // ...no change
            }
            // ACTIVATE
            else if (result == DialogResult.Yes)
            {
                // ...toggle shortcut
                if (np.Type == NotePane.TYPE_SHORTCUT)
                {
                    np.Type = NotePane.TYPE_RICHTEXT;
                }
                else
                {
                    np.Type = NotePane.TYPE_SHORTCUT;
                }

                // ...propagate to currently selected tabs
                TabsCollection.Clone_selection_Type(np);
            }
            // CANCEL
            else
            {
                // ...no change
            }
            base.Close();
        }
Пример #2
0
 private void btn_sel_clear_Click(object sender, EventArgs e)
 {
     TabsCollection.Sel_Clear();
     ttf.lbl_sel_count.Visible = false;
     ttf.btn_sel_clear.Visible = false;
     set_radio_color_BackColor(Settings.MainFormInstance.BackColor);
     set_radio_shape_BackColor(Settings.MainFormInstance.BackColor);
 }
Пример #3
0
        private void ShowSettings()
        {
            SettingsList_ViewModel tab = TabsCollection.FirstOrDefault(vm => vm.DisplayName == SettingsList_ViewModel.MyName)
                                         as SettingsList_ViewModel;

            if (tab == null)
            {
                tab = new SettingsList_ViewModel(settingsList);
                TabsCollection.Add(tab);
                tab.RestartRequest += Tab_RestartRequest;
            }

            SetActiveTab(tab);
        }
Пример #4
0
        private void radio_shape_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rb = (RadioButton)sender;

            if (rb == radio_shape_circle)
            {
                np_clone.shape = "circle";
            }
            else if (rb == radio_shape_onedge)
            {
                np_clone.shape = "onedge";
            }
            else if (rb == radio_shape_padd_r)
            {
                np_clone.shape = "padd_r";
            }
            else if (rb == radio_shape_square)
            {
                np_clone.shape = "square";
            }
            else if (rb == radio_shape_tile)
            {
                np_clone.shape = "tile";
            }
            else if (rb == radio_shape_auto)
            {
                np_clone.shape = "";
            }
            // no default for unchanged options
            int sel_count = TabsCollection.Get_Sel_Count_but_this_one(np);

            if (sel_count > 0)
            {
                collection_shape_has_been_set = true;
                set_radio_shape_BackColor(Settings.MainFormInstance.BackColor);
            }
        }
Пример #5
0
        public static DialogResult ShowDialog(NotePane np, string tag_old, out string tag_new)
        {
            // SINGLETON -  {{{
            int x, y, w, h;

            if (ttf == null)
            {
                ttf = new TabTagForm();

                // START POSITION .. parent middle
                x = Settings.MainFormInstance.Location.X;
                y = Settings.MainFormInstance.Location.Y
                    + Settings.MainFormInstance.ClientSize.Height / 2
                    - ttf.ClientSize.Height / 2
                ;
                ttf.Location = new Point(x, y);

                // Start Dimension .. fit parent width
                w = Settings.MainFormInstance.ClientSize.Width;
                h = ttf.ClientSize.Height;
                ttf.ClientSize = new Size(w, h);

                ToolTip toolTip = new System.Windows.Forms.ToolTip();
                toolTip.BackColor = Settings.MainFormInstance.BackColor;
                toolTip.ForeColor = Settings.MainFormInstance.ForeColor;

                toolTip.SetToolTip(ttf.btn_ok, "EDIT: apply changes");
                toolTip.SetToolTip(ttf.btn_activate, "EDIT: activate / desactivate");
                toolTip.SetToolTip(ttf.btn_cancel, "EDIT: ignore changes");

                toolTip.SetToolTip(ttf.btn_RUN, "SERVER: RUN EXECUTABLE\n ...as a new process");
                toolTip.SetToolTip(ttf.btn_SHELL, "SERVER: OPEN FILE\n...with the default related application");
                toolTip.SetToolTip(ttf.btn_SENDKEYS, "SERVER: SEND KEYS TO THE CURRENT WINDOW\n ...as they would come from the KEYBOARD");
                toolTip.SetToolTip(ttf.btn_PROFILE, "SERVER: LOAD PROFILE");

                toolTip.SetToolTip(ttf.lbl_INFO, "Send SHIFT-ESCAPE to the TAB PANEL\nto reset RichText attributes\n(i.e. ZoomFactor, ...)");
            }
            //}}}

            // TAB NAME - (StartPosition - Manual) {{{
            ttf.Text = Settings.APP_NAME;
            ttf.lbl_tab_name.Text = np.Name;

            // }}}
            // DISPLAY CURRENT TAG COMMAND // {{{
            if (!string.IsNullOrEmpty(tag_old))
            {
                ttf.txt_current.Text = tag_old;
                ttf.txt_input.Text   = tag_old;
            }
            // }}}
            // CLONE NotePane {{{
            ttf.np              = np;
            ttf.np_clone        = NotePane.Clone(ttf.np);
            ttf.np_clone.Parent = ttf;

            x = ttf.btn_ok.Location.X + ttf.btn_ok.ClientSize.Width + 8;
            y = ttf.btn_ok.Location.Y;
            ttf.np_clone_L        = new Point(x, y);
            ttf.np_clone.Location = ttf.np_clone_L;

            w = ttf.btn_SENDKEYS.Location.X
                - ttf.btn_ok.Location.X
                - ttf.btn_ok.ClientSize.Width
                - 24;
            h = ttf.MinimumSize.Height
                - ttf.btn_ok.Location.Y
                - 12;
            ttf.np_clone_S          = new Size(w, h);
            ttf.np_clone.ClientSize = ttf.np_clone_S;

            ttf.np_clone_Z = ttf.np_clone._tb.ZoomFactor;

            ttf.np_clone.KeyUp     += new System.Windows.Forms.KeyEventHandler(ttf.text_KeyUp);
            ttf.np_clone._tb.KeyUp += new System.Windows.Forms.KeyEventHandler(ttf.text_KeyUp);

            ttf.btn_activate.Text = (np.Type != NotePane.TYPE_SHORTCUT) ? "Activate" : "De-Activate";

            // radio_color {{{
            // leave radio buttons unchecked when working with a collection .. (commit changes forced)
            int sel_count = TabsCollection.Get_Sel_Count_but_this_one(np);

            if (sel_count > 0)
            {
                ttf.radio_color01.Checked = false;
                ttf.radio_color02.Checked = false;
                ttf.radio_color03.Checked = false;
                ttf.radio_color04.Checked = false;
                ttf.radio_color05.Checked = false;
                ttf.radio_color06.Checked = false;
                ttf.radio_color07.Checked = false;
                ttf.radio_color08.Checked = false;
                ttf.radio_color09.Checked = false;
                ttf.radio_color10.Checked = false;
                ttf.radio_color11.Checked = false;
                ttf.radio_color00.Checked = false;
                set_radio_color_BackColor(Color.Blue);
            }
            else
            {
                switch (np.color)
                {
                case "01": ttf.radio_color01.Checked = true; break;

                case "02": ttf.radio_color02.Checked = true; break;

                case "03": ttf.radio_color03.Checked = true; break;

                case "04": ttf.radio_color04.Checked = true; break;

                case "05": ttf.radio_color05.Checked = true; break;

                case "06": ttf.radio_color06.Checked = true; break;

                case "07": ttf.radio_color07.Checked = true; break;

                case "08": ttf.radio_color08.Checked = true; break;

                case "09": ttf.radio_color09.Checked = true; break;

                case "10": ttf.radio_color10.Checked = true; break;

                case "11": ttf.radio_color11.Checked = true; break;

                default: ttf.radio_color00.Checked = true; break;
                }
                set_radio_color_BackColor(Settings.MainFormInstance.BackColor);
            }
            //}}}

            // radio_shape {{{
            if (sel_count > 0)
            {
                ttf.radio_shape_tile.Checked   = false;
                ttf.radio_shape_circle.Checked = false;
                ttf.radio_shape_onedge.Checked = false;
                ttf.radio_shape_padd_r.Checked = false;
                ttf.radio_shape_square.Checked = false;
                ttf.radio_shape_auto.Checked   = false;
                set_radio_shape_BackColor(Color.Blue);
            }
            else
            {
                switch (np.shape)
                {
                case   "tile": ttf.radio_shape_tile.Checked = true; break;

                case "circle": ttf.radio_shape_circle.Checked = true; break;

                case "onedge": ttf.radio_shape_onedge.Checked = true; break;

                case "padd_r": ttf.radio_shape_padd_r.Checked = true; break;

                case "square": ttf.radio_shape_square.Checked = true; break;

                default: ttf.radio_shape_auto.Checked = true; break;
                }
                set_radio_shape_BackColor(Settings.MainFormInstance.BackColor);
            }
            //}}}

            //}}}
            // FORM COLOR {{{
            ttf.BackColor = Settings.MainFormInstance.BackColor;

            //}}}
            // FORM SIZE // {{{

/*
 *          w           = ttf.ClientSize.Width; // previous width
 *          int  wm     = ttf.np_clone.Location.X + ttf.np_clone.ClientSize.Width  + 16;
 *          if(w<wm) w  = wm;
 *
 *          h           = ttf.MinimumSize.Height;
 *          int  hm     = ttf.  btn_ok.Location.Y + ttf.np_clone.ClientSize.Height + 16;
 *          if(h<hm) h  = hm;
 *
 *          ttf.ClientSize = new Size(w, h);
 */
            // }}}
            // number of selected tabs to be changed along the current one {{{
            if (sel_count > 0)
            {
                string s = (sel_count > 1) ? "tabs" : "tab";
                ttf.lbl_sel_count.Text    = "...or also change the " + sel_count.ToString() + " other selected " + s;
                ttf.lbl_sel_count.Visible = true;
                ttf.btn_sel_clear.Visible = true;
            }
            else
            {
                ttf.lbl_sel_count.Visible = false;
                ttf.btn_sel_clear.Visible = false;
            }
            //}}}
            // EDIT .. (wait for input] {{{
            ttf.ShowDialog();

            if (ttf.result == DialogResult.OK)
            {
                tag_new = ttf.txt_input.Text;
            }
            else
            {
                tag_new = tag_old;
            }

            //  if(ttf != null) ttf.Dispose();
            //  if(ttf.components != null) ttf.components.Dispose();
            ttf.np_clone.Dispose();
            ttf.np_clone = null;
            ttf.np       = null;

            //}}}

            log("ShowDialog:\n"
                + "DialogResult.OK=[" + DialogResult.OK + "]\n"
                + "     ttf.result [" + ttf.result + "]\n"
                + "        tag_old [" + tag_old + "]"
                + "        tag_new [" + tag_new + "]"
                );
            return(ttf.result);
        }
Пример #6
0
        private void radio_color_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rb = (RadioButton)sender;

            if (rb == radio_color01)
            {
                np_clone.color = "01";
            }
            else if (rb == radio_color02)
            {
                np_clone.color = "02";
            }
            else if (rb == radio_color03)
            {
                np_clone.color = "03";
            }
            else if (rb == radio_color04)
            {
                np_clone.color = "04";
            }
            else if (rb == radio_color05)
            {
                np_clone.color = "05";
            }
            else if (rb == radio_color06)
            {
                np_clone.color = "06";
            }
            else if (rb == radio_color07)
            {
                np_clone.color = "07";
            }
            else if (rb == radio_color08)
            {
                np_clone.color = "08";
            }
            else if (rb == radio_color09)
            {
                np_clone.color = "09";
            }
            else if (rb == radio_color10)
            {
                np_clone.color = "10";
            }
            else if (rb == radio_color11)
            {
                np_clone.color = "11";
            }
            else if (rb == radio_color00)
            {
                np_clone.color = "";
            }
            // no default for unchanged options
            int sel_count = TabsCollection.Get_Sel_Count_but_this_one(np);

            if (sel_count > 0)
            {
                collection_color_has_been_set = true;
                set_radio_color_BackColor(Settings.MainFormInstance.BackColor);
            }
        }