/** insert a field into the internal list */ private void add(BibtexSingleField field) { // field == null check string key = field.name; fieldSet.Add(key, field); }
private BibtexFields() { fieldSet = new Dictionary<string, BibtexSingleField>(); BibtexSingleField dummy = null ; // FIRST: all standard fields // These are the fields that BibTex might want to treat, so these // must conform to BibTex rules. add( new BibtexSingleField( "address", true, GUIGlobals.SMALL_W ) ) ; // An annotation. It is not used by the standard bibliography styles, // but may be used by others that produce an annotated bibliography. // http://www.ecst.csuchico.edu/~jacobsd/bib/formats/bibtex.html add( new BibtexSingleField( "annote", true, GUIGlobals.LARGE_W ) ) ; add( new BibtexSingleField( "author", true, GUIGlobals.MEDIUM_W, 280 ) ) ; add( new BibtexSingleField( "booktitle", true, 175 ) ) ; add( new BibtexSingleField( "chapter", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "crossref", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "edition", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "editor", true, GUIGlobals.MEDIUM_W, 280 ) ) ; add( new BibtexSingleField( "howpublished", true, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "institution", true, GUIGlobals.MEDIUM_W ) ) ; dummy = new BibtexSingleField( "journal", true, GUIGlobals.SMALL_W ) ; dummy.setExtras("journalNames"); add(dummy) ; add( new BibtexSingleField( "key", true ) ) ; add( new BibtexSingleField( "month", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "note", true, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "number", true, GUIGlobals.SMALL_W, 60 ).setNumeric(true) ) ; add( new BibtexSingleField( "organization", true, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "pages", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "publisher", true, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "school", true, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "series", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "title", true, 400 ) ) ; add( new BibtexSingleField( "type", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "language", true, GUIGlobals.SMALL_W ) ) ; add( new BibtexSingleField( "volume", true, GUIGlobals.SMALL_W, 60 ).setNumeric(true) ) ; add( new BibtexSingleField( "year", true, GUIGlobals.SMALL_W, 60 ).setNumeric(true) ) ; // some semi-standard fields dummy = new BibtexSingleField( KEY_FIELD, true ) ; dummy.setPrivate(); add( dummy ) ; dummy = new BibtexSingleField( "doi", true, GUIGlobals.SMALL_W ) ; dummy.setExtras("external"); add(dummy) ; add( new BibtexSingleField( "eid", true, GUIGlobals.SMALL_W ) ) ; dummy = new BibtexSingleField( "date", true ) ; dummy.setPrivate(); add( dummy ) ; add(new BibtexSingleField("pmid", false, GUIGlobals.SMALL_W, 60).setNumeric(true)); // additional fields ------------------------------------------------------ add( new BibtexSingleField( "location", false ) ) ; add( new BibtexSingleField( "abstract", false, GUIGlobals.LARGE_W, 400 ) ) ; dummy = new BibtexSingleField( "url", false, GUIGlobals.SMALL_W) ; dummy.setExtras("external"); add(dummy) ; dummy = new BibtexSingleField( "pdf", false, GUIGlobals.SMALL_W ) ; dummy.setExtras("browseDoc"); add(dummy) ; dummy = new BibtexSingleField( "ps", false, GUIGlobals.SMALL_W ) ; dummy.setExtras("browseDocZip"); add(dummy) ; add( new BibtexSingleField( "comment", false, GUIGlobals.MEDIUM_W ) ) ; add( new BibtexSingleField( "keywords", false, GUIGlobals.SMALL_W ) ) ; //FIELD_EXTRAS.put("keywords", "selector"); dummy = new BibtexSingleField(GUIGlobals.FILE_FIELD, false); dummy.setEditorType(GUIGlobals.FILE_LIST_EDITOR); add(dummy); add( new BibtexSingleField( "search", false, 75 ) ) ; // some internal fields ---------------------------------------------- dummy = new BibtexSingleField( GUIGlobals.NUMBER_COL, false, 32 ) ; dummy.setPrivate() ; dummy.setWriteable(false); dummy.setDisplayable(false); add( dummy ) ; dummy = new BibtexSingleField( OWNER, false, GUIGlobals.SMALL_W ) ; dummy.setExtras("setOwner"); dummy.setPrivate(); add(dummy) ; dummy = new BibtexSingleField( TIMESTAMP, false, GUIGlobals.SMALL_W ) ; dummy.setExtras("datepicker"); dummy.setPrivate(); add(dummy) ; dummy = new BibtexSingleField( ENTRYTYPE, false, 75 ) ; dummy.setPrivate(); add(dummy) ; dummy = new BibtexSingleField( SEARCH, false) ; dummy.setPrivate(); dummy.setWriteable(false); dummy.setDisplayable(false); add(dummy) ; dummy = new BibtexSingleField( GROUPSEARCH, false) ; dummy.setPrivate(); dummy.setWriteable(false); dummy.setDisplayable(false); add(dummy) ; dummy = new BibtexSingleField( MARKED, false) ; dummy.setPrivate(); dummy.setWriteable(true); // This field must be written to file! dummy.setDisplayable(false); add(dummy) ; // collect all public fields for the PUBLIC_FIELDS array List<string> pFields = new List<string>(fieldSet.Count) ; foreach (var sField in fieldSet.Values){ if (sField.isPublic() ) { pFields.Add( sField.getFieldName() ); // or export the complet BibtexSingleField ? // BibtexSingleField.ToString() { return fieldname ; } } } PUBLIC_FIELDS = pFields.ToArray(); // sort the entries Array.Sort( PUBLIC_FIELDS ); }
/** * Read the "numericFields" string array from preferences, and activate numeric * sorting for all fields listed in the array. If an unknown field name is included, * add a field descriptor for the new field. */ public static void setNumericFieldsFromPrefs() { string[] numFields = Globals.prefs.getStringArray("numericFields"); if (numFields == null) return; // Build a Set of field names for the fields that should be sorted numerically: var nF = new Dictionary<string, bool>(); for (int i = 0; i < numFields.Length; i++) { nF.Add(numFields[i], true); } // Look through all registered fields, and activate numeric sorting if necessary: foreach (var fieldName in runtime.fieldSet.Keys) { BibtexSingleField field = runtime.fieldSet[fieldName]; if (!field.isNumeric() && nF.ContainsKey(fieldName)) { field.setNumeric(nF.ContainsKey(fieldName)); } nF.Remove(fieldName); // remove, so we clear the set of all standard fields. } // If there are fields left in nF, these must be non-standard fields. Add descriptors for them: foreach (var fieldName in nF.Keys) { BibtexSingleField field = new BibtexSingleField(fieldName, false); field.setNumeric(true); runtime.fieldSet.Add(fieldName, field); } }