Exemplo n.º 1
0
 public DeleteWindow()
 {
     normalSurface  = NativeThemeManager.LoadBitmap("DeleteWindowNormal.png");
     seletedSurface = NativeThemeManager.LoadBitmap("DeleteWindowSelected.png");
     this.Size(normalSurface.Width, normalSurface.Height);
     CanDrag = false;
 }
Exemplo n.º 2
0
        internal void LoadBackground()
        {
            Bitmap tmp = NativeThemeManager.LoadBitmap("TaskSwitch.png");

            LoadOptimizedBackgroundImage(tmp);
            tmp.Dispose();
        }
Exemplo n.º 3
0
        public StartMenuDialog(IntPtr parentWindow)
            : base(parentWindow)
        {
            //ItemSize = 104;
            Distance               = 20;
            searchFormat           = new StringFormat();
            searchFormat.Alignment = StringAlignment.Near;

            searchFont       = new Font("Tahoma", 12, FontStyle.Bold, GraphicsUnit.Pixel);
            searchTextHeight = (int)Canvas.MeasureString("Wg", searchFont, ItemSize + Distance / 2, searchFormat).Height + 4;

            searchFormat.LineAlignment = StringAlignment.Center;
            searchFormat.Trimming      = StringTrimming.EllipsisCharacter;
            searchFormat.FormatFlags   = StringFormatFlags.LineLimit;

            searchField = NativeThemeManager.LoadBitmap("TextField.png");
            HeaderText  = SR.Applications;

            this.Font = new Font("Tahoma", 10);

            ExtraItemsOffset = searchTextHeight + 14;
            searchText       = string.Empty;
            catalog          = new Catalog {
                Limit = 15
            };
            result = new List <CatalogItem>();
            catalog.Rebuild();
            ScanTime = DateTime.Now;
        }
Exemplo n.º 4
0
        public void AssignIcon()
        {
            if (icon != null)
            {
                icon.Dispose();
                icon = null;
            }

            string fileCustomIcon = FileImage.CustomFileIcon(FileOperations.ExtractFileNameFromShellLink(FullPath));

            if (string.IsNullOrEmpty(fileCustomIcon))
            {
                icon = (Bitmap)FileImage.FileNameImage(FullPath);

                if (icon == null)
                {
                    if (FileOperations.DirectoryExists(FullPath))
                    {
                        icon = NativeThemeManager.LoadBitmap("Folder.png");
                    }
                    else
                    {
                        icon = NativeThemeManager.LoadBitmap("UnknownFile.png");
                    }
                }
            }
            else
            {
                icon = FastBitmap.FromFile(fileCustomIcon);
            }
        }
Exemplo n.º 5
0
        protected override void AssignDefaultImage()
        {
            Image tmp = null;

            EmptyCustomIcon();
            if (!string.IsNullOrEmpty(resourceName))
            {
                tmp = NativeThemeManager.LoadBitmap(resourceName);
            }
            else
            if (defaultImage != null)
            {
                tmp = BitmapPainter.ConvertToRealColors(defaultImage, false);
            }
            else
            {
                tmp = NativeThemeManager.Load("UnknownFile.png");
            }
            if (tmp != null)
            {
                if (imgLogo.Image != null)
                {
                    imgLogo.Image.Dispose();
                    imgLogo.Image = null;
                }
                imgLogo.Image = BitmapPainter.ConvertToRealColors(tmp, false);
                tmp.Dispose();
                tmp = null;
            }
        }
Exemplo n.º 6
0
        public SplashWindow()
            : base()
        {
            Text = "Krento Splash Screen";
            if (!string.IsNullOrEmpty(GlobalSettings.SplashName))
            {
                if (FileOperations.FileExists(GlobalSettings.SplashName))
                {
                    background = FastBitmap.FromFile(FileOperations.StripFileName(GlobalSettings.SplashName));
                }
            }

            if (background == null)
            {
                background = NativeThemeManager.LoadBitmap("WindowKrentoSplash.png");
            }


            bmpHeight = background.Height;
            bmpWidth  = background.Width;

            this.Width  = background.Width + 16;
            this.Height = background.Height + 16;

            this.Alpha    = 240;
            this.ColorKey = ColorUtils.WhiteKey;

            StringBuilder sb = new StringBuilder("Version ");

            sb.Append(Application.ProductVersion);
#if PORTABLE
            sb.Append(" Portable");
#endif
            if (NativeMethods.IsNativeWin64())
            {
                sb.Append("  x64");
            }
            else
            {
                sb.Append("  x86");
            }

            versionInfo = sb.ToString();


            using (Graphics g = Graphics.FromImage(background))
            {
                using (Font versionFont = new Font("Tahoma", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel))
                {
                    TextPainter.DrawStringHalo(g, versionInfo, versionFont, -16, 120, bmpWidth, 50, Color.White, true);
                }
            }


            this.Canvas.DrawImage(background, 8, 8, bmpWidth, bmpHeight);

            this.Update();
        }
Exemplo n.º 7
0
 protected internal void FixupResourceLogo()
 {
     if (Logo == null)
     {
         Bitmap tmp = NativeThemeManager.LoadBitmap(ResourceName);
         Logo = BitmapPainter.ResizeBitmap(tmp, FileImage.ImageSize, FileImage.ImageSize);
         tmp.Dispose();
         AnimatedLogo = false;
         SaveLogoToCache();
     }
 }
Exemplo n.º 8
0
 public AboutWindow()
     : base()
 {
     Text             = "About Krento";
     Name             = "AboutWindow";
     background       = NativeThemeManager.LoadBitmap("WindowBackground.png");
     this.CustomPaint = true;
     this.Width       = background.Width + 16;
     this.Height      = background.Height + 16;
     this.Alpha       = 230;
     this.ColorKey    = ColorUtils.WhiteKey;
     this.Repaint();
 }
Exemplo n.º 9
0
        public PowerControlDialog(IntPtr parentWindow)
            : base(parentWindow)
        {
            popupShutdown  = NativeThemeManager.LoadBitmap("Shutdown.png");
            popupRestart   = NativeThemeManager.LoadBitmap("Restart.png");
            popupSuspend   = NativeThemeManager.LoadBitmap("Suspend.png");
            popupHibernate = NativeThemeManager.LoadBitmap("Hibernate.png");

            HeaderText = SR.PowerManagement;

            ItemSize  = 104;
            this.Font = new Font("Tahoma", 10);
        }
Exemplo n.º 10
0
        public void AddStandardIcons()
        {
            icons.Clear();
            icons.Add(NativeThemeManager.Load("SmallKrento.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Launcher.png", 32, 32));
            icons.Add(NativeThemeManager.Load("DefaultRing.png", 32, 32));
            icons.Add(NativeThemeManager.Load("MyIP.png", 32, 32));
            icons.Add(NativeThemeManager.Load("MyDocuments.png", 32, 32));
            icons.Add(NativeThemeManager.Load("MyPictures.png", 32, 32));
            icons.Add(NativeThemeManager.Load("MyMusic.png", 32, 32));
            icons.Add(NativeThemeManager.Load("MyComputer.png", 32, 32));
            icons.Add(NativeThemeManager.Load("RecycleBin.png", 32, 32));

            icons.Add(NativeThemeManager.Load("Shutdown.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Restart.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Suspend.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Hibernate.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Timer.png", 32, 32));
            icons.Add(NativeThemeManager.Load("Calendar.png", 32, 32));
            icons.Add(NativeThemeManager.Load("CloseKrento.png", 32, 32));

            icons.Add(NativeThemeManager.Load("control.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppAddRemove.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppDateTime.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppPrinters.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppNetwork.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppFonts.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppBackground.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppAppearance.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppUsers.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppThemes.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppAccess.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppMouse.png", 32, 32));
            icons.Add(NativeThemeManager.Load("AppKeyboard.png", 32, 32));

            icons.Add(NativeThemeManager.Load("WebWiki.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebGoogle.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebGmail.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebTwitter.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebBlogger.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebFacebook.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebYoutube.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebWordpress.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebYahoo.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebReggit.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebFlickr.png", 32, 32));
            icons.Add(NativeThemeManager.Load("WebDelicious.png", 32, 32));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        public virtual void Run()
        {
            if (runCount < int.MaxValue)
            {
                runCount++;
            }
            else
            {
                runCount = 0;
                if (runLevel < int.MaxValue)
                {
                    runLevel++;
                }
                else
                {
                    runLevel = 0;
                    //Total runs = int.MaxValue * runLevel + runCount
                    //The number is big enough, normally this situation never happens
                    manager.ClearStatistics();
                }
            }

            if (!IsVirtual)
            {
                NativeMethods.WriteInterger(manager.CurrentCircle, this.stoneID, "RunCount", runCount);
                NativeMethods.WriteInterger(manager.CurrentCircle, this.stoneID, "RunLevel", runLevel);
            }

            NativeThemeManager.MakeSound("#107");
            if (GlobalConfig.LowMemory)
            {
                manager.HideAll();
                manager.ChangeVisibility(false);
            }
            else
            {
                manager.HideRingHint();
                manager.HideButtonHint();
                manager.HideScreenHint();

                manager.HideAllMenus();

                manager.Fade();
            }
        }
Exemplo n.º 12
0
        public PopupDialog(IntPtr parentWindow)
            : base(parentWindow)
        {
            popupAddRing      = NativeThemeManager.LoadBitmap("PopupAddRing.png");
            popupAddStone     = NativeThemeManager.LoadBitmap("PopupAddStone.png");
            popupApplications = NativeThemeManager.LoadBitmap("PopupApplications.png");
            popupChangeSkin   = NativeThemeManager.LoadBitmap("PopupChangeSkin.png");
            popupDeleteCircle = NativeThemeManager.LoadBitmap("PopupDeleteRing.png");
            popupEditCircle   = NativeThemeManager.LoadBitmap("PopupEditRing.png");
            popupHelp         = NativeThemeManager.LoadBitmap("PopupHelp.png");
            popupSettings     = NativeThemeManager.LoadBitmap("PopupSettings.png");


            HeaderText = SR.Settings;

            ItemSize = 104;
            Font     = new Font("Tahoma", 10);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Execute stone only after the manager is totally hidden
        /// </summary>
        /// <param name="execCode">The exec code.</param>
        public virtual void Run(FadeHookDelegate execCode)
        {
            if (runCount < int.MaxValue)
            {
                runCount++;
            }
            else
            {
                runCount = 0;
                if (runLevel < int.MaxValue)
                {
                    runLevel++;
                }
                else
                {
                    runLevel = 0;
                    //Total runs = runCount * runLevel
                    //The number is big enough, normally this situation never happens
                    manager.ClearStatistics();
                }
            }

            NativeThemeManager.MakeSound("#107");
            if (GlobalConfig.LowMemory)
            {
                manager.HideAll();
                manager.ChangeVisibility(false);
                if (execCode != null)
                {
                    execCode();
                }
            }
            else
            {
                manager.HideRingHint();
                manager.HideButtonHint();
                manager.HideScreenHint();

                manager.HideAllMenus();

                manager.HideAndExecute(execCode);
            }
        }
Exemplo n.º 14
0
        public void StartSmoke(int x, int y)
        {
            Bitmap tmp = null;

            if (!string.IsNullOrEmpty(fileName))
            {
                if (FileOperations.FileExists(fileName))
                {
                    tmp = FastBitmap.FromFile(FileOperations.StripFileName(fileName));
                }
            }

            if (tmp == null)
            {
                tmp = NativeThemeManager.LoadBitmap("animation-poof.png");
            }
            animation.Image = tmp;
            UpdatePosition(x - Width / 2, y - Width / 2);
            Update();
            ShowDialog();
        }
Exemplo n.º 15
0
        public RingSwitcher(StonesManager manager, bool inplace)
        {
            this.manager         = manager;
            items                = new List <KrentoRing>();
            TopMostWindow        = true;
            format.Alignment     = StringAlignment.Center;
            format.LineAlignment = StringAlignment.Near;
            //format.FormatFlags = StringFormatFlags.NoWrap;
            format.Trimming    = StringTrimming.EllipsisCharacter;
            format.FormatFlags = StringFormatFlags.LineLimit;
            overlay            = NativeThemeManager.LoadBitmap("overlay.png");
            shine     = NativeThemeManager.LoadBitmap("shine.png");
            logo      = NativeThemeManager.LoadBitmap("Krento48.png");
            signAdd   = NativeThemeManager.LoadBitmap("SignAdd.png");
            signClose = NativeThemeManager.LoadBitmap("SignClose.png");

            this.inplace = inplace;
            this.Text    = SR.SelectCircle;
            Name         = "RingSwitcher";
            this.Alpha   = 240;
        }
Exemplo n.º 16
0
        public AboutWindow()
            : base()
        {
            this.Text = "About Krento";

            if (!string.IsNullOrEmpty(GlobalSettings.AboutBoxName))
            {
                if (FileOperations.FileExists(GlobalSettings.AboutBoxName))
                {
                    background = FastBitmap.FromFile(FileOperations.StripFileName(GlobalSettings.AboutBoxName));
                }
            }

            if (background == null)
            {
                background = NativeThemeManager.LoadBitmap("WindowKrentoAbout.png");
            }

            this.Width           = background.Width + 16;
            this.Height          = background.Height + 16;
            this.Alpha           = 230;
            this.ColorKey        = ColorUtils.WhiteKey;
            Canvas.SmoothingMode = SmoothingMode.HighQuality;
            this.Canvas.DrawImage(background, 8, 8, background.Width, background.Height);
            if (!TextHelper.SameText(Language.Culture.Name, "en-US"))
            {
                translatorName = SR.GetCaption("Translator");
                if (TextHelper.SameText(translatorName, "Put your name here"))
                {
                    translatorName = "";
                }
            }
            if (!string.IsNullOrEmpty(translatorName))
            {
                translator = "Translator: " + translatorName;
            }
            versionInfo = "Version " + Application.ProductVersion;

            this.Repaint();
        }
Exemplo n.º 17
0
        public void AddCustomIcon(string fileName)
        {
            bool found = false;

            if (!string.IsNullOrEmpty(fileName))
            {
                if (FileOperations.FileExists(fileName))
                {
                    found = true;
                }
            }

            if (found)
            {
                Bitmap tmp = FastBitmap.FromFile(fileName);
                icons.Add(BitmapPainter.ResizeBitmap(tmp, 32, 32, true));
            }
            else
            {
                icons.Add(BitmapPainter.ResizeBitmap(NativeThemeManager.Load("SmallKrento.png"), 32, 32, true));
            }
        }
Exemplo n.º 18
0
        public AboutWindow(RollingStoneBase stone)
            : base()
        {
            this.stone = stone;

            if (!string.IsNullOrEmpty(GlobalSettings.AboutStoneName))
            {
                if (FileOperations.FileExists(GlobalSettings.AboutStoneName))
                {
                    background = FastBitmap.FromFile(FileOperations.StripFileName(GlobalSettings.AboutStoneName));
                }
            }

            if (background == null)
            {
                background = NativeThemeManager.LoadBitmap("WindowBackground.png");
            }


            this.Width           = background.Width + 16;
            this.Height          = background.Height + 16;
            this.Alpha           = 230;
            this.ColorKey        = ColorUtils.WhiteKey;
            Canvas.SmoothingMode = SmoothingMode.HighQuality;
            this.Canvas.DrawImage(background, 8, 8, background.Width, background.Height);

            if (!string.IsNullOrEmpty(stone.StoneAuthor))
            {
                this.author = "Author: " + stone.StoneAuthor;
            }
            this.description = stone.StoneDescription;
            this.stoneIcon   = stone.StoneIcon;

            versionInfo = "Version: " + stone.StoneVersion;
            copyright   = stone.StoneCopyright;
        }
Exemplo n.º 19
0
        private void SettingsDialog_Load(object sender, EventArgs e)
        {
            CultureInfo culture;
            DockItem    item;
            Image       icon;

            fish.UseDenomination       = true;
            fish.Settings.MaxScale     = 1.5;
            fish.Settings.ScaleCaption = false;
            fish.ItemsLayout           = ItemsLayout.Default;
            fish.Settings.LeftMargin   = 12;
            fish.Settings.IconsSpacing = 34;
            fish.DockOrientation       = DockOrientation.Vertical;

            icon = NativeThemeManager.Load("SmallKrento.png");

            item     = fish.AddItem(SR.General, icon);
            item.Tag = 1;
            icon.Dispose();

            icon     = NativeThemeManager.Load("exec.png");
            item     = fish.AddItem(SR.Tuning, icon);
            item.Tag = 2;
            icon.Dispose();

            icon     = BitmapPainter.ResizeBitmap(KrentoRing.DefaultRingImage, 48, 48, false);
            item     = fish.AddItem(SR.Circle, icon);
            item.Tag = 3;
            icon.Dispose();

            activeWorkplace = workplaceGeneral;

            workplaceGeneral.Visible = true;
            workplaceManager.Visible = false;
            workplaceTuning.Visible  = false;

            workplaceGeneral.BringToFront();
#if PORTABLE
            edtRunWindows.Enabled = false;
            btnCircle.Enabled     = false;
#else
            edtRunWindows.Checked = InteropHelper.GetStartup("Krento");
#endif
            if ((GlobalSettings.Modifiers == Keys.LWin) && (GlobalSettings.Shortcut == Keys.S))
            {
                edtUseDefault.Checked = true;
                edtHotKey.Enabled     = false;
            }
            else
            {
                edtUseDefault.Checked = false;
                edtHotKey.Enabled     = true;
                this.modifierHotKeys  = GlobalSettings.Modifiers;
                this.shortcut         = GlobalSettings.Shortcut;
            }

            switch (GlobalSettings.MouseHook)
            {
            case MouseHookButton.Wheel:
                rbWheel.Checked = true;
                break;

            case MouseHookButton.XButton1:
                rbXButton1.Checked = true;
                break;

            case MouseHookButton.XButton2:
                rbXButton2.Checked = true;
                break;
            }


            edtShiftButton.Checked   = ((GlobalSettings.MouseModifiers & Keys.Shift) != 0);
            edtAltButton.Checked     = ((GlobalSettings.MouseModifiers & Keys.Alt) != 0);
            edtControlButton.Checked = ((GlobalSettings.MouseModifiers & Keys.Control) != 0);

            edtShowHintWindow.Checked     = GlobalSettings.ShowStoneHint;
            edtShowAlerts.Checked         = GlobalSettings.ShowPopupAlerts;
            edtTrayIcon.Checked           = GlobalSettings.ShowTrayIcon;
            edtShowSplashScreen.Checked   = GlobalSettings.ShowSplashScreen;
            edtManagerButtons.Checked     = GlobalSettings.ShowManagerButtons;
            edtUseSounds.Checked          = GlobalSettings.UseSound;
            edtHideOnClick.Checked        = GlobalSettings.HideOnClick;
            edtRotateOnClick.Checked      = GlobalSettings.RotateOnClick;
            edtCheckUpdates.Checked       = GlobalSettings.CheckUpdate;
            edtLiveReflection.Checked     = GlobalSettings.LiveReflection;
            edtDesktopClick.Checked       = GlobalSettings.DesktopClick;
            edtRightClick.Checked         = GlobalSettings.UseRightClick;
            edtCircleSelector.Checked     = GlobalSettings.CircleSelector;
            edtUseMouse.Checked           = GlobalSettings.UseMouseActivation;
            edtKeyboardActivation.Checked = GlobalSettings.UseKeyboardActivation;

            edtStonesNumber.Value = GlobalSettings.DefaultStonesNumber;
            goodNumber            = Math.Min(GlobalSettings.FadeDelay, (int)edtFadeDelay.Maximum);
            edtFadeDelay.Value    = Math.Max(goodNumber, edtFadeDelay.Minimum);

            goodNumber      = Math.Min(GlobalSettings.Radius, (int)edtRadius.Maximum);
            edtRadius.Value = Math.Max(goodNumber, edtRadius.Minimum);

            goodNumber            = Math.Min(GlobalSettings.WindowHeight, (int)edtWindowHeight.Maximum);
            edtWindowHeight.Value = Math.Max(goodNumber, edtWindowHeight.Minimum);

            goodNumber           = Math.Min(GlobalSettings.WindowWidth, (int)edtWindowWidth.Maximum);
            edtWindowWidth.Value = Math.Max(goodNumber, edtWindowWidth.Minimum);

            goodNumber            = Math.Min(GlobalSettings.Transparency, (int)edtTransparency.Maximum);
            edtTransparency.Value = Math.Max(goodNumber, edtTransparency.Minimum);

            goodNumber         = Math.Min(GlobalSettings.StoneSize, (int)edtStoneSize.Maximum);
            edtStoneSize.Value = Math.Max(goodNumber, edtStoneSize.Minimum);

            goodNumber        = Math.Min(GlobalSettings.IconSize, (int)edtIconSize.Maximum);
            edtIconSize.Value = Math.Max(goodNumber, edtIconSize.Minimum);

            switch (KrentoContext.MainForm.Manager.CircleLocation)
            {
            case CircleLocation.Point:
                rbMousePosition.Checked = true;
                break;

            case CircleLocation.ScreenCenter:
                rbScreenCenter.Checked = true;
                break;

            case CircleLocation.Fixed:
                rbFixed.Checked = true;
                break;

            default:
                break;
            }

            if (NativeMethods.IsWow64())
            {
                edtDesktopClick.Enabled = false;
            }

            cbLanguage.ValueMember = "NativeName"; //"EnglishName"
            cbLanguage.Items.Add(new CultureInfo("en-US"));
            languageIndex = 0;

            string[] langFiles = Directory.GetFiles(GlobalConfig.LanguagesFolder, "*.lng");
            foreach (string lang in langFiles)
            {
                string langName = Path.GetFileNameWithoutExtension(lang);
                if (!TextHelper.SameText(langName, "en-US"))
                {
                    try
                    {
                        culture = new CultureInfo(langName);
                    }
                    catch
                    {
                        culture = null;
                    }

                    if (culture != null)
                    {
                        idx = cbLanguage.Items.Add(culture);
                        if (TextHelper.SameText(langName, GlobalSettings.Language))
                        {
                            languageIndex = idx;
                        }
                    }
                }
            }


            cbLanguage.SelectedIndex = languageIndex;

            KrentoSkinInfo defaultSkin = new KrentoSkinInfo(null, SR.DefaultSkin);

            cbMenuSkins.Items.Add(defaultSkin);
            menuSkinIndex = 0;

            string GlobalMenuSkinFile = "";
            if (!string.IsNullOrEmpty(GlobalSettings.MenuSkin))
            {
                GlobalMenuSkinFile = FileOperations.StripFileName(GlobalSettings.MenuSkin);
            }
            string[] skinFiles = Directory.GetFiles(GlobalConfig.MenusFolder, "*.ini", SearchOption.AllDirectories);
            foreach (string skinFile in skinFiles)
            {
                KrentoSkinInfo skin = new KrentoSkinInfo(skinFile, KrentoMenuSkin.GetSkinCaption(skinFile));
                idx = cbMenuSkins.Items.Add(skin);
                if (TextHelper.SameText(skin.FileName, GlobalMenuSkinFile))
                {
                    menuSkinIndex = idx;
                }
            }
            cbMenuSkins.ValueMember   = "Caption";
            cbMenuSkins.SelectedIndex = menuSkinIndex;
            menuSkinFile = GlobalSettings.MenuSkin;

            this.Text      = SR.Settings;
            btnCancel.Text = SR.Cancel;
            this.hintInfo.SetToolTip(this.btnCancel, SR.FileConfigCancelHint);
            btnOK.Text             = SR.OK;
            gbRunWindows.Text      = SR.KrentoStartup;
            edtRunWindows.Text     = SR.RunWithWindows;
            gbKeyboard.Text        = SR.KeyboardActivation;
            edtUseDefault.Text     = SR.UseDefaultKey;
            gbMouseActivation.Text = SR.MouseActivation;
            hintInfo.SetToolTip(gbMouseActivation, SR.MouseActivation);
            edtControlButton.Text = SR.ButtonControl;
            this.hintInfo.SetToolTip(this.edtControlButton, SR.ButtonControl);
            edtShiftButton.Text = SR.ButtonShift;
            this.hintInfo.SetToolTip(this.edtShiftButton, SR.ButtonShift);
            edtAltButton.Text = SR.ButtonAlt;
            this.hintInfo.SetToolTip(this.edtAltButton, SR.ButtonAlt);
            gbRingLocation.Text        = SR.RingLocation;
            rbScreenCenter.Text        = SR.ScreenCenter;
            rbMousePosition.Text       = SR.MouseCursorPosition;
            btnCircle.Text             = SR.AssociateRing;
            lblHint.Text               = SR.UseCtrlTab;
            rbXButton1.Text            = SR.MouseActionOneButton;
            rbXButton2.Text            = SR.MouseActionTwoButton;
            rbWheel.Text               = SR.MouseWheelClick;
            gbPersonalization.Text     = SR.Personalization;
            gbUserFolders.Text         = SR.UserFolders;
            gbMaintainance.Text        = SR.Maintainance;
            edtTrayIcon.Text           = SR.ShowTrayIcon;
            edtShowSplashScreen.Text   = SR.ShowSplashScreen;
            edtShowAlerts.Text         = SR.ShowPopupAlerts;
            btnOpenSkins.Text          = SR.OpenSkinsFolder;
            btnOpenStones.Text         = SR.OpenStonesFolder;
            btnOpenData.Text           = SR.OpenDataFolder;
            btnOpenCache.Text          = SR.OpenCacheFolder;
            btnClearCache.Text         = SR.ClearCache;
            gbLanguage.Text            = SR.Language;
            lblWindowHeight.Text       = SR.WindowHeight;
            lblWindowWidth.Text        = SR.WindowWidth;
            lblRadius.Text             = SR.Radius;
            lblStoneSize.Text          = SR.StoneSize;
            lblTransparency.Text       = SR.Trancparency;
            lblFadeDelay.Text          = SR.FadeDelay;
            gbMenuSkins.Text           = SR.MenuSkins;
            gbManager.Text             = SR.Circle;
            btnReset.Text              = SR.ResetToDefault;
            btnBackup.Text             = SR.BackupData;
            btnSettings.Text           = SR.AdvancedSettings + "...";
            edtKeyboardActivation.Text = SR.ActivateUsingKeyboard;
            edtUseMouse.Text           = SR.ActivateUsingMouse;
            rbFixed.Text               = SR.FixedPosition;
            edtCircleSelector.Text     = SR.ShowSelector;
            edtDesktopClick.Text       = SR.DesktopClick;
            edtRightClick.Text         = SR.RightButtonActivation;
            lblStonesNumber.Text       = SR.StonesNumber;
            lblIconSize.Text           = SR.IconSize;
            edtRotateOnClick.Text      = SR.RotateOnClick;
            edtShowCircleStartup.Text  = SR.ActivateOnStart;
            edtUseSounds.Text          = SR.UseSounds;
            edtCheckUpdates.Text       = SR.CheckUpdates;
            edtLiveReflection.Text     = SR.LiveReflection;
            edtManagerButtons.Text     = SR.ShowManagerButtons;
            edtShowHintWindow.Text     = SR.ShowStonesHint;
            edtHideOnClick.Text        = SR.HideOnClick;
        }
Exemplo n.º 20
0
        internal void Start()
        {
            string ApplicationPrefix = GlobalConfig.ProductName.ToUpperInvariant();

            TraceDebug.Trace("Start {0}", GlobalConfig.ProductName);
#if PORTABLE
            Environment.SetEnvironmentVariable(ApplicationPrefix + "_PORTABLE", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable(ApplicationPrefix + "_DRIVE", GlobalConfig.ApplicationDrive, EnvironmentVariableTarget.Process);
#endif

            Environment.SetEnvironmentVariable(ApplicationPrefix + "_DATA", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process);

            messageID = NativeMethods.RegisterWindowMessage("KrentoStop"); //Do not localize!!!
            NativeMethods.AddRemoveMessageFilter(messageID, ChangeWindowMessageFilterFlags.Add);


            PrepareStandardProperties();

            showSplashScreen = true;

            ApplyGUILanguage();

            GlobalSettings.LoadGlobalSettings();
            GlobalSettings.ManagerLeft = Settings.Default.ManagerLeft;
            GlobalSettings.ManagerTop  = Settings.Default.ManagerTop;



            #region Parse command line
            foreach (string param in args)
            {
                if (TextHelper.SameText(param, @"/low"))
                {
                    GlobalConfig.LowMemory = true;
                }

                if (TextHelper.SameText(param, @"/ns"))
                {
                    showSplashScreen = false;
                }

                if (TextHelper.SameText(param, @"/nd"))
                {
                    KrentoContext.SkipDocklets = true;
                }

                if (TextHelper.SameText(param, @"/nt"))
                {
                    KrentoContext.SkipToys = true;
                }

                if (TextHelper.SameText(param, @"/desktop"))
                {
                    KrentoContext.CreateDesktopCircle = true;
                }

                if (param.IndexOf(@".circle", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    KrentoContext.CircleParameter = param;
                }

                if (FileOperations.IsKrentoPackage(param))
                {
                    KrentoContext.PackageParameter = param;
                }
            }
            #endregion

            this.context = new KrentoContext();

            #region FirstRun
            if (NativeMethods.GlobalCheckAtom("krento_first_run"))
            {
                KrentoContext.FirstRun = true;
                NativeMethods.GlobalKillAtom("krento_first_run");
            }
#if PORTABLE
            string firstRunFile = Path.Combine(GlobalConfig.ApplicationFolder, "first.run");
            if (NativeMethods.FileExists(firstRunFile))
            {
                KrentoContext.FirstRun = true;
                NativeMethods.FileDelete(firstRunFile);
            }
#endif
            if (KrentoContext.FirstRun)
            {
                GlobalSettings.SaveGlobalSettings();
            }
            #endregion

            #region First Instance
            if (context.FirstInstance)
            {
                if ((showSplashScreen) && GlobalSettings.ShowSplashScreen)
                {
                    splashScreen = new SplashScreen();
                }
                else
                {
                    splashScreen = null;
                }



                this.mainForm            = new MainForm(context);
                mainForm.Text            = GlobalConfig.ProductName;
                InteropHelper.MainWindow = mainForm.Handle;

                if (showSplashScreen)
                {
                    if (splashScreen != null)
                    {
                        mainForm.SplashScreen = splashScreen;
                    }
                }


                if (NativeMethods.StartEngineEx(mainForm.Handle))
                {
                    if (GlobalSettings.ActivateServer)
                    {
                        if (NetworkOperations.PortAvailable(GlobalSettings.PortNumber))
                        {
                            context.StartServer();
                        }
                    }


                    appContext = new ApplicationContext();

                    //Load plugins. If the instance is the first instance and
                    //engine is activated, then plugins are loaded

                    try
                    {
                        context.LoadKrentoPlugins();
                    }
                    catch (Exception)
                    {
                        //do not stop on wrong plugins
                        TraceDebug.Trace("Exception on loading Krento plugin");
                    }

                    try
                    {
                        context.LoadKrentoToys();
                    }
                    catch (Exception)
                    {
                        //do not stop on wrong plugins
                        TraceDebug.Trace("Exception on loading Krento toy");
                    }
                    try
                    {
                        context.LoadKrentoDocklets();
                    }
                    catch
                    {
                        //do not stop on wrong docklet
                        TraceDebug.Trace("Exception on loading docklet");
                    }

                    NativeThemeManager.MakeSound("#110");
                    Application.Run(appContext);
                }
            }
            #endregion
        }
Exemplo n.º 21
0
        private void UpdateLogoFile(string newTarget)
        {
            StopAnimation();
            if (Logo != null)
            {
                Logo.Dispose();
                Logo = null;
            }

            string fullTarget = FileOperations.StripFileName(newTarget);

            if (!FileOperations.IsValidPathName(fullTarget))
            {
                Logo = NativeThemeManager.LoadBitmap("UnknownFile.png");
            }
            else
            {
                if (!string.IsNullOrEmpty(fullTarget))
                {
                    if (NativeMethods.FileExtensionIs(fullTarget, ".circle"))
                    {
                        Logo = GetLogoFromRing(fullTarget);
                    }
                }

                if (Logo == null)
                {
                    try
                    {
                        Logo = (Bitmap)FileImage.FileNameImage(fullTarget);
                    }
                    catch
                    {
                        Logo = null;
                    }
                }

                if (Logo == null)
                {
                    if (FileOperations.DirectoryExists(fullTarget))
                    {
                        Logo = NativeThemeManager.LoadBitmap("Folder.png");
                    }
                    else
                    {
                        Logo = FileOperations.GetExtensionLogo(fullTarget);
                        if (Logo == null)
                        {
                            Logo = NativeThemeManager.LoadBitmap("UnknownFile.png");
                        }
                    }
                }
            }

            AnimatedLogo = ImageAnimator.CanAnimate(Logo);
            if (!AnimatedLogo)
            {
                Logo = BitmapPainter.ResizeBitmap(Logo, FileImage.ImageSize, FileImage.ImageSize, true);
            }

            SaveLogoToCache();
        }
Exemplo n.º 22
0
        public void ActivateEngine()
        {
            TraceDebug.Trace("Activate Engine");

            bool doCheck      = GlobalSettings.CheckUpdate;
            bool disableCheck = false;

            Visible = false;
            NativeMethods.ShowWindow(this.Handle, 0);
            NativeMethods.RemoveSystemMenu(this.Handle);


            #region First Instance Execution
            if (context.FirstInstance)
            {
                if (!string.IsNullOrEmpty(GlobalSettings.IconName))
                {
                    Icon customIcon = null;

                    if (FileOperations.FileExists(GlobalSettings.IconName))
                    {
                        Icon loadIcon = new Icon(FileOperations.StripFileName(GlobalSettings.IconName));
                        try
                        {
                            customIcon = (Icon)loadIcon.Clone();
                        }
                        finally
                        {
                            loadIcon.Dispose();
                            loadIcon = null;
                        }

                        notifyIcon.Icon = customIcon;
                        //this.Icon = customIcon;
                    }
                }

                if (splashScreen != null)
                {
                    splashScreen.Show();
                }

                if (!string.IsNullOrEmpty(GlobalSettings.GlyphName))
                {
                    if (FileOperations.FileExists(GlobalSettings.GlyphName))
                    {
                        Bitmap tmp = FastBitmap.FromFile(GlobalSettings.GlyphName);
                        notifier.Glyph = BitmapPainter.ResizeBitmap(tmp, notifier.GlyphSize, notifier.GlyphSize, true);
                    }
                }

                if (notifier.Glyph == null)
                {
                    notifier.Glyph = NativeThemeManager.Load("BigKrento.png");
                }

                context.Manager.SetHookMessage(context);

                ReloadAll();


                PreparePulsar();


                context.Manager.Rotate(0);
                if (!GlobalSettings.ShowManagerButtons)
                {
                    context.Manager.DrawText(SR.KrentoWelcome);
                }
                context.Manager.Update();
                context.Manager.Visible = false;


                notifyIcon.Visible = GlobalSettings.ShowTrayIcon;


                if (splashScreen != null)
                {
                    if (KrentoContext.FirstRun)
                    {
                        splashScreen.Hide();
                        NativeMethods.PostMessage(InteropHelper.MainWindow, NativeMethods.CM_SPLASHCLOSE, IntPtr.Zero, IntPtr.Zero);
                    }
                    else
                    {
                        splashScreen.Close(200);
                    }
                }

                systemReady = true;

                string keyMessage = HotKeyMessage;



                notifier.Caption = SR.KrentoWelcome;

                if (GlobalSettings.MouseHook == MouseHookButton.None)
                {
                    notifier.Text = SR.WelcomeMessage(keyMessage, "", "");
                }
                else
                {
                    string mouseText = "";
                    switch (GlobalSettings.MouseHook)
                    {
                    case MouseHookButton.Wheel:
                        mouseText = MouseKeyMessage + SR.MouseWheelButton;
                        break;

                    case MouseHookButton.XButton1:
                        mouseText = MouseKeyMessage + SR.MouseXButton1;
                        break;

                    case MouseHookButton.XButton2:
                        mouseText = MouseKeyMessage + SR.MouseXButton2;
                        break;

                    default:
                        mouseText = "";
                        break;
                    }

                    notifier.Text = SR.WelcomeMessage(keyMessage, SR.OrClick, mouseText);
                }

                //Only show popup window when asked
                if (GlobalSettings.ShowPopupAlerts)
                {
                    if (GlobalConfig.LowMemory)
                    {
                        notifyIcon.BalloonTipTitle = notifier.Caption;
                        notifyIcon.BalloonTipText  = notifier.Text;
                        notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                        notifyIcon.ShowBalloonTip(5000);
                    }
                    else
                    {
                        notifier.Show();
                    }
                }


                Manager.ClearUnusedMemory();

                #region manage autoupdate
                DateTime lastCheck = Settings.Default.LastCheck;
                TimeSpan ts        = DateTime.Now - lastCheck;
                if (ts.Days >= 7)
                {
                    Settings.Default.LastCheck = DateTime.Now;
                    Settings.Default.Save();
                    if (Settings.Default.AskForCheck)
                    {
                        UpdateDialog upd = new UpdateDialog();
                        try
                        {
                            upd.ShowDialog();
                            doCheck      = (upd.DialogResult == DialogResult.OK);
                            disableCheck = (upd.btnDisable.Checked);
                            if (disableCheck)
                            {
                                GlobalSettings.CheckUpdate   = doCheck;
                                Settings.Default.AskForCheck = false;
                                Settings.Default.Save();
                            }
                        }
                        finally
                        {
                            upd.Dispose();
                        }
                    }

                    if ((GlobalSettings.CheckUpdate) && (doCheck))
                    {
                        checker.CheckNewVersion();
                    }
                }
                #endregion

                if (GlobalSettings.StartVisible || KrentoContext.FirstRun)
                {
                    InteropHelper.ShowDesktop();
                    if (!Manager.Visible)
                    {
                        if (KrentoContext.FirstRun)
                        {
                            Manager.ShowAndExecute(Manager.SimulateWheelRotation);
                        }
                        else
                        {
                            ChangeVisibility();
                        }
                    }
                }
            }
            #endregion
            else
            {
                systemReady           = false;
                context.FirstInstance = false;
            }
        }
Exemplo n.º 23
0
        protected override void BuildItems()
        {
            FolderItem item;
            string     fullTarget;

            DisposeItems();
            string fullPath = FileOperations.StripFileName(path);

            string[] files = Directory.GetFileSystemEntries(fullPath);

            HeaderText = Path.GetFileNameWithoutExtension(fullPath);

            item      = new FolderItem(fullPath);
            item.Logo = BitmapPainter.ResizeBitmap(NativeThemeManager.LoadBitmap("Folder.png"), FileImage.ImageSize, FileImage.ImageSize, true);
            Items.Add(item);

            int totalItems = 0;

            for (int i = 0; i < files.Length; i++)
            {
                fullTarget = files[i];
                if ((File.GetAttributes(fullTarget) & FileAttributes.Hidden) == FileAttributes.Hidden)
                {
                    continue;
                }

                totalItems++;

                if (totalItems > Limit)
                {
                    totalItems = Limit;
                    break;
                }

                item = new FolderItem(fullTarget);

                if (TextHelper.SameText(Path.GetExtension(fullTarget), ".circle"))
                {
                    item.Logo = GetLogoFromRing(fullTarget);
                }

                if (item.Logo == null)
                {
                    item.Logo = (Bitmap)FileImage.FileNameImage(fullTarget);
                }

                if (item.Logo == null)
                {
                    if (FileOperations.DirectoryExists(fullTarget))
                    {
                        item.Logo = NativeThemeManager.LoadBitmap("Folder.png");
                    }
                    else
                    {
                        item.Logo = NativeThemeManager.LoadBitmap("UnknownFile.png");
                    }
                }

                Items.Add(item);
            }

            files = null;
        }