aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2008-01-16 21:54:11 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2008-01-16 21:54:11 +0000
commitcde1ee8fa147dfd15dc5c5b43093cd8c8a402b74 (patch)
tree8682f7eb796e19647afedd5e1c641425879d98b3 /pd/src
parentc50af0d647849d50a4fbbe44aa855455b92c80fd (diff)
0.41-0 test 11
svn path=/trunk/; revision=9147
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/g_editor.c6
-rw-r--r--pd/src/m_class.c6
-rw-r--r--pd/src/m_pd.h5
-rw-r--r--pd/src/s_file.c3
-rw-r--r--pd/src/s_inter.c6
-rw-r--r--pd/src/s_main.c15
-rw-r--r--pd/src/s_path.c60
-rw-r--r--pd/src/u_main.tk11
-rw-r--r--pd/src/x_connective.c2
9 files changed, 68 insertions, 46 deletions
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 9f3097de..a44d952a 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -1564,6 +1564,12 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
else if (!strcmp(gotkeysym->s_name, "Right"))
canvas_displaceselection(x, shift ? 10 : 1, 0);
}
+ /* if control key goes up or down, and if we're in edit mode, change
+ cursor to indicate how the click action changes */
+ if (x && keynum == 0 && x->gl_edit &&
+ !strncmp(gotkeysym->s_name, "Control", 7))
+ canvas_setcursor(x, down ?
+ CURSOR_RUNMODE_NOTHING :CURSOR_EDITMODE_NOTHING);
}
void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
diff --git a/pd/src/m_class.c b/pd/src/m_class.c
index 622fbd2d..ab0b86be 100644
--- a/pd/src/m_class.c
+++ b/pd/src/m_class.c
@@ -459,12 +459,12 @@ t_propertiesfn class_getpropertiesfn(t_class *c)
static t_symbol *symhash[HASHSIZE];
-t_symbol *dogensym(char *s, t_symbol *oldsym)
+t_symbol *dogensym(const char *s, t_symbol *oldsym)
{
t_symbol **sym1, *sym2;
unsigned int hash1 = 0, hash2 = 0;
int length = 0;
- char *s2 = s;
+ const char *s2 = s;
while (*s2)
{
hash1 += *s2;
@@ -491,7 +491,7 @@ t_symbol *dogensym(char *s, t_symbol *oldsym)
return (sym2);
}
-t_symbol *gensym(char *s)
+t_symbol *gensym(const char *s)
{
return(dogensym(s, 0));
}
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index c92ba837..e7417da7 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 41
#define PD_BUGFIX_VERSION 0
-#define PD_TEST_VERSION "test10"
+#define PD_TEST_VERSION "test11"
/* 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 */
@@ -225,7 +225,7 @@ EXTERN t_symbol s_;
/* --------- prototypes from the central message system ----------- */
EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv);
EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv);
-EXTERN t_symbol *gensym(char *s);
+EXTERN t_symbol *gensym(const char *s);
EXTERN t_gotfn getfn(t_pd *x, t_symbol *s);
EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s);
EXTERN void nullfn(void);
@@ -417,6 +417,7 @@ EXTERN char *class_gethelpname(t_class *c);
EXTERN void class_setdrawcommand(t_class *c);
EXTERN int class_isdrawcommand(t_class *c);
EXTERN void class_domainsignalin(t_class *c, int onset);
+EXTERN void class_set_extern_dir(t_symbol *s);
#define CLASS_MAINSIGNALIN(c, type, field) \
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
diff --git a/pd/src/s_file.c b/pd/src/s_file.c
index c81d423b..fe266b37 100644
--- a/pd/src/s_file.c
+++ b/pd/src/s_file.c
@@ -28,6 +28,9 @@
#include <windows.h>
#include <tchar.h>
#endif
+#ifdef _MSC_VER /* This is only for Microsoft's compiler, not cygwin, e.g. */
+#define snprintf sprintf_s
+#endif
int sys_defeatrt;
t_symbol *sys_flags = &s_;
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 816e6207..85a5af30 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -250,12 +250,14 @@ static void sys_huphandler(int n)
void sys_setalarm(int microsec)
{
struct itimerval gonzo;
+ int sec = (int)(microsec/1000000);
+ microsec %= 1000000;
#if 0
- fprintf(stderr, "timer %d\n", microsec);
+ fprintf(stderr, "timer %d:%d\n", sec, microsec);
#endif
gonzo.it_interval.tv_sec = 0;
gonzo.it_interval.tv_usec = 0;
- gonzo.it_value.tv_sec = 0;
+ gonzo.it_value.tv_sec = sec;
gonzo.it_value.tv_usec = microsec;
if (microsec)
sys_signal(SIGALRM, sys_alarmhandler);
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 3396e993..d8d8602d 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -21,6 +21,9 @@
#include <windows.h>
#include <winbase.h>
#endif
+#ifdef _MSC_VER /* This is only for Microsoft's compiler, not cygwin, e.g. */
+#define snprintf sprintf_s
+#endif
char *pd_version;
char pd_compiletime[] = __TIME__;
@@ -172,7 +175,7 @@ static void openit(const char *dirname, const char *filename)
char dirbuf[MAXPDSTRING], *nameptr;
int fd = open_via_path(dirname, filename, "", dirbuf, &nameptr,
MAXPDSTRING, 0);
- if (fd)
+ if (fd >= 0)
{
close (fd);
glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
@@ -295,7 +298,7 @@ int sys_main(int argc, char **argv)
HINSTANCE ntdll;
char filename[MAXPDSTRING];
- sprintf(filename, "%s.dll", sys_externalschedlibname);
+ snprintf(filename, sizeof(filename), "%s.dll", sys_externalschedlibname);
sys_bashfilename(filename, filename);
ntdll = LoadLibrary(filename);
if (!ntdll)
@@ -386,7 +389,7 @@ static char *(usagemessage[]) = {
"-open <file> -- open file(s) on startup\n",
"-lib <file> -- load object library(s)\n",
"-font-size <n> -- specify default font size in points\n",
-"-font-face <name> -- specify default font (default: Bitstream Vera Sans Mono)\n",
+"-font-face <name> -- specify default font\n",
"-font-weight <name>-- specify default font weight (normal or bold)\n",
"-verbose -- extra printout on startup and when searching for files\n",
"-version -- don't run Pd; just print out which version it is \n",
@@ -747,13 +750,15 @@ int sys_argparse(int argc, char **argv)
sys_externlist = namelist_append_files(sys_externlist, argv[1]);
argc -= 2; argv += 2;
}
- else if ((!strcmp(*argv, "-font-size") || !strcmp(*argv, "-font")) && argc > 1)
+ else if ((!strcmp(*argv, "-font-size") || !strcmp(*argv, "-font"))
+ && argc > 1)
{
sys_defaultfont = sys_nearestfontsize(atoi(argv[1]));
argc -= 2;
argv += 2;
}
- else if ((!strcmp(*argv, "-font-face") || !strcmp(*argv, "-typeface")) && argc > 1)
+ else if ((!strcmp(*argv, "-font-face") || !strcmp(*argv, "-typeface"))
+ && argc > 1)
{
strncpy(sys_font,*(argv+1),sizeof(sys_font)-1);
sys_font[sizeof(sys_font)-1] = 0;
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 6abe7d0c..dbc28316 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -71,21 +71,29 @@ void sys_unbashfilename(const char *from, char *to)
/******************* Utility functions used below ******************/
-/* copy until delimiter and return position after delimiter in string */
-/* if it was the last substring, return NULL */
-
-static const char* strtokcpy(char *to, const char *from, int delim)
+/*!
+ * \brief copy until delimiter
+ *
+ * \arg to destination buffer
+ * \arg to_len destination buffer length
+ * \arg from source buffer
+ * \arg delim string delimiter to stop copying on
+ *
+ * \return position after delimiter in string. If it was the last
+ * substring, return NULL.
+ */
+static const char *strtokcpy(char *to, size_t to_len, const char *from, char delim)
{
- int size = 0;
+ unsigned int i = 0;
- while (from[size] != (char)delim && from[size] != '\0')
- size++;
+ for (; i < (to_len - 1) && from[i] && from[i] != delim; i++)
+ to[i] = from[i];
+ to[i] = '\0';
- strncpy(to,from,size);
- to[size] = '\0';
- if (from[size] == '\0') return NULL;
- if (size) return from+size+1;
- else return NULL;
+ if (i && from[i] != '\0')
+ return from + i + 1;
+
+ return NULL;
}
/* add a single item to a namelist. If "allowdup" is true, duplicates
@@ -133,7 +141,7 @@ t_namelist *namelist_append_files(t_namelist *listwas, const char *s)
npos = s;
do
{
- npos = strtokcpy(temp, npos, SEPARATOR);
+ npos = strtokcpy(temp, sizeof(temp), npos, SEPARATOR);
if (! *temp) continue;
nl = namelist_append(nl, temp, 0);
}
@@ -523,16 +531,9 @@ void glob_start_path_dialog(t_pd *dummy)
int i;
t_namelist *nl;
- sprintf(buf, "list");
- for (nl = sys_searchpath, i = 0; nl; nl = nl->nl_next, i++) {
- if(nl->nl_string){
- strcat(buf, " \"");
- strcat(buf, nl->nl_string);
- strcat(buf, "\"");
- }
- }
- sys_vgui("pd_set pd_path [%s]\n", buf);
-
+ sys_vgui("pd_set pd_path \"\"\n");
+ for (nl = sys_searchpath, i = 0; nl; nl = nl->nl_next, i++)
+ sys_vgui("lappend pd_path \"%s\"\n", nl->nl_string);
sprintf(buf, "pdtk_path_dialog %%s %d %d\n", sys_usestdpath, sys_verbose);
gfxstub_new(&glob_pdobject, (void *)glob_start_path_dialog, buf);
}
@@ -560,16 +561,9 @@ void glob_start_startup_dialog(t_pd *dummy)
int i;
t_namelist *nl;
- sprintf(buf, "list");
- for (nl = sys_externlist, i = 0; nl; nl = nl->nl_next, i++) {
- if(nl->nl_string){
- strcat(buf, " \"");
- strcat(buf, nl->nl_string);
- strcat(buf, "\"");
- }
- }
- sys_vgui("pd_set pd_startup [%s]\n", buf);
-
+ sys_vgui("pd_set pd_startup \"\"\n");
+ for (nl = sys_externlist, i = 0; nl; nl = nl->nl_next, i++)
+ sys_vgui("lappend pd_startup \"%s\"\n", nl->nl_string);
sprintf(buf, "pdtk_startup_dialog %%s %d \"%s\"\n", sys_defeatrt,
sys_flags->s_name);
gfxstub_new(&glob_pdobject, (void *)glob_start_startup_dialog, buf);
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 08d429a1..5b9d4e74 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -895,6 +895,17 @@ proc pdtk_canvas_new {name width height geometry editable} {
global tcl_version
toplevel $name -menu $name.m
+ # if we're a mac, refuse to make window so big you can't get to
+ # the resizing control
+ if {$pd_nt == 2} {
+ if {$width > [winfo screenwidth $name] - 80} {
+ set width [expr [winfo screenwidth $name] - 80]
+ }
+ if {$height > [winfo screenheight $name] - 80} {
+ set height [expr [winfo screenheight $name] - 80]
+ }
+ }
+
# slide offscreen windows into view
if {$tcl_version >= 8.4} {
set geometry [split $geometry +]
diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c
index 2f291f50..8687154e 100644
--- a/pd/src/x_connective.c
+++ b/pd/src/x_connective.c
@@ -1232,7 +1232,7 @@ static void makefilename_scanformat(t_makefilename *x)
x->x_intconvert = 0;
break;
}
- if (strchr("xXdiou",*str)!=0) {
+ if (strchr("xXdiouc",*str)!=0) {
x->x_accept = A_FLOAT;
x->x_intconvert = 1;
break;