From 6efb16b9040f7ba6db8c60559e0c815d54f05c43 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Fri, 8 Jul 2005 00:02:45 +0000 Subject: Bug fixes: took out some unwanted "red rectangle" apparitions when making arrays on new canvases; got the array dialog to come back; made graphical updating a bit more reliable. Tested and fixed a couple of problems on Mac and Windoes. svn path=/trunk/; revision=3300 --- pd/src/g_editor.c | 11 +++++++++- pd/src/g_graph.c | 5 ++--- pd/src/makefile.nt | 39 +++++++++++++++++++++++++++------ pd/src/notes.txt | 8 +++++++ pd/src/s_file.c | 32 +++++++++++++-------------- pd/src/s_main.c | 2 +- pd/src/s_midi.c | 4 ---- pd/src/s_midi_pm.c | 12 ---------- pd/src/u_main.tk | 64 +++++++++++++----------------------------------------- 9 files changed, 84 insertions(+), 93 deletions(-) (limited to 'pd/src') diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index fbf0097a..a4bfa1e6 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -853,11 +853,14 @@ void canvas_setgraph(t_glist *x, int flag, int nogoprect) } } +void garray_properties(t_garray *x); + /* tell GUI to create a properties dialog on the canvas. We tell the user the negative of the "pixel" y scale to make it appear to grow naturally upward, whereas pixels grow downward. */ void canvas_properties(t_glist *x) { + t_gobj *y; char graphbuf[200]; if (glist_isgraph(x) != 0) sprintf(graphbuf, @@ -875,6 +878,10 @@ void canvas_properties(t_glist *x) (int)x->gl_pixwidth, (int)x->gl_pixheight, (int)x->gl_xmargin, (int)x->gl_ymargin); gfxstub_new(&x->gl_pd, x, graphbuf); + /* if any arrays are in the graph, put out their dialogs too */ + for (y = x->gl_list; y; y = y->g_next) + if (pd_class(&y->g_pd) == garray_class) + garray_properties((t_garray *)y); } /* called from the gui when "OK" is selected on the canvas properties @@ -946,7 +953,9 @@ static void canvas_donecanvasdialog(t_glist *x, } /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */ canvas_setgraph(x, graphme, 0); - canvas_redraw(x); + if (x->gl_havewindow) + canvas_redraw(x); + else gobj_redraw(&x->gl_gobj, x->gl_owner); } /* called from the gui when a popup menu comes back with "properties," diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c index 9dae5221..b7b3da72 100644 --- a/pd/src/g_graph.c +++ b/pd/src/g_graph.c @@ -39,7 +39,8 @@ void glist_add(t_glist *x, t_gobj *y) } if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); - if (x->gl_editor && x->gl_isgraph && !x->gl_goprect) + if (x->gl_editor && x->gl_isgraph && !x->gl_goprect + && pd_checkobject(&y->g_pd)) { x->gl_goprect = 1; canvas_drawredrect(x, 1); @@ -1059,8 +1060,6 @@ static int graph_click(t_gobj *z, struct _glist *glist, } } -void garray_properties(t_garray *x); - t_widgetbehavior graph_widgetbehavior = { graph_getrect, diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt index b014931e..a33296c1 100644 --- a/pd/src/makefile.nt +++ b/pd/src/makefile.nt @@ -20,7 +20,7 @@ CFLAGS = /nologo /W3 /DMSW /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox \ LFLAGS = /nologo SYSSRC = s_audio_pa.c s_audio_pablio.c s_audio_paring.c \ - s_audio_mmio.c s_midi_mmio.c + s_audio_mmio.c s_midi_pm.c SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \ @@ -54,8 +54,9 @@ SRCPA = $(PADIR)/pa_common/pa_stream.c \ SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp -ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib $(LDIR)\comdlg32.lib \ -$(LDIR)\advapi32.lib $(LDIR)\shell32.lib $(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \ +ASIOLIB = $(LDIR)\user32.lib $(LDIR)\gdi32.lib $(LDIR)\winspool.lib \ +$(LDIR)\comdlg32.lib $(LDIR)\advapi32.lib $(LDIR)\shell32.lib \ +$(LDIR)\ole32.lib $(LDIR)\oleaut32.lib $(LDIR)\uuid.lib \ $(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib @@ -64,15 +65,26 @@ PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \ pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \ pa_win_wmme.obj +PMDIR = ..\portmidi +INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime +SRCPM = $(PADIR)/pm_common/portmidi.c \ + $(PMDIR)/pm_common/pmutil.c \ + $(PMDIR)/porttime/porttime.c \ + $(PMDIR)/porttime/ptwinmm.c \ + $(PMDIR)/pm_win/pmwin.c \ + $(PMDIR)/pm_win/pmwinmm.c -OBJC = $(SRC:.c=.obj) $(PAOBJ) +PMOBJ = portmidi.obj pmutil.obj porttime.obj ptwinmm.obj pmwin.obj pmwinmm.obj + +OBJC = $(SRC:.c=.obj) $(PAOBJ) $(PMOBJ) GSRC = t_main.c t_tkcmd.c GOBJ = $(GSRC:.c=.obj) .PHONY: pd gui -ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) $(INCPM) /D_WINDOWS /DPA_NO_DS +ALLCF = $(CFLAGS) $(INCLUDE) $(INCASIO) $(INCPA) $(INCPM) /D_WINDOWS \ + /DPA_NO_DS .c.obj: cl /c $(ALLCF) /Tc$*.c @@ -100,8 +112,8 @@ gui: ..\bin\pdtcl.dll $(LIB) ..\bin\pdreceive.exe: u_pdreceive.obj - link $(LFLAGS) /out:..\bin\pdreceive.exe /INCREMENTAL:NO u_pdreceive.obj \ - $(LIB) + link $(LFLAGS) /out:..\bin\pdreceive.exe /INCREMENTAL:NO \ + u_pdreceive.obj $(LIB) # explicit rules to compile portaudio sources: pa_stream.obj: $(PADIR)\pa_common\pa_stream.c @@ -132,6 +144,19 @@ pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp +portmidi.obj: $(PMDIR)\pm_common\portmidi.c + cl /c $(ALLCF) $(PMDIR)\pm_common\portmidi.c +pmutil.obj: $(PMDIR)\pm_common\pmutil.c + cl /c $(ALLCF) $(PMDIR)\pm_common\pmutil.c +pmwin.obj: $(PMDIR)\pm_win\pmwin.c + cl /c $(ALLCF) $(PMDIR)\pm_win\pmwin.c +pmwinmm.obj: $(PMDIR)\pm_win\pmwinmm.c + cl /c $(ALLCF) $(PMDIR)\pm_win\pmwinmm.c +porttime.obj: $(PMDIR)\porttime\porttime.c + cl /c $(ALLCF) $(PMDIR)\porttime\porttime.c +ptwinmm.obj: $(PMDIR)\porttime\ptwinmm.c + cl /c $(ALLCF) $(PMDIR)\porttime\ptwinmm.c + # the following should also clean up "bin" but it doesn't because "bin" holds # precious stuff from elsewhere. clean: diff --git a/pd/src/notes.txt b/pd/src/notes.txt index 5aca35dc..2faef8a0 100644 --- a/pd/src/notes.txt +++ b/pd/src/notes.txt @@ -15,6 +15,14 @@ GOP font depends on abstraction, not parent ------------ 0.39 --------- +problems: +array dimension change gives TK erro (doesn't update) +throwing new array on canvas makes red rectangle? +dialog doesn't start array dialog, just canvas one +arrays that don't fit in bounds don't update (same as red rectangle problem?) + + +flag for array to suppress printing name check: MIDI I/O for windows diff --git a/pd/src/s_file.c b/pd/src/s_file.c index 23e94c3f..bb04e797 100644 --- a/pd/src/s_file.c +++ b/pd/src/s_file.c @@ -270,8 +270,9 @@ void sys_loadpreferences( void) if (sys_getpreference("audioapi", prefbuf, MAXPDSTRING) && sscanf(prefbuf, "%d", &api) > 0) sys_set_audio_api(api); - if (sys_getpreference("noaudioin", prefbuf, MAXPDSTRING)) - naudioindev = 0; + if (sys_getpreference("noaudioin", prefbuf, MAXPDSTRING) && + !strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")) + naudioindev = 0; else { for (i = 0, naudioindev = 0; i < MAXAUDIOINDEV; i++) @@ -287,8 +288,9 @@ void sys_loadpreferences( void) if (naudioindev == 0) naudioindev = -1; } - if (sys_getpreference("noaudioout", prefbuf, MAXPDSTRING)) - naudiooutdev = 0; + if (sys_getpreference("noaudioout", prefbuf, MAXPDSTRING) && + !strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")) + naudiooutdev = 0; else { for (i = 0, naudiooutdev = 0; i < MAXAUDIOOUTDEV; i++) @@ -311,8 +313,9 @@ void sys_loadpreferences( void) naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 0); /* load MIDI preferences */ - if (sys_getpreference("nomidiin", prefbuf, MAXPDSTRING)) - nmidiindev = 0; + if (sys_getpreference("nomidiin", prefbuf, MAXPDSTRING) && + !strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")) + nmidiindev = 0; else for (i = 0, nmidiindev = 0; i < MAXMIDIINDEV; i++) { sprintf(keybuf, "midiindev%d", i+1); @@ -322,8 +325,9 @@ void sys_loadpreferences( void) break; nmidiindev++; } - if (sys_getpreference("nomidiout", prefbuf, MAXPDSTRING)) - nmidioutdev = 0; + if (sys_getpreference("nomidiout", prefbuf, MAXPDSTRING) && + !strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")) + nmidioutdev = 0; else for (i = 0, nmidioutdev = 0; i < MAXMIDIOUTDEV; i++) { sprintf(keybuf, "midioutdev%d", i+1); @@ -397,16 +401,14 @@ void glob_savepreferences(t_pd *dummy) sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &advance); - if (naudioindev <= 0) - sys_putpreference("noaudioin", "."); + sys_putpreference("noaudioin", (naudioindev <= 0 ? "True" : "False")); for (i = 0; i < naudioindev; i++) { sprintf(buf1, "audioindev%d", i+1); sprintf(buf2, "%d %d", audioindev[i], chindev[i]); sys_putpreference(buf1, buf2); } - if (naudiooutdev <= 0) - sys_putpreference("noaudioout", "."); + sys_putpreference("noaudioout", (naudiooutdev <= 0 ? "True" : "False")); for (i = 0; i < naudiooutdev; i++) { sprintf(buf1, "audiooutdev%d", i+1); @@ -422,16 +424,14 @@ void glob_savepreferences(t_pd *dummy) /* MIDI settings */ sys_get_midi_params(&nmidiindev, midiindev, &nmidioutdev, midioutdev); - if (nmidiindev <= 0) - sys_putpreference("nomidiin", "."); + sys_putpreference("nomidiin", (nmidiindev <= 0 ? "True" : "False")); for (i = 0; i < nmidiindev; i++) { sprintf(buf1, "midiindev%d", i+1); sprintf(buf2, "%d", midiindev[i]); sys_putpreference(buf1, buf2); } - if (nmidioutdev <= 0) - sys_putpreference("nomidiout", "."); + sys_putpreference("nomidiout", (nmidioutdev <= 0 ? "True" : "False")); for (i = 0; i < nmidioutdev; i++) { sprintf(buf1, "midioutdev%d", i+1); diff --git a/pd/src/s_main.c b/pd/src/s_main.c index 619e6fd4..a8030f40 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -2,7 +2,7 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -char pd_version[] = "Pd version 0.39 TEST 2\n"; +char pd_version[] = "Pd version 0.39 TEST 3\n"; char pd_compiletime[] = __TIME__; char pd_compiledate[] = __DATE__; diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c index 9e169cd0..fbab4283 100644 --- a/pd/src/s_midi.c +++ b/pd/src/s_midi.c @@ -507,11 +507,7 @@ void sys_reopen_midi( void) #define MAXNDEV 20 #define DEVDESCSIZE 80 -#ifdef MSW -#define DEVONSET 0 /* microsoft device list starts at 0 (the "mapper"). */ -#else /* (see also MSW ifdef in sys_parsedevlist(), s_main.c) */ #define DEVONSET 1 /* To agree with command line flags, normally start at 1 */ -#endif void sys_listmididevs(void ) { diff --git a/pd/src/s_midi_pm.c b/pd/src/s_midi_pm.c index a6c26b26..a79c839b 100644 --- a/pd/src/s_midi_pm.c +++ b/pd/src/s_midi_pm.c @@ -37,18 +37,6 @@ void sys_do_open_midi(int nmidiin, int *midiinvec, Pt_Start(1, 0, 0); /* start a timer with millisecond accuracy */ - /* protect the unwary from having MIDI inputs open; they're - bad news if you close Pd's terminal window. see sys_nmidiin - in s_main.c too. */ -#ifdef MSW - if (nmidiin) - { - post( - "midi input enabled; warning, don't close the DOS window directly!"); - } - else post("not using MIDI input (use 'pd -midiindev 1' to override)"); -#endif - mac_nmidiindev = 0; for (i = 0; i < nmidiin; i++) { diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index f6534dde..f6233efa 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -102,24 +102,16 @@ menu .mbar.audio -tearoff $pd_tearoff if {$pd_nt != 2} { .mbar add cascade -label "Windows" -menu .mbar.windows .mbar add cascade -label "Media" -menu .mbar.audio -# a menu on the main menubar named $whatever.help while be treated -# as a special menu with specific behaviors on different platforms. -# See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm - menu .mbar.help -tearoff $pd_tearoff - .mbar add cascade -label "Help" -menu .mbar.help + menu .mbar.help -tearoff $pd_tearoff + .mbar add cascade -label "Help" -menu .mbar.help } else { - menu .mbar.apple -tearoff 0 - .mbar add cascade -label "Apple" -menu .mbar.apple + menu .mbar.apple -tearoff 0 + .mbar add cascade -label "Apple" -menu .mbar.apple # arrange menus according to Apple HIG .mbar add cascade -label "Media" -menu .mbar.audio .mbar add cascade -label "Window" -menu .mbar.windows -# a menu on the main menubar named "$whatever.help" while be treated -# as a special menu with specific behaviors on different platforms. -# See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm -# Apple doesn't allow cascading menus in their Help so I had to call this -# one $mbar.docs # - menu .mbar.docs -tearoff $pd_tearoff - .mbar add cascade -label "Help" -menu .mbar.docs + menu .mbar.help -tearoff $pd_tearoff + .mbar add cascade -label "Help" -menu .mbar.help } set ctrls_audio_on 0 @@ -506,31 +498,15 @@ proc menu_addstd {mbar} { } -# the "Help" menu - if {$pd_nt != 2} { -# a menu on the main menubar named "$whatever.help" while be treated -# as a special menu with specific behaviors on different platforms. -# See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm - $mbar.help add command -label {About Pd} \ - -command {menu_doc_open doc/1.manual 1.introduction.txt} - $mbar.help add command -label {Pure Documentation...} \ - -command {menu_documentation} - # add menu items for each section instead of using Pd patches - $mbar.help add separator - set helpmenuname help - } else { -# Apple doesn't allow cascading menus in their Help so I had to call this -# one "docs" - set helpmenuname docs - } - - $mbar.$helpmenuname add command -label {1 manual...} \ - -command {menu_doc_open doc/1.manual index.htm} - doc_submenu $mbar.$helpmenuname 2.control.examples - doc_submenu $mbar.$helpmenuname 3.audio.examples - doc_submenu $mbar.$helpmenuname 4.fft.examples - doc_submenu $mbar.$helpmenuname 5.reference - doc_submenu $mbar.$helpmenuname 6.externs + # the "Help" menu + if {$pd_nt != 2} { + $mbar.help add command -label {About Pd} \ + -command {menu_doc_open doc/1.manual 1.introduction.txt} + } + $mbar.help add command -label {Html ...} \ + -command {menu_doc_open doc/1.manual index.htm} + $mbar.help add command -label {Browser ...} \ + -command {menu_documentation} } #################### the "File" menu for the Pd window ############## @@ -1104,18 +1080,8 @@ proc pdtk_canvas_new {name width height geometry editable} { # the help menu -# a menu on the main menubar named "$whatever.help" while be treated -# as a special menu with specific behaviors on different platforms. -# See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm - if {$pd_nt != 2} { menu $name.m.help -tearoff $pd_tearoff $name.m add cascade -label Help -menu $name.m.help - } else { - # Apple doesn't allow cascading menus in their Help - # so I had to call this one "docs". - menu $name.m.docs -tearoff $pd_tearoff - $name.m add cascade -label Help -menu $name.m.docs - } menu_addstd $name.m -- cgit v1.2.1