Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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!");
            }
        }
Exemplo n.º 3
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;
        }