Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
nerrons
purr-data
Commits
25eae801
Commit
25eae801
authored
Nov 11, 2014
by
pokergaming
Browse files
*save gui_preset choice with gui preferences
parent
d33e0fde
Changes
4
Hide whitespace changes
Inline
Side-by-side
pd/src/dialog_gui.tcl
View file @
25eae801
package provide dialog_gui 0.1
package require dialog_prefs
package require pd_guiprefs
namespace import ::pd_guiprefs::write_guipreset
namespace eval ::dialog_gui::
{
namespace export create_gui_dialog
...
...
@@ -28,6 +31,7 @@ proc ::dialog_gui::setswatch {b swatch} {
# variable is written to
proc ::dialog_gui::set_gui_preset
{
args
}
{
set choice $::gui_preset
::pd_guiprefs::write_guipreset
switch $choice
{
Vanilla
{
set ::pd_colors
(
atom_box
)
white
...
...
@@ -35,6 +39,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
white
set ::pd_colors
(
canvas_cursor
)
black
set ::pd_colors
(
text
)
black
set ::pd_colors
(
text_in_console
)
black
set ::pd_colors
(
box
)
white
set ::pd_colors
(
box_border
)
black
set ::pd_colors
(
msg
)
white
...
...
@@ -67,6 +72,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
black
set ::pd_colors
(
canvas_cursor
)
white
set ::pd_colors
(
text
)
white
set ::pd_colors
(
text_in_console
)
white
set ::pd_colors
(
box
)
black
set ::pd_colors
(
box_border
)
white
set ::pd_colors
(
msg
)
black
...
...
@@ -99,6 +105,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
white
set ::pd_colors
(
canvas_cursor
)
black
set ::pd_colors
(
text
)
black
set ::pd_colors
(
text_in_console
)
grey40
set ::pd_colors
(
box
)
"#f6f8f8"
set ::pd_colors
(
box_border
)
"#ccc"
set ::pd_colors
(
msg
)
#f8f8f6
...
...
@@ -130,6 +137,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
black
set ::pd_colors
(
canvas_cursor
)
white
set ::pd_colors
(
text
)
white
set ::pd_colors
(
text_in_console
)
#999999
set ::pd_colors
(
box
)
#090707
set ::pd_colors
(
box_border
)
#3e3e3e
set ::pd_colors
(
msg
)
#090707
...
...
@@ -161,6 +169,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
white
set ::pd_colors
(
canvas_cursor
)
black
set ::pd_colors
(
text
)
black
set ::pd_colors
(
text_in_console
)
black
set ::pd_colors
(
box
)
#f6f8f8
set ::pd_colors
(
box_border
)
#c1c1c1
set ::pd_colors
(
msg
)
#f6f8f8
...
...
@@ -193,6 +202,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
#3e32a2
set ::pd_colors
(
canvas_cursor
)
white
set ::pd_colors
(
text
)
#a49aea
set ::pd_colors
(
text_in_console
)
#a49aea
set ::pd_colors
(
box
)
#3e32a2
set ::pd_colors
(
box_border
)
#7569d7
set ::pd_colors
(
msg
)
#3e32a2
...
...
@@ -225,6 +235,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
black
set ::pd_colors
(
canvas_cursor
)
white
set ::pd_colors
(
text
)
#4bd046
set ::pd_colors
(
text_in_console
)
#4bd046
set ::pd_colors
(
box
)
black
set ::pd_colors
(
box_border
)
#0b560b
set ::pd_colors
(
msg
)
black
...
...
@@ -256,6 +267,7 @@ proc ::dialog_gui::set_gui_preset {args} {
set ::pd_colors
(
canvas_color
)
#c0dcc0
set ::pd_colors
(
canvas_cursor
)
black
set ::pd_colors
(
text
)
black
set ::pd_colors
(
text_in_console
)
black
set ::pd_colors
(
box
)
#c0dcc0
set ::pd_colors
(
box_border
)
#666666
set ::pd_colors
(
msg
)
#c0dcc0
...
...
pd/src/dialog_prefs.tcl
View file @
25eae801
...
...
@@ -152,9 +152,11 @@ proc ::dialog_prefs::set_color {array key op} {
.search.resultstext configure -foreground $c
.search.navtext configure -foreground $c
}
if
{[
winfo exists .printout.frame.text
]}
{
.printout.frame.text configure -foreground $c
}
}
text_in_console
{
if
{[
winfo exists .printout.frame.text
]}
{
.printout.frame.text configure -foureground $c
}
}
canvas_color
{
set commands
[
list
"configure -bg
$c
"
]
if
{[
winfo exists .search.resultstext
]}
{
...
...
pd/src/pd.tk
View file @
25eae801
...
...
@@ -574,59 +574,6 @@ set pd_array_listview_entry(0) 0
set pd_array_listview_page(0) 0
# end jsarlo
# Prefences Dialog
# dialog_prefs.tcl must come first because dialog_gui.tcl depends on it
# This is an ugly hack-- it should just be loaded as tcl packages like
# in 0.43...
source [file join [file dirname [info script]] dialog_prefs.tcl]
source [file join [file dirname [info script]] dialog_gui.tcl]
source [file join [file dirname [info script]] dialog_midi.tcl]
source [file join [file dirname [info script]] dialog_audio.tcl]
# Add a trace for the color array. This way any gui-plugin can make
# color changes simply by changing one of the elements of the pd_colors
# array, and all the preference dialog stuff and open patches will
# magically update
trace add variable pd_colors write ::dialog_prefs::set_color
# ... and a trace for the ::gui_preset variable. There'
s
probably
#
a
way
to
do
this
inside
the
dropdown
code
,
which
would
be
better
...
trace
add
variable
gui_preset
write
"::dialog_gui::set_gui_preset"
#
Now
that
we
've got a trace for the colors, we can set a
# color scheme (defined in dialog_gui.tcl)
set gui_preset L2Ork
# todo: find a home for these:
set ::pd_colors(signal_cord_width) 3
set ::pd_colors(control_cord_width) 1
# color scheme
# set canvas_fill "white"
# set text_color "#000"
# set select_color "#e87216"
# set dash_outline "#f00"
# set dash_fill "#f7f7f7"
# set box_outline "#ccc"
# set graph_outline "#777"
# set atom_box_fill "#eee"
# set msg_box_fill "#f8f8f6"
# set obj_box_fill "#f6f8f8"
# Doesn'
t
look
like
signal_cord_highlight
is
used
#
set
signal_cord_highlight
"#58a"
#
set
signal_cord
"#808095"
#
set
signal_nlet
$
signal_cord
#
Todo
:
make
sure
these
work
in
k12
mode
#
set
signal_cord_width
3
#
set
msg_cord_highlight
"#474"
#
set
msg_cord
"#565"
#
set
msg_nlet
"white"
#
set
mixed_nlet
"#88aaff"
#
set
msg_cord_width
1
#
nlet
highlighting
stuff
set
select_nlet_color
$
pd_colors
(
selection
)
set
highlight_width
5
if {$pd_nt == 1} {
global pd_guidir
...
...
@@ -714,6 +661,65 @@ namespace import ::pd_guiprefs::write_recentfiles
set total_recentfiles 5
::pd_guiprefs::init
# Prefences Dialog
# dialog_prefs.tcl must come first because dialog_gui.tcl depends on it
# This is an ugly hack-- it should just be loaded as tcl packages like
# in 0.43...
source [file join [file dirname [info script]] dialog_prefs.tcl]
source [file join [file dirname [info script]] dialog_gui.tcl]
source [file join [file dirname [info script]] dialog_midi.tcl]
source [file join [file dirname [info script]] dialog_audio.tcl]
# Add a trace for the color array. This way any gui-plugin can make
# color changes simply by changing one of the elements of the pd_colors
# array, and all the preference dialog stuff and open patches will
# magically update
trace add variable pd_colors write ::dialog_prefs::set_color
# ... and a trace for the ::gui_preset variable. There'
s
probably
#
a
way
to
do
this
inside
the
dropdown
code
,
which
would
be
better
...
trace
add
variable
gui_preset
write
"::dialog_gui::set_gui_preset"
#
Now
that
we
've got a trace for the colors, we can set a
# color scheme if there isn'
t
one
in
the
preferences
#
(
defined
in
dialog_gui
.
tcl
)
if
{$::
gui_preset
eq
""
}
{
set
::
gui_preset
L2Ork
}
else
{
::
dialog_gui
::
set_gui_preset
}
#
todo
:
find
a
home
for
these
:
set
::
pd_colors
(
signal_cord_width
)
3
set
::
pd_colors
(
control_cord_width
)
1
#
color
scheme
#
set
canvas_fill
"white"
#
set
text_color
"#000"
#
set
select_color
"#e87216"
#
set
dash_outline
"#f00"
#
set
dash_fill
"#f7f7f7"
#
set
box_outline
"#ccc"
#
set
graph_outline
"#777"
#
set
atom_box_fill
"#eee"
#
set
msg_box_fill
"#f8f8f6"
#
set
obj_box_fill
"#f6f8f8"
#
Doesn
't look like signal_cord_highlight is used
# set signal_cord_highlight "#58a"
# set signal_cord "#808095"
# set signal_nlet $signal_cord
# Todo: make sure these work in k12 mode
# set signal_cord_width 3
# set msg_cord_highlight "#474"
# set msg_cord "#565"
# set msg_nlet "white"
# set mixed_nlet "#88aaff"
# set msg_cord_width 1
#nlet highlighting stuff
set select_nlet_color $pd_colors(selection)
set highlight_width 5
# official GNU gettext msgcat shortcut
proc _ {s} {return [::msgcat::mc $s]}
...
...
@@ -895,7 +901,8 @@ wm protocol .printout WM_DELETE_WINDOW { .controls.switches.console invoke }
match_linux_wm [list frame .printout.frame]
text .printout.frame.text -relief sunken -bd 1 -font console_font \
-yscrollcommand ".printout.frame.scroll set" -width 70 -height 24 \
-
highlightthickness
0
-
takefocus
0
-
fg
gray20
-
state
disabled
-highlightthickness 0 -takefocus 0 -fg $pd_colors(text_in_console) \
-state disabled -bg $pd_colors(canvas_color)
#.printout.frame.text tag configure sel -background $linux_wm_hlcolor
# .printout.frame.text insert end "\n\n\n\n\n\n\n\n\n\n"
...
...
pd/src/pd_guiprefs.tcl
View file @
25eae801
...
...
@@ -15,7 +15,8 @@ namespace eval ::pd_guiprefs:: {
# FIXME should these be globals ?
set ::recentfiles_key
""
set ::recentfiles_domain
""
set ::guipreset_key
""
set ::guipreset_domain
""
#################################################################
# global procedures
...
...
@@ -35,6 +36,9 @@ proc ::pd_guiprefs::init {} {
set ::recentfiles_list
""
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
]}
}
proc ::pd_guiprefs::init_aqua
{}
{
...
...
@@ -42,18 +46,25 @@ proc ::pd_guiprefs::init_aqua {} {
set ::recentfiles_domain org.puredata
set ::recentfiles_key
"NSRecentDocuments"
set ::total_recentfiles 10
set ::guipreset_domain org.puredata
set ::guipreset_key
"GuiPreset"
}
proc ::pd_guiprefs::init_win
{}
{
# windows uses registry
set ::recentfiles_domain
"HKEY_CURRENT_USER
\\
Software
\\
Pd-L2Ork"
set ::recentfiles_key
"RecentDocs"
set ::guipreset_domain
"HKEY_CURRENT_USER
\\
Software
\\
Pd-L2Ork"
set ::guipreset_key
"GuiPreset"
}
proc ::pd_guiprefs::init_x11
{}
{
# linux uses ~/.config/pure-data dir
set ::recentfiles_domain
"~/.config/pd-l2ork"
set ::recentfiles_key
"recentfiles.conf"
set ::guipreset_domain
"~/.config/pd-l2ork"
set ::guipreset_key
"guipreset.conf"
prepare_configdir
}
...
...
@@ -64,6 +75,10 @@ proc ::pd_guiprefs::write_recentfiles {} {
write_config $::recentfiles_list $::recentfiles_domain $::recentfiles_key true
}
proc ::pd_guiprefs::write_guipreset
{}
{
write_config $::gui_preset $::guipreset_domain $::guipreset_key true
}
# ------------------------------------------------------------------------------
# this is called when opening a document
(
wheredoesthisshouldgo.tcl
)
#
...
...
@@ -79,6 +94,11 @@ proc ::pd_guiprefs::update_recentfiles {afile save} {
::pd_guiprefs::write_recentfiles
}
proc ::pd_guiprefs::update_guipreset
{
preset
}
{
set ::gui_preset $preset
::pd_guiprefs::write_guipreset
}
#################################################################
# main read/write procedures
#################################################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment