Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wynn
purr-data
Commits
f71af8d2
Commit
f71af8d2
authored
Feb 22, 2011
by
Ivica Bukvic
Committed by
Hans-Christoph Steiner
Nov 02, 2011
Browse files
Pd-0.42.5-extended-l2ork-dev-20110221.tar.bz2
parent
1743ab9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/g_editor.c
View file @
f71af8d2
...
...
@@ -28,8 +28,8 @@ static void canvas_dopaste(t_canvas *x, t_binbuf *b);
static
void
canvas_paste
(
t_canvas
*
x
);
static
void
canvas_clearline
(
t_canvas
*
x
);
static
t_binbuf
*
copy_binbuf
;
static
char
*
canvas_textcopybuf
;
static
int
canvas_textcopybufsize
;
//
static char *canvas_textcopybuf;
//
static int canvas_textcopybufsize;
static
t_glist
*
glist_finddirty
(
t_glist
*
x
);
static
void
canvas_reselect
(
t_canvas
*
x
);
static
void
canvas_cut
(
t_canvas
*
x
);
...
...
@@ -1631,7 +1631,10 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
t_gobj
*
y
=
NULL
,
*
oldy
=
NULL
,
*
oldy_prev
=
NULL
,
*
oldy_next
=
NULL
,
*
y_begin
,
*
y_end
=
NULL
;
int
x1
,
y1
,
x2
,
y2
;
//mark the beginning of the glist for front/back
// first deselect any objects that may be already selected
glist_noselect
(
x
);
// mark the beginning of the glist for front/back
y_begin
=
x
->
gl_list
;
if
(
which
==
3
||
which
==
4
)
{
...
...
@@ -3018,6 +3021,10 @@ static void canvas_copy(t_canvas *x)
binbuf_free
(
copy_binbuf
);
//fprintf(stderr, "canvas_copy\n");
copy_binbuf
=
canvas_docopy
(
x
);
if
(
!
x
->
gl_editor
->
e_selection
)
sys_vgui
(
"pdtk_canvas_update_edit_menu .x%lx 0
\n
"
,
x
);
else
sys_vgui
(
"pdtk_canvas_update_edit_menu .x%lx 1
\n
"
,
x
);
paste_xyoffset
=
1
;
if
(
x
->
gl_editor
->
e_textedfor
)
{
...
...
@@ -3025,21 +3032,21 @@ static void canvas_copy(t_canvas *x)
int
bufsize
;
rtext_getseltext
(
x
->
gl_editor
->
e_textedfor
,
&
buf
,
&
bufsize
);
#if defined(MSW) || defined(__APPLE__)
/* for Mac or Windows, copy the text to the clipboard here */
//
#if defined(MSW) || defined(__APPLE__)
//
/* for Mac or Windows, copy the text to the clipboard here */
sys_vgui
(
"clipboard clear
\n
"
,
bufsize
,
buf
);
sys_vgui
(
"clipboard append {%.*s}
\n
"
,
bufsize
,
buf
);
#else
//
#else
/* in X windows the selection already went to the
clipboard when it was made; here we "copy" it to our own buffer
as well, because, annoyingly, the clipboard will usually be
destroyed by the time the user asks to "paste". */
if
(
canvas_textcopybuf
)
/*
if (canvas_textcopybuf)
t_freebytes(canvas_textcopybuf, canvas_textcopybufsize);
canvas_textcopybuf = (char *)getbytes(bufsize);
memcpy(canvas_textcopybuf, buf, bufsize);
canvas_textcopybufsize
=
bufsize
;
#endif
canvas_textcopybufsize = bufsize;
*/
//
#endif
}
}
...
...
@@ -3256,18 +3263,18 @@ static void canvas_paste(t_canvas *x)
if
(
x
->
gl_editor
->
e_textedfor
)
{
/* simulate keystrokes as if the copy buffer were typed in. */
#if defined(MSW) || defined(__APPLE__)
//
#if defined(MSW) || defined(__APPLE__)
/* for Mac or Windows, ask the GUI to send the clipboard down */
sys_gui
(
"pdtk_pastetext
\n
"
);
#else
//
#else
/* in X windows we kept the text in our own copy buffer */
int
i
;
/*
int i;
for (i = 0; i < canvas_textcopybufsize; i++)
{
pd_vmess(&x->gl_gobj.g_pd, gensym("key"), "iii",
1, canvas_textcopybuf[i]&0xff, 0);
}
#endif
}
*/
//
#endif
}
else
{
...
...
src/m_pd.h
View file @
f71af8d2
...
...
@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
#define PD_BUGFIX_VERSION 5
#define PD_TEST_VERSION "extended-l2ork-2011021
8
"
#define PD_TEST_VERSION "extended-l2ork-201102
2
1"
/* 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 */
...
...
src/pd.tk
View file @
f71af8d2
...
...
@@ -224,6 +224,7 @@ if { $tcl_platform(platform) == "windows" } {
}
else
{
#
set
nicer
theme
ttk
::
style
theme
use
purty_linux
clipboard
clear
set
window_prefs
{}
set
pd_nt
0
set
ctrl_key
"Control"
...
...
@@ -633,7 +634,7 @@ if { [info tclversion] >= 8.5 && $pd_nt == 0 } {
}
match_linux_wm
[
list
button
.
controls
.
clr_console
-
text
"Clear Console"
\
-command
{.printout.text delete 0.0 end}
]
-
command
[
concat
menu_clear_console
]
]
pack
.
controls
.
inout
.
in
.
controls
.
inout
.
out
-
side
left
-
padx
6
pack
.
controls
.
inout
-
side
left
-
padx
14
...
...
@@ -646,7 +647,9 @@ if {[info exists show_console] && $show_console == 1} {
match_linux_wm
[
list
frame
.
printout
]
text
.
printout
.
text
-
relief
sunken
-
bd
1
-
font
console_font
\
-yscrollcommand ".printout.scroll set" -width 70 -highlightthickness 0 -takefocus 0
-
yscrollcommand
".printout.scroll set"
-
width
70
\
-
highlightthickness
0
-
takefocus
0
-
fg
gray20
-
state
disabled
#.
printout
.
text
tag
configure
sel
-
background
$
linux_wm_hlcolor
#
.
printout
.
text
insert
end
"
\n\n\n\n\n\n\n\n\n\n
"
match_linux_wm
[
list
scrollbar
.
printout
.
scroll
-
command
".printout.text yview"
]
...
...
@@ -663,23 +666,26 @@ bind .printout.text <Button> {pdtk_update_root_edit_menu 0}
bind
.
printout
.
text
<<
Selection
>>
{
pdtk_update_root_edit_menu
1
}
proc
pdtk_update_root_edit_menu
{
value
}
{
#
pdtk_post
"update_root_edit_menu $value
\n
"
if
{$
value
}
{
set
range
[.
printout
.
text
tag
ranges
sel
]
#
pdtk_post
"[lindex $range 0] -- [lindex $range 1]
\n
"
if
{[
lindex
$
range
0
]
!= [lindex $range 1]} {
.mbar.edit entryconfigure "Cut" -state normal
#
.
mbar
.
edit
entryconfigure
"Cut"
-
state
normal
.
mbar
.
edit
entryconfigure
"Copy"
-
state
normal
}
}
else
{
#
pdtk_post
off
.mbar.edit entryconfigure "Cut" -state disabled
#
.
mbar
.
edit
entryconfigure
"Cut"
-
state
disabled
.
mbar
.
edit
entryconfigure
"Copy"
-
state
disabled
}
}
proc
pdtk_post
{
stuff
}
{
.
printout
.
text
configure
-
state
normal
.
printout
.
text
insert
end
$
stuff
.
printout
.
text
yview
end
-
2
char
.
printout
.
text
configure
-
state
disabled
}
proc
pdtk_standardkeybindings
{
id
}
{
...
...
@@ -699,11 +705,11 @@ proc pdtk_panelkeybindings {id panelname} {
pdtk_standardkeybindings
.
#
hacks
to
add
standard
key
bindings
to
the
Pd
window
bind
.
<$
ctrl_key
-
Key
-
a
>
{.
printout
.
text
tag
add
sel
1.0
end
}
bind . <$ctrl_key-Key-x> {tk_textCut .printout.text; \
.mbar.edit entryconfigure "Paste" -state normal}
bind . <$ctrl_key-Key-c> {tk_textCopy .printout.text
; \
.mbar.edit entryconfigure "Paste" -state normal}
bind . <$ctrl_key-Key-v> {tk_textPaste .printout.text}
#
bind
.
<$
ctrl_key
-
Key
-
x
>
{
tk_textCut
.
printout
.
text
;
\
#
.
mbar
.
edit
entryconfigure
"Paste"
-
state
normal
}
bind
.
<$
ctrl_key
-
Key
-
c
>
{
tk_textCopy
.
printout
.
text
}
#
.
mbar
.
edit
entryconfigure
"Paste"
-
state
normal
}
#
bind
.
<$
ctrl_key
-
Key
-
v
>
{
tk_textPaste
.
printout
.
text
}
bind
.
<$
ctrl_key
-
Key
-
w
>
{
menu_quit
}
#
kludge
to
add
window
control
bindings
to
the
Pd
Window
if
{$
pd_nt
==
2
}
{
...
...
@@ -713,8 +719,26 @@ if {$pd_nt == 2} {
bind
.
<
Control
-
Prior
>
{
menu_raisepreviouswindow
}
;#
needs
Tcl
/
Tk
8.5
}
#
pass
key
presses
inside
main
window
to
patch
windows
proc
pdtk_capture_root_window_keys
{
state
key
iso
shift
}
{
global
menu_windowlist
set
first_patch_window_name
[
lindex
$
menu_windowlist
0
1
]
#
pdtk_post
"$first_patch_window_name
\n
"
if
{
[
string
length
$
first_patch_window_name
]
>
0
}
{
pdtk_canvas_sendkey
$
first_patch_window_name
.
c
$
state
$
key
$
iso
$
shift
}
}
bind
.
<
Key
>
{
pdtk_capture_root_window_keys
1
%
K
%
A
0
}
bind
.
<
Shift
-
Key
>
{
pdtk_capture_root_window_keys
1
%
K
%
A
1
}
bind
.
<
KeyRelease
>
{
pdtk_capture_root_window_keys
0
%
K
%
A
0
}
bind
.
<
Control
-
Key
>
{
pdtk_canvas_ctrlkey
%
W
%
K
0
}
bind
.
<
Control
-
Shift
-
Key
>
{
pdtk_canvas_ctrlkey
%
W
%
K
1
}
wm title . "P
d
"
wm
title
.
"P
ure-Data L2Ork
"
#
initial
location
of
Pd
window
(+
x
+
y
)
wm
geometry
.
+
10
+
35
.
configure
-
menu
.
mbar
-
width
200
-
height
150
...
...
@@ -995,7 +1019,7 @@ proc menu_raise_console {} {
proc
menu_toggle_console
{}
{
.
controls
.
switches
.
console
invoke
}
proc menu_clear_console {} {.printout.text
delete 0.0 en
d}
proc
menu_clear_console
{}
{.
printout
.
text
configure
-
state
normal
;
.
printout
.
text
delete
0.0
end
;
.
printout
.
text
configure
-
state
disable
d
}
##################
the
"Quit"
menu
command
#########################
proc
menu_really_quit
{}
{
pd
{
pd
quit
;}}
...
...
@@ -1240,17 +1264,17 @@ if {$pd_nt != 2} {
.mbar.edit add separator
# this should apply to .printout.text
.mbar.edit add command -label Cut -accelerator [accel_munge "Ctrl+x"] \
-command {tk_textCut .printout.text
; .mbar.edit entryconfigure "Paste" -state normal
} -state disabled
-command {tk_textCut .printout.text} -state disabled
# this should apply to .printout.text
.mbar.edit add command -label Copy -accelerator [accel_munge "Ctrl+c"] \
-command {tk_textCopy .printout.text;
.mbar.edit entryconfigure "Paste" -state normal
} -state disabled
-command {
global copytexttocanvas;
tk_textCopy .printout.text;
set copytexttocanvas 1; pdtk_canvas_update_paste_menu 1
} -state disabled
.mbar.edit add command -label Paste -accelerator [accel_munge "Ctrl+v"] \
-command {tk_textPaste .printout.text} -state disabled
.mbar.edit add command -label Duplicate -accelerator [accel_munge "Ctrl+d"] \
-state disabled
# this should apply to .printout.text
.mbar.edit add command -label {Select all} -accelerator [accel_munge "Ctrl+a"]\
-command {.printout.text tag add sel 1.0 end}
-command {
pdtk_post selall;
.printout.text tag add sel 1.0 end}
.mbar.edit add command -label {Reselect} \
-accelerator "Ctrl+Enter" -state disabled
.mbar.edit add separator
...
...
@@ -1503,12 +1527,14 @@ proc menu_cut {name} {
}
proc menu_copy {name} {
# pdtk_post menu_copy
global copytexttocanvas
if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} {
pd [concat $name copy \;]
set copytexttocanvas 0
clipboard clear
#
clipboard clear
} else {
# pdtk_post "this_is_text\n"
set copytexttocanvas 1
}
pdtk_canvas_update_paste_menu 1
...
...
@@ -1516,21 +1542,25 @@ proc menu_copy {name} {
proc menu_paste {name} {
global copytexttocanvas
#pdtk_pastetext
#pdtk_post "pasting..."
#
pdtk_pastetext
#
pdtk_post "pasting..."
if {![string match .gfxstub* $name] && ![string match .printout* $name] && ![string match *entry $name]} {
# puts stderr "this is not an entry $copytexttocanvas\n"
if {$copytexttocanvas} {
pdtk_pastetext
} else {
pd [concat $name paste \;]
pdtk_canvas_getscroll $name.c
}
} else {
# puts stderr "pasting text..."
pdtk_pastetext
}
}
bind . <$ctrl_key-Key-x> {menu_cut .printout.text}
bind . <$ctrl_key-Key-c> {
menu_copy .printout.text
}
bind . <$ctrl_key-Key-v> {menu_paste .printout.text}
#
bind . <$ctrl_key-Key-x> {menu_cut .printout.text}
bind . <$ctrl_key-Key-c> {
global copytexttocanvas; tk_textCopy .printout.text; set copytexttocanvas 1; pdtk_canvas_update_paste_menu 1
}
#
bind . <$ctrl_key-Key-v> {menu_paste .printout.text}
proc menu_duplicate {name} {
pd [concat $name duplicate \;]
...
...
@@ -1658,6 +1688,8 @@ proc menu_mycnv {name accel} {
# correct edit menu, enabling or disabling undo/redo/cut/copy/paste
proc menu_fixeditmenu {name} {
# pdtk_post "fixeditmenu $name\n"
global pd_undoaction
global pd_redoaction
global pd_undocanvas
...
...
@@ -2978,6 +3010,8 @@ proc pdtk_canvas_sendkey {name state key iso shift} {
global ctrl_l_down
global ctrl_r_down
# pdtk_post "key = $name $state $key $iso $shift\n"
if {$key == "BackSpace"} {
set iso ""
set key 8
...
...
@@ -3039,8 +3073,20 @@ proc pdtk_canvas_sendkey {name state key iso shift} {
# if so, invoke edit menu option (whcih will work
# only if the actual option is currently enabled)
proc pdtk_canvas_edit_menu_actions {name action} {
# pdtk_post "edit_menu_actions $name $action\n"
global copytexttocanvas
if {[string match .x* $name]} {
$name.m.edit invoke "$action"
} else {
set tmp ""
catch {
set tmp [clipboard get]
}
if { $tmp != "" } {
set copytexttocanvas 1
pdtk_canvas_update_paste_menu 1
}
}
}
...
...
@@ -3052,6 +3098,7 @@ proc pdtk_canvas_ctrlkey {name key shift} {
#
puts
stderr
[
concat
ctrl
-
key
$
key
$
topname
$
name
]
#
puts
stderr
[
string
match
.
controls
*
$
name
]
#.
printout
.
text
.
controls
.*
.
#
pdtk_post
canvas_ctrlkey
if
{$
name
==
"."
||
$
name
==
".printout.text"
||
[
string
match
.
controls
*
$
name
]
||
[
string
match
.
gfxstub
*
$
name
]}
{
set
ignore
1
...
...
@@ -4976,7 +5023,9 @@ proc pdtk_canvas_magicglassval {name value} {
}
proc
pdtk_canvas_update_edit_menu
{
name
value
}
{
global global_selection
global
global_selection
global_clipboard
#
pdtk_post
"update_edit_menu value=$value clipboard=$global_clipboard
\n
"
set
global_selection
$
value
...
...
@@ -4997,15 +5046,21 @@ proc pdtk_canvas_update_edit_menu {name value} {
$
name
.
m
.
edit
entryconfigure
"Bring To Front"
-
state
disabled
$
name
.
m
.
edit
entryconfigure
"Send To Back"
-
state
disabled
$
name
.
m
.
edit
entryconfigure
"Tidy Up"
-
state
disabled
}
}
if
{
!$global_clipboard} {
$
name
.
m
.
edit
entryconfigure
"Paste"
-
state
disabled
}
else
{
$
name
.
m
.
edit
entryconfigure
"Paste"
-
state
normal
}
}
proc
pdtk_canvas_update_paste_menu
{
value
}
{
#
pdtk_post
"paste_menu $value
\n
"
global
global_clipboard
global menu_windowlist
#
global
menu_windowlist
set global_clipboard $value
set
global_clipboard
$
value
}
############
pdtk_text_new
--
create
a
new
text
object
#
2
###########
...
...
Write
Preview
Supports
Markdown
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