mirror of
				https://bitbucket.org/mfeemster/fractorium.git
				synced 2025-10-27 23:40:31 -04:00 
			
		
		
		
	--Bug Fixes
-Fix strange spurious crash in library tab when switching between SP and DP. -Compensate for severe Qt bug where dragging and dropping disjoint items in the Library tree would resort the dropped items in special situations. -Move Info.plist to Data folder. -Ensure RTTI is included in build. -Add darker versions of .png icons.
This commit is contained in:
		| @ -70,6 +70,7 @@ | ||||
|       <MultiProcessorCompilation>true</MultiProcessorCompilation> | ||||
|       <MinimalRebuild>false</MinimalRebuild> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
| @ -99,6 +100,7 @@ | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <MinimalRebuild>false</MinimalRebuild> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|  | ||||
| @ -67,6 +67,7 @@ | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
| @ -97,6 +98,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)" | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|  | ||||
| @ -68,6 +68,7 @@ | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
| @ -96,6 +97,7 @@ | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|  | ||||
| @ -67,6 +67,7 @@ | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
| @ -97,6 +98,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)" | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|  | ||||
| @ -67,6 +67,7 @@ | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
| @ -98,6 +99,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)" | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|  | ||||
| @ -67,6 +67,7 @@ | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
| @ -97,6 +98,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)" | ||||
|       <StringPooling>true</StringPooling> | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|  | ||||
| @ -49,10 +49,10 @@ | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)Obj\$(TargetName)\$(Platform)\$(Configuration)\</IntDir> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <PostBuildEventUseInBuild>false</PostBuildEventUseInBuild> | ||||
|     <PostBuildEventUseInBuild>true</PostBuildEventUseInBuild> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <PostBuildEventUseInBuild>false</PostBuildEventUseInBuild> | ||||
|     <PostBuildEventUseInBuild>true</PostBuildEventUseInBuild> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
| @ -74,6 +74,7 @@ | ||||
|       <FloatingPointExceptions>false</FloatingPointExceptions> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
| @ -114,6 +115,7 @@ xcopy /F /Y /R /D "$(QTDIR)\plugins\platforms\qwindowsd.dll" "$(OutDir)\platform | ||||
|       <AdditionalOptions>/bigobj -Zm150 %(AdditionalOptions)</AdditionalOptions> | ||||
|       <BufferSecurityCheck>false</BufferSecurityCheck> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <RuntimeTypeInfo>true</RuntimeTypeInfo> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|  | ||||
| @ -34,6 +34,11 @@ public: | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	//~EmberTreeWidgetItemBase() | ||||
| 	//{ | ||||
| 	//	qDebug() << "~EmberTreeWidgetItemBase()"; | ||||
| 	//} | ||||
|  | ||||
| 	/// <summary> | ||||
| 	/// Set the preview image for the tree widget item. | ||||
| 	/// </summary> | ||||
|  | ||||
| @ -283,7 +283,11 @@ void FractoriumEmberController<T>::EmberTreeItemChanged(QTreeWidgetItem* item, i | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void Fractorium::OnEmberTreeItemChanged(QTreeWidgetItem* item, int col) { m_Controller->EmberTreeItemChanged(item, col); } | ||||
| void Fractorium::OnEmberTreeItemChanged(QTreeWidgetItem* item, int col) | ||||
| { | ||||
| 	if (ui.LibraryTree->topLevelItemCount())//This can sometimes be spurriously called even when the tree is empty. | ||||
| 		m_Controller->EmberTreeItemChanged(item, col); | ||||
| } | ||||
|  | ||||
| /// <summary> | ||||
| /// Set the current ember to the selected item. | ||||
| @ -301,12 +305,17 @@ void FractoriumEmberController<T>::EmberTreeItemDoubleClicked(QTreeWidgetItem* i | ||||
| 		SetEmber(m_Fractorium->ui.LibraryTree->currentIndex().row(), false); | ||||
| } | ||||
|  | ||||
| void Fractorium::OnEmberTreeItemDoubleClicked(QTreeWidgetItem* item, int col) { m_Controller->EmberTreeItemDoubleClicked(item, col); } | ||||
| void Fractorium::OnEmberTreeItemDoubleClicked(QTreeWidgetItem* item, int col) | ||||
| { | ||||
| 	if (ui.LibraryTree->topLevelItemCount())//This can sometimes be spurriously called even when the tree is empty. | ||||
| 		m_Controller->EmberTreeItemDoubleClicked(item, col); | ||||
| } | ||||
|  | ||||
| /// <summary> | ||||
| /// Move a library item at one index to the next index. | ||||
| /// Move a possibly disjoint selection of library items from their indices, | ||||
| /// to another index. | ||||
| /// </summary> | ||||
| /// <param name="startRow">The index of the source item to move</param> | ||||
| /// <param name="items">The selected list of items to move</param> | ||||
| /// <param name="destRow">The destination index to move the item to</param> | ||||
| template <typename T> | ||||
| void FractoriumEmberController<T>::MoveLibraryItems(const QModelIndexList& items, int destRow) | ||||
| @ -315,17 +324,16 @@ void FractoriumEmberController<T>::MoveLibraryItems(const QModelIndexList& items | ||||
| 	auto startRow = items[0].row(); | ||||
| 	auto tree = m_Fractorium->ui.LibraryTree; | ||||
| 	auto top = tree->topLevelItem(0); | ||||
| 	list<QString> names; | ||||
| 	list<string> names; | ||||
|  | ||||
| 	for (auto& item : items) | ||||
| 		if (auto temp = m_EmberFile.Get(item.row())) | ||||
| 			names.push_back(QString::fromStdString(temp->m_Name)); | ||||
| 			names.push_back(temp->m_Name); | ||||
|  | ||||
| 	auto b = m_EmberFile.m_Embers.begin(); | ||||
| 	auto result = Gather(b, m_EmberFile.m_Embers.end(), Advance(b, destRow), [&](const Ember<T>& ember) | ||||
| 	{ | ||||
| 		auto qname = QString::fromStdString(ember.m_Name); | ||||
| 		auto position = std::find(names.begin(), names.end(), qname); | ||||
| 		auto position = std::find(names.begin(), names.end(), ember.m_Name); | ||||
|  | ||||
| 		if (position != names.end()) | ||||
| 		{ | ||||
| @ -335,7 +343,9 @@ void FractoriumEmberController<T>::MoveLibraryItems(const QModelIndexList& items | ||||
|  | ||||
| 		return false; | ||||
| 	}); | ||||
| 	tree->update(); | ||||
| 	SyncLibrary(eLibraryUpdate(eLibraryUpdate::INDEX | eLibraryUpdate::POINTER)); | ||||
| 	//SyncLibrary(eLibraryUpdate(eLibraryUpdate::INDEX | eLibraryUpdate::POINTER | eLibraryUpdate::NAME)); | ||||
| } | ||||
|  | ||||
| /// <summary> | ||||
| @ -496,7 +506,11 @@ void FractoriumEmberController<T>::SequenceTreeItemChanged(QTreeWidgetItem* item | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void Fractorium::OnSequenceTreeItemChanged(QTreeWidgetItem* item, int col) { m_Controller->SequenceTreeItemChanged(item, col); } | ||||
| void Fractorium::OnSequenceTreeItemChanged(QTreeWidgetItem* item, int col) | ||||
| { | ||||
| 	if (ui.SequenceTree->topLevelItemCount()) | ||||
| 		m_Controller->SequenceTreeItemChanged(item, col); | ||||
| } | ||||
|  | ||||
| /// <summary> | ||||
| /// Wrapper around calling RenderPreviews with the appropriate values passed in for the previews in the sequence tree. | ||||
|  | ||||
| @ -683,6 +683,7 @@ bool Fractorium::CreateControllerFromOptions() | ||||
| 		Palette<float> tempPalette; | ||||
| #endif | ||||
| 		QModelIndex index = ui.LibraryTree->currentIndex(); | ||||
| 		ui.LibraryTree->clear();//This must be here before FillLibraryTree() is called below, else a spurious EmberTreeItemChanged event will be called on a deleted object. | ||||
|  | ||||
| 		//First check if a controller has already been created, and if so, save its embers and gracefully shut it down. | ||||
| 		if (m_Controller.get()) | ||||
| @ -716,6 +717,12 @@ bool Fractorium::CreateControllerFromOptions() | ||||
| 				prev->m_Palette = tempPalette; | ||||
|  | ||||
| 			m_Controller->SetEmberFile(efd, true); | ||||
| 			//Template specific palette table and variations tree setup in controller constructor, but | ||||
| 			//must manually setup the library tree here because it's after the embers were assigned. | ||||
| 			//Passing row re-selects the item that was previously selected. | ||||
| 			//This will eventually call FillParamTablesAndPalette(), which in addition to filling in various fields, | ||||
| 			//will apply the palette adjustments. | ||||
| 			m_Controller->FillLibraryTree(index.row()); | ||||
| 			m_Controller->SetEmber(current, true); | ||||
| 			m_Controller->LockedScale(scale); | ||||
| 			//Setting these and updating the GUI overwrites the work of clearing them done in SetEmber() above. | ||||
| @ -727,12 +734,6 @@ bool Fractorium::CreateControllerFromOptions() | ||||
| 			m_PaletteBlurSpin->SetValueStealth(blur); | ||||
| 			m_PaletteFrequencySpin->SetValueStealth(freq); | ||||
| 			m_Controller->PaletteAdjust();//Applies the adjustments to temp and saves in m_Ember.m_Palette, then fills in the palette preview widget. | ||||
| 			//Template specific palette table and variations tree setup in controller constructor, but | ||||
| 			//must manually setup the library tree here because it's after the embers were assigned. | ||||
| 			//Passing row re-selects the item that was previously selected. | ||||
| 			//This will eventually call FillParamTablesAndPalette(), which in addition to filling in various fields, | ||||
| 			//will apply the palette adjustments. | ||||
| 			m_Controller->FillLibraryTree(index.row()); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @ -773,5 +774,5 @@ bool Fractorium::ControllersOk() { return m_Controller.get() && m_Controller->GL | ||||
| template class FractoriumEmberController<float>; | ||||
|  | ||||
| #ifdef DO_DOUBLE | ||||
| template class FractoriumEmberController<double>; | ||||
| 	template class FractoriumEmberController<double>; | ||||
| #endif | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 23 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 8.0 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.3 KiB | 
| @ -27,14 +27,70 @@ void LibraryTreeWidget::dropEvent(QDropEvent* de) | ||||
| 	} | ||||
| 	else if (!items.empty())//Actually do the drop and move the item to a new location. | ||||
| 	{ | ||||
| 		int row = droppedIndex.row(); | ||||
| 		// get the list of the items that are about to be dragged | ||||
| 		int i, row = droppedIndex.row(); | ||||
| 		DropIndicatorPosition dp = dropIndicatorPosition(); | ||||
| 		QList<QTreeWidgetItem*> dragItems = selectedItems(); | ||||
|  | ||||
| 		if (dp == QAbstractItemView::BelowItem) | ||||
| 			row++; | ||||
|  | ||||
| 		auto itemat = this->itemFromIndex(droppedIndex); | ||||
| 		QTreeWidget::dropEvent(de);//This internally changes the order of the items. | ||||
|  | ||||
| 		//Qt has a long standing major bug that rearranges the order of disjoint selections when | ||||
| 		//The drop location is in between the disjoint regions. | ||||
| 		//This is an attempt to correct for that bug by removing the dropped items, then re-inserting them | ||||
| 		//in the order they were selected. | ||||
| 		//This bug remains present as of Qt 5.8: https://bugreports.qt.io/browse/QTBUG-45320 | ||||
| 		if (auto top = topLevelItem(0)) | ||||
| 		{ | ||||
| 			if (itemat) | ||||
| 			{ | ||||
| 				auto offsetitem = this->indexFromItem(itemat); | ||||
|  | ||||
| 				if (dp == QAbstractItemView::BelowItem) | ||||
| 				{ | ||||
| 					auto itemrow = offsetitem.row() + 1; | ||||
|  | ||||
| 					for (i = 0; i < dragItems.size(); i++) | ||||
| 					{ | ||||
| 						if (itemrow < top->childCount()) | ||||
| 							top->takeChild(itemrow); | ||||
| 					} | ||||
|  | ||||
| 					for (i = 0; i < dragItems.size(); i++) | ||||
| 					{ | ||||
| 						auto offset = i + itemrow; | ||||
|  | ||||
| 						if (offset <= top->childCount()) | ||||
| 							top->insertChild(offset, dragItems[i]); | ||||
| 					} | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					auto itemrow = offsetitem.row();//Will be at least 1 if dropped above it. | ||||
| 					auto offset = itemrow; | ||||
|  | ||||
| 					for (i = 0; i < dragItems.size(); i++) | ||||
| 					{ | ||||
| 						offset--; | ||||
|  | ||||
| 						if (offset < top->childCount()) | ||||
| 							top->takeChild(offset); | ||||
| 					} | ||||
|  | ||||
| 					for (i = 0; i < dragItems.size(); i++) | ||||
| 					{ | ||||
| 						if (offset <= top->childCount()) | ||||
| 							top->insertChild(offset, dragItems[i]); | ||||
|  | ||||
| 						offset++; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		QTimer::singleShot(500, [ = ]() { m_Fractorium->m_Controller->MoveLibraryItems(items, row); });//Need to fire this after this event has internally reshuffled the items. | ||||
| 	} | ||||
|  | ||||
| 	QTreeWidget::dropEvent(de); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Person
					Person