Commit c796239a authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

add missing canvas_raise_all_cords and cut down a few more sys_vgui

parent 86f10aa3
......@@ -36,6 +36,9 @@ glist has its own window, even if miniaturized.
/* NOTE: this file describes Pd implementation details which may change
in future releases. The public (stable) API is in m_pd.h. */
#ifndef PD_G_CANVAS_H
#define PD_G_CANVAS_H
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
extern "C" {
#endif
......@@ -492,24 +495,23 @@ EXTERN int text_ypix(t_text *x, t_glist *glist);
#define RTEXT_DBL 3
#define RTEXT_SHIFT 4
EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who);
EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who);
EXTERN void rtext_draw(t_rtext *x);
EXTERN void rtext_erase(t_rtext *x);
EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x);
EXTERN int rtext_height(t_rtext *x);
EXTERN void rtext_displace(t_rtext *x, int dx, int dy);
EXTERN void rtext_select(t_rtext *x, int state);
EXTERN void rtext_activate(t_rtext *x, int state);
EXTERN void rtext_free(t_rtext *x);
EXTERN void rtext_key(t_rtext *x, int n, t_symbol *s);
EXTERN void rtext_mouse(t_rtext *x, int xval, int yval, int flag);
EXTERN void rtext_retext(t_rtext *x);
EXTERN int rtext_width(t_rtext *x);
EXTERN int rtext_height(t_rtext *x);
EXTERN char *rtext_gettag(t_rtext *x);
EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize);
EXTERN void rtext_getseltext(t_rtext *x, char **buf, int *bufsize);
// number in comment is the number in grep -w|wc
EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who); //5
EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who); //53
EXTERN void rtext_draw(t_rtext *x); //4
EXTERN void rtext_erase(t_rtext *x); //4
EXTERN int rtext_width(t_rtext *x); //9
EXTERN int rtext_height(t_rtext *x); //9
EXTERN void rtext_displace(t_rtext *x, int dx, int dy); //3
EXTERN void rtext_select(t_rtext *x, int state); //4
EXTERN void rtext_activate(t_rtext *x, int state); //3
EXTERN void rtext_free(t_rtext *x); //4
EXTERN void rtext_key(t_rtext *x, int n, t_symbol *s); //6
EXTERN void rtext_mouse(t_rtext *x, int xval, int yval, int flag); //5
EXTERN void rtext_retext(t_rtext *x); //5
EXTERN char *rtext_gettag(t_rtext *x); //47
EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize); //9
EXTERN void rtext_getseltext(t_rtext *x, char **buf, int *bufsize); //4
/* -------------------- functions on canvases ------------------------ */
EXTERN t_class *canvas_class;
......@@ -768,8 +770,14 @@ EXTERN void *canvas_undo_set_font(t_canvas *x, int font);
void *qt_thread_main (void *);
/* ---------- other things added by Mathieu (aug.2014) ----------------- */
void canvas_raise_all_cords (t_canvas *x);
/* --------------------------------------------------------------------- */
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
}
#endif
#endif // PD_G_CANVAS_H
......@@ -186,7 +186,7 @@ int gobj_shouldvis(t_gobj *x, struct _glist *glist)
return (0);
}
if (glist==glist_getcanvas(glist))
sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
canvas_raise_all_cords(glist);
}
if (ob = pd_checkobject(&x->g_pd))
{
......@@ -288,39 +288,20 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
{
/* we get here if we are supposed to go all the way
to the bottom */
if (objtag)
{
sys_vgui(".x%lx.c addtag arrange withtag %s\n",
x, objtag);
}
else
{
sys_vgui(".x%lx.c addtag arrange withtag selected\n",
x);
}
sys_vgui(".x%lx.c addtag arrange withtag %s\n",
x, objtag ? objtag : "selected");
sys_vgui(".x%lx.c lower arrange\n", x);
if (objtag)
sys_vgui(".x%lx.c dtag %s arrange\n", x, objtag);
else
sys_vgui(".x%lx.c dtag selected arrange\n", x);
sys_vgui(".x%lx.c dtag %s arrange\n",
x, objtag ? objtag : "selected");
}
else if (yrnxt)
{
/* lower into middle */
if (objtag)
{
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s %s\n",
x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag);
}
else
{
sys_vgui(".x%lx.c addtag arrange withtag selected\n",
x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s 0\n",
x, rtext_gettag(yrnxt), rtext_gettag(yr));
}
if (!objtag)
sys_vgui(".x%lx.c addtag arrange withtag selected\n",x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt),
rtext_gettag(yr), objtag ? objtag : "0");
}
else
{
......@@ -335,41 +316,22 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
if (yrnxt)
{
/* raise into middle */
if (objtag)
{
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s %s\n",
x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag);
}
else
{
sys_vgui(".x%lx.c addtag arrange withtag selected\n",
x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s 0\n",
x, rtext_gettag(yrnxt), rtext_gettag(yr));
}
if (!objtag)
sys_vgui(".x%lx.c addtag arrange withtag selected\n",x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange "
".x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt),
rtext_gettag(yr), objtag ? objtag : "0");
}
else if (y->g_next == NULL)
{
/* we get here if we are supposed to go all the way
to the top */
if (objtag)
{
sys_vgui(".x%lx.c addtag arrange withtag %s\n",
x, objtag);
}
else
{
sys_vgui(".x%lx.c addtag arrange withtag selected\n",
x);
}
sys_vgui(".x%lx.c addtag arrange withtag %s\n",
x, objtag ? objtag : "selected");
sys_vgui(".x%lx.c raise arrange\n", x);
if (objtag)
sys_vgui(".x%lx.c dtag %s arrange\n", x, objtag);
else
sys_vgui(".x%lx.c dtag selected arrange\n", x);
sys_vgui(".x%lx.c raise all_cords\n", x);
sys_vgui(".x%lx.c dtag %s arrange\n", x,
objtag ? objtag : "selected");
canvas_raise_all_cords(x);
}
else
{
......@@ -397,7 +359,7 @@ void canvas_check_nlet_highlights(t_glist *x)
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
//if (x->gl_editor->e_onmotion == MA_CONNECT) {
......@@ -418,7 +380,7 @@ void canvas_check_nlet_highlights(t_glist *x)
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_outlet_tag[0] = 0;
//if (x->gl_editor->e_onmotion == MA_CONNECT) {
......@@ -2807,7 +2769,7 @@ static void canvas_doarrange(t_canvas *x, t_float which, t_gobj *oldy,
// and finally redraw
//fprintf(stderr,"raise\n");
sys_vgui(".x%lx.c raise selected\n", x);
sys_vgui(".x%lx.c raise all_cords\n", x);
canvas_raise_all_cords(x);
}
if (which == 4) /* to back */
{
......@@ -3032,7 +2994,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
// read key and mouse button states
......@@ -3076,7 +3038,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (x->gl_editor->e_onmotion == MA_MOVE)
{
//fprintf(stderr,"letting go of objects\n");
sys_vgui(".x%lx.c raise all_cords\n", x);
canvas_raise_all_cords(x);
scrollbar_update(x);
}
if (x->gl_editor->e_onmotion != MA_SCROLL)
......@@ -3455,7 +3417,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
}
......@@ -3476,7 +3438,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_outlet_tag[0] = 0;
}
......@@ -3493,8 +3455,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
{
t_rtext *yr = glist_findrtext(x, (t_text *)&ob->ob_g);
objtooltip = 1;
sys_vgui("pdtk_canvas_enteritem "
".x%x.c %d %d %s -1;\n",
sys_vgui("pdtk_canvas_enteritem .x%x.c %d %d %s -1\n",
x, xpos, ypos, rtext_gettag(yr));
}
}
......@@ -3585,7 +3546,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
}
......@@ -3605,7 +3566,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_outlet_tag[0] = 0;
}
......@@ -3630,7 +3591,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
}
......@@ -3650,7 +3611,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_outlet_tag[0] = 0;
}
......@@ -3972,7 +3933,7 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
}
......@@ -3991,7 +3952,7 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_outlet_tag[0] = 0;
}
......@@ -4564,7 +4525,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
if (tooltips)
{
objtooltip = 1;
sys_vgui("pdtk_canvas_enteritem .x%x.c %d %d %s -1;\n",
sys_vgui("pdtk_canvas_enteritem .x%x.c %d %d %s -1\n",
x, xpos, ypos, x->gl_editor->canvas_cnct_inlet_tag);
}
}
......@@ -4590,7 +4551,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
x->gl_editor->canvas_cnct_inlet_tag[0] = 0;
}
......@@ -4826,7 +4787,7 @@ void canvas_mousedown_middle(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
// read key and mouse button states
......@@ -4938,7 +4899,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
if (ac < 5)
......@@ -5317,8 +5278,8 @@ extern int sys_perf;
void canvas_print(t_canvas *x, t_symbol *s)
{
if (*s->s_name) sys_vgui(".x%lx.c postscript -file %s\n", x, s->s_name);
else sys_vgui(".x%lx.c postscript -file x.ps\n", x);
sys_vgui(".x%lx.c postscript -file %s\n", x,
*s->s_name ? s->s_name : "x.ps");
}
/* find a dirty sub-glist, if any, of this one (including itself) */
......@@ -5615,7 +5576,7 @@ static void canvas_find_parent(t_canvas *x)
canvas_vis(owner, 1);
}
else {
sys_gui("menu_raise_console;\n");
sys_gui("menu_raise_console\n");
}
}
......@@ -6581,7 +6542,13 @@ bad:
(sink? class_getname(pd_class(&sink->g_pd)) : "???"));
}
/* new implementation works in such a way that it first tries to line up all objects in the same line depending on the minimal distance between values (e.g. if objects' y values are closer than x values the alignment will happen vertically and vice-versa). If the objects already exhibit 0 difference across one axis, it will pick the top/left-most two objects and use them as a reference for spatialization between the remaining selected objects. any further tidy calls will be ignored */
/* new implementation works in such a way that it first tries to line up all
* objects in the same line depending on the minimal distance between values
* (e.g. if objects' y values are closer than x values the alignment will
* happen vertically and vice-versa). If the objects already exhibit 0
* difference across one axis, it will pick the top/left-most two objects and
* use them as a reference for spatialization between the remaining selected
* objects. any further tidy calls will be ignored */
// struct for storing spatially aware list of selected gobjects
typedef struct _sgobj
......@@ -7374,7 +7341,7 @@ void canvas_tooltips(t_canvas *x, t_floatarg fyesplease)
if (objtooltip)
{
objtooltip = 0;
sys_vgui("pdtk_canvas_leaveitem .x%x.c;\n", x);
sys_vgui("pdtk_canvas_leaveitem .x%x.c\n", x);
}
}
sys_vgui("pdtk_canvas_tooltips .x%lx %d\n",
......@@ -7535,6 +7502,10 @@ static void canvas_tip(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
}
}
void canvas_raise_all_cords (t_canvas *x) {
sys_vgui(".x%lx.c raise all_cords\n", x);
}
void g_editor_setup(void)
{
/* ------------------------ events ---------------------------------- */
......
......@@ -10,7 +10,6 @@
#include "m_pd.h"
#include "m_imp.h"
#include "s_stuff.h"
#include "t_tk.h"
#include "g_canvas.h"
#include <stdio.h>
#include <string.h>
......@@ -2075,7 +2074,7 @@ void text_drawborder(t_text *x, t_glist *glist,
}
/* raise cords over everything else */
if (firsttime && glist==glist_getcanvas(glist))
sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
canvas_raise_all_cords(glist);
//ico@bukvic.net 100518 update scrollbars when GOP
//potentially exceeds window size
......@@ -2170,7 +2169,7 @@ void text_drawborder_withtag(t_text *x, t_glist *glist,
}
/* raise cords over everything else */
if (firsttime && glist==glist_getcanvas(glist))
sys_vgui(".x%lx.c raise all_cords\n", glist_getcanvas(glist));
canvas_raise_all_cords(glist);
//ico@bukvic.net 100518 update scrollbars when GOP
//potentially exceeds window size
......
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