folder preview panel hack + small fixes

This commit is contained in:
Honfika
2014-03-06 22:06:22 +01:00
parent e0265744e4
commit edc9ed88b6
3 changed files with 15 additions and 7 deletions
@@ -168,7 +168,7 @@ public class Configuration {
public static final ConfigurationItem<String> locale = null;
@ConfigurationDefaultString("_loc%d_")
public static final ConfigurationItem<String> registerNameFormat = null;
@ConfigurationDefaultInt(8)
@ConfigurationDefaultInt(10)
public static final ConfigurationItem<Integer> maxRecentFileCount = null;
public static final ConfigurationItem<String> recentFiles = null;
public static final ConfigurationItem<String> fontPairing = null;
@@ -338,7 +338,7 @@ public class Configuration {
recentFilesArray.remove(idx);
}
recentFilesArray.add(path);
while (recentFilesArray.size() >= maxRecentFileCount.get()) {
while (recentFilesArray.size() > maxRecentFileCount.get()) {
recentFilesArray.remove(0);
}
recentFiles.set(Helper.joinStrings(recentFilesArray, "::"));
@@ -80,9 +80,17 @@ public class PreviewImage extends JPanel {
@Override
public void run() {
// todo:
// call repaint on MainPanel.folderPreviewPanel
// this is a hack, but otherwise the preview panel looks crazy sometimes
// how to handle it in a better way?
// normally repaint() on this panel should be enough
Component parent = getParent();
if (parent != null) {
parent.repaint();
parent = parent.getParent();
if (parent != null) {
parent.repaint();
}
}
}
});
+4 -4
View File
@@ -796,18 +796,18 @@ public class Helper {
Rectangle rectangle = new Rectangle();
int y1, y2;
for (int x = 0; x < image.getWidth(); x++) {
y1 = 99;
y1 = Integer.MAX_VALUE;
y2 = -1;
for (int y = 0; y < image.getHeight(); y++) {
int rgb = image.getRGB(x, y);
rgb = rgb >>> 24;
if (rgb > 0) {
if (y1 == 99) {
if (y1 == Integer.MAX_VALUE) {
y1 = y;
y2 = y;
}
if (y > (y2 + 1)) {
rectangle.setBounds(x, y1, 1, y2 - y1);
rectangle.setBounds(x, y1, 1, y2 - y1 + 1);
area.add(new Area(rectangle));
y1 = y;
}
@@ -815,7 +815,7 @@ public class Helper {
}
}
if ((y2 - y1) >= 0) {
rectangle.setBounds(x, y1, 1, y2 - y1);
rectangle.setBounds(x, y1, 1, y2 - y1 + 1);
area.add(new Area(rectangle));
}
}