mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 09:42:08 +10:00
added icons, fixed donate option
This commit is contained in:
+6
-2
@@ -7,6 +7,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -27,6 +28,7 @@ import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.images.IconLoader;
|
||||
import org.diylc.plugins.canvas.CanvasPlugin;
|
||||
import org.diylc.plugins.clipboard.ClipboardManager;
|
||||
import org.diylc.plugins.file.FileManager;
|
||||
@@ -58,6 +60,8 @@ public class MainFrame extends JFrame implements IView {
|
||||
setPreferredSize(new Dimension(800, 600));
|
||||
createBasePanels();
|
||||
menuMap = new HashMap<String, JMenu>();
|
||||
setIconImages(Arrays.asList(IconLoader.IconSmall.getImage(), IconLoader.IconMedium
|
||||
.getImage(), IconLoader.IconLarge.getImage()));
|
||||
DialogFactory.getInstance().initialize(this);
|
||||
|
||||
this.presenter = new Presenter(this);
|
||||
@@ -248,8 +252,8 @@ public class MainFrame extends JFrame implements IView {
|
||||
fileName = "Untitled";
|
||||
}
|
||||
String modified = (Boolean) params[1] ? " (modified)" : "";
|
||||
setTitle(String.format("DIYLC %s alpha - %s %s", plugInPort.getCurrentVersionNumber(),
|
||||
fileName, modified));
|
||||
setTitle(String.format("DIYLC %s alpha - %s %s", plugInPort
|
||||
.getCurrentVersionNumber(), fileName, modified));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-2
@@ -1,5 +1,10 @@
|
||||
package org.diylc.images;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
@@ -23,8 +28,9 @@ public enum IconLoader {
|
||||
"id_card.png"), IdCardAdd("id_card_add.png"), Chest("chest.png"), Upload("upload.png"), Wrench(
|
||||
"wrench.png"), Group("group.png"), Ungroup("ungroup.png"), TraceMask("trace_mask.png"), Faq(
|
||||
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
|
||||
"donate.png"), Bug("bug.png"), AboutDialog("about_dialog.png"), DocumentEdit(
|
||||
"document_edit.png"), EditComponent("edit_component.png");
|
||||
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
|
||||
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
|
||||
"edit_component.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
@@ -41,4 +47,14 @@ public enum IconLoader {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
BufferedImage img = null;
|
||||
try {
|
||||
img = ImageIO.read(getClass().getResourceAsStream(name));
|
||||
} catch (IOException e) {
|
||||
System.err.println("Couldn't find file: " + name);
|
||||
}
|
||||
return img;
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 898 B |
+2
-2
@@ -50,7 +50,7 @@ public class HelpManager implements IPlugIn {
|
||||
BUG_URL), HELP_TITLE);
|
||||
plugInPort.injectMenuAction(null, HELP_TITLE);
|
||||
plugInPort.injectMenuAction(new NavigateURLAction("Donate", IconLoader.Donate.getIcon(),
|
||||
BUG_URL), HELP_TITLE);
|
||||
DONATE_URL), HELP_TITLE);
|
||||
plugInPort.injectMenuAction(new AboutAction(), HELP_TITLE);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class HelpManager implements IPlugIn {
|
||||
private AboutDialog getAboutDialog() {
|
||||
if (aboutDialog == null) {
|
||||
aboutDialog = DialogFactory.getInstance().createAboutDialog("DIY Layout Creator 4",
|
||||
IconLoader.AboutDialog.getIcon(),
|
||||
IconLoader.IconLarge.getIcon(),
|
||||
plugInPort.getCurrentVersionNumber().toString(), "Branislav Stojkovic",
|
||||
"diylc.org", "bancika@gmail.com", "");
|
||||
}
|
||||
|
||||
+7
@@ -365,6 +365,13 @@ public class Presenter implements IPlugInPort {
|
||||
break;
|
||||
case POINT_BY_POINT:
|
||||
if (controlPointSlot != null) {
|
||||
snapPointToGrid(scaledPoint);
|
||||
if (scaledPoint.equals(controlPointSlot)) {
|
||||
String message = "Cannot create the component because both controls points match. Choose the second control point.";
|
||||
LOG.warn(message);
|
||||
view.showMessage(message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
instantiateComponent(componentSlot, controlPointSlot, scaledPoint);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user