union
{
int distance;
- float percent;
+ float percent;
};
+ property MinMaxValue
+ {
+ set { distance = value; type = offset; }
+ get { return distance; }
+ }
property int
{
set { distance = value; type = offset; }
get { return (double) percent; }
}
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
if(type == offset)
{
c = strlen(stringOutput)-1;
for( ; c >= 0; c--)
{
- if(stringOutput[c] != '0')
+ if(stringOutput[c] != '0')
last = Max(last, c);
if(stringOutput[c] == '.')
{
return stringOutput;
}
- bool OnGetDataFromString(char * stringOutput)
+ bool OnGetDataFromString(const char * stringOutput)
{
char * end;
if(strchr(stringOutput, '.'))
{
float percent = (float)strtod(stringOutput, &end);
-
+
if(end != stringOutput)
{
this.percent = percent;
{
distance = 0;
type = 0;
+ return true;
}
return false;
}
union
{
int distance;
- float percent;
+ float percent;
};
+ property MinMaxValue
+ {
+ set { distance = value; type = none; }
+ get { return distance; }
+ }
property int
{
set { distance = value; type = none; }
get { return (double) percent; }
}
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
if(type == middleRelative)
{
c = strlen(stringOutput)-1;
for( ; c >= 0; c--)
{
- if(stringOutput[c] != '0')
+ if(stringOutput[c] != '0')
last = Max(last, c);
if(stringOutput[c] == '.')
{
return stringOutput;
}
- bool OnGetDataFromString(char * stringOutput)
+ bool OnGetDataFromString(const char * stringOutput)
{
if(strchr(stringOutput, '.'))
{
{
union { AnchorValue left; MiddleAnchorValue horz; };
union { AnchorValue top; MiddleAnchorValue vert; };
- AnchorValue right, bottom;
+ AnchorValue right, bottom;
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
char tempString[256];
- char * anchorValue;
+ const char * anchorValue;
bool subNeedClass;
+ stringOutput[0] = 0;
tempString[0] = '\0';
anchorValue = left.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "left = "); strcat(stringOutput, anchorValue); }
-
+
//if(((!left.type && !right.type) && horz.distance) || horz.type == middleRelative)
if(!right.type && ((!left.type && horz.distance) || horz.type == middleRelative))
{
anchorValue = horz.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "horz = "); strcat(stringOutput, anchorValue); }
}
-
+
tempString[0] = '\0';
anchorValue = top.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "top = "); strcat(stringOutput, anchorValue); }
-
+
tempString[0] = '\0';
anchorValue = right.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "right = "); strcat(stringOutput, anchorValue); }
anchorValue = vert.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "vert = "); strcat(stringOutput, anchorValue); }
}
-
+
tempString[0] = '\0';
anchorValue = bottom.OnGetString(tempString, null, &subNeedClass);
if(anchorValue[0]) { if(stringOutput[0]) strcat(stringOutput, ", "); strcat(stringOutput, "bottom = "); strcat(stringOutput, anchorValue); }
-
+
return stringOutput;
}
- bool OnGetDataFromString(char * string)
+ bool OnGetDataFromString(const char * string)
{
this = Anchor {};
return class::OnGetDataFromString(string);
Window OnEdit(Window listBox, Window master, int x, int y, int w, int h, Window control)
{
- char * string = "";
+ const char * string = "";
AnchorDropBox comboBox
{
editText = true;
control = control;
borderStyle = 0;
};
-
+
comboBox.Create();
{
char tempString[MAX_F_STRING] = "";
bool needClass = false;
- char * result = OnGetString(tempString, null, &needClass);
+ const char * result = OnGetString(tempString, null, &needClass);
if(result) string = result;
}
comboBox.contents = string;
Anchor anchor = anchorDropBox.anchorValue;
Window control = anchorDropBox.control;
DataBox dropMaster = (DataBox)anchorDropBox.master;
- int id = button.id;
+ int64 id = button.id;
switch(id)
{
{
char tempString[1024] = "";
bool needClass = false;
- char * string = anchor.OnGetString(tempString, null, &needClass);
+ const char * string = anchor.OnGetString(tempString, null, &needClass);
anchorDropBox.contents = string;
}
{
int cw = clientSize.w;
int ch = clientSize.h;
-
+
if(checked)
{
surface.SetForeground(black);
Anchor anchor = anchorDropBox.anchorValue;
Window control = anchorDropBox.control;
DataBox dropMaster = (DataBox)anchorDropBox.master;
- int id = button.id;
+ int64 id = button.id;
if((id == 0 || id == 2) && ((!anchor.left.type && !anchor.right.type) || anchor.left.type == middleRelative))
{
//anchor.horz.type = anchor.horz.distance ? offset : none;
}
else if(anchor.horz.type == middleRelative) anchor.horz.percent = (float) ((x + w / 2) - (vpw / 2)) / vpw;
- if(!anchor.top.type && !anchor.bottom.type)
+ if(!anchor.top.type && !anchor.bottom.type)
{
anchor.vert.distance = (y + h / 2) - (vph / 2);
//anchor.vert.type = anchor.vert.distance ? offset : none;
{
char tempString[1024] = "";
bool needClass = false;
- char * string = anchor.OnGetString(tempString, null, &needClass);
+ const char * string = anchor.OnGetString(tempString, null, &needClass);
anchorDropBox.contents = string;
}
};
for(c = 0; c<4; c++)
{
- Button button = buttons[c] = AnchorButton
- {
+ Button button = buttons[c] = AnchorButton
+ {
anchorEditor, id = c,
size = Size { (c%2)?10:28, (c%2)?28:10 }
};
case 0:
if(anchorValue.left.type && anchorValue.left.type != middleRelative) button.checked = true;
if(anchorValue.left.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
-
+
button.anchor = Anchor { left = 0 };
relButton.anchor = Anchor { left = 5, vert = 16 };
break;
button.anchor = Anchor { top = 0 };
relButton.anchor = Anchor { top = 5, horz = 16 };
break;
- case 2:
+ case 2:
if(anchorValue.right.type && anchorValue.right.type != middleRelative) button.checked = true;
if(anchorValue.right.type == relative || anchorValue.horz.type == middleRelative) relButton.checked = true;
-
+
button.anchor = Anchor { right = 0 };
relButton.anchor = Anchor { right = 5, vert = 16 };
break;
- case 3:
+ case 3:
if(anchorValue.bottom.type && anchorValue.bottom.type != middleRelative) button.checked = true;
if(anchorValue.bottom.type == relative || anchorValue.vert.type == middleRelative) relButton.checked = true;
anchorEditor.Create();
return anchorEditor;
}
-
+
void OnCloseDropDown(Window anchorEditor)
{
// TOFIX: Patch for update bug
anchorEditor.Destroy(0);
}
- bool DataBox::NotifyTextEntry(AnchorDropBox dropBox, char * string, bool save)
+ bool DataBox::NotifyTextEntry(AnchorDropBox dropBox, const char * string, bool save)
{
Anchor anchor = dropBox.anchorValue;
- Window control = dropBox.control;
if(save)
{
{
char tempString[1024] = "";
bool needClass = false;
- char * string = anchor.OnGetString(tempString, null, &needClass);
+ const char * string = anchor.OnGetString(tempString, null, &needClass);
dropBox.contents = string;
}
return true;