void HandleButtonPressEvent(object sender, ButtonPressEventArgs args) { TreeViewColumn col; CellRenderer cr; TreePath path; TreeIter iter; if (args.Event.Button != 1 || !GetCellAtPos((int)args.Event.X, (int)args.Event.Y, out path, out col, out cr)) { return; } if (!store.GetIter(out iter, path)) { return; } if (cr == refresh) { var options = DebuggingService.DebuggerSession.Options.EvaluationOptions.Clone(); options.AllowMethodEvaluation = true; options.AllowToStringCalls = true; var frame = (StackFrame)store.GetValue(iter, FrameColumn); var method = EvaluateMethodName(frame, options); store.SetValue(iter, MethodColumn, method); store.SetValue(iter, CanRefreshColumn, false); } }
TreeIter GetTreeIterForRow(int index) { TreeIter iter; _listStore.GetIter(out iter, new TreePath(new int[] { index })); return(iter); }
protected void onCustomersRowActivated(object o, RowActivatedArgs args) { TreeIter iter; CustomersListStore.GetIter(out iter, args.Path); int customerId = (int)CustomersListStore.GetValue(iter, 0); ShowCustomerDialog(customerId); }
private void unknownToggled(object sender, Gtk.ToggledArgs args) { Gtk.TreeIter iter; listStoreAll.GetIter(out iter, new Gtk.TreePath(args.Path)); ChronopicRegisterWindowTypes crwt = (ChronopicRegisterWindowTypes)listStoreAll.GetValue(iter, 0); if (!crwt.Unknown) { crwt.Unknown = true; crwt.Contacts = false; crwt.Encoder = false; } //store on SQL SqliteChronopicRegister.Update(false, new ChronopicRegisterPort(crwt.SerialNumber, ChronopicRegisterPort.Types.UNKNOWN), ChronopicRegisterPort.Types.UNKNOWN); }
/// <summary> /// 更新一条数据到任务状态列表中。 /// </summary> /// <param name="rowidx">Rowidx.</param> /// <param name="columnidx">Columnidx.</param> /// <param name="value">Value.</param> public void UpdateRowForTheListView(int rowidx, int columnidx, object value) { TreeIter iter; ListStore.GetIter(out iter, new TreePath(rowidx.ToString())); if (columnidx == 1) { ListStore.SetValue(iter, columnidx, Convert.ToInt32(value)); } }
private void pluginsTreeView_RowActivated(object sender, RowActivatedArgs args) { TreeIter iter; if (pluginsListStore.GetIter(out iter, args.Path) == true) { PluginInfo pluginInfo = (PluginInfo)pluginsListStore.GetValue(iter, 0); IPluginConfigDialog configDialog = pluginInfo.CreateConfigDialog(); configDialog.Show(dialog); } }
void HandleToggle(object sender, ToggledArgs e) { TreeIter iter; if (targetStore.GetIter(out iter, new TreePath(e.Path))) { bool currentVal = (bool)targetStore.GetValue(iter, LISTCOL_Checked); targetStore.SetValue(iter, LISTCOL_Checked, !currentVal); } UpdateButtonState(); }
private void preferenceToggled(object o, ToggledArgs args) { TreeIter iter; if (PolicyTreeStore.GetIter(out iter, new TreePath(args.Path))) { bool old = (bool)PolicyTreeStore.GetValue(iter, 0); notificationTypes type = (notificationTypes)PolicyTreeStore.GetValue(iter, 2); setNotificationState(type, !old); PolicyTreeStore.SetValue(iter, 0, !old); } }
void OnSelectToggled(object o, ToggledArgs args) { //get the toggled row, pull out the value for the select box, and store the opposite. TreeIter Iter; if (MusicListStore.GetIter(out Iter, new TreePath(args.Path))) { bool OldValue = (bool)MusicListStore.GetValue(Iter, 0); MusicListStore.SetValue(Iter, 0, !OldValue); Log.DebugFormat("Setting Selection Value For Row {0} -> {1}", MusicListStore.GetStringFromIter(Iter), !OldValue); } }
void crt_toggled(object o, ToggledArgs args) { TreeIter iter; Console.WriteLine("Toggled"); Gtk.ListStore store = (Gtk.ListStore)tvBar.Model; if (store.GetIter(out iter, new TreePath(args.Path))) { bool old = (bool)store.GetValue(iter, 3); store.SetValue(iter, 3, !old); } }
protected override void ShowPopupMenu(TreePath path) { //string tfpath = String.Empty; //Workspace workspace = null; if (path != null) { TreeIter iter; store.GetIter(out iter, path); //tfpath = store.GetValue(iter, ColumnIndex.Path).ToString(); } //menu.Show(workspace, tfpath); }
protected void OnButtonOrdinalUpClicked(object sender, EventArgs e) { TreeIter SelectIter, BeforeIter; treeviewref.Selection.GetSelected(out SelectIter); SelectIter = filter.ConvertIterToChildIter(SelectIter); TreePath path = RefListStore.GetPath(SelectIter); path.Prev(); RefListStore.GetIter(out BeforeIter, path); RefListStore.Swap(SelectIter, BeforeIter); OnTreeviewrefCursorChanged(treeviewref, EventArgs.Empty); TestOrdinalChanged(); }
private void nameCellEdited(object o, Gtk.EditedArgs args) { Gtk.TreeIter iter; treeview_lines_store.GetIter(out iter, new Gtk.TreePath(args.Path)); userLine line = (userLine)treeview_lines_store.GetValue(iter, 0); line.m_name = args.NewText; }
/// <summary> /// Event Handler for Remove Button Clicked /// </summary> public void OnRemoveButtonClicked(object o, EventArgs args) { TreeModel tModel; Queue iterQueue; iterQueue = new Queue(); TreeSelection tSelect = SelTreeView.Selection; Array treePaths = tSelect.GetSelectedRows(out tModel); // remove compiler warning if (tModel != null) { tModel = null; } // We can't remove anything while getting the iters // because it will change the paths and we'll remove // the wrong stuff. foreach (TreePath tPath in treePaths) { TreeIter iter; if (SelTreeStore.GetIter(out iter, tPath)) { iterQueue.Enqueue(iter); } } // Now that we have all of the TreeIters, loop and // remove them all while (iterQueue.Count > 0) { TreeIter iter = (TreeIter)iterQueue.Dequeue(); MemberInfo member = (MemberInfo)SelTreeStore.GetValue(iter, 0); selectedUsers.Remove(member.UserID); SelTreeStore.Remove(ref iter); } if (SelTreeStore.IterNChildren() == 0) { SetResponseSensitive(ResponseType.Ok, false); } }
public EditModsDialog(Instance inst, Gtk.Window parent = null) : base("Edit Mods", parent, DialogFlags.Modal) { Inst = inst; this.Build(); #region We have to make the treeview ourselves since monodevelop is absolute shit... this.editModScroll = new ScrolledWindow(); this.editModScroll.HscrollbarPolicy = PolicyType.Never; this.modView = new Gtk.TreeView(); this.modView.CanFocus = true; this.modView.Name = "modView"; this.editModScroll.Add(this.modView); this.VBox.Add(this.editModScroll); Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.VBox[this.editModScroll])); w3.Position = 0; this.ShowAll(); #endregion modList = new ListStore(typeof(string), typeof(string), typeof(bool), typeof(DateTime)); modView.Model = modList; modView.AppendColumn("File", new CellRendererText(), "text", 0); modView.AppendColumn("Install Date", new CellRendererText(), "text", 1); CellRendererToggle toggleRenderer = new CellRendererToggle(); toggleRenderer.Activatable = true; toggleRenderer.Sensitive = true; toggleRenderer.Toggled += (object o, ToggledArgs args) => { TreeIter iter; if (modList.GetIter(out iter, new TreePath(args.Path))) modList.SetValue(iter, 2, !(bool)modList.GetValue(iter, 2)); }; modView.AppendColumn("Delete?", toggleRenderer, "active", 2); modView.Columns[0].Alignment = 0.0f; modView.Columns[0].Expand = true; modView.Columns[1].Alignment = 1.0f; modView.Columns[2].Alignment = 1.0f; LoadMods(); }
private void buildColumns() { Model = new ListStore (typeof (TorrentLabel), typeof (Gdk.Pixbuf), typeof (string), typeof (string), typeof (bool)); iconColumn = new TreeViewColumn(); nameColumn = new TreeViewColumn(); sizeColumn = new TreeViewColumn(); Gtk.CellRendererPixbuf iconRendererCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText nameRendererCell = new Gtk.CellRendererText { Editable = true }; Gtk.CellRendererText sizeRendererCell = new Gtk.CellRendererText(); iconColumn.PackStart(iconRendererCell, true); nameColumn.PackStart(nameRendererCell, true); sizeColumn.PackStart(sizeRendererCell, true); iconColumn.AddAttribute (iconRendererCell, "pixbuf", 1); nameColumn.AddAttribute (nameRendererCell, "text", 2); sizeColumn.AddAttribute (sizeRendererCell, "text", 3); nameColumn.AddAttribute (nameRendererCell, "editable", 4); AppendColumn (iconColumn); AppendColumn (nameColumn); AppendColumn (sizeColumn); nameRendererCell.Edited += Event.Wrap ((EditedHandler) delegate (object o, Gtk.EditedArgs args) { Gtk.TreeIter iter; if (Model.GetIter (out iter, new Gtk.TreePath (args.Path))) { TorrentLabel label = (TorrentLabel) Model.GetValue (iter, 0); label.Name = args.NewText; } }); }
private void GenerateNotebookPages() { string platformName = MainClass.Settings.Platform.Name; foreach(Rule rl in MainClass.Settings.Platform.Rules){ bool iOsNoMac = false; if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue; if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue; bool validDevice = true; if(!Device.CheckDevice(rl.Specific) ){ Tool.Logger.Debug("Invalid Device " + rl.Specific); validDevice = false; } ScrolledWindow sw= new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedOut; TreeView tvList = new TreeView(); List<CombinePublish> lcp = project.ProjectUserSetting.CombinePublish.FindAll(x=> x.combineRule.FindIndex(y=>y.ConditionName==platformName && y.RuleId == rl.Id) >-1); List<CombinePublish> lcpDennied = new List<CombinePublish>(); string deviceName = rl.Name; int deviceTyp = rl.Id; ListStore ls = new ListStore(typeof(bool),typeof(string),typeof(CombinePublish),typeof(string),typeof(bool)); string ico="empty.png"; switch (deviceTyp) { case (int)DeviceType.Android_1_6:{ ico = "android.png"; break;} case (int)DeviceType.Android_2_2:{ ico = "android.png"; break;} case (int)DeviceType.Bada_1_0: case (int)DeviceType.Bada_1_1: case (int)DeviceType.Bada_1_2: case (int)DeviceType.Bada_2_0:{ ico = "bada.png"; break;} case (int)DeviceType.Symbian_9_4:{ ico = "symbian.png"; break;} case (int)DeviceType.iOS_5_0:{ ico = "apple.png"; if(!MainClass.Platform.IsMac){ iOsNoMac = true; } break; } case (int)DeviceType.PocketPC_2003SE: case (int)DeviceType.WindowsMobile_5: case (int)DeviceType.WindowsMobile_6:{ ico = "windows.png"; break;} case (int)DeviceType.Windows:{ ico = "win32.png"; break;} case (int)DeviceType.MacOs:{ ico = "macos.png"; break;} } List<CombinePublish> tmp = lcp.FindAll(x=>x.IsSelected == true); NotebookLabel nl = new NotebookLabel(ico,String.Format("{0} ({1})",deviceName,tmp.Count )); nl.Tag=deviceTyp; if(iOsNoMac){ Label lbl=new Label(MainClass.Languages.Translate("ios_available_Mac")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } if(!validDevice){ Label lbl=new Label(MainClass.Languages.Translate("publish_tool_missing")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } ; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Sensitive = true; tvList.AppendColumn ("", crt, "active", 0); Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText(); Gtk.CellRendererText collumnResolRenderer = new Gtk.CellRendererText(); tvList.AppendColumn(MainClass.Languages.Translate("file_name"),fileNameRenderer, "text", 1); tvList.AppendColumn(MainClass.Languages.Translate("resolution_f1"), collumnResolRenderer, "text", 1); tvList.Columns[1].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderCombine)); tvList.Columns[2].SetCellDataFunc(collumnResolRenderer, new Gtk.TreeCellDataFunc(RenderResolution)); // povolene resolution pre danu platformu PlatformResolution listPR = MainClass.Settings.PlatformResolutions.Find(x=>x.IdPlatform ==deviceTyp); Device dvc = project.DevicesSettings.Find(x=>x.TargetPlatformId ==deviceTyp); string stringTheme = ""; List<System.IO.DirectoryInfo> themeResolution = new List<System.IO.DirectoryInfo>(); // resolution z adresara themes po novom if((project.NewSkin) && (dvc != null)){ Skin skin =dvc.Includes.Skin; if((skin != null) && ( !String.IsNullOrEmpty(skin.Name)) && (!String.IsNullOrEmpty(skin.Theme)) ){ string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); stringTheme = System.IO.Path.Combine(skinDir,skin.Name); stringTheme = System.IO.Path.Combine(stringTheme, "themes"); stringTheme = System.IO.Path.Combine(stringTheme, skin.Theme); if (System.IO.Directory.Exists(stringTheme)){ System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringTheme); themeResolution = new List<System.IO.DirectoryInfo>(di.GetDirectories()); } } } crt.Toggled += delegate(object o, ToggledArgs args) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } TreeIter iter; if (ls.GetIter (out iter, new TreePath(args.Path))) { bool old = (bool) ls.GetValue(iter,0); CombinePublish cp =(CombinePublish) ls.GetValue(iter,2); cp.IsSelected = !old; ls.SetValue(iter,0,!old); List<CombinePublish> tmp2 = lcp.FindAll(x=>x.IsSelected == true); nl.SetLabel (String.Format("{0} ({1})",deviceName,tmp2.Count )); //if(dvc == null) return; //if(dvc.Includes == null) return; if(dvc.Includes.Skin == null) return; if(String.IsNullOrEmpty(dvc.Includes.Skin.Name) || String.IsNullOrEmpty(dvc.Includes.Skin.Theme)) return; if(cp.IsSelected){ // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) return; /// nema ziadne rozlisenie v combinacii int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol<0){ // theme chyba prislusne rozlisenie string error =String.Format("Invalid {0} Skin and {1} Theme, using in {2}. Missing resolutions: {3}. ",dvc.Includes.Skin.Name,dvc.Includes.Skin.Theme,deviceName,cc.RuleName.ToLower()); MainClass.MainWindow.OutputConsole.WriteError(error+"\n"); List<string> lst = new List<string>(); lst.Add(error); MainClass.MainWindow.ErrorWritte("","",lst); } } } }; int cntOfAdded = 0; foreach (CombinePublish cp in lcp){ bool isValid = cp.IsSelected; if (!validDevice) isValid = false; // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) continue; /// nema ziadne rozlisenie v combinacii int indx = MainClass.Settings.Resolution.Rules.FindIndex(x=> x.Id == cc.RuleId ); if(indx<0) continue; /// rozlisenie pouzite v danej combinacii nexistuje if(cc!= null){ bool isValidResolution = false; //ak nema definovane ziadne povolenia, tak povolene su vsetky if((listPR==null) || (listPR.AllowResolution == null) || (listPR.AllowResolution.Count<1)){ isValidResolution = true; } else { isValidResolution = listPR.IsValidResolution(cc.RuleId); } if(isValidResolution){ // po novom vyhodom aj tie ktore niesu v adresaru themes - pokial je thema definovana if((project.NewSkin) && (themeResolution.Count > 0)){ //cntResolution = 0; int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol>-1){ ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } else { lcpDennied.Add(cp); } } else { ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } } else { lcpDennied.Add(cp); } } //} } // pridam tie zakazane, ktore su vybrate na publish foreach (CombinePublish cp in lcpDennied){ if(cp.IsSelected){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); cntOfAdded++; } } if(cntOfAdded == 0){ MainClass.MainWindow.OutputConsole.WriteError(String.Format("Missing publish settings for {0}.\n",deviceName)); } bool showAll = false; tvList.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args){ if (args.Event.Button == 3) { TreeSelection ts = tvList.Selection; Gtk.TreePath[] selRow = ts.GetSelectedRows(); if(selRow.Length<1){ TreeIter tiFirst= new TreeIter(); ls.GetIterFirst(out tiFirst); tvList.Selection.SelectIter(tiFirst); selRow = ts.GetSelectedRows(); } if(selRow.Length<1) return; Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); ls.GetIter(out ti,tp); CombinePublish combinePublish= (CombinePublish)ls.GetValue(ti,2); if(combinePublish!=null){ Menu popupMenu = new Menu(); if(!showAll){ MenuItem miShowDenied = new MenuItem( MainClass.Languages.Translate("show_denied" )); miShowDenied.Activated+= delegate(object sender, EventArgs e) { // odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } // pridam zakazane if( (lcpDennied==null) || (lcpDennied.Count<1)) return; foreach (CombinePublish cp in lcpDennied){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); } showAll = true; }; popupMenu.Append(miShowDenied); } else { MenuItem miHideDenied = new MenuItem( MainClass.Languages.Translate("hide_denied" )); miHideDenied.Activated+= delegate(object sender, EventArgs e) { List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && !selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } showAll = false; }; popupMenu.Append(miHideDenied); } popupMenu.Append(new SeparatorMenuItem()); MenuItem miCheckAll = new MenuItem( MainClass.Languages.Translate("check_all" )); miCheckAll.Activated+= delegate(object sender, EventArgs e) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } int cnt = 0; ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = true; ls.SetValue(iterr,0,true); cnt ++; return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,cnt )); }; popupMenu.Append(miCheckAll); MenuItem miUnCheckAll = new MenuItem( MainClass.Languages.Translate("uncheck_all" )); miUnCheckAll.Activated+= delegate(object sender, EventArgs e) { ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = false; ls.SetValue(iterr,0,false); return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,0 )); }; popupMenu.Append(miUnCheckAll); popupMenu.Popup(); popupMenu.ShowAll(); } } }; tvList.Model = ls; if (!validDevice) tvList.Sensitive = false; sw.Add(tvList); notebook.AppendPage(sw, nl); } }
public RenderablesList(string file_name) { m_unit_file = new UnitFile (file_name); m_renderables_names = new List<string> (m_unit_file.renderables_names()); m_renderables = new List<Renderable> (m_unit_file.renderables()); Console.Write (m_renderables_names[0]); m_renderables_store = new ListStore (typeof (string), typeof (string), typeof (string), typeof(string), typeof(bool)); TreeView tree = new TreeView (); this.Add (tree); TreeViewColumn nameColumn = new TreeViewColumn (); nameColumn.Title = "Name"; nameColumn.Alignment = 0.5f; TreeViewColumn nodeColumn = new TreeViewColumn (); nodeColumn.Title = "Node"; nodeColumn.Alignment = 0.5f; TreeViewColumn typeColumn = new TreeViewColumn (); typeColumn.Title = "Type"; typeColumn.Alignment = 0.5f; TreeViewColumn resourceColumn = new TreeViewColumn (); resourceColumn.Title = "Resource"; resourceColumn.Alignment = 0.5f; TreeViewColumn visibleColumn = new TreeViewColumn (); visibleColumn.Title = "Visible"; visibleColumn.Alignment = 0.5f; // Assign the model to the TreeView tree.Model = m_renderables_store; CellRendererText nameCell = new CellRendererText (); nameCell.Editable = true; nameCell.Edited += delegate (object o, EditedArgs e) { TreePath path = new TreePath (e.Path); TreeIter iter; m_renderables_store.GetIter (out iter, path); int i = path.Indices[0]; string r = e.NewText; m_renderables_names[i] = r; m_renderables_store.SetValue (iter, 0, r); }; nameColumn.PackStart (nameCell, true); CellRendererText nodeCell = new CellRendererText (); nodeCell.Editable = true; nodeCell.Edited += delegate (object o, EditedArgs e) { TreePath path = new TreePath (e.Path); TreeIter iter; m_renderables_store.GetIter (out iter, path); int i = path.Indices[0]; Renderable r = m_renderables[i]; r.node = e.NewText; m_renderables_store.SetValue (iter, 1, r.node); }; nodeColumn.PackStart (nodeCell, true); CellRendererText typeCell = new CellRendererText (); typeCell.Editable = true; typeCell.Edited += delegate (object o, EditedArgs e) { TreePath path = new TreePath (e.Path); TreeIter iter; m_renderables_store.GetIter (out iter, path); int i = path.Indices[0]; Renderable r = m_renderables[i]; r.type = e.NewText; m_renderables_store.SetValue (iter, 2, r.type); }; typeColumn.PackStart (typeCell, true); CellRendererText resourceCell = new CellRendererText (); resourceCell.Editable = true; resourceCell.Edited += delegate (object o, EditedArgs e) { TreePath path = new TreePath (e.Path); TreeIter iter; m_renderables_store.GetIter (out iter, path); int i = path.Indices[0]; Renderable r = m_renderables[i]; r.resource = e.NewText; m_renderables_store.SetValue (iter, 3, r.resource); }; resourceColumn.PackStart (resourceCell, true); CellRendererToggle visibleCell = new CellRendererToggle (); visibleCell.Activatable = true; visibleCell.Toggled += delegate (object o, ToggledArgs e) { TreePath path = new TreePath (e.Path); TreeIter iter; m_renderables_store.GetIter (out iter, path); int i = path.Indices[0]; Renderable r = m_renderables[i]; bool old = (bool) m_renderables_store.GetValue(iter, 4); r.visible = !old; m_renderables_store.SetValue(iter, 4, !old); }; visibleColumn.PackStart (visibleCell, true); // Add the columns to the TreeView nameColumn.AddAttribute (nameCell, "text", 0); nodeColumn.AddAttribute (nodeCell, "text", 1); typeColumn.AddAttribute (typeCell, "text", 2); resourceColumn.AddAttribute (resourceCell, "text", 3); visibleColumn.AddAttribute (visibleCell, "active", 4); tree.AppendColumn (nameColumn); tree.AppendColumn (nodeColumn); tree.AppendColumn (typeColumn); tree.AppendColumn (resourceColumn); tree.AppendColumn (visibleColumn); create_model (); // Show the window and everything on it ShowAll (); }
public LibsManagerDialog(string libsInProject, Gtk.Window parentWindow) { this.TransientFor = parentWindow; this.Build(); if (!String.IsNullOrEmpty(libsInProject)) { libsInProject = libsInProject.Replace(",", " "); libsInProject = libsInProject.Replace(";", " "); string[] libs = libsInProject.Split(' '); projectLibs = new List <string>(libs); } else { projectLibs = new List <string>(); } tvLibs.Model = libstListStore; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Toggled += delegate(object o, ToggledArgs args) { TreeIter iter; if (libstListStore.GetIter(out iter, new TreePath(args.Path))) { bool old = (bool)libstListStore.GetValue(iter, 2); string libSelect = (string)libstListStore.GetValue(iter, 0); bool libMissing = (bool)libstListStore.GetValue(iter, 3); string frameworkLibPath = (string)libstListStore.GetValue(iter, 4); string state = (string)libstListStore.GetValue(iter, 1); if (!MainClass.LicencesSystem.CheckFunction(libSelect, this)) { return; } int resultAction = 0; if (old) { projectLibs.Remove(libSelect); } else { if (libMissing) { MessageDialogs md = new MessageDialogs(new string[] { MainClass.Languages.Translate("as_link"), MainClass.Languages.Translate("copy_f2"), MainClass.Languages.Translate("cancel") }, MainClass.Languages.Translate("add_library_to_workspace", libSelect), "", Gtk.MessageType.Question, this); resultAction = md.ShowDialog(); //Console.WriteLine("resultAction->{0}",resultAction); switch (resultAction) { case -1: //"As Link" try{ MainClass.Tools.CreateLinks(frameworkLibPath, MainClass.Workspace.RootDirectory, true, true); state = MainClass.Languages.Translate("linked"); } catch (Exception ex) { MessageDialogs mdEror = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, ex.Message, "", Gtk.MessageType.Error); mdEror.ShowDialog(); return; } break; case -2: //"Copy" string fullLibDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, libSelect); MainClass.Tools.CopyDirectory(frameworkLibPath, fullLibDir, true, true); state = MainClass.Languages.Translate("copied"); break; default: //"Cancel" break; } } projectLibs.Add(libSelect); } //LoadLibs(); libstListStore.SetValue(iter, 2, !old); libstListStore.SetValue(iter, 1, state); //} } }; tvLibs.AppendColumn("", crt, "active", 2); tvLibs.AppendColumn(MainClass.Languages.Translate("lib_name"), new Gtk.CellRendererText(), "text", 0); tvLibs.AppendColumn(MainClass.Languages.Translate("workspace_location"), new Gtk.CellRendererText(), "text", 1); LoadLibs(); }
public FileExplorer() { navigBar = new NavigationBar(NavigationBar.NavigationType.favorites); navigBar.OnChangePath+= NavigateBarChange; Toolbar toolbar = new Toolbar (); //WinMenuBar toolbar = new WinMenuBar (); this.PackStart (toolbar, false, false, 0); refreshButton = new ToolButton ("refresh.png");//Stock.Home); refreshButton.IsImportant = true; refreshButton.Label = MainClass.Languages.Translate("menu_refresh"); refreshButton.BorderWidth = 1; refreshButton.Clicked+= delegate { FillStore (true); }; toolbar.Insert (refreshButton, -1); upButton = new ToolButton ("go-up.png");//Stock.GoUp upButton.Sensitive = false; upButton.Label ="Up"; upButton.BorderWidth = 1; toolbar.Insert (upButton, -1); Gtk.Menu menu = new Gtk.Menu (); MenuItem mi = new MenuItem ("Workspace"); mi.Activated += OnWorkspaceClicked; menu.Insert (mi, -1); mi = new MenuItem ("Project"); mi.Activated += OnProjectClicked; menu.Insert (mi, -1); menu.ShowAll (); mi = new MenuItem ("User home folder"); mi.Activated += OnHomeClicked; menu.Insert (mi, -1); menu.ShowAll (); mi = new MenuItem ("Output folder"); mi.Activated += OnOutputClicked; menu.Insert (mi, -1); menu.ShowAll (); mi = new MenuItem ("Disk root"); mi.Activated += OnOutputClicked; menu.Insert (mi, -1); menu.ShowAll (); if(MainClass.Platform.IsWindows){ SeparatorMenuItem smi = new SeparatorMenuItem(); menu.Insert (smi, -1); string[] drives = Environment.GetLogicalDrives(); foreach(string strDrive in drives) { mi = new MenuItem (strDrive); mi.TooltipText = strDrive; mi.Activated += delegate(object sender, EventArgs e) { string drive = (sender as MenuItem).TooltipText; parent = new DirectoryInfo(drive); FillStore (true); upButton.Sensitive = false; }; menu.Insert (mi, -1); menu.ShowAll (); }; } MenusToolButton gotoButton= new MenusToolButton(menu,"workspace.png"); gotoButton.IsImportant = true; gotoButton.Label = "Go To"; toolbar.Insert (gotoButton, -1); Gtk.Menu menuAdd = new Gtk.Menu (); mi = new MenuItem (MainClass.Languages.Translate("menu_create_file")); mi.Activated += OnCreateFileClicked; menuAdd.Insert (mi, -1); mi = new MenuItem (MainClass.Languages.Translate("menu_create_dir")); mi.Activated += OnCreateDirectoryClicked; menuAdd.Insert (mi, -1); menuAdd.ShowAll (); MenusToolButton mtbCreate= new MenusToolButton(menuAdd,"file-new.png"); mtbCreate.IsImportant = true; mtbCreate.Label = "Create"; toolbar.Insert (mtbCreate, -1); fileIcon = GetIcon ("file.png");//Stock.File); dirIcon = GetIcon ("folder.png");//Stock.Open); upIcon = GetIcon ("go-up.png"); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); this.PackStart (sw, true, true, 0); // Create the store and fill it with the contents of '/' store = CreateStore (); iconView = new IconView (store); iconView.ButtonReleaseEvent+= OnButtonRelease; iconView.SelectionMode = SelectionMode.Single; iconView.Columns = 1; iconView.Orientation = Orientation.Horizontal; upButton.Clicked += new EventHandler (OnUpClicked); iconView.TextColumn = COL_DISPLAY_NAME; iconView.PixbufColumn = COL_PIXBUF; iconView.TooltipColumn = COL_PATH; iconView.RowSpacing = -6; iconView.Spacing = -1; iconView.ColumnSpacing=0; iconView.Margin=-5; iconView.ItemActivated += new ItemActivatedHandler (OnItemActivated); sw.Add (iconView); iconView.SelectionChanged+= delegate(object sender, EventArgs e) { Gtk.TreePath[] selRow = iconView.SelectedItems; if(selRow.Length<1) return; Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); store.GetIter(out ti,tp); if(tp.Equals(TreeIter.Zero))return; string name = store.GetValue(ti, 1).ToString(); if(name == ".."){ selectedItem = null; } else { selectedItem = store.GetValue(ti, 0).ToString(); isDir = (bool)store.GetValue(ti, 3); } }; this.PackEnd (navigBar, false, false, 0); }
public TorrentTreeView() : base() { Torrents = new ListStore (typeof (Download), typeof (string), typeof (string), typeof (int), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string)); FilterModel = new Gtk.TreeModelFilter (Torrents, null); FilterModel.VisibleFunc = delegate (TreeModel model, TreeIter iter) { return Filter == null ? true : Filter ((Download) model.GetValue (iter, 0)); }; Model = FilterModel; this.torrentController = ServiceManager.Get <TorrentController> (); buildColumns(); Reorderable = true; HeadersVisible = true; HeadersClickable = true; Selection.Mode = SelectionMode.Multiple; Selection.Changed += Event.Wrap (delegate (object o, EventArgs e) { TreeIter iter; TreePath [] selectedTorrents = Selection.GetSelectedRows (); List <Download> downloads = new List<Download> (); foreach (TreePath path in Selection.GetSelectedRows ()) { if (Torrents.GetIter (out iter, path)) { downloads.Add ((Download) Torrents.GetValue (iter, 0)); } } torrentController.Select (downloads); }); sourceEntries = new TargetEntry [] { new TargetEntry(RowAtom.Name, TargetFlags.App, 0) }; targetEntries = new TargetEntry [] { new TargetEntry(RowAtom.Name, TargetFlags.Widget, 0), new TargetEntry(FileAtom.Name, TargetFlags.OtherApp, 0) }; EnableModelDragSource(Gdk.ModifierType.Button1Mask, sourceEntries, Gdk.DragAction.Copy); EnableModelDragDest(targetEntries, Gdk.DragAction.Copy); DragDataGet += OnTorrentDragDataGet; menu = new TorrentContextMenu (); torrentController.Added += delegate(object sender, DownloadAddedEventArgs e) { AddDownload (e.Download); }; torrentController.Removed += delegate(object sender, DownloadAddedEventArgs e) { RemoveDownload (e.Download); }; LabelController lc = ServiceManager.Get <LabelController> (); lc.SelectionChanged += delegate { TorrentLabel label = lc.Selection; Filter = delegate (Download download) { return label.Torrents.Contains (download); }; }; // FIXME: This shouldn't be necessary torrentController.Torrents.ForEach (AddDownload); }
public IPhoneBuildOptionsWidget () { this.Build (); extraArgsEntry.AddOptions (menuOptions); linkCombo.AppendText ("Don't link"); //MtouchLinkMode.None linkCombo.AppendText ("Link SDK assemblies only"); //MtouchLinkMode.SdkOnly linkCombo.AppendText ("Link all assemblies"); //MtouchLinkMode.All foreach (var v in IPhoneFramework.InstalledSdkVersions) sdkComboEntry.AppendText (v.ToString ()); sdkComboEntry.Changed += HandleSdkComboEntryChanged; store = new ListStore (typeof (string), typeof (bool)); i18nTreeView.Model = store; var toggle = new CellRendererToggle (); i18nTreeView.AppendColumn ("", toggle, "active", 1); i18nTreeView.AppendColumn ("", new CellRendererText (), "text", 0); i18nTreeView.HeadersVisible = false; toggle.Toggled += delegate (object o, ToggledArgs args) { TreeIter iter; if (store.GetIter (out iter, new TreePath (args.Path))) store.SetValue (iter, 1, !(bool)store.GetValue (iter, 1)); }; this.ShowAll (); }
public EditModsDialog(Instance inst, Gtk.Window parent = null) : base("Edit Mods", parent, DialogFlags.Modal) { Inst = inst; using (Button buttonRefresh = new Button("gtk-refresh")) { buttonRefresh.Clicked += (sender, e) => { LoadMods(); }; ActionArea.Homogeneous = false; ActionArea.PackEnd(buttonRefresh, false, true, 0); buttonRefresh.Visible = true; } this.Build(); #region We have to make the treeview ourselves since monodevelop is absolute shit... this.editModScroll = new ScrolledWindow(); this.editModScroll.HscrollbarPolicy = PolicyType.Never; this.modView = new Gtk.TreeView(); this.modView.CanFocus = true; this.modView.Name = "modView"; this.editModScroll.Add(this.modView); this.VBox.Add(this.editModScroll); Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.VBox[this.editModScroll])); w3.Position = 0; this.ShowAll(); #endregion modList = new ListStore(typeof(string), typeof(int), typeof(bool)); modView.Model = modList; using (CellRendererText cr = new CellRendererText()) modView.AppendColumn("Index", cr, "text", 1); using (CellRendererText cr = new CellRendererText()) modView.AppendColumn("File", cr, "text", 0); CellRendererToggle toggleRenderer = new CellRendererToggle(); toggleRenderer.Activatable = true; toggleRenderer.Sensitive = true; toggleRenderer.Toggled += (object o, ToggledArgs args) => { TreeIter iter; using (TreePath tp = new TreePath(args.Path)) if (modList.GetIter(out iter, tp)) modList.SetValue(iter, 2, !(bool) modList.GetValue(iter, 2)); }; modView.AppendColumn("Delete?", toggleRenderer, "active", 2); modView.Columns[0].Alignment = 0.0f; modView.Columns[1].Alignment = 0.0f; modView.Columns[1].Expand = true; modView.Columns[2].Alignment = 1.0f; modView.Reorderable = true; LoadMods(); // Auto-refresh Inst.InstMods.ModFileChanged += (sender, e) => Application.Invoke((sender2, e2) => LoadMods()); }
private void RemoveItems(ref Contacts cnts, ref ListStore lstore, TreePath[] tPath) { for(int p=(tPath.Length-1); p>=0; p--) { // remove contact from list cnts.SimContacts.RemoveAt(tPath[p].Indices[0]); } for(int p=(tPath.Length-1); p>=0; p--) { // remove contact from list TreeIter ti; bool isIter = lstore.GetIter(out ti, tPath[p]); if (isIter) { lstore.Remove(ref ti); } } }
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; }
/// <summary> /// Loads the plugins treeview. /// </summary> private void LoadPluginsTreeview() { ListStore store = new ListStore(typeof(PluginTreeviewContainer)); foreach (IBase plug in Plugins.LoadAllPlugins()) { bool loaded = true; IBase loaded_plug = this.ui.Plugins.FirstOrDefault(p => p.GetType().Assembly.GetName().Name == plug.GetType().Assembly.GetName().Name); if (loaded_plug == null) loaded_plug = this.ui.Trays.FirstOrDefault(p => p.GetType().Assembly.GetName().Name == plug.GetType().Assembly.GetName().Name); if (loaded_plug == null) { loaded_plug = plug; loaded = false; } store.AppendValues(new PluginTreeviewContainer() { Enabled = loaded, Name = plug.Name, Description = plug.Description, DllName = plug.GetType().Assembly.GetName().Name, Plugin = loaded_plug }); } TreeViewColumn column = new TreeViewColumn(); column.Title = Catalog.GetString("Enabled"); CellRendererToggle toggle_cell = new CellRendererToggle(); toggle_cell.Toggled += (s, e) => { TreeIter iter; store.GetIter(out iter, new TreePath(e.Path)); PluginTreeviewContainer item = (PluginTreeviewContainer)store.GetValue(iter, 0); item.Enabled = !((CellRendererToggle)s).Active; Type t = item.Plugin.GetType(); string[] plugins = Core.Settings.Instance[Core.Settings.Keys.Plugins.List].AsString().Split('|'); string name = t.Assembly.GetName().Name; ((CellRendererToggle)s).Active = !((CellRendererToggle)s).Active; if (((CellRendererToggle)s).Active) { try { if (t.GetInterface(typeof(IPlugin).Name) != null) { IPlugin plugin = (IPlugin)item.Plugin; plugin.Load(); this.ui.Plugins.Add(plugin); this.ui.Plugins = this.ui.Plugins.OrderBy(p => p.Name).ToList(); this.ui.RebuildMenu(); this.ReloadPluginPreferencesPages(); } else if (t.GetInterface(typeof(ITray).Name) != null) { ITray plugin = (ITray)item.Plugin; plugin.Load(this.ui.Menu, this.ui.RebuildMenu); this.ui.Trays.Add((ITray)item.Plugin); } if (!plugins.Contains(name)) Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = plugins[0] != string.Empty ? string.Join("|", plugins) + "|" + name : name; } catch (Exception ex) { Tools.PrintInfo(ex, this.GetType()); if (plugins.Contains(name)) Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = string.Join("|", plugins.Where(p => p != name).ToArray()); } } else { try { if (t.GetInterface(typeof(IPlugin).Name) != null) { IPlugin plugin = (IPlugin)item.Plugin; this.ui.Plugins.Remove(plugin); plugin.Dispose(); this.ui.RebuildMenu(); this.ReloadPluginPreferencesPages(); } else if (t.GetInterface(typeof(ITray).Name) != null) { ITray plugin = (ITray)item.Plugin; this.ui.Trays.Remove(plugin); plugin.Unload(); } } catch (Exception ex) { Tools.PrintInfo(ex, this.GetType()); } finally { if (plugins.Contains(name)) Core.Settings.Instance[Core.Settings.Keys.Plugins.List] = string.Join("|", plugins.Where(p => p != name).ToArray()); } } store.EmitRowChanged(new TreePath(e.Path), iter); }; column.PackStart(toggle_cell, true); column.SetCellDataFunc(toggle_cell, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { ((CellRendererToggle)cell).Active = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Enabled; }); this.treeviewPlugins.AppendColumn(column); column = new TreeViewColumn(); column.Title = Catalog.GetString("Name"); CellRendererText text_cell = new CellRendererText(); column.PackStart(text_cell, true); column.SetCellDataFunc(text_cell, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { ((CellRendererText)cell).Text = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Name; }); this.treeviewPlugins.AppendColumn(column); column = new TreeViewColumn(); column.Title = Catalog.GetString("Description"); text_cell = new CellRendererText(); column.PackStart(text_cell, true); column.SetCellDataFunc(text_cell, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { ((CellRendererText)cell).Text = ((PluginTreeviewContainer)model.GetValue(iter, 0)).Description; }); this.treeviewPlugins.AppendColumn(column); this.treeviewPlugins.Model = store; this.treeviewPlugins.ShowAll(); }
/// <summary> /// Event Handler for OnConflictSelectionChanged event /// </summary> protected void OnConflictSelectionChanged(object o, EventArgs args) { bool bHasNameConflict = false; bool bHasFileConflict = false; TreeSelection tSelect = ConflictTreeView.Selection; int selectedRows = tSelect.CountSelectedRows(); if (selectedRows > 0) { EnableConflictControls(true); TreeModel tModel; ConflictHolder ch = null; Array treePaths = tSelect.GetSelectedRows(out tModel); foreach (TreePath tPath in treePaths) { TreeIter iter; if (ConflictTreeStore.GetIter(out iter, tPath)) { ch = (ConflictHolder)tModel.GetValue(iter, 0); if (ch.IsNameConflict) { bHasNameConflict = true; } else { bHasFileConflict = true; } } } if (selectedRows == 1) { if (bHasNameConflict) { nameConflictSummary.Text = Util.GS("Enter a new name and click Rename to resolve the conflict."); // This is a name conflict nameConflictBox.Visible = true; fileConflictBox.Visible = false; // Prefill the entry with the filename and auto-select // the text on the left-hand side of the extension. nameConflictEntry.Text = ch.Name; oldFileName = nameConflictEntry.Text; this.FocusChild = nameConflictEntry; /* FIXME: Get GrabFocus() and preselection of filename working * nameConflictEntry.GrabFocus(); * * if (ch.Name.Length > 0) * { * int lastDotPos = ch.Name.LastIndexOf('.'); * if (lastDotPos > 1) * nameConflictEntry.SelectRegion(0, lastDotPos); * else * nameConflictEntry.SelectRegion(0, ch.Name.Length); * } */ } else { // This is a file conflict fileConflictBox.Visible = true; nameConflictBox.Visible = false; } UpdateFields(ch, false); } else { // We're dealing with multiple selections here if (bHasFileConflict) { // Allow name conflicts to be multi-selected with file conflicts fileConflictBox.Visible = true; nameConflictBox.Visible = false; UpdateFields(ch, true); } else { // There are multiple name conflicts selected nameConflictBox.Visible = true; fileConflictBox.Visible = false; nameConflictSummary.Text = Util.GS("Name conflicts must be resolved individually."); nameConflictEntry.Text = ""; EnableConflictControls(false); } } } }
public POEditorWidget (TranslationProject project) { this.project = project; this.Build (); //FIXME: avoid unnecessary creation of old treeview scrolledwindow1.Remove (treeviewEntries); treeviewEntries.Destroy (); treeviewEntries = new MonoDevelop.Components.ContextMenuTreeView (); treeviewEntries.ShowAll (); scrolledwindow1.Add (treeviewEntries); ((MonoDevelop.Components.ContextMenuTreeView)treeviewEntries).DoPopupMenu = ShowPopup; this.headersEditor = new CatalogHeadersWidget (); this.notebookPages.AppendPage (headersEditor, new Gtk.Label ()); updateTaskThread = new BackgroundWorker (); updateTaskThread.WorkerSupportsCancellation = true; updateTaskThread.DoWork += TaskUpdateWorker; AddButton (GettextCatalog.GetString ("Translation")).Active = true; AddButton (GettextCatalog.GetString ("Headers")).Active = false; // entries tree view store = new ListStore (typeof(CatalogEntry)); this.treeviewEntries.Model = store; TreeViewColumn fuzzyColumn = new TreeViewColumn (); fuzzyColumn.SortIndicator = true; fuzzyColumn.SortColumnId = 0; fuzzyColumn.Title = GettextCatalog.GetString ("Fuzzy"); var iconRenderer = new CellRendererImage (); fuzzyColumn.PackStart (iconRenderer, false); fuzzyColumn.SetCellDataFunc (iconRenderer, CatalogIconDataFunc); CellRendererToggle cellRendFuzzy = new CellRendererToggle (); cellRendFuzzy.Activatable = true; cellRendFuzzy.Toggled += HandleCellRendFuzzyToggled; fuzzyColumn.PackStart (cellRendFuzzy, false); fuzzyColumn.SetCellDataFunc (cellRendFuzzy, FuzzyToggleDataFunc); treeviewEntries.AppendColumn (fuzzyColumn); TreeViewColumn originalColumn = new TreeViewColumn (); originalColumn.Expand = true; originalColumn.SortIndicator = true; originalColumn.SortColumnId = 1; originalColumn.Title = GettextCatalog.GetString ("Original string"); CellRendererText original = new CellRendererText (); original.Ellipsize = Pango.EllipsizeMode.End; originalColumn.PackStart (original, true); originalColumn.SetCellDataFunc (original, OriginalTextDataFunc); treeviewEntries.AppendColumn (originalColumn); TreeViewColumn translatedColumn = new TreeViewColumn (); translatedColumn.Expand = true; translatedColumn.SortIndicator = true; translatedColumn.SortColumnId = 2; translatedColumn.Title = GettextCatalog.GetString ("Translated string"); CellRendererText translation = new CellRendererText (); translation.Ellipsize = Pango.EllipsizeMode.End; translatedColumn.PackStart (translation, true); translatedColumn.SetCellDataFunc (translation, TranslationTextDataFunc); treeviewEntries.AppendColumn (translatedColumn); treeviewEntries.Selection.Changed += OnEntrySelected; // found in tree view foundInStore = new ListStore (typeof(string), typeof(string), typeof(string), typeof(Xwt.Drawing.Image)); this.treeviewFoundIn.Model = foundInStore; TreeViewColumn fileColumn = new TreeViewColumn (); var pixbufRenderer = new CellRendererImage (); fileColumn.PackStart (pixbufRenderer, false); fileColumn.SetAttributes (pixbufRenderer, "image", FoundInColumns.Pixbuf); CellRendererText textRenderer = new CellRendererText (); fileColumn.PackStart (textRenderer, true); fileColumn.SetAttributes (textRenderer, "text", FoundInColumns.File); treeviewFoundIn.AppendColumn (fileColumn); treeviewFoundIn.AppendColumn ("", new CellRendererText (), "text", FoundInColumns.Line); treeviewFoundIn.HeadersVisible = false; treeviewFoundIn.GetColumn (1).FixedWidth = 100; treeviewFoundIn.RowActivated += delegate(object sender, RowActivatedArgs e) { Gtk.TreeIter iter; foundInStore.GetIter (out iter, e.Path); string line = foundInStore.GetValue (iter, (int)FoundInColumns.Line) as string; string file = foundInStore.GetValue (iter, (int)FoundInColumns.FullFileName) as string; int lineNr = 1; try { lineNr = 1 + int.Parse (line); } catch { } IdeApp.Workbench.OpenDocument (file, lineNr, 1); }; this.notebookTranslated.RemovePage (0); this.searchEntryFilter.Entry.Text = ""; searchEntryFilter.Entry.Changed += delegate { UpdateFromCatalog (); }; this.togglebuttonFuzzy.Active = PropertyService.Get ("Gettext.ShowFuzzy", true); this.togglebuttonFuzzy.TooltipText = GettextCatalog.GetString ("Show fuzzy translations"); this.togglebuttonFuzzy.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowFuzzy", this.togglebuttonFuzzy.Active); UpdateFromCatalog (); }; this.togglebuttonMissing.Active = PropertyService.Get ("Gettext.ShowMissing", true); this.togglebuttonMissing.TooltipText = GettextCatalog.GetString ("Show missing translations"); this.togglebuttonMissing.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowMissing", this.togglebuttonMissing.Active); UpdateFromCatalog (); }; this.togglebuttonOk.Active = PropertyService.Get ("Gettext.ShowTranslated", true); this.togglebuttonOk.TooltipText = GettextCatalog.GetString ("Show valid translations"); this.togglebuttonOk.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowTranslated", this.togglebuttonOk.Active); UpdateFromCatalog (); }; this.textviewComments.Buffer.Changed += delegate { if (this.isUpdating) return; if (this.currentEntry != null) { string[] lines = textviewComments.Buffer.Text.Split (CatalogParser.LineSplitStrings, System.StringSplitOptions.None); for (int i = 0; i < lines.Length; i++) { if (!lines[i].StartsWith ("#")) lines[i] = "# " + lines[i]; } this.currentEntry.Comment = string.Join (System.Environment.NewLine, lines); } UpdateProgressBar (); }; searchEntryFilter.Ready = true; searchEntryFilter.Visible = true; searchEntryFilter.ForceFilterButtonVisible = true; searchEntryFilter.RequestMenu += delegate { searchEntryFilter.Menu = CreateOptionsMenu (); }; widgets.Add (this); checkbuttonWhiteSpaces.Toggled += CheckbuttonWhiteSpacesToggled; options.ShowLineNumberMargin = false; options.ShowFoldMargin = false; options.ShowIconMargin = false; options.ColorScheme = IdeApp.Preferences.ColorScheme; options.FontName = PropertyService.Get<string> ("FontName"); this.scrolledwindowOriginal.Child = this.texteditorOriginal; this.scrolledwindowPlural.Child = this.texteditorPlural; this.texteditorOriginal.Show (); this.texteditorPlural.Show (); texteditorOriginal.ModifyBase (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Insensitive)); texteditorPlural.ModifyBase (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Insensitive)); this.texteditorOriginal.Options = options; this.texteditorPlural.Options = options; this.texteditorOriginal.Document.ReadOnly = true; this.texteditorPlural.Document.ReadOnly = true; }
public POEditorWidget (TranslationProject project) { this.project = project; this.Build (); this.headersEditor = new CatalogHeadersWidget (); this.notebookPages.AppendPage (headersEditor, new Gtk.Label ()); updateThread = new BackgroundWorker (); updateThread.WorkerSupportsCancellation = true; updateThread.DoWork += FilterWorker; updateTaskThread = new BackgroundWorker (); updateTaskThread.WorkerSupportsCancellation = true; updateTaskThread.DoWork += TaskUpdateWorker; AddButton (GettextCatalog.GetString ("Translation")).Active = true; AddButton (GettextCatalog.GetString ("Headers")).Active = false; // entries tree view store = new ListStore (typeof(string), typeof(bool), typeof(string), typeof(string), typeof(CatalogEntry), typeof(Gdk.Color), typeof(int), typeof(Gdk.Color)); this.treeviewEntries.Model = store; treeviewEntries.AppendColumn (String.Empty, new CellRendererIcon (), "stock_id", Columns.Stock, "cell-background-gdk", Columns.RowColor); CellRendererToggle cellRendFuzzy = new CellRendererToggle (); cellRendFuzzy.Toggled += new ToggledHandler (FuzzyToggled); cellRendFuzzy.Activatable = true; treeviewEntries.AppendColumn (GettextCatalog.GetString ("Fuzzy"), cellRendFuzzy, "active", Columns.Fuzzy, "cell-background-gdk", Columns.RowColor); CellRendererText original = new CellRendererText (); original.Ellipsize = Pango.EllipsizeMode.End; treeviewEntries.AppendColumn (GettextCatalog.GetString ("Original string"), original, "text", Columns.String, "cell-background-gdk", Columns.RowColor, "foreground-gdk", Columns.ForeColor); CellRendererText translation = new CellRendererText (); translation.Ellipsize = Pango.EllipsizeMode.End; treeviewEntries.AppendColumn (GettextCatalog.GetString ("Translated string"), translation, "text", Columns.Translation, "cell-background-gdk", Columns.RowColor, "foreground-gdk", Columns.ForeColor); treeviewEntries.Selection.Changed += new EventHandler (OnEntrySelected); treeviewEntries.GetColumn (0).SortIndicator = true; treeviewEntries.GetColumn (0).SortColumnId = (int)Columns.TypeSortIndicator; treeviewEntries.GetColumn (1).SortIndicator = true; treeviewEntries.GetColumn (1).SortColumnId = (int)Columns.Fuzzy; treeviewEntries.GetColumn (2).SortIndicator = true; treeviewEntries.GetColumn (2).SortColumnId = (int)Columns.String; treeviewEntries.GetColumn (2).Resizable = true; treeviewEntries.GetColumn (2).Expand = true; treeviewEntries.GetColumn (3).SortIndicator = true; treeviewEntries.GetColumn (3).SortColumnId = (int)Columns.Translation; treeviewEntries.GetColumn (3).Resizable = true; treeviewEntries.GetColumn (3).Expand = true; // found in tree view foundInStore = new ListStore (typeof(string), typeof(string), typeof(string), typeof(Pixbuf)); this.treeviewFoundIn.Model = foundInStore; TreeViewColumn fileColumn = new TreeViewColumn (); var pixbufRenderer = new CellRendererPixbuf (); fileColumn.PackStart (pixbufRenderer, false); fileColumn.SetAttributes (pixbufRenderer, "pixbuf", FoundInColumns.Pixbuf); CellRendererText textRenderer = new CellRendererText (); fileColumn.PackStart (textRenderer, true); fileColumn.SetAttributes (textRenderer, "text", FoundInColumns.File); treeviewFoundIn.AppendColumn (fileColumn); treeviewFoundIn.AppendColumn ("", new CellRendererText (), "text", FoundInColumns.Line); treeviewFoundIn.HeadersVisible = false; treeviewFoundIn.GetColumn (1).FixedWidth = 100; treeviewFoundIn.RowActivated += delegate(object sender, RowActivatedArgs e) { Gtk.TreeIter iter; foundInStore.GetIter (out iter, e.Path); string line = foundInStore.GetValue (iter, (int)FoundInColumns.Line) as string; string file = foundInStore.GetValue (iter, (int)FoundInColumns.FullFileName) as string; int lineNr = 1; try { lineNr = 1 + int.Parse (line); } catch { } IdeApp.Workbench.OpenDocument (file, lineNr, 1, true); }; this.notebookTranslated.RemovePage (0); this.searchEntryFilter.Entry.Text = ""; searchEntryFilter.Entry.Changed += delegate { UpdateFromCatalog (); }; this.togglebuttonFuzzy.Active = PropertyService.Get ("Gettext.ShowFuzzy", true); this.togglebuttonFuzzy.TooltipText = GettextCatalog.GetString ("Show fuzzy translations"); this.togglebuttonFuzzy.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowFuzzy", this.togglebuttonFuzzy.Active); UpdateFromCatalog (); }; this.togglebuttonMissing.Active = PropertyService.Get ("Gettext.ShowMissing", true); this.togglebuttonMissing.TooltipText = GettextCatalog.GetString ("Show missing translations"); this.togglebuttonMissing.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowMissing", this.togglebuttonMissing.Active); UpdateFromCatalog (); }; this.togglebuttonOk.Active = PropertyService.Get ("Gettext.ShowTranslated", true); this.togglebuttonOk.TooltipText = GettextCatalog.GetString ("Show valid translations"); this.togglebuttonOk.Toggled += delegate { MonoDevelop.Core.PropertyService.Set ("Gettext.ShowTranslated", this.togglebuttonOk.Active); UpdateFromCatalog (); }; this.textviewComments.Buffer.Changed += delegate { if (this.isUpdating) return; if (this.currentEntry != null) { string[] lines = StringEscaping.FromGettextFormat (textviewComments.Buffer.Text).Split (new string[] { System.Environment.NewLine }, System.StringSplitOptions.None); for (int i = 0; i < lines.Length; i++) { if (!lines[i].StartsWith ("#")) lines[i] = "# " + lines[i]; } this.currentEntry.Comment = string.Join (System.Environment.NewLine, lines); } UpdateProgressBar (); }; this.treeviewEntries.PopupMenu += delegate { ShowPopup (); }; this.treeviewEntries.ButtonReleaseEvent += delegate(object sender, Gtk.ButtonReleaseEventArgs e) { if (e.Event.Button == 3) ShowPopup (); }; searchEntryFilter.Ready = true; searchEntryFilter.Visible = true; searchEntryFilter.ForceFilterButtonVisible = true; searchEntryFilter.RequestMenu += delegate { searchEntryFilter.Menu = CreateOptionsMenu (); }; // this.buttonOptions.Label = GettextCatalog.GetString ("Options"); // this.buttonOptions.StockImage = Gtk.Stock.Properties; // this.buttonOptions.MenuCreator = ; widgets.Add (this); UpdateTasks (); // this.vpaned2.AcceptPosition += delegate { // PropertyService.Set ("Gettext.SplitPosition", vpaned2.Position / (double)Allocation.Height); // inMove = false; // }; // this.vpaned2.CancelPosition += delegate { // inMove = false; // }; // this.vpaned2.MoveHandle += delegate { // inMove = true; // }; // this.ResizeChecked += delegate { // if (inMove) // return; // int newPosition = (int)(Allocation.Height * PropertyService.Get ("Gettext.SplitPosition", 0.3d)); // if (vpaned2.Position != newPosition) // vpaned2.Position = newPosition; // }; checkbuttonWhiteSpaces.Toggled += CheckbuttonWhiteSpacesToggled; options.ShowLineNumberMargin = false; options.ShowFoldMargin = false; options.ShowIconMargin = false; options.ShowInvalidLines = false; options.ShowSpaces = options.ShowTabs = options.ShowEolMarkers = false; options.ColorScheme = PropertyService.Get ("ColorScheme", "Default"); options.FontName = PropertyService.Get<string> ("FontName"); this.scrolledwindowOriginal.Child = this.texteditorOriginal; this.scrolledwindowPlural.Child = this.texteditorPlural; this.texteditorOriginal.Show (); this.texteditorPlural.Show (); texteditorOriginal.ModifyBase (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Insensitive)); texteditorPlural.ModifyBase (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Insensitive)); this.texteditorOriginal.Options = options; this.texteditorPlural.Options = options; this.texteditorOriginal.Document.ReadOnly = true; this.texteditorPlural.Document.ReadOnly = true; }