mirror of https://gitlab.com/nakst/essence
				
				
				
			bugfixes
This commit is contained in:
		
							parent
							
								
									420bdf698a
								
							
						
					
					
						commit
						d6d8c545b0
					
				| 
						 | 
					@ -181,6 +181,12 @@ void InstanceRefreshViewType(Instance *instance) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void InstanceRemoveItemSelectionCommands(EsInstance *instance) {
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_CUT), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_COPY), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_PASTE), nullptr);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void InstanceUpdateItemSelectionCountCommands(Instance *instance) {
 | 
					void InstanceUpdateItemSelectionCountCommands(Instance *instance) {
 | 
				
			||||||
	EsCommandSetEnabled(&instance->commandRename, instance->selectedItemCount == 1 && instance->folder->itemHandler->renameItem && !instance->folder->readOnly);
 | 
						EsCommandSetEnabled(&instance->commandRename, instance->selectedItemCount == 1 && instance->folder->itemHandler->renameItem && !instance->folder->readOnly);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -724,10 +730,12 @@ int ListCallback(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	if (message->type == ES_MSG_FOCUSED_START || message->type == ES_MSG_PRIMARY_CLIPBOARD_UPDATED) {
 | 
						if (message->type == ES_MSG_FOCUSED_START || message->type == ES_MSG_PRIMARY_CLIPBOARD_UPDATED) {
 | 
				
			||||||
		InstanceUpdateItemSelectionCountCommands(instance);
 | 
							InstanceUpdateItemSelectionCountCommands(instance);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
						} else if (message->type == ES_MSG_DESTROY) {
 | 
				
			||||||
 | 
							if (EsElementIsFocused(element)) {
 | 
				
			||||||
 | 
								InstanceRemoveItemSelectionCommands(instance);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else if (message->type == ES_MSG_FOCUSED_END) {
 | 
						} else if (message->type == ES_MSG_FOCUSED_END) {
 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_CUT), nullptr);
 | 
							InstanceRemoveItemSelectionCommands(instance);
 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_COPY), nullptr);
 | 
					 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_PASTE), nullptr);
 | 
					 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	} else if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
 | 
						} else if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
 | 
				
			||||||
		int column = message->getContent.columnID, index = message->getContent.index;
 | 
							int column = message->getContent.columnID, index = message->getContent.index;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -793,6 +793,10 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	WindowTabBand *band = (WindowTabBand *) tab->parent;
 | 
						WindowTabBand *band = (WindowTabBand *) tab->parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_DESTROY) {
 | 
						if (message->type == ES_MSG_DESTROY) {
 | 
				
			||||||
 | 
							if (tab->dragging) {
 | 
				
			||||||
 | 
								EsElementSetDisabled(band->GetChild(0), false);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		band->container->openTabs.FindAndDelete(tab, false);
 | 
							band->container->openTabs.FindAndDelete(tab, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (tab->notRespondingInstance) {
 | 
							if (tab->notRespondingInstance) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3710,8 +3710,8 @@ EsDialog *EsDialogShow(EsWindow *window, const char *title, ptrdiff_t titleBytes
 | 
				
			||||||
	if (window->focused) {
 | 
						if (window->focused) {
 | 
				
			||||||
		window->inactiveFocus = window->focused;
 | 
							window->inactiveFocus = window->focused;
 | 
				
			||||||
		window->inactiveFocus->Repaint(true);
 | 
							window->inactiveFocus->Repaint(true);
 | 
				
			||||||
		UIRemoveFocusFromElement(window->focused);
 | 
					 | 
				
			||||||
		window->focused = nullptr;
 | 
							window->focused = nullptr;
 | 
				
			||||||
 | 
							UIRemoveFocusFromElement(window->focused);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsElement *mainStack = window->children[0];
 | 
						EsElement *mainStack = window->children[0];
 | 
				
			||||||
| 
						 | 
					@ -6101,10 +6101,6 @@ void EsElement::Destroy(bool manual) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (state & UI_STATE_FOCUSED) {
 | 
					 | 
				
			||||||
		UIRemoveFocusFromElement(this);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	state |= UI_STATE_DESTROYING | UI_STATE_DESTROYING_CHILD | UI_STATE_BLOCK_INTERACTION;
 | 
						state |= UI_STATE_DESTROYING | UI_STATE_DESTROYING_CHILD | UI_STATE_BLOCK_INTERACTION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (parent) {
 | 
						if (parent) {
 | 
				
			||||||
| 
						 | 
					@ -6712,6 +6708,7 @@ void EsElementSetDisabled(EsElement *element, bool disabled) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (element->window->focused == element) {
 | 
						if (element->window->focused == element) {
 | 
				
			||||||
 | 
							element->window->focused = nullptr;
 | 
				
			||||||
		UIRemoveFocusFromElement(element);
 | 
							UIRemoveFocusFromElement(element);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6727,10 +6724,6 @@ void EsElementSetDisabled(EsElement *element, bool disabled) {
 | 
				
			||||||
	else element->flags &= ~ES_ELEMENT_DISABLED;
 | 
						else element->flags &= ~ES_ELEMENT_DISABLED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	element->MaybeRefreshStyle();
 | 
						element->MaybeRefreshStyle();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (element->window->focused == element) {
 | 
					 | 
				
			||||||
		element->window->focused = nullptr;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EsElementDestroy(EsElement *element) {
 | 
					void EsElementDestroy(EsElement *element) {
 | 
				
			||||||
| 
						 | 
					@ -7792,6 +7785,10 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
 | 
				
			||||||
		window->hovering = true;
 | 
							window->hovering = true;
 | 
				
			||||||
	} else if (message->type == ES_MSG_WINDOW_DEACTIVATED) {
 | 
						} else if (message->type == ES_MSG_WINDOW_DEACTIVATED) {
 | 
				
			||||||
		if (window->activated) {
 | 
							if (window->activated) {
 | 
				
			||||||
 | 
								if (window->pressed) {
 | 
				
			||||||
 | 
									UIMouseUp(window, nullptr, false);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			AccessKeyModeExit();
 | 
								AccessKeyModeExit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (window->windowStyle == ES_WINDOW_MENU) {
 | 
								if (window->windowStyle == ES_WINDOW_MENU) {
 | 
				
			||||||
| 
						 | 
					@ -7804,8 +7801,8 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
 | 
				
			||||||
			if (window->focused) {
 | 
								if (window->focused) {
 | 
				
			||||||
				window->inactiveFocus = window->focused;
 | 
									window->inactiveFocus = window->focused;
 | 
				
			||||||
				window->inactiveFocus->Repaint(true);
 | 
									window->inactiveFocus->Repaint(true);
 | 
				
			||||||
				UIRemoveFocusFromElement(window->focused);
 | 
					 | 
				
			||||||
				window->focused = nullptr;
 | 
									window->focused = nullptr;
 | 
				
			||||||
 | 
									UIRemoveFocusFromElement(window->focused);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			EsMessageSend(window, message);
 | 
								EsMessageSend(window, message);
 | 
				
			||||||
| 
						 | 
					@ -7815,8 +7812,6 @@ void UIProcessWindowManagerMessage(EsWindow *window, EsMessage *message, Process
 | 
				
			||||||
		gui.leftModifiers = message->windowActivated.leftModifiers;
 | 
							gui.leftModifiers = message->windowActivated.leftModifiers;
 | 
				
			||||||
		gui.rightModifiers = message->windowActivated.rightModifiers;
 | 
							gui.rightModifiers = message->windowActivated.rightModifiers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		UIMouseUp(window, nullptr, false);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (!window->activated) {
 | 
							if (!window->activated) {
 | 
				
			||||||
			AccessKeyModeExit();
 | 
								AccessKeyModeExit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1778,6 +1778,10 @@ struct EsListView : EsElement {
 | 
				
			||||||
			groups.Free();
 | 
								groups.Free();
 | 
				
			||||||
			activeColumns.Free();
 | 
								activeColumns.Free();
 | 
				
			||||||
			registeredColumns.Free();
 | 
								registeredColumns.Free();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (EsElementIsFocused(this)) {
 | 
				
			||||||
 | 
									EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_SELECT_ALL), nullptr);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		} else if (message->type == ES_MSG_KEY_UP) {
 | 
							} else if (message->type == ES_MSG_KEY_UP) {
 | 
				
			||||||
			if (message->keyboard.scancode == ES_SCANCODE_LEFT_CTRL || message->keyboard.scancode == ES_SCANCODE_RIGHT_CTRL) {
 | 
								if (message->keyboard.scancode == ES_SCANCODE_LEFT_CTRL || message->keyboard.scancode == ES_SCANCODE_RIGHT_CTRL) {
 | 
				
			||||||
				SelectPreview();
 | 
									SelectPreview();
 | 
				
			||||||
| 
						 | 
					@ -1833,6 +1837,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
				item->element->MaybeRefreshStyle();
 | 
									item->element->MaybeRefreshStyle();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Also done in ES_MSG_DESTROY:
 | 
				
			||||||
			EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_SELECT_ALL), nullptr);
 | 
								EsCommandSetCallback(EsCommandByID(instance, ES_COMMAND_SELECT_ALL), nullptr);
 | 
				
			||||||
		} else if (message->type == ES_MSG_MOUSE_RIGHT_DOWN) {
 | 
							} else if (message->type == ES_MSG_MOUSE_RIGHT_DOWN) {
 | 
				
			||||||
			// Make sure that right clicking will focus the list.
 | 
								// Make sure that right clicking will focus the list.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -954,7 +954,7 @@ enum EsMessageType {
 | 
				
			||||||
								// this allows messageUser to block input processing by returning ES_REJECTED.
 | 
													// this allows messageUser to block input processing by returning ES_REJECTED.
 | 
				
			||||||
	ES_MSG_SCROLL_X				= 0x2012	// The element has been horizontally scrolled.
 | 
						ES_MSG_SCROLL_X				= 0x2012	// The element has been horizontally scrolled.
 | 
				
			||||||
	ES_MSG_SCROLL_Y				= 0x2013	// The element has been vertically scrolled.
 | 
						ES_MSG_SCROLL_Y				= 0x2013	// The element has been vertically scrolled.
 | 
				
			||||||
	ES_MSG_STRONG_FOCUS_END			= 0x2014	// Sent once when the user 'clicks off' the element, even if a new element was not necessarily focused.
 | 
						ES_MSG_STRONG_FOCUS_END			= 0x2014	// Sent once when the user 'clicks off' the element, even if a new element was not necessarily focused. Not sent when destroying the element!
 | 
				
			||||||
	ES_MSG_BEFORE_Z_ORDER			= 0x2015	// Sent before a batch of Z_ORDER messages.
 | 
						ES_MSG_BEFORE_Z_ORDER			= 0x2015	// Sent before a batch of Z_ORDER messages.
 | 
				
			||||||
	ES_MSG_AFTER_Z_ORDER			= 0x2016	// Sent after a batch of Z_ORDER messages.
 | 
						ES_MSG_AFTER_Z_ORDER			= 0x2016	// Sent after a batch of Z_ORDER messages.
 | 
				
			||||||
	ES_MSG_PAINT_CHILDREN			= 0x2017	// Paint the element's children. Useful for animations, with EsPaintTargetTake/Return.
 | 
						ES_MSG_PAINT_CHILDREN			= 0x2017	// Paint the element's children. Useful for animations, with EsPaintTargetTake/Return.
 | 
				
			||||||
| 
						 | 
					@ -982,13 +982,13 @@ enum EsMessageType {
 | 
				
			||||||
	// State change messages: (causes a style refresh)
 | 
						// State change messages: (causes a style refresh)
 | 
				
			||||||
	ES_MSG_STATE_CHANGE_MESSAGE_START	= 0x2080
 | 
						ES_MSG_STATE_CHANGE_MESSAGE_START	= 0x2080
 | 
				
			||||||
	ES_MSG_HOVERED_START			= 0x2081	// Sent when the mouse starts hovering over an element.
 | 
						ES_MSG_HOVERED_START			= 0x2081	// Sent when the mouse starts hovering over an element.
 | 
				
			||||||
	ES_MSG_HOVERED_END			= 0x2082	// Opposite of ES_MSG_HOVERED_START. Sent before ES_MSG_HOVERED_START is sent to the new hovered element.
 | 
						ES_MSG_HOVERED_END			= 0x2082	// Opposite of ES_MSG_HOVERED_START. Sent before ES_MSG_HOVERED_START is sent to the new hovered element. Not sent when destroying the element!
 | 
				
			||||||
	ES_MSG_PRESSED_START			= 0x2083	// Sent when an element is pressed.
 | 
						ES_MSG_PRESSED_START			= 0x2083	// Sent when an element is pressed.
 | 
				
			||||||
	ES_MSG_PRESSED_END			= 0x2084	// Opposite of ES_MSG_PRESSED_START. 
 | 
						ES_MSG_PRESSED_END			= 0x2084	// Opposite of ES_MSG_PRESSED_START. Not sent when destroying the element!
 | 
				
			||||||
	ES_MSG_FOCUSED_START			= 0x2085	// Sent when an element is focused.
 | 
						ES_MSG_FOCUSED_START			= 0x2085	// Sent when an element is focused.
 | 
				
			||||||
	ES_MSG_FOCUSED_END			= 0x2086	// Opposite of ES_MSG_FOCUSED_START. 
 | 
						ES_MSG_FOCUSED_END			= 0x2086	// Opposite of ES_MSG_FOCUSED_START. Not sent when destroying the element!
 | 
				
			||||||
	ES_MSG_FOCUS_WITHIN_START		= 0x2087	// Sent when an element is focused.
 | 
						ES_MSG_FOCUS_WITHIN_START		= 0x2087	// Sent when an element is focused.
 | 
				
			||||||
	ES_MSG_FOCUS_WITHIN_END			= 0x2088	// Opposite of ES_MSG_FOCUSED_START. 
 | 
						ES_MSG_FOCUS_WITHIN_END			= 0x2088	// Opposite of ES_MSG_FOCUSED_START. Not sent when destroying the element!
 | 
				
			||||||
	ES_MSG_STATE_CHANGE_MESSAGE_END		= 0x20FF
 | 
						ES_MSG_STATE_CHANGE_MESSAGE_END		= 0x20FF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Element messages:
 | 
						// Element messages:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1510,6 +1510,14 @@ void TextboxAddSmartContextMenu(EsTextbox *textbox, EsMenu *menu) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TextboxUnregisterCommands(EsTextbox *textbox) {
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_SELECT_ALL), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_DELETE), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_COPY), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_CUT), nullptr);
 | 
				
			||||||
 | 
						EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_PASTE), nullptr);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
					int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	EsTextbox *textbox = (EsTextbox *) element;
 | 
						EsTextbox *textbox = (EsTextbox *) element;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1608,6 +1616,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		TextboxRefreshVisibleLines(textbox);
 | 
							TextboxRefreshVisibleLines(textbox);
 | 
				
			||||||
	} else if (message->type == ES_MSG_DESTROY) {
 | 
						} else if (message->type == ES_MSG_DESTROY) {
 | 
				
			||||||
 | 
							if (EsElementIsFocused(textbox)) TextboxUnregisterCommands(textbox);
 | 
				
			||||||
		textbox->visibleLines.Free();
 | 
							textbox->visibleLines.Free();
 | 
				
			||||||
		textbox->lines.Free();
 | 
							textbox->lines.Free();
 | 
				
			||||||
		UndoManagerDestroy(&textbox->localUndo);
 | 
							UndoManagerDestroy(&textbox->localUndo);
 | 
				
			||||||
| 
						 | 
					@ -1757,11 +1766,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		EsInstanceSetActiveUndoManager(textbox->instance, textbox->undo);
 | 
							EsInstanceSetActiveUndoManager(textbox->instance, textbox->undo);
 | 
				
			||||||
		textbox->Repaint(true);
 | 
							textbox->Repaint(true);
 | 
				
			||||||
	} else if (message->type == ES_MSG_FOCUSED_END) {
 | 
						} else if (message->type == ES_MSG_FOCUSED_END) {
 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_SELECT_ALL), nullptr);
 | 
							TextboxUnregisterCommands(textbox);
 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_DELETE), nullptr);
 | 
					 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_COPY), nullptr);
 | 
					 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_CUT), nullptr);
 | 
					 | 
				
			||||||
		EsCommandSetCallback(EsCommandByID(textbox->instance, ES_COMMAND_PASTE), nullptr);
 | 
					 | 
				
			||||||
		EsInstanceSetActiveUndoManager(textbox->instance, textbox->instance->undoManager);
 | 
							EsInstanceSetActiveUndoManager(textbox->instance, textbox->instance->undoManager);
 | 
				
			||||||
		textbox->Repaint(true);
 | 
							textbox->Repaint(true);
 | 
				
			||||||
	} else if (message->type == ES_MSG_STRONG_FOCUS_END) {
 | 
						} else if (message->type == ES_MSG_STRONG_FOCUS_END) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue