Skip to content

Commit 1bf8c41

Browse files
committed
Release of Verion 3.0
New file format (.xml instead of some weird and unreadable .csv). This version reads the old but saves the new format.
1 parent 5e8b230 commit 1bf8c41

22 files changed

+846
-397
lines changed

.classpath

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4-
<classpathentry kind="src" path="src"/>
5-
<classpathentry kind="src" path="resources"/>
6-
<classpathentry kind="lib" path="H:/Programming/Java/jnativehook/jar/jnativehook-2.1.0.jar"/>
7-
<classpathentry kind="output" path="bin"/>
3+
<classpathentry kind="con"
4+
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
5+
<classpathentry kind="src" path="src" />
6+
<classpathentry kind="src" path="resources" />
7+
<classpathentry kind="lib"
8+
path="H:/Programming/Java/jnativehook/jar/jnativehook-2.1.0.jar" />
9+
<classpathentry kind="output" path="bin" />
810
</classpath>

settings.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<settings>
3+
<last-notes-file>H:\Gaming\Factorio\any%_Nefrums - Kopie.txt</last-notes-file>
4+
<color-settings current="Dark">
5+
<color-profile>
6+
<name>Light</name>
7+
<text>-16777216</text>
8+
<border>-16777216</border>
9+
<background>-1</background>
10+
</color-profile>
11+
<color-profile>
12+
<name>Dark</name>
13+
<text>-4144960</text>
14+
<border>-12566464</border>
15+
<background>-16777216</background>
16+
</color-profile>
17+
<color-profile>
18+
<name>Custom</name>
19+
<text>-1</text>
20+
<border>-1</border>
21+
<background>-1</background>
22+
</color-profile>
23+
</color-settings>
24+
<hotkey-settings ctrl-workaround="true" current="">
25+
<hotkey-profile>
26+
<name>Default</name>
27+
<split>11,4,0</split>
28+
<reset>10,4,0</reset>
29+
<undo>2,4,0</undo>
30+
<skip>4,4,0</skip>
31+
</hotkey-profile>
32+
<hotkey-profile>
33+
<name>test</name>
34+
<split>37,1,34</split>
35+
<reset>32,1,170</reset>
36+
<undo>2,4,0</undo>
37+
<skip>4,4,0</skip>
38+
</hotkey-profile>
39+
</hotkey-settings>
40+
</settings>

src/edit/CellEditDialog.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
public class CellEditDialog
4545
{
46-
public static JDialog cellEditDialog;
46+
private static JDialog cellEditDialog;
4747

4848
private static Cell selectedCell;
4949
private static EditPanel selectedCellPanel;
@@ -67,7 +67,7 @@ public class CellEditDialog
6767

6868
private static String[] possibleActionsArray = new String[] {"", "text_to_clipboard", "file_to_clipboard"};
6969

70-
public static boolean iconEditEditorOpen = false;
70+
private static boolean iconEditorOpen = false;
7171

7272
private static String[] abbreviationsAndFileNamesList;
7373

@@ -260,7 +260,7 @@ public static void hideEditDialog()
260260

261261
public static void processCell(Cell cell)
262262
{
263-
if (iconEditEditorOpen)
263+
if (iconEditorOpen)
264264
return;
265265

266266
// cell
@@ -383,7 +383,7 @@ public void mouseClicked(MouseEvent e)
383383

384384
private static void processEditPanel(EditPanel edit_panel)
385385
{
386-
if (iconEditEditorOpen)
386+
if (iconEditorOpen)
387387
return;
388388

389389
if (selectedCellPanel != null)
@@ -451,7 +451,7 @@ private static ActionListener getIconEditListener()
451451

452452
private void closeDialog(JDialog dialog)
453453
{
454-
iconEditEditorOpen = false;
454+
iconEditorOpen = false;
455455
dialog.dispose();
456456
}
457457

@@ -460,7 +460,7 @@ public void actionPerformed(ActionEvent ae)
460460
{
461461
updateAbbreviationsAndFileNamesList();
462462

463-
iconEditEditorOpen = true;
463+
iconEditorOpen = true;
464464

465465
main_image_abbr = ( (EditIconLabel) selectedCellPanel).getMainImageAbbr();
466466
layered_image_abbr = ( (EditIconLabel) selectedCellPanel).getLayeredImageAbbr();
@@ -761,7 +761,7 @@ public void actionPerformed(ActionEvent e)
761761
};
762762
}
763763

764-
public static String getLowercaseStringWithFirstCharCapitablized(String str)
764+
private static String getLowercaseStringWithFirstCharCapitablized(String str)
765765
{
766766
return str.length() == 0 ? str : str.length() == 1 ? str.toUpperCase() : Character.toUpperCase(str.charAt(0) ) + str.substring(1).toLowerCase();
767767
}

src/edit/EditIconLabel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public EditIconLabel(Icon new_icon, String main_image_abbr, String layered_image
4242
this.setOpaque(true);
4343
}
4444

45-
public void updateIcon(String main_image_abbr, String layered_image_abbr, String horizontal_alignment, String vertical_alignment)
45+
void updateIcon(String main_image_abbr, String layered_image_abbr, String horizontal_alignment, String vertical_alignment)
4646
{
4747
this.mainImageAbbr = main_image_abbr;
4848
this.layeredImageAbbr = layered_image_abbr;
@@ -52,7 +52,7 @@ public void updateIcon(String main_image_abbr, String layered_image_abbr, String
5252
this.setIcon(icon);
5353
}
5454

55-
public void updateIcon(String main_image_abbr)
55+
void updateIcon(String main_image_abbr)
5656
{
5757
this.mainImageAbbr = main_image_abbr;
5858
this.layeredImageAbbr = this.layeredHorizontalAlignment = this.layeredVerticalAlignment = "";
@@ -75,7 +75,7 @@ public void setDefaultBorder()
7575
this.setBorder(GuiHelper.getEmptyBorder() );
7676
}
7777

78-
public static EditIconLabel getEmptyEditIconLabel()
78+
static EditIconLabel getEmptyEditIconLabel()
7979
{
8080
return new EditIconLabel();
8181
}

src/gui/Abbreviations.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import javax.swing.ScrollPaneConstants;
2020
import javax.swing.event.MouseInputAdapter;
2121

22+
import org.w3c.dom.Document;
23+
import org.w3c.dom.Element;
24+
2225
import gui.MainGui;
2326
import logic.FileOperations;
2427

@@ -27,7 +30,7 @@ public class Abbreviations
2730
private static ArrayList<String[]> abbreviationsList = new ArrayList<String[]>();
2831

2932
@SuppressWarnings("unchecked")
30-
public static void showAbbreviationSettingsDialog()
33+
static void showAbbreviationSettingsDialog()
3134
{
3235
showAbbreviationSettingsDialog(FileOperations.fileAbbreviations, FileOperations.imagesDirectory, (ArrayList<String[]>) abbreviationsList.clone() );
3336
}
@@ -257,7 +260,7 @@ public static void setAbbreviationsList(ArrayList<String[]> abbreviations_list)
257260
abbreviationsList = abbreviations_list.stream().sorted( (a,b) -> {return a[0].compareTo(b[0] ); } ).collect(Collectors.toCollection(ArrayList::new) );
258261
}
259262

260-
public static ArrayList<String[]> getAbbreviationsListFromTextfiles(ArrayList<JTextField[]> textfields)
263+
private static ArrayList<String[]> getAbbreviationsListFromTextfiles(ArrayList<JTextField[]> textfields)
261264
{
262265
return textfields.stream().map(row -> new String[] {row[0].getText(), row[1].getText() } ).collect(Collectors.toCollection(ArrayList::new) );
263266
}
@@ -288,4 +291,30 @@ public static String getAbbreviationSaveString()
288291
res += abbr[0] + ":" + abbr[1] + "\n";
289292
return res;
290293
}
294+
295+
public static Element getAbbreviationsElement(Document doc)
296+
{
297+
Element abbreviations_element = doc.createElement("abbreviations");
298+
299+
for (String[] abbr : abbreviationsList)
300+
{
301+
Element abbr_element = doc.createElement("abbreviation");
302+
abbreviations_element.appendChild(abbr_element);
303+
304+
Element abbr_short_element = doc.createElement("abbr-short");
305+
abbr_short_element.setTextContent(abbr[0] );
306+
abbr_element.appendChild(abbr_short_element);
307+
308+
Element abbr_long_element = doc.createElement("abbr-long");
309+
abbr_long_element.setTextContent(abbr[1] );
310+
abbr_element.appendChild(abbr_long_element);
311+
}
312+
313+
return abbreviations_element;
314+
}
315+
316+
public static void parseAbbreviationselement(Element abbreviaitons_element)
317+
{
318+
319+
}
291320
}

src/gui/ColorSettingProfile.java

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package gui;
22
import java.awt.Color;
33

4+
import org.w3c.dom.Document;
5+
import org.w3c.dom.Element;
6+
47
public class ColorSettingProfile
58
{
6-
public String name;
7-
public Color text;
8-
public Color border;
9-
public Color background;
9+
private String name;
10+
private Color text;
11+
private Color border;
12+
private Color background;
1013

1114
public ColorSettingProfile(String name, Color text, Color border, Color background)
1215
{
@@ -15,4 +18,50 @@ public ColorSettingProfile(String name, Color text, Color border, Color backgrou
1518
this.border = border;
1619
this.background = background;
1720
}
21+
22+
public ColorSettingProfile(Element profile, String current_profile_name)
23+
{
24+
this.name = profile.getElementsByTagName("name").item(0).getTextContent();
25+
this.text = new Color(Integer.parseInt(profile.getElementsByTagName("text").item(0).getTextContent() ) );
26+
this.border = new Color(Integer.parseInt(profile.getElementsByTagName("border").item(0).getTextContent() ) );
27+
this.background = new Color(Integer.parseInt(profile.getElementsByTagName("background").item(0).getTextContent() ) );
28+
29+
if (name.equals(current_profile_name) )
30+
ColorSettings.currentColorSetting = this;
31+
}
32+
33+
public void update(Color text, Color border, Color background)
34+
{
35+
this.text = text;
36+
this.border = border;
37+
this.background = background;
38+
}
39+
40+
public String getName() { return name; }
41+
public Color getTextColor() { return text; }
42+
public Color getBorderColor() { return border; }
43+
public Color getBackgroundColor() { return background; }
44+
45+
public Element getXMLElement(Document doc)
46+
{
47+
Element result = doc.createElement("color-profile");
48+
49+
Element titleElement = doc.createElement("name");
50+
titleElement.setTextContent(name);
51+
result.appendChild(titleElement);
52+
53+
Element textElement = doc.createElement("text");
54+
textElement.setTextContent("" + text.getRGB() );
55+
result.appendChild(textElement);
56+
57+
Element borderElement = doc.createElement("border");
58+
borderElement.setTextContent("" + border.getRGB() );
59+
result.appendChild(borderElement);
60+
61+
Element backgroundElement = doc.createElement("background");
62+
backgroundElement.setTextContent("" + background.getRGB() );
63+
result.appendChild(backgroundElement);
64+
65+
return result;
66+
}
1867
}

0 commit comments

Comments
 (0)