浏览代码

tools-imgui: remove toolbar.{h,inl}

Daniele Bartolini 7 年之前
父节点
当前提交
8880e8e12b
共有 5 个文件被更改,包括 1 次插入158 次删除
  1. 0 1
      tools-imgui/imgui_user.h
  2. 0 1
      tools-imgui/imgui_user.inl
  3. 1 65
      tools-imgui/level_editor.cpp
  4. 0 6
      tools-imgui/widgets/toolbar.h
  5. 0 85
      tools-imgui/widgets/toolbar.inl

+ 0 - 1
tools-imgui/imgui_user.h

@@ -45,5 +45,4 @@ namespace ImGui
 #include "widgets/color_picker.h"
 #include "widgets/color_wheel.h"
 #include "widgets/dock.h"
-#include "widgets/toolbar.h"
 #include "widgets/console.h"

+ 0 - 1
tools-imgui/imgui_user.inl

@@ -74,5 +74,4 @@ namespace ImGui
 #include "widgets/color_picker.inl"
 #include "widgets/color_wheel.inl"
 #include "widgets/dock.inl"
-#include "widgets/toolbar.inl"
 #include "widgets/console.inl"

+ 1 - 65
tools-imgui/level_editor.cpp

@@ -820,9 +820,6 @@ struct LevelEditor
 	ImVec2 _main_menu_pos;
 	ImVec2 _main_menu_size;
 
-	ImVec2 _toolbar_pos;
-	ImVec2 _toolbar_size;
-
 	Console _console;
 	Inspector _inspector;
 	SceneView _scene_view;
@@ -845,8 +842,6 @@ struct LevelEditor
 		, _main_menu_pos(0, 0)
 		, _main_menu_size(0, 0)
 
-		, _toolbar_pos(0, 0)
-		, _toolbar_size(0, 0)
 		, _animator(source_dir)
 	{
 		ResourceManager* resman = device()->_resource_manager;
@@ -1037,7 +1032,7 @@ struct LevelEditor
 		}
 		ImGui::EndDock();
 
-		_sprite_importer.draw();
+		// _sprite_importer.draw();
 
 		imgui_end_frame();
 	}
@@ -1308,65 +1303,6 @@ struct LevelEditor
 			ImGui::EndMainMenuBar();
 		}
 	}
-
-	void toolbar()
-	{
-		if (ImGui::BeginToolbar("Toolbar", _toolbar_pos, _toolbar_size))
-		{
-			if (ImGui::ToolbarButton((void*)(uintptr_t)tool_place_texture->handle.idx, ImVec4(0, 0, 0, 0), "Place"))
-			{
-				_tool_type = tool::ToolType::PLACE;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)tool_move_texture->handle.idx, ImVec4(0, 0, 0, 0), "Move"))
-			{
-				_tool_type = tool::ToolType::MOVE;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)tool_rotate_texture->handle.idx, ImVec4(0, 0, 0, 0), "Rotate"))
-			{
-				_tool_type = tool::ToolType::ROTATE;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)tool_scale_texture->handle.idx, ImVec4(0, 0, 0, 0), "Scale"))
-			{
-				_tool_type = tool::ToolType::SCALE;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)axis_local_texture->handle.idx, ImVec4(0, 0, 0, 0), "Reference System: Local"))
-			{
-				_reference_system = tool::ReferenceSystem::LOCAL;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)axis_world_texture->handle.idx, ImVec4(0, 0, 0, 0), "Reference System: World"))
-			{
-				_reference_system = tool::ReferenceSystem::WORLD;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)axis_local_texture->handle.idx, ImVec4(0, 0, 0, 0), "Snap Mode: Relative"))
-			{
-				_snap_mode = tool::SnapMode::RELATIVE;
-				tool_send_state();
-			}
-
-			if (ImGui::ToolbarButton((void*)(uintptr_t)reference_world_texture->handle.idx, ImVec4(0, 0, 0, 0), "Snap Mode: Absolute"))
-			{
-				_snap_mode = tool::SnapMode::ABSOLUTE;
-				tool_send_state();
-			}
-
-			_toolbar_pos = ImGui::GetWindowPos();
-			_toolbar_size = ImGui::GetWindowSize();
-
-			ImGui::EndToolbar();
-		}
-	}
 };
 
 LevelEditor* s_editor;

+ 0 - 6
tools-imgui/widgets/toolbar.h

@@ -1,6 +0,0 @@
-namespace ImGui
-{
-	bool BeginToolbar(const char* str_id, ImVec2& pos, ImVec2& size);
-	void EndToolbar();
-	bool ToolbarButton(ImTextureID texture, const ImVec4& bg_color, const char* tooltip);
-}

+ 0 - 85
tools-imgui/widgets/toolbar.inl

@@ -1,85 +0,0 @@
-namespace ImGui
-{
-
-bool BeginToolbar(const char* str_id, ImVec2& pos, ImVec2& size)
-{
-	bool is_global = GImGui->CurrentWindowStack.Size == 1;
-	SetNextWindowPos(pos);
-	ImVec2 frame_padding = GetStyle().FramePadding;
-	PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
-	PushStyleVar(ImGuiStyleVar_WindowPadding, frame_padding);
-	PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
-	float padding = frame_padding.y * 2;
-	ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar
-	| ImGuiWindowFlags_NoMove
-	| ImGuiWindowFlags_NoResize
-	| ImGuiWindowFlags_NoScrollbar
-	| ImGuiWindowFlags_NoSavedSettings;
-
-	if (size.x == 0)
-		size.x = GetContentRegionAvailWidth();
-
-	SetNextWindowSize(size);
-
-	bool ret;
-	if (is_global)
-		ret = Begin(str_id, NULL, flags);
-	else
-		ret = BeginChild(str_id, size, false, flags);
-
-	PopStyleVar(3);
-
-	return ret;
-}
-
-void EndToolbar()
-{
-	ImVec2 frame_padding = ImGui::GetStyle().FramePadding;
-	PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
-	PushStyleVar(ImGuiStyleVar_WindowPadding, frame_padding);
-	PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
-
-	ImVec2 pos = GetWindowPos();
-	ImVec2 size = GetWindowSize();
-	if (GImGui->CurrentWindowStack.Size == 2)
-		End();
-	else
-		EndChild();
-
-	PopStyleVar(3);
-	ImGuiWindow* win = GetCurrentWindowRead();
-	if (GImGui->CurrentWindowStack.Size > 1)
-	{
-		ImVec2 addend(0, size.y + GetStyle().FramePadding.y * 2);
-		SetCursorScreenPos(ImVec2(pos.x + addend.x, pos.y + addend.y));
-	}
-}
-
-bool ToolbarButton(ImTextureID texture, const ImVec4& bg_color, const char* tooltip)
-{
-	ImVec2 frame_padding = ImGui::GetStyle().FramePadding;
-	ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0, 0, 0, 0));
-	ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
-	ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0));
-	ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
-	ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, frame_padding);
-	ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
-
-	bool ret = false;
-	ImGui::SameLine();
-	ImVec4 tint_color = ImGui::GetStyle().Colors[ImGuiCol_Text];
-	if (ImGui::ImageButton(texture, ImVec2(24, 24), ImVec2(0, 0), ImVec2(1, 1), -1, bg_color, tint_color))
-	{
-		ret = true;
-	}
-	if (ImGui::IsItemHovered())
-	{
-		ImGui::SetTooltip("%s", tooltip);
-	}
-	ImGui::PopStyleColor(3);
-	ImGui::PopStyleVar(3);
-	return ret;
-}
-
-
-} // namespace ImGui