Changeset 98:475406230aef for source/class
- Timestamp:
- Jan 8, 2009, 4:02:05 PM (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/class/pf/Application.js
r97 r98 164 164 this.showSpeciesButton.setEnabled(explorer_is_seen); 165 165 this.redrawButton.setEnabled(this.canvas.isSeeable()); 166 167 if (this.prefs.autoLoadWiki) { 168 this.loadWikiButton.setEnabled(false); 169 } else { 170 var tree = this.entity_tree; 171 var leaf = tree.getSelectedElement(); 172 if (leaf && leaf.classname == "qx.legacy.ui.tree.TreeFile" && explorer_is_seen) { 173 this.loadWikiButton.setEnabled(true); 174 } else { 175 this.loadWikiButton.setEnabled(false); 176 } 177 } 166 178 } 167 179 … … 715 727 this.gui_entity_value.setNumValue(v*scale); 716 728 717 var url; 718 if (entity.wikiLink) { 719 url = "http://en.wikipedia.org/w/index.php?title=" + 720 entity.wikiLink + "&printable=yes"; 729 if (this.prefs.autoLoadWiki) { 730 this.showWikiPage(entity); 721 731 } else { 722 url = null; 723 } 724 this.gui_wiki.setSource(url); 732 this.gui_wiki.setSource(null); 733 } 725 734 }, 726 735 … … 1697 1706 }, 1698 1707 1708 showWikiPage : function(entity) 1709 { 1710 var url; 1711 if (entity && entity.wikiLink) { 1712 url = "http://en.wikipedia.org/w/index.php?title=" + 1713 entity.wikiLink + "&printable=yes"; 1714 } else { 1715 url = null; 1716 } 1717 1718 this.gui_wiki.setSource(url); 1719 }, 1720 1721 loadWikiCB : function(ev) 1722 { 1723 var tree = this.entity_tree; 1724 var leaf = tree.getSelectedElement(); 1725 1726 if (!leaf) { 1727 return; 1728 } 1729 1730 var entity = leaf.getUserData("entity"); 1731 1732 this.showWikiPage(entity); 1733 }, 1734 1699 1735 drawCB : function(ev) 1700 1736 { … … 2022 2058 2023 2059 submenu.add(new qx.legacy.ui.menu.Separator); 2060 q = new qx.event.Command("Ctrl+W"); 2061 q.addListener("execute", this.loadWikiCB, this); 2062 btn = new qx.legacy.ui.menu.Button("Load Wikipedia Article", 2063 "pf/image/wikipedia.png", q); 2064 submenu.add(btn); 2065 this.loadWikiButton = btn; 2066 this.doc.add(submenu, subMenu1, subMenu2); 2067 2068 submenu.add(new qx.legacy.ui.menu.Separator); 2024 2069 q = new qx.event.Command("Ctrl+L"); 2025 2070 q.addListener("execute", this.drawCB, this); … … 2029 2074 this.redrawButton = btn; 2030 2075 2031 this.doc.add(submenu, subMenu1, subMenu2);2032 2033 2076 btn = new qx.legacy.ui.menubar.Button("View", submenu); 2034 2077 btn.set({ paddingLeft : 7, paddingRight : 7 }); … … 2114 2157 } 2115 2158 2116 if ( !this.prefs.rememberWindowSize) {2159 if (null === this.prefs.rememberWindowSize) { 2117 2160 this.prefs.rememberWindowSize = false; 2161 } 2162 2163 if (null === this.prefs.autoLoadWiki) { 2164 this.prefs.autoLoadWiki = true; 2118 2165 } 2119 2166 … … 2246 2293 }); 2247 2294 2295 rc = new qx.legacy.ui.layout.VerticalBoxLayout; 2296 rc.setWidth("100%"); 2297 rc.setHeight("auto"); 2298 rc.setSpacing(10); 2299 fr2.add(rc); 2300 2301 e = new qx.legacy.ui.form.CheckBox("Load Wikipedia articles automatically"); 2302 e.setChecked(this.prefs.autoLoadWiki); 2303 e.addListener("changeChecked", function(ev) { 2304 this.prefs.autoLoadWiki = ev.getTarget().getChecked(); 2305 }, this); 2306 rc.add(e); 2307 2248 2308 e = new qx.legacy.ui.form.CheckBox("Remember window dimensions on exit"); 2249 2309 e.setChecked(this.prefs.rememberWindowSize); … … 2251 2311 this.prefs.rememberWindowSize = ev.getTarget().getChecked(); 2252 2312 }, this); 2253 fr2.add(e);2313 rc.add(e); 2254 2314 2255 2315 this.doc.add(w);
Note: See TracChangeset
for help on using the changeset viewer.