mirror of https://gitlab.com/nakst/essence
				
				
				
			bugfixes; cleanup theme
This commit is contained in:
		
							parent
							
								
									b6bc221af2
								
							
						
					
					
						commit
						4ad2395977
					
				|  | @ -1,3 +1,4 @@ | |||
| define ES_STYLE_SEPARATOR_HORIZONTAL (ES_STYLE_CAST(1373)) | ||||
| private define ES_STYLE__TEST_STYLE (ES_STYLE_CAST(1385)) | ||||
| private define ES_STYLE_ACCESS_KEY_HINT (ES_STYLE_CAST(1221)) | ||||
| private define ES_STYLE_ANNOUNCEMENT (ES_STYLE_CAST(1511)) | ||||
|  | @ -8,7 +9,13 @@ define ES_STYLE_BUTTON_GROUP_CONTAINER (ES_STYLE_CAST(1229)) | |||
| define ES_STYLE_BUTTON_GROUP_ITEM (ES_STYLE_CAST(1231)) | ||||
| define ES_STYLE_BUTTON_GROUP_SEPARATOR (ES_STYLE_CAST(1233)) | ||||
| private define ES_STYLE_CANVAS_SHADOW (ES_STYLE_CAST(1451)) | ||||
| private define ES_STYLE_COLOR_HEX_TEXTBOX (ES_STYLE_CAST(1245)) | ||||
| private define ES_STYLE_TASK_BAR_BAR (ES_STYLE_CAST(1379)) | ||||
| private define ES_STYLE_SLIDER_TRACK (ES_STYLE_CAST(1601)) | ||||
| private define ES_STYLE_CHECKBOX_NORMAL (ES_STYLE_CAST(1559)) | ||||
| private define ES_STYLE_SPLIT_BAR_VERTICAL (ES_STYLE_CAST(1377)) | ||||
| private define ES_STYLE_WINDOW_TAB_CLOSE_BUTTON (ES_STYLE_CAST(1469)) | ||||
| private define ES_STYLE_SPLIT_BAR_HORIZONTAL (ES_STYLE_CAST(1375)) | ||||
| private define ES_STYLE_CHECKBOX_RADIOBOX (ES_STYLE_CAST(1567)) | ||||
| define ES_STYLE_CLEAR_BACKGROUND (ES_STYLE_CAST(1597)) | ||||
| private define ES_STYLE_COLOR_CHOSEN_POINT (ES_STYLE_CAST(1241)) | ||||
|  | @ -86,6 +93,7 @@ define ES_STYLE_PANEL_WINDOW_BACKGROUND (ES_STYLE_CAST(1341)) | |||
| define ES_STYLE_TEXTBOX_BORDERED_MULTILINE (ES_STYLE_CAST(1399)) | ||||
| define ES_STYLE_PANEL_WINDOW_DIVIDER (ES_STYLE_CAST(1343)) | ||||
| define ES_STYLE_PANEL_WINDOW_WITH_STATUS_BAR_CONTENT (ES_STYLE_CAST(1483)) | ||||
| private define ES_STYLE_SLIDER_POINT (ES_STYLE_CAST(1607)) | ||||
| define ES_STYLE_PUSH_BUTTON_DANGEROUS (ES_STYLE_CAST(1345)) | ||||
| private define ES_STYLE_TEXTBOX_INLINE (ES_STYLE_CAST(1477)) | ||||
| private define ES_STYLE_PUSH_BUTTON_NORMAL (ES_STYLE_CAST(1347)) | ||||
|  | @ -112,11 +120,3 @@ private define ES_STYLE_SCROLLBAR_BAR_VERTICAL (ES_STYLE_CAST(1365)) | |||
| private define ES_STYLE_SCROLLBAR_THUMB_HORIZONTAL (ES_STYLE_CAST(1367)) | ||||
| private define ES_STYLE_SCROLLBAR_THUMB_VERTICAL (ES_STYLE_CAST(1369)) | ||||
| private define ES_STYLE_SCROLLBAR_PAD (ES_STYLE_CAST(1371)) | ||||
| define ES_STYLE_SEPARATOR_HORIZONTAL (ES_STYLE_CAST(1373)) | ||||
| private define ES_STYLE_SLIDER_POINT (ES_STYLE_CAST(1607)) | ||||
| private define ES_STYLE_SLIDER_TRACK (ES_STYLE_CAST(1601)) | ||||
| private define ES_STYLE_SPLIT_BAR_HORIZONTAL (ES_STYLE_CAST(1375)) | ||||
| private define ES_STYLE_WINDOW_TAB_CLOSE_BUTTON (ES_STYLE_CAST(1469)) | ||||
| private define ES_STYLE_SPLIT_BAR_VERTICAL (ES_STYLE_CAST(1377)) | ||||
| private define ES_STYLE_TASK_BAR_BAR (ES_STYLE_CAST(1379)) | ||||
| private define ES_STYLE_COLOR_HEX_TEXTBOX (ES_STYLE_CAST(1245)) | ||||
|  |  | |||
|  | @ -196,10 +196,13 @@ int CanvasCallback(EsElement *element, EsMessage *message) { | |||
| 	// TODO Is it safe to pass input to Bochs on this thread?
 | ||||
| 
 | ||||
| 	if (message->type == ES_MSG_PAINT) { | ||||
| 		int ox = message->painter->width / 2 - instance->vmemWidth / 2; | ||||
| 		int oy = message->painter->height / 2 - instance->vmemHeight / 2; | ||||
| 		EsRectangle bounds = { ox, ox + instance->vmemWidth, oy, oy + instance->vmemHeight }; | ||||
| 		EsDrawBitmap(message->painter, bounds, instance->vmem, instance->vmemWidth * 4, 0xFFFF); | ||||
| 		EsRectangle bounds = EsPainterBoundsInset(message->painter); | ||||
| 		EsRectangle imageBounds = EsRectangleCenter(bounds, ES_RECT_2S(instance->vmemWidth, instance->vmemHeight)); | ||||
| 		EsDrawBitmap(message->painter, imageBounds, instance->vmem, instance->vmemWidth * 4, ES_DRAW_BITMAP_OPAQUE); | ||||
| 		EsDrawBlock(message->painter, ES_RECT_4(bounds.l, imageBounds.l, bounds.t, bounds.b), 0xFF000000); | ||||
| 		EsDrawBlock(message->painter, ES_RECT_4(imageBounds.r, bounds.r, bounds.t, bounds.b), 0xFF000000); | ||||
| 		EsDrawBlock(message->painter, ES_RECT_4(imageBounds.l, imageBounds.r, bounds.t, imageBounds.t), 0xFF000000); | ||||
| 		EsDrawBlock(message->painter, ES_RECT_4(imageBounds.l, imageBounds.r, imageBounds.b, bounds.b), 0xFF000000); | ||||
| 		repaintQueued = false; | ||||
| 	} else if (message->type == ES_MSG_KEY_DOWN) { | ||||
| 		if (message->keyboard.scancode == ES_SCANCODE_RIGHT_CTRL) { | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								res/Theme.dat
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								res/Theme.dat
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -365,15 +365,17 @@ void EsDrawBitmap(EsPainter *painter, EsRectangle region, uint32_t *sourceBits, | |||
| 				j--; | ||||
| 			}  | ||||
| 		} else if (mode == ES_DRAW_BITMAP_OPAQUE) { | ||||
| 			__m128i fillAlpha = _mm_set1_epi32(0xFF000000); | ||||
| 
 | ||||
| 			while (j >= 4) { | ||||
| 				_mm_storeu_si128((__m128i *) destination, _mm_loadu_si128((__m128i *) source)); | ||||
| 				_mm_storeu_si128((__m128i *) destination, _mm_or_si128(fillAlpha, _mm_loadu_si128((__m128i *) source))); | ||||
| 				destination += 4; | ||||
| 				source += 4; | ||||
| 				j -= 4; | ||||
| 			}  | ||||
| 
 | ||||
| 			while (j > 0) { | ||||
| 				*destination = *source; | ||||
| 				*destination = 0xFF000000 | *source; | ||||
| 				destination++; | ||||
| 				source++; | ||||
| 				j--; | ||||
|  |  | |||
|  | @ -20,6 +20,9 @@ | |||
| // 	Prototyping display: previewing state transitions.
 | ||||
| 
 | ||||
| // TODO Additional features:
 | ||||
| // 	Method to iterate through all the objects that link to selected object.
 | ||||
| // 	Sorted list in ObjectAddInstanceCommand.
 | ||||
| // 	Hide arrows to colors.
 | ||||
| //	Having to link to the end of a conditional object chain is a bit strange.
 | ||||
| // 	Output styles.header in order of header ID.
 | ||||
| // 	Cleaning up unused objects.
 | ||||
|  | @ -342,6 +345,7 @@ struct Step { | |||
| 
 | ||||
| struct ExportOffset { | ||||
| 	uint64_t objectID; | ||||
| 	uint64_t styleObjectID; | ||||
| 	uintptr_t offset; | ||||
| 	char cPropertyName[PROPERTY_NAME_SIZE]; | ||||
| 	uint8_t overrideType; | ||||
|  | @ -414,6 +418,16 @@ ExportOffset *ExportOffsetFindObject(uint64_t id) { | |||
| 	return nullptr; | ||||
| } | ||||
| 
 | ||||
| ExportOffset *ExportOffsetFindObjectForStyle(uint64_t id, uint64_t style) { | ||||
| 	for (uintptr_t i = 0; i < exportOffsets.Length(); i++) { | ||||
| 		if (exportOffsets[i].objectID == id && exportOffsets[i].styleObjectID == style) { | ||||
| 			return &exportOffsets[i]; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return nullptr; | ||||
| } | ||||
| 
 | ||||
| ExportOffset *ExportOffsetFindProperty(uint64_t objectID, const char *cPropertyName) { | ||||
| 	for (uintptr_t i = 0; i < exportOffsets.Length(); i++) { | ||||
| 		if (exportOffsets[i].objectID == objectID | ||||
|  | @ -1433,6 +1447,18 @@ void InspectorPopulate() { | |||
| 	UIParentPush(inspector); | ||||
| 
 | ||||
| 	Object *object = ObjectFind(selectedObjectID); | ||||
| 	size_t referenceCount = 0; | ||||
| 
 | ||||
| 	if (object) { | ||||
| 		for (uintptr_t i = 0; i < objects.Length(); i++) { | ||||
| 			for (uintptr_t j = 0; j < objects[i].properties.Length(); j++) { | ||||
| 				if (objects[i].properties[j].type == PROP_OBJECT  | ||||
| 						&& objects[i].properties[j].object == object->id) { | ||||
| 					referenceCount++; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if (object && object->type != OBJ_INSTANCE) { | ||||
| 		UIPanelCreate(0, UI_ELEMENT_PARENT_PUSH | UI_PANEL_BORDER | UI_PANEL_MEDIUM_SPACING | UI_PANEL_EXPAND); | ||||
|  | @ -1444,6 +1470,8 @@ void InspectorPopulate() { | |||
| 			UIButtonCreate(0, UI_BUTTON_SMALL, "Auto", -1)->invoke = InspectorAutoNameObject; | ||||
| 			UIButtonCreate(0, UI_BUTTON_SMALL, "Rename", -1)->invoke = InspectorRenameObject; | ||||
| 			UIParentPop(); | ||||
| 			snprintf(buffer, sizeof(buffer), "%ld references", referenceCount); | ||||
| 			UILabelCreate(0, 0, buffer, -1); | ||||
| 
 | ||||
| 			bool inheritWithAnimation = object->type == OBJ_VAR_TEXT_STYLE | ||||
| 				|| object->type == OBJ_LAYER_BOX || object->type == OBJ_LAYER_TEXT || object->type == OBJ_LAYER_PATH | ||||
|  | @ -3122,6 +3150,8 @@ void Export() { | |||
| 			continue; | ||||
| 		} | ||||
| 		 | ||||
| 		uint64_t styleObjectID = object->id; | ||||
| 
 | ||||
| 		Object *metrics = PropertyFindOrInheritReadObject(object, "metrics"); | ||||
| 		Object *textStyle = PropertyFindOrInheritReadObject(object, "textStyle"); | ||||
| 		Object *appearance = PropertyFindOrInheritReadObject(object, "appearance"); | ||||
|  | @ -3208,6 +3238,7 @@ void Export() { | |||
| 				if (!layerObject) continue; | ||||
| 
 | ||||
| 				ExportOffset exportOffset = {}; | ||||
| 				exportOffset.styleObjectID = styleObjectID; | ||||
| 				exportOffset.objectID = layerObject->id; | ||||
| 				exportOffset.offset = ftell(output); | ||||
| 				exportOffsets.Add(exportOffset); | ||||
|  | @ -3271,6 +3302,8 @@ void Export() { | |||
| 			continue; | ||||
| 		} | ||||
| 
 | ||||
| 		uint64_t styleObjectID = object->id; | ||||
| 
 | ||||
| 		ExportOffset exportOffset = {}; | ||||
| 		exportOffset.objectID = object->id; | ||||
| 		exportOffset.offset = ftell(output); | ||||
|  | @ -3292,7 +3325,7 @@ void Export() { | |||
| 				Property *layerProperty = PropertyFind(appearance, cPropertyName, PROP_OBJECT); | ||||
| 				Object *layerObject = ObjectFind(layerProperty ? layerProperty->object : 0); | ||||
| 				if (!layerObject) continue; | ||||
| 				uint32_t exportOffset = ExportOffsetFindObject(layerObject->id)->offset; | ||||
| 				uint32_t exportOffset = ExportOffsetFindObjectForStyle(layerObject->id, styleObjectID)->offset; | ||||
| 				fwrite(&exportOffset, 1, sizeof(exportOffset), output); | ||||
| 			} | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 nakst
						nakst