Ticket #6187: bettersearch.patch
| File bettersearch.patch, 3.8 KB (added by , 15 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/search/SearchAction.java
135 135 } 136 136 // -- prepare the combo box with the search expressions 137 137 // 138 JLabel label = new JLabel( initialValues instanceof Filter ? tr(" Please enter a filter string.") : tr("Please enter a search string."));138 JLabel label = new JLabel( initialValues instanceof Filter ? tr("Filter string:") : tr("Search string:")); 139 139 final HistoryComboBox hcbSearchString = new HistoryComboBox(); 140 140 hcbSearchString.setText(initialValues.text); 141 141 hcbSearchString.getEditor().selectAll(); … … 164 164 allElements.setToolTipText(tr("Also include incomplete and deleted objects in search.")); 165 165 final JCheckBox regexSearch = new JCheckBox(tr("regular expression"), initialValues.regexSearch); 166 166 167 JPanel top = new JPanel(new GridBagLayout()); 168 top.add(label, GBC.std()); 169 top.add(hcbSearchString, GBC.eol().fill(GBC.HORIZONTAL)); 167 170 JPanel left = new JPanel(new GridBagLayout()); 168 left.add(label, GBC.eop());169 left.add(hcbSearchString, GBC.eop().fill(GBC.HORIZONTAL));170 171 left.add(replace, GBC.eol()); 171 172 left.add(add, GBC.eol()); 172 173 left.add(remove, GBC.eol()); … … 211 212 description.setFont(description.getFont().deriveFont(Font.PLAIN)); 212 213 right.add(description); 213 214 214 final JPanel p = new JPanel(); 215 p.add(left); 216 p.add(right); 215 final JPanel p = new JPanel(new GridBagLayout()); 216 p.add(top, GBC.eol().fill(GBC.HORIZONTAL)); 217 p.add(left, GBC.std()); 218 p.add(right, GBC.eol()); 217 219 ExtendedDialog dialog = new ExtendedDialog( 218 220 Main.parent, 219 221 initialValues instanceof Filter ? tr("Filter") : tr("Search"), -
src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
2 2 package org.openstreetmap.josm.gui.tagging.ac; 3 3 4 4 import java.awt.Component; 5 import java.awt.Dimension; 6 import java.awt.Toolkit; 5 7 import java.awt.event.FocusEvent; 6 8 import java.awt.event.FocusListener; 7 9 import java.util.Collection; … … 144 146 } 145 147 } 146 148 ); 149 int maxsize=Math.max(getMaximumRowCount(),java.awt.Toolkit.getDefaultToolkit().getScreenSize().height/getPreferredSize().height); 150 setMaximumRowCount(maxsize); 147 151 } 148 152 149 153 /** … … 253 257 return this; 254 258 } 255 259 } 260 261 262 256 263 } -
src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java
6 6 import javax.swing.text.JTextComponent; 7 7 8 8 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 9 import org.openstreetmap.josm.Main; 9 10 10 11 public class HistoryComboBox extends AutoCompletingComboBox { 11 12 private ComboBoxHistory model; 12 13 14 public static final int DEFAULT_SEARCH_HISTORY_SIZE = 15; 15 13 16 public HistoryComboBox() { 14 setModel(model = new ComboBoxHistory(15)); 17 int maxsize = Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 18 setModel(model = new ComboBoxHistory(maxsize)); 15 19 setEditable(true); 16 20 } 17 21
