public void BindActor() { fActorStore = new ListStore(typeof(int), typeof(string)); cbActor.Clear(); foreach (DataRow row in ActorSource.Tables["Actor"].Rows) { fActorStore.AppendValues((int)row["ID"], (string)row["Name"]); } cbActor.Model = fActorStore; CellRendererText actorText = new CellRendererText(); actorText.Style = Pango.Style.Oblique; //actorText.BackgroundGdk = new Gdk.Color(0x63,0,0); cbActor.PackStart(actorText, true); cbActor.AddAttribute(actorText, "text", 1); TreeIter iter; if (fActorStore.GetIterFirst(out iter)) { cbActor.SetActiveIter(iter); fActorID = (int)ActorSource.Tables["Actor"].Rows[0]["ID"]; } }
public Widget ResolveEditor(PropertyItem item = null) { if (this._propertyItem.DiaplayName != "Display_FontSize") { this.widget = (Widget) new UndoEntryIntEx(); (this.widget as UndoEntryIntEx).SetEntryPRoperty(true, 0, 1.0); if (this._propertyItem.InstanceCount > 1) { this.widget.Sensitive = false; } else { this.SetControl(); if (this._propertyItem.ValueRangeDescriptor != null) { (this.widget as UndoEntryIntEx).MaxValue = this._propertyItem.ValueRangeDescriptor.MaxValue; (this.widget as UndoEntryIntEx).MinValue = this._propertyItem.ValueRangeDescriptor.MinValue; (this.widget as UndoEntryIntEx).ScrollNum = this._propertyItem.ValueRangeDescriptor.Step; } (this.widget as UndoEntryIntEx).EntryValueChanged += new EventHandler <EntryIntEventArgs>(this.IntEditor_Changed); } return(this.widget); } ComboBoxEntry comboBoxEntry = new ComboBoxEntry(); ListStore listStore = new ListStore(new Type[1] { typeof(string) }); foreach (int combox in this.comboxList) { listStore.AppendValues(new object[1] { (object)combox.ToString() }); } comboBoxEntry.Model = (TreeModel)listStore; CellRendererText cellRendererText = new CellRendererText(); comboBoxEntry.PackStart((CellRenderer)cellRendererText, true); comboBoxEntry.AddAttribute((CellRenderer)cellRendererText, "text", 0); object obj = this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, (object[])null); int index = this.IndexCombox((int)obj); if (index == -1) { comboBoxEntry.Entry.Text = obj.ToString(); } else { comboBoxEntry.Active = index; comboBoxEntry.Entry.Text = this.comboxList[index].ToString(); } this.widget = (Widget)comboBoxEntry; (this.widget as ComboBoxEntry).Changed += new EventHandler(this.combox_Changed); (this.widget as ComboBoxEntry).Entry.KeyReleaseEvent += new KeyReleaseEventHandler(this.Entry_KeyReleaseEvent); (this.widget as ComboBoxEntry).Entry.FocusOutEvent += new FocusOutEventHandler(this.Entry_FocusOutEvent); (this.widget as ComboBoxEntry).Entry.Changed += new EventHandler(this.Entry_Changed); this.widget = (Widget)comboBoxEntry; return(this.widget); }
public void BindStateOut() { if (TaskStateSource != null) { fStateOutStore = new ListStore(typeof(int), typeof(string)); cbStateOut.Clear(); foreach (DataRow row in TaskStateSource.Tables["TaskState"].Rows) { fStateOutStore.AppendValues((int)row["ID"], (string)row["Name"]); } cbStateOut.Model = fStateOutStore; CellRendererText stateText = new CellRendererText(); stateText.Style = Pango.Style.Oblique; cbStateOut.PackStart(stateText, true); cbStateOut.AddAttribute(stateText, "text", 1); TreeIter iter; if (fStateOutStore.GetIterFirst(out iter)) { cbStateOut.SetActiveIter(iter); } } else { throw new ManagementException(ExceptionType.NotAllowed, "TaskStateSource not set to instance"); } }
public ConnectDialog() : base(Gui.MainWindow.Window, "ConnectDialog") { store = new ListStore(typeof(object), typeof(string)); ipCombo.Model = store; ipCombo.TextColumn = 1; CellRendererPixbuf imageCell = new CellRendererPixbuf(); CellRendererText textCell = new CellRendererText(); ipCombo.Clear(); ipCombo.PackStart(imageCell, false); ipCombo.PackStart(textCell, true); ipCombo.SetCellDataFunc(imageCell, ShowImage); ipCombo.SetCellDataFunc(textCell, ShowText); ipCombo.WrapWidth = 3; ipCombo.Entry.ActivatesDefault = true; PopulateAddressCombo(); networksListStore = new ListStore(typeof(object)); networksListStore.AppendValues(new object()); foreach (Network network in Runtime.Core.Networks) { networksListStore.AppendValues(network); } networksComboBox.Clear(); CellRendererText networkNameCell = new CellRendererText(); networksComboBox.PackStart(networkNameCell, false); networksComboBox.SetCellDataFunc(networkNameCell, new CellLayoutDataFunc(NetworkTextFunc)); networksComboBox.Model = networksListStore; networksComboBox.Changed += delegate { PopulateAddressCombo(); }; networksComboBox.Active = Math.Min(networksListStore.IterNChildren(), 1); notImage = Gui.LoadIcon(16, "dialog-warning"); localImage = Gui.LoadIcon(16, "stock_channel"); }
public void BindState() { fStateStore = new ListStore(typeof(int), typeof(string)); cbState.Clear(); foreach (DataRow row in StateSource.Tables["TaskState"].Rows) { fStateStore.AppendValues((int)row["ID"], (string)row["Name"]); } cbState.Model = fStateStore; CellRendererText stateText = new CellRendererText(); cbState.PackStart(stateText, true); cbState.AddAttribute(stateText, "text", 1); TreeIter iter; if (fStateStore.GetIterFirst(out iter)) { cbState.SetActiveIter(iter); fStateID = (int)StateSource.Tables["TaskState"].Rows[0]["ID"]; } }
void PopulateHostEntry() { var devs = Env.Discovery.Devices; var active = hostEntry.ActiveText; hostEntry.Clear(); var cell = new CellRendererText(); hostEntry.PackStart(cell, false); hostEntry.AddAttribute(cell, "text", 0); hostEntry.TextColumn = 0; var store = new ListStore(typeof(string)); if (!string.IsNullOrWhiteSpace(active) && !devs.Contains(active)) { store.AppendValues(active); } store.AppendValues(devs); hostEntry.Model = store; Console.WriteLine(devs); }
public NewProjectWizzard_New(Window parent) { if (parent != null) { this.TransientFor = parent; } else { this.TransientFor = MainClass.MainWindow; } this.Build(); atrApplication = new FileTemplate.Attribute(); atrApplication.Name = "application"; atrApplication.Type = "text"; this.DefaultHeight = 390; this.Title = MainClass.Languages.Translate("moscrif_ide_title_f1"); ntbWizzard.ShowTabs = false; Pango.FontDescription customFont = lblNewProject.Style.FontDescription.Copy(); // Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Size = customFont.Size + (int)(customFont.Size / 2); customFont.Weight = Pango.Weight.Bold; lblNewProject.ModifyFont(customFont); storeTyp = new ListStore(typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(ProjectTemplate), typeof(bool)); storeOrientation = new ListStore(typeof(string), typeof(string), typeof(Gdk.Pixbuf), typeof(string)); storeOutput = new ListStore(typeof(string), typeof(string), typeof(Gdk.Pixbuf)); nvOutput.Model = storeOutput; nvOutput.AppendColumn("", new Gtk.CellRendererText(), "text", 0); nvOutput.AppendColumn("", new Gtk.CellRendererText(), "text", 1); nvOutput.AppendColumn("", new Gtk.CellRendererPixbuf(), "pixbuf", 2); nvOutput.Columns[1].Expand = true; ivSelectTyp.Model = storeTyp; ivSelectTyp.SelectionMode = SelectionMode.Single; ivSelectTyp.Orientation = Orientation.Horizontal; CellRendererText rendererSelectTyp = new CellRendererText(); rendererSelectTyp.Ypad = 0; ivSelectTyp.PackEnd(rendererSelectTyp, false); ivSelectTyp.SetCellDataFunc(rendererSelectTyp, new Gtk.CellLayoutDataFunc(RenderTypProject)); ivSelectTyp.PixbufColumn = COL_PIXBUF; ivSelectTyp.TooltipColumn = COL_DISPLAY_TEXT; ivSelectTyp.AddAttribute(rendererSelectTyp, "sensitive", 5); Gdk.Pixbuf icon0 = MainClass.Tools.GetIconFromStock("project.png", IconSize.LargeToolbar); storeTyp.AppendValues("New Empty Project", "Create empty application", icon0, "", null, true); DirectoryInfo[] diTemplates = GetDirectory(MainClass.Paths.FileTemplateDir); foreach (DirectoryInfo di in diTemplates) { string name = di.Name; string iconFile = System.IO.Path.Combine(di.FullName, "icon.png"); string descFile = System.IO.Path.Combine(di.FullName, "description.xml"); if (!File.Exists(iconFile) || !File.Exists(descFile)) { continue; } string descr = name; ProjectTemplate pt = null; if (File.Exists(descFile)) { pt = ProjectTemplate.OpenProjectTemplate(descFile); if ((pt != null)) { descr = pt.Description; } } Gdk.Pixbuf icon = new Gdk.Pixbuf(iconFile); DirectoryInfo[] templates = di.GetDirectories(); bool sensitive = true; if (templates.Length < 1) { sensitive = false; } else { sensitive = true; } storeTyp.AppendValues(name, descr, icon, di.FullName, pt, sensitive); } ivSelectTyp.SelectionChanged += delegate(object sender, EventArgs e) { Gtk.TreePath[] selRow = ivSelectTyp.SelectedItems; if (selRow.Length < 1) { lblHint.Text = " "; btnNext.Sensitive = false; return; } Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); storeTyp.GetIter(out ti, tp); if (tp.Equals(TreeIter.Zero)) { return; } //string typ = storeTyp.GetValue (ti, 3).ToString(); string text1 = (string)storeTyp.GetValue(ti, 0); string text2 = (string)storeTyp.GetValue(ti, 1); bool sensitive = Convert.ToBoolean(storeTyp.GetValue(ti, 5)); if (!sensitive) { ivSelectTyp.SelectPath(selectedTypPrj); return; } selectedTypPrj = selRow[0]; lblHint.Text = text1 + " - " + text2; btnNext.Sensitive = true; }; CellRendererText rendererOrientation = new CellRendererText(); selectedTypPrj = new TreePath("0"); ivSelectTyp.SelectPath(selectedTypPrj); ivSelectOrientation.Model = storeOrientation; ivSelectOrientation.SelectionMode = SelectionMode.Single; ivSelectOrientation.Orientation = Orientation.Horizontal; ivSelectOrientation.PackEnd(rendererOrientation, false); ivSelectOrientation.SetCellDataFunc(rendererOrientation, new Gtk.CellLayoutDataFunc(RenderOrientationProject)); ivSelectOrientation.PixbufColumn = COL_PIXBUF; ivSelectOrientation.TooltipColumn = COL_DISPLAY_TEXT; foreach (SettingValue ds in MainClass.Settings.DisplayOrientations) { storeOrientation.AppendValues(ds.Display, ds.Display, null, ds.Value); } ivSelectOrientation.SelectPath(new TreePath("0")); storeWorkspace = new ListStore(typeof(string), typeof(string), typeof(int)); cbeWorkspace = new ComboBoxEntry(); cbeWorkspace.Model = storeWorkspace; cbeWorkspace.TextColumn = 0; cbeWorkspace.Changed += OnCbeWorkspaceChanged; this.feLocation = new FileEntry(); this.table3.Attach(this.feLocation, 1, 2, 2, 3); Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table3 [this.feLocation])); w9.XOptions = ((Gtk.AttachOptions)(4)); w9.YOptions = ((Gtk.AttachOptions)(4)); table3.Attach(cbeWorkspace, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0); CellRendererText rendererWorkspace = new CellRendererText(); cbeWorkspace.PackStart(rendererWorkspace, true); cbeWorkspace.SetCellDataFunc(rendererWorkspace, new Gtk.CellLayoutDataFunc(RenderWorkspacePath)); cbeWorkspace.WidthRequest = 125; cbeWorkspace.SetCellDataFunc(cbeWorkspace.Cells[0], new Gtk.CellLayoutDataFunc(RenderWorkspaceName)); string currentWorkspace = ""; if ((MainClass.Workspace != null) && !string.IsNullOrEmpty(MainClass.Workspace.FilePath)) { string name = System.IO.Path.GetFileNameWithoutExtension(MainClass.Workspace.FilePath); storeWorkspace.AppendValues(name, MainClass.Workspace.FilePath, 1); currentWorkspace = MainClass.Workspace.FilePath; } IList <RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace(); foreach (RecentFile rf in lRecentProjects) { if (rf.FileName == currentWorkspace) { continue; } if (File.Exists(rf.FileName)) { string name = System.IO.Path.GetFileNameWithoutExtension(rf.FileName); storeWorkspace.AppendValues(name, rf.FileName, 0); } } //storeWorkspace.AppendValues("","-------------",-1); worksDefaultName = "Workspace" + MainClass.Settings.WorkspaceCount.ToString(); TreeIter tiNewW = storeWorkspace.AppendValues(worksDefaultName, MainClass.Paths.WorkDir, 2); if (!String.IsNullOrEmpty(currentWorkspace)) { cbeWorkspace.Active = 0; } else { feLocation.DefaultPath = MainClass.Paths.WorkDir; cbeWorkspace.SetActiveIter(tiNewW); //storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2); } prjDefaultName = "Project" + MainClass.Settings.ProjectCount.ToString(); entrProjectName.Text = prjDefaultName; cbeWorkspace.ShowAll(); feLocation.ShowAll(); CellRendererText rendererTemplate = new CellRendererText(); cbTemplate.PackStart(rendererTemplate, true); storeTemplate = new ListStore(typeof(string), typeof(string), typeof(string)); cbTemplate.Model = storeTemplate; cbTemplate.Changed += delegate(object sender, EventArgs e) { if (cbTemplate.Active < 0) { return; } if (cbTemplate.ActiveText != KEY_CUSTOM) { tblLibraries.Sensitive = false; tblScreens.Sensitive = false; ivSelectOrientation.Sensitive = false; } else { ivSelectOrientation.Sensitive = true; tblLibraries.Sensitive = true; tblScreens.Sensitive = true; } TreeIter tiChb = new TreeIter(); cbTemplate.GetActiveIter(out tiChb); if (tiChb.Equals(TreeIter.Zero)) { return; } string appPath = storeTemplate.GetValue(tiChb, 2).ToString(); if (File.Exists(appPath)) { AppFile app = new AppFile(appPath); List <string> libs = new List <string>(app.Libs); Widget[] widgets = tblLibraries.Children; foreach (Widget w in widgets) { int indx = libs.FindIndex(x => x == w.Name); if (indx > -1) { (w as CheckButton).Active = true; } else { (w as CheckButton).Active = false; } } } }; btnBack.Sensitive = false; }
public NewProjectWizzard_New(Window parent) { if (parent != null) this.TransientFor =parent; else this.TransientFor = MainClass.MainWindow; this.Build(); atrApplication = new FileTemplate.Attribute(); atrApplication.Name = "application"; atrApplication.Type = "text"; this.DefaultHeight = 390 ; this.Title = MainClass.Languages.Translate("moscrif_ide_title_f1"); ntbWizzard.ShowTabs = false; Pango.FontDescription customFont = lblNewProject.Style.FontDescription.Copy();// Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Size = customFont.Size+(int)(customFont.Size/2); customFont.Weight = Pango.Weight.Bold; lblNewProject.ModifyFont(customFont); storeTyp = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string),typeof(ProjectTemplate),typeof (bool)); storeOrientation = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string)); storeOutput = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf)); nvOutput.Model = storeOutput; nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 0); nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 1); nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2); nvOutput.Columns[1].Expand = true; ivSelectTyp.Model = storeTyp; ivSelectTyp.SelectionMode = SelectionMode.Single; ivSelectTyp.Orientation = Orientation.Horizontal; CellRendererText rendererSelectTyp = new CellRendererText(); rendererSelectTyp.Ypad =0; ivSelectTyp.PackEnd(rendererSelectTyp,false); ivSelectTyp.SetCellDataFunc(rendererSelectTyp, new Gtk.CellLayoutDataFunc(RenderTypProject)); ivSelectTyp.PixbufColumn = COL_PIXBUF; ivSelectTyp.TooltipColumn = COL_DISPLAY_TEXT; ivSelectTyp.AddAttribute(rendererSelectTyp, "sensitive", 5); Gdk.Pixbuf icon0 = MainClass.Tools.GetIconFromStock("project.png",IconSize.LargeToolbar); storeTyp.AppendValues ("New Empty Project", "Create empty application", icon0, "", null,true); DirectoryInfo[] diTemplates = GetDirectory(MainClass.Paths.FileTemplateDir); foreach (DirectoryInfo di in diTemplates) { string name = di.Name; string iconFile = System.IO.Path.Combine(di.FullName,"icon.png"); string descFile = System.IO.Path.Combine(di.FullName,"description.xml"); if(!File.Exists(iconFile) || !File.Exists(descFile)) continue; string descr = name; ProjectTemplate pt = null; if(File.Exists(descFile)){ pt = ProjectTemplate.OpenProjectTemplate(descFile); if((pt!= null)) descr = pt.Description; } Gdk.Pixbuf icon = new Gdk.Pixbuf(iconFile); DirectoryInfo[] templates = di.GetDirectories(); bool sensitive = true; if(templates.Length<1) sensitive = false; else sensitive = true; storeTyp.AppendValues (name, descr, icon, di.FullName,pt,sensitive); } ivSelectTyp.SelectionChanged+= delegate(object sender, EventArgs e) { Gtk.TreePath[] selRow = ivSelectTyp.SelectedItems; if(selRow.Length<1){ lblHint.Text = " "; btnNext.Sensitive = false; return; } Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); storeTyp.GetIter(out ti,tp); if(tp.Equals(TreeIter.Zero))return; //string typ = storeTyp.GetValue (ti, 3).ToString(); string text1 = (string) storeTyp.GetValue (ti, 0); string text2 = (string) storeTyp.GetValue (ti, 1); bool sensitive = Convert.ToBoolean(storeTyp.GetValue (ti, 5)); if(!sensitive){ ivSelectTyp.SelectPath(selectedTypPrj); return; } selectedTypPrj = selRow[0]; lblHint.Text = text1+" - "+text2; btnNext.Sensitive = true; }; CellRendererText rendererOrientation = new CellRendererText(); selectedTypPrj = new TreePath("0"); ivSelectTyp.SelectPath(selectedTypPrj); ivSelectOrientation.Model = storeOrientation; ivSelectOrientation.SelectionMode = SelectionMode.Single; ivSelectOrientation.Orientation = Orientation.Horizontal; ivSelectOrientation.PackEnd(rendererOrientation,false); ivSelectOrientation.SetCellDataFunc(rendererOrientation, new Gtk.CellLayoutDataFunc(RenderOrientationProject)); ivSelectOrientation.PixbufColumn = COL_PIXBUF; ivSelectOrientation.TooltipColumn = COL_DISPLAY_TEXT; foreach(SettingValue ds in MainClass.Settings.DisplayOrientations){ storeOrientation.AppendValues (ds.Display,ds.Display,null,ds.Value); } ivSelectOrientation.SelectPath(new TreePath("0")); storeWorkspace = new ListStore(typeof(string), typeof(string), typeof(int)); cbeWorkspace = new ComboBoxEntry(); cbeWorkspace.Model = storeWorkspace; cbeWorkspace.TextColumn = 0; cbeWorkspace.Changed+= OnCbeWorkspaceChanged; this.feLocation = new FileEntry(); this.table3.Attach (this.feLocation,1,2,2,3); Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table3 [this.feLocation])); w9.XOptions = ((Gtk.AttachOptions)(4)); w9.YOptions = ((Gtk.AttachOptions)(4)); table3.Attach(cbeWorkspace,1,2,1,2,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0); CellRendererText rendererWorkspace = new CellRendererText(); cbeWorkspace.PackStart(rendererWorkspace, true); cbeWorkspace.SetCellDataFunc(rendererWorkspace, new Gtk.CellLayoutDataFunc(RenderWorkspacePath)); cbeWorkspace.WidthRequest = 125; cbeWorkspace.SetCellDataFunc(cbeWorkspace.Cells[0], new Gtk.CellLayoutDataFunc(RenderWorkspaceName)); string currentWorkspace =""; if((MainClass.Workspace!= null) && !string.IsNullOrEmpty(MainClass.Workspace.FilePath)) { string name = System.IO.Path.GetFileNameWithoutExtension(MainClass.Workspace.FilePath); storeWorkspace.AppendValues (name,MainClass.Workspace.FilePath,1); currentWorkspace = MainClass.Workspace.FilePath; } IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace(); foreach(RecentFile rf in lRecentProjects){ if(rf.FileName == currentWorkspace) continue; if(File.Exists(rf.FileName)){ string name = System.IO.Path.GetFileNameWithoutExtension(rf.FileName); storeWorkspace.AppendValues(name,rf.FileName,0); } } //storeWorkspace.AppendValues("","-------------",-1); worksDefaultName = "Workspace"+MainClass.Settings.WorkspaceCount.ToString(); TreeIter tiNewW = storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2); if(!String.IsNullOrEmpty(currentWorkspace)){ cbeWorkspace.Active =0; } else { feLocation.DefaultPath = MainClass.Paths.WorkDir; cbeWorkspace.SetActiveIter(tiNewW); //storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2); } prjDefaultName = "Project"+MainClass.Settings.ProjectCount.ToString(); entrProjectName.Text = prjDefaultName; cbeWorkspace.ShowAll(); feLocation.ShowAll(); CellRendererText rendererTemplate = new CellRendererText(); cbTemplate.PackStart(rendererTemplate, true); storeTemplate = new ListStore(typeof(string), typeof(string), typeof(string)); cbTemplate.Model = storeTemplate; cbTemplate.Changed+= delegate(object sender, EventArgs e) { if(cbTemplate.Active <0) return; if(cbTemplate.ActiveText != KEY_CUSTOM){ tblLibraries.Sensitive = false; tblScreens.Sensitive = false; ivSelectOrientation.Sensitive = false; } else { ivSelectOrientation.Sensitive = true; tblLibraries.Sensitive = true; tblScreens.Sensitive = true; } TreeIter tiChb = new TreeIter(); cbTemplate.GetActiveIter(out tiChb); if(tiChb.Equals(TreeIter.Zero))return; string appPath = storeTemplate.GetValue(tiChb, 2).ToString(); if(File.Exists(appPath)){ AppFile app = new AppFile(appPath); List<string> libs = new List<string>(app.Libs); Widget[] widgets = tblLibraries.Children; foreach (Widget w in widgets ){ int indx = libs.FindIndex(x=>x==w.Name); if(indx>-1) { (w as CheckButton).Active = true; } else { (w as CheckButton).Active = false; } } } }; btnBack.Sensitive = false; }