Commit 80bd824a authored by Michael Gerbracht's avatar Michael Gerbracht Committed by ROOL

Remember scale factor when Scale dialogue is opened

Detail:
  If cancel is clicked (or dialogue closed by Esc) the last applied value (or initial value)
  will be set as scale factor.
parent 8b10f10c
......@@ -120,6 +120,8 @@ extern _kernel_oserror *create_object (_kernel_swi_regs *r, TaskDescriptor *t)
goto clearup2;
}
internal->ini_value = 100;
for (i=0;i<4;i++) {
internal->std_value[i] = template->std_value[i];
......
......@@ -131,7 +131,13 @@ extern _kernel_oserror *events_postfilter (_kernel_swi_regs *r)
}
case Scale_ActionButton_Cancel:
internal->flags &= ~ScaleInternal_IsShowing;
break;
regs.r[1] = (int) internal->sub_object_id;
regs.r[2] = NumberRange_SetValue;
regs.r[3] = Scale_NumberRange_Scale;
regs.r[4] = internal->ini_value;
return _kernel_swi (Toolbox_ObjectMiscOp, &regs, &regs); /* reset to last applied value */
case Scale_ActionButton_Scale:
regs.r[1] = internal->sub_object_id;
regs.r[2] = NumberRange_GetValue;
......@@ -140,6 +146,9 @@ extern _kernel_oserror *events_postfilter (_kernel_swi_regs *r)
if ((e = _kernel_swi (Toolbox_ObjectMiscOp, &regs, &regs)) != NULL) {
return e;
}
internal->ini_value = regs.r[0];
return apply_factor (internal, regs.r[0]);
case Scale_ActionButton_ScaleToFit:
if ((e = apply_factor (internal, -1)) != NULL)
......
......@@ -45,6 +45,7 @@ typedef struct _scale_internal {
ShowInfo *show_info;
ObjectID object_id, sub_object_id;
int std_value[4];
int ini_value; /* contains value when scale was opened */
} ScaleInternal;
#define ScaleInternal_GenerateShowEvent 0x00000001
......
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