From d975b43a308485acdba42c600ab57e5ad06568b5 Mon Sep 17 00:00:00 2001 From: Seb Shader Date: Wed, 22 Dec 2021 02:43:02 -0800 Subject: [PATCH] add text_window_hl_text text color of selected/highlighted text in a [text define] window --- doc/7.stuff/colors-plugin.txt | 2 ++ tcl/pd-gui.tcl | 1 + tcl/pdtk_textwindow.tcl | 10 +++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/7.stuff/colors-plugin.txt b/doc/7.stuff/colors-plugin.txt index d38f3ef7d..b97abac8a 100644 --- a/doc/7.stuff/colors-plugin.txt +++ b/doc/7.stuff/colors-plugin.txt @@ -31,6 +31,7 @@ # text_window_fill - [text] window background # text_window_text - [text] window text # text_window_highlight - like txt_highlight but for [text] window +# text_window_hl_text - color of highlighted text in [text] window # text_window_cursor - [text] window cursor # pdwindow_fill - background of post window # pdwindow_fatal_text - text for fatal errors @@ -72,6 +73,7 @@ atom_box_label "black" atom_box_outline "cyan" text_window_fill "black" text_window_text "white" +text_window_hl_text "white" text_window_highlight "green" text_window_cursor "green" pdwindow_fill "#000" diff --git a/tcl/pd-gui.tcl b/tcl/pd-gui.tcl index 0f6af6780..a6581d173 100755 --- a/tcl/pd-gui.tcl +++ b/tcl/pd-gui.tcl @@ -271,6 +271,7 @@ gop_box "#FF8080" text_window_fill "#FFFFFF" text_window_text "#000" text_window_highlight "" +text_window_hl_text "" text_window_cursor "#000" pdwindow_fill "#FFFFFF" pdwindow_fatal_text "#D00" diff --git a/tcl/pdtk_textwindow.tcl b/tcl/pdtk_textwindow.tcl index 141c5d004..799f9cd27 100644 --- a/tcl/pdtk_textwindow.tcl +++ b/tcl/pdtk_textwindow.tcl @@ -25,11 +25,7 @@ proc pdtk_textwindow_open {name geometry title font} { text $name.text -relief raised -highlightthickness 0 -bd 2 \ -font [get_font_for_size $font] \ -exportselection 1 -undo 1 \ - -yscrollcommand "$name.scroll set" -background \ - [::pdtk_canvas::get_color text_window_fill $name] \ - -foreground [::pdtk_canvas::get_color text_window_text $name] \ - -insertbackground \ - [::pdtk_canvas::get_color text_window_cursor $name] + -yscrollcommand "$name.scroll set" set tmpcol [::pdtk_canvas::get_color text_window_text $name] if {$tmpcol ne ""} { @@ -47,6 +43,10 @@ proc pdtk_textwindow_open {name geometry title font} { if {$tmpcol ne ""} { $name.text configure -selectbackground $tmpcol } + set tmpcol [::pdtk_canvas::get_color text_window_hl_text $name] + if {$tmpcol ne ""} { + $name.text configure -selectforeground $tmpcol + } scrollbar $name.scroll -command "$name.text yview" pack $name.scroll -side right -fill y pack $name.text -side left -fill both -expand 1