mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 16:10:45 +00:00
copyright year updated
This commit is contained in:
+111
-111
@@ -1,111 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import com.jpexs.helpers.LimitedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class CacheEntry {
|
||||
|
||||
public abstract String getRequestURL();
|
||||
|
||||
public abstract Map<String, String> getResponseHeaders();
|
||||
|
||||
public abstract String getStatusLine();
|
||||
|
||||
public abstract String getRequestMethod();
|
||||
|
||||
public abstract InputStream getResponseRawDataStream();
|
||||
|
||||
public InputStream getResponseDataStream() {
|
||||
String contentLengthStr = getHeader("Content-Length");
|
||||
int contentLength = -1;
|
||||
if (contentLengthStr != null) {
|
||||
try {
|
||||
contentLength = Integer.parseInt(contentLengthStr);
|
||||
} catch (NumberFormatException nex) {
|
||||
}
|
||||
}
|
||||
final InputStream rawIs = getResponseRawDataStream();
|
||||
InputStream is = rawIs;
|
||||
if (contentLength > -1) {
|
||||
is = new LimitedInputStream(is, contentLength);
|
||||
}
|
||||
|
||||
String encoding = getHeader("Content-Encoding");
|
||||
if (encoding != null) {
|
||||
switch (encoding) {
|
||||
case "gzip":
|
||||
try {
|
||||
is = new GZIPInputStream(is);
|
||||
} catch (IOException ex) {
|
||||
is = null;
|
||||
//ignore
|
||||
}
|
||||
break;
|
||||
case "deflate":
|
||||
is = new InflaterInputStream(is);
|
||||
break;
|
||||
default: //unknown
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ("chunked".equals(getHeader("Transfer-Encoding"))) {
|
||||
is = new ChunkedInputStream(is);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getRequestURL();
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
String st = getStatusLine();
|
||||
if (st == null) {
|
||||
return 0;
|
||||
}
|
||||
String parts[] = st.split(" ");
|
||||
try {
|
||||
return Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHeader(String header) {
|
||||
Map<String, String> m = getResponseHeaders();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
for (String k : m.keySet()) {
|
||||
if (k.toLowerCase().equals(header.toLowerCase())) {
|
||||
return m.get(k);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import com.jpexs.helpers.LimitedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class CacheEntry {
|
||||
|
||||
public abstract String getRequestURL();
|
||||
|
||||
public abstract Map<String, String> getResponseHeaders();
|
||||
|
||||
public abstract String getStatusLine();
|
||||
|
||||
public abstract String getRequestMethod();
|
||||
|
||||
public abstract InputStream getResponseRawDataStream();
|
||||
|
||||
public InputStream getResponseDataStream() {
|
||||
String contentLengthStr = getHeader("Content-Length");
|
||||
int contentLength = -1;
|
||||
if (contentLengthStr != null) {
|
||||
try {
|
||||
contentLength = Integer.parseInt(contentLengthStr);
|
||||
} catch (NumberFormatException nex) {
|
||||
}
|
||||
}
|
||||
final InputStream rawIs = getResponseRawDataStream();
|
||||
InputStream is = rawIs;
|
||||
if (contentLength > -1) {
|
||||
is = new LimitedInputStream(is, contentLength);
|
||||
}
|
||||
|
||||
String encoding = getHeader("Content-Encoding");
|
||||
if (encoding != null) {
|
||||
switch (encoding) {
|
||||
case "gzip":
|
||||
try {
|
||||
is = new GZIPInputStream(is);
|
||||
} catch (IOException ex) {
|
||||
is = null;
|
||||
//ignore
|
||||
}
|
||||
break;
|
||||
case "deflate":
|
||||
is = new InflaterInputStream(is);
|
||||
break;
|
||||
default: //unknown
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ("chunked".equals(getHeader("Transfer-Encoding"))) {
|
||||
is = new ChunkedInputStream(is);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getRequestURL();
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
String st = getStatusLine();
|
||||
if (st == null) {
|
||||
return 0;
|
||||
}
|
||||
String parts[] = st.split(" ");
|
||||
try {
|
||||
return Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getHeader(String header) {
|
||||
Map<String, String> m = getResponseHeaders();
|
||||
if (m == null) {
|
||||
return null;
|
||||
}
|
||||
for (String k : m.keySet()) {
|
||||
if (k.toLowerCase().equals(header.toLowerCase())) {
|
||||
return m.get(k);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface CacheImplementation {
|
||||
|
||||
public List<CacheEntry> getEntries();
|
||||
|
||||
public void refresh();
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface CacheImplementation {
|
||||
|
||||
public List<CacheEntry> getEntries();
|
||||
|
||||
public void refresh();
|
||||
}
|
||||
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import com.jpexs.browsers.cache.chrome.ChromeCache;
|
||||
import com.jpexs.browsers.cache.firefox.FirefoxCache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheReader {
|
||||
|
||||
public static final String BROWSER_FIREFOX = "firefox";
|
||||
public static final String BROWSER_CHROME = "chrome";
|
||||
|
||||
public static String[] availableBrowsers() {
|
||||
return new String[]{BROWSER_FIREFOX, BROWSER_CHROME};
|
||||
}
|
||||
|
||||
public static CacheImplementation getBrowserCache(String browser) {
|
||||
switch (browser) {
|
||||
case BROWSER_CHROME:
|
||||
return ChromeCache.getInstance();
|
||||
case BROWSER_FIREFOX:
|
||||
return FirefoxCache.getInstance();
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid browser:" + browser);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import com.jpexs.browsers.cache.chrome.ChromeCache;
|
||||
import com.jpexs.browsers.cache.firefox.FirefoxCache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheReader {
|
||||
|
||||
public static final String BROWSER_FIREFOX = "firefox";
|
||||
public static final String BROWSER_CHROME = "chrome";
|
||||
|
||||
public static String[] availableBrowsers() {
|
||||
return new String[]{BROWSER_FIREFOX, BROWSER_CHROME};
|
||||
}
|
||||
|
||||
public static CacheImplementation getBrowserCache(String browser) {
|
||||
switch (browser) {
|
||||
case BROWSER_CHROME:
|
||||
return ChromeCache.getInstance();
|
||||
case BROWSER_FIREFOX:
|
||||
return FirefoxCache.getInstance();
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid browser:" + browser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+48
-48
@@ -1,48 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class RafInputStream extends InputStream {
|
||||
|
||||
private final RandomAccessFile raf;
|
||||
private long pos = 0;
|
||||
|
||||
public RafInputStream(RandomAccessFile raf) {
|
||||
this.raf = raf;
|
||||
try {
|
||||
pos = raf.getFilePointer();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(RafInputStream.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
raf.seek(pos++);
|
||||
return raf.read();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class RafInputStream extends InputStream {
|
||||
|
||||
private final RandomAccessFile raf;
|
||||
private long pos = 0;
|
||||
|
||||
public RafInputStream(RandomAccessFile raf) {
|
||||
this.raf = raf;
|
||||
try {
|
||||
pos = raf.getFilePointer();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(RafInputStream.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
raf.seek(pos++);
|
||||
return raf.read();
|
||||
}
|
||||
}
|
||||
|
||||
+122
-122
@@ -1,122 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.chrome;
|
||||
|
||||
import com.jpexs.browsers.cache.RafInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheAddr {
|
||||
|
||||
public static final int EXTERNAL = 0;
|
||||
public static final int RANKINGS = 1;
|
||||
public static final int BLOCK_256 = 2;
|
||||
public static final int BLOCK_1K = 3;
|
||||
public static final int BLOCK_4K = 4;
|
||||
public static final int BLOCK_FILES = 5;
|
||||
public static final int BLOCK_ENTRIES = 6;
|
||||
public static final int BLOCK_EVICTED = 7;
|
||||
public static final String blockNames[] = new String[]{"EXTERNAL", "RANKINGS", "BLOCK_256", "BLOCK_1K", "BLOCK_4K", "BLOCK_FILES", "BLOCK_ENTRIES", "BLOCK_EVICTED"};
|
||||
public static final int blockSizes[] = new int[]{0, 36, 256, 1024, 4096, 8, 104, 48};
|
||||
public static final long kInitializedMask = 0x80000000L;
|
||||
public static final long kFileTypeMask = 0x70000000L;
|
||||
public static final int kFileTypeOffset = 28;
|
||||
public static final long kReservedBitsMask = 0x0c000000L;
|
||||
public static final long kNumBlocksMask = 0x03000000L;
|
||||
public static final int kNumBlocksOffset = 24;
|
||||
public static final long kFileSelectorMask = 0x00ff0000L;
|
||||
public static final int FileSelectorOffset = 16;
|
||||
public static final long kStartBlockMask = 0x0000FFFFL;
|
||||
public static final long kFileNameMask = 0x0FFFFFFFL;
|
||||
public boolean initialized;
|
||||
public int fileType;
|
||||
public int numBlocks;
|
||||
public int fileSelector;
|
||||
public int startBlock;
|
||||
public int fileName;
|
||||
public long val;
|
||||
public File rootPath;
|
||||
private final Map<Integer, RandomAccessFile> dataFiles;
|
||||
private final File externalFilesDir;
|
||||
|
||||
public CacheAddr(InputStream is, File rootPath, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
|
||||
this.dataFiles = dataFiles;
|
||||
this.rootPath = rootPath;
|
||||
this.externalFilesDir = externalFilesDir;
|
||||
IndexInputStream iis = new IndexInputStream(is);
|
||||
val = iis.readUInt32();
|
||||
initialized = (val & kInitializedMask) == kInitializedMask;
|
||||
fileType = (int) ((val & kFileTypeMask) >> kFileTypeOffset);
|
||||
if (fileType == EXTERNAL) {
|
||||
fileName = (int) (val & kFileNameMask);
|
||||
} else {
|
||||
numBlocks = (int) ((val & kNumBlocksMask) >> kNumBlocksOffset);
|
||||
fileSelector = (int) ((val & kFileSelectorMask) >> FileSelectorOffset);
|
||||
startBlock = (int) (val & kStartBlockMask);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
String ft = blockNames[fileType];
|
||||
if (fileType == EXTERNAL) {
|
||||
return ft + ":" + fileName;
|
||||
}
|
||||
if (!initialized) {
|
||||
return "uninitialized";
|
||||
}
|
||||
return ft + ": numBlocks " + numBlocks + " fileSelector " + fileSelector + " startBlock " + startBlock;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
if (!initialized) {
|
||||
return null;
|
||||
}
|
||||
switch (fileType) {
|
||||
case EXTERNAL:
|
||||
String fileNameStr = Long.toHexString(fileName);
|
||||
while (fileNameStr.length() < 6) {
|
||||
fileNameStr = "0" + fileNameStr;
|
||||
}
|
||||
fileNameStr = "f_" + fileNameStr;
|
||||
return new RafInputStream(new RandomAccessFile(new File(externalFilesDir, fileNameStr), "r"));
|
||||
case BLOCK_1K:
|
||||
case BLOCK_256:
|
||||
case BLOCK_4K:
|
||||
|
||||
RandomAccessFile raf;
|
||||
|
||||
if (dataFiles.containsKey(fileSelector)) {
|
||||
raf = dataFiles.get(fileSelector);
|
||||
} else {
|
||||
raf = new RandomAccessFile(rootPath + "\\data_" + fileSelector, "r");
|
||||
dataFiles.put(fileSelector, raf);
|
||||
}
|
||||
raf.seek(BlockFileHeader.kBlockHeaderSize + startBlock * blockSizes[fileType]);
|
||||
return new RafInputStream(raf);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.chrome;
|
||||
|
||||
import com.jpexs.browsers.cache.RafInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheAddr {
|
||||
|
||||
public static final int EXTERNAL = 0;
|
||||
public static final int RANKINGS = 1;
|
||||
public static final int BLOCK_256 = 2;
|
||||
public static final int BLOCK_1K = 3;
|
||||
public static final int BLOCK_4K = 4;
|
||||
public static final int BLOCK_FILES = 5;
|
||||
public static final int BLOCK_ENTRIES = 6;
|
||||
public static final int BLOCK_EVICTED = 7;
|
||||
public static final String blockNames[] = new String[]{"EXTERNAL", "RANKINGS", "BLOCK_256", "BLOCK_1K", "BLOCK_4K", "BLOCK_FILES", "BLOCK_ENTRIES", "BLOCK_EVICTED"};
|
||||
public static final int blockSizes[] = new int[]{0, 36, 256, 1024, 4096, 8, 104, 48};
|
||||
public static final long kInitializedMask = 0x80000000L;
|
||||
public static final long kFileTypeMask = 0x70000000L;
|
||||
public static final int kFileTypeOffset = 28;
|
||||
public static final long kReservedBitsMask = 0x0c000000L;
|
||||
public static final long kNumBlocksMask = 0x03000000L;
|
||||
public static final int kNumBlocksOffset = 24;
|
||||
public static final long kFileSelectorMask = 0x00ff0000L;
|
||||
public static final int FileSelectorOffset = 16;
|
||||
public static final long kStartBlockMask = 0x0000FFFFL;
|
||||
public static final long kFileNameMask = 0x0FFFFFFFL;
|
||||
public boolean initialized;
|
||||
public int fileType;
|
||||
public int numBlocks;
|
||||
public int fileSelector;
|
||||
public int startBlock;
|
||||
public int fileName;
|
||||
public long val;
|
||||
public File rootPath;
|
||||
private final Map<Integer, RandomAccessFile> dataFiles;
|
||||
private final File externalFilesDir;
|
||||
|
||||
public CacheAddr(InputStream is, File rootPath, Map<Integer, RandomAccessFile> dataFiles, File externalFilesDir) throws IOException {
|
||||
this.dataFiles = dataFiles;
|
||||
this.rootPath = rootPath;
|
||||
this.externalFilesDir = externalFilesDir;
|
||||
IndexInputStream iis = new IndexInputStream(is);
|
||||
val = iis.readUInt32();
|
||||
initialized = (val & kInitializedMask) == kInitializedMask;
|
||||
fileType = (int) ((val & kFileTypeMask) >> kFileTypeOffset);
|
||||
if (fileType == EXTERNAL) {
|
||||
fileName = (int) (val & kFileNameMask);
|
||||
} else {
|
||||
numBlocks = (int) ((val & kNumBlocksMask) >> kNumBlocksOffset);
|
||||
fileSelector = (int) ((val & kFileSelectorMask) >> FileSelectorOffset);
|
||||
startBlock = (int) (val & kStartBlockMask);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
String ft = blockNames[fileType];
|
||||
if (fileType == EXTERNAL) {
|
||||
return ft + ":" + fileName;
|
||||
}
|
||||
if (!initialized) {
|
||||
return "uninitialized";
|
||||
}
|
||||
return ft + ": numBlocks " + numBlocks + " fileSelector " + fileSelector + " startBlock " + startBlock;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
if (!initialized) {
|
||||
return null;
|
||||
}
|
||||
switch (fileType) {
|
||||
case EXTERNAL:
|
||||
String fileNameStr = Long.toHexString(fileName);
|
||||
while (fileNameStr.length() < 6) {
|
||||
fileNameStr = "0" + fileNameStr;
|
||||
}
|
||||
fileNameStr = "f_" + fileNameStr;
|
||||
return new RafInputStream(new RandomAccessFile(new File(externalFilesDir, fileNameStr), "r"));
|
||||
case BLOCK_1K:
|
||||
case BLOCK_256:
|
||||
case BLOCK_4K:
|
||||
|
||||
RandomAccessFile raf;
|
||||
|
||||
if (dataFiles.containsKey(fileSelector)) {
|
||||
raf = dataFiles.get(fileSelector);
|
||||
} else {
|
||||
raf = new RandomAccessFile(rootPath + "\\data_" + fileSelector, "r");
|
||||
dataFiles.put(fileSelector, raf);
|
||||
}
|
||||
raf.seek(BlockFileHeader.kBlockHeaderSize + startBlock * blockSizes[fileType]);
|
||||
return new RafInputStream(raf);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+51
-51
@@ -1,51 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheInputStream extends InputStream {
|
||||
|
||||
private final InputStream is;
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return is.available();
|
||||
}
|
||||
|
||||
public CacheInputStream(InputStream is) {
|
||||
this.is = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return is.read();
|
||||
}
|
||||
|
||||
public long readInt32() throws IOException {
|
||||
return (read() << 24) + (read() << 16) + (read() << 8) + read();
|
||||
}
|
||||
|
||||
public int readInt16() throws IOException {
|
||||
return (read() << 8) + read();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheInputStream extends InputStream {
|
||||
|
||||
private final InputStream is;
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return is.available();
|
||||
}
|
||||
|
||||
public CacheInputStream(InputStream is) {
|
||||
this.is = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return is.read();
|
||||
}
|
||||
|
||||
public long readInt32() throws IOException {
|
||||
return (read() << 24) + (read() << 16) + (read() << 8) + read();
|
||||
}
|
||||
|
||||
public int readInt16() throws IOException {
|
||||
return (read() << 8) + read();
|
||||
}
|
||||
}
|
||||
|
||||
+72
-72
@@ -1,72 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheMap {
|
||||
|
||||
public long version;
|
||||
public long datasize;
|
||||
public long entryCount;
|
||||
public long dirtyFlag;
|
||||
public long recordCount;
|
||||
public long evictionRank[];
|
||||
public long bucketUsage[];
|
||||
public List<MapBucket> mapBuckets;
|
||||
|
||||
public CacheMap(File file) throws IOException {
|
||||
File cacheDir = file.getParentFile();
|
||||
CacheInputStream cis = new CacheInputStream(new FileInputStream(file));
|
||||
version = cis.readInt32();
|
||||
datasize = cis.readInt32();
|
||||
entryCount = cis.readInt32();
|
||||
dirtyFlag = cis.readInt32();
|
||||
recordCount = cis.readInt32();
|
||||
evictionRank = new long[32];
|
||||
for (int i = 0; i < evictionRank.length; i++) {
|
||||
evictionRank[i] = cis.readInt32();
|
||||
}
|
||||
bucketUsage = new long[32];
|
||||
for (int i = 0; i < bucketUsage.length; i++) {
|
||||
bucketUsage[i] = cis.readInt32();
|
||||
}
|
||||
mapBuckets = new ArrayList<>();
|
||||
Map<Integer, RandomAccessFile> cacheFiles = new HashMap<>();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
cacheFiles.put(i, new RandomAccessFile(new File(cacheDir, "_CACHE_00" + i + "_"), "r"));
|
||||
}
|
||||
while (cis.available() > 0) {
|
||||
MapBucket mb = new MapBucket(cis, cacheDir, cacheFiles);
|
||||
if (mb.hash == 0) {
|
||||
continue;
|
||||
}
|
||||
mapBuckets.add(mb);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class CacheMap {
|
||||
|
||||
public long version;
|
||||
public long datasize;
|
||||
public long entryCount;
|
||||
public long dirtyFlag;
|
||||
public long recordCount;
|
||||
public long evictionRank[];
|
||||
public long bucketUsage[];
|
||||
public List<MapBucket> mapBuckets;
|
||||
|
||||
public CacheMap(File file) throws IOException {
|
||||
File cacheDir = file.getParentFile();
|
||||
CacheInputStream cis = new CacheInputStream(new FileInputStream(file));
|
||||
version = cis.readInt32();
|
||||
datasize = cis.readInt32();
|
||||
entryCount = cis.readInt32();
|
||||
dirtyFlag = cis.readInt32();
|
||||
recordCount = cis.readInt32();
|
||||
evictionRank = new long[32];
|
||||
for (int i = 0; i < evictionRank.length; i++) {
|
||||
evictionRank[i] = cis.readInt32();
|
||||
}
|
||||
bucketUsage = new long[32];
|
||||
for (int i = 0; i < bucketUsage.length; i++) {
|
||||
bucketUsage[i] = cis.readInt32();
|
||||
}
|
||||
mapBuckets = new ArrayList<>();
|
||||
Map<Integer, RandomAccessFile> cacheFiles = new HashMap<>();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
cacheFiles.put(i, new RandomAccessFile(new File(cacheDir, "_CACHE_00" + i + "_"), "r"));
|
||||
}
|
||||
while (cis.available() > 0) {
|
||||
MapBucket mb = new MapBucket(cis, cacheDir, cacheFiles);
|
||||
if (mb.hash == 0) {
|
||||
continue;
|
||||
}
|
||||
mapBuckets.add(mb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+161
-161
@@ -1,161 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.CacheEntry;
|
||||
import com.jpexs.browsers.cache.CacheImplementation;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FirefoxCache implements CacheImplementation {
|
||||
|
||||
private static FirefoxCache instance;
|
||||
|
||||
private FirefoxCache() {
|
||||
}
|
||||
|
||||
public static FirefoxCache getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new FirefoxCache();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
private boolean loaded = false;
|
||||
private CacheMap map;
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
File dir = getCacheDirectory();
|
||||
if (dir == null) {
|
||||
return;
|
||||
}
|
||||
File cacheMapFile = new File(dir, "_CACHE_MAP_");
|
||||
try {
|
||||
map = new CacheMap(cacheMapFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(FirefoxCache.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CacheEntry> getEntries() {
|
||||
if (!loaded) {
|
||||
refresh();
|
||||
}
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
List<CacheEntry> ret = new ArrayList<>();
|
||||
|
||||
ret.addAll(map.mapBuckets);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private enum OSId {
|
||||
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
|
||||
private static OSId getOSId() {
|
||||
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty("os.name");
|
||||
}
|
||||
};
|
||||
OSId id = OSId.UNIX;
|
||||
String osName = AccessController.doPrivileged(doGetOSName);
|
||||
if (osName != null) {
|
||||
if (osName.toLowerCase().startsWith("mac os x")) {
|
||||
id = OSId.OSX;
|
||||
} else if (osName.contains("Windows")) {
|
||||
id = OSId.WINDOWS;
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public static File getProfileDirectory() {
|
||||
File profilesDir = getProfilesDirectory();
|
||||
if (profilesDir == null) {
|
||||
return null;
|
||||
}
|
||||
File profiles[] = profilesDir.listFiles();
|
||||
File profileDir = null;
|
||||
for (File f : profiles) {
|
||||
if (f.isDirectory()) {
|
||||
if (f.getName().matches("[a-z0-9]+\\.default")) {
|
||||
profileDir = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return profileDir;
|
||||
}
|
||||
|
||||
public static File getCacheDirectory() {
|
||||
File profileDir = getProfileDirectory();
|
||||
File cacheDir = null;
|
||||
if (profileDir != null) {
|
||||
cacheDir = new File(profileDir, "Cache");
|
||||
}
|
||||
if (cacheDir == null) {
|
||||
return null;
|
||||
}
|
||||
if (!cacheDir.exists()) {
|
||||
return null;
|
||||
}
|
||||
return cacheDir;
|
||||
}
|
||||
|
||||
public static File getProfilesDirectory() {
|
||||
String userHome = null;
|
||||
File profilesDir = null;
|
||||
try {
|
||||
userHome = System.getProperty("user.home");
|
||||
} catch (SecurityException ignore) {
|
||||
}
|
||||
if (userHome != null) {
|
||||
OSId osId = getOSId();
|
||||
if (osId == OSId.WINDOWS) {
|
||||
profilesDir = new File(userHome + "\\AppData\\Local\\Mozilla\\Firefox\\Profiles");
|
||||
if (!profilesDir.exists()) {
|
||||
profilesDir = new File(userHome + "\\Local Settings\\Application Data\\Mozilla\\Firefox\\Profiles");
|
||||
}
|
||||
} else if (osId == OSId.OSX) {
|
||||
profilesDir = new File(userHome + "/Library/Caches/Firefox/Profiles");
|
||||
} else {
|
||||
profilesDir = new File(userHome + "/.mozilla/firefox");
|
||||
}
|
||||
}
|
||||
if ((profilesDir == null) || !profilesDir.exists()) {
|
||||
return null;
|
||||
}
|
||||
return profilesDir;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.CacheEntry;
|
||||
import com.jpexs.browsers.cache.CacheImplementation;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FirefoxCache implements CacheImplementation {
|
||||
|
||||
private static FirefoxCache instance;
|
||||
|
||||
private FirefoxCache() {
|
||||
}
|
||||
|
||||
public static FirefoxCache getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new FirefoxCache();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
private boolean loaded = false;
|
||||
private CacheMap map;
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
File dir = getCacheDirectory();
|
||||
if (dir == null) {
|
||||
return;
|
||||
}
|
||||
File cacheMapFile = new File(dir, "_CACHE_MAP_");
|
||||
try {
|
||||
map = new CacheMap(cacheMapFile);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(FirefoxCache.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CacheEntry> getEntries() {
|
||||
if (!loaded) {
|
||||
refresh();
|
||||
}
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
List<CacheEntry> ret = new ArrayList<>();
|
||||
|
||||
ret.addAll(map.mapBuckets);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private enum OSId {
|
||||
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
|
||||
private static OSId getOSId() {
|
||||
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty("os.name");
|
||||
}
|
||||
};
|
||||
OSId id = OSId.UNIX;
|
||||
String osName = AccessController.doPrivileged(doGetOSName);
|
||||
if (osName != null) {
|
||||
if (osName.toLowerCase().startsWith("mac os x")) {
|
||||
id = OSId.OSX;
|
||||
} else if (osName.contains("Windows")) {
|
||||
id = OSId.WINDOWS;
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public static File getProfileDirectory() {
|
||||
File profilesDir = getProfilesDirectory();
|
||||
if (profilesDir == null) {
|
||||
return null;
|
||||
}
|
||||
File profiles[] = profilesDir.listFiles();
|
||||
File profileDir = null;
|
||||
for (File f : profiles) {
|
||||
if (f.isDirectory()) {
|
||||
if (f.getName().matches("[a-z0-9]+\\.default")) {
|
||||
profileDir = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return profileDir;
|
||||
}
|
||||
|
||||
public static File getCacheDirectory() {
|
||||
File profileDir = getProfileDirectory();
|
||||
File cacheDir = null;
|
||||
if (profileDir != null) {
|
||||
cacheDir = new File(profileDir, "Cache");
|
||||
}
|
||||
if (cacheDir == null) {
|
||||
return null;
|
||||
}
|
||||
if (!cacheDir.exists()) {
|
||||
return null;
|
||||
}
|
||||
return cacheDir;
|
||||
}
|
||||
|
||||
public static File getProfilesDirectory() {
|
||||
String userHome = null;
|
||||
File profilesDir = null;
|
||||
try {
|
||||
userHome = System.getProperty("user.home");
|
||||
} catch (SecurityException ignore) {
|
||||
}
|
||||
if (userHome != null) {
|
||||
OSId osId = getOSId();
|
||||
if (osId == OSId.WINDOWS) {
|
||||
profilesDir = new File(userHome + "\\AppData\\Local\\Mozilla\\Firefox\\Profiles");
|
||||
if (!profilesDir.exists()) {
|
||||
profilesDir = new File(userHome + "\\Local Settings\\Application Data\\Mozilla\\Firefox\\Profiles");
|
||||
}
|
||||
} else if (osId == OSId.OSX) {
|
||||
profilesDir = new File(userHome + "/Library/Caches/Firefox/Profiles");
|
||||
} else {
|
||||
profilesDir = new File(userHome + "/.mozilla/firefox");
|
||||
}
|
||||
}
|
||||
if ((profilesDir == null) || !profilesDir.exists()) {
|
||||
return null;
|
||||
}
|
||||
return profilesDir;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 etrik
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author petrik
|
||||
*/
|
||||
public class IncompatibleVersionException extends Exception {
|
||||
|
||||
public IncompatibleVersionException(int version) {
|
||||
super("Incompatible version: " + version);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author petrik
|
||||
*/
|
||||
public class IncompatibleVersionException extends Exception {
|
||||
|
||||
public IncompatibleVersionException(int version) {
|
||||
super("Incompatible version: " + version);
|
||||
}
|
||||
}
|
||||
|
||||
+116
-116
@@ -1,116 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.RafInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Location {
|
||||
|
||||
public int locationSelector;
|
||||
public int extraBlocks;
|
||||
public long blockNumber;
|
||||
public int fileGeneration;
|
||||
public int fileSize;
|
||||
public boolean isMetadata;
|
||||
public long hash;
|
||||
private final File rootDir;
|
||||
public static final long eReservedMask = 0x4C000000L;
|
||||
public static final long eLocationSelectorMask = 0x30000000L;
|
||||
public static final int eLocationSelectorOffset = 28;
|
||||
public static final long eExtraBlocksMask = 0x03000000L;
|
||||
public static final int eExtraBlocksOffset = 24;
|
||||
public static final long eBlockNumberMask = 0x00FFFFFFL;
|
||||
public static final long eFileGenerationMask = 0x000000FFL;
|
||||
public static final long eFileSizeMask = 0x00FFFF00L;
|
||||
public static final int eFileSizeOffset = 8;
|
||||
public static final long eFileReservedMask = 0x4F000000L;
|
||||
|
||||
public static int size_shift(int idx) {
|
||||
return (2 * ((idx) - 1));
|
||||
}
|
||||
|
||||
public static int bitmapSizeForIndex(int idx) {
|
||||
return ((idx > 0) ? (131072 >> size_shift(idx)) : 0);
|
||||
}
|
||||
|
||||
public static int blockSizeForIndex(int idx) {
|
||||
return ((idx > 0) ? (256 << size_shift(idx)) : 0);
|
||||
}
|
||||
/*
|
||||
#define BLOCK_SIZE_FOR_INDEX(idx) ((idx) ? (256 << SIZE_SHIFT(idx)) : 0)
|
||||
#define BITMAP_SIZE_FOR_INDEX(idx) ((idx) ? (131072 >> SIZE_SHIFT(idx)) : 0)
|
||||
*/
|
||||
private final Map<Integer, RandomAccessFile> dataFiles;
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
String fileName = getFileName();
|
||||
if (locationSelector > 0) {
|
||||
RandomAccessFile raf = dataFiles.get(locationSelector);
|
||||
raf.seek(bitmapSizeForIndex(locationSelector) / 8 + blockSizeForIndex(locationSelector) * blockNumber);
|
||||
return new RafInputStream(raf);
|
||||
}
|
||||
return new FileInputStream(new File(rootDir, fileName));
|
||||
}
|
||||
|
||||
public Location(long val, boolean isMetadata, long hash, File rootDir, Map<Integer, RandomAccessFile> dataFiles) {
|
||||
this.hash = hash;
|
||||
this.dataFiles = dataFiles;
|
||||
this.rootDir = rootDir;
|
||||
this.isMetadata = isMetadata;
|
||||
locationSelector = (int) ((val & eLocationSelectorMask) >> eLocationSelectorOffset);
|
||||
if (locationSelector > 0) {
|
||||
extraBlocks = (int) ((val & eExtraBlocksMask) >> eExtraBlocksOffset);
|
||||
blockNumber = (int) (val & eBlockNumberMask);
|
||||
} else {
|
||||
fileSize = (int) ((val & eFileSizeMask) >> eFileSizeOffset);
|
||||
fileGeneration = (int) (val & eFileGenerationMask);
|
||||
}
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
if (locationSelector > 0) {
|
||||
return "_CACHE_00" + locationSelector + "_";
|
||||
}
|
||||
String hashHex = Long.toHexString(hash & 0xffffffffL).toUpperCase();
|
||||
while (hashHex.length() < 8) {
|
||||
hashHex = "0" + hashHex;
|
||||
}
|
||||
String genHex = Integer.toHexString(fileGeneration);
|
||||
while (genHex.length() < 2) {
|
||||
genHex = "0" + genHex;
|
||||
}
|
||||
return hashHex.charAt(0) + File.separator + hashHex.substring(1, 1 + 2) + File.separator + hashHex.substring(3) + (isMetadata ? "m" : "d") + genHex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (locationSelector > 0) {
|
||||
return getFileName() + " block " + blockNumber + " extraBlocks " + extraBlocks;
|
||||
}
|
||||
return getFileName();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import com.jpexs.browsers.cache.RafInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Location {
|
||||
|
||||
public int locationSelector;
|
||||
public int extraBlocks;
|
||||
public long blockNumber;
|
||||
public int fileGeneration;
|
||||
public int fileSize;
|
||||
public boolean isMetadata;
|
||||
public long hash;
|
||||
private final File rootDir;
|
||||
public static final long eReservedMask = 0x4C000000L;
|
||||
public static final long eLocationSelectorMask = 0x30000000L;
|
||||
public static final int eLocationSelectorOffset = 28;
|
||||
public static final long eExtraBlocksMask = 0x03000000L;
|
||||
public static final int eExtraBlocksOffset = 24;
|
||||
public static final long eBlockNumberMask = 0x00FFFFFFL;
|
||||
public static final long eFileGenerationMask = 0x000000FFL;
|
||||
public static final long eFileSizeMask = 0x00FFFF00L;
|
||||
public static final int eFileSizeOffset = 8;
|
||||
public static final long eFileReservedMask = 0x4F000000L;
|
||||
|
||||
public static int size_shift(int idx) {
|
||||
return (2 * ((idx) - 1));
|
||||
}
|
||||
|
||||
public static int bitmapSizeForIndex(int idx) {
|
||||
return ((idx > 0) ? (131072 >> size_shift(idx)) : 0);
|
||||
}
|
||||
|
||||
public static int blockSizeForIndex(int idx) {
|
||||
return ((idx > 0) ? (256 << size_shift(idx)) : 0);
|
||||
}
|
||||
/*
|
||||
#define BLOCK_SIZE_FOR_INDEX(idx) ((idx) ? (256 << SIZE_SHIFT(idx)) : 0)
|
||||
#define BITMAP_SIZE_FOR_INDEX(idx) ((idx) ? (131072 >> SIZE_SHIFT(idx)) : 0)
|
||||
*/
|
||||
private final Map<Integer, RandomAccessFile> dataFiles;
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
String fileName = getFileName();
|
||||
if (locationSelector > 0) {
|
||||
RandomAccessFile raf = dataFiles.get(locationSelector);
|
||||
raf.seek(bitmapSizeForIndex(locationSelector) / 8 + blockSizeForIndex(locationSelector) * blockNumber);
|
||||
return new RafInputStream(raf);
|
||||
}
|
||||
return new FileInputStream(new File(rootDir, fileName));
|
||||
}
|
||||
|
||||
public Location(long val, boolean isMetadata, long hash, File rootDir, Map<Integer, RandomAccessFile> dataFiles) {
|
||||
this.hash = hash;
|
||||
this.dataFiles = dataFiles;
|
||||
this.rootDir = rootDir;
|
||||
this.isMetadata = isMetadata;
|
||||
locationSelector = (int) ((val & eLocationSelectorMask) >> eLocationSelectorOffset);
|
||||
if (locationSelector > 0) {
|
||||
extraBlocks = (int) ((val & eExtraBlocksMask) >> eExtraBlocksOffset);
|
||||
blockNumber = (int) (val & eBlockNumberMask);
|
||||
} else {
|
||||
fileSize = (int) ((val & eFileSizeMask) >> eFileSizeOffset);
|
||||
fileGeneration = (int) (val & eFileGenerationMask);
|
||||
}
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
if (locationSelector > 0) {
|
||||
return "_CACHE_00" + locationSelector + "_";
|
||||
}
|
||||
String hashHex = Long.toHexString(hash & 0xffffffffL).toUpperCase();
|
||||
while (hashHex.length() < 8) {
|
||||
hashHex = "0" + hashHex;
|
||||
}
|
||||
String genHex = Integer.toHexString(fileGeneration);
|
||||
while (genHex.length() < 2) {
|
||||
genHex = "0" + genHex;
|
||||
}
|
||||
return hashHex.charAt(0) + File.separator + hashHex.substring(1, 1 + 2) + File.separator + hashHex.substring(3) + (isMetadata ? "m" : "d") + genHex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (locationSelector > 0) {
|
||||
return getFileName() + " block " + blockNumber + " extraBlocks " + extraBlocks;
|
||||
}
|
||||
return getFileName();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+79
-79
@@ -1,79 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MetaData {
|
||||
|
||||
public int majorVersion;
|
||||
public int minorVersion;
|
||||
public long location;
|
||||
public long fetchCount;
|
||||
public long firstFetchTime;
|
||||
public long lastFetchTime;
|
||||
public long expireTime;
|
||||
public long dataSize;
|
||||
public long requestSize;
|
||||
public long infoSize;
|
||||
public String request;
|
||||
public Map<String, String> response;
|
||||
|
||||
public MetaData(InputStream is) throws IOException, IncompatibleVersionException {
|
||||
CacheInputStream cis = new CacheInputStream(is);
|
||||
majorVersion = cis.readInt16();
|
||||
if (majorVersion != 1) {
|
||||
throw new IncompatibleVersionException(majorVersion);
|
||||
}
|
||||
minorVersion = cis.readInt16();
|
||||
location = cis.readInt32();
|
||||
fetchCount = cis.readInt32();
|
||||
firstFetchTime = cis.readInt32();
|
||||
lastFetchTime = cis.readInt32();
|
||||
expireTime = cis.readInt32();
|
||||
dataSize = cis.readInt32();
|
||||
requestSize = cis.readInt32();
|
||||
infoSize = cis.readInt32();
|
||||
byte req[] = new byte[(int) requestSize];
|
||||
cis.read(req);
|
||||
request = new String(req, 0, (int) requestSize - 1/*Ends with char 0*/);
|
||||
byte res[] = new byte[(int) infoSize];
|
||||
cis.read(res);
|
||||
String responseStr = new String(res);
|
||||
int nulpos;
|
||||
boolean inKey = true;
|
||||
String key = null;
|
||||
response = new HashMap<>();
|
||||
while ((nulpos = responseStr.indexOf(0)) > 0) {
|
||||
String v = responseStr.substring(0, nulpos);
|
||||
responseStr = responseStr.substring(nulpos + 1);
|
||||
if (inKey) {
|
||||
key = v;
|
||||
} else {
|
||||
response.put(key, v);
|
||||
}
|
||||
inKey = !inKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.browsers.cache.firefox;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MetaData {
|
||||
|
||||
public int majorVersion;
|
||||
public int minorVersion;
|
||||
public long location;
|
||||
public long fetchCount;
|
||||
public long firstFetchTime;
|
||||
public long lastFetchTime;
|
||||
public long expireTime;
|
||||
public long dataSize;
|
||||
public long requestSize;
|
||||
public long infoSize;
|
||||
public String request;
|
||||
public Map<String, String> response;
|
||||
|
||||
public MetaData(InputStream is) throws IOException, IncompatibleVersionException {
|
||||
CacheInputStream cis = new CacheInputStream(is);
|
||||
majorVersion = cis.readInt16();
|
||||
if (majorVersion != 1) {
|
||||
throw new IncompatibleVersionException(majorVersion);
|
||||
}
|
||||
minorVersion = cis.readInt16();
|
||||
location = cis.readInt32();
|
||||
fetchCount = cis.readInt32();
|
||||
firstFetchTime = cis.readInt32();
|
||||
lastFetchTime = cis.readInt32();
|
||||
expireTime = cis.readInt32();
|
||||
dataSize = cis.readInt32();
|
||||
requestSize = cis.readInt32();
|
||||
infoSize = cis.readInt32();
|
||||
byte req[] = new byte[(int) requestSize];
|
||||
cis.read(req);
|
||||
request = new String(req, 0, (int) requestSize - 1/*Ends with char 0*/);
|
||||
byte res[] = new byte[(int) infoSize];
|
||||
cis.read(res);
|
||||
String responseStr = new String(res);
|
||||
int nulpos;
|
||||
boolean inKey = true;
|
||||
String key = null;
|
||||
response = new HashMap<>();
|
||||
while ((nulpos = responseStr.indexOf(0)) > 0) {
|
||||
String v = responseStr.substring(0, nulpos);
|
||||
responseStr = responseStr.substring(nulpos + 1);
|
||||
if (inKey) {
|
||||
key = v;
|
||||
} else {
|
||||
response.put(key, v);
|
||||
}
|
||||
inKey = !inKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionRedirector implements ActionListener {
|
||||
|
||||
ActionListener target;
|
||||
String actionCommand;
|
||||
|
||||
public ActionRedirector(ActionListener target, String actionCommand) {
|
||||
this.target = target;
|
||||
this.actionCommand = actionCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
e = new ActionEvent(e.getSource(), e.getID(), actionCommand);
|
||||
target.actionPerformed(e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionRedirector implements ActionListener {
|
||||
|
||||
ActionListener target;
|
||||
String actionCommand;
|
||||
|
||||
public ActionRedirector(ActionListener target, String actionCommand) {
|
||||
this.target = target;
|
||||
this.actionCommand = actionCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
e = new ActionEvent(e.getSource(), e.getID(), actionCommand);
|
||||
target.actionPerformed(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS, All rights reserved.
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ButtonsPanel extends JPanel {
|
||||
|
||||
private ComponentListener listener;
|
||||
|
||||
public ButtonsPanel() {
|
||||
super(new FlowLayout());
|
||||
|
||||
listener = new ComponentListener() {
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
};
|
||||
|
||||
this.addContainerListener(new ContainerListener() {
|
||||
|
||||
@Override
|
||||
public void componentAdded(ContainerEvent e) {
|
||||
e.getComponent().addComponentListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved(ContainerEvent e) {
|
||||
e.getComponent().removeComponentListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateVisibility() {
|
||||
|
||||
// hide button panel when no button is visible
|
||||
boolean visible = false;
|
||||
for (Component component : getComponents()) {
|
||||
if (component instanceof JButton) {
|
||||
JButton button = (JButton) component;
|
||||
if (button.isVisible()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
setVisible(visible);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ButtonsPanel extends JPanel {
|
||||
|
||||
private ComponentListener listener;
|
||||
|
||||
public ButtonsPanel() {
|
||||
super(new FlowLayout());
|
||||
|
||||
listener = new ComponentListener() {
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
};
|
||||
|
||||
this.addContainerListener(new ContainerListener() {
|
||||
|
||||
@Override
|
||||
public void componentAdded(ContainerEvent e) {
|
||||
e.getComponent().addComponentListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved(ContainerEvent e) {
|
||||
e.getComponent().removeComponentListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateVisibility() {
|
||||
|
||||
// hide button panel when no button is visible
|
||||
boolean visible = false;
|
||||
for (Component component : getComponents()) {
|
||||
if (component instanceof JButton) {
|
||||
JButton button = (JButton) component;
|
||||
if (button.isVisible()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class EachRowRendererEditor extends JTable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Class editingClass;
|
||||
|
||||
@Override
|
||||
public TableCellRenderer getCellRenderer(int row, int column) {
|
||||
editingClass = null;
|
||||
int modelColumn = convertColumnIndexToModel(column);
|
||||
if (modelColumn == 1) {
|
||||
Object value = getModel().getValueAt(row, modelColumn);
|
||||
Class rowClass = value == null ? String.class : value.getClass();
|
||||
return getDefaultRenderer(rowClass);
|
||||
} else {
|
||||
return super.getCellRenderer(row, column);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableCellEditor getCellEditor(int row, int column) {
|
||||
editingClass = null;
|
||||
int modelColumn = convertColumnIndexToModel(column);
|
||||
if (modelColumn == 1) {
|
||||
Object value = getModel().getValueAt(row, modelColumn);
|
||||
editingClass = value == null ? String.class : value.getClass();
|
||||
return getDefaultEditor(editingClass);
|
||||
} else {
|
||||
return super.getCellEditor(row, column);
|
||||
}
|
||||
}
|
||||
|
||||
// This method is also invoked by the editor when the value in the editor
|
||||
// component is saved in the TableModel. The class was saved when the
|
||||
// editor was invoked so the proper class can be created.
|
||||
@Override
|
||||
public Class getColumnClass(int column) {
|
||||
return editingClass != null ? editingClass : super.getColumnClass(column);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class EachRowRendererEditor extends JTable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Class editingClass;
|
||||
|
||||
@Override
|
||||
public TableCellRenderer getCellRenderer(int row, int column) {
|
||||
editingClass = null;
|
||||
int modelColumn = convertColumnIndexToModel(column);
|
||||
if (modelColumn == 1) {
|
||||
Object value = getModel().getValueAt(row, modelColumn);
|
||||
Class rowClass = value == null ? String.class : value.getClass();
|
||||
return getDefaultRenderer(rowClass);
|
||||
} else {
|
||||
return super.getCellRenderer(row, column);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableCellEditor getCellEditor(int row, int column) {
|
||||
editingClass = null;
|
||||
int modelColumn = convertColumnIndexToModel(column);
|
||||
if (modelColumn == 1) {
|
||||
Object value = getModel().getValueAt(row, modelColumn);
|
||||
editingClass = value == null ? String.class : value.getClass();
|
||||
return getDefaultEditor(editingClass);
|
||||
} else {
|
||||
return super.getCellEditor(row, column);
|
||||
}
|
||||
}
|
||||
|
||||
// This method is also invoked by the editor when the value in the editor
|
||||
// component is saved in the TableModel. The class was saved when the
|
||||
// editor was invoked so the proper class can be created.
|
||||
@Override
|
||||
public Class getColumnClass(int column) {
|
||||
return editingClass != null ? editingClass : super.getColumnClass(column);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ErrorState {
|
||||
|
||||
NO_ERROR, INFO, WARNING, ERROR
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum ErrorState {
|
||||
|
||||
NO_ERROR, INFO, WARNING, ERROR
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FlashUnsupportedException extends RuntimeException {
|
||||
|
||||
public FlashUnsupportedException() {
|
||||
super("Flash Unsupported");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FlashUnsupportedException extends RuntimeException {
|
||||
|
||||
public FlashUnsupportedException() {
|
||||
super("Flash Unsupported");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Jindra
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
|
||||
import com.jpexs.decompiler.graph.GraphPart;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class GraphTreeFrame extends AppFrame {
|
||||
|
||||
public JTree graphTree;
|
||||
|
||||
public GraphTreeFrame(final AVM2Graph graph) {
|
||||
setSize(400, 400);
|
||||
graphTree = new JTree(new TreeModel() {
|
||||
@Override
|
||||
public Object getRoot() {
|
||||
return graph.heads.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(Object parent, int index) {
|
||||
return ((GraphPart) parent).nextParts.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount(Object parent) {
|
||||
return ((GraphPart) parent).nextParts.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf(Object node) {
|
||||
return getChildCount(node) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueForPathChanged(TreePath path, Object newValue) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexOfChild(Object parent, Object child) {
|
||||
return ((GraphPart) parent).nextParts.indexOf(child);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
});
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
cnt.add(graphTree, BorderLayout.CENTER);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
|
||||
import com.jpexs.decompiler.graph.GraphPart;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.event.TreeModelListener;
|
||||
import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class GraphTreeFrame extends AppFrame {
|
||||
|
||||
public JTree graphTree;
|
||||
|
||||
public GraphTreeFrame(final AVM2Graph graph) {
|
||||
setSize(400, 400);
|
||||
graphTree = new JTree(new TreeModel() {
|
||||
@Override
|
||||
public Object getRoot() {
|
||||
return graph.heads.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(Object parent, int index) {
|
||||
return ((GraphPart) parent).nextParts.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount(Object parent) {
|
||||
return ((GraphPart) parent).nextParts.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf(Object node) {
|
||||
return getChildCount(node) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueForPathChanged(TreePath path, Object newValue) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexOfChild(Object parent, Object child) {
|
||||
return ((GraphPart) parent).nextParts.indexOf(child);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
});
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
cnt.add(graphTree, BorderLayout.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import javax.swing.JLabel;
|
||||
import org.pushingpixels.substance.api.DecorationAreaType;
|
||||
import org.pushingpixels.substance.api.SubstanceConstants;
|
||||
import org.pushingpixels.substance.api.painter.border.StandardBorderPainter;
|
||||
import org.pushingpixels.substance.api.skin.OfficeBlue2007Skin;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceOutlineUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class HeaderLabel extends JLabel {
|
||||
|
||||
public HeaderLabel(String text) {
|
||||
super(text);
|
||||
//setBorder(BorderFactory.createRaisedBevelBorder());
|
||||
|
||||
|
||||
/*setBorder(new Border() {
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
g.setColor(Color.gray);
|
||||
g.drawLine(0, 0,width-1, 0);
|
||||
g.drawLine(0, 0, 0, height-1);
|
||||
g.setColor(Color.darkGray);
|
||||
g.drawLine(width-1, 0, width-1, height-1);
|
||||
g.drawLine(0, height-1, width-1, height-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(2, 2, 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
g.setColor(new Color(217, 232, 251));
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
StandardBorderPainter borderPainter = new StandardBorderPainter();
|
||||
|
||||
Set<SubstanceConstants.Side> straightSides = EnumSet.of(SubstanceConstants.Side.BOTTOM);
|
||||
int dy = 0;
|
||||
float cornerRadius = 5f;
|
||||
int borderThickness = 1;
|
||||
int borderInsets = 0;
|
||||
GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities.getBaseOutline(getWidth(), getHeight() + dy,
|
||||
cornerRadius - borderThickness, straightSides, borderThickness + borderInsets)
|
||||
: null;
|
||||
|
||||
GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(getWidth(),
|
||||
getHeight() + dy, cornerRadius, straightSides, borderInsets);
|
||||
borderPainter.paintBorder(g, this, getWidth(), getHeight() + dy,
|
||||
contour, contourInner, new OfficeBlue2007Skin().getActiveColorScheme(DecorationAreaType.HEADER));
|
||||
g.setColor(Color.black);
|
||||
JLabel lab = new JLabel(getText(), JLabel.CENTER);
|
||||
lab.setSize(getSize());
|
||||
lab.paint(g);
|
||||
//g.drawString(getText(), getWidth()/2-getFontMetrics(getFont()).stringWidth(getText())/2, getFont().getSize());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import javax.swing.JLabel;
|
||||
import org.pushingpixels.substance.api.DecorationAreaType;
|
||||
import org.pushingpixels.substance.api.SubstanceConstants;
|
||||
import org.pushingpixels.substance.api.painter.border.StandardBorderPainter;
|
||||
import org.pushingpixels.substance.api.skin.OfficeBlue2007Skin;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceOutlineUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class HeaderLabel extends JLabel {
|
||||
|
||||
public HeaderLabel(String text) {
|
||||
super(text);
|
||||
//setBorder(BorderFactory.createRaisedBevelBorder());
|
||||
|
||||
|
||||
/*setBorder(new Border() {
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
g.setColor(Color.gray);
|
||||
g.drawLine(0, 0,width-1, 0);
|
||||
g.drawLine(0, 0, 0, height-1);
|
||||
g.setColor(Color.darkGray);
|
||||
g.drawLine(width-1, 0, width-1, height-1);
|
||||
g.drawLine(0, height-1, width-1, height-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(2, 2, 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
g.setColor(new Color(217, 232, 251));
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
StandardBorderPainter borderPainter = new StandardBorderPainter();
|
||||
|
||||
Set<SubstanceConstants.Side> straightSides = EnumSet.of(SubstanceConstants.Side.BOTTOM);
|
||||
int dy = 0;
|
||||
float cornerRadius = 5f;
|
||||
int borderThickness = 1;
|
||||
int borderInsets = 0;
|
||||
GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities.getBaseOutline(getWidth(), getHeight() + dy,
|
||||
cornerRadius - borderThickness, straightSides, borderThickness + borderInsets)
|
||||
: null;
|
||||
|
||||
GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(getWidth(),
|
||||
getHeight() + dy, cornerRadius, straightSides, borderInsets);
|
||||
borderPainter.paintBorder(g, this, getWidth(), getHeight() + dy,
|
||||
contour, contourInner, new OfficeBlue2007Skin().getActiveColorScheme(DecorationAreaType.HEADER));
|
||||
g.setColor(Color.black);
|
||||
JLabel lab = new JLabel(getText(), JLabel.CENTER);
|
||||
lab.setSize(getSize());
|
||||
lab.paint(g);
|
||||
//g.drawString(getText(), getWidth()/2-getFontMetrics(getFont()).stringWidth(getText())/2, getFont().getSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Language {
|
||||
|
||||
public String code;
|
||||
public String name;
|
||||
|
||||
public Language(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Language {
|
||||
|
||||
public String code;
|
||||
public String name;
|
||||
|
||||
public Language(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -67,7 +67,7 @@ public class LicenseUpdater {
|
||||
|
||||
*/
|
||||
int defaultStartYear = 2010;
|
||||
int defaultFinalYear = 2014;
|
||||
int defaultFinalYear = 2015;
|
||||
String defaultAuthor = "JPEXS";
|
||||
String defaultYearStr = Integer.toString(defaultStartYear);
|
||||
if (defaultFinalYear != defaultStartYear) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.text.Format;
|
||||
import javax.swing.JFormattedTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyFormattedTextField extends JFormattedTextField {
|
||||
|
||||
public MyFormattedTextField(Format format) {
|
||||
super(format);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.text.Format;
|
||||
import javax.swing.JFormattedTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyFormattedTextField extends JFormattedTextField {
|
||||
|
||||
public MyFormattedTextField(Format format) {
|
||||
super(format);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.CellRendererPane;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.substance.internal.ui.SubstanceProgressBarUI;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyProgressBarUI extends SubstanceProgressBarUI {
|
||||
|
||||
private final class MySubstanceChangeListener implements ChangeListener {
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
SubstanceCoreUtilities.testComponentStateChangeThreadingViolation(progressBar);
|
||||
|
||||
if (displayTimeline != null) { //Main Change - this should be first
|
||||
//displayTimeline.abort();
|
||||
}
|
||||
int currValue = progressBar.getValue();
|
||||
int span = progressBar.getMaximum() - progressBar.getMinimum();
|
||||
|
||||
int barRectWidth = progressBar.getWidth() - 2 * margin;
|
||||
int barRectHeight = progressBar.getHeight() - 2 * margin;
|
||||
int totalPixels = (progressBar.getOrientation() == JProgressBar.HORIZONTAL) ? barRectWidth
|
||||
: barRectHeight;
|
||||
|
||||
int pixelDelta = (span <= 0) ? 0 : (currValue - displayedValue)
|
||||
* totalPixels / span;
|
||||
|
||||
|
||||
/*displayTimeline = new Timeline(progressBar);
|
||||
displayTimeline.addPropertyToInterpolate(Timeline
|
||||
.<Integer>property("displayedValue").from(displayedValue)
|
||||
.to(currValue).setWith(new TimelinePropertyBuilder.PropertySetter<Integer>() {
|
||||
@Override
|
||||
public void set(Object obj, String fieldName,
|
||||
Integer value) {
|
||||
displayedValue = value;
|
||||
progressBar.repaint();
|
||||
}
|
||||
}));
|
||||
displayTimeline.setEase(new Spline(0.4f));
|
||||
AnimationConfigurationManager.getInstance().configureTimeline(
|
||||
displayTimeline);*/
|
||||
boolean isInCellRenderer = (SwingUtilities.getAncestorOfClass(
|
||||
CellRendererPane.class, progressBar) != null);
|
||||
if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) {
|
||||
displayTimeline.play();
|
||||
} else {
|
||||
displayedValue = currValue;
|
||||
progressBar.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ComponentUI createUI(JComponent comp) {
|
||||
SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
|
||||
return new MyProgressBarUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
this.progressBar.removeChangeListener(substanceValueChangeListener);
|
||||
this.substanceValueChangeListener = new MySubstanceChangeListener();
|
||||
this.progressBar.addChangeListener(this.substanceValueChangeListener);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.CellRendererPane;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.substance.internal.ui.SubstanceProgressBarUI;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyProgressBarUI extends SubstanceProgressBarUI {
|
||||
|
||||
private final class MySubstanceChangeListener implements ChangeListener {
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
SubstanceCoreUtilities.testComponentStateChangeThreadingViolation(progressBar);
|
||||
|
||||
if (displayTimeline != null) { //Main Change - this should be first
|
||||
//displayTimeline.abort();
|
||||
}
|
||||
int currValue = progressBar.getValue();
|
||||
int span = progressBar.getMaximum() - progressBar.getMinimum();
|
||||
|
||||
int barRectWidth = progressBar.getWidth() - 2 * margin;
|
||||
int barRectHeight = progressBar.getHeight() - 2 * margin;
|
||||
int totalPixels = (progressBar.getOrientation() == JProgressBar.HORIZONTAL) ? barRectWidth
|
||||
: barRectHeight;
|
||||
|
||||
int pixelDelta = (span <= 0) ? 0 : (currValue - displayedValue)
|
||||
* totalPixels / span;
|
||||
|
||||
|
||||
/*displayTimeline = new Timeline(progressBar);
|
||||
displayTimeline.addPropertyToInterpolate(Timeline
|
||||
.<Integer>property("displayedValue").from(displayedValue)
|
||||
.to(currValue).setWith(new TimelinePropertyBuilder.PropertySetter<Integer>() {
|
||||
@Override
|
||||
public void set(Object obj, String fieldName,
|
||||
Integer value) {
|
||||
displayedValue = value;
|
||||
progressBar.repaint();
|
||||
}
|
||||
}));
|
||||
displayTimeline.setEase(new Spline(0.4f));
|
||||
AnimationConfigurationManager.getInstance().configureTimeline(
|
||||
displayTimeline);*/
|
||||
boolean isInCellRenderer = (SwingUtilities.getAncestorOfClass(
|
||||
CellRendererPane.class, progressBar) != null);
|
||||
if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) {
|
||||
displayTimeline.play();
|
||||
} else {
|
||||
displayedValue = currValue;
|
||||
progressBar.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ComponentUI createUI(JComponent comp) {
|
||||
SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp);
|
||||
return new MyProgressBarUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
this.progressBar.removeChangeListener(substanceValueChangeListener);
|
||||
this.substanceValueChangeListener = new MySubstanceChangeListener();
|
||||
this.progressBar.addChangeListener(this.substanceValueChangeListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,95 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.Icon;
|
||||
import org.pushingpixels.flamingo.internal.utils.FlamingoUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyResizableIcon implements Icon {
|
||||
|
||||
protected BufferedImage originalImage;
|
||||
protected Map<String, BufferedImage> cachedImages = new HashMap<>();
|
||||
|
||||
public MyResizableIcon(BufferedImage originalImage) {
|
||||
this.originalImage = originalImage;
|
||||
width = originalImage.getWidth();
|
||||
height = originalImage.getHeight();
|
||||
}
|
||||
|
||||
protected int width;
|
||||
protected int height;
|
||||
protected BufferedImage image;
|
||||
|
||||
public void setDimension(Dimension dim) {
|
||||
setIconSize(dim.width, dim.height);
|
||||
}
|
||||
|
||||
public void setIconSize(int renderWidth, int renderHeight) {
|
||||
width = renderWidth;
|
||||
height = renderHeight;
|
||||
String key = renderWidth + ":" + renderHeight;
|
||||
if (this.cachedImages.containsKey(key)) {
|
||||
image = this.cachedImages.get(key);
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedImage result = originalImage;
|
||||
float scaleX = (float) originalImage.getWidth()
|
||||
/ (float) renderWidth;
|
||||
float scaleY = (float) originalImage.getHeight()
|
||||
/ (float) renderHeight;
|
||||
|
||||
float scale = Math.max(scaleX, scaleY);
|
||||
if (scale > 1.0f) {
|
||||
int finalWidth = (int) (originalImage.getWidth() / scale);
|
||||
result = FlamingoUtilities.createThumbnail(originalImage,
|
||||
finalWidth);
|
||||
}
|
||||
cachedImages.put(renderWidth + ":" + renderHeight, result);
|
||||
image = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
if (image != null) {
|
||||
int dx = (this.width - image.getWidth()) / 2;
|
||||
int dy = (this.height - image.getHeight()) / 2;
|
||||
g.drawImage(image, x + dx, y + dy, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.Icon;
|
||||
import org.pushingpixels.flamingo.internal.utils.FlamingoUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyResizableIcon implements Icon {
|
||||
|
||||
protected BufferedImage originalImage;
|
||||
protected Map<String, BufferedImage> cachedImages = new HashMap<>();
|
||||
|
||||
public MyResizableIcon(BufferedImage originalImage) {
|
||||
this.originalImage = originalImage;
|
||||
width = originalImage.getWidth();
|
||||
height = originalImage.getHeight();
|
||||
}
|
||||
|
||||
protected int width;
|
||||
protected int height;
|
||||
protected BufferedImage image;
|
||||
|
||||
public void setDimension(Dimension dim) {
|
||||
setIconSize(dim.width, dim.height);
|
||||
}
|
||||
|
||||
public void setIconSize(int renderWidth, int renderHeight) {
|
||||
width = renderWidth;
|
||||
height = renderHeight;
|
||||
String key = renderWidth + ":" + renderHeight;
|
||||
if (this.cachedImages.containsKey(key)) {
|
||||
image = this.cachedImages.get(key);
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedImage result = originalImage;
|
||||
float scaleX = (float) originalImage.getWidth()
|
||||
/ (float) renderWidth;
|
||||
float scaleY = (float) originalImage.getHeight()
|
||||
/ (float) renderHeight;
|
||||
|
||||
float scale = Math.max(scaleX, scaleY);
|
||||
if (scale > 1.0f) {
|
||||
int finalWidth = (int) (originalImage.getWidth() / scale);
|
||||
result = FlamingoUtilities.createThumbnail(originalImage,
|
||||
finalWidth);
|
||||
}
|
||||
cachedImages.put(renderWidth + ":" + renderHeight, result);
|
||||
image = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
if (image != null) {
|
||||
int dx = (this.width - image.getWidth()) / 2;
|
||||
int dy = (this.height - image.getHeight()) / 2;
|
||||
g.drawImage(image, x + dx, y + dy, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,232 +1,232 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.flamingo.api.common.model.PopupButtonModel;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.BasicRibbonApplicationMenuButtonUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
||||
import org.pushingpixels.lafwidget.animation.effects.GhostingListener;
|
||||
import org.pushingpixels.substance.flamingo.common.ui.ActionPopupTransitionAwareUI;
|
||||
import org.pushingpixels.substance.flamingo.utils.CommandButtonVisualStateTracker;
|
||||
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
|
||||
|
||||
/**
|
||||
* UI for {@link JRibbonApplicationMenuButton} components in <b>Substance</b>
|
||||
* look and feel.
|
||||
*
|
||||
* @author Kirill Grouchnikov
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuButtonUI implements
|
||||
ActionPopupTransitionAwareUI {
|
||||
|
||||
private MyResizableIcon hoverIcon = null;
|
||||
private MyResizableIcon clickIcon = null;
|
||||
private MyResizableIcon normalIcon = null;
|
||||
private final boolean buttonResized = false;
|
||||
|
||||
public MyResizableIcon getClickIcon() {
|
||||
return clickIcon;
|
||||
}
|
||||
|
||||
public MyRibbonApplicationMenuButtonUI() {
|
||||
super();
|
||||
hoverIcon = View.getMyResizableIcon("buttonicon_hover_256");
|
||||
normalIcon = View.getMyResizableIcon("buttonicon_256");
|
||||
clickIcon = View.getMyResizableIcon("buttonicon_down_256");
|
||||
}
|
||||
|
||||
/**
|
||||
* Model change listener for ghost image effects.
|
||||
*/
|
||||
private GhostingListener substanceModelChangeListener;
|
||||
/**
|
||||
* Tracker for visual state transitions.
|
||||
*/
|
||||
protected CommandButtonVisualStateTracker substanceVisualStateTracker;
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new MyRibbonApplicationMenuButtonUI();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.jvnet.flamingo.common.ui.BasicCommandButtonUI#installListeners()
|
||||
*/
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
this.substanceVisualStateTracker = new CommandButtonVisualStateTracker();
|
||||
this.substanceVisualStateTracker.installListeners(this.commandButton);
|
||||
|
||||
this.substanceModelChangeListener = new GhostingListener(
|
||||
this.commandButton, this.commandButton.getActionModel());
|
||||
this.substanceModelChangeListener.registerListeners();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.common.ui.BasicCommandButtonUI#uninstallListeners()
|
||||
*/
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
this.substanceVisualStateTracker.uninstallListeners(this.commandButton);
|
||||
this.substanceVisualStateTracker = null;
|
||||
|
||||
this.substanceModelChangeListener.unregisterListeners();
|
||||
this.substanceModelChangeListener = null;
|
||||
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
private void updateIcons(JComponent c) {
|
||||
|
||||
Dimension dim = c.getPreferredSize();
|
||||
hoverIcon.setDimension(dim);
|
||||
clickIcon.setDimension(dim);
|
||||
normalIcon.setDimension(dim);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see javax.swing.plaf.basic.BasicButtonUI#paint(java.awt.Graphics,
|
||||
* javax.swing.JComponent)
|
||||
*/
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
JRibbonApplicationMenuButton b = (JRibbonApplicationMenuButton) c;
|
||||
|
||||
updateIcons(c);
|
||||
|
||||
this.layoutInfo = this.layoutManager.getLayoutInfo(this.commandButton, g);
|
||||
commandButton.putClientProperty("icon.bounds", layoutInfo.iconRect);
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
|
||||
// Paint the icon
|
||||
Icon icon = getCurrentIcon(b);
|
||||
|
||||
if (icon != null) {
|
||||
paintButtonIcon(g2d);
|
||||
}
|
||||
|
||||
g2d.dispose();
|
||||
}
|
||||
|
||||
private Icon getCurrentIcon(JRibbonApplicationMenuButton button) {
|
||||
PopupButtonModel mod = button.getPopupModel();
|
||||
if (mod.isPopupShowing()) {
|
||||
if (clickIcon != null) {
|
||||
return clickIcon;
|
||||
}
|
||||
}
|
||||
if (mod.isRollover()) {
|
||||
if (hoverIcon != null) {
|
||||
return hoverIcon;
|
||||
}
|
||||
}
|
||||
if (normalIcon != null) {
|
||||
return normalIcon;
|
||||
}
|
||||
return button.getIcon();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.common.ui.BasicCommandButtonUI#paintButtonIcon(java
|
||||
* .awt.Graphics, java.awt.Rectangle)
|
||||
*/
|
||||
protected void paintButtonIcon(Graphics g) {
|
||||
Icon regular = getCurrentIcon(this.applicationMenuButton);
|
||||
if (regular == null) {
|
||||
return;
|
||||
}
|
||||
if (regular != null) {
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
regular.paintIcon(this.applicationMenuButton, g2d, 0, 0);
|
||||
g2d.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.ribbon.ui.appmenu.BasicRibbonApplicationMenuButtonUI
|
||||
* #update(java.awt.Graphics, javax.swing.JComponent)
|
||||
*/
|
||||
@Override
|
||||
public void update(Graphics g, JComponent c) {
|
||||
this.paint(g, c);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.substance.SubstanceButtonUI#contains(javax.swing.JComponent,
|
||||
* int, int)
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(JComponent c, int x, int y) {
|
||||
// allow clicking anywhere in the area (around the button
|
||||
// round outline as well) to activate the button.
|
||||
return (x >= 0) && (x < c.getWidth()) && (y >= 0)
|
||||
&& (y < c.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getActionTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getActionStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getPopupTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getPopupStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getPopupStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInside(MouseEvent me) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.flamingo.api.common.model.PopupButtonModel;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.BasicRibbonApplicationMenuButtonUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
||||
import org.pushingpixels.lafwidget.animation.effects.GhostingListener;
|
||||
import org.pushingpixels.substance.flamingo.common.ui.ActionPopupTransitionAwareUI;
|
||||
import org.pushingpixels.substance.flamingo.utils.CommandButtonVisualStateTracker;
|
||||
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
|
||||
|
||||
/**
|
||||
* UI for {@link JRibbonApplicationMenuButton} components in <b>Substance</b>
|
||||
* look and feel.
|
||||
*
|
||||
* @author Kirill Grouchnikov
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuButtonUI implements
|
||||
ActionPopupTransitionAwareUI {
|
||||
|
||||
private MyResizableIcon hoverIcon = null;
|
||||
private MyResizableIcon clickIcon = null;
|
||||
private MyResizableIcon normalIcon = null;
|
||||
private final boolean buttonResized = false;
|
||||
|
||||
public MyResizableIcon getClickIcon() {
|
||||
return clickIcon;
|
||||
}
|
||||
|
||||
public MyRibbonApplicationMenuButtonUI() {
|
||||
super();
|
||||
hoverIcon = View.getMyResizableIcon("buttonicon_hover_256");
|
||||
normalIcon = View.getMyResizableIcon("buttonicon_256");
|
||||
clickIcon = View.getMyResizableIcon("buttonicon_down_256");
|
||||
}
|
||||
|
||||
/**
|
||||
* Model change listener for ghost image effects.
|
||||
*/
|
||||
private GhostingListener substanceModelChangeListener;
|
||||
/**
|
||||
* Tracker for visual state transitions.
|
||||
*/
|
||||
protected CommandButtonVisualStateTracker substanceVisualStateTracker;
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new MyRibbonApplicationMenuButtonUI();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.jvnet.flamingo.common.ui.BasicCommandButtonUI#installListeners()
|
||||
*/
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
this.substanceVisualStateTracker = new CommandButtonVisualStateTracker();
|
||||
this.substanceVisualStateTracker.installListeners(this.commandButton);
|
||||
|
||||
this.substanceModelChangeListener = new GhostingListener(
|
||||
this.commandButton, this.commandButton.getActionModel());
|
||||
this.substanceModelChangeListener.registerListeners();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.common.ui.BasicCommandButtonUI#uninstallListeners()
|
||||
*/
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
this.substanceVisualStateTracker.uninstallListeners(this.commandButton);
|
||||
this.substanceVisualStateTracker = null;
|
||||
|
||||
this.substanceModelChangeListener.unregisterListeners();
|
||||
this.substanceModelChangeListener = null;
|
||||
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
private void updateIcons(JComponent c) {
|
||||
|
||||
Dimension dim = c.getPreferredSize();
|
||||
hoverIcon.setDimension(dim);
|
||||
clickIcon.setDimension(dim);
|
||||
normalIcon.setDimension(dim);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see javax.swing.plaf.basic.BasicButtonUI#paint(java.awt.Graphics,
|
||||
* javax.swing.JComponent)
|
||||
*/
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
JRibbonApplicationMenuButton b = (JRibbonApplicationMenuButton) c;
|
||||
|
||||
updateIcons(c);
|
||||
|
||||
this.layoutInfo = this.layoutManager.getLayoutInfo(this.commandButton, g);
|
||||
commandButton.putClientProperty("icon.bounds", layoutInfo.iconRect);
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
|
||||
// Paint the icon
|
||||
Icon icon = getCurrentIcon(b);
|
||||
|
||||
if (icon != null) {
|
||||
paintButtonIcon(g2d);
|
||||
}
|
||||
|
||||
g2d.dispose();
|
||||
}
|
||||
|
||||
private Icon getCurrentIcon(JRibbonApplicationMenuButton button) {
|
||||
PopupButtonModel mod = button.getPopupModel();
|
||||
if (mod.isPopupShowing()) {
|
||||
if (clickIcon != null) {
|
||||
return clickIcon;
|
||||
}
|
||||
}
|
||||
if (mod.isRollover()) {
|
||||
if (hoverIcon != null) {
|
||||
return hoverIcon;
|
||||
}
|
||||
}
|
||||
if (normalIcon != null) {
|
||||
return normalIcon;
|
||||
}
|
||||
return button.getIcon();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.common.ui.BasicCommandButtonUI#paintButtonIcon(java
|
||||
* .awt.Graphics, java.awt.Rectangle)
|
||||
*/
|
||||
protected void paintButtonIcon(Graphics g) {
|
||||
Icon regular = getCurrentIcon(this.applicationMenuButton);
|
||||
if (regular == null) {
|
||||
return;
|
||||
}
|
||||
if (regular != null) {
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
regular.paintIcon(this.applicationMenuButton, g2d, 0, 0);
|
||||
g2d.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.flamingo.ribbon.ui.appmenu.BasicRibbonApplicationMenuButtonUI
|
||||
* #update(java.awt.Graphics, javax.swing.JComponent)
|
||||
*/
|
||||
@Override
|
||||
public void update(Graphics g, JComponent c) {
|
||||
this.paint(g, c);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.jvnet.substance.SubstanceButtonUI#contains(javax.swing.JComponent,
|
||||
* int, int)
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(JComponent c, int x, int y) {
|
||||
// allow clicking anywhere in the area (around the button
|
||||
// round outline as well) to activate the button.
|
||||
return (x >= 0) && (x < c.getWidth()) && (y >= 0)
|
||||
&& (y < c.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getActionTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getActionStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getPopupTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getPopupStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StateTransitionTracker getTransitionTracker() {
|
||||
return this.substanceVisualStateTracker
|
||||
.getPopupStateTransitionTracker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInside(MouseEvent me) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,167 +1,167 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import javax.swing.CellRendererPane;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.BasicRibbonApplicationMenuPopupPanelUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
||||
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
|
||||
import org.pushingpixels.substance.api.ComponentState;
|
||||
import org.pushingpixels.substance.api.SubstanceColorScheme;
|
||||
import org.pushingpixels.substance.internal.painter.HighlightPainterUtils;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceSizeUtils;
|
||||
import org.pushingpixels.substance.internal.utils.border.SubstanceBorder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyRibbonApplicationMenuPopupPanelUI extends BasicRibbonApplicationMenuPopupPanelUI {
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new MyRibbonApplicationMenuPopupPanelUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents() {
|
||||
super.installComponents();
|
||||
Border newBorder = new CompoundBorder(new SubstanceBorder(new Insets(2,
|
||||
2, 2, 2)), new Border() {
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(18, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
SubstanceColorScheme bgFillScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(c,
|
||||
ColorSchemeAssociationKind.HIGHLIGHT,
|
||||
ComponentState.ENABLED);
|
||||
SubstanceColorScheme bgBorderScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(c,
|
||||
ColorSchemeAssociationKind.HIGHLIGHT_BORDER,
|
||||
ComponentState.ENABLED);
|
||||
HighlightPainterUtils.paintHighlight(g, null, c, new Rectangle(
|
||||
x, y, width, height), 0.0f, null, bgFillScheme,
|
||||
bgBorderScheme);
|
||||
|
||||
// draw the application menu button
|
||||
JRibbonApplicationMenuButton rendererButton = new JRibbonApplicationMenuButton(
|
||||
applicationMenuPopupPanel.getAppMenuButton()
|
||||
.getRibbon());
|
||||
|
||||
JRibbonApplicationMenuButton appMenuButton = applicationMenuPopupPanel
|
||||
.getAppMenuButton();
|
||||
rendererButton.applyComponentOrientation(appMenuButton
|
||||
.getComponentOrientation());
|
||||
|
||||
rendererButton.setPopupKeyTip(appMenuButton.getPopupKeyTip());
|
||||
rendererButton.getPopupModel().setPopupShowing(true);
|
||||
rendererButton.setDisplayState(appMenuButton.getDisplayState());
|
||||
|
||||
rendererButton.getPopupModel().setRollover(false);
|
||||
rendererButton.getPopupModel().setPressed(true);
|
||||
rendererButton.getPopupModel().setArmed(true);
|
||||
|
||||
CellRendererPane buttonRendererPane = new CellRendererPane();
|
||||
Point buttonLoc = appMenuButton.getLocationOnScreen();
|
||||
Point panelLoc = c.getLocationOnScreen();
|
||||
|
||||
buttonRendererPane.setBounds(panelLoc.x - buttonLoc.x,
|
||||
panelLoc.y - buttonLoc.y, appMenuButton.getWidth(),
|
||||
appMenuButton.getHeight());
|
||||
|
||||
buttonRendererPane.paintComponent(g, rendererButton,
|
||||
(Container) c, -panelLoc.x + buttonLoc.x, -panelLoc.y
|
||||
+ buttonLoc.y, appMenuButton.getWidth(),
|
||||
appMenuButton.getHeight(), true);
|
||||
/*g.setColor(Color.red);
|
||||
g.fillRect(0, 0, width,height);*/
|
||||
}
|
||||
});
|
||||
this.applicationMenuPopupPanel.setBorder(newBorder);
|
||||
|
||||
this.panelLevel2.setBorder(new Border() {
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
boolean ltr = c.getComponentOrientation().isLeftToRight();
|
||||
return new Insets(0, ltr ? 1 : 0, 0, ltr ? 0 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
int componentFontSize = SubstanceSizeUtils
|
||||
.getComponentFontSize(null);
|
||||
int borderDelta = (int) Math.floor(SubstanceSizeUtils
|
||||
.getBorderStrokeWidth(componentFontSize) / 2.0);
|
||||
float borderThickness = SubstanceSizeUtils
|
||||
.getBorderStrokeWidth(componentFontSize);
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(applicationMenuPopupPanel,
|
||||
ColorSchemeAssociationKind.BORDER,
|
||||
ComponentState.ENABLED);
|
||||
g2d.setColor(scheme.getMidColor());
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
int joinKind = BasicStroke.JOIN_ROUND;
|
||||
int capKind = BasicStroke.CAP_BUTT;
|
||||
g2d.setStroke(new BasicStroke(borderThickness, capKind,
|
||||
joinKind));
|
||||
|
||||
boolean ltr = applicationMenuPopupPanel
|
||||
.getComponentOrientation().isLeftToRight();
|
||||
int lineX = ltr ? borderDelta : c.getWidth() - borderDelta - 1;
|
||||
g2d.drawLine(lineX, borderDelta, lineX, height - 1 - 2
|
||||
* borderDelta);
|
||||
|
||||
g2d.dispose();
|
||||
}
|
||||
});
|
||||
this.mainPanel.setBorder(new SubstanceBorder());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import javax.swing.CellRendererPane;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.BasicRibbonApplicationMenuPopupPanelUI;
|
||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
||||
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
|
||||
import org.pushingpixels.substance.api.ComponentState;
|
||||
import org.pushingpixels.substance.api.SubstanceColorScheme;
|
||||
import org.pushingpixels.substance.internal.painter.HighlightPainterUtils;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities;
|
||||
import org.pushingpixels.substance.internal.utils.SubstanceSizeUtils;
|
||||
import org.pushingpixels.substance.internal.utils.border.SubstanceBorder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyRibbonApplicationMenuPopupPanelUI extends BasicRibbonApplicationMenuPopupPanelUI {
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new MyRibbonApplicationMenuPopupPanelUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents() {
|
||||
super.installComponents();
|
||||
Border newBorder = new CompoundBorder(new SubstanceBorder(new Insets(2,
|
||||
2, 2, 2)), new Border() {
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(18, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
SubstanceColorScheme bgFillScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(c,
|
||||
ColorSchemeAssociationKind.HIGHLIGHT,
|
||||
ComponentState.ENABLED);
|
||||
SubstanceColorScheme bgBorderScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(c,
|
||||
ColorSchemeAssociationKind.HIGHLIGHT_BORDER,
|
||||
ComponentState.ENABLED);
|
||||
HighlightPainterUtils.paintHighlight(g, null, c, new Rectangle(
|
||||
x, y, width, height), 0.0f, null, bgFillScheme,
|
||||
bgBorderScheme);
|
||||
|
||||
// draw the application menu button
|
||||
JRibbonApplicationMenuButton rendererButton = new JRibbonApplicationMenuButton(
|
||||
applicationMenuPopupPanel.getAppMenuButton()
|
||||
.getRibbon());
|
||||
|
||||
JRibbonApplicationMenuButton appMenuButton = applicationMenuPopupPanel
|
||||
.getAppMenuButton();
|
||||
rendererButton.applyComponentOrientation(appMenuButton
|
||||
.getComponentOrientation());
|
||||
|
||||
rendererButton.setPopupKeyTip(appMenuButton.getPopupKeyTip());
|
||||
rendererButton.getPopupModel().setPopupShowing(true);
|
||||
rendererButton.setDisplayState(appMenuButton.getDisplayState());
|
||||
|
||||
rendererButton.getPopupModel().setRollover(false);
|
||||
rendererButton.getPopupModel().setPressed(true);
|
||||
rendererButton.getPopupModel().setArmed(true);
|
||||
|
||||
CellRendererPane buttonRendererPane = new CellRendererPane();
|
||||
Point buttonLoc = appMenuButton.getLocationOnScreen();
|
||||
Point panelLoc = c.getLocationOnScreen();
|
||||
|
||||
buttonRendererPane.setBounds(panelLoc.x - buttonLoc.x,
|
||||
panelLoc.y - buttonLoc.y, appMenuButton.getWidth(),
|
||||
appMenuButton.getHeight());
|
||||
|
||||
buttonRendererPane.paintComponent(g, rendererButton,
|
||||
(Container) c, -panelLoc.x + buttonLoc.x, -panelLoc.y
|
||||
+ buttonLoc.y, appMenuButton.getWidth(),
|
||||
appMenuButton.getHeight(), true);
|
||||
/*g.setColor(Color.red);
|
||||
g.fillRect(0, 0, width,height);*/
|
||||
}
|
||||
});
|
||||
this.applicationMenuPopupPanel.setBorder(newBorder);
|
||||
|
||||
this.panelLevel2.setBorder(new Border() {
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
boolean ltr = c.getComponentOrientation().isLeftToRight();
|
||||
return new Insets(0, ltr ? 1 : 0, 0, ltr ? 0 : 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
int componentFontSize = SubstanceSizeUtils
|
||||
.getComponentFontSize(null);
|
||||
int borderDelta = (int) Math.floor(SubstanceSizeUtils
|
||||
.getBorderStrokeWidth(componentFontSize) / 2.0);
|
||||
float borderThickness = SubstanceSizeUtils
|
||||
.getBorderStrokeWidth(componentFontSize);
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g.create();
|
||||
SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(applicationMenuPopupPanel,
|
||||
ColorSchemeAssociationKind.BORDER,
|
||||
ComponentState.ENABLED);
|
||||
g2d.setColor(scheme.getMidColor());
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
|
||||
RenderingHints.VALUE_STROKE_NORMALIZE);
|
||||
int joinKind = BasicStroke.JOIN_ROUND;
|
||||
int capKind = BasicStroke.CAP_BUTT;
|
||||
g2d.setStroke(new BasicStroke(borderThickness, capKind,
|
||||
joinKind));
|
||||
|
||||
boolean ltr = applicationMenuPopupPanel
|
||||
.getComponentOrientation().isLeftToRight();
|
||||
int lineX = ltr ? borderDelta : c.getWidth() - borderDelta - 1;
|
||||
g2d.drawLine(lineX, borderDelta, lineX, height - 1 - 2
|
||||
* borderDelta);
|
||||
|
||||
g2d.dispose();
|
||||
}
|
||||
});
|
||||
this.mainPanel.setBorder(new SubstanceBorder());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyTextField extends JTextField {
|
||||
|
||||
public MyTextField() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public MyTextField(String text) {
|
||||
super(text);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MyTextField extends JTextField {
|
||||
|
||||
public MyTextField() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public MyTextField(String text) {
|
||||
super(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum OpenFileResult {
|
||||
|
||||
OK,
|
||||
NOT_FOUND,
|
||||
ERROR
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum OpenFileResult {
|
||||
|
||||
OK,
|
||||
NOT_FOUND,
|
||||
ERROR
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface PlayerListener {
|
||||
|
||||
public void playingFinished();
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface PlayerListener {
|
||||
|
||||
public void playingFinished();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class RecentFilesButton extends JCommandButton {
|
||||
|
||||
public String fileName;
|
||||
|
||||
public RecentFilesButton(String title, ResizableIcon icon) {
|
||||
super(title, icon);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class RecentFilesButton extends JCommandButton {
|
||||
|
||||
public String fileName;
|
||||
|
||||
public RecentFilesButton(String title, ResizableIcon icon) {
|
||||
super(title, icon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum SaveFileMode {
|
||||
|
||||
SAVE, SAVEAS, EXE
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public enum SaveFileMode {
|
||||
|
||||
SAVE, SAVEAS, EXE
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
* @param <E>
|
||||
*/
|
||||
public interface SearchListener<E> {
|
||||
|
||||
public void updateSearchPos(E item);
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
* @param <E>
|
||||
*/
|
||||
public interface SearchListener<E> {
|
||||
|
||||
public void updateSearchPos(E item);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* Copyright (C) 2014-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,196 +1,196 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* FlowLayout subclass that fully supports wrapping of components.
|
||||
*
|
||||
* Taken from: http://tips4java.wordpress.com/2008/11/06/wrap-layout/
|
||||
*/
|
||||
public class WrapLayout extends FlowLayout {
|
||||
|
||||
private Dimension preferredLayoutSize;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>WrapLayout</code> with a left alignment and a
|
||||
* default 5-unit horizontal and vertical gap.
|
||||
*/
|
||||
public WrapLayout() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FlowLayout</code> with the specified alignment and
|
||||
* a default 5-unit horizontal and vertical gap. The value of the alignment
|
||||
* argument must be one of <code>WrapLayout</code>, <code>WrapLayout</code>,
|
||||
* or <code>WrapLayout</code>.
|
||||
*
|
||||
* @param align the alignment value
|
||||
*/
|
||||
public WrapLayout(int align) {
|
||||
super(align);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new flow layout manager with the indicated alignment and the
|
||||
* indicated horizontal and vertical gaps.
|
||||
* <p>
|
||||
* The value of the alignment argument must be one of
|
||||
* <code>WrapLayout</code>, <code>WrapLayout</code>, or
|
||||
* <code>WrapLayout</code>.
|
||||
*
|
||||
* @param align the alignment value
|
||||
* @param hgap the horizontal gap between components
|
||||
* @param vgap the vertical gap between components
|
||||
*/
|
||||
public WrapLayout(int align, int hgap, int vgap) {
|
||||
super(align, hgap, vgap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred dimensions for this layout given the
|
||||
* <i>visible</i> components in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
* @return the preferred dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container target) {
|
||||
return layoutSize(target, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum dimensions needed to layout the <i>visible</i>
|
||||
* components contained in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
* @return the minimum dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container target) {
|
||||
Dimension minimum = layoutSize(target, false);
|
||||
minimum.width -= (getHgap() + 1);
|
||||
return minimum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum or preferred dimension needed to layout the target
|
||||
* container.
|
||||
*
|
||||
* @param target target to get layout size for
|
||||
* @param preferred should preferred size be calculated
|
||||
* @return the dimension to layout the target container
|
||||
*/
|
||||
private Dimension layoutSize(Container target, boolean preferred) {
|
||||
synchronized (target.getTreeLock()) {
|
||||
// Each row must fit with the width allocated to the containter.
|
||||
// When the container width = 0, the preferred width of the container
|
||||
// has not yet been calculated so lets ask for the maximum.
|
||||
|
||||
int targetWidth = target.getSize().width;
|
||||
|
||||
if (targetWidth == 0) {
|
||||
targetWidth = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
int hgap = getHgap();
|
||||
int vgap = getVgap();
|
||||
Insets insets = target.getInsets();
|
||||
int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
|
||||
int maxWidth = targetWidth - horizontalInsetsAndGap;
|
||||
|
||||
// Fit components into the allowed width
|
||||
Dimension dim = new Dimension(0, 0);
|
||||
int rowWidth = 0;
|
||||
int rowHeight = 0;
|
||||
|
||||
int nmembers = target.getComponentCount();
|
||||
|
||||
for (int i = 0; i < nmembers; i++) {
|
||||
Component m = target.getComponent(i);
|
||||
|
||||
if (m.isVisible()) {
|
||||
Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
|
||||
|
||||
// Can't add the component to current row. Start a new row.
|
||||
if (rowWidth + d.width > maxWidth) {
|
||||
addRow(dim, rowWidth, rowHeight);
|
||||
rowWidth = 0;
|
||||
rowHeight = 0;
|
||||
}
|
||||
|
||||
// Add a horizontal gap for all components after the first
|
||||
if (rowWidth != 0) {
|
||||
rowWidth += hgap;
|
||||
}
|
||||
|
||||
rowWidth += d.width;
|
||||
rowHeight = Math.max(rowHeight, d.height);
|
||||
}
|
||||
}
|
||||
|
||||
addRow(dim, rowWidth, rowHeight);
|
||||
|
||||
dim.width += horizontalInsetsAndGap;
|
||||
dim.height += insets.top + insets.bottom + vgap * 2;
|
||||
|
||||
// When using a scroll pane or the DecoratedLookAndFeel we need to
|
||||
// make sure the preferred size is less than the size of the
|
||||
// target containter so shrinking the container size works
|
||||
// correctly. Removing the horizontal gap is an easy way to do this.
|
||||
Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
|
||||
|
||||
if (scrollPane != null && target.isValid()) {
|
||||
dim.width -= (hgap + 1);
|
||||
}
|
||||
|
||||
return dim;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A new row has been completed. Use the dimensions of this row
|
||||
* to update the preferred size for the container.
|
||||
*
|
||||
* @param dim update the width and height when appropriate
|
||||
* @param rowWidth the width of the row to add
|
||||
* @param rowHeight the height of the row to add
|
||||
*/
|
||||
private void addRow(Dimension dim, int rowWidth, int rowHeight) {
|
||||
dim.width = Math.max(dim.width, rowWidth);
|
||||
|
||||
if (dim.height > 0) {
|
||||
dim.height += getVgap();
|
||||
}
|
||||
|
||||
dim.height += rowHeight;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* FlowLayout subclass that fully supports wrapping of components.
|
||||
*
|
||||
* Taken from: http://tips4java.wordpress.com/2008/11/06/wrap-layout/
|
||||
*/
|
||||
public class WrapLayout extends FlowLayout {
|
||||
|
||||
private Dimension preferredLayoutSize;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>WrapLayout</code> with a left alignment and a
|
||||
* default 5-unit horizontal and vertical gap.
|
||||
*/
|
||||
public WrapLayout() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FlowLayout</code> with the specified alignment and
|
||||
* a default 5-unit horizontal and vertical gap. The value of the alignment
|
||||
* argument must be one of <code>WrapLayout</code>, <code>WrapLayout</code>,
|
||||
* or <code>WrapLayout</code>.
|
||||
*
|
||||
* @param align the alignment value
|
||||
*/
|
||||
public WrapLayout(int align) {
|
||||
super(align);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new flow layout manager with the indicated alignment and the
|
||||
* indicated horizontal and vertical gaps.
|
||||
* <p>
|
||||
* The value of the alignment argument must be one of
|
||||
* <code>WrapLayout</code>, <code>WrapLayout</code>, or
|
||||
* <code>WrapLayout</code>.
|
||||
*
|
||||
* @param align the alignment value
|
||||
* @param hgap the horizontal gap between components
|
||||
* @param vgap the vertical gap between components
|
||||
*/
|
||||
public WrapLayout(int align, int hgap, int vgap) {
|
||||
super(align, hgap, vgap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preferred dimensions for this layout given the
|
||||
* <i>visible</i> components in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
* @return the preferred dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container target) {
|
||||
return layoutSize(target, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum dimensions needed to layout the <i>visible</i>
|
||||
* components contained in the specified target container.
|
||||
*
|
||||
* @param target the component which needs to be laid out
|
||||
* @return the minimum dimensions to lay out the subcomponents of the
|
||||
* specified container
|
||||
*/
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container target) {
|
||||
Dimension minimum = layoutSize(target, false);
|
||||
minimum.width -= (getHgap() + 1);
|
||||
return minimum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum or preferred dimension needed to layout the target
|
||||
* container.
|
||||
*
|
||||
* @param target target to get layout size for
|
||||
* @param preferred should preferred size be calculated
|
||||
* @return the dimension to layout the target container
|
||||
*/
|
||||
private Dimension layoutSize(Container target, boolean preferred) {
|
||||
synchronized (target.getTreeLock()) {
|
||||
// Each row must fit with the width allocated to the containter.
|
||||
// When the container width = 0, the preferred width of the container
|
||||
// has not yet been calculated so lets ask for the maximum.
|
||||
|
||||
int targetWidth = target.getSize().width;
|
||||
|
||||
if (targetWidth == 0) {
|
||||
targetWidth = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
int hgap = getHgap();
|
||||
int vgap = getVgap();
|
||||
Insets insets = target.getInsets();
|
||||
int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
|
||||
int maxWidth = targetWidth - horizontalInsetsAndGap;
|
||||
|
||||
// Fit components into the allowed width
|
||||
Dimension dim = new Dimension(0, 0);
|
||||
int rowWidth = 0;
|
||||
int rowHeight = 0;
|
||||
|
||||
int nmembers = target.getComponentCount();
|
||||
|
||||
for (int i = 0; i < nmembers; i++) {
|
||||
Component m = target.getComponent(i);
|
||||
|
||||
if (m.isVisible()) {
|
||||
Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
|
||||
|
||||
// Can't add the component to current row. Start a new row.
|
||||
if (rowWidth + d.width > maxWidth) {
|
||||
addRow(dim, rowWidth, rowHeight);
|
||||
rowWidth = 0;
|
||||
rowHeight = 0;
|
||||
}
|
||||
|
||||
// Add a horizontal gap for all components after the first
|
||||
if (rowWidth != 0) {
|
||||
rowWidth += hgap;
|
||||
}
|
||||
|
||||
rowWidth += d.width;
|
||||
rowHeight = Math.max(rowHeight, d.height);
|
||||
}
|
||||
}
|
||||
|
||||
addRow(dim, rowWidth, rowHeight);
|
||||
|
||||
dim.width += horizontalInsetsAndGap;
|
||||
dim.height += insets.top + insets.bottom + vgap * 2;
|
||||
|
||||
// When using a scroll pane or the DecoratedLookAndFeel we need to
|
||||
// make sure the preferred size is less than the size of the
|
||||
// target containter so shrinking the container size works
|
||||
// correctly. Removing the horizontal gap is an easy way to do this.
|
||||
Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
|
||||
|
||||
if (scrollPane != null && target.isValid()) {
|
||||
dim.width -= (hgap + 1);
|
||||
}
|
||||
|
||||
return dim;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A new row has been completed. Use the dimensions of this row
|
||||
* to update the preferred size for the container.
|
||||
*
|
||||
* @param dim update the width and height when appropriate
|
||||
* @param rowWidth the width of the row to add
|
||||
* @param rowHeight the height of the row to add
|
||||
*/
|
||||
private void addRow(Dimension dim, int rowWidth, int rowHeight) {
|
||||
dim.width = Math.max(dim.width, rowWidth);
|
||||
|
||||
if (dim.height > 0) {
|
||||
dim.height += getVgap();
|
||||
}
|
||||
|
||||
dim.height += rowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
public class ABCComboBoxModel implements ComboBoxModel<ABCContainerTag> {
|
||||
|
||||
public List<ABCContainerTag> list;
|
||||
public int itemIndex = 0;
|
||||
public static final ABCContainerTag ROOT = new RootABCContainerTag();
|
||||
|
||||
public ABCComboBoxModel(List<ABCContainerTag> list) {
|
||||
this.list = list;
|
||||
Collections.sort(this.list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 1 + list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ABCContainerTag getElementAt(int index) {
|
||||
if (index == 0) {
|
||||
return ROOT;
|
||||
}
|
||||
return list.get(index - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object anItem) {
|
||||
if (anItem == ROOT) {
|
||||
itemIndex = 0;
|
||||
} else {
|
||||
itemIndex = 1 + list.indexOf(anItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ABCContainerTag getSelectedItem() {
|
||||
return getElementAt(itemIndex);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.abc;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
public class ABCComboBoxModel implements ComboBoxModel<ABCContainerTag> {
|
||||
|
||||
public List<ABCContainerTag> list;
|
||||
public int itemIndex = 0;
|
||||
public static final ABCContainerTag ROOT = new RootABCContainerTag();
|
||||
|
||||
public ABCComboBoxModel(List<ABCContainerTag> list) {
|
||||
this.list = list;
|
||||
Collections.sort(this.list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 1 + list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ABCContainerTag getElementAt(int index) {
|
||||
if (index == 0) {
|
||||
return ROOT;
|
||||
}
|
||||
return list.get(index - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object anItem) {
|
||||
if (anItem == ROOT) {
|
||||
itemIndex = 0;
|
||||
} else {
|
||||
itemIndex = 1 + list.indexOf(anItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ABCContainerTag getSelectedItem() {
|
||||
return getElementAt(itemIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS, All rights reserved.
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user