Skip to content

Commit

Permalink
- Make CHAT_AI OFF by default
Browse files Browse the repository at this point in the history
- Fixed tree view on Linux

Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eranif committed Nov 14, 2024
1 parent b480e0d commit 7556e81
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 33 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

option(WITH_CHATAI "Enable ChatAI plugin" ON)
option(WITH_CHATAI "Enable ChatAI plugin" OFF)

# Set this option to "ON" in order to get CMake standard/expected behavior
set(RETAIN_CACHED_VALUES
Expand Down Expand Up @@ -585,6 +585,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DebugFull)
set(DEBUG_BUILD 1)
set(CL_PCH_FILE "${CL_SRC_ROOT}/PCH/precompiled_header_dbg.h")
set(CL_PCH_TARGET "precompiled_header_dbg.h.gch")
set(BUILD_TYPE "Debug")

# Set the libraries output directory
set(CL_BIN_DIR bin)
Expand Down Expand Up @@ -884,6 +885,11 @@ endif()
# add the dtl module include path before we include Plugin folder
include_directories(submodules/dtl)

if (DEBUG_BUILD)
set(CMAKE_CXX_FLAGS_RELEASE "")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}")
endif()

add_subdirectory(submodules)
include_directories(submodules/cJSON)

Expand Down
2 changes: 2 additions & 0 deletions Plugin/clFileViwerTreeCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class WXDLLIMPEXP_SDK clTreeCtrlData : public wxTreeItemData
{
public:
enum eKind {
kDummy, // Dummy node item
kRoot, // This item is the root (non visible) item
kFile, // a file
kFolder, // a folder
Expand Down Expand Up @@ -124,6 +125,7 @@ class WXDLLIMPEXP_SDK clTreeCtrlData : public wxTreeItemData
// Aliases
bool IsFolder() const { return m_kind == kFolder; }
bool IsFile() const { return m_kind == kFile; }
bool IsDummy() const { return m_kind == kDummy; }
};

#include "bitmap_loader.h"
Expand Down
76 changes: 44 additions & 32 deletions Plugin/clTreeCtrlPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,43 +264,51 @@ void clTreeCtrlPanel::DoExpandItem(const wxTreeItemId& parent, bool expand)
// we only know how to expand folders...
if (!cd->IsFolder())
return;
wxString folderPath = cd->GetPath();

// Item already loaded?
if (m_treeCtrl->ItemHasChildren(parent))
return;
wxString folderPath = cd->GetPath();

// Get the top level folders
wxDir dir(folderPath);
if (!dir.IsOpened())
return;
// If this item has a dummy node - delete it
wxTreeItemIdValue cookie;
auto first_child = GetTreeCtrl()->GetFirstChild(parent, cookie);
if (first_child.IsOk() && GetItemData(first_child) && GetItemData(first_child)->IsDummy()) {
GetTreeCtrl()->DeleteChildren(parent);
}

wxBusyCursor bc;
wxString filename;
bool cont = dir.GetFirst(&filename, wxEmptyString);
while (cont) {
wxFileName fullpath(folderPath, filename);
// Make sure we don't add the same folder twice
if (wxFileName::DirExists(fullpath.GetFullPath())) {
// a folder
if (!(m_options & kShowHiddenFolders) && FileUtils::IsHidden(fullpath)) {
cont = dir.GetNext(&filename);
continue;
}
DoAddFolder(parent, fullpath.GetFullPath());
} else {
// make sure we don't add the same file twice
if (!(m_options & kShowHiddenFiles) && FileUtils::IsHidden(fullpath)) {
cont = dir.GetNext(&filename);
continue;
} else if (!m_excludeFilePatterns.empty() && FileUtils::WildMatch(m_excludeFilePatterns, fullpath)) {
// exclude this file?
cont = dir.GetNext(&filename);
continue;
// If there are no items, scan the disk
if (!GetTreeCtrl()->ItemHasChildren(parent)) {

// Get the top level folders
wxDir dir(folderPath);
if (!dir.IsOpened())
return;

wxBusyCursor bc;
wxString filename;
bool cont = dir.GetFirst(&filename, wxEmptyString);
while (cont) {
wxFileName fullpath(folderPath, filename);
// Make sure we don't add the same folder twice
if (wxFileName::DirExists(fullpath.GetFullPath())) {
// a folder
if (!(m_options & kShowHiddenFolders) && FileUtils::IsHidden(fullpath)) {
cont = dir.GetNext(&filename);
continue;
}
DoAddFolder(parent, fullpath.GetFullPath());
} else {
// make sure we don't add the same file twice
if (!(m_options & kShowHiddenFiles) && FileUtils::IsHidden(fullpath)) {
cont = dir.GetNext(&filename);
continue;
} else if (!m_excludeFilePatterns.empty() && FileUtils::WildMatch(m_excludeFilePatterns, fullpath)) {
// exclude this file?
cont = dir.GetNext(&filename);
continue;
}
DoAddFile(parent, fullpath.GetFullPath());
}
DoAddFile(parent, fullpath.GetFullPath());
cont = dir.GetNext(&filename);
}
cont = dir.GetNext(&filename);
}

// Sort the parent
Expand Down Expand Up @@ -409,6 +417,10 @@ wxTreeItemId clTreeCtrlPanel::DoAddFolder(const wxTreeItemId& parent, const wxSt

wxTreeItemId itemFolder = GetTreeCtrl()->AppendContainer(parent, displayName, imgIdx, imgOpenedIDx, cd);

// Append dummy item - this ensures that we have the + button for expanding the container item
clTreeCtrlData* dummy_client_data = new clTreeCtrlData(clTreeCtrlData::kDummy);
GetTreeCtrl()->AppendItem(itemFolder, "<dummy>", wxNOT_FOUND, wxNOT_FOUND, dummy_client_data);

// use grey text for hidden items
if (isHiddenFolder) {
// a hidden item, use a disabled colour
Expand Down

0 comments on commit 7556e81

Please sign in to comment.