From 71cad3e06e2f2b4818aeabf4668d1ad49875c6aa Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 10 Dec 2015 21:30:01 -0500
Subject: [PATCH] =?UTF-8?q?port=20from=20Pd-l2ork:=207066e0d3495b16491b642?=
 =?UTF-8?q?373dfd030e916bfe309=20=20*added=20legacy=20option=20for=20iemgu?=
 =?UTF-8?q?i=20objects.=20Starting=20pd-l2ork=20with=20-lega=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

…cy flag positions iemgui objects in their old, vertically inconsistent locations for the sake of retaining complete backwards compatibility.

*added sys_legacy global for inclusion of other potential legacy breakages that may develop later.
---
 pd/src/g_all_guis.c | 65 +++++++++++++++++++++++++++++++++++++--------
 pd/src/g_all_guis.h |  5 ++++
 pd/src/g_bang.c     |  6 +++++
 pd/src/g_editor.c   | 22 +++++++++++++--
 pd/src/g_graph.c    | 24 +++++++++++------
 pd/src/g_mycanvas.c |  3 +++
 pd/src/g_numbox.c   |  3 +++
 pd/src/g_radio.c    |  5 +++-
 pd/src/g_slider.c   | 10 +++++++
 pd/src/g_toggle.c   |  6 +++++
 pd/src/g_vumeter.c  |  3 +++
 pd/src/s_main.c     |  9 +++++++
 12 files changed, 139 insertions(+), 22 deletions(-)

diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c
index c738cd29c..4bfce9659 100644
--- a/pd/src/g_all_guis.c
+++ b/pd/src/g_all_guis.c
@@ -30,6 +30,14 @@ int iemgui_clip_size(int size) {return maxi(size,IEM_GUI_MINSIZE);}
 int iemgui_clip_font(int size) {return maxi(size,IEM_FONT_MINSIZE);}
 static void scalehandle_check_and_redraw(t_iemgui *x);
 
+/* helper function to negate legacy draw offset for labels
+*/
+void iemgui_getrect_legacy_label(t_iemgui *x, int *xp1, int *yp1)
+{
+    *xp1 -= x->legacy_x;
+    *yp1 -= x->legacy_y;
+}
+
 static int iemgui_modulo_color(int col)
 {
     const int IEM_GUI_MAX_COLOR = 30;
@@ -247,6 +255,10 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
     x->x_ldy = atom_getintarg(1, ac, av);
     if(glist_isvisible(x->x_glist))
     {
+        int x1 = x->x_ldx;
+        int y1 = x->x_ldy;
+        //iemgui_getrect_legacy_label(x, &x1, &y1);
+
         //sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
         //    glist_getcanvas(x->x_glist), x,
         //    text_xpix((t_object *)x,x->x_glist)+x->x_ldx,
@@ -254,8 +266,8 @@ void iemgui_label_pos(t_iemgui *x, t_symbol *s, int ac, t_atom *av)
         gui_vmess("gui_iemgui_label_coords", "xxii",
             glist_getcanvas(x->x_glist),
             x,
-            x->x_ldx,
-            x->x_ldy);
+            x1,
+            y1);
         iemgui_shouldvis(x, IEM_GUI_DRAW_MODE_CONFIG);
     }
 }
@@ -730,9 +742,21 @@ void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
             sprintf(tags,"x%lx %lx%s iemgui selected", (long)x,
                 (long)x,pd_class((t_pd *)x)==canvas_class?"MOVE":"LABELH");
         }
+        int xpos = 0, ypos = 0;
+        if (pd_class((t_pd *)x) == canvas_class)
+        {
+            xpos = x->te_xpix;
+            ypos = x->te_ypix;
+        }
+        else
+        {
+            t_iemgui *y = (t_iemgui *)(h->h_master);
+            xpos = text_xpix(&y->x_obj, y->x_glist);
+            ypos = text_ypix(&y->x_obj, y->x_glist);
+        }
         sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d "
             "-window %s -tags {%s}\n", canvas,
-            x->te_xpix+px-sx, x->te_ypix+py-sy, sx, sy,
+            xpos+px-sx, ypos+py-sy, sx, sy,
             h->h_pathname, tags);
         scalehandle_bind(h);
         h->h_vis = 1;
@@ -750,12 +774,16 @@ void scalehandle_draw_select2(t_iemgui *x) {
     t_canvas *canvas=glist_getcanvas(x->x_glist);
     t_class *c = pd_class((t_pd *)x);
     int sx,sy;
-    if (c==my_canvas_class) {
+    if (c==my_canvas_class)
+    {
         t_my_canvas *y = (t_my_canvas *)x;
         sx=y->x_vis_w; sy=y->x_vis_h;
-    } else {
+    }
+    else
+    {
         int x1,y1,x2,y2;
         c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
+        //iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
         sx=x2-x1; sy=y2-y1;
     }
     scalehandle_draw_select(x->x_handle,sx-1,sy-1);
@@ -834,6 +862,7 @@ void scalehandle_dragon_label(t_scalehandle *h, float f1, float f2) {
         {
             int xpos=text_xpix(&x->x_obj, x->x_glist);
             int ypos=text_ypix(&x->x_obj, x->x_glist);
+            //iemgui_getrect_legacy_label(x, &xpos, &ypos);
             t_canvas *canvas=glist_getcanvas(x->x_glist);
             sys_vgui(".x%lx.c coords %lxLABEL %d %d\n", canvas, x,
                 xpos+x->x_ldx + h->h_dragx,
@@ -876,6 +905,9 @@ void scalehandle_getrect_master(t_scalehandle *h, int *x1, int *y1, int *x2, int
     t_iemgui *x = (t_iemgui *)h->h_master;
     t_class *c = pd_class((t_pd *)x);
     c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,x1,y1,x2,y2);
+    //fprintf(stderr,"%d %d %d %d\n",*x1,*y1,*x2,*y2);
+    //iemgui_getrect_draw((t_iemgui *)x, x1, y1, x2, y2);
+    //fprintf(stderr,"%d %d %d %d\n",*x1,*y1,*x2,*y2);
     //printf("%s\n",c->c_name->s_name);
     if (c==my_canvas_class) {
         t_my_canvas *xx = (t_my_canvas *)x;
@@ -973,8 +1005,9 @@ void iemgui_tag_selected(t_iemgui *x) {
 void iemgui_label_draw_new(t_iemgui *x) {
     char col[8];
     t_canvas *canvas=glist_getcanvas(x->x_glist);
-    int x1=text_xpix(&x->x_obj, x->x_glist);
-    int y1=text_ypix(&x->x_obj, x->x_glist);
+    int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x;
+    int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y;
+    iemgui_getrect_legacy_label(x, &x1, &y1);
     //sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w "
     //         "-font %s -fill #%6.6x -tags {%lxLABEL x%lx text iemgui}\n",
     //     canvas, x1+x->x_ldx, y1+x->x_ldy,
@@ -995,15 +1028,20 @@ void iemgui_label_draw_new(t_iemgui *x) {
 
 void iemgui_label_draw_move(t_iemgui *x) {
     t_canvas *canvas=glist_getcanvas(x->x_glist);
-    int x1=text_xpix(&x->x_obj, x->x_glist);
-    int y1=text_ypix(&x->x_obj, x->x_glist);
+    int x1=text_xpix(&x->x_obj, x->x_glist)+x->legacy_x;
+    int y1=text_ypix(&x->x_obj, x->x_glist)+x->legacy_y;
+    //iemgui_getrect_legacy_label(x, &x1, &y1);
     //sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
     //    canvas, x, x1+x->x_ldx, y1+x->x_ldy);
+
+    /* Note-- since we're not using x1/y1 above in the new GUI call,
+       Ivica's legacy logic isn't affecting us. Quick fix below by
+       just adding the legacy offsets... */
     gui_vmess("gui_iemgui_label_coords", "xxii",
         glist_getcanvas(x->x_glist),
         x,
-        x->x_ldx,
-        x->x_ldy);
+        x->x_ldx + x->legacy_x,
+        x->x_ldy + x->legacy_y);
 }
 
 void iemgui_label_draw_config(t_iemgui *x) {
@@ -1103,6 +1141,7 @@ void iemgui_draw_io(t_iemgui *x, int old_sr_flags)
 
     int x1,y1,x2,y2;
     c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
+    //iemgui_getrect_draw(x, &x1, &y1, &x2, &y2); 
 
     int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH;
     /* cnv has no inlets */
@@ -1172,6 +1211,8 @@ void iemgui_io_draw_move(t_iemgui *x) {
     t_class *c = pd_class((t_pd *)x);
     int x1,y1,x2,y2;
     c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
+    //iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
+
     int i, n = c==vu_class ? 2 : 1, k=(x2-x1)-IOWIDTH;
     /* cnv has no xlets */
     if (c == my_canvas_class)
@@ -1212,6 +1253,7 @@ void iemgui_base_draw_new(t_iemgui *x) {
     t_class *c = pd_class((t_pd *)x);
     int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
     c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
+    //iemgui_getrect_draw(x, &x1, &y1, &x2, &y2); 
     gop_redraw=gr;
     //sys_vgui(".x%lx.c create prect %d %d %d %d "
     //         "-stroke $pd_colors(iemgui_border) -fill #%6.6x "
@@ -1236,6 +1278,7 @@ void iemgui_base_draw_move(t_iemgui *x) {
     t_class *c = pd_class((t_pd *)x);
     int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
     c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
+    //iemgui_getrect_draw(x, &x1, &y1, &x2, &y2);
     gop_redraw=gr;
     //sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, x1, y1, x2, y2);
     gui_vmess("gui_iemgui_move_and_resize", "xxiiii",
diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h
index 3a065e21f..b5f822826 100644
--- a/pd/src/g_all_guis.h
+++ b/pd/src/g_all_guis.h
@@ -97,6 +97,10 @@ typedef struct _iemgui
     unsigned int x_locked:1;      //  7 matches ([bng] only)
     unsigned int x_reverse:1;     //  4 matches (sliders only)
     unsigned int dummy:20;
+    int legacy_x;                 // legacy x offset
+    int legacy_y;                 // legacy y offset
+    //int click_x;                  // click getrect x offset
+    //int click_y;                  // click getrect y offset
 } t_iemgui;
 
 typedef struct _bng
@@ -282,3 +286,4 @@ EXTERN void iemgui_out_bang(t_iemgui *x, int o, int chk_putin);
 EXTERN void iemgui_out_float(t_iemgui *x, int o, int chk_putin, t_float f);
 EXTERN void iemgui_out_list(t_iemgui *x, int o, int chk_putin, t_symbol *s, int argc, t_atom *argv);
 
+EXTERN int sys_legacy; // found in s_main.c, used for legacy iemgui positioning 
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index e9de2c5f7..0f13be915 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -478,6 +478,12 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
     x->x_gui.x_changed = -1;
 
+    x->x_gui.legacy_x = 0;
+    x->x_gui.legacy_y = 2;
+
+    //x->x_gui.click_x = 1;
+    //x->x_gui.click_y = 2;
+
     return (x);
 }
 
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 763ff50c4..f33f3e0fb 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -82,6 +82,9 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
 extern void glob_preset_node_list_check_loc_and_update(void);
 // for preset_node
 extern t_class *text_class;
+// for iemgui objects' wonky click area
+//extern void iemgui_getrect_mouse(t_gobj *x, int *xp1, int *yp1,
+//    int *xp2, int *yp2);
 
 int do_not_redraw = 0;     // used to optimize redrawing
 int old_displace = 0;      // for legacy displaces within gop that are not
@@ -2262,6 +2265,9 @@ int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos,
     if (!gobj_shouldvis(y, x))
         return (0);
     gobj_getrect(y, x, &x1, &y1, &x2, &y2);
+    //if (((t_text *)y)->te_iemgui)
+    //    iemgui_getrect_mouse(y, &x1, &y1, &x2, &y2);
+   
     // we also add a check that width is greater than 0 because we use this
     // to return value from objects that are designed to ignore clicks and
     // pass them below, e.g. pd-l2ork's version of ggee/image which uses this
@@ -3266,7 +3272,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
             t_selection *sel;
             for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
             {
-                if (sel && ((t_text *)sel->sel_what)->te_iemgui)
+                if (sel && ((t_text *)sel->sel_what)->te_iemgui == 1)
                 {
                     // iemgui exception to hide all handles that may interfere
                     // with the mouse cursor and its ability to move/deselect
@@ -4000,7 +4006,17 @@ int canvas_doconnect_doit(t_canvas *x, t_gobj *y1, t_gobj *y2,
     noutlet1 = obj_noutlets(ob1);
     ninlet2 = obj_ninlets(ob2);
     gobj_getrect(y1, x, &x11, &y11, &x12, &y12);
+    /*if (ob1->te_iemgui)
+    {
+        //fprintf(stderr,"1 is iemgui\n");
+        iemgui_getrect_draw((t_iemgui *)ob1, &x11, &y11, &x12, &y12);
+    }*/
     gobj_getrect(y2, x, &x21, &y21, &x22, &y22);
+    /*if (ob2->te_iemgui)
+    {
+        //fprintf(stderr,"2 is iemgui\n");
+        iemgui_getrect_draw((t_iemgui *)ob2, &x21, &y21, &x22, &y22);
+    }*/
 
     if (canvas_isconnected (x, ob1, closest1, ob2, closest2))
     {
@@ -4698,6 +4714,8 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy)
     {
         int x1, y1, x2, y2;
         gobj_getrect(y, x, &x1, &y1, &x2, &y2);
+        //if (((t_text *)y)->te_iemgui)
+        //    iemgui_getrect_mouse(y, &x1, &y1, &x2, &y2);
         if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2)
         {
             if (!selection_changed)
@@ -5409,7 +5427,7 @@ void canvas_startmotion(t_canvas *x)
     t_selection *sel;
     for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
     {
-        if (sel && ((t_text *)sel->sel_what)->te_iemgui)
+        if (sel && ((t_text *)sel->sel_what)->te_iemgui == 1)
         {
             // iemgui exception to hide all handles that may interfere
             // with the mouse cursor and its ability to move/deselect
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index a58466af4..6e203692b 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -780,26 +780,34 @@ t_float glist_dpixtody(t_glist *x, t_float dypix)
     proportional-style GOP.  In this case we do a coordinate transformation. */
 int text_xpix(t_text *x, t_glist *glist)
 {
+    int xpix = 0; 
     if (glist->gl_havewindow || !glist->gl_isgraph)
-        return (x->te_xpix);
+        xpix = x->te_xpix; 
     else if (glist->gl_goprect)
-        return (glist_xtopixels(glist, glist->gl_x1) +
-            x->te_xpix - glist->gl_xmargin);
-    else return (glist_xtopixels(glist, 
+        xpix = glist_xtopixels(glist, glist->gl_x1) +
+            x->te_xpix - glist->gl_xmargin;
+    else xpix = (glist_xtopixels(glist, 
             glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * 
                 x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)));
+    if (x->te_iemgui == 1)
+        xpix += ((t_iemgui *)x)->legacy_x*sys_legacy;
+    return(xpix);
 }
 
 int text_ypix(t_text *x, t_glist *glist)
 {
+    int ypix = 0; 
     if (glist->gl_havewindow || !glist->gl_isgraph)
-        return (x->te_ypix);
+        ypix = x->te_ypix; 
     else if (glist->gl_goprect)
-        return (glist_ytopixels(glist, glist->gl_y1) +
-            x->te_ypix - glist->gl_ymargin);
-    else return (glist_ytopixels(glist, 
+        ypix = glist_ytopixels(glist, glist->gl_y1) +
+            x->te_ypix - glist->gl_ymargin;
+    else ypix = (glist_ytopixels(glist, 
             glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * 
                 x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)));
+    if (x->te_iemgui == 1)
+        ypix += ((t_iemgui *)x)->legacy_y*sys_legacy;
+    return(ypix);
 }
 
 extern void canvas_updateconnection(t_canvas *x, int lx1, int ly1, int lx2, int ly2, t_int tag);
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 45610546f..e8278a3a2 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -384,6 +384,9 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,my_canvas__clickhook,my_canvas__motionhook);
     x->x_gui.x_obj.te_iemgui = 1;
 
+    x->x_gui.legacy_x = 0;
+    x->x_gui.legacy_y = 2;
+
     return (x);
 }
 
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 630eca2c7..197af3980 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -837,6 +837,9 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
     x->x_gui.x_changed = 0;
 
+    x->x_gui.legacy_x = 0;
+    x->x_gui.legacy_y = 2;
+
     return (x);
 }
 
diff --git a/pd/src/g_radio.c b/pd/src/g_radio.c
index 9b69bc981..6f0bd6f16 100644
--- a/pd/src/g_radio.c
+++ b/pd/src/g_radio.c
@@ -429,7 +429,7 @@ static void radio_click(t_radio *x, t_floatarg xpos, t_floatarg ypos,
         int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
         radio_fout(x, (t_float)(yy / x->x_gui.x_h));
     } else {
-        int xx = (int)xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
+        int xx = (int)xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)-1; 
         radio_fout(x, (t_float)(xx / x->x_gui.x_w));
     }
 }
@@ -533,6 +533,9 @@ static void *radio_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,radio__clickhook,radio__motionhook);
     x->x_gui.x_obj.te_iemgui = 1;
 
+    x->x_gui.legacy_x = 0;
+    x->x_gui.legacy_y = 2;   
+
     return (x);
 }
 
diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c
index 21378a63f..75045a03b 100644
--- a/pd/src/g_slider.c
+++ b/pd/src/g_slider.c
@@ -595,6 +595,16 @@ static void *slider_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
     x->x_gui.x_changed = 0;
 
+    if (x->x_orient)
+    {
+        x->x_gui.legacy_x = 0;
+        x->x_gui.legacy_y = 0;
+    } else {
+        x->x_gui.legacy_x = -3;
+        x->x_gui.legacy_y = 2;        
+    }
+
+
     return (x);
 }
 
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index db04c3c80..c81db5214 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -396,6 +396,12 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_obj.te_iemgui = 1;
     x->x_gui.x_changed = 1;
 
+    x->x_gui.legacy_x = 0;
+    x->x_gui.legacy_y = 2;
+
+    //x->x_gui.click_x = 1;
+    //x->x_gui.click_y = 2;
+
     return (x);
 }
 
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index e9d9f4aa6..5c434f91a 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -747,6 +747,9 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
     x->x_gui.x_lhandle = scalehandle_new((t_object *)x,x->x_gui.x_glist,0,vu__clickhook,vu__motionhook);
     x->x_gui.x_obj.te_iemgui = 1;
 
+    x->x_gui.legacy_x = -1;
+    x->x_gui.legacy_y = 0;
+
     return (x);
 }
 
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 108352f66..1b36ac2dd 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -52,6 +52,8 @@ int sys_console = 0;    /* default settings for the console is off */
 int sys_k12_mode = 0;   /* by default k12 mode is off */
 int sys_unique = 0;     /* by default off, prevents multiple instances
                            of pd-l2ork */
+int sys_legacy = 0;     /* by default off, used to enable legacy features,
+                           such as offsets in iemgui object positioning */
 
 #ifdef QTGUI
 int sys_qtcanvas = 0; /* enable Qt */
@@ -460,6 +462,7 @@ static char *(usagemessage[]) = {
 "-autopatch       -- enable auto-patching new from selected objects\n",
 "-k12             -- enable K-12 education mode (requires L2Ork K12 lib)\n",
 "-unique          -- enable multiple instances (disabled by default)\n",
+"-legacy          -- enable legacy features (disabled by default)\n", 
 "\n",
 };
 
@@ -874,6 +877,12 @@ int sys_argparse(int argc, char **argv)
             argc -= 1;
             argv += 1;
         }
+        else if (!strcmp(*argv, "-legacy"))
+        {
+            sys_legacy = 1;
+            argc -= 1;
+            argv += 1;
+        }
         else if (!strcmp(*argv, "-guiport") && argc > 1 &&
             sscanf(argv[1], "%d", &sys_guisetportnumber) >= 1)
         {
-- 
GitLab