From c5a60e71f9ed869467e2090f4b343641b021386a Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sat, 26 Nov 2022 23:52:57 -0500 Subject: keybind refinement --- createcalls.cpp | 66 ++++----------------------------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) (limited to 'createcalls.cpp') diff --git a/createcalls.cpp b/createcalls.cpp index 1eac4cc..de81c1e 100644 --- a/createcalls.cpp +++ b/createcalls.cpp @@ -5,67 +5,6 @@ PostMsg(project_state *State, char *msg) State->Msg = msg; } -/* -static bool32 -File_Open(project_state *State, memory *Memory, char *Filename) -{ - // uint16 ContextIndex = State->NumberOfOpenFiles; - // State->CurrentFileIndex = State->NumberOfOpenFiles; - uint16 ContextIndex = 0; - State->CurrentFileIndex = 0; - - if (!State->NumberOfOpenFiles) { - Memory_AddPartition(Memory, P_UndoBuffer); - Memory_AddPartition(Memory, F_Data); - Memory_AddPartition(Memory, F_BitmapData); - } - - state_file_context *Context = &State->Context[ContextIndex]; - file_data *File = (file_data *)Memory_PartitionAtIndex(Memory, F_Data, ContextIndex); - - SDL_RWops *FileHandle = SDL_RWFromFile(Filename, "r+b"); - - if (!FileHandle) { - return 0; - } - - int64 FileSize = SDL_RWsize(FileHandle); - - IO_ReadFromStream((void *)File, sizeof(file_data), FileHandle); - SDL_RWseek(FileHandle, 0, RW_SEEK_SET); - IO_ReadFromStream((void *)File, File->Bitmap_ByteOffset, FileHandle); - - void *CompressedLocation = Memory_PushScratch(Memory, File->CompressedSize); - void *BitmapLocation = Memory_PartitionAtIndex(Memory, F_BitmapData, ContextIndex); - - IO_ReadFromStream(CompressedLocation, File->CompressedSize, FileHandle); - - uint64 Bitmap_Size = Source_GetByteOffset(File, File->NumberOfSources); - - Data_Decompress(Memory, CompressedLocation, File->CompressedSize, BitmapLocation, Bitmap_Size); - - Memory_PopScratch(Memory, File->CompressedSize); - - SDL_RWclose(FileHandle); - - Context->UI.Initializing = 4; - - if (!State->NumberOfOpenFiles) { - History_Entry_Commit(Memory, ContextIndex, "Open file"); - History_Action_State_Swap(Memory, sizeof(State->NumberOfOpenFiles), &State->NumberOfOpenFiles); - State->NumberOfOpenFiles++; - History_Entry_End(Memory, ContextIndex); - } - - sprintf(State->Context[0].Filename, "%s", Filename); - Memory->IsFileSaved = true; - Memory->History[0].NumberOfEntries = 0; - Memory->History[0].EntryPlayhead = 0; - - return 1; -} -*/ - static bool32 File_Open(project_data *File, project_state *State, memory *Memory, char *Filename) { @@ -92,6 +31,9 @@ File_Open(project_data *File, project_state *State, memory *Memory, char *Filena } } String_Copy(State->Filename, State->DummyName, 512); + State->Initializing = 4; + Memory->History.NumberOfEntries = 0; + Memory->History.EntryPlayhead = 0; return 1; } @@ -608,7 +550,7 @@ int32 Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_c block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical); block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, Layer->Block_Source_Index); layer_transforms T = Layer_GetTransforms(Layer); - v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, UI->TempZoomRatio); + v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, State->TempZoomRatio); if (UV.x <= 1.0f && UV.x >= 0.0f && UV.y <= 1.0f && UV.y >= 0.0f && !Layer->IsSelected) { LayerIndex = Index_Physical; -- cgit v1.2.3