Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/5.0.x'

Conflicts:
	headless/src/main/org/nlogo/hubnet/server/HubNetUtils.scala
	project/autogen/events.txt
	src/main/org/nlogo/app/App.scala
	src/main/org/nlogo/app/CodeTab.scala
	src/main/org/nlogo/app/InfoTab.scala
	src/main/org/nlogo/app/WidgetPanel.java
	test/benchdumps/Fire.txt
	test/benchdumps/FireBig.txt
	test/benchdumps/Life.txt
  • Loading branch information...
commit 5faea6318b692795fd11a254d882b9630a370864 2 parents e23a218 + 18bf5ae
@SethTisue SethTisue authored
View
6 docs/dictionary.html
@@ -7092,14 +7092,14 @@
self
<br>
<img alt="Turtle Command" src="images/turtle.gif"> <img alt=
- "Patch Command" src="images/patch.gif">
+ "Patch Command" src="images/patch.gif"> <img alt="Link Command" src="images/link.gif">
</h4>
<p>
- Reports this turtle or patch.
+ Reports this turtle, patch, or link.
<p>
&quot;self&quot; and &quot;myself&quot; are very different.
&quot;self&quot; is simple; it means &quot;me&quot;.
- &quot;myself&quot; means &quot;the turtle or patch who asked me to
+ &quot;myself&quot; means &quot;the agent who asked me to
do what I'm doing right now.&quot;
<p>
See also <a href="#myself">myself</a>.
View
2  headless/src/main/org/nlogo/headless/ChecksumsAndPreviews.scala
@@ -80,6 +80,8 @@ object ChecksumsAndPreviews {
def okPath(path: String) = (for {
(message, slices) <- Seq(
None -> List("HUBNET", "/CURRICULAR MODELS/"),
+ Some("it renders slightly differently on Mac vs. Linux") -> List(
+ "/CODE EXAMPLES/LINK BREEDS EXAMPLE.NLOGO"), // see 407ddcdd49f88395915b1a87c663b13000758d35 in `models` repo
Some("it uses the sound extension") -> List(
"/GAMES/FROGGER.NLOGO",
"/ART/SOUND MACHINES.NLOGO",
View
2  headless/src/main/org/nlogo/hubnet/server/HubNetUtils.scala
@@ -17,7 +17,7 @@ object HubNetUtils {
val SERVER_DISCOVERY_ANNOUNCE_INTERVAL = 1000
// these are terrible - JC 8/21/10
- var viewMirroring = false
+ var viewMirroring = true
// this doesnt appear to be used - JC 8/21/10
def checkPacketSize(obj: Object, message: String) {
View
2  project/events.txt
@@ -52,4 +52,4 @@ window.WidgetAdded - widget: Widget
window.WidgetEdited - widget: Widget
window.WidgetForegrounded - widget: Widget
window.WidgetRemoved - widget: Widget
-window.Zoomed - zoomFactor: Double
+window.Zoomed - action: Int
View
45 src/main/org/nlogo/app/App.scala
@@ -276,6 +276,7 @@ class App extends
Events.MagicOpenEventHandler with
Events.ReloadEventHandler with
Events.SwitchedTabsEventHandler with
+ ZoomedEventHandler with
Controllable {
import App.{pico, logger, commandLineMagic, commandLineModel, commandLineURL, commandLineModelIsLaunch, loggingName}
@@ -435,7 +436,7 @@ class App extends
add(fileMenu)
add(new EditMenu(App.this))
add(pico.getComponent(classOf[ToolsMenu]))
- add(new ZoomMenu(App.this))
+ add(new ZoomMenu)
add(tabs.tabsMenu)
}
// a little ugly we have to typecast here, but oh well - ST 10/11/05
@@ -492,7 +493,7 @@ class App extends
def createFileMenu: JMenu = pico.getComponent(classOf[FileMenu])
def createEditMenu: JMenu = new EditMenu(App.this)
def createToolsMenu: JMenu = new ToolsMenu(App.this)
- def createZoomMenu: JMenu = new ZoomMenu(App.this)
+ def createZoomMenu: JMenu = new ZoomMenu
override def addHelpMenu(menuBar:JMenuBar) = {
val newMenu = new HelpMenu (App.this, new EditorColorizer(workspace))
menuBar.add(newMenu)
@@ -577,21 +578,15 @@ class App extends
else fileMenu.newModel()
}
- /// zooming stuff
- private var zoomSteps = 0
- def zoomLarger(){ zoomSteps+=1; finishZoom() }
- def resetZoom() { zoomSteps=0; finishZoom() }
- def zoomSmaller() {
- zoomSteps-=1
- zoomSteps = StrictMath.max(-5, zoomSteps)
- finishZoom()
- }
- private def finishZoom() {
- new ZoomedEvent(1.0 + zoomSteps * 0.1).raise(this)
+ /// zooming
+
+ def handle(e: ZoomedEvent) {
smartPack(frame.getPreferredSize)
}
- /// more event handlers
+ def resetZoom() {
+ new ZoomedEvent(0).raise(this)
+ }
def handle(e: Events.ReloadEvent) {
val modelType = workspace.getModelType
@@ -984,21 +979,25 @@ class App extends
tabs.interfaceTab.adjustTargetSize(targetSize)
- // reduce our size ambitions if necessary
- var newWidth = StrictMath.min(targetSize.width, maxWidth )
- var newHeight = StrictMath.min(targetSize.height, maxHeight)
+ import StrictMath.{ max, min }
+
+ val (currentWidth, currentHeight) = (frame.getWidth, frame.getHeight)
+
+ // Maybe grow the window, but never shrink it
+ var newWidth = max(min(targetSize.width, maxWidth), currentWidth)
+ var newHeight = max(min(targetSize.height, maxHeight), currentHeight)
// move up/left to get more room if possible and necessary
- val moveLeft = StrictMath.max(0, frame.getLocation().x + newWidth - maxX)
- val moveUp = StrictMath.max(0, frame.getLocation().y + newHeight - maxY)
+ val moveLeft = max(0, frame.getLocation().x + newWidth - maxX)
+ val moveUp = max(0, frame.getLocation().y + newHeight - maxY)
// now we can compute our new position
- val newX = StrictMath.max(maxBoundsX, frame.getLocation().x - moveLeft)
- val newY = StrictMath.max(maxBoundsY, frame.getLocation().y - moveUp )
+ val newX = max(maxBoundsX, frame.getLocation().x - moveLeft)
+ val newY = max(maxBoundsY, frame.getLocation().y - moveUp)
// and now that we know our position, we can compute our new size
- newWidth = StrictMath.min(newWidth, maxX - newX)
- newHeight = StrictMath.min(newHeight, maxY - newY)
+ newWidth = min(newWidth, maxX - newX)
+ newHeight = min(newHeight, maxY - newY)
// now do it!
frame.setBounds(newX, newY, newWidth, newHeight)
View
17 src/main/org/nlogo/app/CodeTab.scala
@@ -17,7 +17,7 @@ class CodeTab(val workspace: AbstractWorkspace) extends JPanel
with ProceduresMenuTarget
with Events.SwitchedTabsEventHandler
with org.nlogo.window.Events.CompiledEventHandler
- with org.nlogo.window.Events.ZoomedEventHandler
+ with org.nlogo.window.Zoomable
with org.nlogo.swing.Printable {
private val listener = new TextListener() {
@@ -28,6 +28,7 @@ class CodeTab(val workspace: AbstractWorkspace) extends JPanel
}
val text = new EditorFactory(workspace).newEditor(100, 100, true, listener, true)
text.setBorder(BorderFactory.createEmptyBorder(4, 7, 4, 7))
+ override def zoomTarget = text
val errorLabel = new EditorAreaErrorLabel(text)
val toolBar = getToolBar
@@ -104,14 +105,12 @@ class CodeTab(val workspace: AbstractWorkspace) extends JPanel
}
private var originalFontSize = -1
- private var zoomFactor = 1.0
- def handle(e: org.nlogo.window.Events.ZoomedEvent) {
- if(zoomFactor != e.zoomFactor) {
- zoomFactor = e.zoomFactor
- if(originalFontSize == -1) originalFontSize = text.getFont.getSize
- text.setFont(text.getFont.deriveFont(StrictMath.ceil(originalFontSize * zoomFactor).toFloat))
- errorLabel.zoom(zoomFactor)
- }
+ override def handle(e: org.nlogo.window.Events.ZoomedEvent) {
+ super.handle(e)
+ if(originalFontSize == -1)
+ originalFontSize = text.getFont.getSize
+ text.setFont(text.getFont.deriveFont(StrictMath.ceil(originalFontSize * zoomFactor).toFloat))
+ errorLabel.zoom(zoomFactor)
}
// Error code
View
10 src/main/org/nlogo/app/CommandCenter.scala
@@ -11,6 +11,7 @@ import org.nlogo.api.{ AgentKind, I18N }
class CommandCenter(workspace: org.nlogo.workspace.AbstractWorkspaceScala,
locationToggleAction: Action) extends JPanel
+ with org.nlogo.window.Zoomable
with org.nlogo.window.CommandCenterInterface
with org.nlogo.window.Events.LoadBeginEventHandler
with org.nlogo.window.Events.ZoomedEventHandler {
@@ -143,13 +144,4 @@ class CommandCenter(workspace: org.nlogo.workspace.AbstractWorkspaceScala,
repaintPrompt()
commandLine.requestFocus()
}
- /// zooming
- private lazy val zoomer: Zoomer = new Zoomer(this)
- private var zoomFactor = 1.0
- def zoomSubcomponents = true
- def handle(e: org.nlogo.window.Events.ZoomedEvent) {
- zoomer.scaleComponentFont(this, e.zoomFactor, zoomFactor, true)
- zoomFactor = e.zoomFactor
- revalidate()
- }
}
View
21 src/main/org/nlogo/app/InfoTab.scala
@@ -21,7 +21,8 @@ import java.io.File
class InfoTab(attachModelDir: String => String) extends JPanel with
DocumentListener with Printable with HyperlinkListener with
org.nlogo.window.Events.LoadSectionEventHandler with
- org.nlogo.window.Events.ZoomedEventHandler {
+ org.nlogo.window.Events.ZoomedEventHandler with
+ org.nlogo.window.Zoomable {
val baseDocUrl = "docs/infotab.html"
@@ -73,6 +74,8 @@ class InfoTab(attachModelDir: String => String) extends JPanel with
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)
+ override def zoomTarget = scrollPane
+
locally {
resetBorders()
setLayout(new BorderLayout())
@@ -145,15 +148,13 @@ class InfoTab(attachModelDir: String => String) extends JPanel with
private var editorPaneFontSize = InfoFormatter.defaultFontSize
private var originalFontSize = -1
- private var zoomFactor = 1.0
- def handle(e: org.nlogo.window.Events.ZoomedEvent) {
- if(zoomFactor != e.zoomFactor) {
- zoomFactor = e.zoomFactor
- if(originalFontSize == -1) { originalFontSize = textArea.getFont.getSize }
- textArea.setFont(textArea.getFont.deriveFont(StrictMath.ceil(originalFontSize * zoomFactor).toFloat))
- editorPaneFontSize = StrictMath.ceil(InfoFormatter.defaultFontSize * zoomFactor).toInt
- updateEditorPane()
- }
+ override def handle(e: org.nlogo.window.Events.ZoomedEvent) {
+ super.handle(e)
+ if(originalFontSize == -1)
+ originalFontSize = textArea.getFont.getSize
+ textArea.setFont(textArea.getFont.deriveFont(StrictMath.ceil(originalFontSize * zoomFactor).toFloat))
+ editorPaneFontSize = StrictMath.ceil(InfoFormatter.defaultFontSize * zoomFactor).toInt
+ updateEditorPane()
}
// the textArea will give us an outlandlishly large preferred size unless we restrain it
View
12 src/main/org/nlogo/app/InterfacePanel.java
@@ -273,16 +273,16 @@ public String convert(String source, boolean reporter) {
parent.setSize(viewWidget.asWidget().getSize());
enforceMinimumAndMaximumWidgetSizes(viewWidget.asWidget());
parent.setLocation(x, y);
- zoomer.zoomWidgetLocation
+ zoomer().zoomWidgetLocation
(getWrapper(viewWidget.asWidget()),
- true, true, 1.0, zoomer.zoomFactor());
- zoomer.zoomWidgetSize
+ true, true, 1.0, zoomer().zoomFactor());
+ zoomer().zoomWidgetSize
(getWrapper(viewWidget.asWidget()),
- true, true, 1.0, zoomer.zoomFactor());
- zoomer.scaleComponentFont
+ true, true, 1.0, zoomer().zoomFactor());
+ zoomer().scaleComponentFont
(((org.nlogo.window.ViewWidget) viewWidget)
.view,
- zoomer.zoomFactor(), 1.0, false);
+ zoomFactor(), 1.0, false);
}
return viewWidget.asWidget();
} else {
View
19 src/main/org/nlogo/app/WidgetPanel.java
@@ -26,8 +26,7 @@
java.awt.event.FocusListener,
org.nlogo.window.Events.WidgetEditedEventHandler,
org.nlogo.window.Events.WidgetRemovedEventHandler,
- org.nlogo.window.Events.LoadBeginEventHandler,
- org.nlogo.window.Events.ZoomedEventHandler {
+ org.nlogo.window.Events.LoadBeginEventHandler {
static final int GRID_SNAP = 5; // set the size of the grid, in pixels
protected java.awt.Rectangle selectionRect;
@@ -35,7 +34,6 @@
protected WidgetWrapper newWidget;
protected List<WidgetWrapper> widgetsBeingDragged;
protected final GUIWorkspace workspace;
- final Zoomer zoomer = new Zoomer(this);
protected final javax.swing.JComponent glassPane =
new javax.swing.JComponent() {
@Override
@@ -540,7 +538,7 @@ protected WidgetWrapper addWidget(Widget widget, int x, int y,
wrapper.validate();
wrapper.setVisible(true);
- zoomer.zoomWidget(wrapper, true, loadingWidget, 1.0, zoomer.zoomFactor());
+ zoomer().zoomWidget(wrapper, true, loadingWidget, 1.0, zoomFactor());
if (select) {
newWidget = wrapper;
@@ -623,8 +621,9 @@ public void sliderEventOnReleaseOnly(boolean sliderEventOnReleaseOnly) {
}
public void handle(org.nlogo.window.Events.ZoomedEvent e) {
+ super.handle(e);
unselectWidgets();
- zoomer.zoomWidgets(e.zoomFactor());
+ zoomer().zoomWidgets(zoomFactor());
revalidate();
}
@@ -655,7 +654,7 @@ public String convert(String source, boolean reporter) {
public void handle(org.nlogo.window.Events.WidgetEditedEvent e) {
new org.nlogo.window.Events.DirtyEvent().raise(this);
- zoomer.updateZoomInfo(e.widget());
+ zoomer().updateZoomInfo(e.widget());
}
public void handle(org.nlogo.window.Events.WidgetRemovedEvent e) {
@@ -678,7 +677,7 @@ public void handle(org.nlogo.window.Events.WidgetRemovedEvent e) {
public void handle(org.nlogo.window.Events.LoadBeginEvent e) {
unselectWidgets();
removeAllWidgets();
- zoomer.forgetAllZoomInfo();
+ zoomer().forgetAllZoomInfo();
}
@Override
@@ -822,11 +821,11 @@ public String getBoundsString(Widget widget) {
}
public java.awt.Rectangle getUnzoomedBounds(java.awt.Component component) {
- return zoomer.getUnzoomedBounds(component);
+ return zoomer().getUnzoomedBounds(component);
}
public void resetZoomInfo(Widget widget) {
- zoomer.updateZoomInfo(widget);
+ zoomer().updateZoomInfo(widget);
}
public void resetSizeInfo(Widget widget) {
@@ -834,7 +833,7 @@ public void resetSizeInfo(Widget widget) {
}
public boolean isZoomed() {
- return zoomer.zoomFactor() != 1.0;
+ return zoomer().zoomFactor() != 1.0;
}
public boolean canAddWidget(String widget) {
View
10 src/main/org/nlogo/app/WidgetWrapper.java
@@ -262,7 +262,7 @@ void foreground() {
if (getParent() instanceof WidgetPanel && !widget.isNote()) {
WidgetPanel iP = (WidgetPanel) getParent();
- dim = iP.zoomer.zoomSize(dim);
+ dim = iP.zoomer().zoomSize(dim);
}
if (selected()) {
dim.width += BORDER_E + BORDER_W;
@@ -596,7 +596,7 @@ public void mouseReleased(java.awt.event.MouseEvent e) {
void doDrop() {
selected(true, true); // 2nd true = change was temporary
new org.nlogo.window.Events.DirtyEvent().raise(this);
- ((WidgetPanel) getParent()).zoomer.updateZoomInfo(widget);
+ ((WidgetPanel) getParent()).zoomer().updateZoomInfo(widget);
}
private void enforceMinimumSize(java.awt.Rectangle r) {
@@ -604,7 +604,7 @@ private void enforceMinimumSize(java.awt.Rectangle r) {
java.awt.Dimension minWidgetSize = widget().getMinimumSize();
if (getParent() instanceof WidgetPanel) {
WidgetPanel iP = (WidgetPanel) getParent();
- minWidgetSize = iP.zoomer.zoomSize(minWidgetSize);
+ minWidgetSize = iP.zoomer().zoomSize(minWidgetSize);
}
if (minWidgetSize == null) {
minWidgetSize = new java.awt.Dimension(MIN_WIDGET_WIDTH, MIN_WIDGET_HEIGHT);
@@ -695,7 +695,7 @@ private void enforceMaximumSize(java.awt.Rectangle r) {
}
if (getParent() instanceof WidgetPanel) {
WidgetPanel iP = (WidgetPanel) getParent();
- maxWidgetSize = iP.zoomer.zoomSize(maxWidgetSize);
+ maxWidgetSize = iP.zoomer().zoomSize(maxWidgetSize);
}
switch (mouseMode()) {
@@ -833,7 +833,7 @@ public void handle(org.nlogo.window.Events.WidgetForegroundedEvent e) {
// return what our location would be if we *weren't* selected... this
// is needed for the zooming code in InterfacePanel
- java.awt.Point getUnselectedLocation() {
+ public java.awt.Point getUnselectedLocation() {
java.awt.Point result = getLocation();
if (selected()) {
result.x += BORDER_E;
View
13 src/main/org/nlogo/app/ZoomMenu.scala
@@ -5,20 +5,25 @@ package org.nlogo.app
import org.nlogo.api.I18N
// note that multiple instances of this class may exist as there are now multiple frames that each
// have their own menu bar and menus ev 8/25/05
-private class ZoomMenu(app:App) extends org.nlogo.swing.Menu(I18N.gui.get("menu.zoom")) {
+private class ZoomMenu extends org.nlogo.swing.Menu(I18N.gui.get("menu.zoom")) {
implicit val i18nName = I18N.Prefix("menu.zoom")
addMenuItem('=',new javax.swing.AbstractAction(I18N.gui("larger")) {
def actionPerformed(e:java.awt.event.ActionEvent) {
- app.zoomLarger()
+ zoom(1)
}})
addMenuItem('0',new javax.swing.AbstractAction(I18N.gui("normalSize")) {
def actionPerformed(e:java.awt.event.ActionEvent) {
- app.resetZoom()
+ zoom(0)
}})
addMenuItem('-',new javax.swing.AbstractAction(I18N.gui("smaller")) {
def actionPerformed(e:java.awt.event.ActionEvent) {
- app.zoomSmaller()
+ zoom(-1)
}})
+
+ def zoom(action: Int) {
+ new org.nlogo.window.Events.ZoomedEvent(action).raise(this)
+ }
+
}
View
4 src/main/org/nlogo/window/AbstractWidgetPanel.scala
@@ -2,7 +2,9 @@
package org.nlogo.window
-abstract class AbstractWidgetPanel extends javax.swing.JLayeredPane {
+abstract class AbstractWidgetPanel
+extends javax.swing.JLayeredPane
+with Zoomable {
def removeAllWidgets()
def getWidgetsForSaving: java.util.List[Widget]
def loadWidgets(widgets: Seq[String], version: String)
View
6 src/main/org/nlogo/window/WidgetWrapperInterface.java
@@ -9,6 +9,12 @@
java.awt.Dimension getMaximumSize();
+ java.awt.Point getUnselectedLocation();
+
+ void setLocation(java.awt.Point p);
+
+ void validate();
+
void setSize(int width, int height);
void setSize(java.awt.Dimension size);
View
30 src/main/org/nlogo/window/Zoomable.scala
@@ -0,0 +1,30 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.window
+
+trait Zoomable extends javax.swing.JComponent
+with Events.ZoomedEventHandler {
+ val zoomer = new Zoomer(this)
+ private var _zoomSteps = 0
+ def zoomSteps = _zoomSteps
+ def zoomMin: Int = -9
+ def zoomFactor = 1.0 + 0.1 * zoomSteps
+ def zoomSubcomponents = true
+ def zoomTarget: java.awt.Component = this
+ def handle(e: org.nlogo.window.Events.ZoomedEvent) {
+ if (isShowing) { // ignore unless we're the front tab
+ val oldFactor = zoomFactor
+ _zoomSteps = e.action match {
+ case -1 =>
+ zoomSteps - 1
+ case 1 =>
+ zoomSteps + 1
+ case 0 =>
+ 0
+ }
+ _zoomSteps = _zoomSteps max zoomMin
+ zoomer.scaleComponentFont(zoomTarget, zoomFactor, oldFactor, true)
+ revalidate()
+ }
+ }
+}
View
54 src/main/org/nlogo/app/Zoomer.java → src/main/org/nlogo/window/Zoomer.java
@@ -1,24 +1,22 @@
// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
-package org.nlogo.app;
+package org.nlogo.window;
// There's a lot of carelessness here about Component vs.
// Widget that should be cleaned up at some point
// - ST 8/9/03, 10/14/03
-import org.nlogo.window.Widget;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-strictfp class Zoomer {
+public strictfp class Zoomer {
private final java.awt.Container container;
private double zoomFactor = 1.0;
- double zoomFactor() {
+ public double zoomFactor() {
return zoomFactor;
}
@@ -41,22 +39,22 @@ public Zoomer(java.awt.Container container) {
///
- void zoomWidgets(double newZoom) {
+ public void zoomWidgets(double newZoom) {
container.setVisible(false);
double oldZoom = zoomFactor;
zoomFactor = newZoom;
java.awt.Component[] comps = container.getComponents();
for (int i = 0; i < comps.length; i++) {
- if (comps[i] instanceof WidgetWrapper) {
- WidgetWrapper wrapper = (WidgetWrapper) comps[i];
+ if (comps[i] instanceof WidgetWrapperInterface) {
+ WidgetWrapperInterface wrapper = (WidgetWrapperInterface) comps[i];
zoomWidget(wrapper, false, false, oldZoom, zoomFactor);
}
}
container.setVisible(true);
}
- void zoomWidget(WidgetWrapper wrapper, boolean newWidget, boolean loadingWidget,
- double oldZoom, double newZoom) {
+ public void zoomWidget(WidgetWrapperInterface wrapper, boolean newWidget, boolean loadingWidget,
+ double oldZoom, double newZoom) {
if (oldZoom == newZoom) {
return;
}
@@ -65,7 +63,7 @@ void zoomWidget(WidgetWrapper wrapper, boolean newWidget, boolean loadingWidget,
zoomWidgetFont(wrapper, wrapper.widget(), newWidget, loadingWidget, oldZoom, newZoom);
}
- void zoomWidgetSize(WidgetWrapper wrapper, boolean newWidget, boolean loadingWidget,
+ public void zoomWidgetSize(WidgetWrapperInterface wrapper, boolean newWidget, boolean loadingWidget,
double oldZoom, double newZoom) {
java.awt.Component component = wrapper.widget();
java.awt.Dimension originalSize = sizes.get(component);
@@ -83,18 +81,18 @@ void zoomWidgetSize(WidgetWrapper wrapper, boolean newWidget, boolean loadingWid
}
}
- java.awt.Dimension zoomSize(java.awt.Dimension originalSize, double oldZoom, double newZoom) {
+ public java.awt.Dimension zoomSize(java.awt.Dimension originalSize, double oldZoom, double newZoom) {
return new java.awt.Dimension
((int) StrictMath.ceil(originalSize.width * newZoom / oldZoom),
(int) StrictMath.ceil(originalSize.height * newZoom / oldZoom));
}
- java.awt.Dimension zoomSize(java.awt.Dimension originalSize) {
+ public java.awt.Dimension zoomSize(java.awt.Dimension originalSize) {
return zoomSize(originalSize, 1.0, zoomFactor);
}
- void zoomWidgetLocation(WidgetWrapper wrapper, boolean newWidget, boolean loadingWidget,
- double oldZoom, double newZoom) {
+ public void zoomWidgetLocation(WidgetWrapperInterface wrapper, boolean newWidget, boolean loadingWidget,
+ double oldZoom, double newZoom) {
java.awt.Component component = wrapper.widget();
java.awt.Point originalLocation = locations.get(component);
Double originalZoom = locationZooms.get(component);
@@ -124,7 +122,7 @@ void zoomWidgetLocation(WidgetWrapper wrapper, boolean newWidget, boolean loadin
* it may seems redundant to take both wrapper and widget as arguments,
* but when we are used by CommandCenter, there is no wrapper - ST 7/13/04
*/
- public void zoomWidgetFont(WidgetWrapper wrapper, Widget widget,
+ public void zoomWidgetFont(WidgetWrapperInterface wrapper, Widget widget,
boolean newWidget, boolean loadingWidget,
double oldZoom, double newZoom) {
boolean recursive = widget.zoomSubcomponents();
@@ -143,7 +141,7 @@ private void storeComponentFont(java.awt.Component component, boolean recursive,
// want to remember what the font size at the 100% zoom level is, because
// font sizes are so small that rounding error will mess us up unless we
// always scale from the normal, unzoomed size
- if (!(component instanceof org.nlogo.window.ViewWidgetInterface) ||
+ if (!(component instanceof ViewWidgetInterface) ||
!newWidget ||
loadingWidget) {
fonts.put(component, component.getFont());
@@ -158,8 +156,8 @@ private void storeComponentFont(java.awt.Component component, boolean recursive,
}
}
- void scaleComponentFont(java.awt.Component component, double newZoom, double oldZoom,
- boolean recursive) {
+ public void scaleComponentFont(java.awt.Component component, double newZoom, double oldZoom,
+ boolean recursive) {
if (fonts.get(component) == null) {
storeComponentFont(component, recursive, false, false, oldZoom);
}
@@ -179,7 +177,7 @@ void scaleComponentFont(java.awt.Component component, double newZoom, double old
}
}
- void forgetAllZoomInfo() {
+ public void forgetAllZoomInfo() {
sizes.clear();
sizeZooms.clear();
locations.clear();
@@ -189,17 +187,17 @@ void forgetAllZoomInfo() {
for (Iterator<java.awt.Component> comps = fonts.keySet().iterator();
comps.hasNext();) {
java.awt.Component comp = comps.next();
- if (!(comp instanceof org.nlogo.window.View)) {
+ if (!(comp instanceof View)) {
comps.remove();
fontZooms.remove(comp);
}
}
}
- void updateZoomInfo(java.awt.Component component) {
+ public void updateZoomInfo(java.awt.Component component) {
java.awt.Container parent = component.getParent();
- if (parent instanceof WidgetWrapper) {
- WidgetWrapper wrapper = (WidgetWrapper) parent;
+ if (parent instanceof WidgetWrapperInterface) {
+ WidgetWrapperInterface wrapper = (WidgetWrapperInterface) parent;
java.awt.Dimension storedSize = sizes.get(component);
if (storedSize != null &&
@@ -223,18 +221,18 @@ void updateZoomInfo(java.awt.Component component) {
// except for View, always go from original font
// size, since at the moment the user can't the change
// individual font sizes of other widget types
- if (component instanceof org.nlogo.window.ViewWidget) {
+ if (component instanceof ViewWidget) {
fonts.remove
- (((org.nlogo.window.ViewWidget) component).view);
+ (((ViewWidget) component).view);
fontZooms.remove
- (((org.nlogo.window.ViewWidget) component).view);
+ (((ViewWidget) component).view);
}
}
}
/// called indirectly from the save() methods of the individual Widget classes
- java.awt.Rectangle getUnzoomedBounds(java.awt.Component comp) {
+ public java.awt.Rectangle getUnzoomedBounds(java.awt.Component comp) {
java.awt.Rectangle r = comp.getBounds();
java.awt.Component parent = comp.getParent();
if (parent != null) {
Please sign in to comment.
Something went wrong with that request. Please try again.