随手记快捷替换增加comma和换行之间的互相替换

This commit is contained in:
rememberber
2024-11-21 14:59:50 +08:00
parent e1042adff2
commit 9ef71ca9b6
3 changed files with 50 additions and 20 deletions
@@ -306,7 +306,7 @@
</properties>
<border type="none"/>
<children>
<grid id="c2eeb" layout-manager="GridLayoutManager" row-count="30" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="c2eeb" layout-manager="GridLayoutManager" row-count="32" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints/>
<properties>
@@ -333,7 +333,7 @@
</component>
<vspacer id="c9ff8">
<constraints>
<grid row="29" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="31" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="ed115" class="javax.swing.JCheckBox" binding="clearTabTCheckBox">
@@ -426,7 +426,7 @@
</component>
<component id="83344" class="javax.swing.JCheckBox" binding="tabToEnterCheckBox">
<constraints>
<grid row="21" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="23" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Tab(\t) -&gt; 换行"/>
@@ -434,7 +434,7 @@
</component>
<component id="5c20" class="javax.swing.JButton" binding="startQuickReplaceButton">
<constraints>
<grid row="28" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="30" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="开始"/>
@@ -492,7 +492,7 @@
</grid>
<component id="205c4" class="javax.swing.JSeparator">
<constraints>
<grid row="22" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="24" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
@@ -520,7 +520,7 @@
</component>
<component id="2cc74" class="javax.swing.JCheckBox" binding="deduplicationByLineCheckBox">
<constraints>
<grid row="23" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="25" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="按行去重"/>
@@ -528,7 +528,7 @@
</component>
<component id="32dde" class="javax.swing.JCheckBox" binding="deduplicationByLineCntCheckBox">
<constraints>
<grid row="24" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="26" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="按行去重并统计出现次数"/>
@@ -536,13 +536,13 @@
</component>
<component id="96f95" class="javax.swing.JSeparator">
<constraints>
<grid row="25" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="27" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="fc688" class="javax.swing.JCheckBox" binding="escapeCheckBox">
<constraints>
<grid row="26" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="28" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="转义"/>
@@ -550,12 +550,28 @@
</component>
<component id="32f99" class="javax.swing.JCheckBox" binding="unescapeCheckBox">
<constraints>
<grid row="27" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="29" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="反转义"/>
</properties>
</component>
<component id="86a23" class="javax.swing.JCheckBox" binding="commaSingleQuotesToEnterCheckBox">
<constraints>
<grid row="21" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="',' -&gt; 换行"/>
</properties>
</component>
<component id="861e0" class="javax.swing.JCheckBox" binding="commaDoubleQuotesToEnterCheckBox">
<constraints>
<grid row="22" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&quot;,&quot; -&gt; 换行"/>
</properties>
</component>
</children>
</grid>
</children>
@@ -97,6 +97,8 @@ public class QuickNoteForm {
private JCheckBox deduplicationByLineCntCheckBox;
private JCheckBox escapeCheckBox;
private JCheckBox unescapeCheckBox;
private JCheckBox commaSingleQuotesToEnterCheckBox;
private JCheckBox commaDoubleQuotesToEnterCheckBox;
private JToggleButton colorButton;
@@ -602,7 +604,7 @@ public class QuickNoteForm {
quickReplaceScrollPane.setMinimumSize(new Dimension(-1, -1));
contentSplitPane.setRightComponent(quickReplaceScrollPane);
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(30, 1, new Insets(10, 10, 10, 10), -1, -1));
panel3.setLayout(new GridLayoutManager(32, 1, new Insets(10, 10, 10, 10), -1, -1));
panel3.setMaximumSize(new Dimension(-1, -1));
panel3.setMinimumSize(new Dimension(-1, -1));
quickReplaceScrollPane.setViewportView(panel3);
@@ -613,7 +615,7 @@ public class QuickNoteForm {
trimBlankRowCheckBox.setText("去掉空行");
panel3.add(trimBlankRowCheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
panel3.add(spacer2, new GridConstraints(29, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
panel3.add(spacer2, new GridConstraints(31, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
clearTabTCheckBox = new JCheckBox();
clearTabTCheckBox.setText("去掉Tab(\\t)");
panel3.add(clearTabTCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@@ -649,10 +651,10 @@ public class QuickNoteForm {
panel3.add(commaToEnterCheckBox, new GridConstraints(20, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
tabToEnterCheckBox = new JCheckBox();
tabToEnterCheckBox.setText("Tab(\\t) -> 换行");
panel3.add(tabToEnterCheckBox, new GridConstraints(21, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(tabToEnterCheckBox, new GridConstraints(23, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
startQuickReplaceButton = new JButton();
startQuickReplaceButton.setText("开始");
panel3.add(startQuickReplaceButton, new GridConstraints(28, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, 1, null, null, null, 0, false));
panel3.add(startQuickReplaceButton, new GridConstraints(30, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, 1, null, null, null, 0, false));
final JSeparator separator1 = new JSeparator();
panel3.add(separator1, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
final JSeparator separator2 = new JSeparator();
@@ -672,7 +674,7 @@ public class QuickNoteForm {
final Spacer spacer3 = new Spacer();
panel4.add(spacer3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JSeparator separator4 = new JSeparator();
panel3.add(separator4, new GridConstraints(22, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
panel3.add(separator4, new GridConstraints(24, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
final JSeparator separator5 = new JSeparator();
panel3.add(separator5, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
uperToLowerCheckBox = new JCheckBox();
@@ -683,18 +685,24 @@ public class QuickNoteForm {
panel3.add(lowerToUperCheckBox, new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
deduplicationByLineCheckBox = new JCheckBox();
deduplicationByLineCheckBox.setText("按行去重");
panel3.add(deduplicationByLineCheckBox, new GridConstraints(23, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(deduplicationByLineCheckBox, new GridConstraints(25, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
deduplicationByLineCntCheckBox = new JCheckBox();
deduplicationByLineCntCheckBox.setText("按行去重并统计出现次数");
panel3.add(deduplicationByLineCntCheckBox, new GridConstraints(24, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(deduplicationByLineCntCheckBox, new GridConstraints(26, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JSeparator separator6 = new JSeparator();
panel3.add(separator6, new GridConstraints(25, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
panel3.add(separator6, new GridConstraints(27, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
escapeCheckBox = new JCheckBox();
escapeCheckBox.setText("转义");
panel3.add(escapeCheckBox, new GridConstraints(26, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(escapeCheckBox, new GridConstraints(28, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
unescapeCheckBox = new JCheckBox();
unescapeCheckBox.setText("反转义");
panel3.add(unescapeCheckBox, new GridConstraints(27, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(unescapeCheckBox, new GridConstraints(29, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
commaSingleQuotesToEnterCheckBox = new JCheckBox();
commaSingleQuotesToEnterCheckBox.setText("',' -> 换行");
panel3.add(commaSingleQuotesToEnterCheckBox, new GridConstraints(21, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
commaDoubleQuotesToEnterCheckBox = new JCheckBox();
commaDoubleQuotesToEnterCheckBox.setText("\",\" -> 换行");
panel3.add(commaDoubleQuotesToEnterCheckBox, new GridConstraints(22, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
/**
@@ -575,6 +575,12 @@ public class QuickNoteListener {
if (quickNoteForm.getCommaToEnterCheckBox().isSelected()) {
split = split.replace(",", "\n");
}
if (quickNoteForm.getCommaSingleQuotesToEnterCheckBox().isSelected()) {
split = split.replace("','", "\n").replace("'", "");
}
if (quickNoteForm.getCommaDoubleQuotesToEnterCheckBox().isSelected()) {
split = split.replace("\",\"", "\n").replace("\"", "");
}
if (quickNoteForm.getTabToEnterCheckBox().isSelected()) {
split = split.replace("\t", "\n");
}