mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
more working on multiple files
This commit is contained in:
@@ -73,6 +73,9 @@ public class PdeCode {
|
||||
//history.record(s, PdeHistory.SAVE);
|
||||
|
||||
try {
|
||||
System.out.println("saving to " + file);
|
||||
System.out.println("stuff to save: " + program);
|
||||
System.out.println("-------");
|
||||
PdeBase.saveFile(program, file);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1377,6 +1377,7 @@ public class PdeEditor extends JFrame
|
||||
// so that checkModified2 will just do nothing
|
||||
checking = 0;
|
||||
}
|
||||
message("Done Saving.");
|
||||
buttons.clear();
|
||||
}
|
||||
|
||||
|
||||
+14
-12
@@ -369,19 +369,21 @@ public class PdeEditorHeader extends JComponent /*implements MouseListener*/ {
|
||||
|
||||
menu.add(unhide);
|
||||
|
||||
menu.addSeparator();
|
||||
if (sketch != null) {
|
||||
menu.addSeparator();
|
||||
|
||||
ActionListener jumpListener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//System.out.println("jump to " + e.getActionCommand());
|
||||
System.out.println("jump to " + e);
|
||||
}
|
||||
};
|
||||
for (int i = 0; i < sketch.codeCount; i++) {
|
||||
item = new JMenuItem(sketch.code[i].name);
|
||||
//item.setActionCommand(files[i]);
|
||||
item.addActionListener(jumpListener);
|
||||
menu.add(item);
|
||||
ActionListener jumpListener = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//System.out.println("jump to " + e.getActionCommand());
|
||||
System.out.println("jump to " + e);
|
||||
}
|
||||
};
|
||||
for (int i = 0; i < sketch.codeCount; i++) {
|
||||
item = new JMenuItem(sketch.code[i].name);
|
||||
//item.setActionCommand(files[i]);
|
||||
item.addActionListener(jumpListener);
|
||||
menu.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -199,9 +199,6 @@ public class PdeSketch {
|
||||
}
|
||||
}
|
||||
|
||||
// set the main file to be the current tab
|
||||
current = code[0];
|
||||
|
||||
// cheap-ass sort of the rest of the files
|
||||
// it's a dumb, slow sort, but there shouldn't be more than ~5 files
|
||||
for (int i = 1; i < codeCount; i++) {
|
||||
@@ -217,6 +214,10 @@ public class PdeSketch {
|
||||
code[i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
// set the main file to be the current tab
|
||||
//current = code[0];
|
||||
setCurrent(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -226,6 +227,7 @@ public class PdeSketch {
|
||||
//public void setCurrentModified(boolean what) {
|
||||
//public void setModified(boolean what) {
|
||||
public void setModified() {
|
||||
System.out.println("setting modified for " + current.program);
|
||||
//modified = true;
|
||||
current.modified = true;
|
||||
//editor.header.repaint();
|
||||
@@ -261,6 +263,11 @@ public class PdeSketch {
|
||||
* Save all code in the current sketch.
|
||||
*/
|
||||
public void save() throws IOException {
|
||||
// get the current text area
|
||||
if (current.modified) {
|
||||
current.program = editor.getText();
|
||||
}
|
||||
|
||||
// check if the files are read-only.
|
||||
// if so, need to first do a "save as".
|
||||
if (modified && isReadOnly()) {
|
||||
@@ -272,7 +279,7 @@ public class PdeSketch {
|
||||
}
|
||||
|
||||
for (int i = 0; i < codeCount; i++) {
|
||||
code[i].save();
|
||||
if (code[i].modified) code[i].save();
|
||||
}
|
||||
calcModified();
|
||||
}
|
||||
@@ -286,6 +293,8 @@ public class PdeSketch {
|
||||
|
||||
public void saveAs() {
|
||||
System.err.println("need to save ass here. code not yet finished.");
|
||||
|
||||
// mark all files as modified so that it will save them
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +374,8 @@ public class PdeSketch {
|
||||
|
||||
// and i'll personally make a note of the change
|
||||
//current = which;
|
||||
|
||||
editor.header.rebuild();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -89,7 +89,7 @@ buttons.status.color = #333322
|
||||
|
||||
# settings for the tabs at the top
|
||||
# actual tab images are stored in the lib/ folder
|
||||
header.bgcolor = #333322
|
||||
header.bgcolor = #4C4C3E
|
||||
header.text.selected.color = #ffffff
|
||||
header.text.unselected.color = #999988
|
||||
header.text.font = SansSerif,plain,12
|
||||
|
||||
Reference in New Issue
Block a user