Beispiel #1
0
        protected virtual void OnBtnDeleteFilterClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_filter", cd.Display), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }

            conditions.Remove(cd);
            maskStore.Clear();
            filterStore.Remove(ref ti);
        }
Beispiel #2
0
        protected virtual void OnBtnAddFilterClicked(object sender, System.EventArgs e)
        {
            EntryDialog ed     = new EntryDialog("", MainClass.Languages.Translate("new_filter"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    LogicalSystem cdFind = conditions.Find(x => x.Display.ToUpper() == newStr.ToUpper());
                    if (cdFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("filter_is_exist", cdFind.Display), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }


                    LogicalSystem cd = new LogicalSystem();
                    cd.Display = newStr;
                    filterStore.AppendValues(cd.Display, cd);
                    conditions.Add(cd);
                }
            }
            ed.Destroy();
        }
Beispiel #3
0
        void OnComboFilterChanged(object o, EventArgs args)
        {
            ComboBox combo = o as ComboBox;

            if (o == null)
            {
                return;
            }

            TreeIter iter;

            if (combo.GetActiveIter(out iter))
            {
                LogicalSystem ls = (LogicalSystem)combo.Model.GetValue(iter, 2);

                if (ls != null)
                {
                    activetFilter = ls;
                }
                else
                {
                    activetFilter = null;
                }
                filter.Refilter();
                treeView.QueueDraw();
            }
        }
Beispiel #4
0
        public FilteringWidget(Gtk.Window parent)
        {
            parentWindow = parent;
            this.Build();

            tvFilter.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);
            tvMask.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);


            tvFilter.Model = filterStore;
            tvMask.Model   = maskStore;

            if (MainClass.Settings == null)
            {
                return;
            }
            if (MainClass.Settings == null || MainClass.Settings.LogicalSort.Count < 1)
            {
                MainClass.Settings.LogicalSort = LogicalSystem.GetDefaultLogicalSystem();
            }

            this.conditions = new List <LogicalSystem>();

            conditions = MainClass.Tools.Clone(MainClass.Settings.LogicalSort);

            TreeIter ti = new TreeIter();

            foreach (LogicalSystem cd in conditions)
            {
                ti = filterStore.AppendValues(cd.Display, cd);
            }

            tvFilter.Selection.Changed += delegate(object sender, EventArgs e)
            {
                maskStore.Clear();
                LogicalSystem cd = GetSelected();
                if (cd == null)
                {
                    return;
                }

                if (cd.Mask == null)
                {
                    cd.Mask = new List <string>();
                }

                foreach (string rl in cd.Mask)
                {
                    maskStore.AppendValues(rl);
                }
            };
            if (conditions.Count > 0)
            {
                tvFilter.Selection.SelectIter(ti);
            }
        }
Beispiel #5
0
        protected virtual void OnBtnDeleteMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }
            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            TreeSelection tsR = tvMask.Selection;
            TreeIter      tiR = new TreeIter();

            tsR.GetSelected(out tiR);

            TreePath[] tpR = tsR.GetSelectedRows();
            if (tpR.Length < 1)
            {
                return;
            }

            string rl = (string)tvMask.Model.GetValue(tiR, 0);

            if (String.IsNullOrEmpty(rl))
            {
                return;
            }


            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("delete_mask", rl), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

            if (result != (int)Gtk.ResponseType.Yes)
            {
                return;
            }
            maskStore.Remove(ref tiR);

            LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());

            cd2.Mask.Remove(rl);
            filterStore.SetValues(ti, cd2.Display, cd2);
        }
Beispiel #6
0
        protected virtual void OnBtnAddMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            EntryDialog ed     = new EntryDialog("", MainClass.Languages.Translate("new_mask"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    //int maxCountRule = 0;

                    /*foreach (string rlf in cd.Mask){
                     *      if (maxCountRule < rlf.Id) maxCountRule = rlf.Id;
                     * }*/

                    string rlFind = cd.Mask.Find(x => x.ToUpper() == newStr.ToUpper());
                    if (rlFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("mask_is_exist", rlFind), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    maskStore.AppendValues(newStr);

                    LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
                    cd2.Mask.Add(newStr);
                    filterStore.SetValues(ti, cd2.Display, cd2);
                }
            }
            ed.Destroy();
        }
Beispiel #7
0
        static public Settings OpenSettings(string filePath)
        {
            if (System.IO.File.Exists(filePath))
            {
                try {
                    using (FileStream fs = File.OpenRead(filePath)) {
                        XmlSerializer serializer = new XmlSerializer(typeof(Settings));
                        Settings      s          = (Settings)serializer.Deserialize(fs);


                        if ((s.EmulatorSettings == null) || (String.IsNullOrEmpty(s.EmulatorSettings.Exec)))
                        {
                            s.EmulatorSettings           = new EmulatorSetting();
                            s.EmulatorSettings.UsDefault = true;
                        }

                        if ((s.LogicalSort == null) || ((s.LogicalSort.Count < 1)))
                        {
                            s.LogicalSort = LogicalSystem.GetDefaultLogicalSystem();
                        }

                        if ((s.Resolution == null) || ((s.Resolution.Rules.Count < 1)))
                        {
                            s.GenerateResolution();
                        }
                        else
                        {
                            if (s.Resolution.Rules[1].Width < 1)
                            {
                                s.GenerateResolution();
                            }
                        }

                        if ((s.IgnoresFolders == null) || (s.IgnoresFolders.Count < 1))
                        {
                            s.GenerateIgnoreFolder();
                        }
                        if ((s.ExtensionList == null) || (s.ExtensionList.Count < 1))
                        {
                            s.GenerateExtensionList();
                        }

                        if ((s.IgnoresFiles == null) || (s.IgnoresFiles.Count < 1))
                        {
                            s.GenerateIgnoreFiles();
                        }

                        if ((s.Platform == null) || (s.Platform.Rules.Count < 1))
                        {
                            s.GeneratePlatform();
                        }

                        if ((s.DisplayOrientations == null) || ((s.DisplayOrientations.Count < 1)))
                        {
                            s.GenerateOrientations();
                        }

                        if ((s.InstallLocations == null) || ((s.InstallLocations.Count < 1)))
                        {
                            s.GenerateInstallLocation();
                        }

                        if ((s.OSSupportedDevices == null) || ((s.OSSupportedDevices.Count < 1)))
                        {
                            s.GenerateOSSupportedDevices();
                        }

                        if ((s.PlatformResolutions == null) || ((s.PlatformResolutions.Count < 1)))
                        {
                            s.GeneratePlatformResolutions();
                        }

                        if ((s.ApplicationType == null) || ((s.ApplicationType.Count < 1)))
                        {
                            s.GenerateApplicationType();
                        }

                        if ((s.AndroidSupportedDevices == null) || ((s.AndroidSupportedDevices.Count < 1)))
                        {
                            s.GenerateAndroidSupportedDevices();
                        }

                        if (s.VersionSetting < 111202)                          //year, month, day
                        {
                            s.GenerateIgnoreFolder();
                            s.VersionSetting = 111202;
                        }
                        if (s.VersionSetting < 120314)                          //year, month, day
                        {
                            s.GenerateResolution();
                            s.GeneratePlatformResolutions();
                            s.VersionSetting = 120314;
                        }
                        if (s.VersionSetting < 120828)                          //year, month, day
                        {
                            s.TweetUrl       = "http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=moscrif";
                            s.TweetBaseUrl   = "http://twitter.com/moscrif/statuses/";
                            s.VersionSetting = 120828;
                        }
                        if (s.VersionSetting < 120903)                          //year, month, day
                        {
                            s.GeneratePlatformResolutions();
                            s.VersionSetting = 120903;
                        }
                        if (s.VersionSetting < 121001)                          //year, month, day
                        {
                            s.ShowUnsupportedDevices = false;
                            s.VersionSetting         = 121001;
                        }

                        if (s.VersionSetting < 121017)                          //year, month, day
                        {
                            s.GenerateResolution();
                            s.GeneratePlatformResolutions();
                            s.VersionSetting = 121017;
                        }
                        if (s.VersionSetting < 121106)                          //year, month, day
                        {
                            s.MaxRssTweetMessageCount = 3;
                            s.VersionSetting          = 121106;
                        }
                        return(s);
                    }
                } catch (Exception ex) {
                    throw ex;
                }
            }
            else
            {
                throw new Exception("Settings file does not exist!");
            }
        }
Beispiel #8
0
        protected virtual void OnBtnEditMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }
            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            TreeSelection tsR = tvMask.Selection;
            TreeIter      tiR = new TreeIter();

            tsR.GetSelected(out tiR);

            TreePath[] tpR = tsR.GetSelectedRows();
            if (tpR.Length < 1)
            {
                return;
            }

            string rl = (string)tvMask.Model.GetValue(tiR, 0);

            EntryDialog ed     = new EntryDialog(rl, MainClass.Languages.Translate("new_name"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    if (rl.ToUpper() == newStr.ToUpper())
                    {
                        ed.Destroy();
                        return;
                    }

                    string rlFind = cd.Mask.Find(x => x.ToUpper() == newStr.ToUpper());
                    if (!String.IsNullOrEmpty(rlFind))
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("mask_is_exist", rlFind), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }


                    LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
                    cd2.Mask.Remove(rlFind);

                    maskStore.SetValues(tiR, 0, newStr, newStr);

                    cd2.Mask.Add(newStr);
                    filterStore.SetValues(ti, cd2.Display, cd2);
                }
            }
            ed.Destroy();
        }
Beispiel #9
0
        protected virtual void OnBtnEditFilterClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            EntryDialog ed     = new EntryDialog(cd.Display, MainClass.Languages.Translate("new_filter"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    if (newStr == cd.Display)
                    {
                        return;
                    }

                    LogicalSystem cdFind = conditions.Find(x => x.Display.ToUpper() == newStr.ToUpper());
                    if (cdFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("filter_is_exist", cdFind.Display), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    LogicalSystem cdEdited = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());

                    if (cdEdited == null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("unspecified_error"), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    cdEdited.Display = newStr;

                    filterStore.SetValues(ti, cdEdited.Display, cdEdited);

                    //conditions.Find(cd).Name =ed.TextEntry;
                }
            }
            ed.Destroy();
        }
Beispiel #10
0
        // Icon,Show Name, Full Path, TypFile
        public WorkspaceTree()
        {
            treeView = new TreeView();

            treeView.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease);
            treeView.KeyReleaseEvent    += delegate(object o, KeyReleaseEventArgs args) {
                if (args.Event.Key == Gdk.Key.Delete)
                {
                    MainClass.MainWindow.DeleteFile();
                }
            };

            //treeView.Model = modelStore = store;

            filter             = new Gtk.TreeModelFilter(store, null);
            filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);
            treeView.Model     = filter;

            treeView.HeadersVisible = true;
            //this.ExpandAll();
            treeView.Selection.Mode     = Gtk.SelectionMode.Single;
            treeView.RowActivated      += OnRowActivate;
            treeView.Selection.Changed += OnRowSelection;
            treeView.ShowExpanders      = true;

            //	TreeViewColumn display_column.PackStart (text_render, true);

            CellRendererPixbuf crp = new CellRendererPixbuf();

            crp.Ypad   = 0;
            crp.Yalign = 0;

            Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText();
            fileNameRenderer.Ypad = 0;

            TreeViewColumn icon_column = new TreeViewColumn();            //("Icon", crp, "pixbuf", ICO_ROW);

            icon_column.PackStart(crp, false);
            icon_column.AddAttribute(crp, "pixbuf", ICO_ROW);

            icon_column.PackStart(fileNameRenderer, true);
            icon_column.AddAttribute(fileNameRenderer, "markup", NAME_ROW);


            treeView.AppendColumn(icon_column);

            //treeView.AppendColumn("Icon", crp, "pixbuf", ICO_ROW);

            treeView.AppendColumn("Name", fileNameRenderer, "text", NAME_ROW);
            treeView.Columns[NAME_ROW].Visible = false;

            CellRendererText textRenderer = new CellRendererText();

            textRenderer.Ypad = 0;

            treeView.AppendColumn("FullPath", textRenderer, "text", PATH_ROW);
            treeView.Columns[PATH_ROW].Visible = false;
            treeView.HeadersVisible            = false;
            treeView.EnableTreeLines           = true;
            treeView.HoverExpand    = false;
            treeView.HoverSelection = false;

            treeView.Columns[NAME_ROW].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderFileNme));

            sw.ShadowType = ShadowType.Out;
            sw.Add(treeView);

            this.PackEnd(sw, true, true, 0);

            Toolbar toolbar = new Toolbar();

            refreshButton             = new ToolButton("refresh.png"); //Stock.Home);
            refreshButton.IsImportant = true;
            refreshButton.Label       = MainClass.Languages.Translate("menu_refresh");
            refreshButton.BorderWidth = 1;
            refreshButton.Clicked    += delegate {
                MainClass.MainWindow.RefreshProject();
            };
            toolbar.Insert(refreshButton, -1);

            Gtk.Menu menuAdd = new Gtk.Menu();

            MenuItem mi = new MenuItem(MainClass.Languages.Translate("menu_create_file"));

            mi.Activated += delegate(object sender, EventArgs e) {
                NewAction nw = new NewAction();
                nw.Activate();
            };

            menuAdd.Insert(mi, -1);
            mi            = new MenuItem(MainClass.Languages.Translate("menu_create_dir"));
            mi.Activated += delegate(object sender, EventArgs e) {
                NewDirectoryAction nw = new NewDirectoryAction();
                nw.Activate();
            };

            menuAdd.Insert(mi, -1);
            menuAdd.ShowAll();

            mtbCreate             = new MenusToolButton(menuAdd, "file-new.png");
            mtbCreate.IsImportant = true;
            mtbCreate.Label       = "Create";
            toolbar.Insert(mtbCreate, -1);

            if (MainClass.Settings.LogicalSort == null)
            {
                MainClass.Settings.LogicalSort = LogicalSystem.GetDefaultLogicalSystem();
            }

            Gtk.Menu menuFilter = new Gtk.Menu();

            MenuItem menuItemFilter = new MenuItem(MainClass.Languages.Translate("all_files"));

            menuItemFilter.Activated += delegate(object sender, EventArgs e) {
                activetFilter = null;
                filter.Refilter();
                treeView.QueueDraw();
            };
            menuFilter.Insert(menuItemFilter, -1);


            foreach (LogicalSystem ls in MainClass.Settings.LogicalSort)
            {
                LogicalSystem lsTemp = ls;
                menuItemFilter            = new MenuItem(lsTemp.Display);
                menuItemFilter.Activated += delegate(object sender, EventArgs e) {
                    if (lsTemp != null)
                    {
                        activetFilter = lsTemp;
                    }
                    else
                    {
                        activetFilter = null;
                    }
                    filter.Refilter();
                    treeView.QueueDraw();
                };
                menuFilter.Insert(menuItemFilter, -1);
                //filterModel.AppendValues(ls.Display, "", ls);
            }
            menuFilter.ShowAll();

            MenusToolButton mtbFilter = new MenusToolButton(menuFilter, "filter.png");

            mtbFilter.IsImportant = true;
            mtbFilter.Label       = "Filter";
            toolbar.Insert(mtbFilter, -1);
            this.PackStart(toolbar, false, false, 0);
            //this.PackStart(ComboFilter, false, false, 0);
            //ComboFilter.Active = 0;
        }