mirror of https://gitlab.com/nakst/essence
fix approximate border calculation; installer time textbox
This commit is contained in:
parent
9d8e39cc88
commit
20a9aecae0
|
@ -49,6 +49,15 @@ const EsStyle styleButtonsRow = {
|
|||
},
|
||||
};
|
||||
|
||||
const EsStyle styleTextboxMedium = {
|
||||
.inherit = ES_STYLE_TEXTBOX_BORDERED_SINGLE,
|
||||
|
||||
.metrics = {
|
||||
.mask = ES_THEME_METRICS_PREFERRED_WIDTH,
|
||||
.preferredWidth = 80,
|
||||
},
|
||||
};
|
||||
|
||||
InstallerMetadata *metadata;
|
||||
Array<EsMessageDevice> connectedDrives;
|
||||
EsListView *drivesList;
|
||||
|
@ -66,8 +75,10 @@ EsPanel *panelComplete;
|
|||
EsPanel *panelError;
|
||||
EsPanel *panelNotSupported;
|
||||
EsTextbox *userNameTextbox;
|
||||
EsTextbox *timeTextbox;
|
||||
EsTextDisplay *progressDisplay;
|
||||
const char *cSelectedFont;
|
||||
int64_t clockOffsetMs;
|
||||
uint8_t progress;
|
||||
bool onWaitScreen;
|
||||
bool startedInstallation;
|
||||
|
@ -972,6 +983,15 @@ void Complete() {
|
|||
}
|
||||
|
||||
void ButtonFinish(EsInstance *, EsElement *, EsCommand *) {
|
||||
EsDateComponents base, modified;
|
||||
EsDateNowUTC(&base);
|
||||
modified = base;
|
||||
// TODO Proper date/time parsing.
|
||||
int64_t input = EsTextboxGetContentsAsDouble(timeTextbox);
|
||||
modified.hour = input / 100;
|
||||
modified.minute = (input % 100) % 60;
|
||||
clockOffsetMs = DateToLinear(&modified) - DateToLinear(&base);
|
||||
|
||||
if (progress == 100) {
|
||||
Complete();
|
||||
} else {
|
||||
|
@ -1085,6 +1105,19 @@ void _start() {
|
|||
userNameTextbox = EsTextboxCreate(table, ES_CELL_H_LEFT);
|
||||
userNameTextbox->messageUser = UserNameTextboxMessage;
|
||||
|
||||
// TODO Proper date formatting.
|
||||
EsDateComponents date;
|
||||
EsDateNowUTC(&date);
|
||||
char timeBuffer[64];
|
||||
ptrdiff_t timeBytes = EsStringFormat(timeBuffer, sizeof(timeBuffer), "%d%d:%d%d",
|
||||
date.hour / 10, date.hour % 10, date.minute / 10, date.minute % 10);
|
||||
|
||||
// TODO Make a date/time entry element or textbox overlay.
|
||||
EsTextDisplayCreate(table, ES_CELL_H_RIGHT, ES_STYLE_TEXT_LABEL, INTERFACE_STRING(InstallerTime));
|
||||
timeTextbox = EsTextboxCreate(table, ES_CELL_H_LEFT, &styleTextboxMedium);
|
||||
EsTextboxInsert(timeTextbox, timeBuffer, timeBytes);
|
||||
// TODO A date field.
|
||||
|
||||
EsTextDisplayCreate(table, ES_CELL_H_RIGHT | ES_CELL_V_TOP, ES_STYLE_TEXT_RADIO_GROUP_LABEL, INTERFACE_STRING(InstallerSystemFont));
|
||||
EsPanel *fonts = EsPanelCreate(table, ES_CELL_H_LEFT | ES_PANEL_RADIO_GROUP);
|
||||
EsButton *button = EsButtonCreate(fonts, ES_BUTTON_RADIOBOX | ES_CELL_H_EXPAND, 0, INTERFACE_STRING(InstallerFontDefault));
|
||||
|
|
|
@ -2239,6 +2239,7 @@ function double EsPerformanceTimerPop(); // Returns value in seconds.
|
|||
function double EsTimeStampMs(); // Current value of the performance timer, in ms.
|
||||
|
||||
function void EsDateNowUTC(EsDateComponents *date); // Don't rely on the accuracy of the millisecond field.
|
||||
private function uint64_t DateToLinear(const EsDateComponents *date);
|
||||
|
||||
// Strings.
|
||||
|
||||
|
|
Binary file not shown.
BIN
res/Theme.dat
BIN
res/Theme.dat
Binary file not shown.
|
@ -338,6 +338,7 @@ DEFINE_INTERFACE_STRING(InstallerFinish, "Finish");
|
|||
DEFINE_INTERFACE_STRING(InstallerCustomizeOptions, "Customize your computer.");
|
||||
DEFINE_INTERFACE_STRING(InstallerCustomizeOptionsHint, "More options will be available in Settings.");
|
||||
DEFINE_INTERFACE_STRING(InstallerUserName, "User name:");
|
||||
DEFINE_INTERFACE_STRING(InstallerTime, "Current time:");
|
||||
DEFINE_INTERFACE_STRING(InstallerSystemFont, "System font:");
|
||||
DEFINE_INTERFACE_STRING(InstallerFontDefault, "Default");
|
||||
DEFINE_INTERFACE_STRING(InstallerProgressMessage, "Installing, please wait" ELLIPSIS "\nDo not turn off your computer.\nProgress: \aw6]");
|
||||
|
|
|
@ -490,3 +490,4 @@ EsScrollViewIsInDragScroll=488
|
|||
_EsOpenDocumentEnumerate=489
|
||||
EsDialogGetContentArea=490
|
||||
_EsDebugCommand=491
|
||||
DateToLinear=492
|
||||
|
|
|
@ -256,9 +256,10 @@ void InspectorPopulate();
|
|||
void InspectorPickTargetEnd();
|
||||
void CanvasSelectObject(struct Object *object);
|
||||
void CanvasSwitchView(void *cp);
|
||||
Rectangle8 ExportCalculatePaintOutsets(Object *object);
|
||||
void ObjectAddCommand(void *cp);
|
||||
void ObjectChangeTypeInternal(void *cp);
|
||||
Rectangle8 ExportCalculatePaintOutsets(Object *object);
|
||||
Rectangle8 ExportCalculateApproximateBorders(Object *object);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1988,9 +1989,12 @@ void InspectorPopulate() {
|
|||
UIParentPop();
|
||||
|
||||
Rectangle8 paintOutsets = ExportCalculatePaintOutsets(PropertyFindOrInheritReadObject(style, "appearance"));
|
||||
char paintOutsetsText[256];
|
||||
snprintf(paintOutsetsText, sizeof(paintOutsetsText), "Paint outsets: %d, %d, %d, %d.", UI_RECT_ALL(paintOutsets));
|
||||
UILabelCreate(0, 0, paintOutsetsText, -1);
|
||||
char text[256];
|
||||
snprintf(text, sizeof(text), "Paint outsets: %d, %d, %d, %d.", UI_RECT_ALL(paintOutsets));
|
||||
UILabelCreate(0, 0, text, -1);
|
||||
Rectangle8 approximateBorders = ExportCalculateApproximateBorders(PropertyFindOrInheritReadObject(style, "appearance"));
|
||||
snprintf(text, sizeof(text), "Approximate borders: %d, %d, %d, %d.", UI_RECT_ALL(approximateBorders));
|
||||
UILabelCreate(0, 0, text, -1);
|
||||
} else {
|
||||
UILabelCreate(0, 0, "Select an object to inspect.", -1);
|
||||
}
|
||||
|
@ -2146,12 +2150,12 @@ Rectangle8 ExportCalculateApproximateBorders(Object *object) {
|
|||
|
||||
if (layerObject->type == OBJ_LAYER_BOX && position0 == 0 && position1 == 100 && position2 == 0 && position3 == 100
|
||||
&& !PropertyReadInt32(layerObject, "shadowHiding") && !PropertyReadInt32(layerObject, "isBlurred")
|
||||
&& mode == THEME_LAYER_MODE_BACKGROUND && PropertyFind(layerObject, "borderPaint")) {
|
||||
&& mode == THEME_LAYER_MODE_BACKGROUND && PropertyFindOrInherit(layerObject, "borderPaint")) {
|
||||
return {
|
||||
(int8_t) PropertyReadInt32(layerObject, "borders0"),
|
||||
(int8_t) PropertyReadInt32(layerObject, "borders1"),
|
||||
(int8_t) PropertyReadInt32(layerObject, "borders2"),
|
||||
(int8_t) PropertyReadInt32(layerObject, "borders3"),
|
||||
(int8_t) PropertyFindOrInheritReadInt32(layerObject, "borders0"),
|
||||
(int8_t) PropertyFindOrInheritReadInt32(layerObject, "borders1"),
|
||||
(int8_t) PropertyFindOrInheritReadInt32(layerObject, "borders2"),
|
||||
(int8_t) PropertyFindOrInheritReadInt32(layerObject, "borders3"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue