Commit 37173fd7 authored by Claes Sjofors's avatar Claes Sjofors

Ge commands move, scale and rotate for selected object added, and move with absolute coordinates

parent 3c7a9b89
......@@ -3496,6 +3496,7 @@ create <link>gecmd_create
group <link>gecmd_group
move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject
<t>move selectedobject <link>gecmd_move_selectedobject
new <link>gecmd_new
select <link>gecmd_select
<t>select currentobject <link>gecmd_select_currentobject
......@@ -3533,14 +3534,16 @@ set <link>gecmd_set
<t>set graphattributes <link>gecmd_set_graphattributes
rotate <link>gecmd_rotate
<t>rotate currentobject <link>gecmd_rotate_current
<t>rotate selectedobject <link>gecmd_rotate_selected
scale <link>gecmd_scale
<t>scale currentobject <link>gecmd_scale_current
<t>scale selectedobject <link>gecmd_scale_selected
save <link>gecmd_save
exit <link>gecmd_exit
quit <link>gecmd_quit
open <link>gecmd_open
show <link>gecmd_show
<t>scale version <link>gecmd_show_version
<t>show version <link>gecmd_show_version
</topic>
<headerlevel>
......@@ -3686,14 +3689,37 @@ move
<topic>gecmd_move_currentobject
move currentobject
Move the current object.
Move the current object. The movement can be specified with relative coordinates
(x and y) or absolute coordinates (absx and absy) or combinations.
<b>Syntax
<c>ge> move currentobject /x= /y=
<c>ge> move currentobject /absx= /absy=
/x <t>Relative movement in x direction.
/y <t>Relative movement in y direction.
/absx <t>Movement to absolute coordinate in x direction.
/absy <t>Movement to absolute coordinate in y direction.
</topic>
<topic>gecmd_move_selectedobject
move selectedobject
Move the selected object. The movement can be specified with relative coordinates
(x and y) or absolute coordinates (absx and absy) or combinations.
Only one object can be selected.
<b>Syntax
<c>ge> move selectedobject /x= /y=
<c>ge> move selectedobject /absx= /absy=
/x <t>Relative movement in x direction.
/y <t>Relative movement in y direction.
/absx <t>Movement to absolute coordinate in x direction.
/absy <t>Movement to absolute coordinate in y direction.
</topic>
<topic>gecmd_new <style>function
......@@ -4096,6 +4122,18 @@ Rotates the current object around the center of the object.
/angle <t>Angle in degrees that the object is rotated.
</topic>
<topic>gecmd_rotate_selected
rotate selectedobject
Rotates the selected object around the center of the object.
<b>Syntax
<c>ge> rotate selectedobject /angle=
/angle <t>Angle in degrees that the object is rotated.
</topic>
<topic>gecmd_scale
scale
</topic>
......@@ -4115,6 +4153,21 @@ Scale the current object.
/y <t>y coordinate for the reference point of the scaling.
</topic>
<topic>gecmd_scale_selected
scale selectedobject
Scale the selected object.
<b>Syntax
<c>ge> scale selectedobject /scalex= /scaley= [/x= /y=]
/scalex <t>Scalefactor in x direction.
/scaley <t>Scalefactor in y direction.
/x <t>x coordinate for the reference point of the scaling.
/y <t>y coordinate for the reference point of the scaling.
</topic>
<topic>gecmd_save
save
......
......@@ -3479,6 +3479,7 @@ create <link>gecmd_create
group <link>gecmd_group
move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject
<t>move selectedobject <link>gecmd_move_selectedobject
new <link>gecmd_new
select <link>gecmd_select
<t>select currentobject <link>gecmd_select_currentobject
......@@ -3516,14 +3517,16 @@ set <link>gecmd_set
<t>set graphattributes <link>gecmd_set_graphattributes
rotate <link>gecmd_rotate
<t>rotate currentobject <link>gecmd_rotate_current
<t>rotate selectedobject <link>gecmd_rotate_selected
scale <link>gecmd_scale
<t>scale currentobject <link>gecmd_scale_current
<t>scale selectedobject <link>gecmd_scale_selected
save <link>gecmd_save
exit <link>gecmd_exit
quit <link>gecmd_quit
open <link>gecmd_open
show <link>gecmd_show
<t>scale version <link>gecmd_show_version
<t>show version <link>gecmd_show_version
</topic>
<headerlevel>
......@@ -3672,9 +3675,28 @@ Flyttar senast skapade objekt.
<b>Syntax
<c>ge> move currentobject /x= /y=
<c>ge> move currentobject /absx= /absy=
/x <t>Förflyttning i x-led relativt tidigare position.
/y <t>Förflyttning i y-led relativt tidigare position.
/absx <t>Förflyttning i x-led till absolut position.
/absy <t>Förflyttning i y-led till absolut position.
</topic>
<topic>gecmd_move_selectedobject
move selectedobject
Flyttar utvalt objekt.
<b>Syntax
<c>ge> move selectedobject /x= /y=
<c>ge> move selectedobject /absx= /absy=
/x <t>Förflyttning i x-led relativt tidigare position.
/y <t>Förflyttning i y-led relativt tidigare position.
/absx <t>Förflyttning i x-led till absolut position.
/absy <t>Förflyttning i y-led till absolut position.
</topic>
<topic>gecmd_new <style>function
......@@ -4077,6 +4099,18 @@ Roterar senast skapade objekt runt objektets mittpunkt.
/angle <t>Vinkel i grader som objektet ska roteras.
</topic>
<topic>gecmd_rotate_selected
rotate selectedobject
Roterar utvalt objekt runt objektets mittpunkt.
<b>Syntax
<c>ge> rotate selectedobject /angle=
/angle <t>Vinkel i grader som objektet ska roteras.
</topic>
<topic>gecmd_scale
scale
</topic>
......@@ -4096,6 +4130,21 @@ Skalar om senast skapade objekt.
/y <t>y-koordinat för skalningens referenspunkt.
</topic>
<topic>gecmd_scale_selected
scale selectedobject
Skalar om utvalt objekt.
<b>Syntax
<c>ge> scale selectedobject /scalex= /scaley= [/x= /y=]
/scalex <t>Skalfaktor i x-led
/scaley <t>Skalfaktor i y-led.
/x <t>x-koordinat för skalningens referenspunkt.
/y <t>y-koordinat för skalningens referenspunkt.
</topic>
<topic>gecmd_save
save
......
......@@ -173,7 +173,7 @@ dcli_tCmdTable graph_command_table[] = {
{
"MOVE",
&graph_move_func,
{ "dcli_arg1", "/X", "/Y",
{ "dcli_arg1", "/X", "/Y", "/ABSX", "/ABSY",
""}
},
{
......@@ -1457,44 +1457,51 @@ static int graph_rotate_func( void *client_data,
char arg1_str[80];
int arg1_sts;
char str[80];
int sts;
float value;
double angle;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str));
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0)
{
char str[80];
int sts;
float value;
double angle;
if ( !graph->current_cmd_object)
{
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0) {
if ( !graph->current_cmd_object) {
graph->message('E', "No current object");
return GE__NOCURRENT;
}
if ( EVEN( dcli_get_qualifier( "/ANGLE", str, sizeof(str))))
{
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
graph->message('E', "Syntax error");
}
else if ( cdh_NoCaseStrncmp( arg1_str, "SELECTEDOBJECT", strlen( arg1_str)) == 0) {
grow_tObject *sel_list;
int sel_count;
grow_GetSelectList( graph->grow->ctx, &sel_list, &sel_count);
if ( sel_count != 1) {
graph->message('E', "Select one object");
return GE__SYNTAX;
}
angle = double(value);
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectRotation( graph->current_cmd_object, angle, 0,
0, glow_eRotationPoint_Center);
grow_SetModified( graph->grow->ctx, 1);
graph->current_cmd_object = sel_list[0];
}
else
{
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
if ( EVEN( dcli_get_qualifier( "/ANGLE", str, sizeof(str)))) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
angle = double(value);
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectRotation( graph->current_cmd_object, angle, 0,
0, glow_eRotationPoint_Center);
grow_SetModified( graph->grow->ctx, 1);
return GE__SUCCESS;
}
......@@ -1727,87 +1734,88 @@ static int graph_scale_func( void *client_data,
char arg1_str[80];
int arg1_sts;
char str[80];
int sts;
float value;
double scalex, scaley;
glow_eScaleType scale_type;
double x0, y0;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str));
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0)
{
char str[80];
int sts;
float value;
double scalex, scaley;
glow_eScaleType scale_type;
double x0, y0;
if ( !graph->current_cmd_object)
{
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0) {
if ( !graph->current_cmd_object) {
graph->message('E', "No current object");
return GE__NOCURRENT;
}
if ( EVEN( dcli_get_qualifier( "/SCALEX", str, sizeof(str))))
{
graph->message('E', "Syntax error");
}
else if ( cdh_NoCaseStrncmp( arg1_str, "SELECTEDOBJECT", strlen( arg1_str)) == 0) {
grow_tObject *sel_list;
int sel_count;
grow_GetSelectList( graph->grow->ctx, &sel_list, &sel_count);
if ( sel_count != 1) {
graph->message('E', "Select one object");
return GE__SYNTAX;
}
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
graph->current_cmd_object = sel_list[0];
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
if ( EVEN( dcli_get_qualifier( "/SCALEX", str, sizeof(str)))) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
scalex = double(value);
}
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
scalex = double(value);
if ( EVEN( dcli_get_qualifier( "/SCALEY", str, sizeof(str))))
{
if ( EVEN( dcli_get_qualifier( "/SCALEY", str, sizeof(str)))) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
scaley = double(value);
scale_type = glow_eScaleType_LowerLeft;
x0 = 0;
y0 = 0;
if ( ODD( dcli_get_qualifier( "/X", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
x0 = double(value);
scale_type = glow_eScaleType_FixPoint;
}
if ( ODD( dcli_get_qualifier( "/Y", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
scaley = double(value);
scale_type = glow_eScaleType_LowerLeft;
x0 = 0;
y0 = 0;
y0 = double(value);
scale_type = glow_eScaleType_FixPoint;
}
if ( ODD( dcli_get_qualifier( "/X", str, sizeof(str))))
{
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
x0 = double(value);
scale_type = glow_eScaleType_FixPoint;
}
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectScale( graph->current_cmd_object, scalex, scaley,
x0, y0, scale_type);
grow_SetModified( graph->grow->ctx, 1);
if ( ODD( dcli_get_qualifier( "/Y", str, sizeof(str))))
{
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
y0 = double(value);
scale_type = glow_eScaleType_FixPoint;
}
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectScale( graph->current_cmd_object, scalex, scaley,
x0, y0, scale_type);
grow_SetModified( graph->grow->ctx, 1);
}
else
{
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
return GE__SUCCESS;
}
......@@ -1818,56 +1826,85 @@ static int graph_move_func( void *client_data,
char arg1_str[80];
int arg1_sts;
char str[80];
int sts;
float value;
double x0, y0;
double ll_x, ll_y, ur_x, ur_y;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str));
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0)
{
char str[80];
int sts;
float value;
double x0, y0;
if ( !graph->current_cmd_object)
{
if ( cdh_NoCaseStrncmp( arg1_str, "CURRENTOBJECT", strlen( arg1_str)) == 0) {
if ( !graph->current_cmd_object) {
graph->message('E', "No current object");
return GE__NOCURRENT;
}
if ( EVEN( dcli_get_qualifier( "/X", str, sizeof(str))))
{
graph->message('E', "Syntax error");
}
else if ( cdh_NoCaseStrncmp( arg1_str, "SELECTEDOBJECT", strlen( arg1_str)) == 0) {
grow_tObject *sel_list;
int sel_count;
grow_GetSelectList( graph->grow->ctx, &sel_list, &sel_count);
if ( sel_count != 1) {
graph->message('E', "Select one object");
return GE__SYNTAX;
}
graph->current_cmd_object = sel_list[0];
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
if ( ODD( dcli_get_qualifier( "/X", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
x0 = double(value);
if ( EVEN( dcli_get_qualifier( "/Y", str, sizeof(str))))
{
}
else if ( ODD( dcli_get_qualifier( "/ABSX", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
grow_MeasureNode( graph->current_cmd_object, &ll_x, &ll_y, &ur_x, &ur_y);
x0 = double(value) - ll_x;
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
if ( ODD( dcli_get_qualifier( "/Y", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1)
{
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
y0 = double(value);
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectPosition( graph->current_cmd_object, x0, y0);
grow_SetModified( graph->grow->ctx, 1);
}
else
{
else if ( ODD( dcli_get_qualifier( "/ABSy", str, sizeof(str)))) {
sts = sscanf( str, "%f", &value);
if ( sts != 1) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
grow_MeasureNode( graph->current_cmd_object, &ll_x, &ll_y, &ur_x, &ur_y);
y0 = double(value) - ll_y;
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
grow_StoreTransform( graph->current_cmd_object);
grow_SetObjectPosition( graph->current_cmd_object, x0, y0);
grow_SetModified( graph->grow->ctx, 1);
return GE__SUCCESS;
}
......
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