privateclass Reset_Component extends Button {
action = Action("Reset") { val text_area = view.getTextArea
Syntax_Style.edit_control_style(text_area, "")
text_area.requestFocus()
}
tooltip = "Reset control symbols within text"
}
/* search */
privateclass Search_Panel extends BorderPanel { val search_field = new TextField(10) val results_panel: Wrap_Panel = Wrap_Panel(Nil, Wrap_Panel.Alignment.Center)
layout(search_field) = BorderPanel.Position.North
layout(new ScrollPane(results_panel)) = BorderPanel.Position.Center
privateval search_space = for (entry <- Symbol.symbols.entries if entry.code.isDefined) yield entry.symbol -> Word.lowercase(entry.symbol) val search_delay: Delay =
Delay.last(PIDE.session.input_delay, gui = true) { val search_words = Word.explode(Word.lowercase(search_field.text)) val search_limit = PIDE.options.int("jedit_symbols_search_limit") max 0 val results = for ((sym, s) <- search_space; if search_words.forall(s.contains(_))) yield sym
results_panel.contents.clear() for (sym <- results.take(search_limit))
results_panel.contents += new Symbol_Component(sym, false) if (results.length > search_limit)
results_panel.contents += new Label("...") { tooltip = "(" + (results.length - search_limit) + " more)" }
revalidate()
repaint()
}
search_field.reactions += { case ValueChanged(_) => search_delay.invoke() }
}
/* tabs */
privateval group_tabs: TabbedPane = new TabbedPane {
pages += new TabbedPane.Page("abbrevs", abbrevs_panel)
pages ++=
Symbol.symbols.groups_code.map({ case (group, symbols) => val control = group == "control" new TabbedPane.Page(group, new ScrollPane(Wrap_Panel(
symbols.map(new Symbol_Component(_, control)) :::
(if (control) List(new Reset_Component) else Nil),
Wrap_Panel.Alignment.Center)), null)
})
val search_panel = new Search_Panel val search_page = new TabbedPane.Page("search", search_panel, "Search Symbols")
pages += search_page
listenTo(selection)
reactions += { case SelectionChanged(_) if selection.page == search_page =>
search_panel.search_field.requestFocus()
}
for (page <- pages)
page.title = Word.implode(Word.explode('_', page.title).map(Word.perhaps_capitalized))
}
set_content(group_tabs)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.