mirror of https://gitlab.com/nakst/essence
gui: add ES_ELEMENT_TRANSITION_CONTENT_ONLY; file manager: transition when changing folder view type
This commit is contained in:
parent
daf5cee20a
commit
b649302fe8
|
@ -499,20 +499,23 @@ void InstanceRegisterCommands(Instance *instance) {
|
|||
EsCommandRegister(&instance->commandRename, instance, INTERFACE_STRING(FileManagerRenameAction), CommandRename, stableCommandID++, "F2");
|
||||
|
||||
EsCommandRegister(&instance->commandViewDetails, instance, INTERFACE_STRING(CommonListViewTypeDetails), [] (Instance *instance, EsElement *, EsCommand *) {
|
||||
uint8_t old = instance->viewSettings.viewType;
|
||||
instance->viewSettings.viewType = VIEW_DETAILS;
|
||||
InstanceRefreshViewType(instance);
|
||||
InstanceRefreshViewType(instance, old != instance->viewSettings.viewType);
|
||||
InstanceViewSettingsUpdated(instance);
|
||||
}, stableCommandID++);
|
||||
|
||||
EsCommandRegister(&instance->commandViewTiles, instance, INTERFACE_STRING(CommonListViewTypeTiles), [] (Instance *instance, EsElement *, EsCommand *) {
|
||||
uint8_t old = instance->viewSettings.viewType;
|
||||
instance->viewSettings.viewType = VIEW_TILES;
|
||||
InstanceRefreshViewType(instance);
|
||||
InstanceRefreshViewType(instance, old != instance->viewSettings.viewType);
|
||||
InstanceViewSettingsUpdated(instance);
|
||||
}, stableCommandID++);
|
||||
|
||||
EsCommandRegister(&instance->commandViewThumbnails, instance, INTERFACE_STRING(CommonListViewTypeThumbnails), [] (Instance *instance, EsElement *, EsCommand *) {
|
||||
uint8_t old = instance->viewSettings.viewType;
|
||||
instance->viewSettings.viewType = VIEW_THUMBNAILS;
|
||||
InstanceRefreshViewType(instance);
|
||||
InstanceRefreshViewType(instance, old != instance->viewSettings.viewType);
|
||||
InstanceViewSettingsUpdated(instance);
|
||||
}, stableCommandID++);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void InstanceReportError(struct Instance *instance, int error, EsError code);
|
|||
bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, int historyMode = 0);
|
||||
void InstanceUpdateStatusString(Instance *instance);
|
||||
void InstanceViewSettingsUpdated(Instance *instance);
|
||||
void InstanceRefreshViewType(Instance *instance);
|
||||
void InstanceRefreshViewType(Instance *instance, bool startTransition);
|
||||
void InstanceFolderPathChanged(Instance *instance, bool fromLoadFolder);
|
||||
void InstanceAddContents(struct Instance *instance, HashTable *newEntries);
|
||||
void InstanceAddSingle(struct Instance *instance, ListEntry newEntry);
|
||||
|
|
|
@ -153,7 +153,7 @@ bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, i
|
|||
}
|
||||
}
|
||||
|
||||
InstanceRefreshViewType(instance);
|
||||
InstanceRefreshViewType(instance, false);
|
||||
|
||||
// Update the user interface.
|
||||
|
||||
|
@ -168,7 +168,11 @@ bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, i
|
|||
return true;
|
||||
}
|
||||
|
||||
void InstanceRefreshViewType(Instance *instance) {
|
||||
void InstanceRefreshViewType(Instance *instance, bool startTransition) {
|
||||
if (startTransition) {
|
||||
EsElementStartTransition(instance->list, ES_TRANSITION_FADE, ES_ELEMENT_TRANSITION_CONTENT_ONLY, 1.0f);
|
||||
}
|
||||
|
||||
EsCommandSetCheck(&instance->commandViewDetails, instance->viewSettings.viewType == VIEW_DETAILS ? ES_CHECK_CHECKED : ES_CHECK_UNCHECKED, false);
|
||||
EsCommandSetCheck(&instance->commandViewTiles, instance->viewSettings.viewType == VIEW_TILES ? ES_CHECK_CHECKED : ES_CHECK_UNCHECKED, false);
|
||||
EsCommandSetCheck(&instance->commandViewThumbnails, instance->viewSettings.viewType == VIEW_THUMBNAILS ? ES_CHECK_CHECKED : ES_CHECK_UNCHECKED, false);
|
||||
|
|
|
@ -251,6 +251,7 @@ struct EsElement : EsElementPublic {
|
|||
#define PAINT_NO_OFFSET (1 << 1) // Don't add the element's offset to the painter.
|
||||
#define PAINT_NO_TRANSITION (1 << 2) // Ignore entrance/exit transitions.
|
||||
#define PAINT_OVERLAY (1 << 3) // Paint the overlay layers.
|
||||
#define PAINT_NO_BACKGROUND (1 << 4) // Don't paint the background.
|
||||
void InternalPaint(EsPainter *painter, int flags);
|
||||
|
||||
void InternalMove(int _width, int _height, int _offsetX, int _offsetY); // Non-client offset.
|
||||
|
@ -1374,7 +1375,8 @@ void EsElementStartTransition(EsElement *element, EsTransitionType transitionTyp
|
|||
painter.offsetX = paintOutsets.l;
|
||||
painter.offsetY = paintOutsets.t;
|
||||
painter.target = element->previousTransitionFrame;
|
||||
element->InternalPaint(&painter, PAINT_NO_TRANSITION | PAINT_NO_OFFSET);
|
||||
element->InternalPaint(&painter, PAINT_NO_TRANSITION | PAINT_NO_OFFSET
|
||||
| ((flags & ES_ELEMENT_TRANSITION_CONTENT_ONLY) ? PAINT_NO_BACKGROUND : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1522,6 +1524,16 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
bounds.l -= paintOutsets.l, bounds.r += paintOutsets.r;
|
||||
bounds.t -= paintOutsets.t, bounds.b += paintOutsets.b;
|
||||
|
||||
if (transitionFlags & ES_ELEMENT_TRANSITION_CONTENT_ONLY) {
|
||||
EsMessage m;
|
||||
m.type = ES_MSG_PAINT_BACKGROUND;
|
||||
m.painter = painter;
|
||||
|
||||
if (!EsMessageSend(this, &m)) {
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
||||
if (previousTransitionFrame) {
|
||||
UIDrawTransitionEffect(painter, previousTransitionFrame, bounds, (EsTransitionType) transitionType, progress, false);
|
||||
}
|
||||
|
@ -1533,7 +1545,8 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
p.offsetX = paintOutsets.l;
|
||||
p.offsetY = paintOutsets.t;
|
||||
p.target = ⌖
|
||||
InternalPaint(&p, PAINT_NO_TRANSITION | PAINT_NO_OFFSET);
|
||||
InternalPaint(&p, PAINT_NO_TRANSITION | PAINT_NO_OFFSET
|
||||
| ((transitionFlags & ES_ELEMENT_TRANSITION_CONTENT_ONLY) ? PAINT_NO_BACKGROUND : 0));
|
||||
UIDrawTransitionEffect(painter, &target, bounds, (EsTransitionType) transitionType, progress, true);
|
||||
EsPaintTargetReturn(&target);
|
||||
} else {
|
||||
|
@ -1542,16 +1555,16 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
|
|||
}
|
||||
} else {
|
||||
paintBackground:;
|
||||
|
||||
// Paint the background.
|
||||
|
||||
EsMessage m;
|
||||
m.type = ES_MSG_PAINT_BACKGROUND;
|
||||
m.painter = painter;
|
||||
|
||||
if (!EsMessageSend(this, &m)) {
|
||||
// TODO Optimisation: don't paint if overlapped by an opaque child.
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
|
||||
if (~paintFlags & PAINT_NO_BACKGROUND) {
|
||||
m.type = ES_MSG_PAINT_BACKGROUND;
|
||||
m.painter = painter;
|
||||
|
||||
if (!EsMessageSend(this, &m)) {
|
||||
// TODO Optimisation: don't paint if overlapped by an opaque child.
|
||||
interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the clipping insets.
|
||||
|
|
|
@ -785,6 +785,7 @@ inttype EsElementTransitionFlags uint32_t none {
|
|||
ES_ELEMENT_TRANSITION_ENTRANCE = bit 0
|
||||
ES_ELEMENT_TRANSITION_EXIT = bit 1
|
||||
ES_ELEMENT_TRANSITION_HIDE_AFTER_COMPLETE = bit 2
|
||||
ES_ELEMENT_TRANSITION_CONTENT_ONLY = bit 3 // Don't apply the transition to the background.
|
||||
};
|
||||
|
||||
inttype EsSyntaxHighlightingLanguage uint32_t none {
|
||||
|
|
BIN
res/Theme.dat
BIN
res/Theme.dat
Binary file not shown.
Loading…
Reference in New Issue