@@ -729,11 +729,17 @@ static void pdlua_reload(t_gobj* z)
729
729
730
730
static void pdlua_displace (t_gobj * z , t_glist * glist , int dx , int dy ){
731
731
t_pdlua * x = (t_pdlua * )z ;
732
- x -> pd .te_xpix += dx , x -> pd .te_ypix += dy ;
733
- dx *= glist_getzoom (glist ), dy *= glist_getzoom (glist );
734
732
735
733
#if !PLUGDATA
736
- gfx_displace (z , glist , dx , dy );
734
+ if (x -> has_gui )
735
+ {
736
+ x -> pd .te_xpix += dx , x -> pd .te_ypix += dy ;
737
+ dx *= glist_getzoom (glist ), dy *= glist_getzoom (glist );
738
+ gfx_displace (z , glist , dx , dy );
739
+ }
740
+ else {
741
+ text_widgetbehavior .w_displacefn (z , glist , dx , dy );
742
+ }
737
743
#endif
738
744
739
745
canvas_fixlinesfor (glist , (t_text * )x );
@@ -855,33 +861,25 @@ static void pdlua_menu_open(t_pdlua *o)
855
861
PDLUA_DEBUG3 ("pdlua_menu_open: L is %p, name is %s stack top is %d" , __L (), name , lua_gettop (__L ()));
856
862
if (name )
857
863
{
858
- if (name [strlen (name )- 1 ] == 'x' )
864
+ lua_getglobal (__L (), "pd" );
865
+ lua_getfield (__L (), -1 , "_get_class" );
866
+ lua_pushlightuserdata (__L (), o );
867
+ if (lua_pcall (__L (), 1 , 1 , 0 ))
859
868
{
860
- /* pdluax is a class, the particular file should loadable by name alone, we hope */
861
- sprintf ( pathname , "%s " , name );
862
- lua_pop ( __L (), 2 ); /* pop name and the global "pd" */
869
+ pd_error ( NULL , "lua: error in get_class:\n%s" , lua_tostring ( __L (), -1 ));
870
+ lua_pop ( __L (), 4 ); /* pop the error string, global "pd ", name, global "pd"*/
871
+ return ;
863
872
}
864
- else
865
- {
866
- lua_getglobal (__L (), "pd" );
867
- lua_getfield (__L (), -1 , "_get_class" );
868
- lua_pushlightuserdata (__L (), o );
869
- if (lua_pcall (__L (), 1 , 1 , 0 ))
870
- {
871
- pd_error (NULL , "lua: error in get_class:\n%s" , lua_tostring (__L (), -1 ));
872
- lua_pop (__L (), 4 ); /* pop the error string, global "pd", name, global "pd"*/
873
- return ;
874
- }
875
- class = (t_class * )lua_touserdata (__L (), -1 );
873
+ class = (t_class * )lua_touserdata (__L (), -1 );
876
874
#if PLUGDATA
877
- if (!* class -> c_externdir -> s_name )
878
- path = plugdata_datadir ;
879
- else
875
+ if (!* class -> c_externdir -> s_name )
876
+ path = plugdata_datadir ;
877
+ else
880
878
#endif
881
- path = class -> c_externdir -> s_name ;
882
- sprintf (pathname , "%s/%s" , path , name );
883
- lua_pop (__L (), 4 ); /* pop class, global "pd", name, global "pd"*/
884
- }
879
+ path = class -> c_externdir -> s_name ;
880
+ sprintf (pathname , "%s/%s" , path , name );
881
+ lua_pop (__L (), 4 ); /* pop class, global "pd", name, global "pd"*/
882
+
885
883
#if PD_MAJOR_VERSION == 0 && PD_MINOR_VERSION < 43
886
884
post ("Opening %s for editing" , pathname );
887
885
#else
0 commit comments