aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2009-01-02 19:40:36 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2009-01-02 19:40:36 +0000
commit781d1bc4ab8fc9fa55485d3c35bb1ba7fd6774c3 (patch)
tree0ed8e60689e7afae65cf668b63face8807226fc3 /pd/src
parenta7f56f2c7b0c44912f7fb772c64f547a8c0e0ae3 (diff)
release 0.42-0
svn path=/trunk/; revision=10471
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/g_editor.c104
-rw-r--r--pd/src/m_pd.h2
-rw-r--r--pd/src/notes.txt9
-rw-r--r--pd/src/u_main.tk28
-rw-r--r--pd/src/x_gui.c2
5 files changed, 88 insertions, 57 deletions
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index ef096a4c..a63d4a5c 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -756,11 +756,13 @@ int glist_amreloadingabstractions = 0;
void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except)
{
t_canvas *x;
+ int dspwas = canvas_suspend_dsp();
glist_amreloadingabstractions = 1;
/* find all root canvases */
for (x = canvas_list; x; x = x->gl_next)
glist_doreload(x, name, dir, except);
glist_amreloadingabstractions = 0;
+ canvas_resume_dsp(dspwas);
}
/* ------------------------ event handling ------------------------ */
@@ -1190,8 +1192,9 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
strcpy(namebuf, class_gethelpname(pd_class(&y->g_pd)));
dir = class_gethelpdir(pd_class(&y->g_pd));
}
- if (strcmp(namebuf + strlen(namebuf) - 3, ".pd"))
- strcat(namebuf, ".pd");
+ if (strlen(namebuf) < 4 ||
+ strcmp(namebuf + strlen(namebuf) - 3, ".pd"))
+ strcat(namebuf, ".pd");
open_via_helppath(namebuf, dir);
return;
}
@@ -1596,8 +1599,9 @@ void canvas_mouseup(t_canvas *x,
vmess(&gl2->gl_pd, gensym("menu-open"), "");
x->gl_editor->e_onmotion = MA_NONE;
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx dirty 0;\n} no\n",
- canvas_getrootfor(gl2)->gl_name->s_name, gl2);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx dirty 0;\n} no\n",
+ canvas_getrootfor(gl2),
+ canvas_getrootfor(gl2)->gl_name->s_name, gl2);
return;
}
/* OK, activate it */
@@ -1725,34 +1729,16 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
|| !strcmp(gotkeysym->s_name, "Left")
|| !strcmp(gotkeysym->s_name, "Right")))
{
- /* special case - carriage return to object "makes" it */
- if (keynum == '\n' && (ob =
- pd_checkobject(&x->gl_editor->e_selection->sel_what->g_pd)) &&
- ob->te_type == T_OBJECT)
+ /* send the key to the box's editor */
+ if (!x->gl_editor->e_textdirty)
{
- t_gobj *g;
- int nobj, indx =
- canvas_getindex(x, x->gl_editor->e_selection->sel_what);
- glist_noselect(x);
- /* "ob" may have disappeared; just search to the last
- object and select it */
- for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++)
- if (nobj == indx)
- glist_select(x, g);
- }
- else
- {
- /* otherwise send the key to the box's editor */
- if (!x->gl_editor->e_textdirty)
- {
- canvas_setundo(x, canvas_undo_cut,
- canvas_undo_set_cut(x, UCUT_TEXT), "typing");
- }
- rtext_key(x->gl_editor->e_textedfor,
- (int)keynum, gotkeysym);
- if (x->gl_editor->e_textdirty)
- canvas_dirty(x, 1);
+ canvas_setundo(x, canvas_undo_cut,
+ canvas_undo_set_cut(x, UCUT_TEXT), "typing");
}
+ rtext_key(x->gl_editor->e_textedfor,
+ (int)keynum, gotkeysym);
+ if (x->gl_editor->e_textdirty)
+ canvas_dirty(x, 1);
}
/* check for backspace or clear */
else if (keynum == 8 || keynum == 127)
@@ -1873,12 +1859,13 @@ void glob_verifyquit(void *dummy, t_floatarg f)
{
canvas_vis(g2, 1);
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n",
- canvas_getrootfor(g2)->gl_name->s_name, g2);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 3;\n} no\n",
+ canvas_getrootfor(g2), canvas_getrootfor(g2)->gl_name->s_name, g2);
return;
}
if (f == 0 && sys_perf)
- sys_vgui("pdtk_check {really quit?} {pd quit;\n} yes\n");
+ sys_vgui("pdtk_check .x%lx.c {really quit?} {pd quit;\n} yes\n",
+ canvas_getrootfor(g2));
else glob_quit(0);
}
@@ -1902,15 +1889,15 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
{
vmess(&g->gl_pd, gensym("menu-open"), "");
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
- canvas_getrootfor(g)->gl_name->s_name, g);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
+ canvas_getrootfor(g), canvas_getrootfor(g)->gl_name->s_name, g);
return;
}
else if (sys_perf)
{
sys_vgui(
-"pdtk_check {Close '%s'?} {.x%lx menuclose 1;\n} yes\n",
- canvas_getrootfor(x)->gl_name->s_name, x);
+"pdtk_check .x%lx.c {Close '%s'?} {.x%lx menuclose 1;\n} yes\n",
+ canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, x);
}
else pd_free(&x->gl_pd);
}
@@ -1926,8 +1913,8 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
{
vmess(&g->gl_pd, gensym("menu-open"), "");
sys_vgui(
-"pdtk_check {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
- canvas_getrootfor(x)->gl_name->s_name, g);
+"pdtk_check .x%lx.c {Discard changes to '%s'?} {.x%lx menuclose 2;\n} no\n",
+ canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, g);
return;
}
else pd_free(&x->gl_pd);
@@ -2357,7 +2344,7 @@ static void canvas_paste(t_canvas *x)
static void canvas_duplicate(t_canvas *x)
{
- if (x->gl_editor->e_onmotion == MA_NONE)
+ if (x->gl_editor->e_onmotion == MA_NONE && x->gl_editor->e_selection)
{
t_selection *y;
canvas_copy(x);
@@ -2383,6 +2370,41 @@ static void canvas_selectall(t_canvas *x)
}
}
+static void canvas_reselect(t_canvas *x)
+{
+ t_gobj *g, *gwas;
+ t_selection *sel;
+ t_object *ob;
+ /* if someone is text editing, and if only one object is
+ selected, deselect everyone and reselect. */
+ if (x->gl_editor->e_textedfor)
+ {
+ /* only do this if exactly one item is selected. */
+ if ((gwas = x->gl_editor->e_selection->sel_what) &&
+ !x->gl_editor->e_selection->sel_next)
+ {
+ int nobjwas = glist_getindex(x, 0),
+ indx = canvas_getindex(x, x->gl_editor->e_selection->sel_what);
+ glist_noselect(x);
+ for (g = x->gl_list; g; g = g->g_next)
+ if (g == gwas)
+ {
+ glist_select(x, g);
+ return;
+ }
+ /* "gwas" must have disappeared; just search to the last
+ object and select it */
+ for (g = x->gl_list; g; g = g->g_next)
+ if (!g->g_next)
+ glist_select(x, g);
+ }
+ }
+ else if (x->gl_editor->e_selection &&
+ !x->gl_editor->e_selection->sel_next)
+ /* otherwise activate first item in selection */
+ gobj_activate(x->gl_editor->e_selection->sel_what, x, 1);
+}
+
extern t_class *text_class;
void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
@@ -2663,6 +2685,8 @@ void g_editor_setup(void)
gensym("duplicate"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_selectall,
gensym("selectall"), A_NULL);
+ class_addmethod(canvas_class, (t_method)canvas_reselect,
+ gensym("reselect"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_undo,
gensym("undo"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_redo,
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index 888ed936..ba9cecc5 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
#define PD_BUGFIX_VERSION 0
-#define PD_TEST_VERSION "test8"
+#define PD_TEST_VERSION ""
/* old name for "MSW" flag -- we have to take it for the sake of many old
"nmakefiles" for externs, which will define NT and not MSW */
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index fabdc332..1a17eace 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,5 +1,4 @@
---------------- dolist --------------------
-close patch with dirty GOP abstraction can't vis the abstraction to query
test:
compile on various versions of linux
@@ -15,9 +14,8 @@ mac:
Gnome: why don't windows pop up when clicked on?
problems:
-saving as "x.pd" on mac writes to "x.pd.pd"
-if .pdsettings asks for an alsa device out of range, dialog
- comes up with empty list
+get rid of remaining -export-dynamic in makefiles
+saving as "x.pd" on mac writes to "x.pd.pd" (can't reproduce this.)
find asdf$1 (e.g.) doesn't work
check real-time gaps in writesf~
fix declare to update current patch when changed
@@ -92,7 +90,6 @@ flags to defeat pre-loading specified classes
editing:
pasting should look at current mouse location
clickless connection (hit 'c' key? see Bouchard paper)
- "enter" into object box to create new one (also, change border? forking?)
tab to jump to a connected object (first one?) (shift-tab to back up?)
arrow keys to shift connections left and right
menu item to connect selected objects
@@ -104,7 +101,7 @@ editing:
data:
add -x [-n?] flag to drawnumbers
flag to disable edits for arrays
-make a 2-pass proecss for finding hot spot closes to any given click
+make a 2-pass proecss for finding hot spot closest to any given click
replace list element with binbuf??
hooks for table mousing, other changes (scalars?)
data to save as succession of "list" messages that textfile can store, etc.
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index ee971e50..394ae087 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -282,9 +282,9 @@ proc pdtk_ping {} {
}
##### routine to ask user if OK and, if so, send a message on to Pd ######
-proc pdtk_check {x message default} {
- set answer [tk_messageBox \-message $x \-type yesno -default $default \
- -icon question]
+proc pdtk_check {canvas x message default} {
+ set answer [tk_messageBox -message $x -type yesno -default $default \
+ -parent $canvas -icon question]
if {! [string compare $answer yes]} {pd $message}
}
@@ -333,9 +333,9 @@ proc menu_new {} {
################## the "Open" menu command #########################
-proc menu_open {} {
+proc menu_open {parent} {
global pd_opendir
- set filename [tk_getOpenFile -defaultextension .pd \
+ set filename [tk_getOpenFile -defaultextension .pd -parent $parent\
-filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \
-initialdir $pd_opendir]
if {$filename != ""} {open_file $filename}
@@ -383,6 +383,9 @@ proc menu_pop_pd {} {raise .}
######### the "audio" menu command ###############
proc menu_audio {flag} {pd [concat pd dsp $flag \;]}
+######### the "reselect" menu command ################
+proc menu_reselect {name} {pd [concat $name reselect \;]}
+
######### the "documentation" menu command ###############
set doc_number 1
@@ -592,7 +595,7 @@ proc menu_addstd {mbar} {
.mbar.file add command -label New -command {menu_new} \
-accelerator [accel_munge "Ctrl+n"]
-.mbar.file add command -label Open -command {menu_open} \
+.mbar.file add command -label Open -command {menu_open .} \
-accelerator [accel_munge "Ctrl+o"]
.mbar.file add separator
.mbar.file add command -label Message -command {menu_send} \
@@ -947,7 +950,7 @@ proc pdtk_canvas_new {name width height geometry editable} {
$name.m.file add command -label New -command {menu_new} \
-accelerator [accel_munge "Ctrl+n"]
- $name.m.file add command -label Open -command {menu_open} \
+ $name.m.file add command -label Open -command [concat menu_open $name] \
-accelerator [accel_munge "Ctrl+o"]
$name.m.file add separator
@@ -1014,6 +1017,10 @@ proc pdtk_canvas_new {name width height geometry editable} {
-command [concat menu_selectall $name] \
-accelerator [accel_munge "Ctrl+a"]
+ $name.m.edit add command -label {Reselect} \
+ -command [concat menu_reselect $name] \
+ -accelerator "Ctrl+Enter"
+
$name.m.edit add separator
$name.m.edit add command -label {Text Editor} \
@@ -1652,6 +1659,7 @@ proc pdtk_canvas_ctrlkey {name key shift} {
if {$key == "5"} {menu_comment $topname 1}
if {$key == "slash"} {menu_audio 1}
if {$key == "period"} {menu_audio 0}
+ if {$key == "Return"} {menu_reselect $topname}
if {$shift == 1} {
if {$key == "q" || $key == "Q"} {menu_really_quit}
if {$key == "w" || $key == "W"} {menu_really_close $topname}
@@ -1672,7 +1680,7 @@ proc pdtk_canvas_ctrlkey {name key shift} {
if {$key == "s" || $key == "S"} {menu_save $topname}
if {$key == "z" || $key == "Z"} {menu_undo $topname}
if {$key == "n" || $key == "N"} {menu_new}
- if {$key == "o" || $key == "O"} {menu_open}
+ if {$key == "o" || $key == "O"} {menu_open $topname}
if {$key == "m" || $key == "M"} {menu_send}
if {$key == "w" || $key == "W"} {menu_close $topname}
if {$key == "p" || $key == "P"} {menu_print $topname}
@@ -1726,7 +1734,7 @@ set saveas_dir nowhere
proc pdtk_canvas_saveas {name initfile initdir} {
global pd_nt
set filename [tk_getSaveFile -initialfile $initfile \
- -initialdir $initdir -defaultextension .pd \
+ -initialdir $initdir -defaultextension .pd -parent $name.c \
-filetypes { {{pd files} {.pd}} {{max files} {.pat}} }]
if {$filename != ""} {
@@ -3363,7 +3371,7 @@ proc pdtk_pd_ctrlkey {name key shift} {
# puts stderr [concat key $key shift $shift]
# .dummy itemconfig goo -text [concat ---> control-key event $key];
if {$key == "n" || $key == "N"} {menu_new}
- if {$key == "o" || $key == "O"} {menu_open}
+ if {$key == "o" || $key == "O"} {menu_open .}
if {$key == "m" || $key == "M"} {menu_send}
if {$key == "q" || $key == "Q"} {
if {$shift == 1} {menu_really_quit} else {menu_quit}
diff --git a/pd/src/x_gui.c b/pd/src/x_gui.c
index bcc6ec8b..7cc23d26 100644
--- a/pd/src/x_gui.c
+++ b/pd/src/x_gui.c
@@ -233,6 +233,7 @@ static t_class *savepanel_class;
typedef struct _savepanel
{
t_object x_obj;
+ t_canvas *x_canvas;
t_symbol *x_s;
} t_savepanel;
@@ -242,6 +243,7 @@ static void *savepanel_new( void)
t_savepanel *x = (t_savepanel *)pd_new(savepanel_class);
sprintf(buf, "d%lx", (t_int)x);
x->x_s = gensym(buf);
+ x->x_canvas = canvas_getcurrent();
pd_bind(&x->x_obj.ob_pd, x->x_s);
outlet_new(&x->x_obj, &s_symbol);
return (x);