Commit 938f9026 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*added ability to save custom color themes, enabled bgerror, minor cleanup

parent 2caeeb27
......@@ -293,6 +293,9 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors(magic_glass_text) white
set ::pd_colors(magic_glass_flash) "#e87216"
}
Custom {
# empty one if we have any custom settings
}
}
}
......@@ -303,7 +306,7 @@ proc ::dialog_gui::create_gui_dialog {mytoplevel} {
ttk::label $p.presetlabel -text "Color Preset"
# ttk::combobox $fr.presets -state readonly -values {Inverted L2Ork Foo}
# todo: set presets in _one_ place
::dialog_prefs::dropdown $p.presets ::gui_preset {Vanilla Inverted L2Ork L2Ork_Inverted Extended C64 Strongbad Subdued}
::dialog_prefs::dropdown $p.presets ::gui_preset {Vanilla Inverted L2Ork L2Ork_Inverted Extended C64 Strongbad Subdued Custom}
pack $fr -side top
grid $p -column 0 -columnspan 3 -row 0 -sticky w -pady 21
pack $p.presetlabel -side left -padx 7
......
......@@ -155,7 +155,7 @@ proc ::dialog_prefs::set_color {array key op} {
}
text_in_console {
if {[winfo exists .printout.frame.text]} {
.printout.frame.text configure -foureground $c
.printout.frame.text configure -foreground $c
}
}
canvas_color {set commands [list "configure -bg $c"]
......@@ -292,9 +292,14 @@ proc ::dialog_prefs::swatchmenu_nav {w dir} {
}
proc ::dialog_prefs::swatchbutton_colorchooser {name variable} {
set col [tk_chooseColor -parent $name]
set col [tk_chooseColor -parent $name -initialcolor [set $variable]]
if {$col ne ""} {
set $variable $col
# kludge since the dialog has static name for colors, we refer to it here
# with partially modular approach that should hopefully prove universal
set combobox [string trimright $name .link]
::dialog_prefs::dropdown_set $combobox.presets.presets Custom
::pd_guiprefs::write_guipreset
}
}
......
......@@ -294,10 +294,10 @@ if { $tcl_platform(platform) == "windows" } {
set externalsdir "$::env(HOME)/pd-l2ork-externals"
}
#proc bgerror {message} {
# pdtk_post "\ntcl error: $message"
proc bgerror {message} {
pdtk_post "\ntcl error: $message"
#puts "\033\[0;1;33mtcl error: $::errorInfo\033\[0m"
#}
}
# make sure the user folder for installing externals exists
#catch {
......
......@@ -37,8 +37,43 @@ proc ::pd_guiprefs::init {} {
catch {set ::recentfiles_list [get_config $::recentfiles_domain \
$::recentfiles_key $arr]}
set ::gui_preset ""
catch {set ::gui_preset [get_config $::guipreset_domain \
$::guipreset_key $arr]}
catch {
set ::gui_preset [get_config $::guipreset_domain $::guipreset_key $arr]
if { [lindex $::gui_preset 0] == "Custom" } {
set ::pd_colors(atom_box) [lindex $::gui_preset 1]
set ::pd_colors(atom_box_border) [lindex $::gui_preset 2]
set ::pd_colors(canvas_color) [lindex $::gui_preset 3]
set ::pd_colors(canvas_cursor) [lindex $::gui_preset 4]
set ::pd_colors(text) [lindex $::gui_preset 5]
set ::pd_colors(text_in_console) [lindex $::gui_preset 6]
set ::pd_colors(box) [lindex $::gui_preset 7]
set ::pd_colors(box_border) [lindex $::gui_preset 8]
set ::pd_colors(msg) [lindex $::gui_preset 9]
set ::pd_colors(msg_border) [lindex $::gui_preset 10]
set ::pd_colors(iemgui_border) [lindex $::gui_preset 11]
set ::pd_colors(iemgui_nlet) [lindex $::gui_preset 12]
set ::pd_colors(control_cord) [lindex $::gui_preset 13]
set ::pd_colors(control_nlet) [lindex $::gui_preset 14]
set ::pd_colors(signal_cord) [lindex $::gui_preset 15]
set ::pd_colors(signal_nlet) [lindex $::gui_preset 16]
set ::pd_colors(xlet_hover) [lindex $::gui_preset 17]
set ::pd_colors(link) [lindex $::gui_preset 18]
set ::pd_colors(selection) [lindex $::gui_preset 19]
set ::pd_colors(selection_rectangle) [lindex $::gui_preset 20]
set ::pd_colors(highlighted_text) [lindex $::gui_preset 21]
set ::pd_colors(highlighted_text_bg) [lindex $::gui_preset 22]
set ::pd_colors(dash_outline) [lindex $::gui_preset 23]
set ::pd_colors(dash_fill) [lindex $::gui_preset 24]
set ::pd_colors(graph_border) [lindex $::gui_preset 25]
set ::pd_colors(graph) [lindex $::gui_preset 26]
set ::pd_colors(magic_glass_bg) [lindex $::gui_preset 27]
set ::pd_colors(magic_glass_bd) [lindex $::gui_preset 28]
set ::pd_colors(magic_glass_text) [lindex $::gui_preset 29]
set ::pd_colors(magic_glass_flash) [lindex $::gui_preset 30]
set ::gui_preset [lindex $::gui_preset 0]
}
}
}
proc ::pd_guiprefs::init_aqua {} {
......@@ -76,7 +111,40 @@ proc ::pd_guiprefs::write_recentfiles {} {
}
proc ::pd_guiprefs::write_guipreset {} {
write_config $::gui_preset $::guipreset_domain $::guipreset_key true
set output $::gui_preset
if { $::gui_preset == "Custom" } {
lappend output $::pd_colors(atom_box)
lappend output $::pd_colors(atom_box_border)
lappend output $::pd_colors(canvas_color)
lappend output $::pd_colors(canvas_cursor)
lappend output $::pd_colors(text)
lappend output $::pd_colors(text_in_console)
lappend output $::pd_colors(box)
lappend output $::pd_colors(box_border)
lappend output $::pd_colors(msg)
lappend output $::pd_colors(msg_border)
lappend output $::pd_colors(iemgui_border)
lappend output $::pd_colors(iemgui_nlet)
lappend output $::pd_colors(control_cord)
lappend output $::pd_colors(control_nlet)
lappend output $::pd_colors(signal_cord)
lappend output $::pd_colors(signal_nlet)
lappend output $::pd_colors(xlet_hover)
lappend output $::pd_colors(link)
lappend output $::pd_colors(selection)
lappend output $::pd_colors(selection_rectangle)
lappend output $::pd_colors(highlighted_text)
lappend output $::pd_colors(highlighted_text_bg)
lappend output $::pd_colors(dash_outline)
lappend output $::pd_colors(dash_fill)
lappend output $::pd_colors(graph_border)
lappend output $::pd_colors(graph)
lappend output $::pd_colors(magic_glass_bg)
lappend output $::pd_colors(magic_glass_bd)
lappend output $::pd_colors(magic_glass_text)
lappend output $::pd_colors(magic_glass_flash)
}
write_config $output $::guipreset_domain $::guipreset_key true
}
# ------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment