Skip to content

Commit

Permalink
Fixed the shit before I went fucking insane, im god damn hungry.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBColton committed Jun 6, 2013
1 parent 4d271fb commit 9add999
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 38 deletions.
26 changes: 2 additions & 24 deletions org/lateralgm/main/Prefs.java
Expand Up @@ -112,7 +112,7 @@ public static void loadPrefs()
enableDragAndDrop = getBoolean("enableDragAndDrop", true);
forceMaximized = getBoolean("forceMaximized", false);
dockEventPanel = getBoolean("dockEventPanel", false);
actionLibrary = getString("actionLibrary","Default");
actionLibraryPath = getString("actionLibraryPath","org/lateralgm/resources/library/default");
userLibraryPath = getString("userLibraryPath","./lib");

eventKeyInputAddKey = KeyEvent.VK_BACK_SLASH;
Expand Down Expand Up @@ -158,7 +158,7 @@ public static void loadPrefs()

public static boolean dockEventPanel;
public static boolean enableDragAndDrop;
public static String actionLibrary;
public static String actionLibraryPath;
public static String userLibraryPath;
public static int actionToolTipColumns;
public static int actionToolTipLines;
Expand All @@ -174,27 +174,5 @@ public static void loadPrefs()
public static String externalScriptExtension;
public static boolean useExternalSoundEditor;
public static String externalSoundEditorCommand;

public static String getActionLibraryPath()
{
String ret;
if (actionLibrary.contains("Custom")) {
ret = userLibraryPath;
} else {
ret = "org/lateralgm/resources/library/libs/";
}
return ret;
}

public static String getActionLibraryFullPath()
{
String ret;
if (actionLibrary.contains("Custom")) {
ret = userLibraryPath;
} else {
ret = "org/lateralgm/resources/library/libs/" + actionLibrary.toLowerCase();
}
return ret;
}

}
6 changes: 0 additions & 6 deletions org/lateralgm/main/PrefsStore.java
Expand Up @@ -71,12 +71,6 @@ public static void setIconPack(String s)
Prefs.iconPack = s;
}

public static void setActionLibrary(String s)
{
PREFS.put("actionLibrary",s);
Prefs.actionLibrary = s;
}

public static void setUserLibraryPath(String s)
{
PREFS.put("userLibraryPath",s);
Expand Down
2 changes: 1 addition & 1 deletion org/lateralgm/main/preferences.properties
Expand Up @@ -42,7 +42,7 @@ iconPath = icons/

#Library settings
enableDragAndDrop = true
actionLibrary = Standard
actionLibraryPath = org/lateralgm/resources/library/default
userLibraryPath = ./lib
#D&D Actions in objects show a tooltip of their settings. Set these to 0 to disable.
actionToolTipColumns = 30
Expand Down
16 changes: 11 additions & 5 deletions org/lateralgm/resources/library/LibManager.java
Expand Up @@ -62,24 +62,30 @@ public static LibAction getLibAction(int libraryId, int libActionId)
*/
public static void autoLoad()
{
File dir = new File(Prefs.getActionLibraryFullPath());
if (!Prefs.enableDragAndDrop) {
codeAction = makeCodeAction();
return;
}

File dir = new File(Prefs.actionLibraryPath);
if (!dir.exists())
{
if (LGM.workDir == null) return;
dir = new File(LGM.workDir,Prefs.getActionLibraryFullPath());
dir = new File(LGM.workDir,Prefs.actionLibraryPath);
if (!dir.exists()) dir = LGM.workDir;
}

codeAction = null;

if (!Prefs.actionLibrary.contains("Custom"))
autoLoad(dir);
autoLoad(dir);

File userLibF = new File(Prefs.userLibraryPath);
if (userLibF.exists())
autoLoad(userLibF);

if (codeAction == null) codeAction = makeCodeAction();
if (codeAction == null) {
codeAction = makeCodeAction();
}
}

/** Loads in all libs/lgls in a given location (directory or zip file) */
Expand Down
Binary file not shown.
7 changes: 5 additions & 2 deletions org/lateralgm/subframes/PreferencesFrame.java
Expand Up @@ -96,7 +96,7 @@ private JPanel makeGeneralPrefs()
JLabel actionsLabel = new JLabel(Messages.getString("PreferencesFrame.ACTIONLIBRARY") + ":");
String[] actionsOptions = { "Standard", "Logic", "Custom" };
actionsCombo = new JComboBox(actionsOptions);
actionsCombo.setSelectedItem(Prefs.actionLibrary);
//actionsCombo.setSelectedItem(Prefs.actionLibrary);
actionsPath = new JTextField();
actionsPath.setText(Prefs.userLibraryPath);

Expand Down Expand Up @@ -125,10 +125,12 @@ private JPanel makeGeneralPrefs()
.addComponent(themePath)
.addComponent(iconPath)
.addComponent(manualPath))
/*
.addGroup(gl.createSequentialGroup()
.addComponent(actionsLabel)
.addComponent(actionsCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(actionsPath))
*/
);
gl.setVerticalGroup(
gl.createSequentialGroup()
Expand All @@ -152,10 +154,12 @@ private JPanel makeGeneralPrefs()
.addGroup(gl.createSequentialGroup()
.addComponent(manualPathLabel)
.addComponent(manualPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
/*
.addGroup(gl.createParallelGroup(Alignment.BASELINE)
.addComponent(actionsLabel)
.addComponent(actionsCombo)
.addComponent(actionsPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
*/
);

p.setLayout(gl);
Expand Down Expand Up @@ -439,7 +443,6 @@ public void SavePreferences()
PrefsStore.setDNDEnabled(dndEnable.isSelected());
PrefsStore.setExtraNodes(extraNodesEnable.isSelected());
PrefsStore.setLanguageName((String)langCombo.getSelectedItem());
PrefsStore.setActionLibrary((String)actionsCombo.getSelectedItem());
PrefsStore.setUserLibraryPath(actionsPath.getText());
PrefsStore.setSpriteExt(spriteMIME.getText());
PrefsStore.setBackgroundExt(backgroundMIME.getText());
Expand Down

0 comments on commit 9add999

Please sign in to comment.