summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/all.h16
-rw-r--r--src/include/functions.h128
-rw-r--r--src/include/layer.h3
-rw-r--r--src/include/main.h4
4 files changed, 15 insertions, 136 deletions
diff --git a/src/include/all.h b/src/include/all.h
index 7d7557a..82731ff 100644
--- a/src/include/all.h
+++ b/src/include/all.h
@@ -1,3 +1,9 @@
+
+static int32
+LayerIterate_TestSelection(project_state *State, memory *Memory, uint32 PrincipalIndex, layer_transforms ExtraT, v2 Center,
+ sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, bool32 BelowOnly);
+
+
// TODO(fox);: Incorporate sorting for non-continuous shapes.
static uint32
Bezier_Shape_Sort(memory *Memory, shape_layer *Shape, bezier_point *PointData,
@@ -353,13 +359,13 @@ Layer_GetDimensions(memory *Memory, block_layer *Layer, int *Width, int *Height)
static v2
Layer_TraverseForPoint(project_data *File, project_state *State, memory *Memory, v2 PrincipalCompUV, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 LayerIndex);
-// TODO(fox);: Precomps?
-static int32
-Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 PrincipalIndex, bool32 BelowOnly);
-
static bool32
Shape_TestBoxSelect(v2 Min, v2 Max, bezier_point *BezierPointData, uint32 BezierCount);
+static int32
+LayerIterate_TestSelection(project_state *State, memory *Memory, uint32 PrincipalIndex, layer_transforms ExtraT, v2 Center,
+ sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, bool32 BelowOnly);
+
static bool32
Transform_TestBox(block_layer *Layer, uint32 Width, uint32 Height, v2 Min, v2 Max);
@@ -601,7 +607,7 @@ static void
CopyStrings(void *Dest, void *Data);
static uint16
-String_AddToFile(memory *Memory, char *Char);
+String_AddToFile(memory *Memory, char *Char, bool32 NoUndo = 1);
static bool32
String_Compare(char *String1, char *String2, uint32 Length);
diff --git a/src/include/functions.h b/src/include/functions.h
deleted file mode 100644
index 3826824..0000000
--- a/src/include/functions.h
+++ /dev/null
@@ -1,128 +0,0 @@
-
-// Memory
-
-static void Memory_Copy(uint8 *Address_Write, uint8 *Address_Read, uint64 Size);
-static void Arbitrary_Zero(uint8 *Address_Write, uint64 Size);
-static void Arbitrary_SwapData(memory *Memory, uint8 *Address_0, uint8 *Address_1, uint64 Size);
-static void Arbitrary_ShiftData(uint8 *Address_Start, uint8 *Address_End, uint64 ShiftAmount, int32 Direction);
-
-void AV_Init(block_source *Source, av_info *AV, memory *Memory);
-
-// Rudimentary guess-until-correct solver for bezier curves, used to evaluate
-// the keyframe graph. Similar to the Catmull-Rom solver in CurvesSolver().
-
-static real32 Bezier_SolveYForX(v2 Point_P0, v2 Point_P1, v2 Point_P2, v2 Point_P3, real32 TargetX);
-static bezier_point * Bezier_LookupAddress(memory *Memory, property_channel *Property, uint16 Index, bool32 AssertExists = 1);
-static bezier_point * Bezier_LookupAddress(memory *Memory, uint16 *Block_Bezier_Index, uint16 Index, bool32 AssertExists);
-static void Bezier_Interact_Evaluate(project_state *State, bezier_point *PointAddress, v2 *Pos, real32 GraphZoomHeight = 1, real32 Y_Increment = 1);
-// NOTE(fox): GraphZoomHeight and Y_Increment don't have to be specified if the Y value isn't needed, i.e. in Property_SortAll().
-static void Bezier_Add(memory *Memory, memory_table_list TableName, property_channel *Property, bezier_point PointData, uint16 *ArrayLocation);
-static void Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, uint16 *PointCount, bezier_point PointData);
-
-static void
-Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDrawList *draw_list,
- sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray,
- sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray, uint32 CompIndex, int32 Frame_Current);
-
-static void *
-Memory_Block_AddressAtIndex(memory *Memory, memory_table_list TableName, uint32 Index, bool32 AssertExists = 1);
-
-static bool32
-Block_Loop(memory *Memory, memory_table_list TableName, uint32 TotalCount, int *HasIncremented, int *CurrentCount, int *Index);
-
-static void
-File_SaveAs(project_data *File, project_state *State, memory *Memory, char *Filename);
-
-static uint32
-Bezier_Shape_Sort(memory *Memory, shape_layer *Shape, bezier_point *PointData,
- project_state *State, layer_transforms T, int Width, int Height,
- int CompWidth, int CompHeight, bool32 Interact);
-
-void * Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 Size);
-
-static layer_transforms Transform_Inverse(layer_transforms T);
-
-static v2 T_CompPosToLayerPos(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, real32 X, real32 Y);
-
-static layer_transforms
-Transform_TestInteracts(project_state *State, block_layer *Layer, sorted_layer_array SortEntry, layer_transforms T);
-
-static layer_transforms
-Transform_Add(layer_transforms T, layer_transforms ExtraT, real32 Width, real32 Height);
-
-inline void
-ImGui_DrawCenteredRect(ImDrawList *draw_list, ImVec2 Point, real32 Width, uint32 col)
-
-static void ImGui_ProcessInputs(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_file Sorted);
-static void ImGui_PropertiesPanel(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray);
-static void
-ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, GLuint textureID,
- sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray);
-static void ImGui_Timeline(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray);
-
-static void ImGui_File(project_data *File, project_state *State, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray);
-static void ImGui_EffectsPanel(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO io);
-static void ImGui_ColorPanel(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io);
-
-static void ImGui_Menu(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io);
-static void ImGui_Popups(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io);
-static void ImGui_KeybindUI(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io);
-
-#if DEBUG
-static void ImGui_DebugMemoryViewer(memory *Memory, project_state *State);
-static void ImGui_DebugRenderQueue(project_state *State);
-static void ImGui_DebugUndoTree(memory *Memory, project_state *State);
-#endif
-#if SD
-static void ImGui_SD_Thumbnail(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 *SourceArray, uint16 SourceCount);
-static void ImGui_SD_Prompt(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray);
-#endif
-
-// Widgets not involving drawing UI.
-
-static v2 ImGui_ScreenPointToCompUV(ImVec2 ViewportMin, ImVec2 CompPos, ImVec2 CompZoom, ImVec2 MousePos);
-static void ImGui_WarpMouse(project_state *State, ImVec2 MousePos, ImVec2 Min, ImVec2 Max, int Direction = 3);
-static void ImGui_WarpMouseFinish(project_state *State, ImVec2 MousePos);
-static ImVec2 ImGui_Brush_CalcMousePos(project_state *State, ImGuiIO &io, ImVec2 MouseDelta, int32 i, real32 DeltaDistance, real32 DeltaSlope);
-static bool32 ImGui_TestBoxSelection_Point(ImVec2 Pos, ImGuiIO &io, bool32 *Test);
-
-
-static void
-Render_Main(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID,
- void *Data, void *OutputBuffer, render_type RenderType, rectangle RenderRegion);
-
-static void Effect_Curves_Init(block_effect *Effect, property_channel *Property);
-
-void AV_IsFileSupported(char *filename, bool32 *IsVideo, bool32 *HasAudio);
-
-static v2 T_CompUVToLayerUV(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, v2 CompUV);
-static header_effect* Effect_EntryFromID(project_state *State, char *ID);
-
-void Effect_Curves_Sort(memory *Memory, block_effect *Effect, uint16 *SortedPointStart, uint16 Which);
-inline v2 Effect_V2(memory *Memory, block_effect *Effect, int Offset);
-
-static void Interact_Transform_Begin(project_data *File, memory *Memory, project_state *State, ImVec2 OGPos, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray);
-
-static v2 Transform_ScreenSpaceToLocal(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, ImVec2 CompPos, ImVec2 CompZoom, ImVec2 ViewportMin, ImVec2 Point);
-static ImVec2 Layer_LocalToScreenSpace(project_state *State, memory *Memory, block_layer *Layer, ui *UI, uint32 PrincipalCompIndex, v2 Point);
-
-static v2 TransformPoint(layer_transforms T, real32 Width, real32 Height, v2 Point);
-
-static void Layer_GetDimensions(memory *Memory, block_layer *Layer, int *Width, int *Height);
-
-static void * Memory_PushScratch(memory *Memory, uint64 Size);
-
-static void Memory_PopScratch(memory *Memory, uint64 Size);
-
-void Bitmap_SwapData(uint8 *Address_0, uint8 *Address_1, uint64 Size, uint16 BytesPerPixel);
-void GL_DeleteHWBuffer(gl_effect_layer *Test);
-
-void GL_UpdateTexture(gl_effect_layer *Test, void *Data, uint16 Width, uint16 Height, uint16 BytesPerPixel, bool32 Multisample);
-
-static void Transform_ApplyInteractive(interact_transform Interact, real32 *OutputX, real32 *OutputY, real32 *OutputRotation, real32 *OutputScale);
-
-static layer_transforms Layer_GetTransforms(block_layer *Layer);
-void GL_GenAndBindTexture(GLuint *GLTexture, int Width, int Height, int BytesPerPixel, void *BufferAddress);
-
-static real32 Bezier_SolveYForX(v2 Point_P0, v2 Point_P1, v2 Point_P2, v2 Point_P3, real32 X);
-
diff --git a/src/include/layer.h b/src/include/layer.h
index d059bb6..d354c89 100644
--- a/src/include/layer.h
+++ b/src/include/layer.h
@@ -42,9 +42,6 @@ Layer_Select_Traverse(uint16 PrincipalCompIndex, memory *Memory, project_state *
static v2
Layer_TraverseForPoint(project_data *File, project_state *State, memory *Memory, v2 PrincipalCompUV, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 LayerIndex);
-static int32
-Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 PrincipalIndex, bool32 BelowOnly);
-
static void
Layer_RecursiveDeselect(memory *Memory, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 TargetIndex, uint16 PrincipalIndex);
diff --git a/src/include/main.h b/src/include/main.h
index 1f04d41..0ee8511 100644
--- a/src/include/main.h
+++ b/src/include/main.h
@@ -367,6 +367,7 @@ enum hotkey_input
hotkey_newlayer_paint,
hotkey_newlayer_shape,
hotkey_deletelayer,
+ hotkey_duplicatelayer,
hotkey_undo,
hotkey_redo,
};
@@ -533,6 +534,9 @@ struct project_state
void *Interact_Address;
int Interact_Count;
+ // whether duplicated layers get created above or below
+ int DuplicateDirection = -1;
+
ImGuiID RightDock;
// NOTE(fox): We need to keep track of when the user changes the CurrentValue of a