Exemple #1
0
        bool DoPasteAndSelect(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            var pasteAndSelectInfo = new PasteAndSelectInfo(text, allEntries);

            pasteAndSelectInfo.SelectMatches();

            if (pasteAndSelectInfo.NonMatchCount > 0)
            {
                cmbYear.SelectedIndex = 0;

                if (pasteAndSelectInfo.NonMatchCount > 1)
                {
                    rbOr.Checked = true;
                }
            }

            txtFilter.Text = pasteAndSelectInfo.CreateNonMatchList(" ");

            UpdateFilter();

            return(true);
        }
Exemple #2
0
/*
 *
 * When you copy several BibTeX keys to your clipboard in Docear, e.g. 'miller2000, smith89, johnson2007', and press this button,
 * Docear4Word will automatically select the entries matching the BibTeX keys miller2000, smith89 and johnson2007.
 *
 * Valid separators for BibTeX keys are commas, semicolons, pipes, and spaces. */
        void UpdatePasteAndSelectButton()
        {
            var clipboardText = SafeClipboardGetText();
            var canPaste      = clipboardText != null && allEntries.Count > 0;

            if (canPaste)
            {
                var pasteAndSelectInfo = new PasteAndSelectInfo(clipboardText, allEntries);

                string tooltipText;

                if (pasteAndSelectInfo.ExactMatchCount == 0)
                {
                    tooltipText = string.Format("Docear4Word cannot match any of the entries on the clipboard:\r\n    {0}", pasteAndSelectInfo.CreateOriginalNamesList(", "));
                }
                else if (pasteAndSelectInfo.NonMatchCount == 0)
                {
                    tooltipText = string.Format("Docear4Word will match all of the Entries on the clipboard:\r\n    {0}", pasteAndSelectInfo.CreateOriginalNamesList(", "));
                }
                else
                {
                    tooltipText = string.Format("Docear4Word will match some of the entries on the clipboard:\r\n    {0}\r\n\r\nThe remainder will be left as a filter for manual matching:\r\n    {1}",
                                                pasteAndSelectInfo.CreateExactMatchList(", "), pasteAndSelectInfo.CreateNonMatchList(", "));
                }

                btnPaste.Enabled = true;
                toolTip.SetToolTip(btnPaste, tooltipText);
            }
            else
            {
                btnPaste.Enabled = false;
                toolTip.SetToolTip(btnPaste, null);
            }

            btnPasteCover.Visible = !btnPaste.Enabled;
        }
		bool DoPasteAndSelect(string text)
		{
			if (string.IsNullOrEmpty(text)) return false;

			var pasteAndSelectInfo = new PasteAndSelectInfo(text, allEntries);

			pasteAndSelectInfo.SelectMatches();

			if (pasteAndSelectInfo.NonMatchCount > 0)
			{
				cmbYear.SelectedIndex = 0;

				if (pasteAndSelectInfo.NonMatchCount > 1)
				{
					rbOr.Checked = true;
				}
			}

			txtFilter.Text = pasteAndSelectInfo.CreateNonMatchList(" ");

			UpdateFilter();

			return true;
		}
/*

When you copy several BibTeX keys to your clipboard in Docear, e.g. 'miller2000, smith89, johnson2007', and press this button,
Docear4Word will automatically select the entries matching the BibTeX keys miller2000, smith89 and johnson2007. 

Valid separators for BibTeX keys are commas, semicolons, pipes, and spaces. */
		void UpdatePasteAndSelectButton()
		{
			var clipboardText = SafeClipboardGetText();
			var canPaste = clipboardText != null && allEntries.Count > 0;

			if (canPaste)
			{
				var pasteAndSelectInfo = new PasteAndSelectInfo(clipboardText, allEntries);

				string tooltipText;

				if (pasteAndSelectInfo.ExactMatchCount == 0)
				{
					tooltipText = string.Format("Docear4Word cannot match any of the entries on the clipboard:\r\n    {0}", pasteAndSelectInfo.CreateOriginalNamesList(", "));
				}
				else if (pasteAndSelectInfo.NonMatchCount == 0)
				{
					tooltipText = string.Format("Docear4Word will match all of the Entries on the clipboard:\r\n    {0}", pasteAndSelectInfo.CreateOriginalNamesList(", "));
				}
				else
				{
					tooltipText = string.Format("Docear4Word will match some of the entries on the clipboard:\r\n    {0}\r\n\r\nThe remainder will be left as a filter for manual matching:\r\n    {1}", 
						pasteAndSelectInfo.CreateExactMatchList(", "), pasteAndSelectInfo.CreateNonMatchList(", "));
				}

				btnPaste.Enabled = true;
				toolTip.SetToolTip(btnPaste, tooltipText);
			}
			else
			{
				btnPaste.Enabled = false;
				toolTip.SetToolTip(btnPaste, null);
			}

			btnPasteCover.Visible = !btnPaste.Enabled;
		}