Branimir Karadžić 9 лет назад
Родитель
Сommit
f7f7eb570f
1 измененных файлов с 22 добавлено и 45 удалено
  1. 22 45
      3rdparty/ocornut-imgui/widgets/dock.inl

+ 22 - 45
3rdparty/ocornut-imgui/widgets/dock.inl

@@ -43,7 +43,6 @@ namespace ImGui
 			Slot_None
 		};
 
-
 		enum EndAction_
 		{
 			EndAction_None,
@@ -52,7 +51,6 @@ namespace ImGui
 			EndAction_EndChild
 		};
 
-
 		enum Status_
 		{
 			Status_Docked,
@@ -60,7 +58,6 @@ namespace ImGui
 			Status_Dragged
 		};
 
-
 		struct Dock
 		{
 			Dock()
@@ -79,9 +76,10 @@ namespace ImGui
 				children[0] = children[1] = NULL;
 			}
 
-
-			~Dock() { MemFree(label); }
-
+			~Dock()
+			{
+				MemFree(label);
+			}
 
 			ImVec2 getMinSize() const
 			{
@@ -93,9 +91,10 @@ namespace ImGui
 					: ImVec2(ImMax(s0.x, s1.x), s0.y + s1.y);
 			}
 
-
-			bool isHorizontal() const { return children[0]->pos.x < children[1]->pos.x; }
-
+			bool isHorizontal() const
+			{
+				return children[0]->pos.x < children[1]->pos.x;
+			}
 
 			void setParent(Dock* dock)
 			{
@@ -104,7 +103,6 @@ namespace ImGui
 				for (Dock* tmp = next_tab; tmp; tmp = tmp->next_tab) tmp->parent = dock;
 			}
 
-
 			Dock& getSibling()
 			{
 				IM_ASSERT(parent);
@@ -112,7 +110,6 @@ namespace ImGui
 				return *parent->children[0];
 			}
 
-
 			Dock& getFirstTab()
 			{
 				Dock* tmp = this;
@@ -120,7 +117,6 @@ namespace ImGui
 				return *tmp;
 			}
 
-
 			void setActive()
 			{
 				active = true;
@@ -128,9 +124,10 @@ namespace ImGui
 				for (Dock* tmp = next_tab; tmp; tmp = tmp->next_tab) tmp->active = false;
 			}
 
-
-			bool isContainer() const { return children[0] != NULL; }
-
+			bool isContainer() const
+			{
+				return children[0] != NULL;
+			}
 
 			void setChildrenPosSize(const ImVec2& _pos, const ImVec2& _size)
 			{
@@ -196,7 +193,6 @@ namespace ImGui
 				setChildrenPosSize(_pos, _size);
 			}
 
-
 			ImU32   id;
 			char*   label;
 			Dock*   next_tab;
@@ -215,16 +211,21 @@ namespace ImGui
 			bool  first;
 		};
 
-
 		ImVector<Dock*> m_docks;
 		ImVec2 m_drag_offset;
-		Dock* m_current = NULL;
-		int m_last_frame = 0;
+		Dock* m_current;
+		int m_last_frame;
 		EndAction_ m_end_action;
 
+		DockContext()
+			: m_current(NULL)
+			, m_last_frame(0)
+		{
+		}
 
-		~DockContext() {}
-
+		~DockContext()
+		{
+		}
 
 		Dock& getDock(const char* label, bool opened)
 		{
@@ -252,7 +253,6 @@ namespace ImGui
 			return *new_dock;
 		}
 
-
 		void putInBackground()
 		{
 			ImGuiWindow* win = GetCurrentWindow();
@@ -273,7 +273,6 @@ namespace ImGui
 			}
 		}
 
-
 		void splits()
 		{
 			if (GetFrameCount() == m_last_frame)
@@ -338,7 +337,6 @@ namespace ImGui
 			}
 		}
 
-
 		void checkNonexistent()
 		{
 			int frame_limit = ImMax(0, ImGui::GetFrameCount() - 2);
@@ -360,7 +358,6 @@ namespace ImGui
 			}
 		}
 
-
 		void beginPanel()
 		{
 			ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
@@ -386,7 +383,6 @@ namespace ImGui
 			checkNonexistent();
 		}
 
-
 		void endPanel()
 		{
 			End();
@@ -410,7 +406,6 @@ namespace ImGui
 			return NULL;
 		}
 
-
 		static ImRect getDockedRect(const ImRect& rect, Slot_ dock_slot)
 		{
 			ImVec2 half_size = rect.GetSize() * 0.5f;
@@ -424,7 +419,6 @@ namespace ImGui
 			}
 		}
 
-
 		static ImRect getSlotRect(ImRect parent_rect, Slot_ dock_slot)
 		{
 			ImVec2 size = parent_rect.Max - parent_rect.Min;
@@ -439,7 +433,6 @@ namespace ImGui
 			}
 		}
 
-
 		static ImRect getSlotRectOnBorder(ImRect parent_rect, Slot_ dock_slot)
 		{
 			ImVec2 size = parent_rect.Max - parent_rect.Min;
@@ -464,7 +457,6 @@ namespace ImGui
 			return ImRect();
 		}
 
-
 		Dock* getRootDock()
 		{
 			for (int i = 0; i < m_docks.size(); ++i)
@@ -478,7 +470,6 @@ namespace ImGui
 			return NULL;
 		}
 
-
 		bool dockSlots(Dock& dock, Dock* dest_dock, const ImRect& rect, bool on_border)
 		{
 			ImDrawList* canvas = GetWindowDrawList();
@@ -505,7 +496,6 @@ namespace ImGui
 			return false;
 		}
 
-
 		void handleDrag(Dock& dock)
 		{
 			Dock* dest_dock = getDockAt(GetIO().MousePos);
@@ -555,7 +545,6 @@ namespace ImGui
 			End();
 		}
 
-
 		void fillLocation(Dock& dock)
 		{
 			if (dock.status == Status_Float) return;
@@ -570,7 +559,6 @@ namespace ImGui
 			*c = 0;
 		}
 
-
 		void doUndock(Dock& dock)
 		{
 			if (dock.prev_tab)
@@ -636,7 +624,6 @@ namespace ImGui
 			dock.prev_tab = dock.next_tab = NULL;
 		}
 
-
 		void drawTabbarListButton(Dock& dock)
 		{
 			if (!dock.next_tab) return;
@@ -676,7 +663,6 @@ namespace ImGui
 					hovered ? color_active : text_color);
 		}
 
-
 		bool tabbar(Dock& dock, bool close_button)
 		{
 			float tabbar_height = 2 * GetTextLineHeightWithSpacing();
@@ -758,7 +744,6 @@ namespace ImGui
 			return tab_closed;
 		}
 
-
 		static void setDockPosSize(Dock& dest, Dock& dock, Slot_ dock_slot, Dock& container)
 		{
 			IM_ASSERT(!dock.prev_tab && !dock.next_tab && !dock.children[0] && !dock.children[1]);
@@ -803,7 +788,6 @@ namespace ImGui
 			}
 		}
 
-
 		void doDock(Dock& dock, Dock* dest, Slot_ dock_slot)
 		{
 			IM_ASSERT(!dock.parent);
@@ -867,7 +851,6 @@ namespace ImGui
 			dock.setActive();
 		}
 
-
 		void rootDock(const ImVec2& pos, const ImVec2& size)
 		{
 			Dock* root = getRootDock();
@@ -878,14 +861,12 @@ namespace ImGui
 			root->setPosSize(pos, ImMax(min_size, requested_size));
 		}
 
-
 		void setDockActive()
 		{
 			IM_ASSERT(m_current);
 			if (m_current) m_current->setActive();
 		}
 
-
 		static Slot_ getSlotFromLocationCode(char code)
 		{
 			switch (code)
@@ -897,7 +878,6 @@ namespace ImGui
 			}
 		}
 
-
 		static char getLocationCode(Dock* dock)
 		{
 			if (!dock) return '0';
@@ -916,7 +896,6 @@ namespace ImGui
 			}
 		}
 
-
 		void tryDockToStoredLocation(Dock& dock)
 		{
 			if (dock.status == Status_Docked) return;
@@ -937,7 +916,6 @@ namespace ImGui
 			doDock(dock, tmp ? tmp : prev, tmp && !tmp->children[0] ? Slot_Tab : getSlotFromLocationCode(*c));
 		}
 
-
 		bool begin(const char* label, bool* opened, ImGuiWindowFlags extra_flags)
 		{
 			Dock& dock = getDock(label, !opened || *opened);
@@ -1029,7 +1007,6 @@ namespace ImGui
 			return ret;
 		}
 
-
 		void end()
 		{
 			if (m_end_action == EndAction_End)