Boton ocultar, mas estilo
This commit is contained in:
parent
dbf0ebf76a
commit
4e5f53a3e9
1 changed files with 25 additions and 50 deletions
75
main.cpp
75
main.cpp
|
|
@ -109,14 +109,6 @@ int listDirectory(std::string path, std::vector<directoriesInfo*> *directoryCont
|
|||
}
|
||||
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && skipDueToExtension) continue;*/
|
||||
|
||||
//TODO Borrar legado
|
||||
// char* itemPath;
|
||||
// if (directoryContents->size() <= numFiles){
|
||||
// itemPath = (char*)calloc(1, MAX_PATH * sizeof(WCHAR));
|
||||
// directoryContents->push_back(itemPath);
|
||||
// } else {
|
||||
// itemPath = directoryContents->at(numFiles);
|
||||
// }
|
||||
directoriesInfo* itemInfo;
|
||||
if (directoryContents->size() <= numFiles){
|
||||
itemInfo = new directoriesInfo();
|
||||
|
|
@ -189,7 +181,6 @@ int explodePaths(TCHAR* volumePaths, int volumePathsBufferSize, char separator,
|
|||
|
||||
|
||||
int listVolumes(std::vector<char*> *onPresentPaths){
|
||||
//int listVolumes(){
|
||||
HANDLE hFind = INVALID_HANDLE_VALUE;
|
||||
const char separator = '\0';
|
||||
|
||||
|
|
@ -225,6 +216,7 @@ int listVolumes(std::vector<char*> *onPresentPaths){
|
|||
// std::cout << std::endl << "I IA" << std::endl;
|
||||
// exit(1);
|
||||
// }
|
||||
|
||||
if(numVolumes += explodePaths(volumePaths, volumePathsBufferSize, separator, onPresentPaths)){
|
||||
for (int i = 0; i < onPresentPaths->size(); i++){
|
||||
std::cout << onPresentPaths->at(i) << std::endl;
|
||||
|
|
@ -366,6 +358,7 @@ int main(int, char**)
|
|||
{
|
||||
ImGui::Begin("File Picker in 4K");
|
||||
|
||||
static bool isInvalidPath = false;
|
||||
static bool isListVolumesAdequate = true;
|
||||
static bool isListDirectoriesAdequate = true;
|
||||
|
||||
|
|
@ -406,48 +399,29 @@ int main(int, char**)
|
|||
numFiles = (listDirectory(std::string(currentPath), &directoryContents));//, &restrictToExe));
|
||||
//std::cout << numFiles;
|
||||
if (numFiles < 0) {
|
||||
//ImGui::Text("Path not valid");
|
||||
log_debugcpp("FALLO LA FUNCION, VALOR NEGATIVO");
|
||||
goto filepickerFailure;
|
||||
log_debugcpp("FALLO LA FUNCION, VALOR NEGATIVO " + std::to_string(numFiles));
|
||||
isInvalidPath = true;
|
||||
}
|
||||
|
||||
//displayContents = std::move(directoryContents);
|
||||
//directoryContents.clear();
|
||||
}
|
||||
|
||||
//It's renderin' time
|
||||
static bool showHidden = false;
|
||||
ImGui::Text("Select a file:");
|
||||
if (debug) ImGui::Text("%s TEMPADDRBAR", currentPath);
|
||||
|
||||
//Y a que los VOLUMENES pinta2 pa100pre
|
||||
//if (debug) std::cout << std::to_string(onPresentPaths.size()) + "<- numvols" << std::endl;
|
||||
if (numVolumes > 0) {
|
||||
for (int i = 0; i < onPresentPaths.size(); i++) {
|
||||
if (i > 0) ImGui::SameLine();
|
||||
// if (debug) std::cout << std::to_string(i) + "<- WE IN" << std::endl;
|
||||
// ImGui::PushID(i);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));
|
||||
if(ImGui::Button(onPresentPaths.at(i))){
|
||||
moveDirectory(&onPresentPaths.at(i));
|
||||
isListDirectoriesAdequate = true;
|
||||
}
|
||||
ImGui::PopStyleColor(3);
|
||||
// ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Permanentes e increiblemente utilitarios botones en Cuatro K
|
||||
//Permanentes e increiblemente utilitarios botones en Cuatro K: MOVE UP
|
||||
//c pervirtio con unicode std::wstring s(L"←→↑↓");
|
||||
static char moveUp[] = "..";
|
||||
static char* moveUpPtr = &moveUp[0];
|
||||
if(ImGui::Button("Move Up")){
|
||||
if(ImGui::Button("Move Up")) {
|
||||
moveDirectory(&moveUpPtr);
|
||||
isInvalidPath = false;
|
||||
isListDirectoriesAdequate = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
//BARRA DE DIRECCIONES
|
||||
ImGui::Text("%s TEMPADDRBAR", currentPath);
|
||||
|
||||
//LA GRAN TABLACIÓN: ACTOR EN LAS SOMBRAS
|
||||
static ImGuiTableFlags splitterTableFlags = ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV;
|
||||
if (ImGui::BeginTable("##splitterTable", 2, splitterTableFlags, ImVec2(-FLT_MIN, 0.8f * ImGui::GetTextLineHeightWithSpacing()))){
|
||||
|
|
@ -466,8 +440,6 @@ int main(int, char**)
|
|||
if (numVolumes > 0) {
|
||||
for (int i = 0; i < onPresentPaths.size(); i++) {
|
||||
ImGui::TableNextColumn();
|
||||
//if (i > 0) ImGui::SameLine();
|
||||
// if (debug) std::cout << std::to_string(i) + "<- WE IN" << std::endl;
|
||||
// ImGui::PushID(i);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.6f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.7f));
|
||||
|
|
@ -499,6 +471,8 @@ int main(int, char**)
|
|||
|
||||
int idx = 0;
|
||||
for (; idx < numFiles; idx++) {
|
||||
if(directoryContents.at(idx)->isHidden && !showHidden) continue;
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
|
|
@ -525,26 +499,27 @@ int main(int, char**)
|
|||
//ImGui::SetItemDefaultFocus();
|
||||
|
||||
}
|
||||
if (!idx) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("Folder is empty"); }
|
||||
//DISPLAYING ALTERNATIVE INFO
|
||||
if (!idx) {
|
||||
ImGui::TableNextRow(); ImGui::TableNextColumn();
|
||||
if (isInvalidPath) ImGui::Text("Failed to access: Path not valid");
|
||||
else ImGui::Text("Folder is empty");
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//ImGui::TreePop();
|
||||
|
||||
|
||||
ImGui::Checkbox("Show hidden", &showHidden);
|
||||
ImGui::SameLine();
|
||||
ImGui::Button("Select");
|
||||
filepickerFailure:
|
||||
|
||||
ImGui::Button("AAAAAAAAAAAAAAAAAAAAAAAAAQ" );
|
||||
|
||||
ImGui::End();
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue