Example #1
0
        public void SaveTitleSetupToOptions(TitleSetup title_setup)
        {
            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

            options.TitleSetup = title_setup;
            options.SaveSettingsToStorage();
        }
Example #2
0
 private void Fixup()
 {
     if (m_TitleSetup == null)
     {
         m_TitleSetup = new TitleSetup();
     }
     else
     {
         m_TitleSetup.Fixup();
     }
 }
Example #3
0
 void SaveTitleSetup()
 {
     if (!IsSetupModified())
     {
         return;
     }
     m_OrigTitleSetup = Util.Clone(m_TitleSetup);
     SetupModifiedChanged();
     if (SaveEditedSetup != null)
     {
         SaveEditedSetup(m_TitleSetup);
     }
     editTitleExpression.Focus();
 }
        PackageGlobals(VSWindowTitleChangerPackage package)
        {
            m_Package = package;
            CreateCompileTimeConstants();
            ParseDTEVersion();

            m_ExecFuncEvaluatorThread = new ExecFuncEvaluatorThread();

            m_TitleSetup       = package.GetTitleSetupFromOptions();
            m_TitleSetupEditor = new TitleSetupEditor();
            m_TitleSetupEditor.SaveEditedSetup       += SaveEditedSetup;
            m_TitleSetupEditor.RevertToOriginalSetup += RevertToOriginalSetup;

            m_TitleSetupEditor.CustomTabbingEnabled = true;
        }
Example #5
0
        void buttonRevert_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show(this, "Do you really want to revert to the last saved expression?",
                                               "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.No)
            {
                return;
            }

            m_TitleSetup = Util.Clone(m_OrigTitleSetup);
            if (RevertToOriginalSetup != null)
            {
                RevertToOriginalSetup(m_TitleSetup);
            }
            SetupChanged();
            editTitleExpression.Focus();
        }
Example #6
0
        void TitleSetupEditor_VisibleChanged(object sender, EventArgs e)
        {
            if (Visible)
            {
                m_ClosingWithOK = false;

#if !DEBUG_GUI
                m_BackgroundExpressionCompiler.CompileTimeConstants = PackageGlobals.Instance().CompileTimeConstants;
#endif
                m_BackgroundExpressionCompiler.Enabled = true;
            }
            else
            {
                m_BackgroundExpressionCompiler.Enabled = false;

                TitleSetup = new TitleSetup();
                // Don't fill an empty string into editTitleExpression.Text because its a know bug that
                // it resets the tabsize we previously set with SetTabStopChars().
                editTitleExpression.Text = " ";
                editTitleExpression.ClearUndo();
            }

            UpdateExecDebug();
        }
Example #7
0
        private void UpdateWindowTitle()
        {
            m_VSMainWindow.Update();

            PackageGlobals globals           = PackageGlobals.Instance();
            EvalContext    eval_ctx          = globals.CreateFreshEvalContext();
            bool           variables_changed = !CompareVariables(eval_ctx.VariableValues, m_PrevVariableValues);

            if (variables_changed)
            {
                m_PrevVariableValues = eval_ctx.VariableValues;
                globals.TitleSetupEditor.Variables = eval_ctx.VariableValues;
            }

            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

#if VS2010_AND_LATER
            if (m_DebugPrintTitleControlHierarchyCount < 5 && options.Debug)
            {
                ++m_DebugPrintTitleControlHierarchyCount;
                m_VSMainWindow.DebugPrintTitleControlHierarchy();
            }
#endif

            PackageGlobals.VSMultiInstanceInfo multi_instance_info;
            globals.GetVSMultiInstanceInfo(out multi_instance_info);

            bool extension_active;
            switch (options.ExtensionActivationRule)
            {
            case EExtensionActivationRule.ActiveWithMultipleVSInstances:
                extension_active = multi_instance_info.multiple_instances;
                break;

            case EExtensionActivationRule.ActiveWithMultipleVSInstancesOfTheSameVersion:
                extension_active = multi_instance_info.multiple_instances_same_version;
                break;

            case EExtensionActivationRule.AlwaysInactive:
                extension_active = false;
                break;

            default:
                extension_active = true;
                break;
            }

            if (extension_active)
            {
                TitleSetup title_setup = globals.TitleSetup;
                if (m_ExpressionContainsExec || variables_changed || m_PrevExtensionActivationRule != options.ExtensionActivationRule ||
                    title_setup.TitleExpression != m_PrevTitleExpressionStr)
                {
                    Parser parser             = new Parser(title_setup.TitleExpression, globals.ExecFuncEvaluator, globals.CompileTimeConstants);;
                    ExpressionCompilerJob job = new ExpressionCompilerJob(parser, globals.CreateFreshEvalContext(), false, m_CompiledExpressionCache);
                    job.OnCompileFinished += OnCompileFinished;
                    m_ExpressionCompilerThread.RemoveAllJobs();
                    m_ExpressionCompilerThread.AddJob(job);
                }
                m_PrevTitleExpressionStr = title_setup.TitleExpression;
            }
            else
            {
                m_VSMainWindow.SetTitle(m_VSMainWindow.OriginalTitle);
            }

            m_PrevExtensionActivationRule = options.ExtensionActivationRule;
        }
 void RevertToOriginalSetup(TitleSetup title_setup)
 {
     m_TitleSetup = title_setup;
 }
 void SaveEditedSetup(TitleSetup title_setup)
 {
     m_TitleSetup = title_setup;
     m_Package.SaveTitleSetupToOptions(m_TitleSetup);
 }