initial commit
112
src/main/java/guitartex2/AboutBox.java
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Panel;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
public class AboutBox extends JFrame implements ActionListener {
|
||||
private static final long serialVersionUID = 9143994418412032959L;
|
||||
|
||||
private final JLabel aboutLabel[];
|
||||
private static final int labelCount = 6;
|
||||
private static final int aboutWidth = 280;
|
||||
private static final int aboutHeight = 230;
|
||||
private static int aboutTop = 200;
|
||||
private static int aboutLeft = 350;
|
||||
private Font titleFont, bodyFont;
|
||||
private final ResourceBundle resbundle;
|
||||
|
||||
public AboutBox() {
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
aboutTop = Double.valueOf((screenSize.getHeight()/2) - (aboutHeight/2)).intValue();
|
||||
aboutLeft = Double.valueOf((screenSize.getWidth()/2) - (aboutWidth/2)).intValue();
|
||||
|
||||
this.setResizable(false);
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
this.getContentPane().setLayout(new BorderLayout(30, 30));
|
||||
java.net.URL imgURL = AboutBox.class.getResource("/images/gitarre1.jpg");
|
||||
ImageIcon icon = new ImageIcon(imgURL, "");
|
||||
|
||||
aboutLabel = new JLabel[labelCount];
|
||||
aboutLabel[0] = new JLabel(resbundle.getString("frameConstructor"));
|
||||
aboutLabel[0].setFont(titleFont);
|
||||
aboutLabel[1] = new JLabel(resbundle.getString("appVersion"));
|
||||
aboutLabel[1].setFont(bodyFont);
|
||||
aboutLabel[2] = new JLabel("");
|
||||
aboutLabel[3] = new JLabel("JDK " + System.getProperty("java.version"));
|
||||
aboutLabel[3].setFont(bodyFont);
|
||||
aboutLabel[4] = new JLabel(resbundle.getString("copyright"));
|
||||
aboutLabel[4].setFont(bodyFont);
|
||||
aboutLabel[5] = new JLabel("");
|
||||
|
||||
Panel imagePanel = new Panel(new GridLayout(0,1));
|
||||
imagePanel.add(new JLabel(icon));
|
||||
Panel textPanel2 = new Panel(new GridLayout(labelCount, 1));
|
||||
for (int i = 0; i<labelCount; i++) {
|
||||
aboutLabel[i].setHorizontalAlignment(JLabel.CENTER);
|
||||
textPanel2.add(aboutLabel[i]);
|
||||
}
|
||||
this.getContentPane().add (imagePanel, BorderLayout.PAGE_START);
|
||||
this.getContentPane().add (textPanel2, BorderLayout.CENTER);
|
||||
this.pack();
|
||||
this.setTitle(resbundle.getString("aboutTitle"));
|
||||
this.setLocation(aboutLeft, aboutTop);
|
||||
this.setSize(aboutWidth, aboutHeight);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
54
src/main/java/guitartex2/BareBonesBrowserLaunch.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////
|
||||
// Bare Bones Browser Launch //
|
||||
// Version 2.0 (May 26, 2009) //
|
||||
// By Dem Pilafian //
|
||||
// Supports: //
|
||||
// Mac OS X, GNU/Linux, Unix, Windows XP/Vista //
|
||||
// Example Usage: //
|
||||
// String url = "http://www.centerkey.com/"; //
|
||||
// BareBonesBrowserLaunch.openURL(url); //
|
||||
// Public Domain Software -- Free to Use as You Like //
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BareBonesBrowserLaunch {
|
||||
|
||||
static final String[] browsers = { "firefox", "opera", "konqueror", "epiphany",
|
||||
"seamonkey", "galeon", "kazehakase", "mozilla", "netscape" };
|
||||
|
||||
public static void openURL(String url) {
|
||||
String osName = System.getProperty("os.name");
|
||||
try {
|
||||
if (osName.startsWith("Mac OS")) {
|
||||
Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
|
||||
Method openURL = fileMgr.getDeclaredMethod("openURL",
|
||||
new Class[] {String.class});
|
||||
openURL.invoke(null, new Object[] {url});
|
||||
}
|
||||
else if (osName.startsWith("Windows"))
|
||||
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
|
||||
else { //assume Unix or Linux
|
||||
boolean found = false;
|
||||
for (String browser : browsers)
|
||||
if (!found) {
|
||||
found = Runtime.getRuntime().exec(
|
||||
new String[] {"which", browser}).waitFor() == 0;
|
||||
if (found)
|
||||
Runtime.getRuntime().exec(new String[] {browser, url});
|
||||
}
|
||||
if (!found)
|
||||
throw new Exception(Arrays.toString(browsers));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
JOptionPane.showMessageDialog(null,
|
||||
"Error attempting to launch web browser\n" + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
44
src/main/java/guitartex2/CmdExec.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
|
||||
public class CmdExec{
|
||||
public CmdExec () {
|
||||
|
||||
}
|
||||
|
||||
public String execute (String cmdline) {
|
||||
String ausgabe = "";
|
||||
try {
|
||||
String line;
|
||||
Process p = Runtime.getRuntime().exec(cmdline);
|
||||
try (BufferedReader input = new BufferedReader
|
||||
(new InputStreamReader(p.getInputStream()))) {
|
||||
while ((line = input.readLine()) != null) {
|
||||
ausgabe = ausgabe + line;
|
||||
}
|
||||
}
|
||||
}catch (Exception err) {
|
||||
new InfoBox("ERR: " + err);
|
||||
}
|
||||
return ausgabe;
|
||||
}
|
||||
}
|
||||
509
src/main/java/guitartex2/Configurations.java
Normal file
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
|
||||
final class Configurations {
|
||||
|
||||
private String myName = "GuitarTeX2";
|
||||
private String propertiesFileName = myName + ".properties";
|
||||
|
||||
// get systeminfo
|
||||
private String osName = System.getProperty( "os.name" );
|
||||
private String fileSeparator = System.getProperty("file.separator");
|
||||
private String userPath = System.getProperty("user.home");
|
||||
private String runPath = System.getProperty("user.dir");
|
||||
|
||||
private String pdfViewer = "";
|
||||
private String tmpDir = "";
|
||||
private String tmpDirPrefix = "gtxtmp" + fileSeparator;
|
||||
private Properties mProperties;
|
||||
private String propertiesFile;
|
||||
|
||||
private String confProblems = "";
|
||||
|
||||
private GTXConsole mConsole;
|
||||
|
||||
// Constructor
|
||||
public Configurations(GTXConsole consoleBox) {
|
||||
mProperties = new Properties();
|
||||
mConsole = consoleBox;
|
||||
|
||||
if ( osName.matches("Windows.*")) {
|
||||
mConsole.addText(osName);
|
||||
propertiesFile = windowsConfiguration();
|
||||
}
|
||||
if ( osName.matches("Linux.*")) {
|
||||
mConsole.addText("osName");
|
||||
propertiesFile = linuxConfiguration();
|
||||
}
|
||||
if ( osName.matches("Mac OS.*")) {
|
||||
mConsole.addText(osName);
|
||||
propertiesFile = macosConfiguration();
|
||||
}
|
||||
if ( osName.equals("")) {
|
||||
mConsole.addText("Unknown OS:" + osName);
|
||||
propertiesFile = defaultConfiguration();
|
||||
}
|
||||
try {
|
||||
FileInputStream propsFIS;
|
||||
if ( propertiesFile.equals("")) {
|
||||
mConsole.addText("taking default config");
|
||||
propsFIS = new FileInputStream(propertiesFile);
|
||||
mConsole.addText("loading...");
|
||||
mProperties.load( propsFIS );
|
||||
propsFIS.close();
|
||||
}else{
|
||||
mConsole.addText("taking prefered config: " + propertiesFile);
|
||||
propsFIS = new FileInputStream(propertiesFile);
|
||||
mConsole.addText("checking new entries ...");
|
||||
// Defaultwerte laden
|
||||
//File tmpFile = new File(GuitarTeX2.class.getResourceAsStream(propertiesFileName).);
|
||||
//System.out.println(tmpFile.getAbsoluteFile());
|
||||
//FileInputStream defaultPropFIS = new FileInputStream(tmpFile);
|
||||
|
||||
Properties defProps = new Properties();
|
||||
//defProps.load(defaultPropFIS);
|
||||
defProps.load(GuitarTeX2.class.getResourceAsStream("/"+propertiesFileName));
|
||||
//defaultPropFIS.close();
|
||||
Enumeration<Object> defElements = defProps.keys();
|
||||
mProperties.load( propsFIS );
|
||||
propsFIS.close();
|
||||
// Auf neue Eintrage pruefen
|
||||
boolean mustSafe = false;
|
||||
while (defElements.hasMoreElements()) {
|
||||
String key = (String)defElements.nextElement();
|
||||
if ( mProperties.getProperty(key) == null ) {
|
||||
mProperties.setProperty(key, defProps.getProperty(key));
|
||||
mustSafe = true;
|
||||
}
|
||||
}
|
||||
if ( mustSafe == true) {
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("failed to load config file: " + e);
|
||||
confProblems = confProblems + "Failed to load config file: " + e;
|
||||
}
|
||||
}
|
||||
|
||||
private String windowsConfiguration() {
|
||||
String userFileFullPath = userPath + fileSeparator + myName + fileSeparator + propertiesFileName;
|
||||
String userFileDirectory = userPath + fileSeparator + myName;
|
||||
boolean userConfigFileResult = checkFile(userFileFullPath);
|
||||
if ( userConfigFileResult == false ) {
|
||||
boolean systemConfigFileResult = checkFile(runPath + fileSeparator + myName + fileSeparator + propertiesFileName);
|
||||
if ( systemConfigFileResult == false ) {
|
||||
mConsole.addText("creating user config file...");
|
||||
try {
|
||||
if ( ! new File(userFileDirectory).exists() ) {
|
||||
new File(userFileDirectory).mkdir();
|
||||
}
|
||||
copyFile(GuitarTeX2.class.getResource(propertiesFileName), new File(userFileFullPath));
|
||||
return userFileFullPath;
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("creating user config file failed: " + e);
|
||||
return "";
|
||||
}
|
||||
}else{
|
||||
return runPath + fileSeparator + myName + fileSeparator + propertiesFileName;
|
||||
}
|
||||
}else{
|
||||
return userFileFullPath;
|
||||
}
|
||||
}
|
||||
|
||||
private String linuxConfiguration() {
|
||||
String userFileFullPath = userPath + fileSeparator + "." + myName + fileSeparator + propertiesFileName;
|
||||
String userFileDirectory = userPath + fileSeparator + "." + myName;
|
||||
boolean userConfigFileResult = checkFile(userFileFullPath);
|
||||
if ( userConfigFileResult == false ) {
|
||||
boolean systemConfigFileResult = checkFile("/etc/GuitarTeX2" + fileSeparator + propertiesFileName);
|
||||
if ( systemConfigFileResult == false ) {
|
||||
mConsole.addText("creating user config file...");
|
||||
try {
|
||||
if ( ! new File(userFileDirectory).exists() ) {
|
||||
new File(userFileDirectory).mkdir();
|
||||
}
|
||||
copyFile(GuitarTeX2.class.getResource(propertiesFileName), new File(userFileFullPath));
|
||||
return userFileFullPath;
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("creating user config file failed: " + e);
|
||||
return "";
|
||||
}
|
||||
}else{
|
||||
return runPath + fileSeparator + myName + fileSeparator + propertiesFileName;
|
||||
}
|
||||
}else{
|
||||
return userFileFullPath;
|
||||
}
|
||||
}
|
||||
|
||||
private String macosConfiguration() {
|
||||
String userFileFullPath = userPath + fileSeparator + "." + myName + fileSeparator + propertiesFileName;
|
||||
String userFileDirectory = userPath + fileSeparator + "." + myName;
|
||||
boolean userConfigFileResult = checkFile(userFileFullPath);
|
||||
if ( userConfigFileResult == false ) {
|
||||
boolean systemConfigFileResult = checkFile("/etc/GuitarTeX2" + fileSeparator + propertiesFileName);
|
||||
if ( systemConfigFileResult == false ) {
|
||||
mConsole.addText("creating user config file...");
|
||||
try {
|
||||
if ( ! new File(userFileDirectory).exists() ) {
|
||||
new File(userFileDirectory).mkdir();
|
||||
}
|
||||
copyFile(GuitarTeX2.class.getResource(propertiesFileName), new File(userFileFullPath));
|
||||
return userFileFullPath;
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("creating user config file failed: " + e);
|
||||
return "";
|
||||
}
|
||||
}else{
|
||||
return runPath + fileSeparator + myName + fileSeparator + propertiesFileName;
|
||||
}
|
||||
}else{
|
||||
return userFileFullPath;
|
||||
}
|
||||
}
|
||||
|
||||
private String defaultConfiguration() {
|
||||
String userFileFullPath = userPath + fileSeparator + myName + fileSeparator + propertiesFileName;
|
||||
String userFileDirectory = userPath + fileSeparator + myName;
|
||||
boolean userConfigFileResult = checkFile(userFileFullPath);
|
||||
if ( userConfigFileResult == false ) {
|
||||
mConsole.addText("creating user config file...");
|
||||
try {
|
||||
if ( ! new File(userFileDirectory).exists() ) {
|
||||
new File(userFileDirectory).mkdir();
|
||||
}
|
||||
copyFile(GuitarTeX2.class.getResource(propertiesFileName), new File(userFileFullPath));
|
||||
return userFileFullPath;
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("creating user config file failed: " + e);
|
||||
return "";
|
||||
}
|
||||
}else{
|
||||
return userFileFullPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void copyFile(URL inURL, File out) throws Exception {
|
||||
mConsole.addText("CopyFile: " + inURL);
|
||||
try (InputStream inStream = inURL.openStream(); FileOutputStream fos = new FileOutputStream(out)) {
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int i;
|
||||
while((i=inStream.read(buf))!=-1) {
|
||||
fos.write(buf, 0, i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkFile(String fileName) {
|
||||
try {
|
||||
File myFileName = new File(fileName);
|
||||
return myFileName.canRead() == true;
|
||||
}catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkDirectory(String directory) {
|
||||
try {
|
||||
File dirName = new File(directory);
|
||||
if ( dirName.isDirectory() ) {
|
||||
File testFile = new File(directory+"testFileName.tst");
|
||||
if ( testFile.createNewFile() ) {
|
||||
testFile.delete();
|
||||
return true;
|
||||
}else{
|
||||
mConsole.addText("tmpDirectory is not writable");
|
||||
confProblems = confProblems + "temp directory is not writable!\n";
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
mConsole.addText("tmpDirectory doesn't exist");
|
||||
confProblems = confProblems + "temp directory doesn't exist\n";
|
||||
return false;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkWindowsSettings() {
|
||||
boolean checkResult;
|
||||
String path = userPath + fileSeparator + myName + fileSeparator + "tmp" + fileSeparator;
|
||||
String tmpPath = userPath + fileSeparator + myName + fileSeparator + "tmp" +
|
||||
fileSeparator + tmpDirPrefix + fileSeparator;
|
||||
if ( mProperties.getProperty("windowsTmpPath").equals("") ) {
|
||||
// Create default tmp-Dir
|
||||
File defTmpDir = new File(tmpPath);
|
||||
if ( defTmpDir.isDirectory() == false ) {
|
||||
defTmpDir.mkdirs();
|
||||
}
|
||||
mProperties.setProperty("windowsTmpPath", path);
|
||||
}
|
||||
checkResult = checkDirectory(mProperties.getProperty("windowsTmpPath"));
|
||||
checkResult = checkResult & checkFile(mProperties.getProperty("windowsPdfViewer"));
|
||||
if ( checkResult == false ) {
|
||||
mConsole.addText("windowsPdfViewer not found");
|
||||
confProblems = confProblems + "windowsPdfViewer not found\n";
|
||||
}
|
||||
pdfViewer = mProperties.getProperty("windowsPdfViewer");
|
||||
tmpDir = mProperties.getProperty("windowsTmpPath");
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
private boolean checkLinuxSettings() {
|
||||
boolean checkResult;
|
||||
String path = userPath + fileSeparator + "." + myName + fileSeparator + "tmp" + fileSeparator;
|
||||
String tmpPath = userPath + fileSeparator + "." + myName + fileSeparator + "tmp" +
|
||||
fileSeparator + tmpDirPrefix + fileSeparator;
|
||||
if ( mProperties.getProperty("tmpPath").equals("") ) {
|
||||
// Create default tmp-Dir
|
||||
File defTmpDir = new File(tmpPath);
|
||||
if ( defTmpDir.isDirectory() == false ) {
|
||||
defTmpDir.mkdirs();
|
||||
}
|
||||
mProperties.setProperty("tmpPath", path);
|
||||
}
|
||||
checkResult = checkDirectory(mProperties.getProperty("tmpPath"));
|
||||
checkResult = checkResult & checkFile(mProperties.getProperty("linuxPdfViewer"));
|
||||
if ( checkResult == false ) {
|
||||
mConsole.addText("linuxPdfViewer not found");
|
||||
confProblems = confProblems + "linuxPdfViewer not found!\n";
|
||||
}
|
||||
pdfViewer = mProperties.getProperty("linuxPdfViewer");
|
||||
tmpDir = mProperties.getProperty("tmpPath");
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
private boolean checkMacOSSettings() {
|
||||
boolean checkResult;
|
||||
String path = userPath + fileSeparator + "." + myName + fileSeparator + "tmp" + fileSeparator;
|
||||
String tmpPath = userPath + fileSeparator + "." + myName + fileSeparator + "tmp" + fileSeparator +
|
||||
tmpDirPrefix + fileSeparator;
|
||||
if ( mProperties.getProperty("tmpPath").equals("") ) {
|
||||
// Create default tmp-Dir
|
||||
File defTmpDir = new File(tmpPath);
|
||||
if ( defTmpDir.isDirectory() == false ) {
|
||||
defTmpDir.mkdirs();
|
||||
}
|
||||
mProperties.setProperty("tmpPath", path);
|
||||
}
|
||||
checkResult = checkDirectory(mProperties.getProperty("tmpPath"));
|
||||
pdfViewer = "open";
|
||||
tmpDir = mProperties.getProperty("tmpPath");
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
private boolean checkOsIndependent() {
|
||||
boolean checkResult = true;
|
||||
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
private void setOsUnknown() {
|
||||
pdfViewer = "open";
|
||||
tmpDir = userPath + fileSeparator;
|
||||
}
|
||||
|
||||
public Properties getProperties () {
|
||||
return mProperties;
|
||||
}
|
||||
|
||||
public String getTmpDir() {
|
||||
return tmpDir;
|
||||
}
|
||||
|
||||
public void setTmpDir(String mValue) {
|
||||
if ( osName.equals("Windows XP")) {
|
||||
mProperties.setProperty("windowsTmpPath", mValue);
|
||||
}
|
||||
if ( osName.equals("Linux")) {
|
||||
mProperties.setProperty("tmpPath", mValue);
|
||||
}
|
||||
if ( osName.equals("Mac OS X")) {
|
||||
mProperties.setProperty("tmpPath", mValue);
|
||||
}
|
||||
tmpDir = mValue;
|
||||
}
|
||||
|
||||
public boolean checkConfig() {
|
||||
boolean testResult = true;
|
||||
boolean knownSystem = false;
|
||||
if ( osName.matches("Windows.*")) {
|
||||
testResult = checkWindowsSettings();
|
||||
knownSystem = true;
|
||||
}
|
||||
if ( osName.matches("Linux.*")) {
|
||||
testResult = checkLinuxSettings();
|
||||
knownSystem = true;
|
||||
}
|
||||
if ( osName.matches("Mac OS.*")) {
|
||||
testResult = checkMacOSSettings();
|
||||
knownSystem = true;
|
||||
}
|
||||
|
||||
if ( knownSystem == false ) {
|
||||
setOsUnknown();
|
||||
}
|
||||
|
||||
testResult = testResult & checkOsIndependent();
|
||||
|
||||
return testResult;
|
||||
}
|
||||
|
||||
public void saveSettings() {
|
||||
try {
|
||||
FileOutputStream propsFOS;
|
||||
mConsole.addText("taking prefered config: " + propertiesFile);
|
||||
propsFOS = new FileOutputStream(propertiesFile);
|
||||
mConsole.addText("saving config file ...");
|
||||
mProperties.store( propsFOS, " ");
|
||||
propsFOS.close();
|
||||
}catch (Exception e) {
|
||||
mConsole.addText("failed to save config file: " + e);
|
||||
confProblems = confProblems + "failed to save config file: " + e;
|
||||
}
|
||||
}
|
||||
|
||||
public String getGtxServer() {
|
||||
return mProperties.getProperty("gtxServer");
|
||||
}
|
||||
public void setGtxServer(String mValue) {
|
||||
mProperties.setProperty("gtxServer", mValue);
|
||||
}
|
||||
|
||||
public int getGtxServerPort() {
|
||||
return Integer.parseInt(mProperties.getProperty("gtxServerPort"));
|
||||
}
|
||||
|
||||
public void setGtxServerPort(String mValue) {
|
||||
mProperties.setProperty("gtxServerPort", mValue);
|
||||
}
|
||||
|
||||
public String getPdfViewer() {
|
||||
return pdfViewer;
|
||||
}
|
||||
public void setPdfViewer(String mValue) {
|
||||
if ( osName.matches("Windows.*")) {
|
||||
mProperties.setProperty("windowsPdfViewer", mValue);
|
||||
pdfViewer = mValue;
|
||||
}
|
||||
if ( osName.matches("Linux.*")) {
|
||||
mProperties.setProperty("linuxPdfViewer", mValue);
|
||||
pdfViewer = mValue;
|
||||
}
|
||||
}
|
||||
|
||||
public String getConfFile() {
|
||||
return propertiesFile;
|
||||
}
|
||||
|
||||
public String getLatex() {
|
||||
return mProperties.getProperty("latex");
|
||||
}
|
||||
public void setLatex(String mValue) {
|
||||
mProperties.setProperty("latex", mValue);
|
||||
}
|
||||
|
||||
public String getXDvi() {
|
||||
return mProperties.getProperty("xdvi");
|
||||
}
|
||||
public void setXDvi(String mValue) {
|
||||
mProperties.setProperty("xdvi", mValue);
|
||||
}
|
||||
|
||||
public String getPdfLatex() {
|
||||
return mProperties.getProperty("pdflatex");
|
||||
}
|
||||
|
||||
public void setPdfLatex(String mValue) {
|
||||
mProperties.setProperty("pdflatex", mValue);
|
||||
}
|
||||
|
||||
public String getConfProblems() {
|
||||
return confProblems;
|
||||
}
|
||||
|
||||
public String getTmpDirPrefix() {
|
||||
return tmpDirPrefix;
|
||||
}
|
||||
|
||||
public void setTmpDirPrefix(String mValue) {
|
||||
tmpDirPrefix = mValue;
|
||||
}
|
||||
|
||||
public String quoteString (String input) {
|
||||
if ( osName.matches("Windows.*")) {
|
||||
return "\"" + input + "\"";
|
||||
}else{
|
||||
return input;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getFileSeparator() {
|
||||
return fileSeparator;
|
||||
}
|
||||
|
||||
public String getRunPath() {
|
||||
return runPath;
|
||||
}
|
||||
|
||||
public String getSongTemplate() {
|
||||
return runPath + fileSeparator + "examples" + fileSeparator + mProperties.getProperty("exSongFile");
|
||||
}
|
||||
|
||||
public String getBookTemplate() {
|
||||
return runPath + fileSeparator + "examples" + fileSeparator + mProperties.getProperty("exBookFile");
|
||||
}
|
||||
|
||||
public void loadDefaults() {
|
||||
|
||||
try {
|
||||
Properties defProps;
|
||||
try (FileInputStream defaultPropFIS = new FileInputStream(propertiesFileName)) {
|
||||
defProps = new Properties();
|
||||
defProps.load(defaultPropFIS);
|
||||
}
|
||||
mProperties.setProperty("gtxServer", defProps.getProperty("gtxServer"));
|
||||
mProperties.setProperty("gtxServerPort", defProps.getProperty("gtxServerPort"));
|
||||
} catch (Exception e) {
|
||||
new InfoBox(e + "");
|
||||
}
|
||||
/*
|
||||
mPdfViewerField.setText(myConfiguration.getPdfViewer());
|
||||
mTmpPathField.setText(myConfiguration.getTmpDir());
|
||||
*/
|
||||
}
|
||||
|
||||
public GTXConsole getConsole() {
|
||||
return mConsole;
|
||||
}
|
||||
}
|
||||
303
src/main/java/guitartex2/FileTransfer.java
Normal file
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package guitartex2;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
class FileTransfer {
|
||||
|
||||
// Debug 0/1
|
||||
int debug = 0;
|
||||
|
||||
// Define commands
|
||||
//private static String quit = "CMD:123_QUIT_123";
|
||||
//private static String transfer = "CMD:123_TRANSFER_123";
|
||||
private static String ok = "CMD:123_OK_123";
|
||||
private static String failed = "CMD:123_FAILED_123";
|
||||
|
||||
// Father ID
|
||||
int fId;
|
||||
|
||||
// Streams
|
||||
DataInputStream inStream;
|
||||
DataOutputStream outStream;
|
||||
|
||||
// Main - Constructor
|
||||
public FileTransfer(int id, DataInputStream inputStream, DataOutputStream outputStream) {
|
||||
fId = id;
|
||||
inStream = inputStream;
|
||||
outStream = outputStream;
|
||||
}
|
||||
|
||||
public FileTransfer(int id, int mDebug, DataInputStream inputStream, DataOutputStream outputStream) {
|
||||
debug = mDebug;
|
||||
fId = id;
|
||||
inStream = inputStream;
|
||||
outStream = outputStream;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedAssignment")
|
||||
public int sendFile(String myFile) {
|
||||
RandomAccessFile in;
|
||||
|
||||
long length;
|
||||
String fileLengthResult;
|
||||
|
||||
int zipResult = gzipFile(myFile, false);
|
||||
if (zipResult == 0) {
|
||||
myFile = myFile + ".gz";
|
||||
} else {
|
||||
sendMsg("Filetransfer[" + fId + "]: can't gzip file");
|
||||
try {
|
||||
outStream.writeInt(0);
|
||||
fileLengthResult = inStream.readUTF();
|
||||
} catch (Exception e) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error" + e);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
in = new RandomAccessFile(myFile, "r");
|
||||
length = in.length();
|
||||
} catch (Exception g) {
|
||||
sendMsg("Filetransfer[" + fId + "]: can't read file" + g);
|
||||
try {
|
||||
outStream.writeInt(0);
|
||||
fileLengthResult = inStream.readUTF();
|
||||
} catch (Exception h) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error" + h);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
if (length > Integer.MAX_VALUE) {
|
||||
// File is too large
|
||||
sendMsg("Filetransfer[" + fId + "]: File is too large");
|
||||
cleanTmp(myFile, in);
|
||||
return 1;
|
||||
} else {
|
||||
int myFileLength = (int) length;
|
||||
sendMsg("Filetransfer[" + fId + "]: sending fille length: " + myFileLength);
|
||||
try {
|
||||
outStream.writeInt(myFileLength);
|
||||
fileLengthResult = inStream.readUTF();
|
||||
} catch (Exception i) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error" + i);
|
||||
cleanTmp(myFile, in);
|
||||
return 1;
|
||||
}
|
||||
if (fileLengthResult.equals(ok)) {
|
||||
try {
|
||||
sendMsg("Filetransfer[" + fId + "]: send a file...");
|
||||
byte b;
|
||||
for (int i = 0; i < myFileLength; i++) {
|
||||
b = in.readByte();
|
||||
outStream.writeByte(b);
|
||||
}
|
||||
in.close();
|
||||
File f = new File(myFile);
|
||||
f.delete();
|
||||
String fileTransferResult = inStream.readUTF();
|
||||
if (fileTransferResult.equals(failed)) {
|
||||
sendMsg("Filetransfer[" + fId + "]: sending file failed: " + fileTransferResult);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
} catch (Exception j) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error" + j);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
sendMsg("Filetransfer[" + fId + "]: sending file length failed: " + fileLengthResult);
|
||||
cleanTmp(myFile, in);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int receiveFile(String myFile) {
|
||||
int fileLength;
|
||||
RandomAccessFile out;
|
||||
|
||||
sendMsg("Filetransfer[" + fId + "]: awaiting filelength ...");
|
||||
try {
|
||||
fileLength = inStream.readInt();
|
||||
} catch (IOException e) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error " + e);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
sendMsg("Filetransfer[" + fId + "]: file length = " + fileLength);
|
||||
if (fileLength > 0) {
|
||||
try {
|
||||
out = new RandomAccessFile(myFile + ".gz", "rw");
|
||||
} catch (IOException g) {
|
||||
sendMsg("Filetransfer[" + fId + "]: can't write to a file " + g);
|
||||
try {
|
||||
outStream.writeUTF(failed);
|
||||
} catch (Exception h) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error " + h);
|
||||
}
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
outStream.writeUTF(ok);
|
||||
} catch (Exception i) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error " + i);
|
||||
cleanTmp(myFile, out);
|
||||
return 1;
|
||||
}
|
||||
sendMsg("Filetransfer[" + fId + "]: awaiting file...");
|
||||
try {
|
||||
byte b;
|
||||
for (int i = 0; i < fileLength; i++) {
|
||||
b = inStream.readByte();
|
||||
out.write(b);
|
||||
}
|
||||
out.close();
|
||||
} catch (Exception j) {
|
||||
sendMsg("Filetransfer[" + fId + "]: file transfer failed " + j);
|
||||
try {
|
||||
outStream.writeUTF(failed);
|
||||
} catch (Exception k) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error " + k);
|
||||
}
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
outStream.writeUTF(ok);
|
||||
int gunzipResult = gunzipFile(myFile + ".gz", true);
|
||||
if (gunzipResult != 0) {
|
||||
sendMsg("Filetransfer[" + fId + "]: gunzip failed");
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
} catch (Exception l) {
|
||||
sendMsg("Filetransfer[" + fId + "]: stream error " + l);
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
sendMsg("Filetransfer[" + fId + "]: file transfer complete.");
|
||||
} else {
|
||||
try {
|
||||
outStream.writeUTF(failed);
|
||||
} catch (Exception f) {
|
||||
sendMsg("Filetransfer[" + fId + "]: file length invalid");
|
||||
cleanTmp(myFile);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int gzipFile(String myFile, boolean delSource) {
|
||||
int read;
|
||||
byte[] data = new byte[1024];
|
||||
sendMsg("Filetransfer[" + fId + "]: gzip file");
|
||||
try {
|
||||
File f = new File(myFile);
|
||||
GZIPOutputStream out;
|
||||
try (FileInputStream in = new FileInputStream(f)) {
|
||||
out = new GZIPOutputStream(new FileOutputStream(myFile + ".gz"));
|
||||
while ((read = in.read(data, 0, 1024)) != -1) {
|
||||
out.write(data, 0, read);
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
if (delSource == true) {
|
||||
f.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendMsg("Filetransfer[" + fId + "]: gzipping file failed " + e);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sendMsg("Filetransfer[" + fId + "]: gzip file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int gunzipFile(String myGZFile, boolean delSource) {
|
||||
int read;
|
||||
byte[] data = new byte[1024];
|
||||
|
||||
sendMsg("Filetransfer[" + fId + "]: gunzip file");
|
||||
|
||||
try {
|
||||
File f = new File(myGZFile);
|
||||
FileOutputStream out;
|
||||
try (GZIPInputStream in = new GZIPInputStream(new FileInputStream(f))) {
|
||||
String myFile;
|
||||
if (myGZFile.endsWith(".gz")) {
|
||||
myFile = myGZFile.substring(0, myGZFile.length() - 3);
|
||||
} else {
|
||||
myFile = myGZFile;
|
||||
} out = new FileOutputStream(myFile);
|
||||
while ((read = in.read(data, 0, 1024)) != -1) {
|
||||
out.write(data, 0, read);
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
if (delSource == true) {
|
||||
f.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendMsg("Filetransfer[" + fId + "]: gunzipping file failed " + e);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void sendMsg(String msg) {
|
||||
if (debug == 1) {
|
||||
System.out.println(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanTmp(String fileName, RandomAccessFile file) {
|
||||
try {
|
||||
new File(fileName).delete();
|
||||
file.close();
|
||||
} catch (Exception e) {
|
||||
sendMsg("can't clean tmp file: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanTmp(String fileName) {
|
||||
try {
|
||||
new File(fileName).delete();
|
||||
} catch (Exception e) {
|
||||
sendMsg("can't clean tmp file: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
257
src/main/java/guitartex2/GTXClient.java
Normal file
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
|
||||
public class GTXClient extends Thread{
|
||||
|
||||
private static String quit = "CMD:123_QUIT_123";
|
||||
private static String transfer = "CMD:123_TRANSFER_123";
|
||||
//private static String ok = "CMD:123_OK_123";
|
||||
private static String failed = "CMD:123_FAILED_123";
|
||||
private static String ping = "CMD:123_PING_123";
|
||||
private static String pong = "CMD:123_PONG_123";
|
||||
|
||||
private int id;
|
||||
private StatusBox myStatusBox;
|
||||
private String fileName;
|
||||
private String showPdf;
|
||||
|
||||
private boolean hostExist = false;
|
||||
|
||||
private ResourceBundle resbundle;
|
||||
protected Socket serverConn;
|
||||
DataOutputStream dout;
|
||||
DataInputStream din;
|
||||
|
||||
private GTXConsole myConsole;
|
||||
private String logCache = "";
|
||||
|
||||
// Konstruktor
|
||||
public GTXClient(String host, int port) {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
try {
|
||||
logToConsole("Trying to connect to " + host + " " + port);
|
||||
serverConn = new Socket(host, port);
|
||||
}catch (UnknownHostException e) {
|
||||
logToConsole("Bad host name given.");
|
||||
}catch (IOException e) {
|
||||
logToConsole("GtxClient: " + e);
|
||||
}
|
||||
hostExist = true;
|
||||
logToConsole("Made server connection");
|
||||
}
|
||||
|
||||
public GTXClient(String host, int port, StatusBox sBox, String file, int myId, String sPdf) {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
try {
|
||||
logToConsole("Trying to connect to " + host + " " + port);
|
||||
serverConn = new Socket(host, port);
|
||||
}catch (UnknownHostException e) {
|
||||
logToConsole("Bad host name given.");
|
||||
}catch (IOException e) {
|
||||
logToConsole("GtxClient: " + e);
|
||||
}
|
||||
|
||||
hostExist = true;
|
||||
showPdf = sPdf;
|
||||
id = myId;
|
||||
myStatusBox = sBox;
|
||||
fileName = file;
|
||||
|
||||
logToConsole("Made server connection");
|
||||
}
|
||||
|
||||
private void logToConsole(String text) {
|
||||
if ( myConsole == null ) {
|
||||
if ( logCache.equals("") ) {
|
||||
logCache = text;
|
||||
}else{
|
||||
logCache = logCache + "\n" + text;
|
||||
}
|
||||
}else{
|
||||
if ( ! logCache.equals("") ) {
|
||||
myConsole.addText(logCache);
|
||||
logCache = "";
|
||||
myConsole.addText(text);
|
||||
}else{
|
||||
myConsole.addText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setGTXConsole(GTXConsole mConsole) {
|
||||
myConsole = mConsole;
|
||||
if ( ! logCache.equals("") ) {
|
||||
myConsole.addText(logCache);
|
||||
logCache = "";
|
||||
}
|
||||
}
|
||||
|
||||
void forceLogCache() {
|
||||
if ( myConsole != null ) {
|
||||
myConsole.addText(logCache);
|
||||
logCache = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run () {
|
||||
try {
|
||||
if ( myStatusBox != null ) {
|
||||
myStatusBox.setStatus(resbundle.getString("sendTexFile"));
|
||||
}
|
||||
dout.writeUTF(transfer);
|
||||
logToConsole("Client ready for transfer:");
|
||||
FileTransfer fileTransfer = new FileTransfer(id,0,din, dout);
|
||||
int texSendResult = fileTransfer.sendFile(fileName);
|
||||
if ( texSendResult != 0) {
|
||||
logToConsole("tex file send failed");
|
||||
}else{
|
||||
myStatusBox.setStatus(resbundle.getString("wait4PdfFile"));
|
||||
logToConsole("tex file send.");
|
||||
}
|
||||
String texResult = din.readUTF();
|
||||
if ( texResult.equals(failed)) {
|
||||
new InfoBox(resbundle.getString("texFailed"));
|
||||
logToConsole("texin unsuccessfull");
|
||||
//myStatusBox.setStatus("FEHLER!");
|
||||
//myStatusBox.requestFocus();
|
||||
}else{
|
||||
myStatusBox.setStatus(resbundle.getString("receivePdfFile"));
|
||||
String rawFileName = fileName.substring(0, fileName.length()-4);
|
||||
int pdfResult = fileTransfer.receiveFile(rawFileName + ".pdf");
|
||||
if ( pdfResult != 0) {
|
||||
logToConsole("pdf unsuccesfull");
|
||||
}else{
|
||||
logToConsole("pdf file received.");
|
||||
}
|
||||
myStatusBox.setStatus(resbundle.getString("receiveLogFile"));
|
||||
int logResult = fileTransfer.receiveFile(rawFileName + ".log");
|
||||
if ( logResult != 0) {
|
||||
logToConsole("log unsuccesfull");
|
||||
}else{
|
||||
logToConsole("log file received.");
|
||||
}
|
||||
myStatusBox.setStatus("try to show PDF file ...");
|
||||
logToConsole("try to show pdf file");
|
||||
try{
|
||||
Runtime.getRuntime().exec(showPdf);
|
||||
}catch (Exception h) {
|
||||
logToConsole("ERR: " + h);
|
||||
}
|
||||
|
||||
}
|
||||
closeConnection();
|
||||
|
||||
myStatusBox.setVisible(false);
|
||||
}catch (Exception e) {
|
||||
logToConsole("failed texin file: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public int openConnection() {
|
||||
if ( hostExist) {
|
||||
try {
|
||||
dout = new DataOutputStream(serverConn.getOutputStream());
|
||||
din = new DataInputStream(serverConn.getInputStream());
|
||||
logToConsole("connection open");
|
||||
return 0;
|
||||
}catch (Exception e) {
|
||||
logToConsole("open connection failed: " + e);
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
logToConsole("Host not exists!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int closeConnection() {
|
||||
if ( hostExist ) {
|
||||
try {
|
||||
dout.writeUTF(quit);
|
||||
din.close();
|
||||
dout.close();
|
||||
logToConsole("connection closed");
|
||||
return 0;
|
||||
}catch (Exception e) {
|
||||
logToConsole("close connection failed: " + e);
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
logToConsole("Host not exists!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int checkServerConnection() {
|
||||
if ( hostExist ) {
|
||||
try {
|
||||
logToConsole("sending ping ...");
|
||||
dout.writeUTF(ping);
|
||||
logToConsole("awaiting pong ...");
|
||||
String pingResult = din.readUTF();
|
||||
logToConsole(pingResult);
|
||||
if ( pingResult.equals(pong)) {
|
||||
logToConsole("pong received.");
|
||||
return 0;
|
||||
}else {
|
||||
logToConsole("server doesn't working.");
|
||||
return 1;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logToConsole("ping failed " + e);
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
logToConsole("Host not exists!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public String sendText(String text) {
|
||||
String result = "unknown command!";
|
||||
if ( text.equals("ping") ){
|
||||
try {
|
||||
dout.writeUTF(ping);
|
||||
result = din.readUTF();
|
||||
if ( result.equals(pong) ) {
|
||||
result = "pong";
|
||||
}
|
||||
dout.writeUTF(quit);
|
||||
}catch (Exception e) {
|
||||
logToConsole("Sending failed!");
|
||||
return "Sending failed!";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/* public int tex2pdf(String fileName, int id) {
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
217
src/main/java/guitartex2/GTXConsole.java
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
|
||||
|
||||
class GTXConsole extends JFrame implements ActionListener{
|
||||
private static final long serialVersionUID = -5838495111759011319L;
|
||||
|
||||
private Font titleFont, bodyFont;
|
||||
|
||||
private static final int statusWidth = 640;
|
||||
private static final int statusHeight = 480;
|
||||
private static int statusTop;
|
||||
private static int statusLeft;
|
||||
|
||||
private final ResourceBundle resbundle;
|
||||
|
||||
private final JTextArea mShowArea;
|
||||
//private JTextArea mInputArea;
|
||||
private final JTextField mInputTextField;
|
||||
|
||||
private GTXClient gtxClient;
|
||||
private Configurations myConf;
|
||||
|
||||
private final JButton mInputButton;
|
||||
private final Action mInputAction;
|
||||
|
||||
//public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
|
||||
public static final String DATE_FORMAT_NOW = "HH:mm:ss";
|
||||
|
||||
|
||||
public GTXConsole() {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
statusTop = new Double((screenSize.getHeight()/2) - (statusHeight/2)).intValue();
|
||||
statusLeft = new Double((screenSize.getWidth()/2) - (statusWidth/2)).intValue();
|
||||
|
||||
this.setResizable(false);
|
||||
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
Panel inputPanel = new Panel(new FlowLayout());
|
||||
Panel buttonPanel = new Panel(new GridBagLayout());
|
||||
|
||||
mShowArea = new JTextArea(resbundle.getString("consoleInitText"));
|
||||
mShowArea.setEditable(false);
|
||||
JScrollPane scrollingShowArea = new JScrollPane(mShowArea);
|
||||
|
||||
// InputPanel
|
||||
|
||||
mInputAction = new buttonActionClass(resbundle.getString("consoleSendButton"));
|
||||
mInputButton = new JButton(mInputAction);
|
||||
//mInputButton.setActionCommand("mInputAction");
|
||||
|
||||
|
||||
//mInputArea = new JTextArea();
|
||||
mInputTextField = new JTextField();
|
||||
mInputTextField.setColumns(40);
|
||||
mInputTextField.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), mInputAction);
|
||||
|
||||
|
||||
inputPanel.add(mInputTextField);
|
||||
inputPanel.add(mInputButton);
|
||||
|
||||
mInputButton.setEnabled(false);
|
||||
mInputAction.setEnabled(false);
|
||||
|
||||
// OK - Button
|
||||
|
||||
Action mOkAction = new buttonActionClass(resbundle.getString("okButton"));
|
||||
JButton mOkButton = new JButton(mOkAction);
|
||||
//mOkButton.setActionCommand("mOkAction");
|
||||
mOkButton.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), mOkAction);
|
||||
|
||||
buttonPanel.add(new JLabel());
|
||||
buttonPanel.add(mOkButton);
|
||||
buttonPanel.add(new JLabel());
|
||||
|
||||
this.pack();
|
||||
this.getContentPane().add (scrollingShowArea, BorderLayout.CENTER);
|
||||
this.getContentPane().add (inputPanel, BorderLayout.PAGE_START);
|
||||
this.getContentPane().add (buttonPanel, BorderLayout.PAGE_END);
|
||||
|
||||
this.setLocation(statusLeft, statusTop);
|
||||
this.setSize(statusWidth, statusHeight);
|
||||
this.setTitle(resbundle.getString("consoleTitle"));
|
||||
this.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
public void setGTXClient(Configurations mConf) {
|
||||
myConf = mConf;
|
||||
gtxClient = new GTXClient(myConf.getGtxServer(), myConf.getGtxServerPort());
|
||||
int openResult = gtxClient.openConnection();
|
||||
if ( openResult == 0 ) {
|
||||
int connResult = gtxClient.checkServerConnection();
|
||||
if ( connResult == 0) {
|
||||
mInputButton.setEnabled(true);
|
||||
mInputAction.setEnabled(true);
|
||||
}
|
||||
}
|
||||
gtxClient.closeConnection();
|
||||
}
|
||||
|
||||
public class buttonActionClass extends AbstractAction {
|
||||
private static final long serialVersionUID = 3791659234149686228L;
|
||||
|
||||
private final String mAction;
|
||||
|
||||
public buttonActionClass(String text) {
|
||||
super(text);
|
||||
mAction = text;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (mAction.equals(resbundle.getString("consoleSendButton"))) {
|
||||
// Nachricht anzeigen
|
||||
addText(mInputTextField.getText());
|
||||
|
||||
// Nachricht senden
|
||||
gtxClient = new GTXClient(myConf.getGtxServer(), myConf.getGtxServerPort());
|
||||
int openResult = gtxClient.openConnection();
|
||||
if ( openResult == 0 ) {
|
||||
String receiveText = gtxClient.sendText(mInputTextField.getText());
|
||||
addText("Server: " + receiveText);
|
||||
}
|
||||
gtxClient.closeConnection();
|
||||
|
||||
mInputTextField.setText("");
|
||||
mInputTextField.requestFocus();
|
||||
}
|
||||
|
||||
// Fenster schliessen
|
||||
if (mAction.equals(resbundle.getString("okButton"))) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public void addText(String text) {
|
||||
String prefix = this.now() + " # ";
|
||||
text = text.replaceAll("\n", "\n" + prefix);
|
||||
mShowArea.setText(mShowArea.getText() + "\n" + prefix + text);
|
||||
//System.out.println(text);
|
||||
}
|
||||
|
||||
private String now() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
}
|
||||
1442
src/main/java/guitartex2/GTXParser.java
Normal file
12
src/main/java/guitartex2/GTXTextConsole.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package guitartex2;
|
||||
|
||||
class GTXTextConsole {
|
||||
public GTXTextConsole() {
|
||||
|
||||
};
|
||||
|
||||
public void addText(String text) {
|
||||
System.out.println(text);
|
||||
}
|
||||
|
||||
}
|
||||
1720
src/main/java/guitartex2/GuitarTeX2.java
Normal file
110
src/main/java/guitartex2/GuitarTeX2Convert.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package guitartex2;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class GuitarTeX2Convert {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ResourceBundle resbundle = ResourceBundle.getBundle("GuitarTeX2strings", Locale.getDefault());
|
||||
String help = ""
|
||||
+ resbundle.getString("appVersion") + "\n"
|
||||
+ "Usage: \n"
|
||||
+ " GuitarTeX2Converter -h help (this screen)\n"
|
||||
+ " GuitarTeX2Converter -f <file.gtx> convert gtx file and print to std out\n"
|
||||
+ "\n";
|
||||
|
||||
if (args.length != 0) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].equals("--help") || args[i].equals("-help") || args[i].equals("-h") || args[i].equals("--h")) {
|
||||
System.out.println(help);
|
||||
System.exit(0);
|
||||
}
|
||||
if (args[i].equals("-f") || args[i].equals("--f") || args[i].equals("-file") || args[i].equals("--file")) {
|
||||
if (i + 1 < args.length) {
|
||||
String fileName = args[i + 1];
|
||||
if (!fileName.equals("")) {
|
||||
File f = new File(fileName);
|
||||
if (f.canRead()) {
|
||||
new GuitarTeX2Convert(f);
|
||||
} else {
|
||||
System.out.println("error: can't read file\n");
|
||||
System.out.println(help);
|
||||
System.exit(1);
|
||||
}
|
||||
} else {
|
||||
System.out.println(help);
|
||||
System.exit(1);
|
||||
}
|
||||
} else {
|
||||
System.out.println("error: no file found\n");
|
||||
System.out.println(help);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println(help);
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
public GuitarTeX2Convert(File f) {
|
||||
String mTextArea = "";
|
||||
try {
|
||||
/*InputStreamReader in = new InputStreamReader(fis, Charset.forName("UTF-8"));
|
||||
while ( in.read() != -1) {
|
||||
char c = (char)in.read();
|
||||
mTextArea = mTextArea + c;
|
||||
}*/
|
||||
try (FileInputStream fis = new FileInputStream(f); /*InputStreamReader in = new InputStreamReader(fis, Charset.forName("UTF-8"));
|
||||
while ( in.read() != -1) {
|
||||
char c = (char)in.read();
|
||||
mTextArea = mTextArea + c;
|
||||
}*/ BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(new FileInputStream(f), Charset.forName("UTF-8")))) {
|
||||
boolean eof = false;
|
||||
while (eof == false) {
|
||||
String line = in.readLine();
|
||||
if (line == null) {
|
||||
eof = true;
|
||||
} else {
|
||||
mTextArea = mTextArea + line + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GTXParser mGTXParser = new GTXParser(mTextArea);
|
||||
mGTXParser.convertToTeX();
|
||||
|
||||
try (OutputStreamWriter out = new OutputStreamWriter(System.out, Charset.forName("UTF-8"))) {
|
||||
out.write(mGTXParser.getMyTeXFile());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("File input error:" + e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
121
src/main/java/guitartex2/InfoBox.java
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
|
||||
|
||||
class InfoBox extends JFrame implements ActionListener{
|
||||
private static final long serialVersionUID = 671314678552270671L;
|
||||
|
||||
private Font titleFont, bodyFont;
|
||||
|
||||
private static final int statusWidth = 480;
|
||||
private static final int statusHeight = 200;
|
||||
private static int statusTop;
|
||||
private static int statusLeft;
|
||||
|
||||
private final ResourceBundle resbundle;
|
||||
|
||||
|
||||
public InfoBox(String myInfo) {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
statusTop = new Double((screenSize.getHeight()/2) - (statusHeight/2)).intValue();
|
||||
statusLeft = new Double((screenSize.getWidth()/2) - (statusWidth/2)).intValue();
|
||||
|
||||
this.setResizable(false);
|
||||
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
Panel buttonPanel = new Panel(new GridBagLayout());
|
||||
|
||||
JTextArea mShowArea = new JTextArea(myInfo);
|
||||
mShowArea.setEditable(false);
|
||||
JScrollPane scrollingShowArea = new JScrollPane(mShowArea);
|
||||
|
||||
Action mOkAction = new buttonActionClass(resbundle.getString("okButton"));
|
||||
JButton mOkButton = new JButton(mOkAction);
|
||||
mOkButton.setActionCommand("mOkAction");
|
||||
|
||||
buttonPanel.add(new JLabel());
|
||||
buttonPanel.add(mOkButton);
|
||||
buttonPanel.add(new JLabel());
|
||||
|
||||
this.getContentPane().add (scrollingShowArea, BorderLayout.CENTER);
|
||||
this.getContentPane().add (buttonPanel, BorderLayout.PAGE_END);
|
||||
|
||||
this.pack();
|
||||
this.setLocation(statusLeft, statusTop);
|
||||
this.setSize(statusWidth, statusHeight);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public class buttonActionClass extends AbstractAction {
|
||||
private static final long serialVersionUID = 3791659234149686228L;
|
||||
|
||||
public buttonActionClass(String text) {
|
||||
super(text);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
330
src/main/java/guitartex2/PreferencesBox.java
Normal file
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
public class PreferencesBox extends JFrame implements ActionListener {
|
||||
|
||||
private static final long serialVersionUID = -7086306896538924587L;
|
||||
|
||||
private Font titleFont, bodyFont;
|
||||
private final ResourceBundle resbundle;
|
||||
private final Configurations myConfiguration;
|
||||
|
||||
//private Action mLatexAction, mXDviAction, mPdfLatexAction;
|
||||
private final Action mPdfViewerAction, mTmpPathAction;
|
||||
private JTextField mLatexField, mXDviField, mPdfLatexField;
|
||||
private final JTextField mPdfViewerField;
|
||||
private final JTextField mTmpPathField;
|
||||
private final JTextField mGtxServerField, mGtxServerPortField;
|
||||
private final JButton tex2pdfButton;
|
||||
private final Action tex2pdfAction;
|
||||
|
||||
private final String fileSeparator = System.getProperty("file.separator");
|
||||
|
||||
PreferencesBox(Configurations myConf, JButton mTeX2PdfButton, Action mTeX2PdfAction) {
|
||||
myConfiguration = myConf;
|
||||
tex2pdfButton = mTeX2PdfButton;
|
||||
tex2pdfAction = mTeX2PdfAction;
|
||||
|
||||
resbundle = ResourceBundle.getBundle("GuitarTeX2strings", Locale.getDefault());
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
// Show local configuration
|
||||
//Create and populate the panel.
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
|
||||
|
||||
//int numPairs = 9;
|
||||
int numPairs = 6;
|
||||
int fieldLength = 30;
|
||||
|
||||
JPanel p = new JPanel(new SpringLayout());
|
||||
|
||||
// External programs
|
||||
/*
|
||||
JLabel mLatexLabel = new JLabel(resbundle.getString("mPrefLatex"), JLabel.TRAILING);
|
||||
p.add(mLatexLabel);
|
||||
mLatexField = new JTextField(fieldLength);
|
||||
mLatexField.setText(myConfiguration.getLatex());
|
||||
mLatexLabel.setLabelFor(mLatexField);
|
||||
p.add(mLatexField);
|
||||
mLatexAction = new chooseFileActionClass(resbundle.getString("choose"));
|
||||
JButton mLatexButton = new JButton(mLatexAction);
|
||||
mLatexButton.setActionCommand("mLatexAction");
|
||||
p.add(mLatexButton);
|
||||
|
||||
JLabel mXDviLabel = new JLabel(resbundle.getString("mPrefXDvi"), JLabel.TRAILING);
|
||||
p.add(mXDviLabel);
|
||||
mXDviField = new JTextField(fieldLength);
|
||||
mXDviField.setText(myConfiguration.getXDvi());
|
||||
mXDviLabel.setLabelFor(mXDviField);
|
||||
p.add(mXDviField);
|
||||
mXDviAction = new chooseFileActionClass(resbundle.getString("choose"));
|
||||
JButton mXDviButton = new JButton(mXDviAction);
|
||||
mXDviButton.setActionCommand("mXDviAction");
|
||||
p.add(mXDviButton);
|
||||
|
||||
JLabel mPdfLatexLabel = new JLabel(resbundle.getString("mPrefPdfLatex"), JLabel.TRAILING);
|
||||
p.add(mPdfLatexLabel);
|
||||
mPdfLatexField = new JTextField(fieldLength);
|
||||
mPdfLatexField.setText(myConfiguration.getPdfLatex());
|
||||
mPdfLatexLabel.setLabelFor(mPdfLatexField);
|
||||
p.add(mPdfLatexField);
|
||||
mPdfLatexAction = new chooseFileActionClass(resbundle.getString("choose"));
|
||||
JButton mPdfLatexButton = new JButton(mPdfLatexAction);
|
||||
mPdfLatexButton.setActionCommand("mPdfLatexAction");
|
||||
p.add(mPdfLatexButton);
|
||||
*/
|
||||
JLabel mPdfViewerLabel = new JLabel(resbundle.getString("mPrefPdfViewer"), JLabel.TRAILING);
|
||||
p.add(mPdfViewerLabel);
|
||||
mPdfViewerField = new JTextField(fieldLength);
|
||||
mPdfViewerField.setText(myConfiguration.getPdfViewer());
|
||||
mPdfViewerLabel.setLabelFor(mPdfViewerField);
|
||||
p.add(mPdfViewerField);
|
||||
mPdfViewerAction = new chooseFileActionClass(resbundle.getString("choose"));
|
||||
JButton mPdfViewerButton = new JButton(mPdfViewerAction);
|
||||
mPdfViewerButton.setActionCommand("mPdfViewerAction");
|
||||
p.add(mPdfViewerButton);
|
||||
|
||||
// Spaces
|
||||
p.add(new JLabel());
|
||||
p.add(new JLabel());
|
||||
p.add(new JLabel());
|
||||
|
||||
// Tmp Path
|
||||
JLabel mTmpPathLabel = new JLabel(resbundle.getString("mPrefTmpPath"), JLabel.TRAILING);
|
||||
p.add(mTmpPathLabel);
|
||||
mTmpPathField = new JTextField(fieldLength);
|
||||
mTmpPathField.setText(myConfiguration.getTmpDir());
|
||||
mTmpPathLabel.setLabelFor(mTmpPathField);
|
||||
p.add(mTmpPathField);
|
||||
mTmpPathAction = new chooseDirActionClass(resbundle.getString("choose"));
|
||||
JButton mTmpPathButton = new JButton(mTmpPathAction);
|
||||
mTmpPathButton.setActionCommand("mTmpPathAction");
|
||||
p.add(mTmpPathButton);
|
||||
|
||||
// Space
|
||||
p.add(new JLabel());
|
||||
p.add(new JLabel());
|
||||
p.add(new JLabel());
|
||||
|
||||
// Remote connection
|
||||
JLabel mGtxServerLabel = new JLabel(resbundle.getString("mPrefGtxServer"), JLabel.TRAILING);
|
||||
p.add(mGtxServerLabel);
|
||||
mGtxServerField = new JTextField(fieldLength);
|
||||
mGtxServerField.setText(myConfiguration.getGtxServer());
|
||||
mGtxServerLabel.setLabelFor(mGtxServerField);
|
||||
p.add(mGtxServerField);
|
||||
p.add(new JLabel());
|
||||
|
||||
JLabel mGtxServerPortLabel = new JLabel(resbundle.getString("mPrefGtxServerPort"), JLabel.TRAILING);
|
||||
p.add(mGtxServerPortLabel);
|
||||
mGtxServerPortField = new JTextField(fieldLength);
|
||||
mGtxServerPortField.setText(Integer.toString(myConfiguration.getGtxServerPort()));
|
||||
mGtxServerPortLabel.setLabelFor(mGtxServerPortField);
|
||||
p.add(mGtxServerPortField);
|
||||
p.add(new JLabel());
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
|
||||
|
||||
// Create Buttons
|
||||
JButton resetButton = new JButton(resbundle.getString("resetButton"));
|
||||
resetButton.setActionCommand("resetButtonPressed");
|
||||
resetButton.addActionListener(this);
|
||||
JButton okButton = new JButton(resbundle.getString("okButton"));
|
||||
okButton.setActionCommand("okButtonPressed");
|
||||
okButton.addActionListener(this);
|
||||
JButton cancelButton = new JButton(resbundle.getString("cancelButton"));
|
||||
cancelButton.setActionCommand("cancelButtonPressed");
|
||||
cancelButton.addActionListener(this);
|
||||
buttonsPanel.add(resetButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
buttonsPanel.add(okButton);
|
||||
|
||||
mainPanel.add(p);
|
||||
mainPanel.add(buttonsPanel);
|
||||
|
||||
//Lay out the panel.
|
||||
SpringUtilities.makeCompactGrid(p,
|
||||
numPairs, 3, //rows, cols
|
||||
6, 6, //initX, initY
|
||||
6, 6); //xPad, yPad
|
||||
|
||||
//Create and set up the window.
|
||||
p.setOpaque(true); //content panes must be opaque
|
||||
buttonsPanel.setOpaque(true);
|
||||
mainPanel.setOpaque(true);
|
||||
|
||||
this.setResizable(false);
|
||||
this.getContentPane().add(mainPanel);
|
||||
this.pack();
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
int aboutTop = new Double((screenSize.getHeight() / 2) - (this.getHeight() / 2)).intValue();
|
||||
int aboutLeft = new Double((screenSize.getWidth() / 2) - (this.getWidth() / 2)).intValue();
|
||||
|
||||
this.setTitle(resbundle.getString("prefTitle"));
|
||||
this.setLocation(aboutLeft, aboutTop);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public class chooseFileActionClass extends AbstractAction {
|
||||
|
||||
private static final long serialVersionUID = 6483849350866369203L;
|
||||
|
||||
public chooseFileActionClass(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFileChooser mFileChooser = new JFileChooser(System.getProperty("."));
|
||||
int retval = mFileChooser.showOpenDialog(PreferencesBox.this);
|
||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||
String actionCommand = e.getActionCommand();
|
||||
if (actionCommand.equals("mLatexAction")) {
|
||||
mLatexField.setText(mFileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
if (actionCommand.equals("mXDviAction")) {
|
||||
mXDviField.setText(mFileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
if (actionCommand.equals("mPdfLatexAction")) {
|
||||
mPdfLatexField.setText(mFileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
if (actionCommand.equals("mPdfViewerAction")) {
|
||||
mPdfViewerField.setText(mFileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
if (actionCommand.equals("mTmpPathAction")) {
|
||||
mTmpPathField.setText(mFileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class chooseDirActionClass extends AbstractAction {
|
||||
|
||||
private static final long serialVersionUID = 6483849350866369203L;
|
||||
|
||||
public chooseDirActionClass(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFileChooser mFileChooser = new JFileChooser(System.getProperty("."));
|
||||
mFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int retval = mFileChooser.showOpenDialog(PreferencesBox.this);
|
||||
if (retval == JFileChooser.APPROVE_OPTION) {
|
||||
String actionCommand = e.getActionCommand();
|
||||
if (actionCommand.equals("mTmpPathAction")) {
|
||||
mTmpPathField.setText(mFileChooser.getSelectedFile().getAbsolutePath() + fileSeparator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setFields() {
|
||||
//myConfiguration.setLatex(mLatexField.getText());
|
||||
//myConfiguration.setXDvi(mXDviField.getText());
|
||||
//myConfiguration.setPdfLatex(mPdfLatexField.getText());
|
||||
myConfiguration.setPdfViewer(mPdfViewerField.getText());
|
||||
myConfiguration.setTmpDir(mTmpPathField.getText());
|
||||
myConfiguration.setGtxServer(mGtxServerField.getText());
|
||||
myConfiguration.setGtxServerPort(mGtxServerPortField.getText());
|
||||
}
|
||||
|
||||
private void resetFields() {
|
||||
mPdfViewerField.setText(myConfiguration.getPdfViewer());
|
||||
mTmpPathField.setText(myConfiguration.getTmpDir());
|
||||
mGtxServerField.setText(myConfiguration.getGtxServer());
|
||||
mGtxServerPortField.setText(myConfiguration.getGtxServerPort() + "");
|
||||
}
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
if (newEvent.getActionCommand().equals("resetButtonPressed")) {
|
||||
myConfiguration.loadDefaults();
|
||||
resetFields();
|
||||
}
|
||||
|
||||
if (newEvent.getActionCommand().equals("okButtonPressed")) {
|
||||
setFields();
|
||||
myConfiguration.saveSettings();
|
||||
GTXClient gtxClient = new GTXClient(myConfiguration.getGtxServer(), myConfiguration.getGtxServerPort());
|
||||
gtxClient.setGTXConsole(myConfiguration.getConsole());
|
||||
int openResult = gtxClient.openConnection();
|
||||
if (openResult == 0) {
|
||||
int connResult = gtxClient.checkServerConnection();
|
||||
if (connResult == 0) {
|
||||
tex2pdfButton.setEnabled(true);
|
||||
tex2pdfAction.setEnabled(true);
|
||||
} else {
|
||||
tex2pdfButton.setEnabled(false);
|
||||
tex2pdfAction.setEnabled(false);
|
||||
}
|
||||
gtxClient.closeConnection();
|
||||
} else {
|
||||
tex2pdfButton.setEnabled(false);
|
||||
tex2pdfAction.setEnabled(false);
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
if (newEvent.getActionCommand().equals("cancelButtonPressed")) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
210
src/main/java/guitartex2/SpringUtilities.java
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import javax.swing.Spring;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
|
||||
|
||||
public class SpringUtilities {
|
||||
/**
|
||||
* A debugging utility that prints to stdout the component's
|
||||
* minimum, preferred, and maximum sizes.
|
||||
* @param c
|
||||
*/
|
||||
public static void printSizes(Component c) {
|
||||
System.out.println("minimumSize = " + c.getMinimumSize());
|
||||
System.out.println("preferredSize = " + c.getPreferredSize());
|
||||
System.out.println("maximumSize = " + c.getMaximumSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code> * <code>cols</code>
|
||||
* components of <code>parent</code> in
|
||||
* a grid. Each component is as big as the maximum
|
||||
* preferred width and height of the components.
|
||||
* The parent is made just big enough to fit them all.
|
||||
*
|
||||
* @param parent
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
* @param initialX x location to start the grid at
|
||||
* @param initialY y location to start the grid at
|
||||
* @param xPad x padding between cells
|
||||
* @param yPad y padding between cells
|
||||
*/
|
||||
public static void makeGrid(Container parent,
|
||||
int rows, int cols,
|
||||
int initialX, int initialY,
|
||||
int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout)parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
System.err.println("The first argument to makeGrid must use SpringLayout.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spring xPadSpring = Spring.constant(xPad);
|
||||
Spring yPadSpring = Spring.constant(yPad);
|
||||
Spring initialXSpring = Spring.constant(initialX);
|
||||
Spring initialYSpring = Spring.constant(initialY);
|
||||
int max = rows * cols;
|
||||
|
||||
//Calculate Springs that are the max of the width/height so that all
|
||||
//cells have the same size.
|
||||
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
|
||||
getWidth();
|
||||
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
|
||||
getWidth();
|
||||
for (int i = 1; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(
|
||||
parent.getComponent(i));
|
||||
|
||||
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
|
||||
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
|
||||
}
|
||||
|
||||
//Apply the new width/height Spring. This forces all the
|
||||
//components to have the same size.
|
||||
for (int i = 0; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(
|
||||
parent.getComponent(i));
|
||||
|
||||
cons.setWidth(maxWidthSpring);
|
||||
cons.setHeight(maxHeightSpring);
|
||||
}
|
||||
|
||||
//Then adjust the x/y constraints of all the cells so that they
|
||||
//are aligned in a grid.
|
||||
SpringLayout.Constraints lastCons = null;
|
||||
SpringLayout.Constraints lastRowCons = null;
|
||||
for (int i = 0; i < max; i++) {
|
||||
SpringLayout.Constraints cons = layout.getConstraints(
|
||||
parent.getComponent(i));
|
||||
if (i % cols == 0) { //start of new row
|
||||
lastRowCons = lastCons;
|
||||
cons.setX(initialXSpring);
|
||||
} else { //x position depends on previous component
|
||||
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
|
||||
xPadSpring));
|
||||
}
|
||||
|
||||
if (i / cols == 0) { //first row
|
||||
cons.setY(initialYSpring);
|
||||
} else { //y position depends on previous row
|
||||
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
|
||||
yPadSpring));
|
||||
}
|
||||
lastCons = cons;
|
||||
}
|
||||
|
||||
//Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
pCons.setConstraint(SpringLayout.SOUTH,
|
||||
Spring.sum(
|
||||
Spring.constant(yPad),
|
||||
lastCons.getConstraint(SpringLayout.SOUTH)));
|
||||
pCons.setConstraint(SpringLayout.EAST,
|
||||
Spring.sum(
|
||||
Spring.constant(xPad),
|
||||
lastCons.getConstraint(SpringLayout.EAST)));
|
||||
}
|
||||
|
||||
/* Used by makeCompactGrid. */
|
||||
private static SpringLayout.Constraints getConstraintsForCell(
|
||||
int row, int col,
|
||||
Container parent,
|
||||
int cols) {
|
||||
SpringLayout layout = (SpringLayout) parent.getLayout();
|
||||
Component c = parent.getComponent(row * cols + col);
|
||||
return layout.getConstraints(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code> * <code>cols</code>
|
||||
* components of <code>parent</code> in
|
||||
* a grid. Each component in a column is as wide as the maximum
|
||||
* preferred width of the components in that column;
|
||||
* height is similarly determined for each row.
|
||||
* The parent is made just big enough to fit them all.
|
||||
*
|
||||
* @param parent
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
* @param initialX x location to start the grid at
|
||||
* @param initialY y location to start the grid at
|
||||
* @param xPad x padding between cells
|
||||
* @param yPad y padding between cells
|
||||
*/
|
||||
public static void makeCompactGrid(Container parent,
|
||||
int rows, int cols,
|
||||
int initialX, int initialY,
|
||||
int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout)parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
|
||||
return;
|
||||
}
|
||||
|
||||
//Align all cells in each column and make them the same width.
|
||||
Spring x = Spring.constant(initialX);
|
||||
for (int c = 0; c < cols; c++) {
|
||||
Spring width = Spring.constant(0);
|
||||
for (int r = 0; r < rows; r++) {
|
||||
width = Spring.max(width,
|
||||
getConstraintsForCell(r, c, parent, cols).
|
||||
getWidth());
|
||||
}
|
||||
for (int r = 0; r < rows; r++) {
|
||||
SpringLayout.Constraints constraints =
|
||||
getConstraintsForCell(r, c, parent, cols);
|
||||
constraints.setX(x);
|
||||
constraints.setWidth(width);
|
||||
}
|
||||
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
|
||||
}
|
||||
|
||||
//Align all cells in each row and make them the same height.
|
||||
Spring y = Spring.constant(initialY);
|
||||
for (int r = 0; r < rows; r++) {
|
||||
Spring height = Spring.constant(0);
|
||||
for (int c = 0; c < cols; c++) {
|
||||
height = Spring.max(height,
|
||||
getConstraintsForCell(r, c, parent, cols).
|
||||
getHeight());
|
||||
}
|
||||
for (int c = 0; c < cols; c++) {
|
||||
SpringLayout.Constraints constraints =
|
||||
getConstraintsForCell(r, c, parent, cols);
|
||||
constraints.setY(y);
|
||||
constraints.setHeight(height);
|
||||
}
|
||||
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
|
||||
}
|
||||
|
||||
//Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
pCons.setConstraint(SpringLayout.SOUTH, y);
|
||||
pCons.setConstraint(SpringLayout.EAST, x);
|
||||
}
|
||||
}
|
||||
149
src/main/java/guitartex2/StatusBox.java
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Panel;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
|
||||
|
||||
|
||||
public class StatusBox extends JFrame implements ActionListener {
|
||||
private static final long serialVersionUID = 8854494445995604753L;
|
||||
|
||||
private Font titleFont, bodyFont;
|
||||
|
||||
private static int statusWidth = 280;
|
||||
private static int statusHeight = 100;
|
||||
private static int statusTop;
|
||||
private static int statusLeft;
|
||||
|
||||
private ResourceBundle resbundle;
|
||||
private final JLabel myJLStatus;
|
||||
|
||||
public StatusBox() {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
statusTop = new Double((screenSize.getHeight()/2) - (statusHeight/2)).intValue();
|
||||
statusLeft = new Double((screenSize.getWidth()/2) - (statusWidth/2)).intValue();
|
||||
|
||||
this.setResizable(false);
|
||||
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
java.net.URL imgURL = StatusBox.class.getResource("/images/info.png");
|
||||
ImageIcon icon = new ImageIcon(imgURL, "");
|
||||
|
||||
Panel textPanel = new Panel(new GridBagLayout());
|
||||
Panel imagePanel = new Panel(new GridBagLayout());
|
||||
|
||||
myJLStatus = new JLabel();
|
||||
|
||||
imagePanel.add(new JLabel(icon));
|
||||
|
||||
textPanel.add(new JLabel());
|
||||
textPanel.add(myJLStatus);
|
||||
textPanel.add(new JLabel());
|
||||
|
||||
this.getContentPane().add (imagePanel, BorderLayout.PAGE_START);
|
||||
this.getContentPane().add (textPanel, BorderLayout.CENTER);
|
||||
|
||||
this.pack();
|
||||
this.setTitle(resbundle.getString("statusTitle"));
|
||||
this.setLocation(statusLeft, statusTop);
|
||||
this.setSize(statusWidth, statusHeight);
|
||||
}
|
||||
|
||||
public StatusBox(String myStatus) {
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
statusTop = new Double((screenSize.getHeight()/2) - (statusHeight/2)).intValue();
|
||||
statusLeft = new Double((screenSize.getWidth()/2) - (statusWidth/2)).intValue();
|
||||
|
||||
this.setResizable(false);
|
||||
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
Panel textPanel = new Panel(new GridBagLayout());
|
||||
|
||||
myJLStatus = new JLabel(myStatus);
|
||||
|
||||
textPanel.add(new JLabel());
|
||||
textPanel.add(myJLStatus);
|
||||
textPanel.add(new JLabel());
|
||||
|
||||
this.getContentPane().add (textPanel, BorderLayout.CENTER);
|
||||
|
||||
this.pack();
|
||||
this.setLocation(statusLeft, statusTop);
|
||||
this.setSize(statusWidth, statusHeight);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public void setStatus(String myStatus) {
|
||||
myJLStatus.setText(myStatus);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
115
src/main/java/guitartex2/UnicodeReader.java
Normal file
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Original pseudocode : Thomas Weidenfeller Implementation tweaked: Aki
|
||||
* Nieminen
|
||||
*
|
||||
* http://www.unicode.org/unicode/faq/utf_bom.html BOMs: 00 00 FE FF = UTF-32,
|
||||
* big-endian FF FE 00 00 = UTF-32, little-endian FE FF = UTF-16, big-endian FF
|
||||
* FE = UTF-16, little-endian EF BB BF = UTF-8
|
||||
*
|
||||
* Win2k Notepad: Unicode format = UTF-16LE
|
||||
**
|
||||
*/
|
||||
package guitartex2;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Generic unicode textreader, which will use BOM mark to identify the encoding
|
||||
* to be used. If BOM is not found then use a given default encoding. System
|
||||
* default is used if: BOM mark is not found and defaultEnc is NULL
|
||||
*
|
||||
* Usage pattern: String defaultEnc = "ISO-8859-1"; // or NULL to use system
|
||||
* default FileInputStream fis = new FileInputStream(file); Reader in = new
|
||||
* UnicodeReader(fis, defaultEnc);
|
||||
*/
|
||||
public class UnicodeReader extends Reader {
|
||||
|
||||
PushbackInputStream internalIn;
|
||||
|
||||
InputStreamReader internalIn2 = null;
|
||||
|
||||
String defaultEnc;
|
||||
|
||||
private static final int BOM_SIZE = 4;
|
||||
|
||||
UnicodeReader(InputStream in, String defaultEnc) {
|
||||
internalIn = new PushbackInputStream(in, BOM_SIZE);
|
||||
this.defaultEnc = defaultEnc;
|
||||
}
|
||||
|
||||
public String getDefaultEncoding() {
|
||||
return defaultEnc;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
if (internalIn2 == null) {
|
||||
return null;
|
||||
}
|
||||
return internalIn2.getEncoding();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read-ahead four bytes and check for BOM marks. Extra bytes are unread
|
||||
* back to the stream, only BOM bytes are skipped.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
protected void init() throws IOException {
|
||||
if (internalIn2 != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String encoding;
|
||||
byte bom[] = new byte[BOM_SIZE];
|
||||
int n, unread;
|
||||
n = internalIn.read(bom, 0, bom.length);
|
||||
|
||||
if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB)
|
||||
&& (bom[2] == (byte) 0xBF)) {
|
||||
encoding = "UTF-8";
|
||||
unread = n - 3;
|
||||
} else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
|
||||
encoding = "UTF-16BE";
|
||||
unread = n - 2;
|
||||
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
|
||||
encoding = "UTF-16LE";
|
||||
unread = n - 2;
|
||||
} else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00)
|
||||
&& (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
|
||||
encoding = "UTF-32BE";
|
||||
unread = n - 4;
|
||||
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)
|
||||
&& (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
|
||||
encoding = "UTF-32LE";
|
||||
unread = n - 4;
|
||||
} else {
|
||||
// Unicode BOM mark not found, unread all bytes
|
||||
encoding = defaultEnc;
|
||||
unread = n;
|
||||
}
|
||||
// System.out.println("read=" + n + ", unread=" + unread);
|
||||
|
||||
if (unread > 0) {
|
||||
internalIn.unread(bom, (n - unread), unread);
|
||||
}
|
||||
|
||||
// Use given encoding
|
||||
if (encoding == null) {
|
||||
internalIn2 = new InputStreamReader(internalIn);
|
||||
} else {
|
||||
internalIn2 = new InputStreamReader(internalIn, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
init();
|
||||
internalIn2.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
init();
|
||||
return internalIn2.read(cbuf, off, len);
|
||||
}
|
||||
}
|
||||
164
src/main/java/guitartex2/WarningBox.java
Normal file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package guitartex2;
|
||||
|
||||
//import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Panel;
|
||||
//import java.awt.Toolkit;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
|
||||
|
||||
public class WarningBox extends JFrame implements ActionListener {
|
||||
private static final long serialVersionUID = -6792186354255191963L;
|
||||
|
||||
private Font titleFont, bodyFont;
|
||||
|
||||
private static final int warnWidth = 330;
|
||||
private static final int warnHeight = 150;
|
||||
private static int warnTop;
|
||||
private static int warnLeft;
|
||||
|
||||
private final JLabel myJLStatus;
|
||||
private final String myInfo;
|
||||
|
||||
private final Action mOkAction, mInfoAction, mQuitAction;
|
||||
private final ResourceBundle resbundle;
|
||||
|
||||
public WarningBox(String myStatus, String mInfo) {
|
||||
resbundle = ResourceBundle.getBundle ("GuitarTeX2strings", Locale.getDefault());
|
||||
|
||||
myInfo = mInfo;
|
||||
|
||||
/* TODO: Bring WarnBox always on top
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
/warnTop = new Double((screenSize.getHeight()/2) - (warnHeight/2)).intValue();
|
||||
warnLeft = new Double((screenSize.getWidth()/2) - (warnWidth/2)).intValue();
|
||||
*/
|
||||
warnTop = 0;
|
||||
warnLeft = 0;
|
||||
|
||||
this.setResizable(false);
|
||||
|
||||
SymWindow aSymWindow = new SymWindow();
|
||||
this.addWindowListener(aSymWindow);
|
||||
|
||||
// Initialize useful fonts
|
||||
titleFont = new Font("Lucida Grande", Font.BOLD, 14);
|
||||
if (titleFont == null) {
|
||||
titleFont = new Font("SansSerif", Font.BOLD, 14);
|
||||
}
|
||||
bodyFont = new Font("Lucida Grande", Font.PLAIN, 10);
|
||||
if (bodyFont == null) {
|
||||
bodyFont = new Font("SansSerif", Font.PLAIN, 10);
|
||||
}
|
||||
java.net.URL imgURL = WarningBox.class.getResource("images/info.png");
|
||||
ImageIcon icon = new ImageIcon(imgURL, "");
|
||||
Panel imagePanel = new Panel(new GridBagLayout());
|
||||
Panel textPanel = new Panel(new GridBagLayout());
|
||||
Panel buttonPanel = new Panel(new GridBagLayout());
|
||||
|
||||
myJLStatus = new JLabel(myStatus);
|
||||
|
||||
imagePanel.add(new JLabel(icon));
|
||||
|
||||
JLabel spaceLabel = new JLabel();
|
||||
|
||||
textPanel.add(spaceLabel);
|
||||
textPanel.add(myJLStatus);
|
||||
textPanel.add(spaceLabel);
|
||||
|
||||
mOkAction = new buttonActionClass(resbundle.getString("okButton"));
|
||||
JButton mOkButton = new JButton(mOkAction);
|
||||
mOkButton.setActionCommand("mOkAction");
|
||||
|
||||
mInfoAction = new buttonActionClass(resbundle.getString("infoButton"));
|
||||
JButton mInfoButton = new JButton(mInfoAction);
|
||||
mInfoButton.setActionCommand("mInfoAction");
|
||||
|
||||
mQuitAction = new buttonActionClass(resbundle.getString("quitButton"));
|
||||
JButton mQuitButton = new JButton(mQuitAction);
|
||||
mQuitButton.setActionCommand("mQuitAction");
|
||||
|
||||
buttonPanel.add(mQuitButton);
|
||||
buttonPanel.add(mInfoButton);
|
||||
buttonPanel.add(mOkButton);
|
||||
|
||||
this.getContentPane().add (imagePanel, BorderLayout.PAGE_START);
|
||||
this.getContentPane().add (textPanel, BorderLayout.CENTER);
|
||||
this.getContentPane().add (buttonPanel, BorderLayout.PAGE_END);
|
||||
|
||||
this.pack();
|
||||
this.setLocation(warnLeft, warnTop);
|
||||
this.setSize(warnWidth, warnHeight);
|
||||
this.setTitle(resbundle.getString("warnTitle"));
|
||||
this.setVisible(true);
|
||||
//this.setResizable(true);
|
||||
}
|
||||
|
||||
|
||||
public class buttonActionClass extends AbstractAction {
|
||||
private static final long serialVersionUID = 3791659234149686228L;
|
||||
|
||||
public buttonActionClass(String text) {
|
||||
super(text);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String mAction = e.getActionCommand();
|
||||
if ( mAction.equals("mQuitAction")) {
|
||||
System.exit(1);
|
||||
}
|
||||
if ( mAction.equals("mOkAction")) {
|
||||
setVisible(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
if ( mAction.equals("mInfoAction")) {
|
||||
new InfoBox(myInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SymWindow extends java.awt.event.WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent event) {
|
||||
setVisible(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent newEvent) {
|
||||
setVisible(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
11
src/main/resources/GuitarTeX2.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
latex=/usr/bin/latex
|
||||
xdvi=/usr/bin/xdvi
|
||||
pdflatex=/usr/bin/pdflatex
|
||||
windowsTmpPath=
|
||||
tmpPath=
|
||||
windowsPdfViewer=/Programme/Adobe/Reader/AcroRd32.exe
|
||||
linuxPdfViewer=/usr/bin/acroread
|
||||
exSongFile=griechischer_wein.gtx
|
||||
exBookFile=my_first_book.gtb
|
||||
gtxServer=guitartex2.nikolai-rinas.de
|
||||
gtxServerPort=3121
|
||||
129
src/main/resources/GuitarTeX2strings.properties
Normal file
@@ -0,0 +1,129 @@
|
||||
fileMenu=File
|
||||
newItem=New
|
||||
openItem=Open...
|
||||
closeItem=Close
|
||||
saveItem=Save
|
||||
saveAsItem=Save As...
|
||||
templateItem=Templates
|
||||
simpleSong=Song
|
||||
simpleBook=Book
|
||||
exitItem=Quit
|
||||
|
||||
editMenu=Edit
|
||||
mPrefs=Preferences
|
||||
undoItem=Undo
|
||||
cutItem=Cut
|
||||
copyItem=Copy
|
||||
pasteItem=Paste
|
||||
clearItem=Clear
|
||||
selectAllItem=Select All
|
||||
|
||||
buildMenu=Build
|
||||
gtx2tex=GTX2TeX
|
||||
latex=Latex
|
||||
dvi2ps=Dvi2Ps
|
||||
dvi2pdf=Dvi2Pdf
|
||||
tex2pdf=TeX2Pdf
|
||||
|
||||
|
||||
helpMenu=Help
|
||||
aboutItem=About
|
||||
aboutTitle=About
|
||||
faqItem=FAQ
|
||||
faqURL=http://guitartex2.sourceforge.net/page7/page6/page6.html
|
||||
shortcutItem=Shortcuts
|
||||
shortcutsURL=http://guitartex2.sourceforge.net/page7/page30/page30.html
|
||||
consoleItem=Console
|
||||
|
||||
consoleTitle=Console
|
||||
consoleInitText=Debugging and testing console
|
||||
consoleSendButton=send
|
||||
|
||||
actionToolBar=Actions
|
||||
chordsToolBar=Chords
|
||||
tabsToolBar=Tabs
|
||||
structToolBar=Structure
|
||||
melodyToolBar=Melody Creator
|
||||
mShowTeXArea=TeX-Preview
|
||||
harpToolBar=Channels
|
||||
|
||||
mHarpTone1=1
|
||||
mHarpTone2=2
|
||||
mHarpTone3=3
|
||||
mHarpTone4=4
|
||||
mHarpTone5=5
|
||||
mHarpTone6=6
|
||||
mHarpTone7=7
|
||||
mHarpTone8=8
|
||||
mHarpTone9=9
|
||||
mHarpTone10=10
|
||||
|
||||
mToneA=A
|
||||
mTonea=a
|
||||
mToneAs=Bb
|
||||
mToneH=B
|
||||
mToneC=C
|
||||
mToneCis=C#
|
||||
mToneD=D
|
||||
mToneDis=D#
|
||||
mToneE=E
|
||||
mTonee=e
|
||||
mToneF=F
|
||||
mToneFis=F#
|
||||
mToneG=G
|
||||
mToneGis=G#
|
||||
|
||||
mLanguage=Language
|
||||
mTitle=Title
|
||||
mSubtitle=Subtitle
|
||||
mBridge=Bridge
|
||||
mChorus=Chorus
|
||||
mBold=Comment
|
||||
mGuitarTab=Tabs
|
||||
|
||||
mNewFile=New File
|
||||
|
||||
checkConn=Checking connection to the server ...
|
||||
createPdf=Creating PDF ...
|
||||
showPdf=Try to display PDF File ...
|
||||
|
||||
sendTexFile=Sending TeX-File ...
|
||||
wait4PdfFile=Waiting for results ...
|
||||
receivePdfFile=Receiving PDF-File ...
|
||||
receiveLogFile=Receiving Log-File ...
|
||||
confFailed=Load configuration failed!
|
||||
texFailed=Failed to create PDF file!\nPlease check your document!
|
||||
|
||||
mSaveQuestionHead=File has been changed!
|
||||
mSaveQuestion=Would you like to save your file?
|
||||
|
||||
prefTitle=Preferences
|
||||
mPrefLatex=Latex
|
||||
mPrefXDvi=XDvi
|
||||
mPrefPdfLatex=PdfLatex
|
||||
mPrefPdfViewer=PdfViewer
|
||||
mPrefTmpPath=TmpDir
|
||||
mPrefGtxServer=Server
|
||||
mPrefGtxServerPort=Port
|
||||
|
||||
mBookToolBar=Book Toolbar
|
||||
mSetBook=Book
|
||||
mBookAuthor=Author
|
||||
mBookTitle=Title
|
||||
mBookDate=Date
|
||||
mBookInclude=Include
|
||||
|
||||
resetButton=Reset
|
||||
okButton=OK
|
||||
cancelButton=Cancel
|
||||
quitButton=Quit
|
||||
infoButton=Info
|
||||
|
||||
choose=Choose
|
||||
|
||||
warnTitle=Warning!
|
||||
statusTitle=Status
|
||||
|
||||
frameConstructor=GuitarTeX2
|
||||
appVersion=Version - 3.4.1
|
||||
copyright=Nikolai Rinas
|
||||
128
src/main/resources/GuitarTeX2strings_de.properties
Normal file
@@ -0,0 +1,128 @@
|
||||
fileMenu=Datei
|
||||
newItem=Neu
|
||||
openItem=Öffnen...
|
||||
closeItem=Schließen
|
||||
saveItem=Speichern
|
||||
saveAsItem=Speichern unter...
|
||||
templateItem=Templates
|
||||
simpleSong=Lied
|
||||
simpleBook=Liederbuch
|
||||
exitItem=Beenden
|
||||
|
||||
editMenu=Bearbeiten
|
||||
mPrefs=Einstellungen
|
||||
undoItem=
|
||||
cutItem=Ausschneiden
|
||||
copyItem=Kopieren
|
||||
pasteItem=Einfügen
|
||||
clearItem=Löschen
|
||||
selectAllItem=Alles auswählen
|
||||
|
||||
buildMenu=Erstellen
|
||||
gtx2tex=GTX2TeX
|
||||
latex=Latex
|
||||
dvi2ps=Dvi2Ps
|
||||
dvi2pdf=Dvi2Pdf
|
||||
tex2pdf=TeX2Pdf
|
||||
|
||||
helpMenu=Hilfe
|
||||
aboutItem=Über GuitarTeX2
|
||||
aboutTitle=Über GuitarTeX2
|
||||
faqItem=FAQ
|
||||
faqURL=http://guitartex2.sourceforge.net/page7/page6/page6.html
|
||||
shortcutItem=Shortcuts
|
||||
shortcutsURL=http://guitartex2.sourceforge.net/page7/page30/page30.html
|
||||
consoleItem=Konsole
|
||||
|
||||
consoleTitle=Konsole
|
||||
consoleInitText=Konsole zum Testen und Debuggen
|
||||
consoleSendButton=Senden
|
||||
|
||||
actionToolBar=Aktionen
|
||||
chordsToolBar=Akkorde
|
||||
tabsToolBar=Tabulatur
|
||||
structToolBar=Struktur
|
||||
melodyToolBar=Melodie Creator
|
||||
mShowTeXArea=TeX-Vorschau
|
||||
harpToolBar=Kanzellen
|
||||
|
||||
mHarpTone1=1
|
||||
mHarpTone2=2
|
||||
mHarpTone3=3
|
||||
mHarpTone4=4
|
||||
mHarpTone5=5
|
||||
mHarpTone6=6
|
||||
mHarpTone7=7
|
||||
mHarpTone8=8
|
||||
mHarpTone9=9
|
||||
mHarpTone10=10
|
||||
|
||||
mToneA=A
|
||||
mTonea=a
|
||||
mToneAs=B
|
||||
mToneH=H
|
||||
mToneC=C
|
||||
mToneCis=C#
|
||||
mToneD=D
|
||||
mToneDis=D#
|
||||
mToneE=E
|
||||
mTonee=e
|
||||
mToneF=F
|
||||
mToneFis=F#
|
||||
mToneG=G
|
||||
mToneGis=G#
|
||||
|
||||
mLanguage=Sprache
|
||||
mTitle=Titel
|
||||
mSubtitle=Komponist
|
||||
mBridge=Vers
|
||||
mChorus=Refrain
|
||||
mBold=Kommentar
|
||||
mGuitarTab=Tabulatur
|
||||
|
||||
mNewFile=Neue Datei
|
||||
|
||||
checkConn=Überprüfe Verbindung zum Server ...
|
||||
createPdf=Erstelle PDF ...
|
||||
showPdf=Versuche die PDF Datei darzustellen ...
|
||||
|
||||
sendTexFile=Versende TeX-Datei ...
|
||||
wait4PdfFile=Warte auf das Ergebnis ...
|
||||
receivePdfFile=Empfange PDF-Datei ...
|
||||
receiveLogFile=Empfange Log-Datei ...
|
||||
confFailed=Laden von Konfigurationsdatei fehlgeschlagen!
|
||||
texFailed=PDF Datei kann nicht erzeugt werden!\nBitte Überprüfen Sie Ihr Dokument!
|
||||
|
||||
mSaveQuestionHead=Datei wurde verändert!
|
||||
mSaveQuestion=Wollen Sie die Datei speichern?
|
||||
|
||||
prefTitle=Einstellungen
|
||||
mPrefLatex=Latex
|
||||
mPrefXDvi=XDvi
|
||||
mPrefPdfLatex=PdfLatex
|
||||
mPrefPdfViewer=PdfBetrachter
|
||||
mPrefTmpPath=TmpVerzeichnis
|
||||
mPrefGtxServer=Server
|
||||
mPrefGtxServerPort=Port
|
||||
|
||||
mBookToolBar=Buch Toolbar
|
||||
mSetBook=Buch
|
||||
mBookAuthor=Autor
|
||||
mBookTitle=Titel
|
||||
mBookDate=Datum
|
||||
mBookInclude=Einfügen
|
||||
|
||||
resetButton=Zurücksetzen
|
||||
okButton=OK
|
||||
cancelButton=Abbrechen
|
||||
quitButton=Beenden
|
||||
infoButton=Info
|
||||
|
||||
choose=Auswählen
|
||||
|
||||
warnTitle=Warnung!
|
||||
statusTitle=Status
|
||||
|
||||
frameConstructor=GuitarTeX2
|
||||
appVersion=Version - 3.4.1
|
||||
copyright=Nikolai Rinas
|
||||
BIN
src/main/resources/images/dvipdf.png
Normal file
|
After Width: | Height: | Size: 892 B |
BIN
src/main/resources/images/dvips.png
Normal file
|
After Width: | Height: | Size: 1017 B |
BIN
src/main/resources/images/filenew.png
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
src/main/resources/images/fileopen.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/resources/images/filesave.png
Normal file
|
After Width: | Height: | Size: 821 B |
BIN
src/main/resources/images/filesaveas.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/main/resources/images/gitarre1.jpg
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
src/main/resources/images/gtx2tex.png
Normal file
|
After Width: | Height: | Size: 761 B |
BIN
src/main/resources/images/icon-down2.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/main/resources/images/icon-up2.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/main/resources/images/icon1.jpg
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/resources/images/info.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
src/main/resources/images/latex.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/main/resources/images/tex2pdf.png
Normal file
|
After Width: | Height: | Size: 909 B |