Exemplo n.º 1
0
        public PublishDialogWizzard()
        {
            project           = MainClass.Workspace.ActualProject;
            this.TransientFor = MainClass.MainWindow;
            this.Build();

            ciDeviceTesting      = new DropDownButton.ComboItem(MainClass.Languages.Translate("device_testing"), 0);
            ciDeviceDistribution = new DropDownButton.ComboItem(MainClass.Languages.Translate("market_distribution"), 1);

            btnResetMatrix.Label = MainClass.Languages.Translate("reset_matrix");

            chbSignApp           = new CheckButton(MainClass.Languages.Translate("sign_app"));
            chbSignApp.Active    = MainClass.Workspace.SignApp;
            chbSignApp.Toggled  += new EventHandler(OnChbSignAppToggled);
            chbSignApp.Sensitive = true;            //MainClass.Settings.SignAllow;

            notebook1.ShowTabs   = false;
            notebook1.ShowBorder = false;
            notebook1.Page       = 0;

            Table tblHeader = new Table(1, 4, false);

            ddbTypPublish          = new DropDownRadioButton();
            ddbTypPublish.Changed += delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if (e.Item != null)
                {
                    int selTyp = (int)e.Item;
                    if (selTyp == 0)
                    {
                        lblRemote.Visible    = true;
                        ddbTypRemote.Visible = true;
                        chbSignApp.Sensitive = false;
                    }
                    else
                    {
                        if (!MainClass.LicencesSystem.CheckFunction("marketdistribution", this))
                        {
                            ddbTypPublish.SelectItem(publishItems, ciDeviceTesting);
                            return;
                        }

                        lblRemote.Visible    = false;
                        ddbTypRemote.Visible = false;
                        chbSignApp.Sensitive = true;
                    }

                    MainClass.Workspace.ActualProject.TypPublish = selTyp;
                }
            };
            ddbTypPublish.WidthRequest = 175;
            ddbTypPublish.SetItemSet(publishItems);

            ddbTypRemote          = new DropDownRadioButton();
            ddbTypRemote.Changed += delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if (e.Item != null)
                {
                    string ipAdress = (string)e.Item;
                    MainClass.Settings.RemoteIpAdress = ipAdress;
                }
            };

            ddbTypRemote.WidthRequest = 175;
            ddbTypRemote.SetItemSet(remoteItems);

            publishItems.Add(ciDeviceTesting);
            publishItems.Add(ciDeviceDistribution);

            ddbTypPublish.SelectItem(publishItems, ciDeviceTesting);

            /*if(MainClass.Workspace.ActualProject.TypPublish ==1)
             *      ddbTypPublish.SelectItem(publishItems,ciDeviceDistribution);
             * else
             *      ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);*/


            DropDownButton.ComboItem addRemote0 = new DropDownButton.ComboItem(MainClass.Languages.Translate("remote_none"), "0");
            remoteItems.Add(addRemote0);


            bool          findSelect = false;
            List <string> listIp     = Moscrif.IDE.Tool.Network.GetIpAdress();

            foreach (string ip in listIp)
            {
                DropDownButton.ComboItem addIP = new DropDownButton.ComboItem(ip, ip);
                remoteItems.Add(addIP);

                /*if(ip== MainClass.Settings.RemoteIpAdress){
                 *      ddbTypRemote.SelectItem(remoteItems,addIP);
                 *      findSelect = true;
                 * }*/
            }
            if (!findSelect)
            {
                ddbTypRemote.SelectItem(remoteItems, addRemote0);;
            }


            tblHeader.Attach(new Label("Publish: "), 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 0);
            tblHeader.Attach(ddbTypPublish, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            tblHeader.Attach(lblRemote, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 0);
            tblHeader.Attach(ddbTypRemote, 3, 4, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            this.vbox2.PackStart(tblHeader, false, false, 0);


            storeOutput = new ListStore(typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(bool));

            nvOutput.Model = storeOutput;
            Gtk.CellRendererText collumnRenderer = new Gtk.CellRendererText();

            //nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2);
            nvOutput.AppendColumn("", collumnRenderer, "text", 0);
            nvOutput.AppendColumn("", collumnRenderer, "text", 1);
            nvOutput.Columns[0].FixedWidth = 200;
            nvOutput.Columns[1].Expand     = true;

            //nvOutput.Columns[0].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));
            //nvOutput.Columns[1].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));

            this.Title = MainClass.Languages.Translate("publish_title", project.ProjectName);

            if (project.ProjectUserSetting.CombinePublish == null || project.ProjectUserSetting.CombinePublish.Count == 0)
            {
                project.GeneratePublishCombination();
            }

            if (project.DevicesSettings == null || project.DevicesSettings.Count == 0)
            {
                project.GenerateDevices();
            }

            foreach (Rule rl in MainClass.Settings.Platform.Rules)
            {
                if ((rl.Tag == -1) && !MainClass.Settings.ShowUnsupportedDevices)
                {
                    continue;
                }
                if ((rl.Tag == -2) && !MainClass.Settings.ShowDebugDevices)
                {
                    continue;
                }

                Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == rl.Id);
                if (dvc == null)
                {
                    Console.WriteLine("generate device -{0}", rl.Id);
                    dvc = new Device();
                    dvc.TargetPlatformId     = rl.Id;
                    dvc.PublishPropertisMask = project.GeneratePublishPropertisMask(rl.Id);
                    project.DevicesSettings.Add(dvc);
                }
            }

            project.Save();
            notebook = new Notebook();
            GenerateNotebookPages();

            this.vbox2.PackStart(notebook, true, true, 0);         //PackEnd

            VBox vbox1 = new VBox();

            chbOpenOutputDirectory          = new CheckButton(MainClass.Languages.Translate("open_open_directory_after_publish"));
            chbOpenOutputDirectory.Toggled += new EventHandler(OnChbOpenOutputDirectoryToggled);

            chbIncludeAllResolution           = new CheckButton(MainClass.Languages.Translate("include_all_resolution"));
            chbIncludeAllResolution.Active    = project.IncludeAllResolution;
            chbIncludeAllResolution.Sensitive = false;
            chbIncludeAllResolution.Toggled  += delegate {
                project.IncludeAllResolution = chbIncludeAllResolution.Active;
            };

            vbox1.PackStart(chbIncludeAllResolution, false, false, 0);
            vbox3.PackEnd(chbOpenOutputDirectory, false, false, 0);

            chbDebugLog          = new Gtk.CheckButton(MainClass.Languages.Translate("debug_log_publish"));
            chbDebugLog.Active   = MainClass.Settings.LogPublish;
            chbDebugLog.Toggled += delegate {
                MainClass.Settings.LogPublish = chbDebugLog.Active;
            };

            vbox1.PackEnd(chbDebugLog, false, false, 0);

            this.vbox2.PackEnd(vbox1, false, false, 0);


            VBox hbox = new VBox();

            hbox.PackStart(chbSignApp, false, false, 0);

            this.vbox2.PackEnd(hbox, false, false, 0);

            this.ShowAll();

            int cpage = project.ProjectUserSetting.PublishPage;

            notebook.SwitchPage += delegate(object o, SwitchPageArgs args) {
                project.ProjectUserSetting.PublishPage = notebook.CurrentPage;

                NotebookLabel nl = (NotebookLabel)notebook.GetTabLabel(notebook.CurrentPageWidget);
                chbIncludeAllResolution.Sensitive = false;

                if (nl.Tag == null)
                {
                    return;
                }

                Device d = project.DevicesSettings.Find(x => (int)x.Devicetype == (int)nl.Tag);
                if (d != null)
                {
                    if (d.Includes != null)
                    {
                        if (d.Includes.Skin != null)
                        {
                            if (!String.IsNullOrEmpty(d.Includes.Skin.Name))
                            {
                                chbIncludeAllResolution.Sensitive = true;
                            }
                        }
                    }
                }
            };

            chbOpenOutputDirectory.Active = MainClass.Settings.OpenOutputAfterPublish;


            notebook.CurrentPage = cpage;
            btnNext.GrabFocus();
        }
Exemplo n.º 2
0
        public PublishDialogWizzard()
        {
            project  = MainClass.Workspace.ActualProject;
            this.TransientFor = MainClass.MainWindow;
            this.Build();

            ciDeviceTesting = new DropDownButton.ComboItem(MainClass.Languages.Translate("device_testing"),0);
            ciDeviceDistribution = new DropDownButton.ComboItem(MainClass.Languages.Translate("market_distribution"),1);

            btnResetMatrix.Label = MainClass.Languages.Translate("reset_matrix");

            chbSignApp= new CheckButton( MainClass.Languages.Translate("sign_app"));
            chbSignApp.Active = MainClass.Workspace.SignApp;
            chbSignApp.Toggled += new EventHandler(OnChbSignAppToggled);
            chbSignApp.Sensitive = true;//MainClass.Settings.SignAllow;

            notebook1.ShowTabs = false;
            notebook1.ShowBorder = false;
            notebook1.Page = 0;

            Table tblHeader = new Table(1,4,false);

            ddbTypPublish = new DropDownRadioButton();
            ddbTypPublish.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if(e.Item !=null){
                    int selTyp = (int)e.Item;
                    if(selTyp == 0){
                        lblRemote.Visible = true;
                        ddbTypRemote.Visible = true;
                        chbSignApp.Sensitive= false;
                    } else {
                        if(!MainClass.LicencesSystem.CheckFunction("marketdistribution",this)){
                            ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);
                            return;
                        }

                        lblRemote.Visible = false;
                        ddbTypRemote.Visible = false;
                        chbSignApp.Sensitive= true;
                    }

                    MainClass.Workspace.ActualProject.TypPublish = selTyp;
                }
            };
            ddbTypPublish.WidthRequest = 175;
            ddbTypPublish.SetItemSet(publishItems);

            ddbTypRemote = new DropDownRadioButton();
            ddbTypRemote.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if(e.Item !=null){
                    string ipAdress = (string)e.Item;
                    MainClass.Settings.RemoteIpAdress = ipAdress;
                }
            };

            ddbTypRemote.WidthRequest = 175;
            ddbTypRemote.SetItemSet(remoteItems);

            publishItems.Add(ciDeviceTesting);
            publishItems.Add(ciDeviceDistribution);

            ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);
            /*if(MainClass.Workspace.ActualProject.TypPublish ==1)
                ddbTypPublish.SelectItem(publishItems,ciDeviceDistribution);
            else
                ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);*/

            DropDownButton.ComboItem addRemote0 = new DropDownButton.ComboItem(MainClass.Languages.Translate("remote_none"),"0");
            remoteItems.Add(addRemote0);

            bool findSelect = false;
            List<string> listIp = Moscrif.IDE.Tool.Network.GetIpAdress();
            foreach (string ip in listIp){
                DropDownButton.ComboItem addIP = new DropDownButton.ComboItem(ip,ip);
                remoteItems.Add(addIP);
                /*if(ip== MainClass.Settings.RemoteIpAdress){
                    ddbTypRemote.SelectItem(remoteItems,addIP);
                    findSelect = true;
                }*/
            }
            if(!findSelect){
                ddbTypRemote.SelectItem(remoteItems,addRemote0);;
            }

            tblHeader.Attach(new Label("Publish: "),0,1,0,1,AttachOptions.Fill,AttachOptions.Fill,5,0);
            tblHeader.Attach(ddbTypPublish,1,2,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0);

            tblHeader.Attach(lblRemote,2,3,0,1,AttachOptions.Fill,AttachOptions.Fill,5,0);
            tblHeader.Attach(ddbTypRemote,3,4,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0);

            this.vbox2.PackStart(tblHeader,false,false,0);

            storeOutput = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf),typeof (bool));

            nvOutput.Model = storeOutput;
            Gtk.CellRendererText collumnRenderer = new Gtk.CellRendererText();

            //nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2);
            nvOutput.AppendColumn ("", collumnRenderer, "text", 0);
            nvOutput.AppendColumn ("", collumnRenderer, "text", 1);
            nvOutput.Columns[0].FixedWidth = 200;
            nvOutput.Columns[1].Expand = true;

            //nvOutput.Columns[0].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));
            //nvOutput.Columns[1].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));

            this.Title = MainClass.Languages.Translate("publish_title" , project.ProjectName);

            if(project.ProjectUserSetting.CombinePublish == null || project.ProjectUserSetting.CombinePublish.Count==0){
                project.GeneratePublishCombination();
            }

            if(project.DevicesSettings == null || project.DevicesSettings.Count == 0)
                project.GenerateDevices();

            foreach (Rule rl in MainClass.Settings.Platform.Rules){

                if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue;
                if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue;

                Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == rl.Id);
                if (dvc == null) {
                    Console.WriteLine("generate device -{0}",rl.Id);
                    dvc = new Device();
                    dvc.TargetPlatformId = rl.Id;
                    dvc.PublishPropertisMask = project.GeneratePublishPropertisMask(rl.Id);
                    project.DevicesSettings.Add(dvc);
                }
            }

            project.Save();
            notebook = new Notebook();
            GenerateNotebookPages();

            this.vbox2.PackStart(notebook,true,true,0);//PackEnd

            VBox vbox1 = new VBox();

            chbOpenOutputDirectory = new CheckButton( MainClass.Languages.Translate("open_open_directory_after_publish"));
            chbOpenOutputDirectory.Toggled += new EventHandler(OnChbOpenOutputDirectoryToggled);

            chbIncludeAllResolution = new CheckButton( MainClass.Languages.Translate("include_all_resolution"));
            chbIncludeAllResolution.Active = project.IncludeAllResolution;
            chbIncludeAllResolution.Sensitive = false;
            chbIncludeAllResolution.Toggled+= delegate {
                project.IncludeAllResolution =chbIncludeAllResolution.Active;
            };

            vbox1.PackStart(chbIncludeAllResolution,false,false,0);
            vbox3.PackEnd(chbOpenOutputDirectory,false,false,0);

            chbDebugLog = new Gtk.CheckButton(MainClass.Languages.Translate("debug_log_publish"));
            chbDebugLog.Active = MainClass.Settings.LogPublish;
            chbDebugLog.Toggled+= delegate {
                MainClass.Settings.LogPublish =  chbDebugLog.Active;
            };

            vbox1.PackEnd(chbDebugLog,false,false,0);

            this.vbox2.PackEnd(vbox1,false,false,0);

            VBox hbox = new VBox();
            hbox.PackStart(chbSignApp,false,false,0);

            this.vbox2.PackEnd(hbox,false,false,0);

            this.ShowAll();

            int cpage = project.ProjectUserSetting.PublishPage;

            notebook.SwitchPage += delegate(object o, SwitchPageArgs args) {
                project.ProjectUserSetting.PublishPage = notebook.CurrentPage;

                NotebookLabel nl = (NotebookLabel)notebook.GetTabLabel(notebook.CurrentPageWidget);
                chbIncludeAllResolution.Sensitive = false;

                if(nl.Tag == null) return;

                Device d = project.DevicesSettings.Find(x=>(int)x.Devicetype==(int)nl.Tag);
                if(d!=null){
                    if(d.Includes != null){
                        if(d.Includes.Skin!=null){
                            if(!String.IsNullOrEmpty(d.Includes.Skin.Name))
                                chbIncludeAllResolution.Sensitive = true;
                        }
                    }
                }
            };

            chbOpenOutputDirectory.Active = MainClass.Settings.OpenOutputAfterPublish;

            notebook.CurrentPage =cpage;
            btnNext.GrabFocus();
        }
Exemplo n.º 3
0
        private void getRecentWorkspace()
        {
            IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();
            int no =0;
            foreach(RecentFile rf in lRecentProjects){

                WebButton lb = new WebButton();
                lb.Label = System.IO.Path.GetFileName(rf.DisplayName);
                lb.HoverMessage =rf.DisplayName;
                //lb.Description=" ";
                lb.WidthRequest = 150;
                string fileName = rf.FileName;
                lb.Clicked+= delegate(object sender, EventArgs e) {
                    Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fileName);
                    if (workspace != null)
                        MainClass.MainWindow.ReloadWorkspace(workspace,false,true);
                };
                tblAction.Attach(lb,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Shrink,0,0);
                no++;
                if (no>=2) break;
            }
            if(lRecentProjects.Count>2){
                DropDownButton.ComboItemSet otherSample = new DropDownButton.ComboItemSet ();

                DropDownButton ddbSample = new DropDownButton();
                ddbSample.Relief = ReliefStyle.None;
                ddbSample.HeightRequest = 25;
                ddbSample.MarkupFormat = "<span  foreground=\"#697077\"><b>{0}</b></span>";
                ddbSample.WidthRequest = 150;
                ddbSample.SetItemSet(otherSample);
                for (int i = 3;i<lRecentProjects.Count;i++){
                    DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(System.IO.Path.GetFileName(lRecentProjects[i].DisplayName)
                                                                                       ,lRecentProjects[i].FileName);
                    otherSample.Add(addComboItem);
                }
                ddbSample.ActiveText="More...";
                ddbSample.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e) {
                    if(e.Item !=null){
                        string worksPath = (string)e.Item;
                        Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(worksPath);
                        if (workspace != null)
                            MainClass.MainWindow.ReloadWorkspace(workspace,true,true);
                    }
                };
                tblAction.Attach(ddbSample,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Fill,0,0);
            }
        }
Exemplo n.º 4
0
    public void AddAndShowProject(Project p, bool addRecent,bool showStartPage)
    {
        if (p != null) {
            DropDownButton.ComboItem ci = new DropDownButton.ComboItem(p.ProjectName,p);
            projectItems.Add(ci);
            ddbProject.SelectItem(projectItems,ci);

            ShowProject(p,addRecent);

            if(showStartPage){
                OpenFile(MainClass.Workspace.GetFullPath(p.StartFile),false);
            }
        }
    }
Exemplo n.º 5
0
    private void ReloadDevice(bool setSelectedDevices)
    {
        ddbDevice.Clear();
        foreach (Rule rl in MainClass.Settings.Platform.Rules) {
            if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue;
            if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue;

            string dirPublish = MainClass.Tools.GetPublishDirectory(rl.Specific);
            if (System.IO.Directory.Exists(dirPublish)){

                DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(rl.Name,rl);
                deviceItems.Add(addComboItem);

                if(setSelectedDevices){
                    if (rl.Id==  MainClass.Workspace.ActualDevice) {
                        ddbDevice.SelectItem(deviceItems,addComboItem);
                    } else {
                        if(deviceItems.Count>0)
                            ddbDevice.SelectItem(deviceItems,deviceItems[0]);
                    }
                }
            }else {
                Logger.Debug("{0} devices missing publish tool.",rl.Name);
            }
        }
    }
Exemplo n.º 6
0
    private void FillResolution(int device, bool allResolution)
    {
        bool isFind = false;
        bool hardAll  = false;
        ddbResolution.Clear();

        string path="";
        if(MainClass.Workspace!= null)
            path = MainClass.Workspace.ActualResolution;

        string[] listFi = Directory.GetFiles(MainClass.Paths.DisplayDir, "*.ini");
        string vvgaPath = System.IO.Path.Combine(MainClass.Paths.DisplayDir,"noskin_vga.ini");

        PlatformResolution pr = MainClass.Settings.PlatformResolutions.Find(x=>x.IdPlatform == device);
        if(pr == null){
            hardAll = true; // nema definiciu , zobrazuju sa vsetky
        }
        DropDownButton.ComboItem selectComboItem = null;
        DropDownButton.ComboItem vvgaComboItem = null;

        foreach (string fi in listFi) {
            EmulatorDisplay dd = new EmulatorDisplay(fi);
            if (dd.Load()) {

                if((!allResolution) && (!hardAll)){
                    Rule rlr = MainClass.Settings.Resolution.Rules.Find(x=>x.Height==dd.Height && x.Width== dd.Width);
                    if((rlr!= null) && device >-1){
                        if(!pr.IsValidResolution(rlr.Id)){
                            continue;
                        }
                    }
                }

                DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(dd.Title,dd.FilePath);
                resolutionItems.Add(addComboItem);

                if(dd.FilePath == vvgaPath){
                    vvgaComboItem = addComboItem;
                }

                if (dd.FilePath == path) {
                    isFind = true;
                    selectComboItem = addComboItem;
                }
            }
        }

        if (isFind)
            ddbResolution.SelectItem(resolutionItems,selectComboItem);
        else{
            if(vvgaComboItem != null){
                ddbResolution.SelectItem(resolutionItems,vvgaComboItem);
            } else {
                if(resolutionItems.Count>0){
                    ddbResolution.SelectItem(resolutionItems,resolutionItems[0]);
                }
            }
        }

        if(!hardAll){
            if(!allResolution){
                resolutionItems.Add(new DropDownButton.ComboItem(MainClass.Languages.Translate("show_denied" ) , "-1") );
            } else {
                resolutionItems.Add(new DropDownButton.ComboItem(MainClass.Languages.Translate("hide_denied" ) , "-2") );
            }
        }
    }
Exemplo n.º 7
0
        public EditorWidget(Gtk.Window parent)
        {
            this.Build();
            this.parentWindow = parent;
            feExternalPRogram.IsFolder = false;
            DropDownButton.ComboItem textEdit = new DropDownButton.ComboItem("Text Editor",(int)ExtensionSetting.OpenTyp.TEXT);

            actionItems.Add(textEdit);
            actionItems.Add(new DropDownButton.ComboItem("Image Editor",(int)ExtensionSetting.OpenTyp.IMAGE));
            actionItems.Add(new DropDownButton.ComboItem("Database Editor",(int)ExtensionSetting.OpenTyp.DATABASE));
            actionItems.Add(new DropDownButton.ComboItem("System program",(int)ExtensionSetting.OpenTyp.SYSTEM));
            actionItems.Add(new DropDownButton.ComboItem("External Program",(int)ExtensionSetting.OpenTyp.EXTERNAL));

            ddrbAction.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if(e.Item !=null){
                    int indx = 0;
                    Int32.TryParse(e.Item.ToString(),out indx);
                    switch(indx){
                    case 0:{
                        frmExternal.Sensitive = false;
                        break;
                    }
                    case 1:{
                        frmExternal.Sensitive = false;
                        break;
                    }
                    case 2:{
                        frmExternal.Sensitive = false;
                        break;
                    }
                    case -1:{
                        frmExternal.Sensitive = false;
                        break;
                    }
                    case -2:{
                        frmExternal.Sensitive = true;
                        break;
                    }
                    }
                }
            };
            ddrbAction.SetItemSet(actionItems);
            ddrbAction.SelectItem(actionItems,textEdit);

            tblMain.Attach(ddrbAction,2,3,2,3,AttachOptions.Fill,AttachOptions.Shrink,0,0);
            tblExternal.Attach(feExternalPRogram,1,2,0,1,AttachOptions.Fill,AttachOptions.Shrink,0,0);

            tvExtension.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);
            tvExtension.Model = resolStore;
            this.ShowAll();

            if((MainClass.Settings.ExtensionList == null)||(MainClass.Settings.ExtensionList.Count<1)){
                MainClass.Settings.GenerateExtensionList();
            }

            foreach(ExtensionSetting ex in MainClass.Settings.ExtensionList){
                resolStore.AppendValues(ex.Extension,ex);
            }
            tvExtension.Selection.Changed+= delegate(object sender, EventArgs e) {
                selectedExtensionSetting = GetSelectedExtensionSetting();
                if(selectedExtensionSetting==null) return;

                entrExtension.Text = selectedExtensionSetting.Extension;

                ddrbAction.SelectValue(actionItems,(int)selectedExtensionSetting.OpenType);

                if(!String.IsNullOrEmpty(selectedExtensionSetting.ExternalProgram)){
                    feExternalPRogram.DefaultPath =selectedExtensionSetting.ExternalProgram;
                    feExternalPRogram.Path =selectedExtensionSetting.ExternalProgram;
                    entrParameters.Text = selectedExtensionSetting.Parameter;
                }
            };
            tvExtension.Selection.SelectPath(new TreePath("0"));
        }
Exemplo n.º 8
0
        public EditorWidget(Gtk.Window parent)
        {
            this.Build();
            this.parentWindow          = parent;
            feExternalPRogram.IsFolder = false;
            DropDownButton.ComboItem textEdit = new DropDownButton.ComboItem("Text Editor", (int)ExtensionSetting.OpenTyp.TEXT);

            actionItems.Add(textEdit);
            actionItems.Add(new DropDownButton.ComboItem("Image Editor", (int)ExtensionSetting.OpenTyp.IMAGE));
            actionItems.Add(new DropDownButton.ComboItem("Database Editor", (int)ExtensionSetting.OpenTyp.DATABASE));
            actionItems.Add(new DropDownButton.ComboItem("System program", (int)ExtensionSetting.OpenTyp.SYSTEM));
            actionItems.Add(new DropDownButton.ComboItem("External Program", (int)ExtensionSetting.OpenTyp.EXTERNAL));

            ddrbAction.Changed += delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if (e.Item != null)
                {
                    int indx = 0;
                    Int32.TryParse(e.Item.ToString(), out indx);
                    switch (indx)
                    {
                    case 0: {
                        frmExternal.Sensitive = false;
                        break;
                    }

                    case 1: {
                        frmExternal.Sensitive = false;
                        break;
                    }

                    case 2: {
                        frmExternal.Sensitive = false;
                        break;
                    }

                    case -1: {
                        frmExternal.Sensitive = false;
                        break;
                    }

                    case -2: {
                        frmExternal.Sensitive = true;
                        break;
                    }
                    }
                }
            };
            ddrbAction.SetItemSet(actionItems);
            ddrbAction.SelectItem(actionItems, textEdit);

            tblMain.Attach(ddrbAction, 2, 3, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            tblExternal.Attach(feExternalPRogram, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            tvExtension.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);
            tvExtension.Model = resolStore;
            this.ShowAll();


            if ((MainClass.Settings.ExtensionList == null) || (MainClass.Settings.ExtensionList.Count < 1))
            {
                MainClass.Settings.GenerateExtensionList();
            }

            foreach (ExtensionSetting ex in MainClass.Settings.ExtensionList)
            {
                resolStore.AppendValues(ex.Extension, ex);
            }
            tvExtension.Selection.Changed += delegate(object sender, EventArgs e) {
                selectedExtensionSetting = GetSelectedExtensionSetting();
                if (selectedExtensionSetting == null)
                {
                    return;
                }

                entrExtension.Text = selectedExtensionSetting.Extension;

                ddrbAction.SelectValue(actionItems, (int)selectedExtensionSetting.OpenType);

                if (!String.IsNullOrEmpty(selectedExtensionSetting.ExternalProgram))
                {
                    feExternalPRogram.DefaultPath = selectedExtensionSetting.ExternalProgram;
                    feExternalPRogram.Path        = selectedExtensionSetting.ExternalProgram;
                    entrParameters.Text           = selectedExtensionSetting.Parameter;
                }
            };
            tvExtension.Selection.SelectPath(new TreePath("0"));
        }