|
38 | 38 | import processing.app.helpers.Keys;
|
39 | 39 | import processing.app.helpers.OSUtils;
|
40 | 40 | import processing.app.helpers.PreferencesMapException;
|
| 41 | +import processing.app.helpers.StringReplacer; |
41 | 42 | import processing.app.legacy.PApplet;
|
42 | 43 | import processing.app.syntax.PdeKeywords;
|
43 | 44 | import processing.app.syntax.SketchTextArea;
|
@@ -1935,12 +1936,25 @@ private void updateTitle() {
|
1935 | 1936 | return;
|
1936 | 1937 | }
|
1937 | 1938 | SketchFile current = getCurrentTab().getSketchFile();
|
1938 |
| - if (current.isPrimary()) { |
1939 |
| - setTitle(I18n.format(tr("{0} | Arduino {1}"), sketch.getName(), |
1940 |
| - BaseNoGui.VERSION_NAME_LONG)); |
| 1939 | + String customFormat = PreferencesData.get("editor.custom_title_format"); |
| 1940 | + if (customFormat != null && !customFormat.trim().isEmpty()) { |
| 1941 | + Map<String, String> titleMap = new HashMap<String, String>(); |
| 1942 | + titleMap.put("file", current.getFileName()); |
| 1943 | + String path = sketch.getFolder().getAbsolutePath(); |
| 1944 | + titleMap.put("folder", path); |
| 1945 | + titleMap.put("path", path); |
| 1946 | + titleMap.put("project", sketch.getName()); |
| 1947 | + titleMap.put("version", BaseNoGui.VERSION_NAME_LONG); |
| 1948 | + |
| 1949 | + setTitle(StringReplacer.replaceFromMapping(customFormat, titleMap)); |
1941 | 1950 | } else {
|
1942 |
| - setTitle(I18n.format(tr("{0} - {1} | Arduino {2}"), sketch.getName(), |
1943 |
| - current.getFileName(), BaseNoGui.VERSION_NAME_LONG)); |
| 1951 | + if (current.isPrimary()) { |
| 1952 | + setTitle(I18n.format(tr("{0} | Arduino {1}"), sketch.getName(), |
| 1953 | + BaseNoGui.VERSION_NAME_LONG)); |
| 1954 | + } else { |
| 1955 | + setTitle(I18n.format(tr("{0} - {1} | Arduino {2}"), sketch.getName(), |
| 1956 | + current.getFileName(), BaseNoGui.VERSION_NAME_LONG)); |
| 1957 | + } |
1944 | 1958 | }
|
1945 | 1959 | }
|
1946 | 1960 |
|
|
0 commit comments