コード例 #1
0
        public override object Load(string fileToLoad, ShowFlags showFlags)
        {
            ListerControl lc = null;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                if ((showFlags & ShowFlags.ForceShow).Equals(ShowFlags.ForceShow))
                {
                    string ext = Path.GetExtension(fileToLoad);
                    if (AllowedExtensionsOnForceShow.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        return(null);
                    }
                }
                lc = new ListerControl {
                    WrapText     = (showFlags & ShowFlags.WrapText).Equals(ShowFlags.WrapText),
                    AsciiCharset = (showFlags & ShowFlags.Ascii).Equals(ShowFlags.Ascii)
                };

                lc.FileLoad(fileToLoad);
                FocusedControl = lc.tabControl;
                ScrollProc(0);

                controls.Add(lc);
            }
            return(lc);
        }
コード例 #2
0
        public override ListerResult SendCommand(object control, ListerCommand command, ShowFlags parameter)
        {
            ListerControl lc = (ListerControl)control;

            switch (command)
            {
            case ListerCommand.Copy:
                lc.Copy();
                break;

            case ListerCommand.SelectAll:
                lc.SelectAll();
                break;

            case ListerCommand.NewParams:
                lc.WrapText     = (parameter & ShowFlags.WrapText).Equals(ShowFlags.WrapText);
                lc.AsciiCharset = (parameter & ShowFlags.Ascii).Equals(ShowFlags.Ascii);
                break;

            case ListerCommand.SetPercent:
                lc.SetPercent((int)parameter);
                ScrollProc((int)parameter);
                break;
            }
            return(ListerResult.OK);
        }
コード例 #3
0
        public override ListerResult SearchText(object control, string searchString, SearchParameter searchParameter)
        {
            ListerControl lc         = (ListerControl)control;
            bool          matchCase  = (searchParameter & SearchParameter.MatchCase).Equals(SearchParameter.MatchCase);
            bool          wholeWords = (searchParameter & SearchParameter.WholeWords).Equals(SearchParameter.WholeWords);
            bool          findFirst  = (searchParameter & SearchParameter.FindFirst).Equals(SearchParameter.FindFirst);
            bool          backwards  = (searchParameter & SearchParameter.Backwards).Equals(SearchParameter.Backwards);
            int           tabIndex   = searchTabIndex;
            int           percent    = lc.Search(searchString, matchCase, wholeWords, findFirst, backwards, tabIndex);

            if (percent >= 0)
            {
                ScrollProc(percent);
            }
            return(ListerResult.OK);
        }
コード例 #4
0
        public override ListerResult Print(object control, string fileToPrint, string defPrinter,
                                           PrintFlags printFlags, PrintMargins pMargins)
        {
            ListerControl lc     = (ListerControl)control;
            PrintDialog   dialog = new PrintDialog {
                PrinterSettings = { PrinterName = defPrinter }
            };

            if (dialog.ShowDialog().Equals(DialogResult.OK))
            {
                PrinterSettings printerSettings = dialog.PrinterSettings;

                //Margins margins = new Margins(pMargins.left, pMargins.right, pMargins.top, pMargins.bottom);
                //printerSettings.DefaultPageSettings.Margins = margins;

                lc.Print(printerSettings);
            }
            return(ListerResult.OK);
        }
コード例 #5
0
        public override ListerResult LoadNext(object control, string fileToLoad, ShowFlags showFlags)
        {
            ListerControl lc = (ListerControl)control;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                if ((showFlags & ShowFlags.ForceShow).Equals(ShowFlags.ForceShow))
                {
                    string ext = Path.GetExtension(fileToLoad);
                    if (AllowedExtensionsOnForceShow.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        return(ListerResult.Error);
                    }
                }
                lc.WrapText     = (showFlags & ShowFlags.WrapText).Equals(ShowFlags.WrapText);
                lc.AsciiCharset = (showFlags & ShowFlags.Ascii).Equals(ShowFlags.Ascii);
                lc.FileLoad(fileToLoad);
                ScrollProc(0);
                return(ListerResult.OK);
            }
            return(ListerResult.Error);
        }