Commit 5c2f8f45 authored by Miller Puckette's avatar Miller Puckette
Browse files

expand detabbing to *.tk

parent a2bfe438
#! /bin/sh
for i in `find . -name "*.[ch]"` ; do
for i in `find . -name "*.[ch]" -o -name "*.tk"` ; do
expand $i > /tmp/foo
if ( ! cmp -s $i /tmp/foo ) ; then
echo detabbing: $i
......
......@@ -448,7 +448,7 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} %d %s}\n",
glist_getcanvas(iemgui->x_glist), x, iemgui->x_font,
iemgui->x_fontsize, sys_fontweight);
iemgui->x_fontsize, sys_fontweight);
}
void iemgui_size(void *x, t_iemgui *iemgui)
......
......@@ -60,7 +60,7 @@ void bng_draw_new(t_bng *x, t_glist *glist)
ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n",
canvas, xpos,
......
......@@ -828,7 +828,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
(int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)),
(int)glist_ytopixels(x, x->gl_xlabely),
x->gl_xlabel[i]->s_name, sys_font,
glist_getfont(x), sys_fontweight, tag);
glist_getfont(x), sys_fontweight, tag);
/* draw y labels */
for (i = 0; i < x->gl_nylabels; i++)
......
......@@ -81,7 +81,7 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist)
ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n",
canvas, xpos-3, ypos + x->x_gui.x_h-1,
......
......@@ -48,7 +48,7 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
}
void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
......@@ -87,7 +87,7 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol);
sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} %d %s} -fill #%6.6x -text {%s} \n",
canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol,
x->x_gui.x_lcol,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
}
......
......@@ -199,7 +199,7 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
my_numbox_ftoa(x);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags %lxNUMBER\n",
......
......@@ -2137,7 +2137,7 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}",
glist_getcanvas(glist), xloc, yloc, colorstring, buf);
sys_vgui(" -font {{%s} %d %s}", sys_font,
sys_hostfontsize(glist_getfont(glist)), sys_fontweight);
sys_hostfontsize(glist_getfont(glist)), sys_fontweight);
sys_vgui(" -tags drawnumber%lx\n", data);
}
else sys_vgui(".x%lx.c delete drawnumber%lx\n", glist_getcanvas(glist), data);
......
......@@ -66,7 +66,7 @@ void toggle_draw_new(t_toggle *x, t_glist *glist)
yy+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n",
canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, x, 0);
......
......@@ -63,7 +63,7 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist)
canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n",
canvas,
......
......@@ -118,7 +118,7 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags %lxSCALE%d\n",
canvas, end, yyy+k3, iemgui_vu_scale_str[i],
x->x_gui.x_font, x->x_gui.x_fontsize,
x->x_gui.x_font, x->x_gui.x_fontsize,
sys_fontweight, x->x_gui.x_lcol, x, i);
}
if(x->x_scale)
......@@ -128,7 +128,7 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags %lxSCALE%d\n",
canvas, end, yyy+k3, iemgui_vu_scale_str[i], x->x_gui.x_font,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, i);
}
sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxRCOVER\n",
......@@ -142,7 +142,7 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x);
x->x_gui.x_lcol, x);
if(!x->x_gui.x_fsf.x_snd_able)
{
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxOUT%d\n",
......@@ -279,7 +279,7 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
if(((i+2)&3) && (x->x_scale))
sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} %d %s} -fill #%6.6x\n",
canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol);
}
if(x->x_scale)
......@@ -287,7 +287,7 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
i=IEM_VU_STEPS+1;
sys_vgui(".x%lx.c itemconfigure %lxSCALE%d -text {%s} -font {{%s} %d %s} -fill #%6.6x\n",
canvas, x, i, iemgui_vu_scale_str[i], x->x_gui.x_font,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol);
}
sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} %d %s} -fill #%6.6x -text {%s} \n",
......@@ -483,7 +483,7 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags %lxSCALE%d\n",
canvas, end, yyy+k3, iemgui_vu_scale_str[i],
x->x_gui.x_font, x->x_gui.x_fontsize,
x->x_gui.x_font, x->x_gui.x_fontsize,
sys_fontweight, x->x_gui.x_lcol, x, i);
}
i=IEM_VU_STEPS+1;
......@@ -491,7 +491,7 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} %d %s} -fill #%6.6x -tags %lxSCALE%d\n",
canvas, end, yyy+k3, iemgui_vu_scale_str[i],
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
sys_fontweight, x->x_gui.x_lcol, x, i);
}
}
......
......@@ -1258,7 +1258,7 @@ int sys_startgui(const char *guidir)
sys_get_audio_apis(buf);
sys_get_midi_apis(buf2);
sys_vgui("pdtk_pd_startup {%s} %s %s {%s} %s\n", pd_version, buf, buf2,
sys_font, sys_fontweight);
sys_font, sys_fontweight);
}
return (0);
......
......@@ -58,10 +58,11 @@ int sys_nmidiin = -1;
int sys_midiindevlist[MAXMIDIINDEV] = {1};
int sys_midioutdevlist[MAXMIDIOUTDEV] = {1};
#ifdef __APPLE__
char sys_font[] = "Monaco"; /* tb: font name */
char sys_font[100] =
#ifdef MSW
"courier";
#else
char sys_font[] = "Bitstream Vera Sans Mono"; /* tb: font name */
"Bitstream Vera Sans Mono";
#endif
char sys_fontweight[] = "normal"; /* currently only used for iemguis */
static int sys_main_srate;
......@@ -765,10 +766,11 @@ int sys_argparse(int argc, char **argv)
}
else if (!strcmp(*argv, "-font-weight") && argc > 1)
{
strcpy(sys_fontweight,*(argv+1));
argc -= 2;
argv += 2;
}
strncpy(sys_fontweight,*(argv+1),sizeof(sys_fontweight)-1);
sys_font[sizeof(sys_fontweight)-1] = 0;
argc -= 2;
argv += 2;
}
else if (!strcmp(*argv, "-verbose"))
{
sys_verbose++;
......
......@@ -64,7 +64,7 @@ if {$pd_nt == 2} {
# turn on James Tittle II's fast drawing
set tk::mac::useCGDrawing 1
# anti-alias all lines that need it
set tk::mac::CGAntialiasLimit 0
set tk::mac::CGAntialiasLimit 2
global pd_guidir
global pd_tearoff
set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]]
......@@ -441,72 +441,72 @@ proc menu_doc_open {subdir basename} {
################## help browser and support functions #########################
proc menu_doc_browser {dir} {
global .mbar
if {![file isdirectory $dir]} {
puts stderr "menu_doc_browser non-directory $dir\n"
}
if { [winfo exists .help_browser.frame] } {
raise .help_browser
} else {
toplevel .help_browser -menu .mbar
wm title .help_browser "Pd Documentation Browser"
frame .help_browser.frame
pack .help_browser.frame -side top -fill both
doc_make_listbox .help_browser.frame $dir 0
global .mbar
if {![file isdirectory $dir]} {
puts stderr "menu_doc_browser non-directory $dir\n"
}
if { [winfo exists .help_browser.frame] } {
raise .help_browser
} else {
toplevel .help_browser -menu .mbar
wm title .help_browser "Pd Documentation Browser"
frame .help_browser.frame
pack .help_browser.frame -side top -fill both
doc_make_listbox .help_browser.frame $dir 0
}
}
proc doc_make_listbox {base dir count} {
# check for [file readable]?
#if { [info tclversion] >= 8.5 } {
# requires Tcl 8.5 but probably deals with special chars better
# destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
#} else {
if { [catch { eval destroy [lrange [winfo children $base] \
[expr { 2 * $count }] end] } \
errorMessage] } {
puts stderr "doc_make_listbox: error listing $dir\n"
}
#}
# exportselection 0 looks good, but selection gets easily out-of-sync
set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
[list "$b-scroll" set] -height 20 -exportselection 0]
pack $current_listbox [scrollbar "$b-scroll" -command [list $current_listbox yview]] \
-side left -expand 1 -fill y -anchor w
foreach item [concat [lsort -dictionary [glob -directory $dir -nocomplain -types {d} -- *]] \
[lsort -dictionary [glob -directory $dir -nocomplain -types {f} -- *]]] {
$current_listbox insert end "[file tail $item][expr {[file isdirectory $item] ? {/} : {}}]"
}
bind $current_listbox <Button-1> [list doc_navigate $dir $count %W %x %y]
bind $current_listbox <Double-Button-1> [list doc_double_button $dir $count %W %x %y]
# check for [file readable]?
#if { [info tclversion] >= 8.5 } {
# requires Tcl 8.5 but probably deals with special chars better
# destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
#} else {
if { [catch { eval destroy [lrange [winfo children $base] \
[expr { 2 * $count }] end] } \
errorMessage] } {
puts stderr "doc_make_listbox: error listing $dir\n"
}
#}
# exportselection 0 looks good, but selection gets easily out-of-sync
set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
[list "$b-scroll" set] -height 20 -exportselection 0]
pack $current_listbox [scrollbar "$b-scroll" -command [list $current_listbox yview]] \
-side left -expand 1 -fill y -anchor w
foreach item [concat [lsort -dictionary [glob -directory $dir -nocomplain -types {d} -- *]] \
[lsort -dictionary [glob -directory $dir -nocomplain -types {f} -- *]]] {
$current_listbox insert end "[file tail $item][expr {[file isdirectory $item] ? {/} : {}}]"
}
bind $current_listbox <Button-1> [list doc_navigate $dir $count %W %x %y]
bind $current_listbox <Double-Button-1> [list doc_double_button $dir $count %W %x %y]
}
proc doc_navigate {dir count width x y} {
if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
return
}
set dir_to_open [file join $dir $newdir]
if {[file isdirectory $dir_to_open]} {
doc_make_listbox [winfo parent $width] $dir_to_open [incr count]
}
if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
return
}
set dir_to_open [file join $dir $newdir]
if {[file isdirectory $dir_to_open]} {
doc_make_listbox [winfo parent $width] $dir_to_open [incr count]
}
}
proc doc_double_button {dir count width x y} {
global pd_guidir
if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
return
}
set dir_to_open [file join $dir $newdir]
if {[file isdirectory $dir_to_open]} {
doc_navigate $dir $count $width $x $y
} else {
regsub -- $pd_guidir [file dirname $dir_to_open] "" subdir
set file [file tail $dir_to_open]
if { [catch {menu_doc_open $subdir $file} fid] } {
puts stderr "Could not open $pd_guidir/$subdir/$file\n"
}
return;
}
global pd_guidir
if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
return
}
set dir_to_open [file join $dir $newdir]
if {[file isdirectory $dir_to_open]} {
doc_navigate $dir $count $width $x $y
} else {
regsub -- $pd_guidir [file dirname $dir_to_open] "" subdir
set file [file tail $dir_to_open]
if { [catch {menu_doc_open $subdir $file} fid] } {
puts stderr "Could not open $pd_guidir/$subdir/$file\n"
}
return;
}
}
############# routine to add media, help, and apple menu items ###############
......@@ -3376,17 +3376,17 @@ proc pdtk_pd_startup {version apilist midiapilist fontname_from_pd fontweight_fr
set width0 [font measure $font x]
set height0 [lindex [font metrics $font] 5]
set fontlist [concat $fontlist $i [font measure $font x] \
[lindex [font metrics $font] 5]]
[lindex [font metrics $font] 5]]
}
set tclpatch [info patchlevel]
if {$tclpatch == "8.3.0" || \
$tclpatch == "8.3.1" || \
$tclpatch == "8.3.2" || \
$tclpatch == "8.3.3" } {
set oldtclversion 1
$tclpatch == "8.3.1" || \
$tclpatch == "8.3.2" || \
$tclpatch == "8.3.3" } {
set oldtclversion 1
} else {
set oldtclversion 0
set oldtclversion 0
}
pd [concat pd init [pdtk_enquote [pwd]] $oldtclversion $fontlist \;];
......
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