inline rename with shift f6

This commit is contained in:
Radek Davidek 2026-01-20 18:02:57 +01:00
parent 54889fb4c1
commit 1a71db41d7
3 changed files with 66 additions and 2 deletions

View File

@ -94,6 +94,38 @@ public class AppConfig {
properties.setProperty("window.maximized", String.valueOf(maximized));
}
public int getFileEditorX() {
return Integer.parseInt(properties.getProperty("fileeditor.x", "150"));
}
public void setFileEditorX(int x) {
properties.setProperty("fileeditor.x", String.valueOf(x));
}
public int getFileEditorY() {
return Integer.parseInt(properties.getProperty("fileeditor.y", "150"));
}
public void setFileEditorY(int y) {
properties.setProperty("fileeditor.y", String.valueOf(y));
}
public int getFileEditorWidth() {
return Integer.parseInt(properties.getProperty("fileeditor.width", "800"));
}
public void setFileEditorWidth(int width) {
properties.setProperty("fileeditor.width", String.valueOf(width));
}
public int getFileEditorHeight() {
return Integer.parseInt(properties.getProperty("fileeditor.height", "600"));
}
public void setFileEditorHeight(int height) {
properties.setProperty("fileeditor.height", String.valueOf(height));
}
public String getActivePanel() {
return properties.getProperty("active.panel", "left");
}

View File

@ -65,8 +65,12 @@ public class FileEditor extends JDialog {
// Final window positioning and visibility - only set default size if NOT an image
if (!isImageFile(file)) {
setSize(800, 600);
setSize(config.getFileEditorWidth(), config.getFileEditorHeight());
if (config.getFileEditorX() == 150 && config.getFileEditorY() == 150) {
setLocationRelativeTo(parent);
} else {
setLocation(config.getFileEditorX(), config.getFileEditorY());
}
}
// Intercept window close (X) so we run the same save-confirm flow as other close actions
@ -1036,7 +1040,18 @@ public class FileEditor extends JDialog {
}
}
private void saveWindowState() {
if (!isImageFile(file)) {
config.setFileEditorX(this.getX());
config.setFileEditorY(this.getY());
config.setFileEditorWidth(this.getWidth());
config.setFileEditorHeight(this.getHeight());
config.saveConfig();
}
}
private void closeEditor() {
saveWindowState();
if (!readOnly && modified) {
int result = showSaveConfirmDialog("Soubor byl změněn. Uložit změny?", "Neuložené změny");

View File

@ -76,6 +76,23 @@ public class FilePanelTab extends JPanel {
/** Start inline rename for currently selected item (if single selection). */
public void startInlineRename() {
// If already editing, special logic: select filename without extension
if (fileTable.isEditing()) {
Component ed = fileTable.getEditorComponent();
if (ed instanceof JTextField) {
JTextField tf = (JTextField) ed;
String text = tf.getText();
int lastDot = text.lastIndexOf('.');
if (lastDot > 0) { // Found a dot, and it's not the first character
tf.setSelectionStart(0);
tf.setSelectionEnd(lastDot);
} else {
tf.selectAll();
}
}
return;
}
// Determine selected row/column according to view mode
int selRow = fileTable.getSelectedRow();
if (selRow < 0) return;