示例#1
0
        public AboutDialog()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.richCreditsBox.BackColor = SystemColors.Window;

            string textFormat = PdnResources.GetString("AboutDialog.Text.Format");

            this.Text = string.Format(textFormat, PdnInfo.GetBareProductName());

            this.pdnBanner.BannerText = string.Empty;// PdnInfo.GetFriendlyVersionString();
            this.richCreditsBox.LoadFile(PdnResources.GetResourceStream("Files.AboutCredits.rtf"), RichTextBoxStreamType.RichText);
            this.copyrightLabel.Text = PdnInfo.GetCopyrightString();

            this.Icon = PdnInfo.AppIcon;

            this.okButton.Text     = PdnResources.GetString("Form.OkButton.Text");
            this.okButton.Location = new Point((this.ClientSize.Width - this.okButton.Width) / 2, this.okButton.Top);

            this.creditsLabel.Text = PdnResources.GetString("AboutDialog.CreditsLabel.Text");

            Font bannerFont    = this.pdnBanner.BannerFont;
            Font newBannerFont = Utility.CreateFont(bannerFont.Name, 8.0f, bannerFont.Style);

            this.pdnBanner.BannerFont = newBannerFont;
            newBannerFont.Dispose();
            bannerFont.Dispose();

            this.versionLabel.Text = PdnInfo.GetFullAppName();
        }
示例#2
0
 public PdnFileType()
     : base(PdnInfo.GetBareProductName(),
            FileTypeFlags.SavesWithProgress |
            FileTypeFlags.SupportsCustomHeaders |
            FileTypeFlags.SupportsLayers |
            FileTypeFlags.SupportsLoading |
            FileTypeFlags.SupportsSaving,
            new string[] { ".pdn" })
 {
 }
 public LoadProgressDialog(Control owner, Stream stream, FileType fileType)
     : base(owner,
            PdnInfo.GetBareProductName(),
            PdnResources.GetString("LoadProgressDialog.Description"))
 {
     this.fileType                 = fileType;
     this.siphonStream             = new SiphonStream(stream);
     this.siphonStream.IOFinished += new IOEventHandler(siphonStream_IOFinished);
     this.Icon = Utility.ImageToIcon(PdnResources.GetImage("Icons.ImageFromDiskIcon.png"), Utility.TransparentKey);
 }
示例#4
0
        public static bool OpenUrl(IWin32Window owner, string url)
        {
            bool result = SystemLayer.Shell.LaunchUrl(owner, url);

            if (!result)
            {
                string message = PdnResources.GetString("LaunchLink.Error");
                MessageBox.Show(owner, message, PdnInfo.GetBareProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(result);
        }
示例#5
0
        public static void SetNewCulture(IWin32Window owner, string newLocaleName)
        {
            // TODO, HACK: post-3.0 we must refactor and have an actual user data manager that can handle all this renaming
            string oldUserDataPath   = PdnInfo.UserDataPath;
            string oldPaletteDirName = PdnResources.GetString("ColorPalettes.UserDataSubDirName");
            // END HACK

            CultureInfo newCI = new CultureInfo(newLocaleName);

            Settings.CurrentUser.SetString("LanguageName", newLocaleName);
            Culture = newCI;

            // TODO, HACK: finish up renaming
            string newUserDataPath   = PdnInfo.UserDataPath;
            string newPaletteDirName = PdnResources.GetString("ColorPalettes.UserDataSubDirName");

            // 1. rename user data dir from old localized name to new localized name
            if (oldUserDataPath != newUserDataPath)
            {
                try
                {
                    Directory.Move(oldUserDataPath, newUserDataPath);
                }

                catch (Exception)
                {
                }
            }

            // 2. rename palette dir from old localized name (in new localized user data path) to new localized name
            string oldPalettePath = Path.Combine(newUserDataPath, oldPaletteDirName);
            string newPalettePath = Path.Combine(newUserDataPath, newPaletteDirName);

            if (oldPalettePath != newPalettePath)
            {
                try
                {
                    Directory.Move(oldPalettePath, newPalettePath);
                }

                catch (Exception)
                {
                }
            }
            // END HACK

            string message = PdnResources.GetString("SetLanguage.PleaseRestartApplication");

            MessageBox.Show(owner, message, PdnInfo.GetBareProductName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#6
0
        protected override void OnDragDrop(DragEventArgs drgevent)
        {
            Activate();

            if (!IsCurrentModalForm || !Enabled)
            {
                // do nothing
            }
            else if (drgevent.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] allFiles = (string[])drgevent.Data.GetData(DataFormats.FileDrop);

                if (allFiles == null)
                {
                    return;
                }

                string[] files = PruneDirectories(allFiles);

                bool importAsLayers = true;

                if (files.Length == 0)
                {
                    return;
                }
                else
                {
                    TaskButton openTB = new TaskButton(
                        ImageResource.Get("Icons.MenuFileOpenIcon.png").Reference,
                        PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ActionText"),
                        PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ExplanationText"));

                    string importLayersExplanation;
                    if (this.appWorkspace.DocumentWorkspaces.Length == 0)
                    {
                        importLayersExplanation = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText.NoImagesYet");
                    }
                    else
                    {
                        importLayersExplanation = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText");
                    }

                    TaskButton importLayersTB = new TaskButton(
                        ImageResource.Get("Icons.MenuLayersImportFromFileIcon.png").Reference,
                        PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ActionText"),
                        importLayersExplanation);

                    TaskButton clickedTB = TaskDialog.Show(
                        this,
                        new Icon(PdnResources.GetResourceStream("Icons.Question.ico")),
                        PdnInfo.GetBareProductName(),
                        null,
                        false,
                        PdnResources.GetString("DragDrop.OpenOrImport.InfoText"),
                        new TaskButton[] { openTB, importLayersTB, TaskButton.Cancel },
                        null,
                        TaskButton.Cancel);

                    if (clickedTB == openTB)
                    {
                        importAsLayers = false;
                    }
                    else if (clickedTB == importLayersTB)
                    {
                        importAsLayers = true;
                    }
                    else
                    {
                        return;
                    }
                }

                if (!importAsLayers)
                {
                    // open files into new tabs
                    this.appWorkspace.OpenFilesInNewWorkspace(files);
                }
                else
                {
                    // no image open? we will have to create one
                    if (this.appWorkspace.ActiveDocumentWorkspace == null)
                    {
                        Size newSize = this.appWorkspace.GetNewDocumentSize();

                        this.appWorkspace.CreateBlankDocumentInNewWorkspace(
                            newSize,
                            Document.DefaultDpuUnit,
                            Document.GetDefaultDpu(Document.DefaultDpuUnit),
                            false);
                    }

                    ImportFromFileAction action = new ImportFromFileAction();
                    HistoryMemento       ha     = action.ImportMultipleFiles(this.appWorkspace.ActiveDocumentWorkspace, files);

                    if (ha != null)
                    {
                        this.appWorkspace.ActiveDocumentWorkspace.History.PushNewMemento(ha);
                    }
                }
            }

            base.OnDragDrop(drgevent);
        }
示例#7
0
 public PdnFileType()
     : base(PdnInfo.GetBareProductName(), true, true, true, true, true, new string[] { ".pdn" })
 {
 }